intf_msg.h 3.97 KB
Newer Older
1
/*****************************************************************************
Michel Kaempf's avatar
Michel Kaempf committed
2 3
 * intf_msg.h: messages interface
 * This library provides basic functions for threads to interact with user
Vincent Seguin's avatar
Vincent Seguin committed
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.16 2001/10/01 16:18:48 massiot Exp $
8
 *
9
 * Authors: Vincent Seguin <seguin@via.ecp.fr>
10 11 12 13 14
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
15
 * 
16 17
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
20
 *
21 22 23
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
24
 *****************************************************************************/
Michel Kaempf's avatar
Michel Kaempf committed
25

26
/*****************************************************************************
Michel Kaempf's avatar
Michel Kaempf committed
27
 * intf_DbgMsg macros and functions
28 29
 *****************************************************************************
 * The intf_DbgMsg* functions are defined as macro to be able to use the
Michel Kaempf's avatar
Michel Kaempf committed
30 31 32
 * compiler extensions and print the file, the function and the line number
 * from which they have been called. They call _intf_DbgMsg*() functions after
 * having added debugging informations.
33
 * Outside trace mode, intf_DbgMsg* functions do nothing.
34
 *****************************************************************************/
35
#ifdef TRACE
Michel Kaempf's avatar
Michel Kaempf committed
36

37
/* TRACE mode */
38
void    _intf_DbgMsg        ( char *psz_file, char *psz_function, int i_line,
Michel Kaempf's avatar
Michel Kaempf committed
39 40 41 42 43 44 45 46 47 48 49
                              char *psz_format, ... );
void    _intf_DbgMsgImm     ( char *psz_file, char *psz_function, int i_line,
                              char *psz_format, ... );

#define intf_DbgMsg( format, args... ) \
    _intf_DbgMsg( __FILE__, __FUNCTION__, __LINE__, format, ## args )
#define intf_DbgMsgImm( format, args... ) \
    _intf_DbgMsg( __FILE__, __FUNCTION__, __LINE__, format, ## args )

#else

50
/* Non-TRACE mode */
51
#if defined( _MSC_VER )
52 53
#   define intf_DbgMsg
#   define intf_DbgMsgImm
54
#else
55 56
#   define intf_DbgMsg( format, args... )
#   define intf_DbgMsgImm( format, args...)
57
#endif
Michel Kaempf's avatar
Michel Kaempf committed
58 59 60

#endif

61
/*****************************************************************************
Michel Kaempf's avatar
Michel Kaempf committed
62
 * intf_FlushMsg macro and function
63
 *****************************************************************************
Michel Kaempf's avatar
Michel Kaempf committed
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
Michel Kaempf's avatar
Michel Kaempf committed
66
 * is really a function. In the other case, it is a macro doing nothing.
67
 *****************************************************************************/
Michel Kaempf's avatar
Michel Kaempf committed
68 69 70 71 72 73 74 75 76 77 78 79
#ifdef INTF_MSG_QUEUE

/* Message queue mode */
void    intf_FlushMsg       ( void );

#else

/* Direct mode */
#define intf_FlushMsg()     ;

#endif

80 81 82
/*****************************************************************************
 * Prototypes
 *****************************************************************************/
Vincent Seguin's avatar
Vincent Seguin committed
83 84
p_intf_msg_t intf_MsgCreate      ( void );
void         intf_MsgDestroy     ( void );
Michel Kaempf's avatar
Michel Kaempf committed
85

Vincent Seguin's avatar
Vincent Seguin committed
86 87
void         intf_Msg            ( char *psz_format, ... );
void         intf_ErrMsg         ( char *psz_format, ... );
88
void         intf_WarnMsg        ( int i_level, char *psz_format, ... );
89
void         intf_StatMsg        ( char *psz_format, ... );
Michel Kaempf's avatar
Michel Kaempf committed
90

Vincent Seguin's avatar
Vincent Seguin committed
91 92
void         intf_MsgImm         ( char *psz_format, ... );
void         intf_ErrMsgImm      ( char *psz_format, ... );
93
void         intf_WarnMsgImm     ( int i_level, char *psz_format, ... );
94 95
void         intf_WarnHexDump    ( int i_level, void *p_data, int i_size );