void revert_command (Widget w, XtPointer client_data, XtPointer call_data) { char_type *c; font_type *f = (font_type *) client_data; charcode_type code = FONT_CURRENT_CHARCODE (*f); char_type *original = FONT_CHAR (*f, code); /* Set the pointer in the font structure to null, so `read_char' will have to reread the character. */ FONT_CHAR (*f, code) = NULL; /* Reread the character. */ c = read_char (*f, code); if (c == NULL) FATAL2 ("xbfe: Character %d has somehow been deleted from `%s'", FONT_CURRENT_CHARCODE (*f), FONT_NAME (*f)); show_char (XtParent (w), f, c); /* Release the storage the current character is using. We must do this after rereading the character from the font, so that the same memory is not used. If that happens, `bitmap_set_values' thinks nothing has changed. */ free_bitmap (&BCHAR_BITMAP (*original)); free (original); }
void expand_command (Widget w, XtPointer client_data, XtPointer call_data) { font_type *f = (font_type *) client_data; /* We must use `*bitmap' here, since the editable Bitmap is a child of the Viewport. Incidentally, R3's XtNameToWidget won't work here. */ Widget bw = XtNameToWidget (XtParent (w), "*bitmap"); bitmap_type *b = BitmapBits (bw); char_type *c = XTALLOC (1, char_type); /* Copy the current character, so the `*_set_values' commands can notice something is changed. */ *c = *FONT_CURRENT_CHAR (*f); /* Do the enlargement. */ BCHAR_BITMAP (*c) = enlarge_bitmap (*b); /* We have to increase the bounding box for the character. The best way to do this is not obvious. Right now, we arrange things so that the origin of the character does not move, i.e., the new row at the bottom is below the baseline, and the new column at the left is into the side bearing. Perhaps we should have four separate expand commands (or something along those lines). */ BCHAR_SET_WIDTH (*c) += 2; BCHAR_MIN_COL (*c)--; BCHAR_MAX_COL (*c)++; BCHAR_MIN_ROW (*c)--; BCHAR_MAX_ROW (*c)++; /* Display the new values. */ show_char (XtParent (w), f, c); /* Free afterwards; see revert_command. */ free_bitmap (b); }
/*********************************************************** * 函数名称: * 功能描述: OLED显示一个字符串 * 参数列表:len :数字的位数,size:字体大小,mode:模式 0,填充模式;1,叠加模式 * num:数值(0~4294967295); * 返回结果: * 备 注:在指定位置显示一个字符串 ***********************************************************/ void OLED_SSD1306::show_num(uint8_t x, uint8_t y, uint32_t num, uint8_t len, uint8_t size) { u8 t, temp; u8 enshow = 0; for(t = 0; t < len; t++) { temp = (num / oled_pow(10, len - t - 1)) % 10; if(enshow == 0 && t < (len - 1)) { if(temp == 0) { show_char(x + (size / 2)*t, y, ' '); continue; } else enshow = 1; } show_char(x + (size / 2)*t, y, temp + '0'); } }
void show_governor(char *ptr) { int i,a,c; for(i=0;i<8;i++) { a=(int)ptr[i]; c=show_char(a); copyXPMArea(6+(6*c),78,6,9, 7+(6*i), 49); } RedrawWindow(); return; }
void show_driver( char *pt) { int i,a,c; for(i=0;i<8;i++) { a=(int)pt[i]; c=show_char(a); copyXPMArea(6+(6*c),64,6,9, 7+(6*i), 34); } RedrawWindow(); return; }
/*********************************************************** * 函数名称: * 功能描述: OLED显示一个字符串 * 参数列表: * 返回结果: * 备 注:在指定位置显示一个字符串 ***********************************************************/ void OLED_SSD1306::show_string(uint8_t x, uint8_t y, uint8_t *chr) { unsigned char j = 0; while (chr[j] != '\0') { show_char(x, y, chr[j]); x += 8; if(x > 120) { x = 0; y += 2; } j++; } }
int main (void) { uint8_t size = 0; code_t codeseq[CODESEQ_LEN_MAX]; uint8_t count = 0; system_init (); tinygl_init (LOOP_RATE); tinygl_font_set (&font3x5_1); tinygl_text_mode_set (TINYGL_TEXT_MODE_SCROLL); tinygl_text_dir_set (TINYGL_TEXT_DIR_ROTATE); tinygl_text_speed_set (MESSAGE_RATE); navswitch_init (); ir_init (); pacer_init (LOOP_RATE); show_num ('W', count); /* Paced loop. */ while (1) { /* Wait for next tick. */ pacer_wait (); tinygl_update (); navswitch_update (); if (navswitch_push_event_p (NAVSWITCH_PUSH)) { transmit (codeseq, size); show_char ('T'); } if (ir_rx_get ()) { size = capture (codeseq, CODESEQ_LEN_MAX); show_num (size == 0 ? 'E' : 'R', size); count++; // size = capture (codeseq, 9); // show_char ('0' + size); } } return 0; }
int main() { if(is_big_endian()) printf("\nbig endian"); else printf("\nlittle endian"); show_char('C'); show_int(-535703600); show_double(1.7E+308); printf("\n"); return EXIT_SUCCESS; }
void prev_command (Widget w, XtPointer client_data, XtPointer call_data) { int this_char; char_type *c = NULL; font_type *f = (font_type *) client_data; for (this_char = FONT_CURRENT_CHARCODE (*f) - 1; this_char >= 0 && c == NULL; this_char--) c = read_char (*f, this_char); if (c == NULL) x_warning (XtParent (w), "You're at the first character"); else show_char (XtParent (w), f, c); }
void next_command (Widget w, XtPointer client_data, XtPointer call_data) { unsigned this_char; char_type *c = NULL; font_type *f = (font_type *) client_data; for (this_char = FONT_CURRENT_CHARCODE (*f) + 1; this_char <= MAX_CHARCODE && c == NULL; this_char++) c = read_char (*f, this_char); if (c == NULL) x_warning (XtParent (w), "You're at the last character"); else show_char (XtParent (w), f, c); }
void char_change_callback (Widget w, XtPointer client_data, XtPointer call_data) { charcode_type charcode; string value_string = call_data; if (XTPARSE_CHARCODE (charcode, value_string, w)) { font_type *f = (font_type *) client_data; char_type *c = read_char (*f, charcode); if (c == NULL) x_warning (XtParent (w), "No such character"); else show_char (XtParent (w), f, c); } }
void send_receive(int optical_eye_fd, char const *message) { write(optical_eye_fd, message, strlen(message)); flush_optical_eye(optical_eye_fd); int twice = 0; while (1) { char c; int received = read(optical_eye_fd, &c, sizeof(c)); if (received == 1) show_char(c); else exit(1); // if (c == '\n') { // if (twice) break; else twice = 1; // } int stdin_read_status = read(stdin, &c, sizeof(c)); if (stdin_read_status >= 0) { printf("{Leaving}"); break; } else { printf("{%d,%c}", stdin_read_status, c); } } }
int main(void) { char* name = "1485"; #if 0 //printf("%s\n", name); //printf("%d\n", *(name + 0)); //printf("%c\n", *(name + 0)); printf("%s\n", name); printf("%d\n", *name+1); printf("%d\n", (*name) + 1); printf("%d\n", *(name + 1)); printf("%d\n", *(name + 2)); printf("%c\n", *(name + 2)); #endif printf("%c\n", 48); printf("%d\n", '0'); printf("%s\n", name); show_char(name); return (0); }
void show (char *command_line) { unsigned int i,l,len,temp_int; unsigned long offset=0,temp_long; unsigned char temp_char,*ch_ptr; void *ptr; if (device_handle==NULL) return; show_pad_info.line=0; if (current_type==NULL) { wmove (show_pad,0,0); ch_ptr=type_data.u.buffer; for (l=0;l<file_system_info.block_size/16;l++) { wprintw (show_pad,"%08ld : ",offset); for (i=0;i<16;i++) { if (type_data.offset_in_block==offset+i) wattrset (show_pad,A_REVERSE); if (ch_ptr [i]>=' ' && ch_ptr [i]<='z') wprintw (show_pad,"%c",ch_ptr [i]); else wprintw (show_pad,"."); if (type_data.offset_in_block==offset+i) wattrset (show_pad,A_NORMAL); } wprintw (show_pad," "); for (i=0;i<16;i++) { if (type_data.offset_in_block==offset+i) wattrset (show_pad,A_REVERSE); wprintw (show_pad,"%02x",ch_ptr [i]); if (type_data.offset_in_block==offset+i) { wattrset (show_pad,A_NORMAL); show_pad_info.line=l-l % show_pad_info.display_lines; } wprintw (show_pad," "); } wprintw (show_pad,"\n"); offset+=16; ch_ptr+=16; } show_pad_info.max_line=l-1;show_pad_info.max_col=COLS-1; refresh_show_pad ();show_info (); } else { wmove (show_pad,0,0);l=0; for (i=0;i<current_type->fields_num;i++) { wprintw (show_pad,"%-20s = ",current_type->field_names [i]); ptr=type_data.u.buffer+offset; len = current_type->field_lengths[i]; switch (current_type->field_types[i]) { case FIELD_TYPE_INT: show_int(len, ptr); break; case FIELD_TYPE_UINT: show_uint(len, ptr); break; case FIELD_TYPE_CHAR: show_char(len, ptr); break; default: wprintw (show_pad, "unimplemented\n"); break; } offset+=len; l++; } current_type->length=offset; show_pad_info.max_line=l-1; refresh_show_pad ();show_info (); } }
static void do_stuff(MYDATA * data) { char *s; SCREEN *sp = data->sp; int my_code = 1234; const char *my_text = "\033[?m"; set_curterm_sp(sp, data->term); /* putp always goes to standard output */ putp_sp(sp, "Hello "); putp_sp(sp, data->name); putp_sp(sp, "!\n"); fprintf(data->fp, "Term: %s\n", termname_sp(sp)); fprintf(data->fp, "Long: %s\n", longname_sp(sp)); show_cap_flag(data, "am", "am"); show_cap_number(data, "lines", "li"); show_cap_string(data, "clear", "cl"); show_cap_string(data, "tbc", "ct"); show_flag(data, "has_ic", has_ic_sp(sp)); show_flag(data, "has_il", has_il_sp(sp)); show_number(data, "baudrate", baudrate_sp(sp)); show_char(data, "erase ch", erasechar_sp(sp)); show_char(data, "kill ch", killchar_sp(sp)); show_string(data, "unctrl", unctrl_sp(sp, 033)); fflush(data->fp); define_key_sp(sp, my_text, my_code); has_key_sp(sp, 0); key_defined_sp(sp, my_text); if ((s = keybound_sp(sp, my_code, 0)) != 0) free(s); keyname_sp(sp, '?'); keyok_sp(sp, my_code, FALSE); keyok_sp(sp, my_code, TRUE); savetty_sp(sp); def_shell_mode_sp(sp); /* * These functions are low-level settings for ncurses. */ set_tabsize_sp(sp, 5); /* waddch */ typeahead_sp(sp, FALSE); /* waddch */ use_env_sp(sp, FALSE); /* newterm */ use_tioctl_sp(sp, FALSE); /* newterm */ intrflush_sp(sp, 0, 0); /* wgetch */ flushinp_sp(sp); /* waddch */ halfdelay_sp(sp, 5); /* wgetch */ /* * These manipulate the terminal modes, mainly for wgetch. */ cbreak_sp(sp); raw_sp(sp); def_prog_mode_sp(sp); delay_output_sp(sp, 200); napms_sp(sp, 10); nocbreak_sp(sp); noqiflush_sp(sp); noraw_sp(sp); qiflush_sp(sp); resetty_sp(sp); tputs_sp(sp, "{reset-mode}\n", 0, data->outc); reset_prog_mode_sp(sp); curs_set_sp(sp, 0); tputs_sp(sp, "{prog-mode}\n", 0, data->outc); reset_shell_mode_sp(sp); tputs_sp(sp, "{shell-mode}\n", 0, data->outc); }
void show_string(unsigned int x,unsigned int y,unsigned char *s,graphics_pixel_t pixel){ unsigned int len = strlen(s); for(int i=0;i<len;i++){ show_char(x+i*text_width,y,s[i],pixel,0); } }