00001 /* 00002 This file is part of PolyLib. 00003 00004 PolyLib is free software: you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation, either version 3 of the License, or 00007 (at your option) any later version. 00008 00009 PolyLib is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with PolyLib. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 /* errormsg.c 00019 COPYRIGHT 00020 Both this software and its documentation are 00021 00022 Copyright 1993 by IRISA /Universite de Rennes I - France, 00023 Copyright 1995,1996 by BYU, Provo, Utah 00024 all rights reserved. 00025 00026 Permission is granted to copy, use, and distribute 00027 for any commercial or noncommercial purpose under the terms 00028 of the GNU General Public license, version 2, June 1991 00029 (see file : LICENSING). 00030 */ 00031 00032 #include <stdio.h> 00033 #include <polylib/polylib.h> 00034 00035 extern int Pol_status; 00036 00037 /* This function allows either error messages to be sent to Mathematica, 00038 or messages to be printed to stderr. 00039 00040 If MATHLINK is defined, then a command Message[f::msgname] is sent to 00041 Mathematica. If not, one prints on stderr. The difference with errormsg 00042 is that the control should be returned immediately to Mathematica after 00043 the call to errormsg1. Therefore, no Compound statement is sent to 00044 Mathematica. 00045 */ 00046 void errormsg1(const char *f, const char *msgname, const char *msg) 00047 { 00048 Pol_status = 1; 00049 00050 #ifdef MATHLINK 00051 MLPutFunction(stdlink,"Message",1); 00052 MLPutFunction(stdlink,"MessageName",2); 00053 MLPutSymbol(stdlink,f); 00054 MLPutString(stdlink,msgname); 00055 #else 00056 #ifndef NO_MESSAGES 00057 fprintf(stderr, "?%s: %s\n", f, msg); 00058 #endif 00059 #endif 00060 00061 }