Value *lang_puts(Context *const context, ValueList *const argument_list) { ValueList *vl; char str[80]; FOR (vl, argument_list, next) { value2string(str, 80, vl->value); printf("%s\n", str); }
DWORD WINAPI CCintocxCtrl::CintThread(LPVOID lpvThreadParm) { DWORD dwResult=0; int flag=1; G__value result; int iresult; char arg[G__LONGLINE]; CCintocxCtrl *origin; EVENTID eid; #ifndef WIN32EVENT CSingleLock WaitForCintEvent(&CintEvent); #else CintEvent = CreateEvent(NULL,FALSE,FALSE,"CintEvent"); #endif while(flag) { // Wait for event from GUI thread IsBusy=0; #ifndef WIN32EVENT WaitForCintEvent.Lock(INFINITE); #else WaitForSingleObject(CintEvent,INFINITE); #endif IsBusy=1; while(0==EventQue.Pop(arg,&origin,&eid)) { switch(eid) { case INITEVENT: // start cint with specified argument iresult=G__init_cint(arg); sprintf(arg,"%d",iresult); origin->m_result = arg; break; case EVALEVENT: // start cint with default if not started already if(!G__getcintready()) iresult=G__init_cint("cint"); // evaluate scheduled expression result=G__calc(arg); // translate return value to string value2string(arg,&result); origin->m_result = arg; break; case TERMINATEEVENT: // terminate cint and kill thread G__scratch_all(); goto terminate_thread; } // notify evaldone to GUI thread origin->FireEvalDone(); } } // while(flag) terminate_thread: IsBusy=0; IsCintThreadActive = 0 ; #ifndef WIN32EVENT WaitForCintEvent.Unlock(3); #else CloseHandle(CintEvent); #endif G__FreeConsole(); return(dwResult); }
void CommandLine::addOption(const char *name, double value) { append(name); append(value2string(value)); }
static void print_event(int fd) { size_t rb, yalv; /* the events (up to 64 at once) */ struct input_event ev[64]; rb=read(fd,ev,sizeof(struct input_event)*64); if (rb < (int) sizeof(struct input_event)) { fprintf(stderr, "Failed to get read event: %s\n", strerror(errno)); exit(-1); } for (yalv = 0; yalv < (int) (rb / sizeof(struct input_event)); yalv++) { if (EV_KEY == ev[yalv].type ) { // && ev[yalv].value == 1) { printf("%ld.%06ld ", ev[yalv].time.tv_sec, ev[yalv].time.tv_usec); printf("type %d code %d (%s) value %d (%s)\n", ev[yalv].type, ev[yalv].code, code2string(ev[yalv].code), ev[yalv].value, value2string(ev[yalv].value)); } } }