Overview
Comment: | Add class.c and add more instruction names |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
06c8b2a46942f7550d01b8c1af4eb6c4 |
User & Date: | user on 2018-04-20 05:04:50 |
Other Links: | manifest | tags |
Context
2018-04-22
| ||
00:44 | Further progress on writing the lexer check-in: c36edda367 user: user tags: trunk | |
2018-04-20
| ||
05:04 | Add class.c and add more instruction names check-in: 06c8b2a469 user: user tags: trunk | |
2018-04-16
| ||
00:14 | Add some starting for loading class files (not much yet) check-in: e701e7c58f user: user tags: trunk | |
Changes
Added class.c version [a8af44a33c].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 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 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | #if 0 gcc -s -O2 -c -Wno-unused-result class.c `sdl-config --cflags` exit #endif /* This program is part of Free Hero Mesh and is public domain. */ #define HEROMESH_CLASS #include "SDL.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include "sqlite3.h" #include "smallxrm.h" #include "heromesh.h" #define TF_COMMA 0x0001 #define TF_EQUAL 0x0002 #define TF_ABNORMAL 0x0004 #define TF_COMPAT 0x0008 #define TF_DIR 0x0010 #define TF_DROP 0x0020 #define TF_NAME 0x0080 #define TF_KEY 0x0100 #define TF_STRING 0x0200 #define TF_OPEN 0x0400 #define TF_CLOSE 0x0800 #define TF_INT 0x1000 #define TF_MACRO 0x4000 #define TF_EOF 0x8000 typedef struct { const char*txt; Uint32 num; } Op_Names; #include "instruc.h" Class*classes[0x4000]; const char*messages[0x4000]; int max_animation=32; Sint32 max_volume=10000; static FILE*classfp; static Uint16 tokent; static Uint32 tokenv; static int linenum=1; static char tokenstr[0x2000]; static int undef_class=1; static int undef_message=0; #define ParseError(a,...) fatal("On line %d: " a,linenum,##__VA_ARGS__) static const unsigned char chkind[256]={ ['$']=1, ['!']=1, ['\'']=1, ['#']=1, ['@']=1, ['%']=1, ['&']=1, [':']=1, ['0'...'9']=2, ['-']=2, ['+']=2, ['A'...'Z']=3, ['a'...'z']=3, ['_']=3, ['?']=3, ['.']=3, ['*']=3, ['/']=3, }; static void read_quoted_string(void) { int c,i,n; int isimg=0; for(i=0;i<0x1FFD;) { c=fgetc(classfp); if(c==EOF) { ParseError("Unterminated string literal\n"); } else if(c=='\\') { if(isimg) { isimg=0; tokenstr[i++]=c; } else switch(c=fgetc(classfp)) { case '"': case '\\': tokenstr[i++]=c; break; case '0' ... '7': tokenstr[i++]=c+1-'0'; break; case 'b': tokenstr[i++]=15; break; case 'c': tokenstr[i++]=12; break; case 'i': tokenstr[i++]=14; isimg=1; break; case 'l': tokenstr[i++]=11; break; case 'n': tokenstr[i++]=10; break; case 'q': tokenstr[i++]=16; break; case 'x': c=fgetc(classfp); if(c>='0' && c<='9') n=c-'0'; else if(c>='A' && c<='F') n=c+10-'A'; else if(c>='a' && c<='f') n=c+10-'a'; else ParseError("Invalid string escape: \\x%c\n",c); n<<=4; c=fgetc(classfp); if(c>='0' && c<='9') n|=c-'0'; else if(c>='A' && c<='F') n|=c+10-'A'; else if(c>='a' && c<='f') n|=c+10-'a'; else ParseError("Invalid string escape: \\x%X%c\n",n>>4,c); if(n<32) tokenstr[i++]=31; tokenstr[i++]=n; break; default: ParseError("Invalid string escape: \\%c\n",c); } } else if(c=='"') { if(isimg) ParseError("Unterminated \\i escape in string literal\n"); tokenstr[i]=0; return; } else if(c!='\r') { tokenstr[i++]=c; if(c=='\n') ++linenum; } } ParseError("Too long string literal\n"); } static int name_compar(const void*a,const void*b) { const Op_Names*x=a; const Op_Names*y=b; return strcmp(x->txt,y->txt); } #define ReturnToken(x,y) do{ tokent=x; tokenv=y; return; }while(0) static void nxttok(void) { int c,i; int fl=0; int n=0; int pr=0; tokent=tokenv=0; *tokenstr=0; again: c=fgetc(classfp); while(c==' ' || c=='\t' || c=='\r' || c=='\n') { if(c=='\n') ++linenum; c=fgetc(classfp); } if(c==EOF) ReturnToken(TF_EOF,0); if(c==';') { while(c!=EOF && c!='\n') c=fgetc(classfp); ++linenum; goto again; } if(c=='(') ReturnToken(TF_OPEN,0); if(c==')') ReturnToken(TF_CLOSE,0); if(c=='"') { tokent=TF_STRING; read_quoted_string(); return; } if(c=='=') { fl|=TF_EQUAL; c=fgetc(classfp); } if(c==',') { fl|=TF_COMMA; c=fgetc(classfp); } if(c==EOF) ParseError("Unexpected end of file\n"); if(chkind[c]==1) { pr=c; c=fgetc(classfp); if(c==EOF) ParseError("Unexpected end of file\n"); } while(c>0 && (chkind[c]&2)) { if(n==256) { tokenstr[256]=0; ParseError("Identifier too long: %s\n",tokenstr); } tokenstr[n++]=c; c=fgetc(classfp); } tokenstr[n]=0; if(!n) fatal("Expected identifier\n"); if(c!=EOF) ungetc(c,classfp); switch(pr) { case 0: if(chkind[c=*tokenstr]==2) { char*e; if(c=='-' || c=='+') n=1; else n=0; if(n && !tokenstr[1]) goto norm; tokent=TF_INT; if(fl) ParseError("Invalid use of , and = in a numeric token\n"); if(c=='0' && tokenstr[1]=='x') { tokenv=strtol(tokenstr+2,&e,16); } else if(c=='0' && tokenstr[1]=='o') { tokenv=strtol(tokenstr+2,&e,8); } else { tokenv=strtol(tokenstr+n,&e,10); } if(e && *e) ParseError("Invalid token: %s\n",tokenstr); if(c=='-') tokenv=-tokenv; } else { static Op_Names key={tokenstr}; const Op_Names*op; norm: op=bsearch(&key,op_names,N_OP_NAMES,sizeof(Op_Names),name_compar); if(!op) ParseError("Invalid token: %s\n",tokenstr); tokenv=op->num&0xFFFF; tokent=op->num>>16; if(fl&~tokent) ParseError("Invalid use of , and = in token: %s\n",tokenstr); } break; case '$': break; case '!': // Just ignore sounds for now if(fl) ParseError("Invalid use of , and = in user sound token\n"); tokent=TF_NAME; tokenv=0x0400; break; case '%': break; case '@': break; case '#': break; case ':': break; case '&': break; case '\'': break; } } void load_classes(void) { } |
Modified instruc from [edebcdf7b1] to [be5d10fd00].
︙ | ︙ | |||
53 54 55 56 57 58 59 60 61 62 | #bit26 #bit27 #bit28 #bit29 #bit30 #bit31 (8000) ; Stack ops | > > > > > > > | > > | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | #bit26 #bit27 #bit28 #bit29 #bit30 #bit31 ; Animation constants STOP (0000) ONCE (0001) LOOP (0002) OSC (0008) OSCLOOP (000A) (8000) ; Stack ops .drop "." ,dup swap nip tuck ; Flow controls -if -else -then -el -begin -again -until -while -repeat -for -next *goto *CallSub ret ; Arithmetic add "+" sub "-" |
︙ | ︙ | |||
145 146 147 148 149 150 151 152 153 | ,=Departures ,=Busy ,=Invisible ,=KeyCleared ,=UserSignal ,=VisualOnly ,=Stealthy ,IsPlayer ,Compatible | > > | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | ,=Departures ,=Busy ,=Invisible ,=KeyCleared ,=UserSignal ,=VisualOnly ,=Stealthy ,=Moved ,IsPlayer ,Compatible Self Msg From =Arg1 =Arg2 =Arg3 MoveNumber Level Key ; Class definitions -Quiz -InPlace -DefaultImage -Help -EditorHelp -SUBS ; Main operations Animate ,Assassinate .Broadcast *BroadcastClass .BroadcastEx BroadcastSum BroadcastSumEx .Create DelInventory Delta .,Destroy FlushClass FlushObj GetInventory HeightAt IgnoreKey .,IntMove ,JumpTo ,Loc LocateMe LoseLevel MaxInventory .,Move .,MovePlus "Move+" .,MoveTo NewX NewY ,ObjAbove ObjClassAt ,ObjBelow ,ObjDir PopUp *PopUpArgs .,Send .,SendEx SetInventory Sound Trace VolumeAt WinLevel ,XDir ,YDir ; Specials *Function *Local *Label *String |
Modified instruc.h from [6eea7d367d] to [8595c2a4b6].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #define OP_BITCONSTANT 34792 #define OP_DROP 32768 #define OP_DUP 32769 #define OP_DUP_C 34817 #define OP_SWAP 32770 #define OP_NIP 32771 #define OP_TUCK 32772 #define OP_IF 32773 #define OP_ELSE 32774 #define OP_THEN 32775 #define OP_EL 32776 #define OP_BEGIN 32777 #define OP_AGAIN 32778 #define OP_UNTIL 32779 #define OP_WHILE 32780 #define OP_REPEAT 32781 | > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > < < < < | | | | | | | | | | | | | | | | > > > < < < | | | | | | | | | | | | | | | | | > > > < | < < | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | > | | | | | > > > | | | | | > > > | > > > | > > > | > > > | > > > | | | | | | | > | | | | | | | | | | | | | | | | | | > > > | | > | > | > | | > | | | | | > | > | | | | | | | | | | | | > | | | | > | > > | | | | | | > > > > > | > | | | | | | | | > > > | | | > | | | | > | | | | | | | | | | > | | | | | > | | | | | | | | | | | > > > > | | | | | | | | | | | | > | | | | | | | | | > > | | | > | | | | | | | | | | > > | | | > | | | | | | > | | > | | | > | | | | > | | | | > | | | | | | > | > > > | | > | | | | | | | > > | > > | | | | > > | < < < < > > > > > > > > > > > > | | | | | | | | | | | | > | | | > > > > | | | | > | | | | | | | > | | | | | | | > | | | | > > | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | | | | | | | | | | | | | > | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 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 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 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 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | #define OP_BITCONSTANT 34792 #define OP_STOP 0 #define OP_ONCE 1 #define OP_LOOP 2 #define OP_OSC 8 #define OP_OSCLOOP 10 #define OP_DROP 32768 #define OP_DROP_D 40960 #define OP_DUP 32769 #define OP_DUP_C 34817 #define OP_SWAP 32770 #define OP_NIP 32771 #define OP_TUCK 32772 #define OP_IF 32773 #define OP_ELSE 32774 #define OP_THEN 32775 #define OP_EL 32776 #define OP_BEGIN 32777 #define OP_AGAIN 32778 #define OP_UNTIL 32779 #define OP_WHILE 32780 #define OP_REPEAT 32781 #define OP_FOR 32782 #define OP_NEXT 32783 #define OP_GOTO 32784 #define OP_CALLSUB 32785 #define OP_RET 32786 #define OP_ADD 32787 #define OP_SUB 32788 #define OP_MUL 32789 #define OP_MUL_C 34837 #define OP_DIV 32790 #define OP_DIV_C 34838 #define OP_MOD 32791 #define OP_MOD_C 34839 #define OP_NEG 32792 #define OP_LSH 32793 #define OP_RSH 32794 #define OP_RSH_C 34842 #define OP_BAND 32795 #define OP_BOR 32796 #define OP_BXOR 32797 #define OP_BNOT 32798 #define OP_BIT 32799 #define OP_LAND 32800 #define OP_LOR 32801 #define OP_LXOR 32802 #define OP_LNOT 32803 #define OP_EQ 32804 #define OP_NE 32805 #define OP_GT 32806 #define OP_GT_C 34854 #define OP_LT 32807 #define OP_LT_C 34855 #define OP_GE 32808 #define OP_GE_C 34856 #define OP_LE 32809 #define OP_LE_C 34857 #define OP_IS 32810 #define OP_CLASS 32811 #define OP_CLASS_C 34859 #define OP_TEMPERATURE 32812 #define OP_TEMPERATURE_C 34860 #define OP_TEMPERATURE_E 36908 #define OP_TEMPERATURE_EC 38956 #define OP_TEMPERATURE_EC16 34861 #define OP_TEMPERATURE_E16 36909 #define OP_SHAPE 32814 #define OP_SHAPE_C 34862 #define OP_SHAPE_E 36910 #define OP_SHAPE_EC 38958 #define OP_XLOC 32815 #define OP_XLOC_C 34863 #define OP_YLOC 32816 #define OP_YLOC_C 34864 #define OP_DIR 32817 #define OP_DIR_C 34865 #define OP_DIR_E 36913 #define OP_DIR_EC 38961 #define OP_IMAGE 32818 #define OP_IMAGE_C 34866 #define OP_IMAGE_E 36914 #define OP_IMAGE_EC 38962 #define OP_INERTIA 32819 #define OP_INERTIA_C 34867 #define OP_INERTIA_E 36915 #define OP_INERTIA_EC 38963 #define OP_INERTIA_EC16 34868 #define OP_INERTIA_E16 36916 #define OP_DISTANCE 32821 #define OP_DISTANCE_C 34869 #define OP_DISTANCE_E 36917 #define OP_DISTANCE_EC 38965 #define OP_DISTANCE_EC16 34870 #define OP_DISTANCE_E16 36918 #define OP_DENSITY 32823 #define OP_DENSITY_C 34871 #define OP_DENSITY_E 36919 #define OP_DENSITY_EC 38967 #define OP_DENSITY_EC16 34872 #define OP_DENSITY_E16 36920 #define OP_VOLUME 32825 #define OP_VOLUME_C 34873 #define OP_VOLUME_E 36921 #define OP_VOLUME_EC 38969 #define OP_VOLUME_EC16 34874 #define OP_VOLUME_E16 36922 #define OP_WEIGHT 32827 #define OP_WEIGHT_C 34875 #define OP_WEIGHT_E 36923 #define OP_WEIGHT_EC 38971 #define OP_WEIGHT_EC16 34876 #define OP_WEIGHT_E16 36924 #define OP_HEIGHT 32829 #define OP_HEIGHT_C 34877 #define OP_HEIGHT_E 36925 #define OP_HEIGHT_EC 38973 #define OP_HEIGHT_EC16 34878 #define OP_HEIGHT_E16 36926 #define OP_CLIMB 32831 #define OP_CLIMB_C 34879 #define OP_CLIMB_E 36927 #define OP_CLIMB_EC 38975 #define OP_CLIMB_EC16 34880 #define OP_CLIMB_E16 36928 #define OP_STRENGTH 32833 #define OP_STRENGTH_C 34881 #define OP_STRENGTH_E 36929 #define OP_STRENGTH_EC 38977 #define OP_STRENGTH_EC16 34882 #define OP_STRENGTH_E16 36930 #define OP_HARD 32835 #define OP_HARD_C 34883 #define OP_HARD_E 36931 #define OP_HARD_EC 38979 #define OP_SHARP 32836 #define OP_SHARP_C 34884 #define OP_SHARP_E 36932 #define OP_SHARP_EC 38980 #define OP_SHAPEDIR 32837 #define OP_SHAPEDIR_C 34885 #define OP_SHAPEDIR_E 36933 #define OP_SHAPEDIR_EC 38981 #define OP_SHOVABLE 32838 #define OP_SHOVABLE_C 34886 #define OP_SHOVABLE_E 36934 #define OP_SHOVABLE_EC 38982 #define OP_MISC1 32839 #define OP_MISC1_C 34887 #define OP_MISC1_E 36935 #define OP_MISC1_EC 38983 #define OP_MISC1_EC16 34888 #define OP_MISC1_E16 36936 #define OP_MISC2 32841 #define OP_MISC2_C 34889 #define OP_MISC2_E 36937 #define OP_MISC2_EC 38985 #define OP_MISC2_EC16 34890 #define OP_MISC2_E16 36938 #define OP_MISC3 32843 #define OP_MISC3_C 34891 #define OP_MISC3_E 36939 #define OP_MISC3_EC 38987 #define OP_MISC3_EC16 34892 #define OP_MISC3_E16 36940 #define OP_MISC4 32845 #define OP_MISC4_C 34893 #define OP_MISC4_E 36941 #define OP_MISC4_EC 38989 #define OP_MISC4_EC16 34894 #define OP_MISC4_E16 36942 #define OP_MISC5 32847 #define OP_MISC5_C 34895 #define OP_MISC5_E 36943 #define OP_MISC5_EC 38991 #define OP_MISC5_EC16 34896 #define OP_MISC5_E16 36944 #define OP_MISC6 32849 #define OP_MISC6_C 34897 #define OP_MISC6_E 36945 #define OP_MISC6_EC 38993 #define OP_MISC6_EC16 34898 #define OP_MISC6_E16 36946 #define OP_MISC7 32851 #define OP_MISC7_C 34899 #define OP_MISC7_E 36947 #define OP_MISC7_EC 38995 #define OP_MISC7_EC16 34900 #define OP_MISC7_E16 36948 #define OP_ARRIVED 32853 #define OP_ARRIVED_C 34901 #define OP_ARRIVED_E 36949 #define OP_ARRIVED_EC 38997 #define OP_DEPARTED 32854 #define OP_DEPARTED_C 34902 #define OP_DEPARTED_E 36950 #define OP_DEPARTED_EC 38998 #define OP_ARRIVALS 32855 #define OP_ARRIVALS_C 34903 #define OP_ARRIVALS_E 36951 #define OP_ARRIVALS_EC 38999 #define OP_DEPARTURES 32856 #define OP_DEPARTURES_C 34904 #define OP_DEPARTURES_E 36952 #define OP_DEPARTURES_EC 39000 #define OP_BUSY 32857 #define OP_BUSY_C 34905 #define OP_BUSY_E 36953 #define OP_BUSY_EC 39001 #define OP_INVISIBLE 32858 #define OP_INVISIBLE_C 34906 #define OP_INVISIBLE_E 36954 #define OP_INVISIBLE_EC 39002 #define OP_KEYCLEARED 32859 #define OP_KEYCLEARED_C 34907 #define OP_KEYCLEARED_E 36955 #define OP_KEYCLEARED_EC 39003 #define OP_USERSIGNAL 32860 #define OP_USERSIGNAL_C 34908 #define OP_USERSIGNAL_E 36956 #define OP_USERSIGNAL_EC 39004 #define OP_VISUALONLY 32861 #define OP_VISUALONLY_C 34909 #define OP_VISUALONLY_E 36957 #define OP_VISUALONLY_EC 39005 #define OP_STEALTHY 32862 #define OP_STEALTHY_C 34910 #define OP_STEALTHY_E 36958 #define OP_STEALTHY_EC 39006 #define OP_MOVED 32863 #define OP_MOVED_C 34911 #define OP_MOVED_E 36959 #define OP_MOVED_EC 39007 #define OP_ISPLAYER 32864 #define OP_ISPLAYER_C 34912 #define OP_COMPATIBLE 32865 #define OP_COMPATIBLE_C 34913 #define OP_SELF 32866 #define OP_MSG 32867 #define OP_FROM 32868 #define OP_ARG1 32869 #define OP_ARG1_E 36965 #define OP_ARG2 32870 #define OP_ARG2_E 36966 #define OP_ARG3 32871 #define OP_ARG3_E 36967 #define OP_MOVENUMBER 32872 #define OP_LEVEL 32873 #define OP_KEY 32874 #define OP_QUIZ 32875 #define OP_INPLACE 32876 #define OP_DEFAULTIMAGE 32877 #define OP_HELP 32878 #define OP_EDITORHELP 32879 #define OP_SUBS 32880 #define OP_ANIMATE 32881 #define OP_ASSASSINATE 32882 #define OP_ASSASSINATE_C 34930 #define OP_BROADCAST 32883 #define OP_BROADCAST_D 41075 #define OP_BROADCASTCLASS 32884 #define OP_BROADCASTEX 32885 #define OP_BROADCASTEX_D 41077 #define OP_BROADCASTSUM 32886 #define OP_BROADCASTSUMEX 32887 #define OP_CREATE 32888 #define OP_CREATE_D 41080 #define OP_DELINVENTORY 32889 #define OP_DELTA 32890 #define OP_DESTROY 32891 #define OP_DESTROY_C 34939 #define OP_DESTROY_D 41083 #define OP_DESTROY_CD 43131 #define OP_FLUSHCLASS 32892 #define OP_FLUSHOBJ 32893 #define OP_GETINVENTORY 32894 #define OP_HEIGHTAT 32895 #define OP_IGNOREKEY 32896 #define OP_INTMOVE 32897 #define OP_INTMOVE_C 34945 #define OP_INTMOVE_D 41089 #define OP_INTMOVE_CD 43137 #define OP_JUMPTO 32898 #define OP_JUMPTO_C 34946 #define OP_LOC 32899 #define OP_LOC_C 34947 #define OP_LOCATEME 32900 #define OP_LOSELEVEL 32901 #define OP_MAXINVENTORY 32902 #define OP_MOVE 32903 #define OP_MOVE_C 34951 #define OP_MOVE_D 41095 #define OP_MOVE_CD 43143 #define OP_MOVEPLUS 32904 #define OP_MOVEPLUS_C 34952 #define OP_MOVEPLUS_D 41096 #define OP_MOVEPLUS_CD 43144 #define OP_MOVETO 32905 #define OP_MOVETO_C 34953 #define OP_MOVETO_D 41097 #define OP_MOVETO_CD 43145 #define OP_NEWX 32906 #define OP_NEWY 32907 #define OP_OBJABOVE 32908 #define OP_OBJABOVE_C 34956 #define OP_OBJCLASSAT 32909 #define OP_OBJBELOW 32910 #define OP_OBJBELOW_C 34958 #define OP_OBJDIR 32911 #define OP_OBJDIR_C 34959 #define OP_POPUP 32912 #define OP_POPUPARGS 32913 #define OP_SEND 32914 #define OP_SEND_C 34962 #define OP_SEND_D 41106 #define OP_SEND_CD 43154 #define OP_SENDEX 32915 #define OP_SENDEX_C 34963 #define OP_SENDEX_D 41107 #define OP_SENDEX_CD 43155 #define OP_SETINVENTORY 32916 #define OP_SOUND 32917 #define OP_TRACE 32918 #define OP_VOLUMEAT 32919 #define OP_WINLEVEL 32920 #define OP_XDIR 32921 #define OP_XDIR_C 34969 #define OP_YDIR 32922 #define OP_YDIR_C 34970 #define OP_FUNCTION 32923 #define OP_LOCAL 32924 #define OP_LABEL 32925 #define OP_STRING 32926 #ifdef HEROMESH_CLASS static const Op_Names op_names[]={ {"*",8486933}, {"+",8421395}, {"-",8421396}, {".",10518528}, {"/",8486934}, {"ANHH",8389394}, {"ARRIVED",8389124}, {"Animate",8421489}, {"Arg1",8552549}, {"Arg2",8552550}, {"Arg3",8552551}, {"Arrivals",8618071}, {"Arrived",8618069}, {"Assassinate",8487026}, {"B",9437196}, {"BANG",8389380}, {"BEDOINGNG",8389406}, {"BEEDEEP",8389404}, {"BEGIN_TURN",8389123}, {"BOOOM",8389410}, {"BOUNCE",8389415}, {"BRRREEET",8389396}, {"BRRRT",8389395}, {"BUZZER",8389420}, {"BWEEP",8389397}, {"Broadcast",10518643}, {"BroadcastEx",10518645}, {"BroadcastSum",8421494}, {"BroadcastSumEx",8421495}, {"Busy",8618073}, {"CHEEP",8389393}, {"CHYEW",8389392}, {"CLEANUP",8389140}, {"CLICK",8389388}, {"COLLIDE",8389142}, {"COLLIDING",8389141}, {"CREATE",8389121}, {"CREATED",8389137}, {"Class",8486955}, {"Climb",9142335}, {"Compatible",8487009}, {"Create",10518648}, {"DEEP_POP",8389417}, {"DEPARTED",8389125}, {"DESTROY",8389122}, {"DESTROYED",8389136}, {"DINK",8389390}, {"DOOR",8389378}, {"DRLRLRINK",8389398}, {"DYUPE",8389413}, {"DefaultImage",8683629}, {"DelInventory",8421497}, {"Delta",8421498}, {"Density",9142327}, {"Departed",8618070}, {"Departures",8618072}, {"Destroy",10584187}, {"Dir",8618033}, {"Distance",9142325}, {"E",9437184}, {"END_TURN",8389139}, {"EditorHelp",8683631}, {"F",9437192}, {"FAROUT",8389421}, {"FFFFTT",8389399}, {"FLOATED",8389132}, {"FROG",8389383}, {"FlushClass",8421500}, {"FlushObj",8421501}, {"From",8421476}, {"GLASS",8389379}, {"GLISSANT",8389419}, {"GetInventory",8421502}, {"HAWK",8389425}, {"HEARTBEAT",8389407}, {"HIT",8389134}, {"HITBY",8389135}, {"Hard",8618051}, {"Height",9142333}, {"HeightAt",8421503}, {"Help",8683630}, {"INIT",8389120}, {"IgnoreKey",8421504}, {"Image",8618034}, {"InPlace",8683628}, {"Inertia",9142323}, {"IntMove",10584193}, {"Invisible",8618074}, {"IsPlayer",8487008}, {"JAYAYAYNG",8389416}, {"JUMPED",8389128}, {"JumpTo",8487042}, {"KEWEL",8389422}, {"KEY",8389129}, {"KLECK",8389387}, {"KLINKK",8389385}, {"Key",8421482}, {"KeyCleared",8618075}, {"L",9437194}, {"LASTIMAGE",8389126}, {"LB",9437195}, {"LF",9437193}, {"LOCK",8389408}, {"LOOP",8388610}, {"Level",8421481}, {"Loc",8487043}, {"LocateMe",8421508}, {"LoseLevel",8421509}, {"MOVED",8389127}, {"MOVING",8389130}, {"MaxInventory",8421510}, {"Misc1",9142343}, {"Misc2",9142345}, {"Misc3",9142347}, {"Misc4",9142349}, {"Misc5",9142351}, {"Misc6",9142353}, {"Misc7",9142355}, {"Move",10584199}, {"Move+",10584200}, {"MoveNumber",8421480}, {"MoveTo",10584201}, {"Moved",8618079}, {"Msg",8421475}, {"N",9437186}, {"NE",9437185}, {"NW",9437187}, {"NewX",8421514}, {"NewY",8421515}, {"OLDPHONE",8389402}, {"ONCE",8388609}, {"OSC",8388616}, {"OSCLOOP",8388618}, {"ObjAbove",8487052}, {"ObjBelow",8487054}, {"ObjClassAt",8421517}, {"ObjDir",8487055}, {"PLAYERMOVING",8389133}, {"POSTINIT",8389138}, {"POUR",8389377}, {"POWER",8389386}, {"PopUp",8421520}, {"Quiz",8683627}, {"R",9437198}, {"RATCHET1",8389418}, {"RATCHET2",8389412}, {"RATTLE",8389403}, {"RB",9437197}, {"RF",9437199}, {"S",9437190}, {"SE",9437191}, {"SMALL_POP",8389389}, {"SPLASH",8389376}, {"STEAM",8389424}, {"STOP",8388608}, {"SUBS",8683632}, {"SUNK",8389131}, {"SW",9437189}, {"Self",8421474}, {"Send",10584210}, {"SendEx",10584211}, {"SetInventory",8421524}, {"Shape",8618030}, {"ShapeDir",8618053}, {"Sharp",8618052}, {"Shovable",8618054}, {"Sound",8421525}, {"Stealthy",8618078}, {"Strength",9142337}, {"TAHTASHH",8389409}, {"THMP_thmp",8389405}, {"THWIT",8389384}, {"TICK",8389391}, {"Temperature",9142316}, {"Trace",8421526}, {"UH_OH",8389382}, {"UNCORK",8389414}, {"UNHH",8389381}, {"UserSignal",8618076}, {"VACUUM",8389411}, {"VisualOnly",8618077}, {"Volume",9142329}, {"VolumeAt",8421527}, {"W",9437188}, {"WAHOO",8389400}, {"WHACK",8389423}, {"Weight",9142331}, {"WinLevel",8421528}, {"XDir",8487065}, {"Xloc",8486959}, {"YDir",8487066}, {"YEEHAW",8389401}, {"Yloc",8486960}, {"again",8683530}, {"band",8421403}, {"begin",8683529}, {"bit",8683551}, {"bit0",8388609}, {"bit1",8388610}, {"bit10",8423402}, {"bit11",8423403}, {"bit12",8423404}, {"bit13",8423405}, {"bit14",8423406}, {"bit15",8423407}, {"bit16",8423408}, {"bit17",8423409}, {"bit18",8423410}, {"bit19",8423411}, {"bit2",8388612}, {"bit20",8423412}, {"bit21",8423413}, {"bit22",8423414}, {"bit23",8423415}, {"bit24",8423416}, {"bit25",8423417}, {"bit26",8423418}, {"bit27",8423419}, {"bit28",8423420}, {"bit29",8423421}, {"bit3",8388616}, {"bit30",8423422}, {"bit31",8423423}, {"bit4",8388624}, {"bit5",8388640}, {"bit6",8388672}, {"bit7",8388736}, {"bit8",8423400}, {"bit9",8423401}, {"bnot",8421406}, {"bor",8421404}, {"bxor",8421405}, {"dup",8486913}, {"el",8683528}, {"else",8683526}, {"eq",8421412}, {"for",8683534}, {"ge",8486952}, {"gt",8486950}, {"if",8683525}, {"is",8421418}, {"land",8421408}, {"le",8486953}, {"lnot",8421411}, {"lor",8421409}, {"lsh",8421401}, {"lt",8486951}, {"lxor",8421410}, {"mod",8486935}, {"ne",8421413}, {"neg",8421400}, {"next",8683535}, {"nip",8421379}, {"repeat",8683533}, {"ret",8421394}, {"rsh",8486938}, {"swap",8421378}, {"then",8683527}, {"tuck",8421380}, {"until",8683531}, {"while",8683532}, }; #define N_OP_NAMES 261 #endif |
Modified instruc.js from [781e18edec] to [4a2fc602fd].
︙ | ︙ | |||
19 20 21 22 23 24 25 | let f=x=>{ if(x.startsWith("const standard_message_names=")) f=do_message_names; }; names_file.forEach(x=>f(x)); // not .forEach(f); the function to use varies let curnum=0; const names=Object.create(null); data_file.forEach((line,linenum)=>{ | | | > > > > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | let f=x=>{ if(x.startsWith("const standard_message_names=")) f=do_message_names; }; names_file.forEach(x=>f(x)); // not .forEach(f); the function to use varies let curnum=0; const names=Object.create(null); data_file.forEach((line,linenum)=>{ const reg=/^[ \t]*([-,=!+*#.]*)[ \t]*([A-Za-z0-9_]+)?[ \t]*(?:"([^" \t]+)")?[ \t]*(?:\(([0-9A-Fa-f]+)\))?[ \t]*(?:;.*)?$/.exec(line); if(!reg) throw "Syntax error on line "+(linenum+1); let flags=128; if(reg[1].includes(",")) flags|=1; if(reg[1].includes("=")) flags|=2; if(reg[1].includes("-")) flags|=4; if(reg[1].includes("!")) flags|=8; if(reg[1].includes("+")) flags|=16; if(reg[1].includes(".")) flags|=32; if(reg[4]) curnum=parseInt(reg[4],16); if(reg[2] && !reg[1].includes("#")) { console.log("#define OP_"+reg[2].toUpperCase()+" "+curnum); if(flags&1) console.log("#define OP_"+reg[2].toUpperCase()+"_C "+(curnum+0x0800)); if(flags&2) console.log("#define OP_"+reg[2].toUpperCase()+"_E "+(curnum+0x1000)); if(3==(flags&3)) console.log("#define OP_"+reg[2].toUpperCase()+"_EC "+(curnum+0x1800)); if(10==(flags&10)) { if(flags&1) console.log("#define OP_"+reg[2].toUpperCase()+"_EC16 "+(curnum+0x0801)); console.log("#define OP_"+reg[2].toUpperCase()+"_E16 "+(curnum+0x1001)); } if(flags&32) { console.log("#define OP_"+reg[2].toUpperCase()+"_D "+(curnum+0x2000)); if(flags&1) console.log("#define OP_"+reg[2].toUpperCase()+"_CD "+(curnum+0x2800)); } } if(reg[2] && !reg[1].includes("*")) names[reg[3]||reg[2]]=curnum|(flags<<16); if(reg[2]) ++curnum; if(flags&8) ++curnum; }); console.log("#ifdef HEROMESH_CLASS\nstatic const Op_Names op_names[]={"); Object.keys(names).sort().forEach(x=>console.log("{\""+x+"\","+names[x]+"},")); |
︙ | ︙ |
Modified mbtofhm.c from [5d0704a0ba] to [d589d1523d].
︙ | ︙ | |||
617 618 619 620 621 622 623 | fprintf(fp," (Broadcast $%s)",class[*op]->name); break; case 67: fprintf(fp," Broadcast"); break; case 68: if(*op==255) fprintf(fp," Move"); | | | 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | fprintf(fp," (Broadcast $%s)",class[*op]->name); break; case 67: fprintf(fp," Broadcast"); break; case 68: if(*op==255) fprintf(fp," Move"); else fprintf(fp," %s Move+",direction[*op]); break; case 69: if(*op==255) fprintf(fp," ,Move"); else fprintf(fp," %s ,Move",direction[*op]); break; case 70: fprintf(fp," JumpTo"); |
︙ | ︙ | |||
652 653 654 655 656 657 658 | fprintf(fp," (Broadcast $%s) .",class[*op]->name); st=0; break; case 83: fprintf(fp," Broadcast ."); st=0; break; case 84: if(*op==255) fprintf(fp," Move ."); | | | 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | fprintf(fp," (Broadcast $%s) .",class[*op]->name); st=0; break; case 83: fprintf(fp," Broadcast ."); st=0; break; case 84: if(*op==255) fprintf(fp," Move ."); else fprintf(fp," %s Move+ .",direction[*op]); st=0; break; case 85: if(*op==255) fprintf(fp," ,Move ."); else fprintf(fp," %s ,Move .",direction[*op]); st=0; break; case 88: fprintf(fp," Create ."); |
︙ | ︙ |