CORSIKA add-on package IACT/ATMO:  Version 1.63 (November 2020)
warning.h
Go to the documentation of this file.
1 /* ============================================================================
2 
3  Copyright (C) 2001, 2007, 2010 Konrad Bernloehr
4 
5  This file is part of the eventio/hessio library.
6 
7  The eventio/hessio library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with this library. If not, see <http://www.gnu.org/licenses/>.
19 
20 ============================================================================ */
21 
31 #ifndef WARNING_H__LOADED
32 
33 #define WARNING_H__LOADED 1
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 void warn_f_warning (const char *text, const char *origin,
40  int level, int msgno);
41 int set_warning (int level, int mode);
42 int set_default_warning (int level, int mode);
43 void warning_status (int *plevel, int *pmode);
44 void set_logging_function ( void (*user_function)(
45  const char *, const char *, int, int) );
46 void set_default_logging_function ( void (*user_function) (
47  const char *, const char *, int, int) );
48 int set_log_file (const char *fname);
49 void warn_f_output_text (const char *text);
50 void flush_output (void);
51 void set_output_function ( void (*user_function) (
52  const char *) );
53 void set_default_output_function ( void (*user_function) (
54  const char *) );
55 void set_aux_warning_function ( char *(*auxfunc) (
56  void) );
57 void set_default_aux_warning_function ( char *(*auxfunc) (
58  void) );
59 char *warn_f_get_message_buffer (void);
60 
61 #ifndef WARNING_ORIGIN
62 # define WARNING_ORIGIN (char *) NULL
63 #endif
64 
65 #ifdef __cplusplus
66 inline void Information(const char *str) { warn_f_warning(str,WARNING_ORIGIN,0,0); }
67 inline void Warning(const char *str) { warn_f_warning(str,WARNING_ORIGIN,10,0); }
68 inline void Error(const char *str) {warn_f_warning(str,WARNING_ORIGIN,20,0); }
69 
70 inline void Output(const char *str) { warn_f_output_text(str); }
71 #define WITH_INLINE_WARNING 1
72 #else
73 #define Information(string) warn_f_warning(string,WARNING_ORIGIN,0,0)
74 #define Warning(string) warn_f_warning(string,WARNING_ORIGIN,10,0)
75 #define Error(string) warn_f_warning(string,WARNING_ORIGIN,20,0)
76 
77 #define Output(string) warn_f_output_text(string)
78 #endif
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif /* __WARNING_LOADED */
void set_output_function(void(*user_function)(const char *))
Set a user-defined function as the function to be used for normal text output.
Definition: warning.c:591
void set_logging_function(void(*user_function)(const char *, const char *, int, int))
Set user-defined function for logging warnings and errors.
Definition: warning.c:427
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 proc...
Definition: warning.c:518
void warn_f_warning(const char *text, const char *origin, int level, int msgno)
Issue a warning to screen or other configured target.
Definition: warning.c:229
int set_warning(int level, int mode)
Set a specific warning level and mode.
Definition: warning.c:358
void flush_output(void)
Flush buffered output.
Definition: warning.c:564
void set_aux_warning_function(char *(*auxfunc)(void))
Set an auxilliary function for warnings.
Definition: warning.c:629
void warning_status(int *plevel, int *pmode)
Inquire status of warning settings.
Definition: warning.c:397
int set_log_file(const char *fname)
Set a new log file name and save it in local storage.
Definition: warning.c:464