Ignore:
Timestamp:
Apr 17, 2011, 10:28:20 AM (11 years ago)
Author:
Sam Hocevar
Message:

lisp: populate LispSymbol? with symbol-related methods.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/chars.cpp

    r482 r484  
    8181};
    8282
    83 int character_type::add_state(void *symbol)             // returns index into seq to use
     83int character_type::add_state(void *symbol) // returns index into seq to use
    8484{
    8585  if (item_type(symbol)!=L_SYMBOL)
     
    110110    int sp=current_space;
    111111    current_space=PERM_SPACE;
    112     set_symbol_number(symbol,num);
     112    ((LispSymbol *)symbol)->SetNumber(num);
    113113    current_space=sp;
    114114  }
     
    119119    lbreak("symbol has been assigned value %d, but value already in use by state %s\n"
    120120       "use a different symbol for this state\n",
    121        lstring_value(symbol_name(seq_syms[num])));
     121       lstring_value(((LispSymbol *)seq_syms[num])->GetName()));
    122122    exit(0);
    123123  } else if (num>=ts)
     
    219219           "  with index %d, but %s has a var listed '%s' with same index\n"
    220220           "  try moving definition of %s before previously declared object",
    221            lstring_value(symbol_name(name)),
    222            lstring_value(symbol_name(symbol)),
     221           lstring_value(((LispSymbol *)name)->GetName()),
     222           lstring_value(((LispSymbol *)symbol)->GetName()),
    223223           index,
    224            lstring_value(symbol_name(name)),
    225            lstring_value(symbol_name(vars[index])),
    226            lstring_value(symbol_name(name))
     224           lstring_value(((LispSymbol *)name)->GetName()),
     225           lstring_value(((LispSymbol *)vars[index])->GetName()),
     226           lstring_value(((LispSymbol *)name)->GetName())
    227227           );
    228228    exit(0);
     
    285285  }
    286286  for (i=0;i<tiv;i++)
    287     if (!strcmp(lstring_value(symbol_name(vars[i])),name))
     287    if (!strcmp(lstring_value(((LispSymbol *)vars[i])->GetName()),name))
    288288      return 1;
    289289  return 0;
     
    301301  tiv=0;
    302302
    303   void *l_abil=  make_find_symbol("abilities");
    304   void *l_funs=  make_find_symbol("funs");
    305   void *l_states=make_find_symbol("states");
    306   void *l_flags= make_find_symbol("flags");
    307   void *l_range= make_find_symbol("range");
    308   void *l_draw_range= make_find_symbol("draw_range");
    309   void *l_fields=make_find_symbol("fields");
    310   void *l_logo=  make_find_symbol("logo");
    311   void *l_vars=  make_find_symbol("vars");
     303  LispSymbol *l_abil =   LispSymbol::FindOrCreate("abilities");
     304  LispSymbol *l_funs =   LispSymbol::FindOrCreate("funs");
     305  LispSymbol *l_states = LispSymbol::FindOrCreate("states");
     306  LispSymbol *l_flags =  LispSymbol::FindOrCreate("flags");
     307  LispSymbol *l_range =  LispSymbol::FindOrCreate("range");
     308  LispSymbol *l_draw_range = LispSymbol::FindOrCreate("draw_range");
     309  LispSymbol *l_fields = LispSymbol::FindOrCreate("fields");
     310  LispSymbol *l_logo =   LispSymbol::FindOrCreate("logo");
     311  LispSymbol *l_vars =   LispSymbol::FindOrCreate("vars");
    312312
    313313  memset(fun_table,0,sizeof(fun_table));     // destory all hopes of fun
     
    336336      for (i=0;i<TOTAL_ABILITIES;i++)
    337337      {
    338     Cell *ab=assoc(make_find_symbol(ability_names[i]),l);
     338    Cell *ab=assoc(LispSymbol::FindOrCreate(ability_names[i]),l);
    339339    p_ref r5(ab);
    340340    if (!NILP(ab))
     
    347347      for (i=0;i<TOTAL_OFUNS;i++)
    348348      {
    349     Cell *ab=assoc(make_find_symbol(ofun_names[i]),l);
     349    Cell *ab=assoc(LispSymbol::FindOrCreate(ofun_names[i]),l);
    350350    p_ref r5(ab);
    351351    if (!NILP(ab) && lcar(lcdr(ab)))
     
    358358      for (i=0;i<TOTAL_CFLAGS;i++)
    359359      {
    360     Cell *ab=assoc(make_find_symbol(cflag_names[i]),l);
     360    Cell *ab=assoc(LispSymbol::FindOrCreate(cflag_names[i]),l);
    361361    p_ref r5(ab);
    362362    if (!NILP(ab) && eval(lcar(lcdr(ab))))
     
    440440  if (!seq[stopped])
    441441    lbreak("object (%s) has no stopped state, please define one!\n",
    442        lstring_value(symbol_name(name)));
     442       lstring_value(((LispSymbol *)name)->GetName()));
    443443
    444444/*  char *fn=lstring_value(lcar(desc));
Note: See TracChangeset for help on using the changeset viewer.