Changeset 501
- Timestamp:
- Apr 18, 2011, 3:22:27 AM (11 years ago)
- Location:
- abuse/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/game.cpp
r497 r501 2487 2487 2488 2488 game_net_init(argc, argv); 2489 // lisp_init(0x100000, 0x94000);2490 2489 lisp_init(0x80000, 0x94000); 2491 // lisp_init(0x20000, 0x94000);2492 // lisp_init(0x100000, 0x10000);2493 2490 2494 2491 dev_init(argc, argv); -
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 -
abuse/trunk/src/lisp/lisp.h
r499 r501 154 154 struct LUserFunction : LObject 155 155 { 156 #ifndef NO_LIBS 157 intptr_t alist, blist; // id for cached blocks 158 #else 159 void *arg_list, *block_list; 160 #endif 156 LList *arg_list, *block_list; 161 157 }; 162 158 … … 238 234 LSysFunction *new_lisp_c_bool(int min_args, int max_args, int fun_number); 239 235 240 #ifdef NO_LIBS 241 LUserFunction *new_lisp_user_function(void *arg_list, void *block_list); 242 #else 243 LUserFunction *new_lisp_user_function(intptr_t arg_list, intptr_t block_list); 244 #endif 236 LUserFunction *new_lisp_user_function(LList *arg_list, LList *block_list); 245 237 246 238 LSysFunction *new_user_lisp_function(int min_args, int max_args, int fun_number); -
abuse/trunk/src/lisp/lisp_gc.cpp
r497 r501 148 148 break; 149 149 case L_USER_FUNCTION: 150 #ifndef NO_LIBS 151 ret = new_lisp_user_function(((LUserFunction *)x)->alist, 152 ((LUserFunction *)x)->blist); 153 154 #else 155 { 156 LObject *arg = CollectObject(((LUserFunction *)x)->arg_list); 157 LObject *block = CollectObject(((LUserFunction *)x)->block_list); 158 ret = new_lisp_user_function(arg, block); 159 } 160 #endif 161 break; 150 { 151 LUserFunction *fun = (LUserFunction *)x; 152 LList *arg = (LList *)CollectObject(fun->arg_list); 153 LList *block = (LList *)CollectObject(fun->block_list); 154 ret = new_lisp_user_function(arg, block); 155 break; 156 } 162 157 case L_STRING: 163 158 ret = LString::Create(lstring_value(x)); … … 261 256 void collect_space(int which_space) // should be tmp or permanent 262 257 { 263 return; /* XXX: temporary hack */264 265 258 int old_space = current_space; 266 259 cstart = space[which_space];
Note: See TracChangeset
for help on using the changeset viewer.