Index: compile ================================================================== --- compile +++ compile @@ -1,18 +1,19 @@ #!/bin/bash -- test -f CFLAGS || echo xxx > CFLAGS -test "xx$CFLAGS" = "x`cat CFLAGS`" || rm bindings.o class.o picture.o +test "xx$CFLAGS" = "x`cat CFLAGS`" || rm bindings.o class.o picture.o function.o echo "x$CFLAGS" > CFLAGS test "x$EXE" = "x" && EXE=~/bin/heromesh test instruc -nt instruc.h && node instruc.js > instruc.h test instruc.js -nt instruc.h && node instruc.js > instruc.h test names.js -nt names.h && node names.js > names.h test quarks -nt quarks.h && node quarks.js > quarks.h test quarks.js -nt quarks.h && node quarks.js > quarks.h -test heromesh.h -nt "$EXE" && rm bindings.o class.o picture.o +test heromesh.h -nt "$EXE" && rm bindings.o class.o picture.o function.o test instruc.h -nt "$EXE" && rm class.o test pcfont.h -nt "$EXE" && rm picture.o test quarks.h -nt "$EXE" && rm bindings.o picture.o test bindings.c -nt bindings.o && bash bindings.c test class.c -nt class.o && bash class.c +test function.c -nt function.o && bash function.c test picture.c -nt picture.o && bash picture.c bash main.c ADDED function.c Index: function.c ================================================================== --- /dev/null +++ function.c @@ -0,0 +1,55 @@ +#if 0 +gcc ${CFLAGS:--s -O2} -c function.c `sdl-config --cflags` +exit +#endif + +#include "SDL.h" +#include +#include +#include +#include "sqlite3.h" +#include "smallxrm.h" +#include "heromesh.h" + +static void fn_basename(sqlite3_context*cxt,int argc,sqlite3_value**argv) { + sqlite3_result_text(cxt,basefilename,-1,SQLITE_STATIC); +} + +static void fn_cacheid(sqlite3_context*cxt,int argc,sqlite3_value**argv) { + sqlite3_result_int64(cxt,*(sqlite3_int64*)sqlite3_user_data(cxt)); +} + +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_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>=1; if(!cursor[id]) cursor[id]=SDL_CreateCursor((void*)cursorimg+(id<<6),(void*)cursorimg+(id<<6)+32,16,16,cursorhot[id]>>4,cursorhot[id]&15);