Changeset 501 for abuse/trunk/src/lisp/lisp.cpp
- Timestamp:
- Apr 18, 2011, 3:22:27 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/lisp/lisp.cpp
r499 r501 180 180 void *lmalloc(int size, int which_space) 181 181 { 182 return malloc(size); /* XXX: temporary hack */183 184 182 #ifdef WORD_ALIGN 185 183 size=(size+3)&(~3); … … 355 353 } 356 354 357 #ifdef NO_LIBS 358 LUserFunction *new_lisp_user_function(void *arg_list, void *block_list) 355 LUserFunction *new_lisp_user_function(LList *arg_list, LList *block_list) 359 356 { 360 357 PtrRef r1(arg_list), r2(block_list); … … 370 367 return lu; 371 368 } 372 #else373 LUserFunction *new_lisp_user_function(intptr_t arg_list, intptr_t block_list)374 {375 // Make sure all functions get defined in permanent space376 int sp = current_space;377 if (current_space != GC_SPACE)378 current_space = PERM_SPACE;379 380 size_t size = sizeof(LUserFunction);381 if (size < sizeof(LRedirect))382 size = sizeof(LRedirect);383 384 LUserFunction *lu = (LUserFunction *)lmalloc(size, current_space);385 lu->type = L_USER_FUNCTION;386 lu->alist = arg_list;387 lu->blist = block_list;388 389 current_space = sp;390 391 return lu;392 }393 #endif394 369 395 370 LSysFunction *new_lisp_sys_function(int min_args, int max_args, int fun_number) … … 2148 2123 { 2149 2124 LSymbol *symbol = (LSymbol *)CAR(arg_list); 2125 PtrRef r1(symbol); 2150 2126 #ifdef TYPE_CHECKING 2151 2127 if (item_type(symbol) != L_SYMBOL) … … 2165 2141 LObject *block_list = CDR(CDR(arg_list)); 2166 2142 2167 #ifndef NO_LIBS 2168 intptr_t a = cache.reg_lisp_block(lcar(lcdr(arg_list))); 2169 intptr_t b = cache.reg_lisp_block(block_list); 2170 LUserFunction *ufun = new_lisp_user_function(a, b); 2171 #else 2172 LUserFunction *ufun = new_lisp_user_function(lcar(lcdr(arg_list)), block_list); 2173 #endif 2143 LUserFunction *ufun = new_lisp_user_function((LList *)lcar(lcdr(arg_list)), (LList *)block_list); 2174 2144 symbol->SetFunction(ufun); 2175 2145 ret = symbol; … … 3002 2972 void use_user_space(void *addr, long size) 3003 2973 { 3004 current_space = 2;2974 current_space = USER_SPACE; 3005 2975 free_space[USER_SPACE] = space[USER_SPACE] = (uint8_t *)addr; 3006 2976 space_size[USER_SPACE] = size; … … 3035 3005 #endif 3036 3006 3037 #ifndef NO_LIBS 3038 void *fun_arg_list = cache.lblock(fun->alist); 3039 void *block_list = cache.lblock(fun->blist); 3007 LList *fun_arg_list = fun->arg_list; 3008 LList *block_list = fun->block_list; 3040 3009 PtrRef r9(block_list), r10(fun_arg_list); 3041 #else3042 void *fun_arg_list = fun->arg_list;3043 void *block_list = fun->block_list;3044 PtrRef r9(block_list), r10(fun_arg_list);3045 #endif3046 3010 3047 3011 // mark the start start, so we can restore when done … … 3053 3017 PtrRef r19(arg_list); 3054 3018 3055 for (f_arg = (LObject *)fun_arg_list; f_arg; f_arg = CDR(f_arg))3019 for (f_arg = fun_arg_list; f_arg; f_arg = CDR(f_arg)) 3056 3020 { 3057 3021 LSymbol *s = (LSymbol *)CAR(f_arg); … … 3064 3028 int i = new_start; 3065 3029 // now push all the values we wish to gather 3066 for (f_arg = (LObject *)fun_arg_list; f_arg; f_arg = CDR(f_arg))3030 for (f_arg = fun_arg_list; f_arg; f_arg = CDR(f_arg)) 3067 3031 { 3068 3032 if (!arg_list) … … 3077 3041 3078 3042 // now store all the values and put them into the symbols 3079 for (f_arg = (LObject *)fun_arg_list; f_arg; f_arg = CDR(f_arg))3043 for (f_arg = fun_arg_list; f_arg; f_arg = CDR(f_arg)) 3080 3044 ((LSymbol *)CAR(f_arg))->SetValue((LObject *)l_user_stack.sdata[i++]); 3081 3045 … … 3094 3058 { 3095 3059 ret = CAR(block_list)->Eval(); 3096 block_list = CDR(block_list);3060 block_list = (LList *)CDR(block_list); 3097 3061 } 3098 3062 3099 3063 long cur_stack = stack_start; 3100 for (f_arg = (LObject *)fun_arg_list; f_arg; f_arg = CDR(f_arg))3064 for (f_arg = fun_arg_list; f_arg; f_arg = CDR(f_arg)) 3101 3065 ((LSymbol *)CAR(f_arg))->SetValue((LObject *)l_user_stack.sdata[cur_stack++]); 3102 3066
Note: See TracChangeset
for help on using the changeset viewer.