3 * (C) Copyright Apr 15 1995, Edmond J. Breen.
5 * This code may be copied for personal, non-profit use only.
22 int EiC_ParseError, EiC_ErrorRecover;
26 static void messageDisplay(char *msg);
28 void (*EiC_messageDisplay)(char *) = messageDisplay;
32 void EiC_setMessageDisplay(void (*t)(char *msg))
34 EiC_messageDisplay = t;
39 int EiC_match(int t, char *m)
41 extern token_t *token;
45 lookahead = EiC_lexan();
46 if (EiC_ErrorRecover) { /* error recovery method */
47 while ((lookahead != t && lookahead != ';') && lookahead != DONE) {
49 xfree(token->Val.p.p);
50 lookahead = EiC_lexan();
52 if (lookahead == t || lookahead == ';') {
62 sprintf(message, "Expected %s", m);
71 void EiC_clear_err_msgs(void)
76 static void messageDisplay(char *msg)
81 void EiC_formatMessage(char *msg, ...)
88 vsprintf(buff2,msg,args);
89 EiC_messageDisplay(buff2);
94 void EiC_error(char *msg, ...)
103 buff1 = malloc(ln + 256);
104 buff2 = malloc(ln + 512);
106 if (!EiC_ErrorRecover) {
108 EiC_ErrorRecover = EiC_ParseError = 1;
109 sprintf(buff1,"Error in %s near line %d: %s\n",
113 vsprintf(buff2,buff1,args);
114 EiC_messageDisplay(buff2);
121 void EiC_warningerror(char *msg, ...)
131 buff1 = malloc(ln + 256);
132 buff2 = malloc(ln + 512);
135 sprintf(buff1,"Warning: in %s near line %d: %s\n",
139 vsprintf(buff2,buff1,args);
140 EiC_messageDisplay(buff2);