void blocker_suspend(vm_t vm,vm_blocker_t b,thread_t t) { assert(b); assert(t); gpush(b,&t); vm_obj_ref_ptr(vm,t); thread_set_state(vm,t,ThreadBlocked); }
/* * "switch" statement */ void doswitch (void ) { INTPTR_T ws[7]; INTPTR_T *ptr; ws[WSSYM] = (INTPTR_T)locptr; ws[WSSP] = stkp; ws[WSTYP] = WSSWITCH; ws[WSCASEP] = swstp; ws[WSTAB] = getlabel (); ws[WSDEF] = ws[WSEXIT] = getlabel (); addwhile (ws); immed (T_LABEL, ws[WSTAB]); gpush (); needbrack ("("); expression (YES); needbrack (")"); stkp = stkp + INTSIZE; /* '?case' will adjust the stack */ gjcase (); statement (NO); ptr = readswitch (); jump (ptr[WSEXIT]); dumpsw (ptr); gnlabel (ptr[WSEXIT]); locptr = (char*)ptr[WSSYM]; stkp = modstk (ptr[WSSP]); swstp = ptr[WSCASEP]; delwhile (); }
/* Execute a GOSUB command. */ void gosub() { char *loc; char zeroc='\0'; get_token(); /* find the label to call */ loc = find_label(bas_token); if( loc[0]=='\0') serror(7); /* label not defined */ else { gpush(prog); /* save place to return to */ prog = loc; /* start program running at that loc */ } }
void gread_list (gread_state *state) { if (gread_res) { gpair *newpair = New gpair (gread_res, bottom); gpair *head = state->list.elms; gpair *tail = state->list.elmstail; if (tail) { tail->cdr = newpair; tail = newpair; } else head = tail = newpair; state->list.elms = head; state->list.elmstail = tail; } consume_whitespace (); int c = gget (); switch (c) { case EOF: gerror (); case ')': { gpair *elms = state->list.elms; delete state; if (elms) greturn (elms); else greturn (bottom); } default: gunget (c); gpush (gread_list, state); ggoto (gread_gob, NULL); } }