break;
#endif
case BCRETURN: trace("Return");
- pc = plen;
t->value = (uint16_t) stack[sp-1];
- break;
+ debug("Task returned");
+ task_delete(t->taskid);
+ return;
default:
trace("unrecognized");
die("Unrecognized command: %d", program[pc-1]);
}
+ //Read return type
+ t->type = read_byte();
+
//Read tasklength
t->tasklength = read16();
debug("task interval: %d, length: %d\n", t->interval, t->tasklength);
}
t = task_next(t);
}
+ //Write acknowledgement
+ write_byte('d');
+ write16(c);
+ write16(t->value);
+ write_byte('\n');
if(t != NULL){
//We found the task, now we move everything from the end of the task up
import Tasks.Examples
encode :: MTaskMSGSend -> String
-encode (MTTask to data) = "t" +++ toByteCode to +++ to16bit (size data) +++ data +++ "\n"
+encode (MTTask to ret data) = "t" +++ toByteCode to +++ toString ret +++ to16bit (size data) +++ data +++ "\n"
encode (MTTaskDel i) = "d" +++ to16bit i +++ "\n"
encode (MTSds i v) = "s" +++ to16bit i +++ toByteCode v +++ "\n"
encode (MTUpd i v) = "u" +++ to16bit i +++ toByteCode v +++ "\n"
instance toString MTaskMSGSend where
toString (MTSds i v) = "Sds id: " +++ toString i
+++ " value " +++ safePrint v
- toString (MTTask to data) = "Task timeout: " +++ toString to
+ toString (MTTask to ret data) = "Task timeout: " +++ toString to
+ +++ " return type: " +++ toString ret
+++ " data " +++ safePrint data
toString (MTTaskDel i) = "Task delete request: " +++ toString i
toString (MTUpd i v) = "Update id: " +++ toString i
| not (trace_tn $ printToString newstate.sdss) = undef
| not (trace_tn $ printToString newsdss) = undef
= ([MTSds sdsi e\\{sdsi,sdsval=e}<-newsdss] ++
- [MTTask interval bc], newstate)
+ [MTTask interval 'i' bc], newstate)
instance == BCShare where (==) a b = a.sdsi == b.sdsi