00001 /* errormsg.c 00002 COPYRIGHT 00003 Both this software and its documentation are 00004 00005 Copyright 1993 by IRISA /Universite de Rennes I - France, 00006 Copyright 1995,1996 by BYU, Provo, Utah 00007 all rights reserved. 00008 00009 Permission is granted to copy, use, and distribute 00010 for any commercial or noncommercial purpose under the terms 00011 of the GNU General Public license, version 2, June 1991 00012 (see file : LICENSING). 00013 */ 00014 00015 #include <stdio.h> 00016 #include <polylib/polylib.h> 00017 00018 extern int Pol_status; 00019 00020 /* This function allows either error messages to be sent to Mathematica, 00021 or messages to be printed to stderr. 00022 00023 If MATHLINK is defined, then a command Message[f::msgname] is sent to 00024 Mathematica. If not, one prints on stderr. The difference with errormsg 00025 is that the control should be returned immediately to Mathematica after 00026 the call to errormsg1. Therefore, no Compound statement is sent to 00027 Mathematica. 00028 */ 00029 void errormsg1(const char *f, const char *msgname, const char *msg) 00030 { 00031 Pol_status = 1; 00032 00033 #ifdef MATHLINK 00034 MLPutFunction(stdlink,"Message",1); 00035 MLPutFunction(stdlink,"MessageName",2); 00036 MLPutSymbol(stdlink,f); 00037 MLPutString(stdlink,msgname); 00038 #else 00039 #ifndef NO_MESSAGES 00040 fprintf(stderr, "?%s: %s\n", f, msg); 00041 #endif 00042 #endif 00043 00044 }