Overview
Comment: | Implement the {append} macro; also start to implement arrays in the conversion |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c4bb0e3270f18c7cde8da89239d50387 |
User & Date: | user on 2021-02-25 03:28:57 |
Original Comment: | Implement the {append} macro |
Other Links: | manifest | tags |
Context
2021-02-25
| ||
05:36 | Correct and complete the implementation of arrays in the converter check-in: 33593e7ab7 user: user tags: trunk | |
03:28 | Implement the {append} macro; also start to implement arrays in the conversion check-in: c4bb0e3270 user: user tags: trunk | |
2021-02-24
| ||
07:12 | Start to implement arrays (there is no way to use them yet, and the converter does not yet handle arrays). check-in: f7d9c45b1e user: user tags: trunk | |
Changes
Modified class.c from [88b2dee7a7] to [f9db23fff0].
︙ | |||
127 128 129 130 131 132 133 134 135 136 137 138 139 140 | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | + | #define MAC_BNOT 0xFFC8 #define MAC_CAT 0xFFC9 #define MAC_BIT 0xFFCA #define MAC_VERSION 0xFFE0 #define MAC_DEFINE 0xFFE1 #define MAC_INCLUDE 0xFFE2 #define MAC_CALL 0xFFE3 #define MAC_APPEND 0xFFE4 #define MAC_UNDEFINED 0xFFFF static TokenList*add_macro(void) { TokenList*o=malloc(sizeof(TokenList)); if(!o) fatal("Allocation failed\n"); o->t=tokent; o->v=tokenv; |
︙ | |||
541 542 543 544 545 546 547 | 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 | - + + + + - - + + + + + + + + + + + + + + + | } } ParseError("Invalid Hero Mesh key name: %s\n",tokenstr); break; } } |
︙ | |||
814 815 816 817 818 819 820 | 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 | - + + + + + + + + + + | case MAC_DEFINE: if(!macros) { macros=calloc(MAX_MACRO,sizeof(TokenList*)); if(!macros) fatal("Allocation failed\n"); } nxttok(); if(!(tokent&TF_NAME) || tokenv!=OP_STRING) ParseError("String literal expected\n"); |
︙ | |||
1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 | 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 | + | strcpy(tokenstr,"bnot"); glohash[look_hash_mac()].id=MAC_BNOT; strcpy(tokenstr,"cat"); glohash[look_hash_mac()].id=MAC_CAT; strcpy(tokenstr,"bit"); glohash[look_hash_mac()].id=MAC_BIT; strcpy(tokenstr,"version"); glohash[look_hash_mac()].id=MAC_VERSION; strcpy(tokenstr,"define"); glohash[look_hash_mac()].id=MAC_DEFINE; strcpy(tokenstr,"include"); glohash[look_hash_mac()].id=MAC_INCLUDE; strcpy(tokenstr,"call"); glohash[look_hash_mac()].id=MAC_CALL; strcpy(tokenstr,"append"); glohash[look_hash_mac()].id=MAC_APPEND; if(main_options['L']) { for(;;) { nxttok(); printf("** %5d %04X %08X \"",linenum,tokent,tokenv); for(i=0;tokenstr[i];i++) { if(tokenstr[i]<32 || tokenstr[i]>126) printf("<%02X>",tokenstr[i]&255); else putchar(tokenstr[i]); |
︙ |
Modified class.doc from [30af8774af] to [31119da0f4].
︙ | |||
127 128 129 130 131 132 133 134 135 136 137 138 139 140 | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | + + + + | Subtraction. {* <numbers...>} Multiplication. The result is 1 if no arguments are specified. {/ <number> <number>} Division. {append <string> <tokens...>} This works like {define} but adds to an existing definition rather than replacing the definition. {band <numbers...>} Bitwise AND. The result is -1 if no arguments are specified. {bit <numbers...>} The numbers are in range 0 to 31 and denote bit positions; the result is a number with only those bits set. |
︙ |
Modified mbtofhm.c from [443bde1bde] to [86b6c496cf].
︙ | |||
410 411 412 413 414 415 416 | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | - + | } } } #define SubOpcode(...) do{ static const char*const ss[]={__VA_ARGS__}; if(*op>=sizeof(ss)/sizeof(*ss)) goto unknown; fprintf(fp," %s",ss[*op]); }while(0) #define PushFlowControl() do{ flowblock[flowptr]=ofs+2+(op[1]<<1)+(op[2]<<9); if(++flowptr==64) fatal("Too many nested flow controls\n"); len+=2; ind+=2; }while(0) |
︙ | |||
558 559 560 561 562 563 564 565 566 567 568 569 570 571 | 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | + + + + + + + + + | break; case 39: fprintf(fp," Self"); break; case 40: fprintf(fp," ObjClassAt"); break; case 47: z=-1; for(x=0;x<nsubs;x++) { if(op[1]==subs[x*10+8] && op[2]==subs[x*10+9]) { z=x; break; } } if(z==-1) fprintf(fp," @???"); else fprintf(fp," @%s.%s",cname,subs+z*10); len+=2; break; case 48: fprintf(fp," Key"); break; case 49: SubOpcode("STOP","ONCE","LOOP","3","4","5","6","7","OSC","9","OSCLOOP"); break; case 50: |
︙ | |||
604 605 606 607 608 609 610 611 612 613 614 615 616 617 | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 | + + + + | case 59: fprintf(fp," bit%d",*op); break; case 60: if(*op<50) fprintf(fp," %s",standard_sound_names[*op]); else goto unknown; break; case 61: if(*op!=1) goto unknown; fprintf(fp," GetArray"); break; case 64: fprintf(fp," Send"); break; case 65: fprintf(fp," ,Send"); break; case 66: |
︙ | |||
722 723 724 725 726 727 728 729 730 731 732 733 734 735 | 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 | + + + + + + + + + + + + + + + + | fprintf(fp," JumpTo ."); st=0; break; case 111: fprintf(fp," ,JumpTo ."); st=0; break; case 112: case 113: fprintf(fp," Sound"); st=0; break; case 114: if(op[1]) { SubOpcode(";","SetArray","InitArray"); } else { x=0; y=nlbl; z=-1; while(y) { if(lbl[x+8]|(lbl[x+9]<<8))==ofs>>1) break; y--; x+=10; } if(z!=-1) fprintf(fp,"{Array @%s.%s %d %d}",cname,lbl+z*10,op[1],op[3]); len+=4*(op[1]*op[3]+1); } st=0; break; case 126: fprintf(fp," Animate"); st=0; break; case 127: case 128: fprintf(fp," LoseLevel"); st=0; break; |
︙ | |||
881 882 883 884 885 886 887 | 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 | - + - + | fprintf(fp,")\n"); } else { fprintf(fp," (Sharp %d)\n",c->attr[38]|(c->attr[39]<<8)); } } if(c->subscode[1] || c->subscode[0]>2) { fprintf(fp," (SUBS"); |
︙ |