void printResults() { int i; double hinreichendGrenze = getHinreichendGrenze(); for(i = 0; i < taskCount; ++i) { printf("%s:\n", tasks[i].secname); printf("-- Hinreichend: %.4f <= %.4f %s\n", tasks[i].hinreichend, hinreichendGrenze, INT_TO_BOOL(tasks[i].hinreichend <= hinreichendGrenze)); printf("-- Notwendig: %.4f <= %.4f %s\n", tasks[i].notwendig, tasks[i].tDMax, INT_TO_BOOL(tasks[i].notwendig <= tasks[i].tDMax)); } }
static BOOL list_wait(link_list_t* list, long timeout) { #if defined(LINK_LIST_THREADSAFE) if(timeout<0) /* infinite */ return listSemWait(list); if(timeout==0) /* poll */ return listSemTryWait(list); return listSemTryWaitBlock(list,timeout); #else clock_t start; long count; start=msclock(); while((count=listCountNodes(list))==0) { if(timeout==0) break; if(timeout>0 && msclock()-start > timeout) break; YIELD(); } return(INT_TO_BOOL(count)); #endif }
static pwr_tBoolean int8ToBool(CONV_ARGS) { INT_TO_BOOL(pwr_tInt8); return TRUE; }
static JSBool js_console_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp) { ulong val; jsint tiny; JSString* js_str; sbbs_t* sbbs; if((sbbs=(sbbs_t*)JS_GetContextPrivate(cx))==NULL) return(JS_FALSE); tiny = JSVAL_TO_INT(id); switch(tiny) { case CON_PROP_STATUS: val=sbbs->console; break; case CON_PROP_LNCNTR: val=sbbs->lncntr; break; case CON_PROP_ATTR: val=sbbs->curatr; break; case CON_PROP_TOS: val=sbbs->tos; break; case CON_PROP_ROWS: val=sbbs->rows; break; case CON_PROP_COLUMNS: val=sbbs->cols; break; case CON_PROP_AUTOTERM: val=sbbs->autoterm; break; case CON_PROP_TERMINAL: if((js_str=JS_NewStringCopyZ(cx, sbbs->terminal))==NULL) return(JS_FALSE); *vp = STRING_TO_JSVAL(js_str); return(JS_TRUE); case CON_PROP_TIMEOUT: val=sbbs->timeout; break; case CON_PROP_TIMELEFT_WARN: val=sbbs->timeleft_warn; break; case CON_PROP_ABORTED: *vp=BOOLEAN_TO_JSVAL(INT_TO_BOOL(sbbs->sys_status&SS_ABORT)); return(JS_TRUE); case CON_PROP_ABORTABLE: *vp=BOOLEAN_TO_JSVAL(INT_TO_BOOL(sbbs->rio_abortable)); return(JS_TRUE); case CON_PROP_TELNET_MODE: val=sbbs->telnet_mode; break; case CON_PROP_GETSTR_OFFSET: val=sbbs->getstr_offset; break; case CON_PROP_WORDWRAP: if((js_str=JS_NewStringCopyZ(cx, sbbs->wordwrap))==NULL) return(JS_FALSE); *vp = STRING_TO_JSVAL(js_str); return(JS_TRUE); case CON_PROP_QUESTION: if((js_str=JS_NewStringCopyZ(cx, sbbs->question))==NULL) return(JS_FALSE); *vp = STRING_TO_JSVAL(js_str); return(JS_TRUE); case CON_PROP_CTRLKEY_PASSTHRU: val=sbbs->cfg.ctrlkey_passthru; break; case CON_PROP_INBUF_LEVEL: val=RingBufFull(&sbbs->inbuf); break; case CON_PROP_INBUF_SPACE: val=RingBufFree(&sbbs->inbuf); break; case CON_PROP_OUTBUF_LEVEL: val=RingBufFull(&sbbs->outbuf); break; case CON_PROP_OUTBUF_SPACE: val=RingBufFree(&sbbs->outbuf); break; default: return(JS_TRUE); } *vp = INT_TO_JSVAL(val); return(JS_TRUE); }