misc/lemon.c
changeset 830 b15b3c3b5c4a
parent 829 7b3c3ae9e5a9
child 831 80e47b096ecd
equal deleted inserted replaced
829:7b3c3ae9e5a9 830:b15b3c3b5c4a
  1342 */
  1342 */
  1343 #define ERRMSGSIZE  10000 /* Hope this is big enough.  No way to error check */
  1343 #define ERRMSGSIZE  10000 /* Hope this is big enough.  No way to error check */
  1344 #define LINEWIDTH      79 /* Max width of any output line */
  1344 #define LINEWIDTH      79 /* Max width of any output line */
  1345 #define PREFIXLIMIT    30 /* Max width of the prefix on each line */
  1345 #define PREFIXLIMIT    30 /* Max width of the prefix on each line */
  1346 void ErrorMsg(const char *filename, int lineno, const char *format, ...){
  1346 void ErrorMsg(const char *filename, int lineno, const char *format, ...){
       
  1347 #if __MOJOSHADER__
       
  1348   va_list ap;
       
  1349   fprintf(stderr, "%s:%d: ", filename, lineno);
       
  1350   va_start(ap, format);
       
  1351   vfprintf(stderr,format,ap);
       
  1352   va_end(ap);
       
  1353   fprintf(stderr, "\n");
       
  1354   fflush(stderr);
       
  1355 #else
  1347   char errmsg[ERRMSGSIZE];
  1356   char errmsg[ERRMSGSIZE];
  1348   char prefix[PREFIXLIMIT+10];
  1357   char prefix[PREFIXLIMIT+10];
  1349   int errmsgsize;
  1358   int errmsgsize;
  1350   int prefixsize;
  1359   int prefixsize;
  1351   int availablewidth;
  1360   int availablewidth;
  1378     restart += base;
  1387     restart += base;
  1379     while( errmsg[restart]==' ' ) restart++;
  1388     while( errmsg[restart]==' ' ) restart++;
  1380     fprintf(stdout,"%s%.*s\n",prefix,end,&errmsg[base]);
  1389     fprintf(stdout,"%s%.*s\n",prefix,end,&errmsg[base]);
  1381     base = restart;
  1390     base = restart;
  1382   }
  1391   }
       
  1392 #endif
  1383 }
  1393 }
  1384 /**************** From the file "main.c" ************************************/
  1394 /**************** From the file "main.c" ************************************/
  1385 /*
  1395 /*
  1386 ** Main program file for the LEMON parser generator.
  1396 ** Main program file for the LEMON parser generator.
  1387 */
  1397 */