Overview
Comment: | Implement flush_usercache() (completely untested so far, though). |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
19b4240efe67dea6a6fe4d53b958ff12 |
User & Date: | user on 2018-06-16 03:26:32 |
Other Links: | manifest | tags |
Context
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 | |
2018-06-15
| ||
21:06 | Add the MESSAGES virtual table check-in: ee25076d50 user: user tags: trunk | |
Changes
Modified function.c from [ad9b86d7bd] to [aa26680e3f].
︙ | |||
28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 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 | + + + + + + + + + + + + + + + + + + + | static void fn_modstate(sqlite3_context*cxt,int argc,sqlite3_value**argv) { sqlite3_result_int(cxt,SDL_GetModState()); } static void fn_picture_size(sqlite3_context*cxt,int argc,sqlite3_value**argv) { sqlite3_result_int(cxt,picture_size); } static void fn_read_lump_at(sqlite3_context*cxt,int argc,sqlite3_value**argv) { sqlite3_int64 of=sqlite3_value_int64(argv[0]); FILE*fp=sqlite3_value_pointer(argv[1],"http://zzo38computer.org/fossil/heromesh.ui#FILE_ptr"); long sz; Uint8*buf; if(!fp) return; rewind(fp); fseek(fp,of-4,SEEK_SET); sz=fgetc(fp)<<16; sz|=fgetc(fp)<<24; sz|=fgetc(fp); sz|=fgetc(fp)<<8; if(sz>0) { buf=malloc(sz); if(!buf) fatal("Allocation failed\n"); if(fread(buf,1,sz,fp)<=0) fatal("I/O error in READ_LUMP_AT() function\n"); sqlite3_result_blob64(cxt,buf,sz,free); } else { sqlite3_result_zeroblob64(cxt,0); } } static void fn_resource(sqlite3_context*cxt,int argc,sqlite3_value**argv) { int i; if(argc>14 || argc<1) { sqlite3_result_error(cxt,"Invalid number of XRM resource components",-1); } else { for(i=0;i<argc;i++) optionquery[i+1]=xrm_make_quark(sqlite3_value_text(argv[i])?:(const unsigned char*)"?",0)?:xrm_anyq; |
︙ | |||
184 185 186 187 188 189 190 191 192 193 194 195 | 203 204 205 206 207 208 209 210 211 212 213 214 215 | + | ); void init_sql_functions(sqlite3_int64*ptr0,sqlite3_int64*ptr1) { sqlite3_create_function(userdb,"BASENAME",0,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_basename,0,0); sqlite3_create_function(userdb,"LEVEL_CACHEID",0,SQLITE_UTF8|SQLITE_DETERMINISTIC,ptr0,fn_cacheid,0,0); sqlite3_create_function(userdb,"MODSTATE",0,SQLITE_UTF8,0,fn_modstate,0,0); sqlite3_create_function(userdb,"PICTURE_SIZE",0,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_picture_size,0,0); sqlite3_create_function(userdb,"READ_LUMP_AT",2,SQLITE_UTF8,0,fn_read_lump_at,0,0); sqlite3_create_function(userdb,"RESOURCE",-1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_resource,0,0); sqlite3_create_function(userdb,"SIGN_EXTEND",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_sign_extend,0,0); sqlite3_create_function(userdb,"SOLUTION_CACHEID",0,SQLITE_UTF8|SQLITE_DETERMINISTIC,ptr1,fn_cacheid,0,0); sqlite3_create_module(userdb,"MESSAGES",&vt_messages,"CREATE TABLE `MESSAGES`(`ID` INTEGER PRIMARY KEY, `NAME` TEXT, `TRACE` INT);"); } |
Modified main.c from [73e39a2b6c] to [f367a2dcad].
︙ | |||
46 47 48 49 50 51 52 | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | - - - - - - - - - - - - - - - - - - - | Uint8 message_trace[0x4100/8]; static const char*globalclassname; static SDL_Cursor*cursor[77]; static FILE*levelfp; static FILE*solutionfp; static sqlite3_int64 leveluc,solutionuc; |
︙ | |||
186 187 188 189 190 191 192 193 | 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 | - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | sqlite3_bind_int(st,2,lvl); sqlite3_bind_text(st,3,lvl==LUMP_CLASS_DEF?"CLASS.DEF":lvl==LUMP_LEVEL_IDX?"LEVEL.IDX":sol?".SOL":".LVL",-1,SQLITE_STATIC); sqlite3_bind_blob64(st,4,data,sz,0); while((e=sqlite3_step(st))==SQLITE_ROW); if(e!=SQLITE_DONE) fatal("SQL error (%d): %s\n",e,sqlite3_errmsg(userdb)); sqlite3_finalize(st); } |
︙ |