added debug statements, dynamic allocation is working for tasks
[mTask.git] / client / interpret.c
index 86e3964..6f2f20d 100644 (file)
 void run_task(struct task *t)
 {
        uint8_t *program = t->bc;
-       int plen = t->tlen;
+       int plen = t->tasklength;
        int pc = 0;
        int sp = 0;
        char stack[STACKSIZE] = {0};
        debug("Running task with length: %d", plen);
        while(pc < plen){
-//             debug("program: %d", program[pc]);
-//             debug("stack: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
-//                     stack[0], stack[1], stack[2], stack[3], stack[4],
-//                     stack[5], stack[6], stack[7], stack[8], stack[9]);
-
                switch(program[pc++]){
                case BCNOP: trace("nop");
                        break;
@@ -156,7 +151,7 @@ void run_task(struct task *t)
                        sp--;
                        break;
 #endif
-//#if HAVELED == 1
+#if HAVELED == 1
                case BCLEDON: trace("LedOn(%d)", program[pc]);
                        led_on(stack[sp-1]);
                        sp--;
@@ -165,7 +160,7 @@ void run_task(struct task *t)
                        led_off(stack[sp-1]);
                        sp--;
                        break;
-//#endif
+#endif
                default:
                        trace("unrecognized");
                        die("Unrecognized command: %d", program[pc-1]);