stratagus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stratagus-CVS] stratagus/src/siod slib.c


From: Martin Renold
Subject: [Stratagus-CVS] stratagus/src/siod slib.c
Date: Fri, 25 Jul 2003 13:11:58 -0400

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Martin Renold <address@hidden>  03/07/25 13:11:58

Modified files:
        src/siod       : slib.c 

Log message:
        show line number with ccl errors

Patches:
Index: stratagus/src/siod/slib.c
diff -u stratagus/src/siod/slib.c:1.23 stratagus/src/siod/slib.c:1.24
--- stratagus/src/siod/slib.c:1.23      Fri May 30 20:00:52 2003
+++ stratagus/src/siod/slib.c   Fri Jul 25 13:11:58 2003
@@ -93,13 +93,14 @@
 
 static void init_slib_version(void)
 {setvar(cintern("*slib-version*"),
-       cintern("$Id: slib.c,v 1.23 2003/05/31 00:00:52 nehalmistry Exp $"),
+       cintern("$Id: slib.c,v 1.24 2003/07/25 17:11:58 martinxyz Exp $"),
        NIL);}
 
 char * __stdcall siod_version(void)
 {return("3.5 5-MAY-97");}
 
 char current_filename[256];
+long *current_lineno;
 long nheaps = 2;
 LISP *heaps;
 LISP heap,heap_end,heap_org;
@@ -652,11 +653,11 @@
    eobj = NULL;
  if ((siod_verbose_level >= 1) && msg)
    {if NULLP(nx)
-      printf("ERROR in %s: %s\n",current_filename,msg);
+      printf("%s:%ld: %s\n",current_filename,*current_lineno,msg);
     else if (eobj)
-      printf("ERROR in %s: %s (errobj %s)\n",current_filename,msg,eobj);
+      printf("%s:%ld: %s (errobj 
%s)\n",current_filename,*current_lineno,msg,eobj);
     else
-      printf("ERROR in %s: %s (see errobj)\n",current_filename,msg);}
+      printf("%s:%ld: %s (see 
errobj)\n",current_filename,*current_lineno,msg);}
  if (errjmp_ok == 1 && errjmp_avail == 1)
    {inside_err = 1;
     setvar(sym_errobj,nx,NIL);
@@ -2110,6 +2111,7 @@
  while(1)
    {c = GETC_FCN(f);
     if (c == EOF) { if (eoferr) errl(eoferr,NIL); else return(c); }
+    if (c == '\n') (*current_lineno)++;
     if (commentp) {if (c == '\n') commentp = 0;}
     else if (c == ';') commentp = 1;
     else if (!isspace(c)) return(c);}}
@@ -2207,6 +2209,7 @@
  *p++ = c;
  for(j = 1; j<TKBUFFERN; ++j)
    {c = GETC_FCN(f);
+    if (c == '\n') (*current_lineno)++;
     if (c == EOF) return(lreadtk(buffer,j));
     if (isspace(c)) return(lreadtk(buffer,j));
     if (strchr("()'`,;\"",c) || strchr(user_te_readm,c))
@@ -2346,6 +2349,8 @@
 {LISP form,result,tail;
  long len;
  char buffer[512],*start,*fname;
+ long lno;
+ long *old_lineno;
 #if !(defined(USE_ZLIB) || defined(USE_BZ2LIB) || defined(USE_ZZIPLIB))
  LISP reader = NIL,lf;
  FILE *f;
@@ -2354,11 +2359,15 @@
  char *key = "parser:",*ftype=".scm",*end;
 #endif
 
+ old_lineno = current_lineno;
+ current_lineno = &lno;
  if ((start = strchr(ofname,VLOAD_OFFSET_HACK_CHAR)))
   {len = atol(ofname);
-   fname = &start[1];}
+   fname = &start[1];
+   lno = -9999; /* maxy: this hack is not used anyway */}
  else
   {len = 0;
+   lno = 1;
    fname = ofname;}
  strcpy(current_filename, fname);
 //---
@@ -2450,7 +2459,8 @@
        {buffer[j] = c;
         buffer[++j] = 0;}
     if (c == '\n')
-      c = f_getc(f);}
+      {c = f_getc(f);
+       lno++;}}
  if (c != EOF)
    f_ungetc(c,f);
  if ((start = strstr(buffer,key)))
@@ -2488,6 +2498,7 @@
 #endif
  if (siod_verbose_level >= 3)
    put_st("done.\n");
+ current_lineno = old_lineno;
  return(result);}
 
 LISP load(LISP fname,LISP cflag,LISP rflag)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]