Index: compile ================================================================== --- compile +++ compile @@ -1,21 +1,22 @@ #!/bin/bash -- +set -e test -f CFLAGS || echo xxx > CFLAGS -test "xx$CFLAGS" = "x`cat CFLAGS`" || rm bindings.o class.o picture.o function.o exec.o +test "xx$CFLAGS" = "x`cat CFLAGS`" || rm bindings.o class.o picture.o function.o exec.o edit.o || true echo "x$CFLAGS" > CFLAGS test "x$EXE" = "x" && EXE=~/bin/heromesh echo 'Flags: ' "$CFLAGS" echo 'Target filename: ' "$EXE" 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 exec.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 heromesh.h -nt "$EXE" && rm bindings.o class.o picture.o function.o exec.o edit.o || true +test instruc.h -nt "$EXE" && rm class.o || true +test pcfont.h -nt "$EXE" && rm picture.o || true +test quarks.h -nt "$EXE" && rm bindings.o picture.o || true echo '* bindings' test bindings.c -nt bindings.o && bash bindings.c echo '* class' test class.c -nt class.o && bash class.c echo '* function' @@ -22,8 +23,10 @@ test function.c -nt function.o && bash function.c echo '* picture' test picture.c -nt picture.o && bash picture.c echo '* exec' test exec.c -nt exec.o && bash exec.c +echo '* edit' +test edit.c -nt edit.o && bash edit.c echo '* main' bash main.c echo 'DONE' ADDED edit.c Index: edit.c ================================================================== --- edit.c +++ edit.c @@ -0,0 +1,16 @@ +#if 0 +gcc ${CFLAGS:--s -O2} -c edit.c `sdl-config --cflags` +exit +#endif + +#include "SDL.h" +#include +#include +#include +#include "sqlite3.h" +#include "smallxrm.h" +#include "heromesh.h" + +void run_editor(void) { + fatal("[Editor not implemented yet]\n"); // so far just a stub +} Index: exec.c ================================================================== --- exec.c +++ exec.c @@ -109,10 +109,11 @@ bad: free(o); return VOIDLINK; } +// Here is where the execution of a Free Hero Mesh bytecode subroutine is executed. static void execute_program(Uint16*code,int ptr,Uint32 obj) { Object*o=objects[obj]; if(StackProtection()) Throw("Call stack overflow"); for(;;) switch(code[ptr++]) { case OP_GOTO: ptr=code[ptr]; break; Index: heromesh.h ================================================================== --- heromesh.h +++ heromesh.h @@ -190,5 +190,10 @@ void pfunlink(Uint32 n); void pflink(Uint32 n); Uint32 objalloc(Uint16 c); void annihilate(void); const char*execute_turn(int key); + +// == edit == + +void run_editor(void); + Index: main.c ================================================================== --- main.c +++ main.c @@ -1,7 +1,7 @@ #if 0 -gcc ${CFLAGS:--s -O2} -o ${EXE:-~/bin/heromesh} main.c class.o picture.o bindings.o function.o exec.o smallxrm.o sqlite3.o `sdl-config --cflags --libs` -ldl -lpthread +gcc ${CFLAGS:--s -O2} -o ${EXE:-~/bin/heromesh} main.c class.o picture.o bindings.o function.o exec.o edit.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. @@ -726,10 +726,11 @@ } if(v[1]) stack_protect_mark=((char*)stack_protect_mark)+strtoll(v+1,0,0); } #endif +#define run_game() fatal("[Not implemented yet]\n") int main(int argc,char**argv) { int optind=1; while(argc>optind && argv[optind][0]=='-') { int i; const char*s=argv[optind++]; @@ -776,7 +777,7 @@ if(main_options['x']) { fprintf(stderr,"Ready for executing SQL statements.\n"); do_sql_mode(); return 0; } - return 0; // for(;;) { if(main_options['e']) run_editor(); else run_game(); } + for(;;) { if(main_options['e']) run_editor(); else run_game(); } }