#include #include "vm.h" // /home/scott/joey/rpgengine/dbltw/test.bin void func_print(VMContextT *context, juint16 args) { int x; for (x=0; xworking[0]); if (vmIsItemNumber(&context->working[0])) { printf("%d", context->working[0].value); } else { printf("%s", context->working[0].text); } } } int main(int argc, char *argv[]) { char *programFile; VMContextT context; // Get arguments if (argc != 2) { printf("Usage: %s binary.bin\n", argv[0]); return 1; } programFile = argv[1]; jlUtilStartup("VM Test"); if (!vmCreate(&context)) { printf("Unable to initialize VM.\n"); } else { vmAddFunction(&context, func_print); if (!vmLoad(&context, programFile)) { printf("Unable to load '%s'.\n", programFile); } else { vmRun(&context); } // vmLoad } // vmCreate vmDestroy(&context); printf("\nJlStaT = %lu\n", sizeof(jlStaT)); jlUtilShutdown(); }