int main(int argc, char** argv) { struct program *p = CALLOC_STRUCT(program); utl_window_t *window = calloc(1, sizeof(utl_window_t)); window->width = WIDTH; window->height = HEIGHT; utl_window_init(window); init_prog(p); draw(p); utl_window_attach_surface(window, p->pipe, p->framebuffer.cbufs[0]); for (;;) { utl_window_nextevent(window); if (window->event.type == KeyPress) break; } close_prog(p); return 0; }
int main(int argc, char *argv[]) { strcpy(act_info.prog_id,argv[0]); //creep_capacity = 10; // strcpy(act_info.prog_id,argv[0]); strcpy(date, argv[1]); init_prog(); printf("here\n"); get_unit_info(); get_limit(); check(); init_to_downlimit_power(); print_unit("用最小出力初始化电厂出力后打印"); cal_unit_gen(); printf("\n\n\n"); //write_act_info( 1, "执行定电量负荷分配程序成功"); free_memory(); close_database(); printf("\n\n"); }
int is_prog(t_list *list, int max_elem) { int *index; int *coords; struct termios term; char *buf; char buffer[2048]; if (tgetent(buffer, getenv("TERM")) < 1) return (-1); index = init_prog(&term, list, max_elem, &coords); while (1) { buf = init_read(list, index); if (buf[0] == 27 && buf[1] == 0 && buf[2] == 0) is_escape(term); else if (buf[0] == 27 && buf[1] == 91 && buf[2] != 51) coords = is_arrow(list, buf, index, coords); else if ((buf[0] == 127 && buf[1] == 0 && buf[2] == 0) || (buf[0] == 27 && buf[1] == 91 && buf[2] == 51)) coords = is_del(&list, term, index, coords); else if (buf[0] == 10 && buf[1] == 0 && buf[2] == 0) is_return(term, list); else if (buf[0] == 32 && buf[1] == 0 && buf[2] == 0) coords = is_space(list, index, coords); } return (0); }
int main(int argc, char** argv) { struct program *p = CALLOC_STRUCT(program); init_prog(p); draw(p); close_prog(p); return 0; }
void run(struct program *prog, uint8 input) { init_prog(prog); prog->input = input; for (long int i = 0; i < PRG_SIZE * 5; i++) { step(prog); if (prog->op || prog->ip >= PRG_SIZE - 1) break; } }
stmt_ac *extension() { extern void init_store(Universal, size_t, Universal, size_t); extern void init_prog(cons<fun_ac> *prog_cTree); set_specialization_context(_arg1,_arg2); init_store(_global_sstore_start, _global_sstore_size, _local_sstore_start, _local_sstore_size); init_prog(new cons<fun_ac>( RES_7())); return new Exp_reb(Call_reb("_Gdotproduct_1",cons<param>( param((funptr)&EV_8) += param((funptr)&EV_9) += param(Exp_id("VAR(ROOT(L(G(\"dotproduct\"),0, \"v\")),tINDR(NON_CST,NON_VOL,tINT(NON_CST,NON_VOL,SIGNED,STD)),A(D))")) ),0,"CALL(0,G(\"%s\"),CALL_SIG([VAR(tINDR(NON_CST,NON_VOL,tINT(NON_CST,NON_VOL,SIGNED,STD)),ROOT(L(G(\"dotproduct\"),0, \"v\")))],[],ALIAS_CALL_SIG(STORE([])),BTA_CALL_SIG([D],[]),ETA_RETURN_SIG(D,[],[])),[%s],[[ALIASES([],[])]],tINT(NON_CST,NON_VOL,SIGNED,STD),A(U))"), ""); }
int sprintf_handler(char *str, int fd, const char *format, ...) { va_list ap; t_printf tab[MY_PRINTF_TAB_SIZE]; init_printf_var(tab); init_prog(fd, IS_SPRINTF); va_start(ap, format); global_handler(str, format, ap, tab); va_end(ap); return (g_prog.i); }
//------------------------------------------------------------------------------ void main(void) { unsigned int8 i; init_prog(); EXT_INT_EDGE(2,L_TO_H); disable_interrupts(INT_EXT2); enable_interrupts(INT_TIMER0); enable_interrupts(INT_RDA); enable_interrupts(INT_RDA2); enable_interrupts(GLOBAL); fprintf(RFID,"SRA\r"); for(i=0;i<16;i++) { RFIDmsg[i]=' '; fprintf(DEBUG,"%d\r\n",i); } for(;;) { IOpin.RFIDpower=0; if(RFIDmsgready) { fprintf(DEBUG,"%s\r\n",RFIDmsg); RFIDmsgready=0; } if(GSMmsgready) { fprintf(DEBUG,"%s",GSMmsg); GSMmsgready=0; } fprintf(GSM,"AT\r"); delay_ms(3000); fprintf(DEBUG,"ALGIFARM\r\n"); } }
int main(int argc, char **argv) { int result, nr_of_plugins, x; t_tissue_stack *t; char serv_command[20], load_command[150]; prctl(PR_SET_NAME, "TS_CORE"); // initialisation of some variable t = malloc(sizeof(*t)); init_prog(t); srand((unsigned) time(NULL)); // intitialisation the volume if (argc > 2) { if (argv[2] != NULL && strcmp(argv[2], "--prompt") != 0) { t->volume_first = malloc(sizeof(*t->volume_first)); if ((result = init_volume(t->memory_mappings, t->volume_first, argv[2])) != 0) return (result); } else if (argv[3] != NULL && strcmp(argv[3], "--prompt") != 0) { t->volume_first = malloc(sizeof(*t->volume_first)); if ((result = init_volume(t->memory_mappings, t->volume_first, argv[3])) != 0) return (result); } } else t->volume_first = NULL; // lunch thread_pool t->tp = malloc(sizeof(*t->tp)); thread_pool_init(t->tp, 16); nr_of_plugins = sizeof(PLUGINS) / sizeof(PLUGINS[0]); for (x = 0; x < nr_of_plugins; x++) { sprintf(load_command, "load %s %s/%s", PLUGINS[x][0], PLUGINS_PATH, PLUGINS[x][1]); plugin_load_from_string(load_command, t); DEBUG("Loading: %s\n", load_command); } sprintf(serv_command, "start serv %s", argv[1]); // start plugins (t->plug_actions)(t, serv_command, NULL); (t->plug_actions)(t, "start comm", NULL); task_clean_up(t); task_lunch(t); signal_manager(t); if ((argv[2] != NULL && strcmp(argv[2], "--prompt") == 0) || (argv[3] != NULL && strcmp(argv[3], "--prompt") == 0)) prompt_start(t); else { INFO("TissueStackImageServer Running!"); pthread_mutex_lock(&t->main_mutex); pthread_cond_wait(&t->main_cond, &t->main_mutex); pthread_mutex_unlock(&t->main_mutex); } // free all the stuff mallocked INFO("Shutting down TissueStackImageServer!"); t->tp->loop = 0; thread_pool_destroy(t->tp); free_core_struct(t); return (0); }
//------------------------------------------------------------------------------ void main(void) { unsigned int16 i; unsigned char tmpbcd; init_prog(); delay_ms (100); DS3231_init(); lcd_init (); //clear_usart_receiver(); EXT_INT_EDGE(2,L_TO_H); disable_interrupts(INT_EXT2); enable_interrupts(INT_TIMER0); enable_interrupts(INT_RDA); IOpin.buzzer=1; for(i=0;i<16;i++) RFIDmsg[i]=' '; lcd_gotoxy(4,1); printf(lcd_putc,"ELFATEK"); for(i=0;i<100;i++) { IOpin.buzzer=0; delay_us(500); IOpin.buzzer=1; delay_us(500); } //printf(lcd_putc,"ALGIFarm"); delay_ms(1000); lcd_putc('\f'); //lcd_gotoxy(1,1); //printf(lcd_putc,"ID:"); //setTime( hr,min,s,am_pm,hr_format); //setDate(dy, dt, mt, yr); txmode=1; get_date_time(); show_parameters(); set_CHID(); init_nrf24(); enable_interrupts(GLOBAL); for(;;) { //lcd_backlight=ON; if(msgrdy) { lcd_backlight=ON; IOpin.errorLED=1; set_CHID(); init_nrf24(); for(i=0;i<100;i++) { IOpin.buzzer=0; delay_us(500); IOpin.buzzer=1; delay_us(500); } lcd_putc('\f'); lcd_gotoxy(1,1); printf(lcd_putc,"ID:"); for(i=0;i<16;i++) { lcd_gotoxy(1+i,2); printf(lcd_putc,"%c",RFIDmsg[i]); } IOpin.errorLED=0; delay_ms(1000); lcd_gotoxy(1,2); lcd_putc('\f'); get_date_time(); for(i=0;i<10;i++) RFIDmsg_[i]=RFIDmsg[i]-48; TXBuffer[0]=0; TXBuffer[1]=hr; TXBuffer[2]=min; TXBuffer[3]=dt; TXBuffer[4]=mt; TXBuffer[5]=yr; TXBuffer[6]=RFIDmsg_[0];// country code TXBuffer[7]=RFIDmsg_[1];// country code TXBuffer[8]=RFIDmsg_[2];// country code TXBUffer[9]=RFIDmsg_[4]; TXBuffer[10]=RFIDmsg_[5]; TXBuffer[11]=RFIDmsg_[6]; TXBuffer[12]=RFIDmsg_[7]; TXBuffer[13]=RFIDmsg_[8]; TXBuffer[15]=RFIDmsg_[9]; lcd_putc('\f'); lcd_gotoxy(1,2); printf(lcd_putc,"%d",RFIDmsg_[9]); /* for(i=0;i<10;i++) { lcd_gotoxy(1+i,2); if(i!=3) printf(lcd_putc,"%d",RFIDmsg_[i]); else printf(lcd_putc,"%c",RFIDmsg[i]); }*/ delay_ms(2000); /* tmpbcd=(RFIDmsg[4]<<4)||RFIDmsg[5]; TXBuffer[9]=tmpbcd;//ID tmpbcd=(RFIDmsg[6]<<4)||RFIDmsg[7]; TXBuffer[10]=tmpbcd; tmpbcd=(RFIDmsg[8]<<4)||RFIDmsg[9]; TXBuffer[11]=tmpbcd; tmpbcd=(RFIDmsg[10]<<4)||RFIDmsg[11]; TXBuffer[12]=tmpbcd; tmpbcd=(RFIDmsg[12]<<4)||RFIDmsg[13]; TXBuffer[13]=tmpbcd; tmpbcd=(RFIDmsg[14]<<4)||RFIDmsg[15]; TXBuffer[14]=tmpbcd; */ transmit_data(); msgrdy=0; } get_date_time(); if(s!=sec) { show_parameters(); delay_ms(2000); } lcd_backlight=OFF; /* for(i=0;i<PAYLOADSIZE;i++) TXBuffer[i]=i; transmit_data(); */ } }