︙ | | | ︙ | |
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
int max_animation=32;
Sint32 max_volume=10000;
Uint8 back_color=1;
Uint8 inv_back_color=9;
char**stringpool;
AnimationSlot anim_slot[8];
Uint8 keymask[256/8];
#define HASH_SIZE 8888
#define LOCAL_HASH_SIZE 5555
typedef struct {
Uint16 id;
char*txt;
} Hash;
|
>
|
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
int max_animation=32;
Sint32 max_volume=10000;
Uint8 back_color=1;
Uint8 inv_back_color=9;
char**stringpool;
AnimationSlot anim_slot[8];
Uint8 keymask[256/8];
Uint16 array_size;
#define HASH_SIZE 8888
#define LOCAL_HASH_SIZE 5555
typedef struct {
Uint16 id;
char*txt;
} Hash;
|
︙ | | | ︙ | |
871
872
873
874
875
876
877
878
879
880
881
882
883
884
|
case OP_STRING: return UVALUE(pool_string(tokenstr),TY_STRING);
case OP_BITCONSTANT ... OP_BITCONSTANT_LAST: return NVALUE(1<<(tokenv&31));
case 0xC000 ... 0xFFFF: return MVALUE(tokenv-0xBF00);
}
}
ParseError("Constant value expected\n");
}
static void begin_label_stack(void) {
labelstack=0;
labelptr=malloc(0x8000*sizeof(Uint16));
if(!labelptr) fatal("Allocation failed\n");
memset(labelptr,255,0x8000*sizeof(Uint16));
*labelptr=0x8001;
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
|
case OP_STRING: return UVALUE(pool_string(tokenstr),TY_STRING);
case OP_BITCONSTANT ... OP_BITCONSTANT_LAST: return NVALUE(1<<(tokenv&31));
case 0xC000 ... 0xFFFF: return MVALUE(tokenv-0xBF00);
}
}
ParseError("Constant value expected\n");
}
static Uint32 parse_array(void) {
Uint32 x,y,z;
nxttok();
if(tokent!=TF_INT) ParseError("Number expected\n");
x=tokenv;
nxttok();
if(tokent!=TF_INT) ParseError("Number expected\n");
y=tokenv;
if(x<1 || x>64 || y<1 || y>255) ParseError("Array dimension out of range\n");
z=array_size;
if(z+x*y>0xFFFE) ParseError("Out of array memory\n");
array_size+=x*y;
return z|(y<<16)|(x<<24);
}
static void begin_label_stack(void) {
labelstack=0;
labelptr=malloc(0x8000*sizeof(Uint16));
if(!labelptr) fatal("Allocation failed\n");
memset(labelptr,255,0x8000*sizeof(Uint16));
*labelptr=0x8001;
|
︙ | | | ︙ | |
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
|
gloptr=parse_instructions(0,gloptr,glolocalhash,0);
end_label_stack(classes[0]->codes,glolocalhash);
break;
case 0x2800 ... 0x2FFF: // Define initial values of global variables
i=tokenv-0x2800;
nxttok();
if(tokent==TF_CLOSE) break;
initglobals[i]=parse_constant_value();
nxttok();
if(tokent!=TF_CLOSE) ParseError("Expected close parenthesis\n");
break;
case OP_BACKGROUND:
nxttok();
if(tokent!=TF_INT) ParseError("Number expected\n");
if(tokenv&~255) ParseError("Background color out of range\n");
|
>
>
>
>
|
>
|
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
|
gloptr=parse_instructions(0,gloptr,glolocalhash,0);
end_label_stack(classes[0]->codes,glolocalhash);
break;
case 0x2800 ... 0x2FFF: // Define initial values of global variables
i=tokenv-0x2800;
nxttok();
if(tokent==TF_CLOSE) break;
if(Tokenf(TF_NAME) && tokenv==OP_ARRAY) {
initglobals[i].t=TY_ARRAY;
initglobals[i].u=parse_array();
} else {
initglobals[i]=parse_constant_value();
}
nxttok();
if(tokent!=TF_CLOSE) ParseError("Expected close parenthesis\n");
break;
case OP_BACKGROUND:
nxttok();
if(tokent!=TF_INT) ParseError("Number expected\n");
if(tokenv&~255) ParseError("Background color out of range\n");
|
︙ | | | ︙ | |
1722
1723
1724
1725
1726
1727
1728
1729
1730
|
}
}
if(vst) sqlite3_finalize(vst);
free(glohash);
for(i=1;i<undef_class;i++) if(classes[i] && (classes[i]->cflags&CF_NOCLASS1)) fatal("Class $%s mentioned but not defined\n",classes[i]->name);
if(macros) for(i=0;i<MAX_MACRO;i++) if(macros[i]) free_macro(macros[i]);
free(macros);
fprintf(stderr,"Done\n");
}
|
>
>
>
>
|
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
|
}
}
if(vst) sqlite3_finalize(vst);
free(glohash);
for(i=1;i<undef_class;i++) if(classes[i] && (classes[i]->cflags&CF_NOCLASS1)) fatal("Class $%s mentioned but not defined\n",classes[i]->name);
if(macros) for(i=0;i<MAX_MACRO;i++) if(macros[i]) free_macro(macros[i]);
free(macros);
if(array_size) {
array_data=malloc(array_size*sizeof(Value));
if(!array_data) fatal("Array allocation failed\n");
}
fprintf(stderr,"Done\n");
}
|