Debian Codegraph @

external/glpk/glpenv04.c

raw symbols SCIP
1 /* glpenv04.c (error handling) */cxx . . $ `<file>/external/glpk/glpenv04.c`/
2
3 /***********************************************************************
4 * This code is part of GLPK (GNU Linear Programming Kit).
5 *
6 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
7 * 2009, 2010 Andrew Makhorin, Department for Applied Informatics,
8 * Moscow Aviation Institute, Moscow, Russia. All rights reserved.
9 * E-mail: <[email protected]>.
10 *
11 * GLPK is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * GLPK is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
19 * License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with GLPK. If not, see <http://www.gnu.org/licenses/>.
23 ***********************************************************************/
24
25 #include "glpapi.h"cxx . . $ `<file>/external/glpk/glpapi.h`/
26
27 /***********************************************************************
28 * NAME
29 *
30 * glp_error - display error message and terminate execution
31 *
32 * SYNOPSIS
33 *
34 * void glp_error(const char *fmt, ...);
35 *
36 * DESCRIPTION
37 *
38 * The routine glp_error (implemented as a macro) formats its
39 * parameters using the format control string fmt, writes the formatted
40 * message to the terminal, and abnormally terminates the program. */
41
42 static void errorcxx . . $ error(326aeb464d16410c).(const char *fmt, ...)
43 { ENVcxx . . $ ENV# *env = get_env_ptrcxx . . $ `external/glpk/glpenv.h:133:9`!();
44 va_listcxx . . $ va_list# arg;
45 env->term_outcxx . . $ ENV#term_out. = GLP_ONcxx . . $ `external/glpk/glpk.h:221:9`!;
46 va_startcxx . . $ `<external>/8105065126723003039/stdarg.h:50:9`!(arg, fmt);
47 xvprintfcxx . . $ `external/glpk/glpenv.h:149:9`!(fmt, arg);
48 va_endcxx . . $ `<external>/8105065126723003039/stdarg.h:52:9`!(arg);
49 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("Error detected in file %s at line %d\n", env->err_filecxx . . $ ENV#err_file.,
50 env->err_linecxx . . $ ENV#err_line.);
51 if (env->err_hookcxx . . $ ENV#err_hook. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
52 env->err_hookcxx . . $ ENV#err_hook.(env->err_infocxx . . $ ENV#err_info.);
53 abortcxx . . $ abort(8df32a62017fbbf6).();
54 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!);
55 /* no return */
56 }
57
58 _glp_errorcxx . . $ _glp_error# glp_error_cxx . . $ glp_error_(68ddb57ca28ebef9).(const char *file, int line)
59 { ENVcxx . . $ ENV# *env = get_env_ptrcxx . . $ `external/glpk/glpenv.h:133:9`!();
60 env->err_filecxx . . $ ENV#err_file. = file;
61 env->err_linecxx . . $ ENV#err_line. = line;
62 return errorcxx . . $ error(326aeb464d16410c).;
63 }
64
65 /***********************************************************************
66 * NAME
67 *
68 * glp_assert - check for logical condition
69 *
70 * SYNOPSIS
71 *
72 * #include "glplib.h"
73 * void glp_assert(int expr);
74 *
75 * DESCRIPTION
76 *
77 * The routine glp_assert (implemented as a macro) checks for a logical
78 * condition specified by the parameter expr. If the condition is false
79 * (i.e. the value of expr is zero), the routine writes a message to
80 * the terminal and abnormally terminates the program. */
81
82 void glp_assert_cxx . . $ glp_assert_(5e891a9f77bb0eff).(const char *expr, const char *file, int line)
83 { glp_error_cxx . . $ glp_error_(68ddb57ca28ebef9).(file, line)("Assertion failed: %s\n", expr);
84 /* no return */
85 }
86
87 /***********************************************************************
88 * NAME
89 *
90 * glp_error_hook - install hook to intercept abnormal termination
91 *
92 * SYNOPSIS
93 *
94 * void glp_error_hook(void (*func)(void *info), void *info);
95 *
96 * DESCRIPTION
97 *
98 * The routine glp_error_hook installs a user-defined hook routine to
99 * intercept abnormal termination.
100 *
101 * The parameter func specifies the user-defined hook routine. It is
102 * called from the routine glp_error before the latter calls the abort
103 * function to abnormally terminate the application program because of
104 * fatal error. The parameter info is a transit pointer, specified in
105 * the corresponding call to the routine glp_error_hook; it may be used
106 * to pass some information to the hook routine.
107 *
108 * To uninstall the hook routine the parameters func and info should be
109 * specified as NULL. */
110
111 void glp_error_hookcxx . . $ glp_error_hook(97a347b124788245).(void (*func)(void *info), void *info)
112 { ENVcxx . . $ ENV# *env = get_env_ptrcxx . . $ `external/glpk/glpenv.h:133:9`!();
113 if (func == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
114 { env->err_hookcxx . . $ ENV#err_hook. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
115 env->err_infocxx . . $ ENV#err_info. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
116 }
117 else
118 { env->err_hookcxx . . $ ENV#err_hook. = func;
119 env->err_infocxx . . $ ENV#err_info. = info;
120 }
121 return;
122 }
123
124 /* eof */