]> git.sesse.net Git - vlc/blob - include/intf_msg.h
Some heavy changes today:
[vlc] / include / intf_msg.h
1 /*****************************************************************************
2  * intf_msg.h: messages interface
3  * This library provides basic functions for threads to interact with user
4  * interface, such as message output. See config.h for output configuration.
5  *****************************************************************************
6  * Copyright (C) 1999, 2000 VideoLAN
7  * $Id: intf_msg.h,v 1.17 2001/12/30 07:09:54 sam Exp $
8  *
9  * Authors: Vincent Seguin <seguin@via.ecp.fr>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  * 
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
24  *****************************************************************************/
25
26 /*****************************************************************************
27  * intf_DbgMsg macros and functions
28  *****************************************************************************
29  * The intf_DbgMsg* functions are defined as macro to be able to use the
30  * compiler extensions and print the file, the function and the line number
31  * from which they have been called. They call _intf_DbgMsg*() functions after
32  * having added debugging informations.
33  * Outside trace mode, intf_DbgMsg* functions do nothing.
34  *****************************************************************************/
35 #ifdef TRACE
36
37 /* TRACE mode */
38 void    _intf_DbgMsg        ( char *psz_file, char *psz_function, int i_line,
39                               char *psz_format, ... );
40 void    _intf_DbgMsgImm     ( char *psz_file, char *psz_function, int i_line,
41                               char *psz_format, ... );
42
43 #define intf_DbgMsg( format, args... ) \
44     _intf_DbgMsg( __FILE__, __FUNCTION__, __LINE__, format, ## args )
45 #define intf_DbgMsgImm( format, args... ) \
46     _intf_DbgMsg( __FILE__, __FUNCTION__, __LINE__, format, ## args )
47
48 #else
49
50 /* Non-TRACE mode */
51 #if defined( _MSC_VER )
52 #   define intf_DbgMsg
53 #   define intf_DbgMsgImm
54 #else
55 #   define intf_DbgMsg( format, args... )
56 #   define intf_DbgMsgImm( format, args...)
57 #endif
58
59 #endif
60
61 /*****************************************************************************
62  * intf_FlushMsg macro and function
63  *****************************************************************************
64  * intf_FlushMsg is a function which flushs message queue and print all messages
65  * remaining. It is only useful if INTF_MSG_QUEUE is defined. In this case, it
66  * is really a function. In the other case, it is a macro doing nothing.
67  *****************************************************************************/
68 #ifdef INTF_MSG_QUEUE
69
70 /* Message queue mode */
71 void    intf_FlushMsg       ( void );
72
73 #else
74
75 /* Direct mode */
76 #define intf_FlushMsg()     ;
77
78 #endif
79
80 /*****************************************************************************
81  * Prototypes
82  *****************************************************************************/
83 #ifndef PLUGIN
84 p_intf_msg_t intf_MsgCreate      ( void );
85 void         intf_MsgDestroy     ( void );
86
87 void         intf_Msg            ( char *psz_format, ... );
88 void         intf_ErrMsg         ( char *psz_format, ... );
89 void         intf_WarnMsg        ( int i_level, char *psz_format, ... );
90 void         intf_StatMsg        ( char *psz_format, ... );
91
92 void         intf_MsgImm         ( char *psz_format, ... );
93 void         intf_ErrMsgImm      ( char *psz_format, ... );
94 void         intf_WarnMsgImm     ( int i_level, char *psz_format, ... );
95 void         intf_WarnHexDump    ( int i_level, void *p_data, int i_size );
96 #else
97 #   define intf_Msg p_symbols->intf_Msg
98 #   define intf_ErrMsg p_symbols->intf_ErrMsg
99 #   define intf_StatMsg p_symbols->intf_StatMsg
100 #   define intf_WarnMsg p_symbols->intf_WarnMsg
101 #   define intf_WarnMsgImm p_symbols->intf_WarnMsgImm
102 #   ifdef TRACE
103 #       undef  intf_DbgMsg
104 #       undef  intf_DbgMsgImm
105 #       define intf_DbgMsg( format, args... ) \
106         p_symbols->intf_DbgMsg( __FILE__, __FUNCTION__, \
107                                 __LINE__, format, ## args )
108 #       define intf_DbgMsgImm( format, args... ) \
109             p_symbols->intf_DbgMsgImm( __FILE__, __FUNCTION__, \
110                                        __LINE__, format, ## args )
111 #   endif
112
113 #endif
114