Changeset 489


Ignore:
Timestamp:
Apr 17, 2011, 10:28:40 AM (6 years ago)
Author:
sam
Message:

lisp: no LispSymbol? members are anonymous pointers any longer.

Location:
abuse/trunk/src
Files:
6 edited

Legend:

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

    r488 r489  
    957957}
    958958
    959 void LispSymbol::SetFunction(void *fun)
     959void LispSymbol::SetFunction(LispObject *fun)
    960960{
    961961    function = fun;
     
    19621962            {
    19631963              if (x==L_NUMBER && ((LispSymbol *)i)->value!=l_undefined)
    1964               ((LispNumber *)(((LispSymbol *)i)->value))->num=lnumber_value(set_to);
     1964                ((LispSymbol *)i)->SetNumber(lnumber_value(set_to));
    19651965              else
    1966               ((LispSymbol *)i)->value=set_to;
     1966                ((LispSymbol *)i)->SetValue((LispNumber *)set_to);
    19671967            } break;
    19681968            case L_OBJECT_VAR :
     
    19711971            } break;
    19721972            default :
    1973             ((LispSymbol *)i)->value=set_to;
     1973              ((LispSymbol *)i)->SetValue((LispObject *)set_to);
    19741974          }
    19751975          ret=((LispSymbol *)i)->value;
     
    20872087    l_user_stack.push(((LispSymbol *)var_name)->value);
    20882088    tmp=eval(CAR(CDR(CAR(var_list))));   
    2089     ((LispSymbol *)var_name)->value=tmp;
     2089    ((LispSymbol *)var_name)->SetValue((LispObject *)tmp);
    20902090    var_list=CDR(var_list);
    20912091      }
     
    21042104      {
    21052105    void *var_name=CAR(CAR(var_list));
    2106     ((LispSymbol *)var_name)->value=l_user_stack.sdata[cur_stack++];
     2106    ((LispSymbol *)var_name)->SetValue((LispObject *)l_user_stack.sdata[cur_stack++]);
    21072107    var_list=CDR(var_list);
    21082108      }
     
    25462546      while (ilist)
    25472547      {
    2548                 bind_var->SetValue(CAR(ilist));
     2548                bind_var->SetValue((LispObject *)CAR(ilist));
    25492549                for (block=arg_list;block;block=CDR(block))
    25502550                  ret=eval(CAR(block));
    25512551                ilist=CDR(ilist);
    25522552      }
    2553       bind_var->SetValue(l_user_stack.pop(1)); // restore symbol value
     2553      bind_var->SetValue((LispObject *)l_user_stack.pop(1)); // restore symbol value
    25542554      ret=ret;
    25552555    } break;
     
    27152715      {
    27162716                sym = (LispSymbol *)CAR(CAR(init_var));
    2717                 sym->SetValue(*do_evaled);
     2717                sym->SetValue((LispObject *)*do_evaled);
    27182718      }
    27192719
     
    27372737      {
    27382738                sym = (LispSymbol *)CAR(CAR(init_var));
    2739                 sym->SetValue(*do_evaled);
     2739                sym->SetValue((LispObject *)*do_evaled);
    27402740      }
    27412741
     
    29372937    // now store all the values and put them into the symbols
    29382938    for (f_arg=fun_arg_list;f_arg;f_arg=CDR(f_arg))
    2939       ((LispSymbol *)CAR(f_arg))->value=l_user_stack.sdata[i++];
     2939      ((LispSymbol *)CAR(f_arg))->SetValue((LispObject *)l_user_stack.sdata[i++]);
    29402940
    29412941    l_user_stack.son=new_start;
     
    29572957  long cur_stack=stack_start;
    29582958  for (f_arg=fun_arg_list;f_arg;f_arg=CDR(f_arg))
    2959     ((LispSymbol *)CAR(f_arg))->value=l_user_stack.sdata[cur_stack++];
     2959    ((LispSymbol *)CAR(f_arg))->SetValue((LispObject *)l_user_stack.sdata[cur_stack++]);
    29602960
    29612961  l_user_stack.son=stack_start;
     
    31273127}
    31283128
    3129 void *LispSymbol::GetName()
     3129LispString *LispSymbol::GetName()
    31303130{
    31313131#ifdef TYPE_CHECKING
     
    31563156}
    31573157
    3158 void LispSymbol::SetValue(void *val)
     3158void LispSymbol::SetValue(LispObject *val)
    31593159{
    31603160#ifdef TYPE_CHECKING
     
    31693169}
    31703170
    3171 void *LispSymbol::GetFunction()
     3171LispObject *LispSymbol::GetFunction()
    31723172{
    31733173#ifdef TYPE_CHECKING
     
    31823182}
    31833183
    3184 void *LispSymbol::GetValue()
     3184LispObject *LispSymbol::GetValue()
    31853185{
    31863186#ifdef TYPE_CHECKING
  • abuse/trunk/src/lisp/lisp.h

    r488 r489  
    1212
    1313#include <stdint.h>
    14 
    15 #include "lisp_opt.h"
    1614
    1715#ifdef L_PROFILE
     
    8987    static LispSymbol *FindOrCreate(char const *name);
    9088
    91     void *GetName();
    92     void *GetFunction();
    93     void *GetValue();
    94 
    95     void SetFunction(void *fun);
    96     void SetValue(void *value);
     89    LispString *GetName();
     90    LispObject *GetFunction();
     91    LispObject *GetValue();
     92
     93    void SetFunction(LispObject *fun);
     94    void SetValue(LispObject *value);
    9795    void SetNumber(long num);
    9896
     
    10098    float time_taken;
    10199#endif
    102     void *value, *function;
     100    LispObject *value;
     101    LispObject *function;
    103102    LispString *name;
    104103    LispSymbol *left, *right; // tree structure
     
    153152static inline void *&CAR(void *x) { return ((LispList *)x)->car; }
    154153static inline void *&CDR(void *x) { return ((LispList *)x)->cdr; }
     154static inline ltype item_type(void *x) { if (x) return *(ltype *)x; return L_CONS_CELL; }
    155155
    156156void perm_space();
    157157void tmp_space();
    158158void use_user_space(void *addr, long size);
    159 #define item_type(c) ((c) ? *((ltype *)c) : (ltype)L_CONS_CELL)
    160159void *lpointer_value(void *lpointer);
    161160int32_t lnumber_value(void *lnumber);
     
    235234static inline char *lstring_value(void *str) { return ((LispString *)str)->GetString(); }
    236235
    237 
    238 
    239 #endif
     236#include "lisp_opt.h"
     237
     238#endif
  • abuse/trunk/src/lisp/lisp_gc.cpp

    r488 r489  
    222222  if (root)
    223223  {
    224     root->value = collect_object(root->value);
    225     root->function = collect_object(root->function);
     224    root->value = (LispObject *)collect_object(root->value);
     225    root->function = (LispObject *)collect_object(root->function);
    226226    root->name = (LispString *)collect_object(root->name);
    227227    collect_symbols(root->left);
  • abuse/trunk/src/lisp/lisp_opt.cpp

    r484 r489  
    1919#include "lisp_gc.h"
    2020
    21 void *true_symbol=NULL,*l_undefined,*list_symbol,*string_symbol,     // in lisp_init()
     21LispObject *l_undefined;
     22LispSymbol *true_symbol = NULL;
     23
     24void *list_symbol,*string_symbol,     // in lisp_init()
    2225     *quote_symbol,*backquote_symbol,*comma_symbol,*do_symbol,*in_symbol,*aref_symbol,
    2326     *colon_initial_contents,*colon_initial_element,*if_symbol,
  • abuse/trunk/src/lisp/lisp_opt.h

    r481 r489  
    1111#define __LISP_OPT_HPP_
    1212
    13 extern void *true_symbol,*l_undefined,*list_symbol,*string_symbol,     // in lisp_init()
     13#include "lisp.h"
     14
     15extern LispObject *l_undefined;
     16extern LispSymbol *true_symbol;
     17
     18extern void *list_symbol,*string_symbol,     // in lisp_init()
    1419           *quote_symbol,*backquote_symbol,*comma_symbol,*do_symbol,*in_symbol,*aref_symbol,
    1520       *colon_initial_contents,*colon_initial_element,*if_symbol,
  • abuse/trunk/src/menu.cpp

    r484 r489  
    385385//    char *prog="((\"art/endgame.spe\" . \"credit\") (\"art/help.spe\" . \"sell6\"))";
    386386    char const *prog="((\"art/endgame.spe\" . \"credit\"))";
    387     ss->SetValue(compile(prog));
     387    ss->SetValue((LispObject *)compile(prog));
    388388    current_space=sp;
    389389  }
Note: See TracChangeset for help on using the changeset viewer.