corrected a bug in reading matrices on MacOS (fgets) and cleaned a bit the code
[polylib.git] / source / kernel / errormsg.c
blob3b94cd687ecd137f6be41d07a4320224a46a51d1
1 /*
2 This file is part of PolyLib.
4 PolyLib is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 PolyLib is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with PolyLib. If not, see <http://www.gnu.org/licenses/>.
18 /* errormsg.c
19 COPYRIGHT
20 Both this software and its documentation are
22 Copyright 1993 by IRISA /Universite de Rennes I - France,
23 Copyright 1995,1996 by BYU, Provo, Utah
24 all rights reserved.
28 #include <stdio.h>
29 #include <polylib/polylib.h>
31 extern int Pol_status;
33 /* This function allows either error messages to be sent to Mathematica,
34 or messages to be printed to stderr.
36 If MATHLINK is defined, then a command Message[f::msgname] is sent to
37 Mathematica. If not, one prints on stderr. The difference with errormsg
38 is that the control should be returned immediately to Mathematica after
39 the call to errormsg1. Therefore, no Compound statement is sent to
40 Mathematica.
42 void errormsg1(const char *f, const char *msgname, const char *msg)
44 Pol_status = 1;
46 #ifdef MATHLINK
47 MLPutFunction(stdlink,"Message",1);
48 MLPutFunction(stdlink,"MessageName",2);
49 MLPutSymbol(stdlink,f);
50 MLPutString(stdlink,msgname);
51 #else
52 #ifndef NO_MESSAGES
53 fprintf(stderr, "?%s: %s\n", f, msg);
54 #endif
55 #endif