int main() { print_int(2); foo(); print_int(5); return 0; }
int main () { print_int(13 & 6); // 4 print_int(13 | 6); // 15 print_int(~13); // -14 print_int(13 ^ 6); // 11 return 0; }
void check_type(char type) { switch(type) { case 'd': { int num = va_arg(args, int); if(num < 0){ UsartPut('-'); num = num * (-1); } print_int(num, 10, 0); break; } case 'c': { char ch = (char)va_arg(args, int); UsartPut(ch); break; } case 's': { char *str = va_arg(args, char *); print_str(str); break; } case 'f': { float num = (float)va_arg(args, double); if(num < 0) { UsartPut('-'); num = num * (-1); } print_float(num); break; } case 'p': { int num = va_arg(args, int); UsartPut('0'); UsartPut('x'); print_int(num, 16, 0); break; } default: { UsartPut('%'); UsartPut(type); } } }
static void specs_mmap_flags(ulli param_reg[MAX_ARG]) { int i; char put_pipe; put_pipe = 0; i = 0; dprintf(2, ", "); while (g_flags[i].flags != -1) { if (((long)param_reg[3] & g_flags[i].flags) == g_flags[i].flags) { if (put_pipe == 1) { dprintf(2, "|"); put_pipe = 0; } dprintf(2, "%s", g_flags[i].name); put_pipe++; } i++; } dprintf(2, ", "); print_int(param_reg[4]); dprintf(2, ", "); print_int(param_reg[5]); }
void poll_ultrasonic() { uint32_t L; if(US_mode == US_MODE_OFF) { start_ultrasonic(); return; }//else if(ultrasonic_ms != DIDNT_TRIGGERED) return; if(ultrasonic_get(&L)) { // measurements done, check event if(!overcapture) { if(!last_us_val) { last_us_val = L; } else { uint32_t diff = (last_us_val > L) ? last_us_val - L : L - last_us_val; if(diff > MAX_LEN_DIFF) { if(last_us_val > L) { // someone move in front of sensor ultrasonic_ms = Timer; memcpy(&ultrasonic_time, ¤t_time, sizeof(curtime)); P("Pass! Was: "); print_int(last_us_val); P(", become: "); print_int(L); P("!!!\n"); } else { // free space - check for noices (signal should be at least 10ms) diff = (ultrasonic_ms < Timer) ? Timer - ultrasonic_ms : ultrasonic_ms - Timer; if(diff < ULTRASONIC_TIMEOUT) ultrasonic_ms = DIDNT_TRIGGERED; } last_us_val = L; } } } start_ultrasonic(); } }
void log_banner(const char*v) { const char*months[]= {" ", "JAN","FEB","MAR","APR","MAY","JUN", "JUL","AUG","SEP","OCT","NOV","DEC" }; unsigned month= (unsigned)month_par; if(month> 12) month= 0; fprintf(log_file,"This is "MyName", Version %s%s ",v,WEB2CVERSION); print(format_ident); print_char(' '); print_char(' '); print_int(day_par); print_char(' '); fprintf(log_file,"%s",months[month]); print_char(' '); print_int(year_par); print_char(' '); print_two(time_par/60); print_char(':'); print_two(time_par%60); if(shellenabledp){ wlog_cr(); wlog(' '); if(restrictedshell) fprintf(log_file,"restricted "); fprintf(log_file,"system commands enabled."); } if(filelineerrorstylep){ wlog_cr(); fprintf(log_file," file:line:error style messages enabled."); } }
/** * displays periods of both generators */ void show_motors_period(sendfun s){ P("[ " STR_SHOW_PERIOD " ", s); print_int((int32_t)Motor_period[0],s); s(' '); print_int((int32_t)Motor_period[1],s); P(" ]\n", s); }
void tex::show_page_stats(int b, int pi, int c) { begin_diagnostic(); print_nl("%"); print(" t="); print_totals(); print(" g="); print_scaled(page_goal); print(" b="); if (b == AWFUL_BAD) { print_char('*'); } else { print_int(b); } print(" p="); print_int(pi); print(" c="); if (c == AWFUL_BAD) { print("*"); } else { print_int(c); } if (c <= least_page_cost) { print("#"); } end_diagnostic(FALSE); }
void main() { print_int(odd(42)); // 0 print_str("\n"); print_int(even(42)); // 1 print_str("\n"); }
int print_game(t_game *game) { int j; j = 0; print_line(game->y + j, game->x, game->width); j = j + 1; print_int(game, j, game->high_score, "| High Score "); j = j + 1; print_int(game, j, game->score, "| Score "); j = j + 1; mvprintw(game->y + j, game->x + game->width, "|"); mvprintw(game->y + j, game->x, "|"); j = j + 1; print_int(game, j, game->lvl, "| Level "); j = j + 1; print_int(game, j, game->line, "| Line "); j = j + 1; mvprintw(game->y + j, game->x + game->width, "|"); mvprintw(game->y + j, game->x, "|"); j = j + 1; print_time(game, j); j = j + 1; print_line(game->y + j, game->x, game->width); j = j + 1; return (0); }
void fib(void) { msg_t msg_struct; msg_t *msg = &msg_struct; int n = 0; int i = 0; read_message_by_type(msg, MSG_TYPE_ARGUMENT, 100); if (msg_type_is_invalid(msg)) { print_usage(); return; } n = atoi(msg_data_get_string(msg)); if (n <= 0) { print_usage(); return; } for (i = 0; i <= n; ++i) { sleep(100); print_str("fib("); print_int(i); print_str(") = "); print_int(fib_rec(i)); print_strln(""); } }
void debug_int(struct s_node* head) { assert(head != NULL); if(head != NULL) { while(head != NULL) { my_char('('); if(head->prev == NULL) my_str("NULL <- "); else { print_int(head->prev); my_str(" <- "); } print_int(head); if(head->next == NULL) my_str(" -> NULL)"); else { my_str(" -> "); print_int(head->next); my_str("), "); } head = head->next; } } }
int main() { hpx::naming::id_type console = hpx::find_root_locality(); // print something to the console { print_action<std::string> print_string; print_action<int> print_int; print_action<double> print_double; print_string(console, "Hello World!"); print_int(console, 42); print_double(console, 3.1415); } // print something to the console using a direct action { print_direct_action<std::string> print_string; print_direct_action<int> print_int; print_direct_action<double> print_double; print_string(console, "Hello World!"); print_int(console, 42); print_double(console, 3.1415); } return 0; }
int main () { print_int(1<<1); print_int(1<<2); print_int(1<<3); print_int(18>>1); print_int(18>>2); print_int(18>>3); }
int main () { long a[3] = {1,2,3}; int *p; p = (int*)(void*)a; print_int(p[0]); print_int(p[1]); print_int(p[2]); }
int main() { print_int(callee(0)); print_int(callee(1)); print_int(callee(2)); print_int(callee(3)); return 0; }
myInt main () { pair p; p.x = 1; p.y = 2; print_int(p.x); print_int(p.y); return 0; }
int main () { int x = 23; print_int(x / 3); print_int(-x / 3); print_int(x / -3); print_int(-x / -3); return 0; }
/** * print current time in milliseconds: 4 bytes for ovrvlow + 4 bytes for time * with ' ' as delimeter */ void print_time(sendfun s){ if(mode == LINE_MODE) P("[ " STR_PRINT_TIME " ", s); print_int(tOVRFL, s); s(' '); print_int(Timer, s); if(mode == LINE_MODE) P(" ]\n", s); else if(mode == BYTE_MODE) s(' '); }
int xvfprintf(xFILE *stream, const char *fmt, va_list ap) { const char *p; char *sval; int ival; double dval; void *vp; int cnt = 0; for (p = fmt; *p; p++) { if (*p != '%') { xputc(*p, stream); cnt++; continue; } switch (*++p) { case 'd': case 'i': ival = va_arg(ap, int); cnt += print_int(stream, ival, 10); break; case 'f': dval = va_arg(ap, double); cnt += print_int(stream, dval, 10); xputc('.', stream); cnt++; if ((ival = fabs((dval - floor(dval)) * 1e4) + 0.5) == 0) { cnt += xfputs("0000", stream); } else { int i; for (i = 0; i < 3 - (int)log10(ival); ++i) { xputc('0', stream); cnt++; } cnt += print_int(stream, ival, 10); } break; case 's': sval = va_arg(ap, char*); cnt += xfputs(sval, stream); break; case 'p': vp = va_arg(ap, void*); cnt += xfputs("0x", stream); cnt += print_int(stream, (long)vp, 16); break; case '%': xputc(*(p-1), stream); cnt++; break; default: xputc('%', stream); xputc(*(p-1), stream); cnt += 2; break; } } return cnt; }
int main(void) { unsigned last_branch = 0; enum mips_exception err; Elf32_Sym *sym; const char *symname; int opcode; /* Prepare the code */ l2_memory = sbrk(MEMSZ); if(!l2_memory) BREAK(1); mips_init(); pcpu = mips_init_cpu(l2_memory, MEMSZ, STKSZ); if(mips_elf_load(pcpu, l2_elf, l2_elf_size) < 0) BREAK(2); /* Execute it */ while(1) { if(pcpu->delay_slot) last_branch = pcpu->delay_slot-4; /* Print all labels as they are encountered. */ if((sym = mips_elf_find_address(pcpu, pcpu->pc)) && (sym->st_value == pcpu->pc) && (symname = mips_elf_get_symname(pcpu, sym))) { printaddr("PC=", pcpu->pc); printaddr(",last_branch=", last_branch); print_char('\n'); } if((err = mips_execute(pcpu)) == MIPS_E_OK) continue; if(err == MIPS_E_BREAK) break; /* Expected exceptions must exactly match PC. */ if((sym = mips_elf_find_address(pcpu, pcpu->pc)) && (sym->st_value == pcpu->pc) && (symname = mips_elf_get_symname(pcpu, sym)) && (beginswith(symname, "EXN") == 0)) { pcpu->pc += 8; } else { break; } } print_string("L1 FINISHED: exception="); print_int(err); print_string(", code="); print_int(mips_break_code(pcpu, &opcode)); print_string(", "); printaddr("last_branch=", last_branch); print_char('\n'); printaddr("PC=", pcpu->pc); print_char('\n'); return 0; }
void print_float(float num) { int part = (int)num/1; print_int(part, 10, 0); UsartPut('.'); part=num*1000000-part*1000000; print_int(part, 10, 0); }
void main(void) { x = 123456; y = x; print_int(x); print_string("\n"); print_int(y); print_string("\n"); }
// invoca varias funciones void test(){ float aux; aux = 2.0; print_int(gcd(factorial(3),factorial(4))); print_int(nthprimeArray(gcd(factorial(3),factorial(4)))); aux = potenciaR(aux,nthprimeArray(gcd(factorial(3),factorial(4)))); print_float(aux); }
void print_date (date_type date) { print_int(date.month,0); print_str("/"); print_int(date.day, 0); print_str("/"); print_int(date.year, 0); }
int main(void) { struct heading result; /*u08 k=0; u08 b=0; u08 choice=0; u08 button=0;*/ u08 ir=0; u08 i=0; x = 64; y = 48; initialize(); motor_init(); servo_init(); set_motor_power(0,0); set_motor_power(1,0); set_motor_power(2,0); set_motor_power(3,0); compass_init(); sonar_init(); calCompass(); while(1) { clear_screen(); result = compass(); /* use calibration data */ result.x -= compZero.x; result.y -= compZero.y; print_string("x "); /* 2 */ print_int(result.x); /* 3 */ print_string(" y "); /* 3 */ print_int(result.y); /* 3 */ /* print_string(" s "); */ /* 3 */ /* print_int(getSonar(0)); */ /* 3 */ /* =17 */ next_line(); /* print_string("a "); */ /* 2 */ /* print_int(IR(0)); */ /* 3 */ /* print_string(" b "); */ /* 3 */ /* print_int(analog(1)); */ /* 3 */ /* print_string(" c "); */ /* 3 */ /* print_int(analog(2)); */ /* 3 */ /* print_int(i++); */ /* =17 */ /* print_int(distance(0)); print_string(" "); */ print_int(sizeof(int)); delay_ms(200); /* print_int(i); i=sweep(); */ } }
int main(){ print_int(5); print_int(10); print_int(15); Foo::x = 5; Foo::setX(6); return 0; }
//Set the cursor position void set_cursor(uint8_t row, uint8_t col) { //<ESC>[{ROW};{COLUMN}H write_byte(ESC); write_byte('['); print_int(row); write_byte(';'); print_int(col); write_byte('H'); }
int main() { print_int(5); print_int(423423); print_int(111111111); // Halt(); return 7; }
int test_const(int* a) { int c1,c2,c3; c1 = 1; c2 = 2; c3 = 3; a[1] = 5; a[a[c3-c1*c2]] = 1; print_int (a[5]); print_string ("\nresult\n"); print_int ( c3 * c2 ); }