3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
33 * Gromacs Runs On Most of All Computer Systems
50 /* Abstract type for warning bookkeeping */
51 typedef struct warninp
*warninp_t
;
55 init_warning(bool bAllowWarnings
,int maxwarning
);
56 /* Initialize the warning data structure.
57 * If bAllowWarnings=FALSE, all warnings (calls to warning()) will be
58 * transformed into errors, calls to warning_note still produce notes.
59 * maxwarning determines the maximum number of warnings that are allowed
60 * for proceeding. When this number is exceeded check_warning_error
61 * and done_warning will generate a fatal error.
62 * bAllowWarnings=TRUE should only be used by programs that have
63 * a -maxwarn command line option.
67 set_warning_line(warninp_t wi
,const char *fn
,int line
);
68 /* Set filename and linenumber for the warning */
71 get_warning_line(warninp_t wi
);
72 /* Get linenumber for the warning */
76 get_warning_file(warninp_t wi
);
77 /* Get filename for the warning */
80 warning(warninp_t wi
,const char *s
);
81 /* Issue a warning, with the string s. If s == NULL, then warn_buf
82 * will be printed instead. The file and line set by set_warning_line
83 * are printed, nwarn_warn (local) is incremented.
84 * A fatal error will be generated after processing the input
85 * when nwarn_warn is larger than maxwarning passed to init_warning.
86 * So warning should only be called for issues that should be resolved,
87 * otherwise warning_note should be called.
91 warning_note(warninp_t wi
,const char *s
);
92 /* Issue a note, with the string s. If s == NULL, then warn_buf
93 * will be printed instead. The file and line set by set_warning_line
94 * are printed, nwarn_note (local) is incremented.
95 * This is for issues which could be a problem for some systems,
96 * but 100% ok for other systems.
100 warning_error(warninp_t wi
,const char *s
);
101 /* Issue an error, with the string s. If s == NULL, then warn_buf
102 * will be printed instead. The file and line set by set_warning_line
103 * are printed, nwarn_error (local) is incremented.
107 check_warning_error(warninp_t wi
,int f_errno
,const char *file
,int line
);
108 /* When warning_error has been called at least once gmx_fatal is called,
109 * otherwise does nothing.
113 done_warning(warninp_t wi
,int f_errno
,const char *file
,int line
);
114 /* Should be called when finished processing the input file.
115 * Prints the number of notes and warnings
116 * and generates a fatal error when errors were found or too many
117 * warnings were generatesd.
118 * Frees the data structure pointed to by wi.
122 _too_few(warninp_t wi
,const char *fn
,int line
);
123 #define too_few(wi) _too_few(wi,__FILE__,__LINE__)
124 /* Issue a warning stating 'Too few parameters' */
127 _incorrect_n_param(warninp_t wi
,const char *fn
,int line
);
128 #define incorrect_n_param(wi) _incorrect_n_param(wi,__FILE__,__LINE__)
129 /* Issue a warning stating 'Incorrect number of parameters' */
135 #endif /* _warninp_h */