1 /*****************************************************************************
2 * messages.h: messages interface
3 * This library provides basic functions for threads to interact with user
4 * interface, such as message output.
5 *****************************************************************************
6 * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
7 * $Id: vlc_messages.h,v 1.9 2003/12/03 23:01:48 sigmunau Exp $
9 * Authors: Vincent Seguin <seguin@via.ecp.fr>
10 * Samuel Hocevar <sam@zoy.org>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
25 *****************************************************************************/
29 * \defgroup messages Messages
30 * This library provides basic functions for threads to interact with user
31 * interface, such as message output.
38 * Store a single message.
42 int i_type; /**< message type, see below */
46 char * psz_msg; /**< the message itself */
49 mtime_t date; /* date of the message */
50 char * psz_file; /* file in which the function was called */
51 char * psz_function; /* function from which the function was called */
52 int i_line; /* line at which the function was called */
57 /** standard messages */
58 #define VLC_MSG_INFO 0
61 /** warning messages */
62 #define VLC_MSG_WARN 2
67 * Store all data requiered by messages interfaces.
71 /** Message queue lock */
73 vlc_bool_t b_configured;
74 vlc_bool_t b_overflow;
77 msg_item_t msg[VLC_MSG_QSIZE]; /**< message queue */
83 msg_subscription_t **pp_sub;
85 /* Logfile for WinCE */
92 * Used by interface plugins which subscribe to the message bank.
94 struct msg_subscription_t
103 /*****************************************************************************
105 *****************************************************************************/
106 VLC_EXPORT( void, __msg_Generic, ( vlc_object_t *, int, const char *, const char *, ... ) ATTRIBUTE_FORMAT( 4, 5 ) );
107 VLC_EXPORT( void, __msg_Info, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) );
108 VLC_EXPORT( void, __msg_Err, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) );
109 VLC_EXPORT( void, __msg_Warn, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) );
110 VLC_EXPORT( void, __msg_Dbg, ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) );
112 #ifdef HAVE_VARIADIC_MACROS
114 # define msg_Info( p_this, psz_format, args... ) \
115 __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_INFO, MODULE_STRING, \
116 psz_format, ## args )
118 # define msg_Err( p_this, psz_format, args... ) \
119 __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_ERR, MODULE_STRING, \
120 psz_format, ## args )
122 # define msg_Warn( p_this, psz_format, args... ) \
123 __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_WARN, MODULE_STRING, \
124 psz_format, ## args )
126 # define msg_Dbg( p_this, psz_format, args... ) \
127 __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_DBG, MODULE_STRING, \
128 psz_format, ## args )
130 #else /* HAVE_VARIADIC_MACROS */
132 # define msg_Info __msg_Info
133 # define msg_Err __msg_Err
134 # define msg_Warn __msg_Warn
135 # define msg_Dbg __msg_Dbg
137 #endif /* HAVE_VARIADIC_MACROS */
139 #define msg_Create(a) __msg_Create(VLC_OBJECT(a))
140 #define msg_Flush(a) __msg_Flush(VLC_OBJECT(a))
141 #define msg_Destroy(a) __msg_Destroy(VLC_OBJECT(a))
142 void __msg_Create ( vlc_object_t * );
143 void __msg_Flush ( vlc_object_t * );
144 void __msg_Destroy ( vlc_object_t * );
146 #define msg_Subscribe(a) __msg_Subscribe(VLC_OBJECT(a))
147 #define msg_Unsubscribe(a,b) __msg_Unsubscribe(VLC_OBJECT(a),b)
148 VLC_EXPORT( msg_subscription_t*, __msg_Subscribe, ( vlc_object_t * ) );
149 VLC_EXPORT( void, __msg_Unsubscribe, ( vlc_object_t *, msg_subscription_t * ) );