/[gcl]/gcl/o/symbol.d
ViewVC logotype

Diff of /gcl/o/symbol.d

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by camm, Wed Oct 9 04:04:17 2002 UTC revision 1.7 by camm, Thu Oct 10 02:51:59 2002 UTC
# Line 475  Lmake_symbol() Line 475  Lmake_symbol()
475          @(return x)          @(return x)
476  @)  @)
477    
478    DEFVAR("*GENSYM-COUNTER*",sLgensym_counter,LISP,make_fixnum(0),"");
479    
480  @(defun gensym (&optional (x gensym_prefix) &aux sym)  @(defun gensym (&optional (x gensym_prefix) &aux sym)
481          int i, j;          int i, j;
482            object this_gensym_prefix;
483            object this_gensym_counter;
484            object this_gensym_counter_string;
485  @  @
486            this_gensym_prefix=gensym_prefix;
487            this_gensym_counter=sLgensym_counter->s.s_dbind;
488          if (type_of(x) == t_string)          if (type_of(x) == t_string)
489                  gensym_prefix = x;                  this_gensym_prefix = x;
490          else {          else {
491                  check_type_non_negative_integer(&x);                  check_type_non_negative_integer(&x);
492                  if (type_of(x) == t_fixnum)                  this_gensym_counter=x;
                         gensym_counter = fix(x);  
                 else  
                         gensym_counter = 0;  
                         /*  incorrect implementation  */  
493          }          }
494          for (j = gensym_counter, i = 0;  j > 0;  j /= 10)          if (x==gensym_prefix)
495                  i++;                  sLgensym_counter->s.s_dbind=number_plus(sLgensym_counter->s.s_dbind,small_fixnum(1));
496          if (i == 0)  /*         FIXME: come up with a better call sequence */
497                  i++;          VFUN_NARGS=3;
498          i += gensym_prefix->st.st_fillp;          this_gensym_counter_string=fLformat(Cnil,make_simple_string("~S"),this_gensym_counter);
499            i=this_gensym_counter_string->st.st_fillp;
500            i += this_gensym_prefix->st.st_fillp;
501          set_up_string_register("");          set_up_string_register("");
502          sym = make_symbol(string_register);          sym = make_symbol(string_register);
503          {BEGIN_NO_INTERRUPT;              {BEGIN_NO_INTERRUPT;    
504          sym->s.s_fillp = i;          sym->s.s_fillp = i;
505          sym->s.s_self = alloc_relblock(i);          sym->s.s_self = alloc_relblock(i);
506          for (j = 0;  j < gensym_prefix->st.st_fillp;  j++)          i=this_gensym_prefix->st.st_fillp;
507                  sym->s.s_self[j] = gensym_prefix->st.st_self[j];          for (j = 0;  j < i;  j++)
508          if ((j = gensym_counter) == 0)                  sym->s.s_self[j] = this_gensym_prefix->st.st_self[j];
509                  sym->s.s_self[--i] = '0';          for (;j<sym->s.s_fillp;j++)
510          else                 sym->s.s_self[j] = this_gensym_counter_string->st.st_self[j-i];
                 for (;  j > 0;  j /= 10)  
                         sym->s.s_self[--i] = j%10 + '0';  
         gensym_counter++;  
511          END_NO_INTERRUPT;}                END_NO_INTERRUPT;}      
512          @(return sym)          @(return sym)
513  @)  @)
# Line 638  init_symbol() Line 640  init_symbol()
640  {  {
641          string_register = alloc_simple_string(0);          string_register = alloc_simple_string(0);
642          gensym_prefix = make_simple_string("G");          gensym_prefix = make_simple_string("G");
643          gensym_counter = 0;  /*      gensym_counter = 0; */
644          gentemp_prefix = make_simple_string("T");          gentemp_prefix = make_simple_string("T");
645          gentemp_counter = 0;          gentemp_counter = 0;
646          token = alloc_simple_string(INITIAL_TOKEN_LENGTH);          token = alloc_simple_string(INITIAL_TOKEN_LENGTH);
# Line 679  init_symbol_function() Line 681  init_symbol_function()
681    
682          siSpname = make_si_ordinary("PNAME");          siSpname = make_si_ordinary("PNAME");
683          enter_mark_origin(&siSpname);          enter_mark_origin(&siSpname);
684    /*      enter_mark_origin(&sLgensym_counter); */
685  }  }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26