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.1 2002/06/01 12:31:58 sam 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 /*****************************************************************************
31 *****************************************************************************
32 * Store a single message.
33 *****************************************************************************/
36 int i_type; /* message type, see below */
38 char * psz_msg; /* the message itself */
41 mtime_t date; /* date of the message */
42 char * psz_file; /* file in which the function was called */
43 char * psz_function; /* function from which the function was called */
44 int i_line; /* line at which the function was called */
49 #define VLC_MSG_INFO 0 /* standard messages */
50 #define VLC_MSG_ERR 1 /* error messages */
51 #define VLC_MSG_WARN 2 /* warning messages */
52 #define VLC_MSG_DBG 3 /* debug messages */
54 /*****************************************************************************
56 *****************************************************************************
57 * Store all data requiered by messages interfaces.
58 *****************************************************************************/
61 /* Message queue lock */
65 msg_item_t msg[VLC_MSG_QSIZE]; /* message queue */
71 msg_subscription_t **pp_sub;
74 /*****************************************************************************
76 *****************************************************************************
77 * Used by interface plugins which subscribe to the message bank.
78 *****************************************************************************/
79 struct msg_subscription_s
88 /*****************************************************************************
90 *****************************************************************************/
91 VLC_EXPORT( void, __msg_Generic, ( vlc_object_t *, int, const char *, const char *, ... ) );
92 VLC_EXPORT( void, __msg_Info, ( void *, const char *, ... ) );
93 VLC_EXPORT( void, __msg_Err, ( void *, const char *, ... ) );
94 VLC_EXPORT( void, __msg_Warn, ( void *, const char *, ... ) );
95 VLC_EXPORT( void, __msg_Dbg, ( void *, const char *, ... ) );
97 #ifdef HAVE_VARIADIC_MACROS
99 # define msg_Info( p_this, psz_format, args... ) \
100 __msg_Generic( CAST_TO_VLC_OBJECT(p_this), VLC_MSG_INFO, MODULE_STRING, \
101 psz_format, ## args )
103 # define msg_Err( p_this, psz_format, args... ) \
104 __msg_Generic( CAST_TO_VLC_OBJECT(p_this), VLC_MSG_ERR, MODULE_STRING, \
105 psz_format, ## args )
107 # define msg_Warn( p_this, psz_format, args... ) \
108 __msg_Generic( CAST_TO_VLC_OBJECT(p_this), VLC_MSG_WARN, MODULE_STRING, \
109 psz_format, ## args )
111 # define msg_Dbg( p_this, psz_format, args... ) \
112 __msg_Generic( CAST_TO_VLC_OBJECT(p_this), VLC_MSG_DBG, MODULE_STRING, \
113 psz_format, ## args )
115 #else /* HAVE_VARIADIC_MACROS */
117 # define msg_Info __msg_Info
118 # define msg_Err __msg_Err
119 # define msg_Warn __msg_Warn
120 # define msg_Dbg __msg_Dbg
122 #endif /* HAVE_VARIADIC_MACROS */