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 00017 extern int Pol_status; 00018 00019 /* This function allows either error messages to be sent to Mathematica, 00020 or messages to be printed to stderr. 00021 00022 If MATHLINK is defined, then a command Message[f::msgname] is sent to 00023 Mathematica. If not, one prints on stderr. The difference with errormsg 00024 is that the control should be returned immediately to Mathematica after 00025 the call to errormsg1. Therefore, no Compound statement is sent to 00026 Mathematica. 00027 */ 00028 void errormsg1(char *f , char *msgname, char *msg) { 00029 00030 Pol_status = 1; 00031 00032 #ifdef MATHLINK 00033 MLPutFunction(stdlink,"Message",1); 00034 MLPutFunction(stdlink,"MessageName",2); 00035 MLPutSymbol(stdlink,f); 00036 MLPutString(stdlink,msgname); 00037 #else 00038 #ifndef NO_MESSAGES 00039 fprintf(stderr, "?%s: %s\n", f, msg); 00040 #endif 00041 #endif 00042 00043 }