Index: bindings.c ================================================================== --- bindings.c +++ bindings.c @@ -1,7 +1,7 @@ #if 0 -gcc -s -O2 -c -Wno-unused-result bindings.c `sdl-config --cflags` +gcc ${CFLAGS:--s -O2} -c -Wno-unused-result bindings.c `sdl-config --cflags` exit #endif /* This program is part of Free Hero Mesh and is public domain. Index: class.c ================================================================== --- class.c +++ class.c @@ -1,7 +1,7 @@ #if 0 -gcc -s -O2 -c -Wno-unused-result class.c `sdl-config --cflags` +gcc ${CFLAGS:--s -O2} -c -Wno-unused-result class.c `sdl-config --cflags` exit #endif /* This program is part of Free Hero Mesh and is public domain. @@ -817,10 +817,15 @@ } #define AddInst(x) (cl->codes[ptr++]=(x),prflag=0) #define AddInst2(x,y) (cl->codes[ptr++]=(x),cl->codes[ptr++]=(y),prflag=0,peep=ptr) #define AddInstF(x,y) (cl->codes[ptr++]=(x),prflag=(y)) +#define ChangeInst(x) (cl->codes[ptr-1]x,prflag=0) +#define InstFlag(x) (peepcodes[ptr-1]<0x0080) +#define Inst8bit() (peepcodes[ptr-1]<0x0100) +#define AbbrevOp(x,y) case x: if(Inst7bit()) ChangeInst(+=0x1000|((y)<<4)); else AddInstF(x,tokent); break static int parse_instructions(int cla,int ptr,Hash*hash) { int peep=ptr; int prflag=0; Class*cl=classes[cla]; cl->codes=realloc(cl->codes,0x10000*sizeof(Uint16)); @@ -830,11 +835,38 @@ if(Tokenf(TF_MACRO)) ParseError("Unexpected macro\n"); if(Tokenf(TF_INT)) { } else if(Tokenf(TF_NAME)) { switch(tokenv) { - + AbbrevOp(OP_ADD,0x00); + AbbrevOp(OP_SUB,0x08); + AbbrevOp(OP_MUL,0x10); + AbbrevOp(OP_DIV,0x18); + AbbrevOp(OP_MOD,0x20); + AbbrevOp(OP_MUL_C,0x28); + AbbrevOp(OP_DIV_C,0x30); + AbbrevOp(OP_MOD_C,0x38); + AbbrevOp(OP_BAND,0x40); + AbbrevOp(OP_BOR,0x48); + AbbrevOp(OP_BXOR,0x50); + AbbrevOp(OP_LSH,0x58); + AbbrevOp(OP_RSH,0x60); + AbbrevOp(OP_RSH_C,0x68); + AbbrevOp(OP_EQ,0x70); + AbbrevOp(OP_NE,0x78); + AbbrevOp(OP_LT,0x80); + AbbrevOp(OP_GT,0x88); + AbbrevOp(OP_LE,0x90); + AbbrevOp(OP_GE,0x98); + AbbrevOp(OP_LT_C,0xA0); + AbbrevOp(OP_GT_C,0xA8); + AbbrevOp(OP_LE_C,0xB0); + AbbrevOp(OP_GE_C,0xB8); + case OP_DROP: + if(InstFlag(TF_DROP)) ChangeInst(+=0x2000); + else AddInst(OP_DROP); + break; default: if(Tokenf(TF_ABNORMAL)) ParseError("Invalid instruction token\n"); AddInstF(tokenv,tokent); } } else if(Tokenf(TF_FUNCTION)) { @@ -847,11 +879,11 @@ default: ParseError("Invalid parenthesized instruction\n"); } } else if(tokent==TF_CLOSE) { - if(peepcodes[ptr-1]<0x0100) cl->codes[ptr-1]+=0x1E00; + if(Inst8bit()) ChangeInst(+=0x1E00); else AddInst(OP_RET); break; } else { ParseError("Invalid instruction token\n"); } ADDED compile Index: compile ================================================================== --- /dev/null +++ compile @@ -0,0 +1,15 @@ +#!/bin/bash -- +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 Index: main.c ================================================================== --- main.c +++ main.c @@ -1,7 +1,7 @@ #if 0 -gcc -s -O2 -o ~/bin/heromesh main.c class.o picture.o bindings.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 smallxrm.o sqlite3.o `sdl-config --cflags --libs` -ldl -lpthread exit #endif /* This program is part of Free Hero Mesh and is public domain. Index: names.h ================================================================== --- names.h +++ names.h @@ -18,10 +18,12 @@ #define MSG_DESTROYED 16 #define MSG_CREATED 17 #define MSG_POSTINIT 18 #define MSG_END_TURN 19 #define MSG_CLEANUP 20 +#define MSG_COLLIDING 21 +#define MSG_COLLIDE 22 const char*const standard_message_names[]={ "INIT", "CREATE", "DESTROY", "BEGIN_TURN", @@ -40,10 +42,12 @@ "DESTROYED", "CREATED", "POSTINIT", "END_TURN", "CLEANUP", + "COLLIDING", + "COLLIDE", }; #define SND_SPLASH 0 #define SND_POUR 1 #define SND_DOOR 2 #define SND_GLASS 3 Index: picture.c ================================================================== --- picture.c +++ picture.c @@ -1,7 +1,7 @@ #if 0 -gcc -s -O2 -c -Wno-unused-result picture.c `sdl-config --cflags` +gcc ${CFLAGS:--s -O2} -c -Wno-unused-result picture.c `sdl-config --cflags` exit #endif /* This program is part of Free Hero Mesh and is public domain. Index: quarks.h ================================================================== --- quarks.h +++ quarks.h @@ -171,10 +171,11 @@ #define Q_sqlMemStatus 172 #define Q_sqlSmallAllocations 173 #define Q_sqlCoveringIndexScan 174 #define Q_sqlPowerSafe 175 #define Q_level 176 +#define Q_tracePrefix 177 static const char*const global_quarks[]={ "screenWidth", "screenHeight", "palette", "popupColors", @@ -347,10 +348,11 @@ "sqlMemStatus", "sqlSmallAllocations", "sqlCoveringIndexScan", "sqlPowerSafe", "level", + "tracePrefix", 0}; #ifdef HEROMESH_BINDINGS static const SDLKey quark_to_key[Q_undo+1-Q_backspace]={ SDLK_BACKSPACE, SDLK_TAB,