/usr/include/libAfterBase/output.h is in libafterimage-dev 2.2.12-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | #ifndef OUTPUT_H_HEADER_INCLUDED
#define OUTPUT_H_HEADER_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#ifndef Bool
#define Bool int
#endif
/* This has to manually set in order for output to have meaningfull labels : */
extern char *ApplicationName ;
void set_application_name (char *argv0);
const char *get_application_name();
/***********************************************************************************/
/* The following can be used to enable/disable verbose output from AfterStep : */
/***********************************************************************************/
typedef int (*stream_func)(void*, const char*,...);
unsigned int set_output_threshold( unsigned int threshold );
unsigned int get_output_threshold();
/*
* FEW PRESET LEVELS OF OUTPUT :
*/
#define OUTPUT_LEVEL_INVALID 0
#define OUTPUT_LEVEL_PARSE_ERR 1
#define OUTPUT_LEVEL_ERROR 1
#define OUTPUT_LEVEL_WARNING 4
#define OUTPUT_DEFAULT_THRESHOLD 5
#define OUTPUT_LEVEL_PROGRESS OUTPUT_DEFAULT_THRESHOLD+1
#define OUTPUT_LEVEL_ACTIVITY OUTPUT_DEFAULT_THRESHOLD+2
#define OUTPUT_VERBOSE_THRESHOLD OUTPUT_DEFAULT_THRESHOLD+3
#define OUTPUT_LEVEL_DEBUG 10 /* anything above it is hardcore debugging */
unsigned int set_output_level( unsigned int level );
void restore_output_level();
Bool is_output_level_under_threshold( unsigned int level );
/*
* if pfunc is NULL then if threshold >= level - then we use fprintf
* otherwise - return False
*/
Bool pre_print_check( stream_func *pfunc, void** pstream, void *data, const char *msg );
/* AfterStep specific error and Warning handlers : */
/* Returns True if something was actually printed */
Bool show_error( const char *error_format, ...);
Bool show_system_error( const char *error_format, ...); /* will also execute perror() */
Bool show_warning( const char *warning_format, ...);
Bool show_progress( const char *msg_format, ...);
Bool show_activity( const char *msg_format, ...);
Bool show_debug( const char *file, const char *func, int line, const char *msg_format, ...);
#define SHOW_CHECKPOINT show_debug(__FILE__,__FUNCTION__,__LINE__, "*checkpoint*")
void nonGNUC_debugout( const char *format, ...);
void nonGNUC_debugout_stub( const char *format, ...);
/* may be used below in case compilation problems occur.
* Please submit a bug report if usage of any of the following generates errors on
* your compiler . Thanks!!! */
void debugout_print_linestamp(const char *file, const char *func, int line );
const char *get_caller_func();/* required by below */
/* Some usefull debugging macros : */
#ifdef __GNUC__
#if (!defined(NO_DEBUG_OUTPUT))&&(defined(LOCAL_DEBUG)||defined(DEBUG)||defined(DEBUG_ALL))
#define DEBUG_OUT(format,args...) \
do{ fprintf( stderr, "%s:%s:%s:%d:>" format "\n", ApplicationName, __FILE__, __FUNCTION__, __LINE__, ## args );}while(0)
#else
#define DEBUG_OUT(format,args...)
#endif /* DEBUG */
#if (!defined(NO_DEBUG_OUTPUT))&&(defined(LOCAL_DEBUG)||defined(DEBUG_ALL))
#define LOCAL_DEBUG_OUT(format,args...) \
do{ debugout_print_linestamp(__FILE__,__FUNCTION__,__LINE__); \
fprintf( stderr, format "\n", ## args );}while(0)
#define LOCAL_DEBUG_CALLER_OUT(format,args...) \
do{ debugout_print_linestamp(__FILE__,__FUNCTION__,__LINE__); \
fprintf( stderr, "called from [%s] with args(" format ")\n", get_caller_func(), ## args );}while(0)
#else
#define LOCAL_DEBUG_OUT(format,args...)
#define LOCAL_DEBUG_CALLER_OUT(format,args...)
#endif /* LOCAL_DEBUG */
#elif __STDC_VERSION__ >= 199901 /* C99 standard provides support for this as well : */
#if (!defined(NO_DEBUG_OUTPUT))&&(defined(LOCAL_DEBUG)||defined(DEBUG)||defined(DEBUG_ALL))
#define DEBUG_OUT(...) \
do{ fprintf( stderr, "%s:%s:%s:%d:>", ApplicationName, __FILE__, __FUNCTION__, __LINE__ ); \
fprintf( stderr, __VA_ARGS__); \
fprintf( stderr, "\n"); \
}while(0)
#else
#define DEBUG_OUT(...)
#endif /* DEBUG */
#if (!defined(NO_DEBUG_OUTPUT))&&(defined(LOCAL_DEBUG)||defined(DEBUG_ALL))
#define LOCAL_DEBUG_OUT(...) \
do{ fprintf( stderr, "%s:%s:%s:%d:>", ApplicationName, __FILE__, __FUNCTION__, __LINE__ ); \
fprintf( stderr, __VA_ARGS__); \
fprintf( stderr, "\n"); \
}while(0)
#define LOCAL_DEBUG_CALLER_OUT(...) \
do{ fprintf( stderr, "%s:%s:%s:> called from [%s] with args(", ApplicationName, __FILE__, get_caller_func() ); \
fprintf( stderr, __VA_ARGS__); \
fprintf( stderr, ")\n"); \
}while(0)
#else
#define LOCAL_DEBUG_OUT(...)
#define LOCAL_DEBUG_CALLER_OUT(...)
#endif /* LOCAL_DEBUG */
#else /* non __GNUC__ or C99 compliant compiler : */
#if (!defined(NO_DEBUG_OUTPUT))&&(defined(LOCAL_DEBUG)||defined(DEBUG)||defined(DEBUG_ALL))
#define DEBUG_OUT nonGNUC_debugout
#else
#define DEBUG_OUT nonGNUC_debugout_stub
#endif /* DEBUG */
#if (!defined(NO_DEBUG_OUTPUT))&&(defined(LOCAL_DEBUG)||defined(DEBUG_ALL))
#define LOCAL_DEBUG_OUT nonGNUC_debugout
#define LOCAL_DEBUG_CALLER_OUT nonGNUC_debugout_stub
#else
#define LOCAL_DEBUG_OUT nonGNUC_debugout_stub
#define LOCAL_DEBUG_CALLER_OUT nonGNUC_debugout_stub
#endif /* LOCAL_DEBUG */
#endif
#ifdef DO_CLOCKING
#define START_TIME(started) time_t started = clock()
#define SHOW_TIME(s,started) fprintf (stderr, "%s %s time (clocks): %lu mlsec\n", __FUNCTION__, s, ((clock () - (started))*100)/CLOCKS_PER_SEC)
#else
#define START_TIME(started) while(0){};
#define SHOW_TIME(s,started) while(0){};
#endif
#ifdef __cplusplus
}
#endif
#endif
|