MCPcopy Create free account
hub / github.com/OpenIPC/firmware / serror

Function serror

general/package/comgt/src/comgt.c:295–324  ·  view source on GitHub ↗

Report script errors and quit */

Source from the content-addressed store, hash-verified

293
294/* Report script errors and quit */
295void serror(char *text, int exitcode) {
296 int a,line;
297 char lmsg[STRINGL];
298 verbose=1;
299 //dodump();
300 vmsg("-- Error Report --");
301 a=pc;
302 pc=lastpc;
303 //printwhere();
304 pc=a;
305 while(pc!=0 && (script[pc]==' ' || script[pc]=='\t')) pc--;
306 strcpy(lmsg,"----> ");
307 for(a=6;a<STRINGL;a++) lmsg[a]=' ';
308 for(a=0;a<pc-lastpc;a++) {
309 if(script[a+lastpc]=='\t') lmsg[a+8]='\t';
310 }
311 a+=6;
312 lmsg[a++]='^';
313 lmsg[a]=0;
314 vmsg(lmsg);
315 a=0; line=1;
316 while(a<pc) {
317 if(script[a++]=='\n') {
318 if(a<pc) line++;
319 }
320 }
321 sprintf(lmsg,"Error @%d, line %d, %s. (%d)\n",pc,line,text,exitcode);
322 vmsg(lmsg);
323 ext(exitcode);
324}
325
326void skipspaces(void) {
327 while(script[pc]==' ' || script[pc]=='\t' ) pc++;

Callers 15

writecomFunction · 0.85
getopenFunction · 0.85
getcloseFunction · 0.85
gettokenFunction · 0.85
getvalueFunction · 0.85
getcommaFunction · 0.85
getstringFunction · 0.85
doletFunction · 0.85
getonoroffFunction · 0.85
setcomFunction · 0.85
dosetFunction · 0.85
dogotoFunction · 0.85

Calls 2

vmsgFunction · 0.85
extFunction · 0.85

Tested by

no test coverage detected