Diff for /gforth/engine/main.c between versions 1.118 and 1.119

version 1.118, 2003/08/10 22:20:24 version 1.119, 2003/08/15 14:07:04
Line 47 Line 47
 #include <systypes.h>  #include <systypes.h>
 #endif  #endif
   
   enum {
   /* definitions of N_execute etc. */
   #include "prim_num.i"
     N_START_SUPER
   };
   
 /* global variables for engine.c   /* global variables for engine.c 
    We put them here because engine.c is compiled several times in     We put them here because engine.c is compiled several times in
    different ways for the same engine. */     different ways for the same engine. */
Line 696  void check_prims(Label symbols1[]) Line 702  void check_prims(Label symbols1[])
 {  {
   int i;    int i;
 #ifndef NO_DYNAMIC  #ifndef NO_DYNAMIC
   Label *symbols2, *symbols3, *ends1, *ends1k, *ends1ksorted;    Label *symbols2, *symbols3, *ends1, *ends1j, *ends1jsorted;
   int nends1k;    int nends1j;
 #endif  #endif
   
   if (debug)    if (debug)
Line 722  void check_prims(Label symbols1[]) Line 728  void check_prims(Label symbols1[])
   symbols3=symbols1;    symbols3=symbols1;
 #endif  #endif
   ends1 = symbols1+i+1-DOESJUMP;    ends1 = symbols1+i+1-DOESJUMP;
   ends1k =   ends1+i+1-DOESJUMP;    ends1j =   ends1+i;
   nends1k = i+1-DOESJUMP;    nends1j = i-DOESJUMP;
   ends1ksorted = (Label *)alloca(nends1k*sizeof(Label));    ends1jsorted = (Label *)alloca(nends1j*sizeof(Label));
   memcpy(ends1ksorted,ends1k,nends1k*sizeof(Label));    memcpy(ends1jsorted,ends1j,nends1j*sizeof(Label));
   qsort(ends1ksorted, nends1k, sizeof(Label), compare_labels);    qsort(ends1jsorted, nends1j, sizeof(Label), compare_labels);
       
   priminfos = calloc(i,sizeof(PrimInfo));    priminfos = calloc(i,sizeof(PrimInfo));
   for (i=DOESJUMP+1; symbols1[i+1]!=0; i++) {    for (i=DOESJUMP+1; symbols1[i+1]!=0; i++) {
Line 736  void check_prims(Label symbols1[]) Line 742  void check_prims(Label symbols1[])
     char *s1 = (char *)symbols1[i];      char *s1 = (char *)symbols1[i];
     char *s2 = (char *)symbols2[i];      char *s2 = (char *)symbols2[i];
     char *s3 = (char *)symbols3[i];      char *s3 = (char *)symbols3[i];
     Label endlabel = bsearch_next(symbols1[i]+1,ends1ksorted,nends1k);      Label endlabel = bsearch_next(symbols1[i]+1,ends1jsorted,nends1j);
   
     pi->start = s1;      pi->start = s1;
     pi->superend = superend[i-DOESJUMP-1]|no_super;      pi->superend = superend[i-DOESJUMP-1]|no_super;
Line 752  void check_prims(Label symbols1[]) Line 758  void check_prims(Label symbols1[])
     if (endlabel == NULL) {      if (endlabel == NULL) {
       pi->start = NULL; /* not relocatable */        pi->start = NULL; /* not relocatable */
       if (debug)        if (debug)
         fprintf(stderr,"\n   non_reloc: no K label > start found\n");          fprintf(stderr,"\n   non_reloc: no J label > start found\n");
       continue;        continue;
     }      }
     if (ends1[i] > endlabel && !pi->superend) {      if (ends1[i] > endlabel && !pi->superend) {
       pi->start = NULL; /* not relocatable */        pi->start = NULL; /* not relocatable */
       if (debug)        if (debug)
         fprintf(stderr,"\n   non_reloc: there is a K label before the J label (restlength<0)\n");          fprintf(stderr,"\n   non_reloc: there is a J label before the J label (restlength<0)\n");
       continue;        continue;
     }      }
     if (ends1[i] < pi->start && !pi->superend) {      if (ends1[i] < pi->start && !pi->superend) {
       pi->start = NULL; /* not relocatable */        pi->start = NULL; /* not relocatable */
       if (debug)        if (debug)
         fprintf(stderr,"\n   non_reloc: J label before I label (length<0)\n");          fprintf(stderr,"\n   non_reloc: K label before I label (length<0)\n");
       continue;        continue;
     }      }
     assert(prim_len>=0);      assert(prim_len>=0);
Line 953  struct doesexecinfo { Line 959  struct doesexecinfo {
   Cell *xt; /* cfa of word whose does-code needs calling */    Cell *xt; /* cfa of word whose does-code needs calling */
 } doesexecinfos[10000];  } doesexecinfos[10000];
   
 /* definitions of N_execute etc. */  
 #include "prim_num.i"  
   
 void set_rel_target(Cell *source, Label target)  void set_rel_target(Cell *source, Label target)
 {  {
   *source = ((Cell)target)-(((Cell)source)+4);    *source = ((Cell)target)-(((Cell)source)+4);

Removed from v.1.118  
changed lines
  Added in v.1.119


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>