Free Hero Mesh

Check-in [81f52e6f42]
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.
Overview
Comment:Add some SQL functions
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 81f52e6f42fc9ac97ad167bba91cb5b06f7cff31
User & Date: user on 2018-06-10 16:34:34.492
Other Links: manifest | tags
Context
2018-06-10
21:26
Fill in the VARIABLES table check-in: fd3a87fc50 user: user tags: trunk
16:34
Add some SQL functions check-in: 81f52e6f42 user: user tags: trunk
06:10
Move around some BEGIN and COMMIT commands to avoid misnested transactions in some cases check-in: b4a4337c4a user: user tags: trunk
Changes
Modified compile from [4085df24bd] to [626fabb32d].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
#!/bin/bash --
test -f CFLAGS || echo xxx > CFLAGS
test "xx$CFLAGS" = "x`cat CFLAGS`" || rm bindings.o class.o picture.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 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 picture.c -nt picture.o && bash picture.c
bash main.c


|







|





>


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash --
test -f CFLAGS || echo xxx > CFLAGS
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 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 version [7c083f4652].
118
119
120
121
122
123
124




    const char*txt;
  };
} UserCommand;

void load_key_bindings(void);
const UserCommand*find_key_binding(SDL_Event*ev,int editing);












>
>
>
>
118
119
120
121
122
123
124
125
126
127
128
    const char*txt;
  };
} UserCommand;

void load_key_bindings(void);
const UserCommand*find_key_binding(SDL_Event*ev,int editing);

// == function ==

void init_sql_functions(sqlite3_int64*ptr0,sqlite3_int64*ptr1);

Modified main.c from [8ee65d5a1a] to [56dbbbf3e1].
1
2
3
4
5
6
7
8
9
#if 0
gcc ${CFLAGS:--s -O2} -o ${EXE:-~/bin/heromesh} main.c class.o picture.o bindings.o smallxrm.o sqlite3.o `sdl-config --cflags --libs` -ldl -lpthread
exit
#endif

/*
  This program is part of Free Hero Mesh and is public domain.
*/


|







1
2
3
4
5
6
7
8
9
#if 0
gcc ${CFLAGS:--s -O2} -o ${EXE:-~/bin/heromesh} main.c class.o picture.o bindings.o function.o smallxrm.o sqlite3.o `sdl-config --cflags --libs` -ldl -lpthread
exit
#endif

/*
  This program is part of Free Hero Mesh and is public domain.
*/

308
309
310
311
312
313
314

315
316
317
318
319
320
321
    if(*s && sqlite3_load_extension(userdb,s,0,&p)) fatal("Failed to load extension '%s' (%s)\n",s,p?:"unknown error");
    free(s);
  }
  if(sqlite3_exec(userdb,schema,0,0,&s)) fatal("Failed to initialize database schema (%s)\n",s?:"unknown error");
  optionquery[1]=Q_sqlInit;
  v=xrm_get_resource(resourcedb,optionquery,optionquery,2);
  if(v && sqlite3_exec(userdb,v,0,0,&s)) fatal("Failed to execute user-defined SQL statements (%s)\n",s?:"unknown error");

}

void set_cursor(int id) {
  id>>=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);
  SDL_SetCursor(cursor[id]);
}







>







308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
    if(*s && sqlite3_load_extension(userdb,s,0,&p)) fatal("Failed to load extension '%s' (%s)\n",s,p?:"unknown error");
    free(s);
  }
  if(sqlite3_exec(userdb,schema,0,0,&s)) fatal("Failed to initialize database schema (%s)\n",s?:"unknown error");
  optionquery[1]=Q_sqlInit;
  v=xrm_get_resource(resourcedb,optionquery,optionquery,2);
  if(v && sqlite3_exec(userdb,v,0,0,&s)) fatal("Failed to execute user-defined SQL statements (%s)\n",s?:"unknown error");
  init_sql_functions(&leveluc,&solutionuc);
}

void set_cursor(int id) {
  id>>=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);
  SDL_SetCursor(cursor[id]);
}