proc.c (387B)
1 #include "cell.h" 2 #include "proc.h" 3 4 Proc * 5 proccreate(void) 6 { 7 Proc * p; 8 p = malloc(sizeof(Proc)); 9 p->pc = 0; 10 p->state = 0; 11 p->send = NULL; 12 p->recv = NULL; 13 return p; 14 } 15 16 /* 17 Proc logic is: 18 - send 'read' msg to mem 19 - recv reply 20 - exec 21 - loop 22 */ 23 24 void 25 procstep(Proc *p) 26 { 27 switch (p->state) { 28 case PSError: 29 case PSWait: 30 case PSHalt: 31 return; 32 default: 33 p->state = PSError; 34 } 35 } 36