CORSIKA add-on package IACT/ATMO:  Version 1.63 (November 2020)
Macros | Functions
warning.h File Reference

Pass warning messages to the screen or a usr function as set up. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define Error(string)   warn_f_warning(string,WARNING_ORIGIN,20,0)
 
#define Information(string)   warn_f_warning(string,WARNING_ORIGIN,0,0)
 
#define Output(string)   warn_f_output_text(string)
 
#define Warning(string)   warn_f_warning(string,WARNING_ORIGIN,10,0)
 
#define WARNING_ORIGIN   (char *) NULL
 

Functions

void flush_output (void)
 Flush buffered output. More...
 
void set_aux_warning_function (char *(*auxfunc)(void))
 Set an auxilliary function for warnings. More...
 
void set_default_aux_warning_function (char *(*auxfunc)(void))
 
void set_default_logging_function (void(*user_function)(const char *, const char *, int, int))
 
void set_default_output_function (void(*user_function)(const char *))
 
int set_default_warning (int level, int mode)
 
int set_log_file (const char *fname)
 Set a new log file name and save it in local storage. More...
 
void set_logging_function (void(*user_function)(const char *, const char *, int, int))
 Set user-defined function for logging warnings and errors. More...
 
void set_output_function (void(*user_function)(const char *))
 Set a user-defined function as the function to be used for normal text output. More...
 
int set_warning (int level, int mode)
 Set a specific warning level and mode. More...
 
char * warn_f_get_message_buffer (void)
 
void warn_f_output_text (const char *text)
 Print a text string (without appending a newline etc.) on the screen or send it to a controlling process, depending on the setting of the output function. More...
 
void warn_f_warning (const char *text, const char *origin, int level, int msgno)
 Issue a warning to screen or other configured target. More...
 
void warning_status (int *plevel, int *pmode)
 Inquire status of warning settings. More...
 

Detailed Description

Author
Konrad Bernloehr
Date
CVS $Date: 2010/07/20 13:37:45 $ 
Version
CVS $Revision: 1.5 $ 

Function Documentation

◆ flush_output()

void flush_output ( void  )

Output is flushed, no matter if it is standard output or a special output function;

Returns
(none)

◆ set_aux_warning_function()

void set_aux_warning_function ( char *(*)(void)  auxfunc)

This function may be used to insert time and date or origin etc. at the beginning of the warning text.

Parameters
auxfunc– Pointer to a function taking no argument and returning a character string.
Returns
(none)

◆ set_log_file()

int set_log_file ( const char *  fname)

If there was a log file with a different name opened previously, close it.

Parameters
fnameNew name of log file for warnings
Returns
0 (o.k.), -1 (error)

◆ set_logging_function()

void set_logging_function ( void(*)(const char *, const char *, int, int)  user_function)

Set a user-defined function as the function to be used for logging warnings and errors. To enable usage of this function, bit 2 of the warning mode must be set and other bits reset, if logging to screen and/or disk file is no longer wanted.

Parameter userfunc: Pointer to a function taking two strings (the message text and the origin text, which may be NULL) and two integers (message level and message number).

Returns
(none)

◆ set_output_function()

void set_output_function ( void(*)(const char *)  user_function)

Such a function may be used to send output back to a remote control process via network.

Parameter userfunc: Pointer to a function taking a string (the text to be displayed) as argument.

Returns
(none)

◆ set_warning()

int set_warning ( int  level,
int  mode 
)
Parameters
levelWarnings with level below this are ignored.
modeTo screen, to file, with user function ...
Returns
0 if ok, -1 if level and/or mode could not be set.

◆ warn_f_output_text()

void warn_f_output_text ( const char *  text)
Parameters
textA text string to be displayed.
Returns
(none)

◆ warn_f_warning()

void warn_f_warning ( const char *  msgtext,
const char *  msgorigin,
int  msglevel,
int  msgno 
)

Issue a warning to screen and/or file if the warning has a sufficiently large message 'level' (high enough severity). This function should best be called through the macros 'Information', 'Warning', and 'Error'. The name of this function has been changed from 'warning' to '_warning' to avoid trouble if you call 'warning' instead of 'Warning'. Now such a typo causes an error in the link step.

Parameters
msgtextWarning or error text.
msgoriginOptional origin (e.g. function name) or NULL.
msglevelLevel of message importance: negative: debugging if needed, 0-9: informative, 10-19: warning, 20-29: error.
msgnoNumber of message or 0.
Returns
(none)

◆ warning_status()

void warning_status ( int *  plevel,
int *  pmode 
)
Parameters
plevelPointer to variable for storing current level.
pmodePointer to store the current warning mode.
Returns
(none)