void fips_partition_table::print (void) { printx (" | | Start | | End | Start |Number of|\n"); printx ("Part.|bootable|Head Cyl. Sector|System|Head Cyl. Sector| Sector |Sectors | MB\n"); printx ("-----+--------+----------------+------+----------------+--------+---------+----\n"); for (int i=0;i<4;i++) { printx ("%u | %s |%4u %4u %4u| %02Xh|%4u %4u %4u|%8lu| %8lu|%4lu\n",i+1, partition_info[i].bootable ? "yes" : " no", partition_info[i].start_head,partition_info[i].start_cylinder,partition_info[i].start_sector, partition_info[i].system,partition_info[i].end_head,partition_info[i].end_cylinder,partition_info[i].end_sector, partition_info[i].start_sector_abs,partition_info[i].no_of_sectors_abs,partition_info[i].no_of_sectors_abs / 2048); } }
void CDebugToolDlg::OnBnClickedWrite() { printx("OnBnClickedWrite.\n"); BYTE buffer[] = { 1, 3, 5, 7, 9, 11, 13, 15, 17, 19 }; HANDLE hAdapter = OpenAdapter(); DWORD dwWritten = 0; HRESULT hr = WriteFile(hAdapter, buffer, 2700, &dwWritten, 0); printx("dwWritten: %d, hr: %08x, Error code: %d\n", dwWritten, hr, GetLastError()); CloseHandle(hAdapter); }
int printf(char *fmt) { char *cp; u16 *ip; u32 *up; cp = fmt; ip = (int *)&fmt + 1; while (*cp){ if (*cp != '%'){ putc(*cp); if (*cp=='\n') putc('\r'); cp++; continue; } cp++; switch(*cp){ case 'c' : putc (*ip); break; case 's' : prints(*ip); break; case 'u' : printu(*ip); break; case 'd' : printd(*ip); break; case 'x' : printx(*ip); break; case 'l' : printl(*(u32 *)ip++); break; // print long value in decimal case 'X' : printX(*(u32 *)ip++); break; // print long value in hex } cp++; ip++; } }
void printk(char* clt, ...){ int* arg = (int*) &clt; while (*clt){ if (*clt == '%'){ clt++; arg++; if (*clt == 'd') printd(*(int*)arg); else if (*clt == 'c') printc(*(char*)arg); else if (*clt == 's') prints(*(char**)arg); else if (*clt == 'x') printx(*(unsigned int*)arg); clt++; } else if (*clt == '\n'){ printc('\n'); printc('\r'); clt++; } else if (*clt == ' '){ printc(' '); clt++; } else printc(*clt++); } }
void test_matrices() { //this part tests matrices raw_data mat; mat.length = 4; mat.data = (uint8_t*)alloc_named(mat.length, "main mat"); mat.data[0] = 0xc2; mat.data[1] = 0xca; mat.data[2] = 0xf0; mat.data[3] = 0xd6; uint8_t test_data[2] = {2, 3}; raw_data test; test.length = 2; test.data = test_data; printx(mat_vec_multiply(mat, test)); unsigned int i; for(i = 0; i < mat.length; i++) { mat.data[i] = rand(); } print_matrix(mat); printf("%x\n", determinant(mat)); raw_data mat2 = inverse(mat, determinant(mat)); print_matrix(mat2); dealloc(mat.data); dealloc(mat2.data); }
int printf(char *fmt, ...) { char *cp = fmt; //cp points to the fmt string u16 *ip = (u16 *) &fmt + 1; //ip points to the first item u32 *up; while(*cp){ if(*cp != '%'){ putc(*cp); if(*cp=='\n') putc('\r'); cp++; continue; } cp++; switch(*cp){ case 'c' : putc(*ip); break; case 's' : prints(*ip); break; case 'u' : printu(*ip); break; case 'd' : printd(*ip); break; case 'x' : printx(*ip); break; } cp++; ip++; } }
void save_root_and_boot (harddrive *drive,partition *partition) { FILE *save_file; char *filename = "a:\\rootboot.000"; while (access (filename,0) == 0) { if (++filename[14] > '9') error ("Too many save files on disk"); } if ((save_file = fopen (filename,"wb")) == NULL) error ("Can't open file: %s",filename); printx ("\nWriting file %s\n", filename); if (fwrite (drive->root_sector->data,1,512,save_file) != 512) error ("Error writing file: %s",filename); if (fwrite (partition->boot_sector->data,1,512,save_file) != 512) error ("Error writing file: %s",filename); if (fputc (drive->number,save_file) != drive->number) error ("Error writing file: %s",filename); if (fputc (partition->number,save_file) != partition->number) error ("Error writing file: %s",filename); if (fclose (save_file)) error ("Error closing file: %s",filename); }
void printf(char * frmt,...){ int i; char *p, *s, buf[1024]; va_list argp; va_start(argp, frmt); for(p=frmt; *p!='\0';p++) if(*p=='%'){ p++; //skip the first % sign switch(*p){ case 'c': putc(va_arg(argp,char)); break; case 's': prints(va_arg(argp,char *)); break; case 'o': printo(va_arg(argp,u16)); break; case 'u': printu(va_arg(argp,u16)); break; case 'x': printx(va_arg(argp,u16)); break; case 'd': printd(va_arg(argp,int)); break; case 'l': printl(va_arg(argp,u32)); break; case '%': putc('%'); break; } } else{ switch(*p){ case '\n': putc(*p);putc('\r'); break; case '\t': for(i=0;i<TAB_SPACE_COUNT;i++)putc(' '); break; default: putc(*p); break; } } va_end(argp); }
void assertion_failure(char *exp, char *file, char *base_file, int line) { printx("%c asert(%s) failed: file: %s, base_file: %s, ln%d", MAG_CH_ASSERT, exp, file, base_file, line); spin("assertion_failure()"); __asm__ __volatile__("ud2"); }
void printf(char *fmt, ...) { unsigned short bp; char **cp; char *fmtStr; int *ip; char tmp; bp = getbp(); //printf("bp = %x\n", bp); // For testing cp = (char**)(bp+4); //printf("cp = %x, *cp = %c\n", cp, **cp); // For testing fmtStr = *cp; //printf("fmtStr = %s", fmtStr); ip = (uint16_t *)(bp+6); //printf("ip = %x\n", ip); // For testing while(*fmtStr != 0) { if(*fmtStr == '%') { fmtStr++; switch(*fmtStr) { case 'c': tmp = (char)*ip; putc(tmp); break; case 's': prints((char *)(*ip)); break; case 'd': printd((int)*ip); break; case 'x': printx((uint16_t)*ip); break; case 'u': printu((uint16_t)*ip); break; case 'l': ip++; printu((uint32_t)*ip); break; default: prints(" Invalid format specifier "); break; } //fflush(stdout); ip++; } else { putc(*fmtStr); //fflush(stdout); if(*fmtStr == '\n') { putc('\r'); } } fmtStr++; } }
void myprintf(char *fmt, ...) { // char *cp = fmt; int *ip; char *cp; cp=fmt; /*while(cp != '\0') // iterate through fmt string until end of string { cp++; } cp++; // step over null character */ asm("movl %ebp, FP"); // assign ip to the next parameter after fmt string // ip = FP + 3; // moves the ip pointer over the fp, pc, and fmt ip = FP + 2; while(*cp != '\0') { if(*cp == '%') { cp++; ip++; if(*cp == 'c') { putchar(*ip); } else if(*cp == 's') { prints((char *)(*ip)); } else if(*cp == 'u') { printu(*ip); } else if(*cp == 'd') { printd(*ip); } else if (*cp == 'o') { printo(*ip); } else if(*cp == 'x') printx(*ip); } else if(*cp == '\n') putchar('\n'); putchar('\r'); else { putchar(*cp); } cp++; }
void child_make() { x = 2; pid_t pid; if ((pid = fork()) > 0 ) { printx(); } }
static void print_ColorSpace(IN TDE_COLORSPACE cs) { #ifdef _DEBUG printx("ColorSpaceOpt = "); switch(cs) { case TDE_COLORSPACE_DISABLE: printx("TDE_COLORSPACE_DISABLE\n"); break; case TDE_COLORSPACE_ENABLE: printx("TDE_COLORSPACE_ENABLE\n"); break; default: printx("Unknown %d\n", cs); break; } #endif }
void print_OutAlphaFrom(TDE_OUT_ALPHAFROM oaf) { #ifdef _DEBUG printx("OutAlphaFrom = "); switch(oaf) { case TDE_OUT_ALPHAFROM_INTERNAL: printx("TDE_OUT_ALPHAFROM_INTERNAL\n"); break; case TDE_OUT_ALPHAFROM_SRC: printx("TDE_OUT_ALPHAFROM_SRC\n"); break; default: printx("Unknown %d\n", oaf); break; } #endif }
int printk(const char *fmt, ...) { int i; char buf[256]; va_list arg=(va_list)((char* )(&fmt)+4); i=vsprintf(buf,fmt,arg); buf[i]=0; printx(buf); return i; }
PUBLIC int printl(const char* fmt, ...) { char buf[256]; va_list args = (va_list)((char*)(&fmt) + 4); int len = vsprintf(buf, fmt, args); buf[len] = 0; printx(buf); return len; }
int printf(char *fmt, ...) { char *c = fmt; int *param = &fmt + 1; while(*c) { if(*c != '%') { putc(*c); if(*c == '\n') putc('\r'); } else { c++; switch(*c) { case 'd': printd(*param++); //param++; break; case 's': prints(*param++); //param++; break; case 'c': putc(*param++); //param++; break; case 'o': printo(*param++); //param++; break; case 'x': printx(*param++); break; case 'u': printu(*param++); break; default: c--; putc(*c); } } c++; } }
int printf(const char fmt[], ...) { int i; char buf[256]; va_list arg = (va_list)((char*)&fmt + 4); i = vsprintf(buf, arg, fmt); printx(buf, i); return i; }
int main (void) { // int x1 = 1, x2 = 2, x3 = 3, x4 = 4, x5 = 5, x6 = 6; //int xi = 0; //works int i = 0; for (i = 1; i < 100; ++i) // change i to xi , then works printx (i); return 0; }
int printl(const char *format, ...) { int i; char buf[STR_DEFAULT_LEN]; va_list args = (va_list)((char*)(&format) + 4); i = vsprintf(buf, format, args); buf[i] = 0; printx(buf); return i; }
PUBLIC int printf(const char* fmt, ...) { int i; char buf[256]; va_list arg = (va_list)((char*)(&fmt) + 4); /* 4是参数fmt所占堆栈中的大小 */ i = vsprintf(buf, fmt, arg); /* i 是字符串的长度 */ buf[i] = 0; printx(buf); return i; }
static void *usb_sram_alloc(int size, int align) { void *highwater = usb_sram_highwater; highwater += (align - ((unsigned)usb_sram_highwater % align)) % align; if (highwater + size > (void *)(USB_SRAM + USB_SRAM_SIZE)) { printx("can't allocate 0x%x bytes of USB SRAM\n", size); return 0; } usb_sram_highwater = highwater + size; return highwater; }
void panic(const char *fmt, ...) { int i; char buf[256]; char *arg = (char *)(&fmt+1); int len=s32_vsprintf(buf, fmt, arg); printx("%c !!panic!! %s", MAG_CH_PANIC, buf); __asm__ __volatile__("ud2"); }
int memu(const char* user_name,int* extra_button){ int i = 0; int restart = 0; while (1) { printf(" hello~~ %s,",user_name); printf(" Welcome to CPythonCharX press s&w to move '*'\n"); printf(" You'd better press win+space to switch english "); cprint("start the game 开始装逼 ",1-1,1); cprint("/****************************************/",2-1,1); cprint("get point records 查看装逼榜",3-1,1); cprint("exit 退出装逼 ",4-1,1); cprint(" ______________________________________ ",5-1,0); cprint(" →5, ~ 你, 渴望力量吗? ~ ",6-1,0); cprint(" 极制extra以献给渴望力量的人 ",7-1,0); printx(ctrl); getcontrol(); if ((13 == cont && ctrl == 1-1) || '1' == cont ){ gotoxy(4,2); break; } if ((13 == cont && ctrl == 2-1) || '2' == cont ){ // break; } if ((13 == cont && ctrl == 3-1) || '3' == cont ){ gotoxy(4,4); output_point_records(); } if ((13 == cont && ctrl == 4-1) || '4' == cont ){ gotoxy(0,15); return -1; } if ((13 == cont && ctrl == 6-1) || '5' == cont ){ gotoxy(4,7); *extra_button = 1; break; } system("cls"); } i = 0; while (*(shaonv+i) != '\0'){ printf("%c",*(shaonv+i)); _sleep(extra_speed-25); i++; } system("cls"); }
FX_BOOL util::printx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) { int iSize = params.size(); if (iSize<2) return FALSE; CFX_WideString sFormat = params[0].ToCFXWideString(); CFX_WideString sSource = params[1].ToCFXWideString(); std::string cFormat = CFX_ByteString::FromUnicode(sFormat).c_str(); std::string cSource = CFX_ByteString::FromUnicode(sSource).c_str(); std::string cDest; printx(cFormat,cSource,cDest); vRet = cDest.c_str(); return TRUE; }
FX_BOOL util::printx(OBJ_METHOD_PARAMS) { int iSize = params.size(); if (iSize<2) return FALSE; CFX_WideString sFormat = params[0].operator CFX_WideString(); CFX_WideString sSource = params[1].operator CFX_WideString(); std::string cFormat = (FX_LPCSTR)CFX_ByteString::FromUnicode(sFormat); std::string cSource = (FX_LPCSTR)CFX_ByteString::FromUnicode(sSource); std::string cDest; printx(cFormat,cSource,cDest); vRet = cDest.c_str(); return TRUE; }
/** * low level print * * @param fmt The format string * * @return The number of chars printed. *****************************************************************************/ PUBLIC int printl(const char *fmt, ...) { int i; char buf[STR_DEFAULT_LEN]; va_list arg = (va_list)((char*)(&fmt) + 4); /** * 4: size of `fmt' in * the stack */ i = vsprintf(buf, fmt, arg); printx(buf); return i; }
int fwritex( const void *ptr, int count, FILE * stream ) { char *ptr1 = (char*)ptr; int bytes, total_bytes = 0; printx("\nfwritex(), count: %d, remainder: %d\n", count, count % 1024); do { if( count >= 1024 ) { bytes = fwrite( ptr1, 1, 1024, stream ); //printx("fwritex: %d\n", bytes); ptr1 += 1024; count -= 1024; total_bytes += bytes; } else { bytes = fwrite( ptr1, 1, count, stream ); printx("\nfwritex: %d\n", bytes); count = 0; total_bytes += bytes; } } while (count); return total_bytes; }
static void usb_handle_set_config(unsigned config) { usb_debug("set_config(%d)\n", config); if (config != 1) { usb_nak(&usb_ep_data[0]); return; } usb_config_ep(&usb_ep_data[1]); // clr_set_reg(USB_DEVCMDSTAT, 0, USB_DEVCMDSTAT_INTONNAK_AI); usb_send_zlp(&usb_ep_data[0]); usb_state = USB_STATE_ONLINE; if (usb_online_cb) usb_online_cb(1); printx("state = %d\n", usb_state); }
void cockpit_init() { initscr(); /* Start curses mode */ cbreak(); if(has_colors() == FALSE) { endwin(); printf("Your terminal does not support color\n"); exit(1); } start_color(); // Start color init_pair(1, COLOR_BLUE, COLOR_BLACK); init_pair(2, COLOR_RED, COLOR_BLACK); init_pair(3, COLOR_RED, COLOR_WHITE); init_pair(4, COLOR_BLACK, COLOR_RED); //check if the screen is big enough if((LINES < MIN_ROW)| (COLS < MIN_COL)){ endwin(); printf("your screen is too small %d x %d ,please resize it !\n",LINES,COLS); exit(1); } //generate separating line attron(COLOR_PAIR(1)); mvhline(COCKPIT_HEIGHT+1,0,'=',COLS); attroff(COLOR_PAIR(1)); refresh(); roll=newwin(ROLL_HEIGHT,ROLL_WIDTH, ROLL_Y,ROLL_X); show_roll(roll,0); pitch=newwin(PITCH_HEIGHT,PITCH_WIDTH, PITCH_Y,PITCH_X); show_pitch(pitch,0); yaw=newwin(YAW_HEIGHT,YAW_WIDTH, YAW_Y,YAW_X); show_yaw(yaw,0); heading=newwin(HEAD_HEIGHT,HEAD_WIDTH,HEAD_Y,HEAD_X); show_heading(heading,0); other=newwin(OTHER_HEIGHT,OTHER_WIDTH,OTHER_Y,OTHER_X); console=create_newwin(CONSOLE_HEIGHT,COLS, COCKPIT_HEIGHT+2,0); keypad(console,TRUE); scrollok(console,TRUE); printx(console,"please enter the COM name,enter 'y' to use default /dev/ttyUSB0:"); wrefresh(console); }