void boatDump(boat b) { printf("Bote:\n\n"); objectDump(b); printf("Virando: %s\n", b->extra->isTurning == 0 ? "Nao" : b->extra->isTurning < 0 ? "Sentido anti-horario" : "Sentido horario"); printf("Acelerando: %s\n", b->extra->isAccel == 0 ? "Nao" : b->extra->isTurning < 0 ? "Para tras" : "Para frente"); printf("Vida: %d\n", b->extra->life); }
int main (int argc, char *argv[]) { Proto realRoot; Proto root; Proto start; Proto tmpObj; unsigned char * p; unsigned char * module; int i; VM32Cpu cpu; VM32Cpu * pcpu; // Setup the memory and the GC // Setup our virtual CPU pcpu = &cpu; init(pcpu); reset(pcpu); // Setup our runtime celInit(0, pcpu); for (i = 0; i < argc; i++) { if (argv[i][0] == '-') { if (strcmp(argv[i], "--trace") == 0) { debugTrace = 1; printf("debugTrace ON\n"); } else if (strcmp(argv[i], "--dump") == 0) { debugDump = 1; printf("debugDump ON\n"); } } else { module = argv[i]; } } // Load the module if (argc == 1) { printf("Syntax: celdump <module file>\n\n"); exit(1); } root = loadModule(module); if (nil == root) { printf("%s", sd2celError()); } objectDump(root); return 0; }