26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
typedef struct {
char a[(N_MESSAGES==sizeof(standard_message_names)/sizeof(*standard_message_names))?1:-9];
char b[('\1\0'*'x'+'\0\1'*'y'=='xy')?1:-9];
char c[(N_STANDARD_SOUNDS==sizeof(standard_sound_names)/sizeof(*standard_sound_names))?1:-9];
} ASSERTION;
static const char schema[]=
"BEGIN;"
"PRAGMA APPLICATION_ID(1296388936);"
"PRAGMA RECURSIVE_TRIGGERS(1);"
"CREATE TABLE IF NOT EXISTS `USERCACHEINDEX`(`ID` INTEGER PRIMARY KEY, `NAME` TEXT, `TIME` INT);"
"CREATE TABLE IF NOT EXISTS `USERCACHEDATA`(`ID` INTEGER PRIMARY KEY, `FILE` INT, `LEVEL` INT, `NAME` TEXT COLLATE NOCASE, `OFFSET` INT, `DATA` BLOB, `USERSTATE` BLOB);"
"CREATE UNIQUE INDEX IF NOT EXISTS `USERCACHEDATA_I1` ON `USERCACHEDATA`(`FILE`, `LEVEL`);"
"CREATE TRIGGER IF NOT EXISTS `USERCACHEINDEX_DELETION` AFTER DELETE ON `USERCACHEINDEX` BEGIN DELETE FROM `USERCACHEDATA` WHERE `FILE` = OLD.`ID`; END;"
"CREATE TEMPORARY TABLE `PICTURES`(`ID` INTEGER PRIMARY KEY, `NAME` TEXT COLLATE NOCASE, `OFFSET` INT, `DEPENDENT` INT);"
"CREATE TEMPORARY TABLE `VARIABLES`(`ID` INTEGER PRIMARY KEY, `NAME` TEXT);"
|
>
>
>
|
|
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
typedef struct {
char a[(N_MESSAGES==sizeof(standard_message_names)/sizeof(*standard_message_names))?1:-9];
char b[('\1\0'*'x'+'\0\1'*'y'=='xy')?1:-9];
char c[(N_STANDARD_SOUNDS==sizeof(standard_sound_names)/sizeof(*standard_sound_names))?1:-9];
} ASSERTION;
#ifndef CONFIG_APPLICATION_ID
#define CONFIG_APPLICATION_ID "1296388936"
#endif
static const char schema[]=
"BEGIN;"
"PRAGMA APPLICATION_ID("CONFIG_APPLICATION_ID");"
"PRAGMA RECURSIVE_TRIGGERS(1);"
"CREATE TABLE IF NOT EXISTS `USERCACHEINDEX`(`ID` INTEGER PRIMARY KEY, `NAME` TEXT, `TIME` INT);"
"CREATE TABLE IF NOT EXISTS `USERCACHEDATA`(`ID` INTEGER PRIMARY KEY, `FILE` INT, `LEVEL` INT, `NAME` TEXT COLLATE NOCASE, `OFFSET` INT, `DATA` BLOB, `USERSTATE` BLOB);"
"CREATE UNIQUE INDEX IF NOT EXISTS `USERCACHEDATA_I1` ON `USERCACHEDATA`(`FILE`, `LEVEL`);"
"CREATE TRIGGER IF NOT EXISTS `USERCACHEINDEX_DELETION` AFTER DELETE ON `USERCACHEINDEX` BEGIN DELETE FROM `USERCACHEDATA` WHERE `FILE` = OLD.`ID`; END;"
"CREATE TEMPORARY TABLE `PICTURES`(`ID` INTEGER PRIMARY KEY, `NAME` TEXT COLLATE NOCASE, `OFFSET` INT, `DEPENDENT` INT);"
"CREATE TEMPORARY TABLE `VARIABLES`(`ID` INTEGER PRIMARY KEY, `NAME` TEXT);"
|
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
unsigned char*level_title;
Uint16*level_index;
int level_nindex;
char level_changed;
FILE*levelfp;
FILE*solutionfp;
#ifdef __GNUC__
char stack_protect_mode=0;
void*stack_protect_mark;
void*stack_protect_low;
void*stack_protect_high;
#endif
static const char*globalclassname;
|
|
|
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
unsigned char*level_title;
Uint16*level_index;
int level_nindex;
char level_changed;
FILE*levelfp;
FILE*solutionfp;
#ifdef CONFIG_WITH_STACK_PROTECTION
char stack_protect_mode=0;
void*stack_protect_mark;
void*stack_protect_low;
void*stack_protect_high;
#endif
static const char*globalclassname;
|
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
|
if(main_options['h']) goto home;
if((s=getenv("HEROMESH_PREFIX")) && *s) {
hpath=malloc(strlen(s)+32);
if(!hpath) fatal("Allocation failed\n");
sprintf(hpath,"%s.heromeshrc",s);
return;
}
if(s=strrchr(arg,'/')) {
hpath=malloc(s+64-arg);
if(!hpath) fatal("Allocation failed\n");
sprintf(hpath,"%.*s/current.heromeshrc",(int)(s-arg),arg);
return;
}
home:
s=getenv("HOME")?:".";
hpath=malloc(strlen(s)+32);
if(!hpath) fatal("Allocation failed\n");
sprintf(hpath,"%s%s.heromeshrc",s,s[strlen(s)-1]=='/'?"":"/");
}
static void load_options(void) {
FILE*fp;
fp=fopen(hpath,"r");
if(!fp) fatal("Failed to open %s (%m)\n",hpath);
if(xrm_load(resourcedb,fp,1)) fatal("Error while loading .heromeshrc\n");
fclose(fp);
}
static void read_options(int argc,char**argv) {
xrm_db*db=xrm_sub(resourcedb,0,xrm_make_quark(globalclassname,0)?:xrm_anyq);
|
>
>
>
>
<
|
>
>
>
|
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
|
if(main_options['h']) goto home;
if((s=getenv("HEROMESH_PREFIX")) && *s) {
hpath=malloc(strlen(s)+32);
if(!hpath) fatal("Allocation failed\n");
sprintf(hpath,"%s.heromeshrc",s);
return;
}
#ifndef CONFIG_NO_PORTABLE
#ifndef CONFIG_USING_APPIMAGE
if(s=strrchr(arg,'/')) {
hpath=malloc(s+64-arg);
if(!hpath) fatal("Allocation failed\n");
sprintf(hpath,"%.*s/current.heromeshrc",(int)(s-arg),arg);
return;
}
#endif
#endif
home:
s=getenv("HOME")?:".";
hpath=malloc(strlen(s)+32);
if(!hpath) fatal("Allocation failed\n");
sprintf(hpath,"%s%s.heromeshrc",s,s[strlen(s)-1]=='/'?"":"/");
}
static void load_options(void) {
FILE*fp=fopen(hpath,"r");
#ifdef CONFIG_DEFAULT_RESOURCES
if(!fp) fp=fopen(CONFIG_DEFAULT_RESOURCES,"r");
#endif
if(!fp) fatal("Failed to open %s (%m)\n",hpath);
if(xrm_load(resourcedb,fp,1)) fatal("Error while loading .heromeshrc\n");
fclose(fp);
}
static void read_options(int argc,char**argv) {
xrm_db*db=xrm_sub(resourcedb,0,xrm_make_quark(globalclassname,0)?:xrm_anyq);
|
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
|
}
if(n>=m) fatal("Too long SQL statement\n");
}
if(n) fatal("Unterminated SQL statement\n");
free(txt);
}
#ifdef __GNUC__
static void test_stack_protection(void) {
fprintf(stderr,"Stack protection final values: %p %p %p\n",stack_protect_mark,stack_protect_low,stack_protect_high);
}
static void set_stack_protection(void) {
const char*v;
optionquery[1]=Q_stackProtection;
|
|
|
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
|
}
if(n>=m) fatal("Too long SQL statement\n");
}
if(n) fatal("Unterminated SQL statement\n");
free(txt);
}
#ifdef CONFIG_WITH_STACK_PROTECTION
static void test_stack_protection(void) {
fprintf(stderr,"Stack protection final values: %p %p %p\n",stack_protect_mark,stack_protect_low,stack_protect_high);
}
static void set_stack_protection(void) {
const char*v;
optionquery[1]=Q_stackProtection;
|
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
|
if(main_options['f']) main_options['x']=1;
if(!main_options['c']) {
set_path(argv[0]);
load_options();
}
if(argc>optind) read_options(argc-optind,argv+optind);
*optionquery=xrm_make_quark(globalclassname,0)?:xrm_anyq;
#ifdef __GNUC__
stack_protect_mark=__builtin_frame_address(0);
set_stack_protection();
#endif
if(main_options['c']) {
load_classes();
return 0;
}
|
|
|
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
|
if(main_options['f']) main_options['x']=1;
if(!main_options['c']) {
set_path(argv[0]);
load_options();
}
if(argc>optind) read_options(argc-optind,argv+optind);
*optionquery=xrm_make_quark(globalclassname,0)?:xrm_anyq;
#ifdef CONFIG_WITH_STACK_PROTECTION
stack_protect_mark=__builtin_frame_address(0);
set_stack_protection();
#endif
if(main_options['c']) {
load_classes();
return 0;
}
|