Overview
Comment: | Add exec.c (moving some things from main.c); add definitions for exec.c in heromesh.h; also add a macro tracing option. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
9ffad27cd3f3715dcce7329143f1fda0 |
User & Date: | user on 2018-06-22 07:17:54 |
Other Links: | manifest | tags |
Context
2018-06-24
| ||
02:12 | Implement stack overflow protection check-in: 9f57c48591 user: user tags: trunk | |
2018-06-22
| ||
07:17 | Add exec.c (moving some things from main.c); add definitions for exec.c in heromesh.h; also add a macro tracing option. check-in: 9ffad27cd3 user: user tags: trunk | |
2018-06-16
| ||
03:26 | Implement flush_usercache() (completely untested so far, though). check-in: 19b4240efe user: user tags: trunk | |
Changes
Modified class.c from [59aa7eb0cd] to [d86091200c].
︙ | |||
33 34 35 36 37 38 39 | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | - | typedef struct { const char*txt; Uint32 num; } Op_Names; #include "instruc.h" #define Tokenf(x) (tokent&(x)) |
︙ | |||
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | + + + + + + + + + + | TokenList*tl=0; pr=0; tokent=macstack->tok->t; if(tokent&TF_EOF) ParseError("Unexpected end of file in macro expansion\n"); tokenv=macstack->tok->v; *tokenstr=0; if(macstack->tok->str) strcpy(tokenstr,macstack->tok->str); if(main_options['M']) { printf("M* Macro %04X %08X \"",tokent,tokenv); for(i=0;tokenstr[i];i++) { if(tokenstr[i]<32 || tokenstr[i]>126) printf("<%02X>",tokenstr[i]&255); else putchar(tokenstr[i]); } printf("\"\n"); } if(tokent==TF_MACRO+TF_INT && macstack->n>=0) { if(tokenv&~0xFF) { tokenv-=0x100; } else { if(tokenv<macstack->n) tl=macstack->args[tokenv]; if(tl) ref_macro(tl); pr=1; } } macstack->tok=step_macro(macstack->tok); if(!macstack->tok) { MacroStack*ms=macstack->next; for(i=0;i<macstack->n;i++) free_macro(macstack->args[i]); free(macstack->args); free(macstack); macstack=ms; if(main_options['M']) printf("M.\n"); } if(pr) { if(tl) { MacroStack*ms=malloc(sizeof(MacroStack)); if(!ms) fatal("Allocation failed\n"); ms->tok=tl; ms->n=-1; ms->args=0; ms->next=macstack; macstack=ms; } if(main_options['M']) printf("M^ %d\n",tl?1:0); goto magain; } return; } fl=n=pr=0; tokent=tokenv=0; *tokenstr=0; |
︙ | |||
577 578 579 580 581 582 583 584 585 586 587 588 589 590 | 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | + + + + + + + + + | if(!ms) fatal("Allocation failed\n"); ms->tok=mac; ms->n=0; ms->args=0; for(;;) { nxttok1(); if(tokent&TF_EOF) ParseError("Unexpected end of file in macro argument\n"); if(main_options['M']) { int i; printf("M= %c%4d %04X %08X \"",b?'|':a?'^':' ',ms->n,tokent,tokenv); for(i=0;tokenstr[i];i++) { if(tokenstr[i]<32 || tokenstr[i]>126) printf("<%02X>",tokenstr[i]&255); else putchar(tokenstr[i]); } printf("\"\n"); } if(tokent&TF_OPEN) { ++a; if(tokent&TF_MACRO) ++c; } if(tokent&TF_CLOSE) { --a; if(tokent&TF_MACRO) --c; |
︙ | |||
634 635 636 637 638 639 640 641 642 643 644 645 646 647 | 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | + | goto again; } } else if(tokent&TF_MACRO) { Uint32 n; char*s; if(tokent&TF_OPEN) { call: if(main_options['M']) printf("M+ {%s}\n",glohash[tokenv].txt); switch(glohash[tokenv].id) { case 0xC000 ... MAX_MACRO+0xC000-1: begin_macro(macros[glohash[tokenv].id-0xC000]); goto again; case MAC_ADD: n=0; for(;;) { |
︙ | |||
812 813 814 815 816 817 818 819 820 821 822 823 824 825 | 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 | + | goto call; case MAC_UNDEFINED: ParseError("Undefined macro: {%s}\n",tokenstr); break; default: ParseError("Strange macro token: 0x%04X\n",glohash[tokenv].id); } if(main_options['M']) printf("M-\n"); } } } static int pool_string(const char*s) { int i; for(i=0;i<num_strings;i++) if(!strcmp(s,stringpool[i])) return i; |
︙ |
Modified compile from [626fabb32d] to [67c0841242].
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | - + - + + | #!/bin/bash -- test -f CFLAGS || echo xxx > CFLAGS |
Added exec.c version [7c6d309993].
|
Modified heromesh.h from [ba1bd3273a] to [637f2cff6e].
︙ | |||
35 36 37 38 39 40 41 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | - | extern const char*const standard_sound_names[]; extern const char*const heromesh_key_names[256]; extern sqlite3*userdb; extern xrm_db*resourcedb; extern const char*basefilename; extern xrm_quark optionquery[16]; |
︙ | |||
93 94 95 96 97 98 99 | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | - | Sint32 temperature,misc4,misc5,misc6,misc7; Uint16 uservars,oflags,nmsg; Uint16 sharp[4]; Uint16 hard[4]; Uint8 cflags,shape,shovable,collisionLayers,nimages; } Class; |
︙ | |||
124 125 126 127 128 129 130 | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | + + + + + + + + + + + + + + + + + + + + + + | void load_key_bindings(void); const UserCommand*find_key_binding(SDL_Event*ev,int editing); // == function == void init_sql_functions(sqlite3_int64*ptr0,sqlite3_int64*ptr1); // == exec == // The following "internal object flags" are part of the "dir" variable: #define IOF_DEAD 0x10 // object doesn't exist, except to continue an animation #define IOF_ANIM 0x20 // an animation is being displayed typedef struct { Sint32 height,weight,climb,density,volume,strength,arrivals,departures,temperature; Uint32 arrived,departed,arrived2,departed2,generation,up; Uint16 class,oflags; Uint16 sharp[4]; Uint16 hard[4]; Uint8 x,y,shape,shovable,image,dir; Value misc1,misc2,misc3,misc4,misc5,misc6,misc7; Value uservars[0]; } Object; extern Uint32 generation_number; extern Object*objects; extern Uint32 nobjects; extern Value globals[0x800]; |
Modified main.c from [f367a2dcad] to [8f25720cf2].
︙ | |||
37 38 39 40 41 42 43 | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | - | "COMMIT;" ; sqlite3*userdb; xrm_db*resourcedb; const char*basefilename; xrm_quark optionquery[16]; |
︙ |