Changeset 482 for abuse/trunk
- Timestamp:
- Apr 17, 2011, 10:28:12 AM (12 years ago)
- Location:
- abuse/trunk/src
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/ant.cpp
r481 r482 118 118 push_onto_list(new_lisp_number(o->aitype()),call_list); 119 119 push_onto_list(new_lisp_pointer(o),call_list); 120 eval_user_fun(( lisp_symbol *)l_fire_object,call_list);120 eval_user_fun((LispSymbol *)l_fire_object,call_list); 121 121 o->set_state((character_state)S_weapon_fire); 122 122 } -
abuse/trunk/src/cache.cpp
r481 r482 386 386 push_onto_list(new_lisp_number(type),call_with); 387 387 388 void *CacheList=eval_function(( lisp_symbol *)cache_fun,call_with);388 void *CacheList=eval_function((LispSymbol *)cache_fun,call_with); 389 389 p_ref r1(CacheList); 390 390 -
abuse/trunk/src/chars.cpp
r481 r482 202 202 /* First see if the variable has been defined for another object 203 203 if so report a conflict if any occur */ 204 lisp_symbol *s=(lisp_symbol *)symbol;204 LispSymbol *s=(LispSymbol *)symbol; 205 205 if (DEFINEDP(s->value) && (item_type(s->value)!=L_OBJECT_VAR)) 206 206 { … … 210 210 } else if (DEFINEDP(s->value)) 211 211 { 212 int index=(( lisp_object_var *)s->value)->number;212 int index=((LispObjectVar *)s->value)->number; 213 213 if (index<tiv) 214 214 { -
abuse/trunk/src/clisp.cpp
r481 r482 576 576 exit(0); 577 577 } 578 return eval_function(( lisp_symbol *)ai,NULL);578 return eval_function((LispSymbol *)ai,NULL); 579 579 } break; 580 580 case 1 : … … 704 704 void *f=figures[current_object->otype]->get_fun(OFUN_USER_FUN); 705 705 if (!f) return NULL; 706 return eval_function(( lisp_symbol *)f,args);706 return eval_function((LispSymbol *)f,args); 707 707 } break; 708 708 case 17 : … … 753 753 case 23 : // def_character 754 754 { 755 lisp_symbol *sym=(lisp_symbol *)lcar(args);755 LispSymbol *sym=(LispSymbol *)lcar(args); 756 756 if (item_type(sym)!=L_SYMBOL) 757 757 { … … 1350 1350 case 133 : // def_sound 1351 1351 { 1352 lisp_symbol *sym=NULL;1352 LispSymbol *sym=NULL; 1353 1353 if (CDR(args)) 1354 1354 { 1355 sym=( lisp_symbol *)lcar(args);1355 sym=(LispSymbol *)lcar(args); 1356 1356 if (item_type(sym)!=L_SYMBOL) 1357 1357 { … … 2259 2259 current_object=v->focus; 2260 2260 2261 eval_function(( lisp_symbol *)l_restart_player,NULL);2261 eval_function((LispSymbol *)l_restart_player,NULL); 2262 2262 v->reset_player(); 2263 2263 v->focus->set_aistate(0); -
abuse/trunk/src/compiled.cpp
r481 r482 45 45 if (sym) 46 46 { 47 if (item_type((( lisp_symbol *)sym)->value)!=L_NUMBER)47 if (item_type(((LispSymbol *)sym)->value)!=L_NUMBER) 48 48 compile_error=1; 49 49 else 50 return lnumber_value((( lisp_symbol *)sym)->value);50 return lnumber_value(((LispSymbol *)sym)->value); 51 51 } else compile_error=1; 52 52 return 0; -
abuse/trunk/src/cop.cpp
r481 r482 233 233 push_onto_list(new_lisp_number(type),list); 234 234 push_onto_list(new_lisp_pointer(o->get_object(0)),list); 235 eval_function(( lisp_symbol *)l_fire_object,list);235 eval_function((LispSymbol *)l_fire_object,list); 236 236 o->lvars[top_just_fired]=1; 237 237 other->lvars[just_fired]=1; … … 662 662 663 663 current_object=top; 664 void *ret=eval_function(( lisp_symbol *)figures[top->otype]->get_fun(OFUN_USER_FUN),args);664 void *ret=eval_function((LispSymbol *)figures[top->otype]->get_fun(OFUN_USER_FUN),args); 665 665 current_object=o; 666 666 v->add_ammo(v->current_weapon,lnumber_value(ret)); … … 672 672 { 673 673 // call the user function to reset the player 674 eval_function(( lisp_symbol *)l_restart_player,NULL);674 eval_function((LispSymbol *)l_restart_player,NULL); 675 675 o->controller()->reset_player(); 676 676 o->set_aistate(0); … … 766 766 o->draw_predator(); 767 767 } else 768 eval_function(( lisp_symbol *)l_player_draw,ret);768 eval_function((LispSymbol *)l_player_draw,ret); 769 769 770 770 o->y=oldy; … … 829 829 case FAST_POWER : 830 830 { 831 eval_function(( lisp_symbol *)l_draw_fast,NULL);831 eval_function((LispSymbol *)l_draw_fast,NULL); 832 832 int old_state=o->state; 833 833 switch (o->state) -
abuse/trunk/src/game.cpp
r481 r482 690 690 screen->dirt_off(); 691 691 clear_tmp(); 692 eval_function(( lisp_symbol *)l_post_render, NULL);692 eval_function((LispSymbol *)l_post_render, NULL); 693 693 clear_tmp(); 694 694 screen->dirt_on(); … … 2344 2344 int sp = current_space; 2345 2345 current_space = PERM_SPACE; 2346 eval_function(( lisp_symbol *)l_next_song, NULL);2346 eval_function((LispSymbol *)l_next_song, NULL); 2347 2347 current_space = sp; 2348 2348 } */ -
abuse/trunk/src/lcache.cpp
r481 r482 27 27 for (;b && item_type(b)==L_CONS_CELL;b=CDR(b)) 28 28 { 29 t+=sizeof( cons_cell);29 t+=sizeof(LispList); 30 30 } 31 31 if (b) t+=block_size(b); … … 34 34 ret=t; 35 35 } else if (type== L_NUMBER) 36 { ret=sizeof( lisp_number); }36 { ret=sizeof(LispNumber); } 37 37 else if (type==L_CHARACTER) 38 { ret=sizeof( lisp_character); }38 { ret=sizeof(LispChar); } 39 39 else if (type==L_STRING) 40 40 { 41 ret=sizeof( lisp_string)+strlen(lstring_value(level))+1;41 ret=sizeof(LispString)+strlen(lstring_value(level))+1; 42 42 if (ret<8) 43 43 ret=8; 44 44 } 45 45 else if (type==L_POINTER) 46 { ret=sizeof( lisp_pointer); }46 { ret=sizeof(LispPointer); } 47 47 else ret=0; 48 48 } … … 108 108 case L_STRING : 109 109 { long l=fp->read_uint32(); 110 lisp_string *s=new_lisp_string(l);110 LispString *s=new_lisp_string(l); 111 111 fp->read(lstring_value(s),l); 112 112 return s; … … 121 121 { 122 122 long x=abs(t); 123 cons_cell*last=NULL,*first=NULL;123 LispList *last=NULL,*first=NULL; 124 124 while (x) 125 125 { 126 cons_cell*c=new_cons_cell();126 LispList *c=new_cons_cell(); 127 127 if (first) 128 128 last->cdr=c; … … 135 135 else last->cdr=NULL; 136 136 137 for (last=first,x=0;x<abs(t);x++,last=( cons_cell*)last->cdr)137 for (last=first,x=0;x<abs(t);x++,last=(LispList *)last->cdr) 138 138 last->car=load_block(fp); 139 139 return first; -
abuse/trunk/src/level.cpp
r481 r482 1511 1511 p_ref r1(arg_list); 1512 1512 push_onto_list(new_lisp_string(n),arg_list); 1513 eval_function(( lisp_symbol *)l_level_loaded,arg_list);1513 eval_function((LispSymbol *)l_level_loaded,arg_list); 1514 1514 1515 1515 current_space=sp; … … 1838 1838 current_object=f->focus; 1839 1839 void *m=mark_heap(TMP_SPACE); 1840 eval_function(( lisp_symbol *)fun,NULL);1840 eval_function((LispSymbol *)fun,NULL); 1841 1841 restore_heap(m,TMP_SPACE); 1842 1842 } -
abuse/trunk/src/lisp/lisp.cpp
r481 r482 41 41 42 42 bFILE *current_print_file=NULL; 43 lisp_symbol *lsym_root=NULL;43 LispSymbol *lsym_root=NULL; 44 44 long ltotal_syms=0; 45 45 … … 220 220 } 221 221 222 lisp_1d_array *new_lisp_1d_array(int size, void *rest)222 LispArray *new_lisp_1d_array(int size, void *rest) 223 223 { 224 224 p_ref r11(rest); 225 size_t s=sizeof( lisp_1d_array)+size*sizeof(void *);225 size_t s=sizeof(LispArray)+size*sizeof(void *); 226 226 if (s<8 + sizeof(intptr_t)) s=8 + sizeof(intptr_t); 227 void *p=( lisp_1d_array *)lmalloc(s, current_space);228 (( lisp_1d_array *)p)->type=L_1D_ARRAY;229 (( lisp_1d_array *)p)->size=size;230 void **data=(void **)((( lisp_1d_array *)p)+1);227 void *p=(LispArray *)lmalloc(s, current_space); 228 ((LispArray *)p)->type=L_1D_ARRAY; 229 ((LispArray *)p)->size=size; 230 void **data=(void **)(((LispArray *)p)+1); 231 231 memset(data, 0, size*sizeof(void *)); 232 232 p_ref r1(p); … … 238 238 { 239 239 x=eval(CAR(CDR(rest))); 240 data=(void **)((( lisp_1d_array *)p)+1);240 data=(void **)(((LispArray *)p)+1); 241 241 for (int i=0;i<size;i++, x=CDR(x)) 242 242 { … … 254 254 { 255 255 x=eval(CAR(CDR(rest))); 256 data=(void **)((( lisp_1d_array *)p)+1);256 data=(void **)(((LispArray *)p)+1); 257 257 for (int i=0;i<size;i++) 258 258 data[i]=x; … … 266 266 } 267 267 268 return (( lisp_1d_array *)p);269 } 270 271 lisp_fixed_point *new_lisp_fixed_point(int32_t x)272 { 273 lisp_fixed_point *p=(lisp_fixed_point *)lmalloc(sizeof(lisp_fixed_point), current_space);268 return ((LispArray *)p); 269 } 270 271 LispFixedPoint *new_lisp_fixed_point(int32_t x) 272 { 273 LispFixedPoint *p=(LispFixedPoint *)lmalloc(sizeof(LispFixedPoint), current_space); 274 274 p->type=L_FIXED_POINT; 275 275 p->x=x; … … 278 278 279 279 280 lisp_object_var *new_lisp_object_var(int16_t number)281 { 282 lisp_object_var *p=(lisp_object_var *)lmalloc(sizeof(lisp_object_var), current_space);280 LispObjectVar *new_lisp_object_var(int16_t number) 281 { 282 LispObjectVar *p=(LispObjectVar *)lmalloc(sizeof(LispObjectVar), current_space); 283 283 p->type=L_OBJECT_VAR; 284 284 p->number=number; … … 287 287 288 288 289 struct lisp_pointer *new_lisp_pointer(void *addr)289 struct LispPointer *new_lisp_pointer(void *addr) 290 290 { 291 291 if (addr==NULL) return NULL; 292 lisp_pointer *p=(lisp_pointer *)lmalloc(sizeof(lisp_pointer), current_space);292 LispPointer *p=(LispPointer *)lmalloc(sizeof(LispPointer), current_space); 293 293 p->type=L_POINTER; 294 294 p->addr=addr; … … 296 296 } 297 297 298 struct lisp_character *new_lisp_character(uint16_t ch)299 { 300 lisp_character *c=(lisp_character *)lmalloc(sizeof(lisp_character), current_space);298 struct LispChar *new_lisp_character(uint16_t ch) 299 { 300 LispChar *c=(LispChar *)lmalloc(sizeof(LispChar), current_space); 301 301 c->type=L_CHARACTER; 302 302 c->ch=ch; … … 304 304 } 305 305 306 struct lisp_string *new_lisp_string(char const *string)307 { 308 size_t size=sizeof( lisp_string)+strlen(string)+1;306 struct LispString *new_lisp_string(char const *string) 307 { 308 size_t size=sizeof(LispString)+strlen(string)+1; 309 309 if (size<8 + sizeof(intptr_t)) size=8 + sizeof(intptr_t); 310 310 311 lisp_string *s=(lisp_string *)lmalloc(size, current_space);311 LispString *s=(LispString *)lmalloc(size, current_space); 312 312 s->type=L_STRING; 313 char *sloc=((char *)s)+sizeof( lisp_string);313 char *sloc=((char *)s)+sizeof(LispString); 314 314 strcpy(sloc, string); 315 315 return s; 316 316 } 317 317 318 struct lisp_string *new_lisp_string(char const *string, int length)319 { 320 size_t size=sizeof( lisp_string)+length+1;318 struct LispString *new_lisp_string(char const *string, int length) 319 { 320 size_t size=sizeof(LispString)+length+1; 321 321 if (size<8 + sizeof(intptr_t)) size=8 + sizeof(intptr_t); 322 lisp_string *s=(lisp_string *)lmalloc(size, current_space);322 LispString *s=(LispString *)lmalloc(size, current_space); 323 323 s->type=L_STRING; 324 char *sloc=((char *)s)+sizeof( lisp_string);324 char *sloc=((char *)s)+sizeof(LispString); 325 325 memcpy(sloc, string, length); 326 326 sloc[length]=0; … … 328 328 } 329 329 330 struct lisp_string *new_lisp_string(int length)331 { 332 size_t size=sizeof( lisp_string)+length;330 struct LispString *new_lisp_string(int length) 331 { 332 size_t size=sizeof(LispString)+length; 333 333 if (size<8 + sizeof(intptr_t)) size=8 + sizeof(intptr_t); 334 lisp_string *s=(lisp_string *)lmalloc(size, current_space);334 LispString *s=(LispString *)lmalloc(size, current_space); 335 335 s->type=L_STRING; 336 char *sloc=((char *)s)+sizeof( lisp_string);336 char *sloc=((char *)s)+sizeof(LispString); 337 337 strcpy(sloc, ""); 338 338 return s; … … 340 340 341 341 #ifdef NO_LIBS 342 lisp_user_function *new_lisp_user_function(void *arg_list, void *block_list)342 LispUserFunction *new_lisp_user_function(void *arg_list, void *block_list) 343 343 { 344 344 p_ref r1(arg_list), r2(block_list); 345 lisp_user_function *lu=(lisp_user_function *)lmalloc(sizeof(lisp_user_function), current_space);345 LispUserFunction *lu=(LispUserFunction *)lmalloc(sizeof(LispUserFunction), current_space); 346 346 lu->type=L_USER_FUNCTION; 347 347 lu->arg_list=arg_list; … … 350 350 } 351 351 #else 352 lisp_user_function *new_lisp_user_function(intptr_t arg_list, intptr_t block_list)352 LispUserFunction *new_lisp_user_function(intptr_t arg_list, intptr_t block_list) 353 353 { 354 354 int sp=current_space; … … 356 356 current_space=PERM_SPACE; // make sure all functions get defined in permanant space 357 357 358 lisp_user_function *lu=(lisp_user_function *)lmalloc(sizeof(lisp_user_function), current_space);358 LispUserFunction *lu=(LispUserFunction *)lmalloc(sizeof(LispUserFunction), current_space); 359 359 lu->type=L_USER_FUNCTION; 360 360 lu->alist=arg_list; … … 368 368 369 369 370 lisp_sys_function *new_lisp_sys_function(int min_args, int max_args, int fun_number)370 LispSysFunction *new_lisp_sys_function(int min_args, int max_args, int fun_number) 371 371 { 372 372 // sys functions should reside in permanant space 373 lisp_sys_function *ls=(lisp_sys_function *)lmalloc(sizeof(lisp_sys_function),373 LispSysFunction *ls=(LispSysFunction *)lmalloc(sizeof(LispSysFunction), 374 374 current_space==GC_SPACE ? GC_SPACE : PERM_SPACE); 375 375 ls->type=L_SYS_FUNCTION; … … 380 380 } 381 381 382 lisp_sys_function *new_lisp_c_function(int min_args, int max_args, int fun_number)382 LispSysFunction *new_lisp_c_function(int min_args, int max_args, int fun_number) 383 383 { 384 384 // sys functions should reside in permanant space 385 lisp_sys_function *ls=(lisp_sys_function *)lmalloc(sizeof(lisp_sys_function),385 LispSysFunction *ls=(LispSysFunction *)lmalloc(sizeof(LispSysFunction), 386 386 current_space==GC_SPACE ? GC_SPACE : PERM_SPACE); 387 387 ls->type=L_C_FUNCTION; … … 392 392 } 393 393 394 lisp_sys_function *new_lisp_c_bool(int min_args, int max_args, int fun_number)394 LispSysFunction *new_lisp_c_bool(int min_args, int max_args, int fun_number) 395 395 { 396 396 // sys functions should reside in permanant space 397 lisp_sys_function *ls=(lisp_sys_function *)lmalloc(sizeof(lisp_sys_function),397 LispSysFunction *ls=(LispSysFunction *)lmalloc(sizeof(LispSysFunction), 398 398 current_space==GC_SPACE ? GC_SPACE : PERM_SPACE); 399 399 ls->type=L_C_BOOL; … … 404 404 } 405 405 406 lisp_sys_function *new_user_lisp_function(int min_args, int max_args, int fun_number)406 LispSysFunction *new_user_lisp_function(int min_args, int max_args, int fun_number) 407 407 { 408 408 // sys functions should reside in permanant space 409 lisp_sys_function *ls=(lisp_sys_function *)lmalloc(sizeof(lisp_sys_function),409 LispSysFunction *ls=(LispSysFunction *)lmalloc(sizeof(LispSysFunction), 410 410 current_space==GC_SPACE ? GC_SPACE : PERM_SPACE); 411 411 ls->type=L_L_FUNCTION; … … 416 416 } 417 417 418 lisp_number *new_lisp_node(long num)419 { 420 lisp_number *n=(lisp_number *)lmalloc(sizeof(lisp_number), current_space);418 LispNumber *new_lisp_node(long num) 419 { 420 LispNumber *n=(LispNumber *)lmalloc(sizeof(LispNumber), current_space); 421 421 n->type=L_NUMBER; 422 422 n->num=num; … … 424 424 } 425 425 426 lisp_symbol *new_lisp_symbol(char *name)427 { 428 lisp_symbol *s=(lisp_symbol *)lmalloc(sizeof(lisp_symbol), current_space);426 LispSymbol *new_lisp_symbol(char *name) 427 { 428 LispSymbol *s=(LispSymbol *)lmalloc(sizeof(LispSymbol), current_space); 429 429 s->type=L_SYMBOL; 430 430 s->name=new_lisp_string(name); … … 437 437 } 438 438 439 lisp_number *new_lisp_number(long num)440 { 441 lisp_number *s=(lisp_number *)lmalloc(sizeof(lisp_number), current_space);439 LispNumber *new_lisp_number(long num) 440 { 441 LispNumber *s=(LispNumber *)lmalloc(sizeof(LispNumber), current_space); 442 442 s->type=L_NUMBER; 443 443 s->num=num; … … 446 446 447 447 448 cons_cell*new_cons_cell()449 { 450 cons_cell *c=(cons_cell *)lmalloc(sizeof(cons_cell), current_space);448 LispList *new_cons_cell() 449 { 450 LispList *c=(LispList *)lmalloc(sizeof(LispList), current_space); 451 451 c->type=L_CONS_CELL; 452 452 c->car=NULL; … … 503 503 } 504 504 #endif 505 return (( lisp_pointer *)lpointer)->addr;505 return ((LispPointer *)lpointer)->addr; 506 506 } 507 507 … … 511 511 { 512 512 case L_NUMBER : 513 return (( lisp_number *)lnumber)->num;513 return ((LispNumber *)lnumber)->num; 514 514 case L_FIXED_POINT : 515 return ((( lisp_fixed_point *)lnumber)->x)>>16;515 return (((LispFixedPoint *)lnumber)->x)>>16; 516 516 case L_STRING : 517 517 return (uint8_t)*lstring_value(lnumber); … … 538 538 } 539 539 #endif 540 return ((char *)lstring)+sizeof( lisp_string);540 return ((char *)lstring)+sizeof(LispString); 541 541 } 542 542 … … 554 554 if (!c) return NULL; 555 555 else if (item_type(c)==(ltype)L_CONS_CELL) 556 return (( cons_cell*)c)->cdr;556 return ((LispList *)c)->cdr; 557 557 else 558 558 return NULL; … … 563 563 if (!c) return NULL; 564 564 else if (item_type(c)==(ltype)L_CONS_CELL) 565 return (( cons_cell*)c)->car;565 return ((LispList *)c)->car; 566 566 else return NULL; 567 567 } … … 577 577 } 578 578 #endif 579 return (( lisp_character *)c)->ch;579 return ((LispChar *)c)->ch; 580 580 } 581 581 … … 585 585 { 586 586 case L_NUMBER : 587 return (( lisp_number *)c)->num<<16; break;587 return ((LispNumber *)c)->num<<16; break; 588 588 case L_FIXED_POINT : 589 return ((( lisp_fixed_point *)c)->x); break;589 return (((LispFixedPoint *)c)->x); break; 590 590 default : 591 591 { … … 606 606 if (t1!=t2) return NULL; 607 607 else if (t1==L_NUMBER) 608 { if ((( lisp_number *)n1)->num==((lisp_number *)n2)->num)608 { if (((LispNumber *)n1)->num==((LispNumber *)n2)->num) 609 609 return true_symbol; 610 610 else return NULL; 611 611 } else if (t1==L_CHARACTER) 612 612 { 613 if ((( lisp_character *)n1)->ch==((lisp_character *)n2)->ch)613 if (((LispChar *)n1)->ch==((LispChar *)n2)->ch) 614 614 return true_symbol; 615 615 else return NULL; … … 633 633 } 634 634 #endif 635 if (x>=(( lisp_1d_array *)a)->size || x<0)635 if (x>=((LispArray *)a)->size || x<0) 636 636 { 637 637 lbreak("array refrence out of bounds (%d)\n", x); 638 638 exit(0); 639 639 } 640 return ((void **)((( lisp_1d_array *)a)+1))[x];640 return ((void **)(((LispArray *)a)+1))[x]; 641 641 } 642 642 … … 781 781 782 782 /* 783 lisp_symbol *find_symbol(char const *name)784 { 785 cons_cell*cs;786 for (cs=( cons_cell *)symbol_list;cs;cs=(cons_cell*)CDR(cs))787 { 788 if (!strcmp( ((char *)(( lisp_symbol *)cs->car)->name)+sizeof(lisp_string), name))789 return ( lisp_symbol *)(cs->car);783 LispSymbol *find_symbol(char const *name) 784 { 785 LispList *cs; 786 for (cs=(LispList *)symbol_list;cs;cs=(LispList *)CDR(cs)) 787 { 788 if (!strcmp( ((char *)((LispSymbol *)cs->car)->name)+sizeof(LispString), name)) 789 return (LispSymbol *)(cs->car); 790 790 } 791 791 return NULL; … … 793 793 794 794 795 lisp_symbol *make_find_symbol(char const *name) // find a symbol, if it doesn't exsist it is created796 { 797 lisp_symbol *s=find_symbol(name);795 LispSymbol *make_find_symbol(char const *name) // find a symbol, if it doesn't exsist it is created 796 { 797 LispSymbol *s=find_symbol(name); 798 798 if (s) return s; 799 799 else … … 802 802 if (current_space!=GC_SPACE) 803 803 current_space=PERM_SPACE; // make sure all symbols get defined in permanant space 804 cons_cell*cs;804 LispList *cs; 805 805 cs=new_cons_cell(); 806 806 s=new_lisp_symbol(name); … … 815 815 */ 816 816 817 lisp_symbol *find_symbol(char const *name)818 { 819 lisp_symbol *p=lsym_root;817 LispSymbol *find_symbol(char const *name) 818 { 819 LispSymbol *p=lsym_root; 820 820 while (p) 821 821 { 822 int cmp=strcmp(name, ((char *)p->name)+sizeof( lisp_string));822 int cmp=strcmp(name, ((char *)p->name)+sizeof(LispString)); 823 823 if (cmp==0) return p; 824 824 else if (cmp<0) p=p->left; … … 830 830 831 831 832 lisp_symbol *make_find_symbol(char const *name)833 { 834 lisp_symbol *p=lsym_root;835 lisp_symbol **parent=&lsym_root;832 LispSymbol *make_find_symbol(char const *name) 833 { 834 LispSymbol *p=lsym_root; 835 LispSymbol **parent=&lsym_root; 836 836 while (p) 837 837 { 838 int cmp=strcmp(name, ((char *)p->name)+sizeof( lisp_string));838 int cmp=strcmp(name, ((char *)p->name)+sizeof(LispString)); 839 839 if (cmp==0) return p; 840 840 else if (cmp<0) … … 853 853 current_space=PERM_SPACE; // make sure all symbols get defined in permanant space 854 854 855 p=( lisp_symbol *)malloc(sizeof(lisp_symbol));855 p=(LispSymbol *)malloc(sizeof(LispSymbol)); 856 856 p->type=L_SYMBOL; 857 857 p->name=new_lisp_string(name); … … 874 874 875 875 876 void ldelete_syms( lisp_symbol *root)876 void ldelete_syms(LispSymbol *root) 877 877 { 878 878 if (root) … … 894 894 if (lisp_eq(CAR(CAR(list)), item)) 895 895 return lcar(list); 896 list=( cons_cell*)(CDR(list));896 list=(LispList *)(CDR(list)); 897 897 } 898 898 } … … 943 943 if (!first) first=cur; 944 944 if (last) 945 (( cons_cell*)last)->cdr=cur;945 ((LispList *)last)->cdr=cur; 946 946 last=cur; 947 947 948 cons_cell*cell=new_cons_cell();948 LispList *cell=new_cons_cell(); 949 949 tmp=lcar(list1); 950 (( cons_cell*)cell)->car=tmp;950 ((LispList *)cell)->car=tmp; 951 951 tmp=lcar(list2); 952 (( cons_cell*)cell)->cdr=tmp;953 (( cons_cell*)cur)->car=cell;954 955 list1=(( cons_cell*)list1)->cdr;956 list2=(( cons_cell*)list2)->cdr;957 } 958 (( cons_cell*)cur)->cdr=list3;952 ((LispList *)cell)->cdr=tmp; 953 ((LispList *)cur)->car=cell; 954 955 list1=((LispList *)list1)->cdr; 956 list2=((LispList *)list2)->cdr; 957 } 958 ((LispList *)cur)->cdr=list3; 959 959 ret=first; 960 960 } else ret=NULL; … … 964 964 void *lookup_symbol_function(void *symbol) 965 965 { 966 return (( lisp_symbol *)symbol)->function;966 return ((LispSymbol *)symbol)->function; 967 967 } 968 968 969 969 void set_symbol_function(void *symbol, void *function) 970 970 { 971 (( lisp_symbol *)symbol)->function=function;971 ((LispSymbol *)symbol)->function=function; 972 972 } 973 973 … … 975 975 { 976 976 #ifdef TYPE_CHECKING 977 if ((( lisp_symbol *)symbol)->value!=l_undefined)978 #endif 979 return (( lisp_symbol *)symbol)->value;977 if (((LispSymbol *)symbol)->value!=l_undefined) 978 #endif 979 return ((LispSymbol *)symbol)->value; 980 980 #ifdef TYPE_CHECKING 981 981 else … … 991 991 void set_variable_value(void *symbol, void *value) 992 992 { 993 (( lisp_symbol *) symbol)->value=value;994 } 995 996 lisp_symbol *add_sys_function(char const *name, short min_args, short max_args, short number)993 ((LispSymbol *) symbol)->value=value; 994 } 995 996 LispSymbol *add_sys_function(char const *name, short min_args, short max_args, short number) 997 997 { 998 998 need_perm_space("add_sys_function"); 999 lisp_symbol *s=make_find_symbol(name);999 LispSymbol *s=make_find_symbol(name); 1000 1000 if (s->function!=l_undefined) 1001 1001 { … … 1007 1007 } 1008 1008 1009 lisp_symbol *add_c_object(void *symbol, int16_t number)1009 LispSymbol *add_c_object(void *symbol, int16_t number) 1010 1010 { 1011 1011 need_perm_space("add_c_object"); 1012 lisp_symbol *s=(lisp_symbol *)symbol;1012 LispSymbol *s=(LispSymbol *)symbol; 1013 1013 if (s->value!=l_undefined) 1014 1014 { … … 1020 1020 } 1021 1021 1022 lisp_symbol *add_c_function(char const *name, short min_args, short max_args, short number)1022 LispSymbol *add_c_function(char const *name, short min_args, short max_args, short number) 1023 1023 { 1024 1024 total_user_functions++; 1025 1025 need_perm_space("add_c_function"); 1026 lisp_symbol *s=make_find_symbol(name);1026 LispSymbol *s=make_find_symbol(name); 1027 1027 if (s->function!=l_undefined) 1028 1028 { … … 1034 1034 } 1035 1035 1036 lisp_symbol *add_c_bool_fun(char const *name, short min_args, short max_args, short number)1036 LispSymbol *add_c_bool_fun(char const *name, short min_args, short max_args, short number) 1037 1037 { 1038 1038 total_user_functions++; 1039 1039 need_perm_space("add_c_bool_fun"); 1040 lisp_symbol *s=make_find_symbol(name);1040 LispSymbol *s=make_find_symbol(name); 1041 1041 if (s->function!=l_undefined) 1042 1042 { … … 1049 1049 1050 1050 1051 lisp_symbol *add_lisp_function(char const *name, short min_args, short max_args, short number)1051 LispSymbol *add_lisp_function(char const *name, short min_args, short max_args, short number) 1052 1052 { 1053 1053 total_user_functions++; 1054 1054 need_perm_space("add_c_bool_fun"); 1055 lisp_symbol *s=make_find_symbol(name);1055 LispSymbol *s=make_find_symbol(name); 1056 1056 if (s->function!=l_undefined) 1057 1057 { … … 1138 1138 { 1139 1139 p_ref r1(object), r2(list); 1140 cons_cell*c=new_cons_cell();1140 LispList *c=new_cons_cell(); 1141 1141 c->car=object; 1142 1142 c->cdr=list; … … 1160 1160 p_ref r1(cs), r2(c2); 1161 1161 1162 (( cons_cell*)cs)->car=quote_symbol;1162 ((LispList *)cs)->car=quote_symbol; 1163 1163 c2=new_cons_cell(); 1164 1164 tmp=compile(s); 1165 (( cons_cell*)c2)->car=tmp;1166 (( cons_cell*)c2)->cdr=NULL;1167 (( cons_cell*)cs)->cdr=c2;1165 ((LispList *)c2)->car=tmp; 1166 ((LispList *)c2)->cdr=NULL; 1167 ((LispList *)cs)->cdr=c2; 1168 1168 ret=cs; 1169 1169 } … … 1173 1173 p_ref r1(cs), r2(c2); 1174 1174 1175 (( cons_cell*)cs)->car=backquote_symbol;1175 ((LispList *)cs)->car=backquote_symbol; 1176 1176 c2=new_cons_cell(); 1177 1177 tmp=compile(s); 1178 (( cons_cell*)c2)->car=tmp;1179 (( cons_cell*)c2)->cdr=NULL;1180 (( cons_cell*)cs)->cdr=c2;1178 ((LispList *)c2)->car=tmp; 1179 ((LispList *)c2)->cdr=NULL; 1180 ((LispList *)cs)->cdr=c2; 1181 1181 ret=cs; 1182 1182 } else if (n[0]==',') // short hand for comma function … … 1185 1185 p_ref r1(cs), r2(c2); 1186 1186 1187 (( cons_cell*)cs)->car=comma_symbol;1187 ((LispList *)cs)->car=comma_symbol; 1188 1188 c2=new_cons_cell(); 1189 1189 tmp=compile(s); 1190 (( cons_cell*)c2)->car=tmp;1191 (( cons_cell*)c2)->cdr=NULL;1192 (( cons_cell*)cs)->cdr=c2;1190 ((LispList *)c2)->car=tmp; 1191 ((LispList *)c2)->cdr=NULL; 1192 ((LispList *)cs)->cdr=c2; 1193 1193 ret=cs; 1194 1194 } … … 1219 1219 read_ltoken(s, n); // skip the '.' 1220 1220 tmp=compile(s); 1221 (( cons_cell*)last)->cdr=tmp; // link the last cdr to1221 ((LispList *)last)->cdr=tmp; // link the last cdr to 1222 1222 last=NULL; 1223 1223 } … … 1231 1231 if (!first) first=cur; 1232 1232 tmp=compile(s); 1233 (( cons_cell*)cur)->car=tmp;1233 ((LispList *)cur)->car=tmp; 1234 1234 if (last) 1235 (( cons_cell*)last)->cdr=cur;1235 ((LispList *)last)->cdr=cur; 1236 1236 last=cur; 1237 1237 } … … 1244 1244 else if (isdigit(n[0]) || (n[0]=='-' && isdigit(n[1]))) 1245 1245 { 1246 lisp_number *num=new_lisp_number(0);1246 LispNumber *num=new_lisp_number(0); 1247 1247 sscanf(n, "%ld", &num->num); 1248 1248 ret=num; … … 1282 1282 p_ref r4(cs), r5(c2); 1283 1283 tmp=make_find_symbol("function"); 1284 (( cons_cell*)cs)->car=tmp;1284 ((LispList *)cs)->car=tmp; 1285 1285 c2=new_cons_cell(); 1286 1286 tmp=compile(s); 1287 (( cons_cell*)c2)->car=tmp;1288 (( cons_cell*)cs)->cdr=c2;1287 ((LispList *)c2)->car=tmp; 1288 ((LispList *)cs)->cdr=c2; 1289 1289 ret=cs; 1290 1290 } … … 1338 1338 case L_CONS_CELL : 1339 1339 { 1340 cons_cell *cs=(cons_cell*)i;1340 LispList *cs=(LispList *)i; 1341 1341 lprint_string("("); 1342 for (;cs;cs=( cons_cell*)lcdr(cs))1342 for (;cs;cs=(LispList *)lcdr(cs)) 1343 1343 { 1344 1344 if (item_type(cs)==(ltype)L_CONS_CELL) … … 1361 1361 { 1362 1362 char num[10]; 1363 sprintf(num, "%ld", (( lisp_number *)i)->num);1363 sprintf(num, "%ld", ((LispNumber *)i)->num); 1364 1364 lprint_string(num); 1365 1365 } 1366 1366 break; 1367 1367 case L_SYMBOL : 1368 lprint_string((char *)((( lisp_symbol *)i)->name)+sizeof(lisp_string));1368 lprint_string((char *)(((LispSymbol *)i)->name)+sizeof(LispString)); 1369 1369 break; 1370 1370 case L_USER_FUNCTION : … … 1408 1408 if (current_print_file) 1409 1409 { 1410 uint8_t ch=(( lisp_character *)i)->ch;1410 uint8_t ch=((LispChar *)i)->ch; 1411 1411 current_print_file->write(&ch, 1); 1412 1412 } else 1413 1413 { 1414 uint16_t ch=(( lisp_character *)i)->ch;1414 uint16_t ch=((LispChar *)i)->ch; 1415 1415 dprintf("#\\"); 1416 1416 switch (ch) … … 1427 1427 case L_OBJECT_VAR : 1428 1428 { 1429 l_obj_print((( lisp_object_var *)i)->number);1429 l_obj_print(((LispObjectVar *)i)->number); 1430 1430 } break; 1431 1431 case L_1D_ARRAY : 1432 1432 { 1433 lisp_1d_array *a=(lisp_1d_array *)i;1433 LispArray *a=(LispArray *)i; 1434 1434 void **data=(void **)(a+1); 1435 1435 dprintf("#("); … … 1445 1445 { 1446 1446 lprint_string("GC_refrence->"); 1447 lprint((( lisp_collected_object *)i)->new_reference);1447 lprint(((LispRedirect *)i)->new_reference); 1448 1448 } break; 1449 1449 default : … … 1456 1456 } 1457 1457 1458 void *eval_sys_function( lisp_sys_function *fun, void *arg_list);1459 1460 void *eval_function( lisp_symbol *sym, void *arg_list)1458 void *eval_sys_function(LispSysFunction *fun, void *arg_list); 1459 1460 void *eval_function(LispSymbol *sym, void *arg_list) 1461 1461 { 1462 1462 #ifdef TYPE_CHECKING … … 1470 1470 #endif 1471 1471 1472 void *fun=( lisp_sys_function *)(((lisp_symbol *)sym)->function);1472 void *fun=(LispSysFunction *)(((LispSymbol *)sym)->function); 1473 1473 p_ref ref2( fun ); 1474 1474 … … 1484 1484 case L_L_FUNCTION : 1485 1485 { 1486 req_min=(( lisp_sys_function *)fun)->min_args;1487 req_max=(( lisp_sys_function *)fun)->max_args;1486 req_min=((LispSysFunction *)fun)->min_args; 1487 req_max=((LispSysFunction *)fun)->max_args; 1488 1488 } break; 1489 1489 case L_USER_FUNCTION : … … 1531 1531 { 1532 1532 case L_SYS_FUNCTION : 1533 { ret=eval_sys_function( (( lisp_sys_function *)fun), arg_list); } break;1533 { ret=eval_sys_function( ((LispSysFunction *)fun), arg_list); } break; 1534 1534 case L_L_FUNCTION : 1535 { ret=l_caller( (( lisp_sys_function *)fun)->fun_number, arg_list); } break;1535 { ret=l_caller( ((LispSysFunction *)fun)->fun_number, arg_list); } break; 1536 1536 case L_USER_FUNCTION : 1537 1537 { … … 1547 1547 if (first) { 1548 1548 tmp=new_cons_cell(); 1549 (( cons_cell*)cur)->cdr=tmp;1549 ((LispList *)cur)->cdr=tmp; 1550 1550 cur=tmp; 1551 1551 } else … … 1553 1553 1554 1554 void *val=eval(CAR(arg_list)); 1555 (( cons_cell*)cur)->car=val;1555 ((LispList *)cur)->car=val; 1556 1556 arg_list=lcdr(arg_list); 1557 1557 } 1558 1558 if(t == L_C_FUNCTION) 1559 ret=new_lisp_number(c_caller( (( lisp_sys_function *)fun)->fun_number, first));1560 else if (c_caller( (( lisp_sys_function *)fun)->fun_number, first))1559 ret=new_lisp_number(c_caller( ((LispSysFunction *)fun)->fun_number, first)); 1560 else if (c_caller( ((LispSysFunction *)fun)->fun_number, first)) 1561 1561 ret=true_symbol; 1562 1562 else ret=NULL; … … 1568 1568 #ifdef L_PROFILE 1569 1569 time_marker end; 1570 (( lisp_symbol *)sym)->time_taken+=end.diff_time(&start);1570 ((LispSymbol *)sym)->time_taken+=end.diff_time(&start); 1571 1571 #endif 1572 1572 … … 1575 1575 1576 1576 #ifdef L_PROFILE 1577 void pro_print(bFILE *out, lisp_symbol *p)1577 void pro_print(bFILE *out, LispSymbol *p) 1578 1578 { 1579 1579 if (p) … … 1582 1582 { 1583 1583 char st[100]; 1584 sprintf(st, "%20s %f\n", lstring_value(symbol_name(p)), (( lisp_symbol *)p)->time_taken);1584 sprintf(st, "%20s %f\n", lstring_value(symbol_name(p)), ((LispSymbol *)p)->time_taken); 1585 1585 out->write(st, strlen(st)); 1586 1586 } … … 1618 1618 1619 1619 void **arg_on=(void **)malloc(sizeof(void *)*num_args); 1620 cons_cell *list_on=(cons_cell*)CDR(arg_list);1620 LispList *list_on=(LispList *)CDR(arg_list); 1621 1621 long old_ptr_son=l_ptr_stack.son; 1622 1622 1623 1623 for (i=0;i<num_args;i++) 1624 1624 { 1625 arg_on[i]=( cons_cell*)eval(CAR(list_on));1625 arg_on[i]=(LispList *)eval(CAR(list_on)); 1626 1626 l_ptr_stack.push(&arg_on[i]); 1627 1627 1628 list_on=( cons_cell*)CDR(list_on);1628 list_on=(LispList *)CDR(list_on); 1629 1629 if (!arg_on[i]) stop=1; 1630 1630 } … … 1636 1636 } 1637 1637 1638 cons_cell*na_list=NULL, *return_list=NULL, *last_return=NULL;1638 LispList *na_list=NULL, *return_list=NULL, *last_return=NULL; 1639 1639 1640 1640 do … … 1642 1642 na_list=NULL; // create a cons list with all of the parameters for the function 1643 1643 1644 cons_cell*first=NULL; // save the start of the list1644 LispList *first=NULL; // save the start of the list 1645 1645 for (i=0;!stop &&i<num_args;i++) 1646 1646 { … … 1650 1650 { 1651 1651 na_list->cdr=new_cons_cell(); 1652 na_list=( cons_cell*)CDR(na_list);1652 na_list=(LispList *)CDR(na_list); 1653 1653 } 1654 1654 … … 1657 1657 { 1658 1658 na_list->car=CAR(arg_on[i]); 1659 arg_on[i]=( cons_cell*)CDR(arg_on[i]);1659 arg_on[i]=(LispList *)CDR(arg_on[i]); 1660 1660 } 1661 1661 else stop=1; … … 1663 1663 if (!stop) 1664 1664 { 1665 cons_cell*c=new_cons_cell();1666 c->car=eval_function(( lisp_symbol *)sym, first);1665 LispList *c=new_cons_cell(); 1666 c->car=eval_function((LispSymbol *)sym, first); 1667 1667 if (return_list) 1668 1668 last_return->cdr=c; … … 1706 1706 case L_CONS_CELL : 1707 1707 { 1708 cons_cell *char_list=(cons_cell*)str_eval[i];1708 LispList *char_list=(LispList *)str_eval[i]; 1709 1709 while (char_list) 1710 1710 { … … 1717 1717 exit(0); 1718 1718 } 1719 char_list=( cons_cell*)CDR(char_list);1719 char_list=(LispList *)CDR(char_list); 1720 1720 } 1721 1721 } break; … … 1729 1729 } 1730 1730 } 1731 lisp_string *st=new_lisp_string(len+1);1731 LispString *st=new_lisp_string(len+1); 1732 1732 char *s=lstring_value(st); 1733 1733 … … 1739 1739 case L_CONS_CELL : 1740 1740 { 1741 cons_cell *char_list=(cons_cell*)str_eval[i];1741 LispList *char_list=(LispList *)str_eval[i]; 1742 1742 while (char_list) 1743 1743 { 1744 1744 if (item_type(CAR(char_list))==L_CHARACTER) 1745 *(s++)=(( lisp_character *)CAR(char_list))->ch;1746 char_list=( cons_cell*)CDR(char_list);1745 *(s++)=((LispChar *)CAR(char_list))->ch; 1746 char_list=(LispList *)CDR(char_list); 1747 1747 } 1748 1748 } break; … … 1777 1777 else if (args==NULL) 1778 1778 return NULL; 1779 else if (( lisp_symbol *) (((cons_cell*)args)->car)==comma_symbol)1779 else if ((LispSymbol *) (((LispList *)args)->car)==comma_symbol) 1780 1780 return eval(CAR(CDR(args))); 1781 1781 else … … 1790 1790 { 1791 1791 tmp=eval(CAR(CDR(args))); 1792 (( cons_cell*)last)->cdr=tmp;1792 ((LispList *)last)->cdr=tmp; 1793 1793 args=NULL; 1794 1794 } … … 1797 1797 cur=new_cons_cell(); 1798 1798 if (first) 1799 (( cons_cell*)last)->cdr=cur;1799 ((LispList *)last)->cdr=cur; 1800 1800 else 1801 1801 first=cur; 1802 1802 last=cur; 1803 1803 tmp=backquote_eval(CAR(args)); 1804 (( cons_cell*)cur)->car=tmp;1804 ((LispList *)cur)->car=tmp; 1805 1805 args=CDR(args); 1806 1806 } … … 1808 1808 { 1809 1809 tmp=backquote_eval(args); 1810 (( cons_cell*)last)->cdr=tmp;1810 ((LispList *)last)->cdr=tmp; 1811 1811 args=NULL; 1812 1812 } … … 1819 1819 1820 1820 1821 void *eval_sys_function( lisp_sys_function *fun, void *arg_list)1821 void *eval_sys_function(LispSysFunction *fun, void *arg_list) 1822 1822 { 1823 1823 p_ref ref1(arg_list); … … 1860 1860 cur=new_cons_cell(); 1861 1861 void *val=eval(CAR(arg_list)); 1862 (( cons_cell*) cur)->car=val;1862 ((LispList *) cur)->car=val; 1863 1863 if (last) 1864 (( cons_cell*)last)->cdr=cur;1864 ((LispList *)last)->cdr=cur; 1865 1865 else first=cur; 1866 1866 last=cur; 1867 arg_list=( cons_cell*)CDR(arg_list);1867 arg_list=(LispList *)CDR(arg_list); 1868 1868 } 1869 1869 ret=first; … … 1873 1873 p_ref r1(c); 1874 1874 void *val=eval(CAR(arg_list)); 1875 (( cons_cell*)c)->car=val;1875 ((LispList *)c)->car=val; 1876 1876 val=eval(CAR(CDR(arg_list))); 1877 (( cons_cell*)c)->cdr=val;1877 ((LispList *)c)->cdr=val; 1878 1878 ret=c; 1879 1879 } break; … … 1946 1946 } else if (first) 1947 1947 { 1948 sum=(( lisp_number *)i)->num;1948 sum=((LispNumber *)i)->num; 1949 1949 first=0; 1950 1950 } 1951 else sum/=(( lisp_number *)i)->num;1951 else sum/=((LispNumber *)i)->num; 1952 1952 arg_list=CDR(arg_list); 1953 1953 } … … 1989 1989 case L_SYMBOL : 1990 1990 { 1991 switch (item_type ((( lisp_symbol *)i)->value))1991 switch (item_type (((LispSymbol *)i)->value)) 1992 1992 { 1993 1993 case L_NUMBER : 1994 1994 { 1995 if (x==L_NUMBER && (( lisp_symbol *)i)->value!=l_undefined)1996 (( lisp_number *)(((lisp_symbol *)i)->value))->num=lnumber_value(set_to);1995 if (x==L_NUMBER && ((LispSymbol *)i)->value!=l_undefined) 1996 ((LispNumber *)(((LispSymbol *)i)->value))->num=lnumber_value(set_to); 1997 1997 else 1998 (( lisp_symbol *)i)->value=set_to;1998 ((LispSymbol *)i)->value=set_to; 1999 1999 } break; 2000 2000 case L_OBJECT_VAR : 2001 2001 { 2002 l_obj_set((( lisp_object_var *)(((lisp_symbol *)i)->value))->number, set_to);2002 l_obj_set(((LispObjectVar *)(((LispSymbol *)i)->value))->number, set_to); 2003 2003 } break; 2004 2004 default : 2005 (( lisp_symbol *)i)->value=set_to;2005 ((LispSymbol *)i)->value=set_to; 2006 2006 } 2007 ret=(( lisp_symbol *)i)->value;2007 ret=((LispSymbol *)i)->value; 2008 2008 } break; 2009 2009 case L_CONS_CELL : // this better be an 'aref' 2010 2010 { 2011 2011 #ifdef TYPE_CHECKING 2012 void *car=(( cons_cell*)i)->car;2012 void *car=((LispList *)i)->car; 2013 2013 if (car==car_symbol) 2014 2014 { … … 2016 2016 if (!car || item_type(car)!=L_CONS_CELL) 2017 2017 { lprint(car); lbreak("setq car : evaled object is not a cons cell\n"); exit(0); } 2018 (( cons_cell*)car)->car=set_to;2018 ((LispList *)car)->car=set_to; 2019 2019 } else if (car==cdr_symbol) 2020 2020 { … … 2022 2022 if (!car || item_type(car)!=L_CONS_CELL) 2023 2023 { lprint(car); lbreak("setq cdr : evaled object is not a cons cell\n"); exit(0); } 2024 (( cons_cell*)car)->cdr=set_to;2024 ((LispList *)car)->cdr=set_to; 2025 2025 } else if (car==aref_symbol) 2026 2026 { 2027 2027 #endif 2028 void *a=( lisp_1d_array *)eval(CAR(CDR(i)));2028 void *a=(LispArray *)eval(CAR(CDR(i))); 2029 2029 p_ref r1(a); 2030 2030 #ifdef TYPE_CHECKING … … 2038 2038 long num=lnumber_value(eval(CAR(CDR(CDR(i))))); 2039 2039 #ifdef TYPE_CHECKING 2040 if (num>=(( lisp_1d_array *)a)->size || num<0)2040 if (num>=((LispArray *)a)->size || num<0) 2041 2041 { 2042 2042 lbreak("aref : value of bounds (%d)\n", num); … … 2044 2044 } 2045 2045 #endif 2046 void **data=(void **)((( lisp_1d_array *)a)+1);2046 void **data=(void **)(((LispArray *)a)+1); 2047 2047 data[num]=set_to; 2048 2048 #ifdef TYPE_CHECKING … … 2071 2071 void *item=eval(CAR(arg_list)); 2072 2072 p_ref r1(item); 2073 void *list=( cons_cell*)eval(CAR(CDR(arg_list)));2073 void *list=(LispList *)eval(CAR(CDR(arg_list))); 2074 2074 p_ref r2(list); 2075 ret=assoc(item, ( cons_cell*)list);2075 ret=assoc(item, (LispList *)list); 2076 2076 } break; 2077 2077 case SYS_FUNC_NOT: … … 2083 2083 void *i1=eval(CAR(arg_list)), *i2=eval(CAR(CDR(arg_list))); 2084 2084 p_ref r1(i1); 2085 cons_cell*cs=new_cons_cell();2085 LispList *cs=new_cons_cell(); 2086 2086 cs->car=i1; 2087 2087 cs->cdr=i2; … … 2118 2118 #endif 2119 2119 2120 l_user_stack.push((( lisp_symbol *)var_name)->value);2120 l_user_stack.push(((LispSymbol *)var_name)->value); 2121 2121 tmp=eval(CAR(CDR(CAR(var_list)))); 2122 (( lisp_symbol *)var_name)->value=tmp;2122 ((LispSymbol *)var_name)->value=tmp; 2123 2123 var_list=CDR(var_list); 2124 2124 } … … 2137 2137 { 2138 2138 void *var_name=CAR(CAR(var_list)); 2139 (( lisp_symbol *)var_name)->value=l_user_stack.sdata[cur_stack++];2139 ((LispSymbol *)var_name)->value=l_user_stack.sdata[cur_stack++]; 2140 2140 var_list=CDR(var_list); 2141 2141 } … … 2166 2166 intptr_t a=cache.reg_lisp_block(lcar(lcdr(arg_list))); 2167 2167 intptr_t b=cache.reg_lisp_block(block_list); 2168 lisp_user_function *ufun=new_lisp_user_function(a, b);2168 LispUserFunction *ufun=new_lisp_user_function(a, b); 2169 2169 #else 2170 lisp_user_function *ufun=new_lisp_user_function(lcar(lcdr(arg_list)), block_list);2170 LispUserFunction *ufun=new_lisp_user_function(lcar(lcdr(arg_list)), block_list); 2171 2171 #endif 2172 2172 set_symbol_function(symbol, ufun); … … 2216 2216 { 2217 2217 case L_CHARACTER : 2218 { ret=new_lisp_number((( lisp_character *)i)->ch); } break;2218 { ret=new_lisp_number(((LispChar *)i)->ch); } break; 2219 2219 case L_STRING : 2220 2220 { ret=new_lisp_number(*lstring_value(i)); } break; … … 2237 2237 exit(0); 2238 2238 } 2239 ret=new_lisp_character((( lisp_number *)i)->num);2239 ret=new_lisp_character(((LispNumber *)i)->num); 2240 2240 } break; 2241 2241 case SYS_FUNC_COND: … … 2282 2282 { 2283 2283 void *n1=eval(CAR(arg_list)); 2284 ret=eval_function(( lisp_symbol *)n1, CDR(arg_list));2284 ret=eval_function((LispSymbol *)n1, CDR(arg_list)); 2285 2285 } break; 2286 2286 case SYS_FUNC_GT: … … 2332 2332 } 2333 2333 #endif 2334 ret=(( lisp_symbol *)symb)->name;2334 ret=((LispSymbol *)symb)->name; 2335 2335 break; 2336 2336 case SYS_FUNC_TRACE: … … 2497 2497 { 2498 2498 case L_SYMBOL : 2499 { (( lisp_symbol *)sym)->value=new_lisp_number(x); } break;2499 { ((LispSymbol *)sym)->value=new_lisp_number(x); } break; 2500 2500 case L_CONS_CELL : 2501 2501 { … … 2510 2510 #endif 2511 2511 x=lnumber_value(eval(CAR(CDR(sym)))); 2512 (( lisp_symbol *)sym)->value=new_lisp_number(x);2512 ((LispSymbol *)sym)->value=new_lisp_number(x); 2513 2513 } break; 2514 2514 default : … … 2549 2549 { 2550 2550 for (void *s=symbol_list;s;s=CDR(s)) 2551 fprintf(fp, "%8d %s\n", (( lisp_symbol *)(CAR(s)))->call_counter,2552 lstring_value((( lisp_symbol *)(CAR(s)))->name));2551 fprintf(fp, "%8d %s\n", ((LispSymbol *)(CAR(s)))->call_counter, 2552 lstring_value(((LispSymbol *)(CAR(s)))->name)); 2553 2553 fclose(fp); 2554 2554 } … … 2677 2677 { 2678 2678 void *v=eval(CAR(arg_list)); 2679 if (item_type(v)!=L_NUMBER || ((( lisp_number *)v)->num!=0))2679 if (item_type(v)!=L_NUMBER || (((LispNumber *)v)->num!=0)) 2680 2680 ret=NULL; 2681 2681 else ret=true_symbol; … … 2817 2817 next=l1; 2818 2818 while (next) { l1=next; next=lcdr(next); } 2819 (( cons_cell*)l1)->cdr=eval(CAR(arg_list));2819 ((LispList *)l1)->cdr=eval(CAR(arg_list)); 2820 2820 arg_list=CDR(arg_list); 2821 2821 } while (arg_list); … … 2852 2852 lbreak("substr : bad x1 or x2 value"); 2853 2853 2854 lisp_string *s=new_lisp_string(x2-x1+2);2854 LispString *s=new_lisp_string(x2-x1+2); 2855 2855 if (x2-x1) 2856 2856 memcpy(lstring_value(s), lstring_value(st)+x1, x2-x1+1); … … 2875 2875 2876 2876 default : 2877 { dprintf("Undefined system function number %d\n", (( lisp_sys_function *)fun)->fun_number); }2877 { dprintf("Undefined system function number %d\n", ((LispSysFunction *)fun)->fun_number); } 2878 2878 } 2879 2879 return ret; … … 2898 2898 2899 2899 2900 void *eval_user_fun( lisp_symbol *sym, void *arg_list)2900 void *eval_user_fun(LispSymbol *sym, void *arg_list) 2901 2901 { 2902 2902 void *ret=NULL; … … 2916 2916 2917 2917 2918 lisp_user_function *fun=(lisp_user_function *)(((lisp_symbol *)sym)->function);2918 LispUserFunction *fun=(LispUserFunction *)(((LispSymbol *)sym)->function); 2919 2919 2920 2920 #ifdef TYPE_CHECKING … … 2947 2947 for (;f_arg;f_arg=CDR(f_arg)) 2948 2948 { 2949 lisp_symbol *s = (lisp_symbol *)CAR(f_arg);2949 LispSymbol *s = (LispSymbol *)CAR(f_arg); 2950 2950 l_user_stack.push(s->value); 2951 2951 } … … 2968 2968 // now store all the values and put them into the symbols 2969 2969 for (f_arg=fun_arg_list;f_arg;f_arg=CDR(f_arg)) 2970 (( lisp_symbol *)CAR(f_arg))->value=l_user_stack.sdata[i++];2970 ((LispSymbol *)CAR(f_arg))->value=l_user_stack.sdata[i++]; 2971 2971 2972 2972 l_user_stack.son=new_start; … … 2988 2988 long cur_stack=stack_start; 2989 2989 for (f_arg=fun_arg_list;f_arg;f_arg=CDR(f_arg)) 2990 (( lisp_symbol *)CAR(f_arg))->value=l_user_stack.sdata[cur_stack++];2990 ((LispSymbol *)CAR(f_arg))->value=l_user_stack.sdata[cur_stack++]; 2991 2991 2992 2992 l_user_stack.son=stack_start; … … 2994 2994 #ifdef L_PROFILE 2995 2995 time_marker end; 2996 (( lisp_symbol *)sym)->time_taken+=end.diff_time(&start);2996 ((LispSymbol *)sym)->time_taken+=end.diff_time(&start); 2997 2997 #endif 2998 2998 … … 3048 3048 ret=lookup_symbol_value(prog); 3049 3049 if (item_type(ret)==L_OBJECT_VAR) 3050 ret=l_obj_get((( lisp_object_var *)ret)->number);3050 ret=l_obj_get(((LispObjectVar *)ret)->number); 3051 3051 } 3052 3052 } break; 3053 3053 case L_CONS_CELL : 3054 3054 { 3055 ret=eval_function(( lisp_symbol *)CAR(prog), CDR(prog));3055 ret=eval_function((LispSymbol *)CAR(prog), CDR(prog)); 3056 3056 } 3057 3057 break; … … 3160 3160 void *symbol_name(void *symbol) 3161 3161 { 3162 return (( lisp_symbol *)symbol)->name;3162 return ((LispSymbol *)symbol)->name; 3163 3163 } 3164 3164 … … 3174 3174 } 3175 3175 #endif 3176 if ((( lisp_symbol *)symbol)->value!=l_undefined &&3177 item_type((( lisp_symbol *)symbol)->value)==L_NUMBER)3178 (( lisp_number *)((lisp_symbol *)symbol)->value)->num=num;3176 if (((LispSymbol *)symbol)->value!=l_undefined && 3177 item_type(((LispSymbol *)symbol)->value)==L_NUMBER) 3178 ((LispNumber *)((LispSymbol *)symbol)->value)->num=num; 3179 3179 else 3180 (( lisp_symbol *)(symbol))->value=new_lisp_number(num);3181 3182 return (( lisp_symbol *)(symbol))->value;3180 ((LispSymbol *)(symbol))->value=new_lisp_number(num); 3181 3182 return ((LispSymbol *)(symbol))->value; 3183 3183 } 3184 3184 … … 3193 3193 } 3194 3194 #endif 3195 (( lisp_symbol *)(symbol))->value=value;3195 ((LispSymbol *)(symbol))->value=value; 3196 3196 return value; 3197 3197 } … … 3207 3207 } 3208 3208 #endif 3209 return (( lisp_symbol *)symbol)->function;3209 return ((LispSymbol *)symbol)->function; 3210 3210 } 3211 3211 … … 3220 3220 } 3221 3221 #endif 3222 return (( lisp_symbol *)symbol)->value;3223 } 3224 3225 3226 3227 3228 3229 3222 return ((LispSymbol *)symbol)->value; 3223 } 3224 3225 3226 3227 3228 3229 -
abuse/trunk/src/lisp/lisp.h
r481 r482 43 43 L_FIXED_POINT, L_COLLECTED_OBJECT }; 44 44 45 typedef uint 64_t ltype; // make sure structures aren't packed differently on various compiler45 typedef uint32_t ltype; // make sure structures aren't packed differently on various compiler 46 46 // and sure that word, etc are word aligned 47 47 48 struct lisp_object_var49 { 50 ltype type;51 long number;52 } ; 53 54 struct cons_cell 55 { 56 ltype type;57 void *cdr,*car; 58 } ; 59 60 struct lisp_number 61 { 62 ltype type; 63 long num; 64 } ; 65 66 struct lisp_collected_object 67 { 68 ltype type; 69 void *new_reference; 70 };71 72 struct lisp_symbol 73 { 74 ltype type; 48 struct LispObject 49 { 50 ltype type; 51 }; 52 53 struct LispObjectVar : LispObject 54 { 55 long number; 56 }; 57 58 struct LispList : LispObject 59 { 60 void *cdr, *car; 61 }; 62 63 struct LispNumber : LispObject 64 { 65 long num; 66 }; 67 68 struct LispRedirect : LispObject 69 { 70 void *new_reference; 71 }; 72 73 struct LispSymbol : LispObject 74 { 75 75 #ifdef L_PROFILE 76 float time_taken; 77 #endif 78 void *value, *function, *name; 79 lisp_symbol *left,*right; // tree structure 80 } ; 81 82 struct lisp_sys_function 83 { 84 ltype type; 85 short min_args,max_args, 86 fun_number; 87 } ; 88 89 struct lisp_user_function 90 { 91 ltype type; 76 float time_taken; 77 #endif 78 void *value, *function, *name; 79 LispSymbol *left, *right; // tree structure 80 }; 81 82 struct LispSysFunction : LispObject 83 { 84 short min_args, max_args; 85 short fun_number; 86 }; 87 88 struct LispUserFunction : LispObject 89 { 92 90 #ifndef NO_LIBS 93 intptr_t alist,blist; // id for cached blocks91 intptr_t alist, blist; // id for cached blocks 94 92 #else 95 void *arg_list,*block_list; 96 #endif 97 } ; 98 99 struct lisp_1d_array 100 { 101 ltype type; 102 unsigned short size; 103 // size * sizeof (void *) follows1 104 } ; 105 106 struct lisp_string 107 { 108 ltype type; 109 } ; 110 111 struct lisp_character 112 { 113 ltype type; 114 int16_t pad; 115 uint16_t ch; 116 } ; 117 118 struct lisp_pointer 119 { 120 ltype type; 121 void *addr; 122 } ; 123 124 125 struct lisp_fixed_point 126 { 127 ltype type; 128 int32_t x; 129 } ; 130 131 static inline void *&CAR(void *x) { return ((cons_cell *)x)->car; } 132 static inline void *&CDR(void *x) { return ((cons_cell *)x)->cdr; } 93 void *arg_list, *block_list; 94 #endif 95 }; 96 97 struct LispArray : LispObject 98 { 99 unsigned short size; 100 // size * sizeof (void *) follows1 101 }; 102 103 struct LispString : LispObject 104 { 105 }; 106 107 struct LispChar : LispObject 108 { 109 int16_t pad; 110 uint16_t ch; 111 }; 112 113 struct LispPointer : LispObject 114 { 115 void *addr; 116 }; 117 118 119 struct LispFixedPoint : LispObject 120 { 121 int32_t x; 122 }; 123 124 static inline void *&CAR(void *x) { return ((LispList *)x)->car; } 125 static inline void *&CDR(void *x) { return ((LispList *)x)->cdr; } 133 126 134 127 void perm_space(); … … 147 140 void *lisp_eq(void *n1, void *n2); 148 141 void *lisp_equal(void *n1, void *n2); 149 lisp_symbol *find_symbol(char const *name);142 LispSymbol *find_symbol(char const *name); 150 143 long list_length(void *i); 151 144 void lprint(void *i); 152 145 void *eval(void *prog); 153 146 void *eval_block(void *list); 154 void *eval_function( lisp_symbol *sym, void *arg_list);155 void *eval_user_fun( lisp_symbol *sym, void *arg_list);147 void *eval_function(LispSymbol *sym, void *arg_list); 148 void *eval_user_fun(LispSymbol *sym, void *arg_list); 156 149 void *compile(char const *&s); 157 150 void *symbol_value(void *symbol); … … 163 156 void resize_tmp(int new_size); 164 157 void resize_perm(int new_size); 165 lisp_symbol *make_find_symbol(char const *name);158 LispSymbol *make_find_symbol(char const *name); 166 159 167 160 void push_onto_list(void *object, void *&list); 168 lisp_symbol *add_c_object(void *symbol, int16_t number);169 lisp_symbol *add_c_function(char const *name, short min_args, short max_args, short number);170 lisp_symbol *add_c_bool_fun(char const *name, short min_args, short max_args, short number);171 lisp_symbol *add_lisp_function(char const *name, short min_args, short max_args, short number);161 LispSymbol *add_c_object(void *symbol, int16_t number); 162 LispSymbol *add_c_function(char const *name, short min_args, short max_args, short number); 163 LispSymbol *add_c_bool_fun(char const *name, short min_args, short max_args, short number); 164 LispSymbol *add_lisp_function(char const *name, short min_args, short max_args, short number); 172 165 int read_ltoken(char *&s, char *buffer); 173 cons_cell*new_cons_cell();166 LispList *new_cons_cell(); 174 167 void print_trace_stack(int max_levels); 175 168 176 169 177 lisp_number *new_lisp_number(long num);178 lisp_pointer *new_lisp_pointer(void *addr);179 lisp_character *new_lisp_character(uint16_t ch);180 lisp_string *new_lisp_string(char const *string);181 lisp_string *new_lisp_string(char const *string, int length);182 lisp_string *new_lisp_string(int length);183 lisp_fixed_point *new_lisp_fixed_point(int32_t x);184 lisp_object_var *new_lisp_object_var(int16_t number);185 lisp_1d_array *new_lisp_1d_array(int size, void *rest);186 lisp_sys_function *new_lisp_sys_function(int min_args, int max_args, int fun_number);187 lisp_sys_function *new_lisp_c_function(int min_args, int max_args, int fun_number);188 lisp_sys_function *new_lisp_c_bool(int min_args, int max_args, int fun_number);170 LispNumber *new_lisp_number(long num); 171 LispPointer *new_lisp_pointer(void *addr); 172 LispChar *new_lisp_character(uint16_t ch); 173 LispString *new_lisp_string(char const *string); 174 LispString *new_lisp_string(char const *string, int length); 175 LispString *new_lisp_string(int length); 176 LispFixedPoint *new_lisp_fixed_point(int32_t x); 177 LispObjectVar *new_lisp_object_var(int16_t number); 178 LispArray *new_lisp_1d_array(int size, void *rest); 179 LispSysFunction *new_lisp_sys_function(int min_args, int max_args, int fun_number); 180 LispSysFunction *new_lisp_c_function(int min_args, int max_args, int fun_number); 181 LispSysFunction *new_lisp_c_bool(int min_args, int max_args, int fun_number); 189 182 190 183 #ifdef NO_LIBS 191 lisp_user_function *new_lisp_user_function(void *arg_list, void *block_list);184 LispUserFunction *new_lisp_user_function(void *arg_list, void *block_list); 192 185 #else 193 lisp_user_function *new_lisp_user_function(intptr_t arg_list, intptr_t block_list);194 #endif 195 196 lisp_sys_function *new_user_lisp_function(int min_args, int max_args, int fun_number);186 LispUserFunction *new_lisp_user_function(intptr_t arg_list, intptr_t block_list); 187 #endif 188 189 LispSysFunction *new_user_lisp_function(int min_args, int max_args, int fun_number); 197 190 198 191 int end_of_program(char *s); … … 200 193 void lisp_init(long perm_size, long tmp_size); 201 194 void lisp_uninit(); 202 extern lisp_symbol *lsym_root;195 extern LispSymbol *lsym_root; 203 196 204 197 extern uint8_t *space[4], *free_space[4]; -
abuse/trunk/src/lisp/lisp_gc.cpp
r481 r482 86 86 static void *collect_array(void *x) 87 87 { 88 long s = (( lisp_1d_array *)x)->size;89 lisp_1d_array *a = new_lisp_1d_array(s, NULL);88 long s = ((LispArray *)x)->size; 89 LispArray *a = new_lisp_1d_array(s, NULL); 90 90 void **src, **dst; 91 src = (void **)((( lisp_1d_array *)x)+1);91 src = (void **)(((LispArray *)x)+1); 92 92 dst = (void **)(a+1); 93 93 for (int i = 0; i<s; i++) … … 99 99 inline void *collect_cons_cell(void *x) 100 100 { 101 cons_cell*last = NULL, *first = NULL;101 LispList *last = NULL, *first = NULL; 102 102 if (!x) return x; 103 103 for (; x && item_type(x) == L_CONS_CELL; ) 104 104 { 105 cons_cell*p = new_cons_cell();106 void *old_car = (( cons_cell*)x)->car;107 void *old_cdr = (( cons_cell*)x)->cdr;105 LispList *p = new_cons_cell(); 106 void *old_car = ((LispList *)x)->car; 107 void *old_cdr = ((LispList *)x)->cdr; 108 108 void *old_x = x; 109 109 x = CDR(x); 110 (( lisp_collected_object *)old_x)->type = L_COLLECTED_OBJECT;111 (( lisp_collected_object *)old_x)->new_reference = p;110 ((LispRedirect *)old_x)->type = L_COLLECTED_OBJECT; 111 ((LispRedirect *)old_x)->new_reference = p; 112 112 113 113 p->car = collect_object(old_car); … … 136 136 break; 137 137 case L_NUMBER: 138 ret = new_lisp_number((( lisp_number *)x)->num);138 ret = new_lisp_number(((LispNumber *)x)->num); 139 139 break; 140 140 case L_SYS_FUNCTION: 141 ret = new_lisp_sys_function((( lisp_sys_function *)x)->min_args,142 (( lisp_sys_function *)x)->max_args,143 (( lisp_sys_function *)x)->fun_number);141 ret = new_lisp_sys_function(((LispSysFunction *)x)->min_args, 142 ((LispSysFunction *)x)->max_args, 143 ((LispSysFunction *)x)->fun_number); 144 144 break; 145 145 case L_USER_FUNCTION: 146 146 #ifndef NO_LIBS 147 ret = new_lisp_user_function((( lisp_user_function *)x)->alist,148 (( lisp_user_function *)x)->blist);147 ret = new_lisp_user_function(((LispUserFunction *)x)->alist, 148 ((LispUserFunction *)x)->blist); 149 149 150 150 #else 151 151 { 152 void *arg = collect_object((( lisp_user_function *)x)->arg_list);153 void *block = collect_object((( lisp_user_function *)x)->block_list);152 void *arg = collect_object(((LispUserFunction *)x)->arg_list); 153 void *block = collect_object(((LispUserFunction *)x)->block_list); 154 154 ret = new_lisp_user_function(arg, block); 155 155 } … … 163 163 break; 164 164 case L_C_FUNCTION: 165 ret = new_lisp_c_function((( lisp_sys_function *)x)->min_args,166 (( lisp_sys_function *)x)->max_args,167 (( lisp_sys_function *)x)->fun_number);165 ret = new_lisp_c_function(((LispSysFunction *)x)->min_args, 166 ((LispSysFunction *)x)->max_args, 167 ((LispSysFunction *)x)->fun_number); 168 168 break; 169 169 case L_C_BOOL: 170 ret = new_lisp_c_bool((( lisp_sys_function *)x)->min_args,171 (( lisp_sys_function *)x)->max_args,172 (( lisp_sys_function *)x)->fun_number);170 ret = new_lisp_c_bool(((LispSysFunction *)x)->min_args, 171 ((LispSysFunction *)x)->max_args, 172 ((LispSysFunction *)x)->fun_number); 173 173 break; 174 174 case L_L_FUNCTION: 175 ret = new_user_lisp_function((( lisp_sys_function *)x)->min_args,176 (( lisp_sys_function *)x)->max_args,177 (( lisp_sys_function *)x)->fun_number);175 ret = new_user_lisp_function(((LispSysFunction *)x)->min_args, 176 ((LispSysFunction *)x)->max_args, 177 ((LispSysFunction *)x)->fun_number); 178 178 break; 179 179 case L_POINTER: … … 187 187 break; 188 188 case L_CONS_CELL: 189 ret = collect_cons_cell(( cons_cell*)x);189 ret = collect_cons_cell((LispList *)x); 190 190 break; 191 191 case L_OBJECT_VAR: 192 ret = new_lisp_object_var((( lisp_object_var *)x)->number);192 ret = new_lisp_object_var(((LispObjectVar *)x)->number); 193 193 break; 194 194 case L_COLLECTED_OBJECT: 195 ret = (( lisp_collected_object *)x)->new_reference;195 ret = ((LispRedirect *)x)->new_reference; 196 196 break; 197 197 default: … … 202 202 break; 203 203 } 204 (( lisp_collected_object *)x)->type = L_COLLECTED_OBJECT;205 (( lisp_collected_object *)x)->new_reference = ret;204 ((LispRedirect *)x)->type = L_COLLECTED_OBJECT; 205 ((LispRedirect *)x)->new_reference = ret; 206 206 } 207 207 else if ((uint8_t *)x < collected_start || (uint8_t *)x >= collected_end) … … 210 210 { 211 211 for (; x && item_type(x) == L_CONS_CELL; x = CDR(x)) 212 (( cons_cell *)x)->car = collect_object(((cons_cell*)x)->car);212 ((LispList *)x)->car = collect_object(((LispList *)x)->car); 213 213 if (x) 214 (( cons_cell *)x)->cdr = collect_object(((cons_cell*)x)->cdr);214 ((LispList *)x)->cdr = collect_object(((LispList *)x)->cdr); 215 215 } 216 216 } … … 219 219 } 220 220 221 static void collect_symbols( lisp_symbol *root)221 static void collect_symbols(LispSymbol *root) 222 222 { 223 223 if (root) -
abuse/trunk/src/lisp/lisp_opt.cpp
r481 r482 95 95 { 96 96 l_undefined=make_find_symbol(":UNDEFINED"); // this needs to be defined first 97 (( lisp_symbol *)l_undefined)->function=NULL; // collection problems result if we don't do this98 (( lisp_symbol *)l_undefined)->value=NULL;97 ((LispSymbol *)l_undefined)->function=NULL; // collection problems result if we don't do this 98 ((LispSymbol *)l_undefined)->value=NULL; 99 99 100 100 -
abuse/trunk/src/ltree.cpp
r129 r482 10 10 #include "config.h" 11 11 12 lisp_symbol *find_symbol(char *name)12 LispSymbol *find_symbol(char *name) 13 13 { 14 lisp_symbol *p=lsym_root;14 LispSymbol *p=lsym_root; 15 15 while (p) 16 16 { 17 int cmp=strcmp(name,((char *)(( lisp_symbol *)cs->car)->name)+sizeof(lisp_string));17 int cmp=strcmp(name,((char *)((LispSymbol *)cs->car)->name)+sizeof(LispString)); 18 18 if (cmp==0) return p; 19 19 else if (cmp<0) p=p->left; … … 25 25 26 26 27 lisp_symbol *make_find_symbol(char *name)27 LispSymbol *make_find_symbol(char *name) 28 28 { 29 lisp_symbol *p=lsym_root;30 lisp_symbol **parent=&lsym_root;29 LispSymbol *p=lsym_root; 30 LispSymbol **parent=&lsym_root; 31 31 while (p) 32 32 { 33 int cmp=strcmp(name,((char *)(( lisp_symbol *)cs->car)->name)+sizeof(lisp_string));33 int cmp=strcmp(name,((char *)((LispSymbol *)cs->car)->name)+sizeof(LispString)); 34 34 if (cmp==0) return p; 35 35 else if (cmp<0) … … 45 45 } 46 46 47 p=malloc(sizeof( lisp_symbol));47 p=malloc(sizeof(LispSymbol)); 48 48 p->type=L_SYMBOL; 49 49 p->name=new_lisp_string(name); -
abuse/trunk/src/objects.cpp
r481 r482 108 108 { 109 109 return lvars[figures[otype]->var_index[i]]; 110 /* lisp_object_var *cobj=(lisp_object_var *)symbol_value(figures[otype]->vars[i]);110 /* LispObjectVar *cobj=(LispObjectVar *)symbol_value(figures[otype]->vars[i]); 111 111 character_type *t=figures[otype]; 112 112 int number=cobj->number; … … 265 265 266 266 void *m=mark_heap(TMP_SPACE); 267 eval_function(( lisp_symbol *)ns,NULL);267 eval_function((LispSymbol *)ns,NULL); 268 268 restore_heap(m,TMP_SPACE); 269 269 … … 279 279 current_object = this; 280 280 void *m = mark_heap( TMP_SPACE ); 281 (void)eval_function( ( lisp_symbol *)ns, NULL );281 (void)eval_function( (LispSymbol *)ns, NULL ); 282 282 restore_heap( m, TMP_SPACE ); 283 283 } … … 419 419 prof1=new time_marker; 420 420 421 Cell *ret=(Cell *)eval_function(( lisp_symbol *)figures[otype]->get_fun(OFUN_AI),NULL);421 Cell *ret=(Cell *)eval_function((LispSymbol *)figures[otype]->get_fun(OFUN_AI),NULL); 422 422 if (profiling()) 423 423 { … … 492 492 l_ptr_stack.push(&am); 493 493 494 (( cons_cell*)am)->car=new_lisp_number(amount);494 ((LispList *)am)->car=new_lisp_number(amount); 495 495 496 496 frm=new_cons_cell(); 497 497 l_ptr_stack.push(&frm); 498 498 499 (( cons_cell*)frm)->car=new_lisp_pointer(from);499 ((LispList *)frm)->car=new_lisp_pointer(from); 500 500 501 501 hx=new_cons_cell(); 502 502 l_ptr_stack.push(&hx); 503 503 504 (( cons_cell*)hx)->car=new_lisp_number(hitx);504 ((LispList *)hx)->car=new_lisp_number(hitx); 505 505 506 506 hy=new_cons_cell(); 507 507 l_ptr_stack.push(&hy); 508 (( cons_cell*)hy)->car=new_lisp_number(hity);508 ((LispList *)hy)->car=new_lisp_number(hity); 509 509 510 510 px=new_cons_cell(); 511 511 l_ptr_stack.push(&px); 512 (( cons_cell*)px)->car=new_lisp_number(push_xvel);512 ((LispList *)px)->car=new_lisp_number(push_xvel); 513 513 514 514 py=new_cons_cell(); 515 515 l_ptr_stack.push(&py); 516 (( cons_cell*)py)->car=new_lisp_number(push_yvel);517 518 519 (( cons_cell*)am)->cdr=frm;520 (( cons_cell*)frm)->cdr=hx;521 (( cons_cell*)hx)->cdr=hy;522 (( cons_cell*)hy)->cdr=px;523 (( cons_cell*)px)->cdr=py;516 ((LispList *)py)->car=new_lisp_number(push_yvel); 517 518 519 ((LispList *)am)->cdr=frm; 520 ((LispList *)frm)->cdr=hx; 521 ((LispList *)hx)->cdr=hy; 522 ((LispList *)hy)->cdr=px; 523 ((LispList *)px)->cdr=py; 524 524 525 525 time_marker *prof1=NULL; … … 527 527 prof1=new time_marker; 528 528 529 eval_user_fun(( lisp_symbol *)d,am);529 eval_user_fun((LispSymbol *)d,am); 530 530 if (profiling()) 531 531 { … … 642 642 prof1=new time_marker; 643 643 644 eval_function(( lisp_symbol *)figures[otype]->get_fun(OFUN_DRAW),NULL);644 eval_function((LispSymbol *)figures[otype]->get_fun(OFUN_DRAW),NULL); 645 645 if (profiling()) 646 646 { … … 669 669 prof1=new time_marker; 670 670 671 eval_function(( lisp_symbol *)figures[otype]->get_fun(OFUN_MAP_DRAW),NULL);671 eval_function((LispSymbol *)figures[otype]->get_fun(OFUN_MAP_DRAW),NULL); 672 672 if (profiling()) 673 673 { … … 1176 1176 prof1=new time_marker; 1177 1177 1178 eval_function(( lisp_symbol *)figures[type]->get_fun(OFUN_CONSTRUCTOR),NULL);1178 eval_function((LispSymbol *)figures[type]->get_fun(OFUN_CONSTRUCTOR),NULL); 1179 1179 if (profiling()) 1180 1180 { … … 1223 1223 lcx=new_cons_cell(); 1224 1224 l_ptr_stack.push(&lcx); 1225 (( cons_cell*)lcx)->car=new_lisp_number(cx);1225 ((LispList *)lcx)->car=new_lisp_number(cx); 1226 1226 1227 1227 lcy=new_cons_cell(); 1228 1228 l_ptr_stack.push(&lcy); 1229 (( cons_cell*)lcy)->car=new_lisp_number(cy);1229 ((LispList *)lcy)->car=new_lisp_number(cy); 1230 1230 1231 1231 lb=new_cons_cell(); 1232 1232 l_ptr_stack.push(&lb); 1233 (( cons_cell*)lb)->car=new_lisp_number(button);1234 1235 1236 (( cons_cell*)lcx)->cdr=lcy;1237 (( cons_cell*)lcy)->cdr=lb;1233 ((LispList *)lb)->car=new_lisp_number(button); 1234 1235 1236 ((LispList *)lcx)->cdr=lcy; 1237 ((LispList *)lcy)->cdr=lb; 1238 1238 1239 1239 void *m=mark_heap(TMP_SPACE); … … 1243 1243 prof1=new time_marker; 1244 1244 1245 void *r=eval_function(( lisp_symbol *)figures[otype]->get_fun(OFUN_MOVER),1245 void *r=eval_function((LispSymbol *)figures[otype]->get_fun(OFUN_MOVER), 1246 1246 (void *)lcx); 1247 1247 if (profiling()) … … 1604 1604 prof1=new time_marker; 1605 1605 1606 eval_user_fun(( lisp_symbol *)f,NULL);1606 eval_user_fun((LispSymbol *)f,NULL); 1607 1607 1608 1608 if (profiling()) … … 1647 1647 prof1=new time_marker; 1648 1648 1649 eval_function(( lisp_symbol *)figures[new_type]->get_fun(OFUN_CONSTRUCTOR),NULL);1649 eval_function((LispSymbol *)figures[new_type]->get_fun(OFUN_CONSTRUCTOR),NULL); 1650 1650 if (profiling()) 1651 1651 { -
abuse/trunk/src/particle.cpp
r481 r482 61 61 int defun_pseq(void *args) 62 62 { 63 lisp_symbol *sym=(lisp_symbol *)lcar(args);63 LispSymbol *sym=(LispSymbol *)lcar(args); 64 64 if (item_type(sym)!=L_SYMBOL) 65 65 { -
abuse/trunk/src/view.cpp
r481 r482 334 334 /* if( DEFINEDP( symbol_function( l_get_local_input ) ) ) 335 335 { 336 void *ret = eval_function(( lisp_symbol *)l_get_local_input, NULL );336 void *ret = eval_function((LispSymbol *)l_get_local_input, NULL ); 337 337 sug_x = lnumber_value( CAR( ret ) ); 338 338 ret = CDR( ret ); … … 461 461 void *list=NULL; 462 462 push_onto_list(new_lisp_string(chat_buf),list); 463 eval_function(( lisp_symbol *)l_chat_input,list);463 eval_function((LispSymbol *)l_chat_input,list); 464 464 restore_heap(m,TMP_SPACE); 465 465 … … 883 883 game_object *o=current_object; 884 884 current_object=focus; 885 eval_user_fun(( lisp_symbol *)figures[focus->otype]->get_fun(OFUN_CONSTRUCTOR),NULL);885 eval_user_fun((LispSymbol *)figures[focus->otype]->get_fun(OFUN_CONSTRUCTOR),NULL); 886 886 current_object=o; 887 887 }
Note: See TracChangeset
for help on using the changeset viewer.