1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#if 0
gcc ${CFLAGS:--s -O2} -c -Wno-multichar bindings.c `sdl-config --cflags`
exit
#endif
/*
This program is part of Free Hero Mesh and is public domain.
*/
#define HEROMESH_BINDINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SDL.h"
#include "sqlite3.h"
#include "smallxrm.h"
#include "quarks.h"
|
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#if 0
gcc ${CFLAGS:--s -O2} -c -Wno-multichar bindings.c `sdl-config --cflags`
exit
#endif
/*
This program is part of Free Hero Mesh and is public domain.
*/
#define HEROMESH_BINDINGS
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SDL.h"
#include "sqlite3.h"
#include "smallxrm.h"
#include "quarks.h"
|
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
if((name=sqlite3_column_text(cmd->stmt,0)) && *name) {
if(name[0]==':') {
switch(name[1]) {
case '!': if(i>1) i=system(sqlite3_column_text(cmd->stmt,1)?:(const unsigned char*)"# "); break;
case ';': i=SQLITE_DONE; goto done;
case '?': if(i>1) puts(sqlite3_column_text(cmd->stmt,1)?:(const unsigned char*)"(null)"); break;
case 'm': if(i>1) screen_message(sqlite3_column_text(cmd->stmt,1)?:(const unsigned char*)"(null)"); break;
case 'x': sql_interactive(); break;
}
} else {
k=name[0]*'\1\0'+name[1]*'\0\1';
while(i && sqlite3_column_type(cmd->stmt,i-1)==SQLITE_NULL) i--;
prev=cb(prev,k,j,i,cmd->stmt,aux);
if(prev<0) {
|
>
|
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
|
if((name=sqlite3_column_text(cmd->stmt,0)) && *name) {
if(name[0]==':') {
switch(name[1]) {
case '!': if(i>1) i=system(sqlite3_column_text(cmd->stmt,1)?:(const unsigned char*)"# "); break;
case ';': i=SQLITE_DONE; goto done;
case '?': if(i>1) puts(sqlite3_column_text(cmd->stmt,1)?:(const unsigned char*)"(null)"); break;
case 'm': if(i>1) screen_message(sqlite3_column_text(cmd->stmt,1)?:(const unsigned char*)"(null)"); break;
case 's': malloc_stats(); fprintf(stderr,"SQLite memory use: %lld %lld\n",(long long)sqlite3_memory_used(),(long long)sqlite3_memory_highwater(1)); break;
case 'x': sql_interactive(); break;
}
} else {
k=name[0]*'\1\0'+name[1]*'\0\1';
while(i && sqlite3_column_type(cmd->stmt,i-1)==SQLITE_NULL) i--;
prev=cb(prev,k,j,i,cmd->stmt,aux);
if(prev<0) {
|