📄 charset.c
字号:
generic_done_message(t, state, ch); return; } test_one_attr(3, enter_reverse_mode, exit_attribute_mode); test_one_attr(4, enter_blink_mode, exit_attribute_mode); test_one_attr(5, enter_dim_mode, exit_attribute_mode); test_one_attr(6, enter_bold_mode, exit_attribute_mode); test_one_attr(7, enter_secure_mode, exit_attribute_mode); test_one_attr(8, enter_protected_mode, exit_attribute_mode); generic_done_message(t, state, ch);}#define GLYPHS 256/*** charset_smacs(test_list, status, ch)**** display all possible acs characters** (smacs) (rmacs)*/static voidcharset_smacs( struct test_list *t, int *state, int *ch){ int i, c; if (enter_alt_charset_mode) { put_clear(); ptextln("The following characters are available. (smacs) (rmacs)"); for (i = ' '; i <= '`'; i += 32) { put_crlf(); put_mode(exit_alt_charset_mode); for (c = 0; c < 32; c++) { putchp(c + i); } put_crlf(); put_mode(enter_alt_charset_mode); for (c = 0; c < 32; c++) { putchp(c + i); } put_mode(exit_alt_charset_mode); put_crlf(); } put_mode(exit_alt_charset_mode); put_crlf(); generic_done_message(t, state, ch); }}static voidtest_acs( int attr){ /* alternate character set */ int i, j; char valid_glyph[GLYPHS]; char acs_table[GLYPHS]; static unsigned char vt100[] = "`afgjklmnopqrstuvwxyz{|}~"; line_count = 0; for (i = 0; i < GLYPHS; i++) { valid_glyph[i] = FALSE; acs_table[i] = i; } if (acs_chars) { sprintf(temp, "Alternate character set map: %s", expand(acs_chars)); putln(temp); for (i = 0; acs_chars[i]; i += 2) { if (acs_chars[i + 1] == 0) { break; } for (j = 0;; j++) { if (glyph[j].c == (unsigned char) acs_chars[i]) { acs_table[glyph[j].c] = acs_chars[i + 1]; valid_glyph[glyph[j].c] = TRUE; break; } if (glyph[j].name[0] == '\0') { if (isgraph(UChar(acs_chars[i]))) { sprintf(temp, " %c", acs_chars[i]); } else { sprintf(temp, " 0x%02x", UChar(acs_chars[i])); } strcpy(&temp[5], " *** has no mapping ***"); putln(temp); break; } } } } else { ptextln("acs_chars not defined (acsc)"); /* enable the VT-100 graphics characters (default) */ for (i = 0; vt100[i]; i++) { valid_glyph[vt100[i]] = TRUE; } } if (attr) { set_attr(attr); } _nc_init_acs(); /* puts 'ena_acs' and incidentally links acs_map[] */ for (i = 0; glyph[i].name[0]; i++) { if (valid_glyph[glyph[i].c]) { put_mode(enter_alt_charset_mode); put_this(acs_table[glyph[i].c]); char_count++; put_mode(exit_alt_charset_mode); if (magic_cookie_glitch >= 1) { sprintf(temp, " %-30.30s", glyph[i].name); put_str(temp); if (char_count + 33 >= columns) put_crlf(); } else { sprintf(temp, " %-24.24s", glyph[i].name); put_str(temp); if (char_count + 26 >= columns) put_crlf(); } if (line_count >= lines) { (void) wait_here(); put_clear(); } } } if (char_count > 1) { put_crlf(); }#ifdef ACS_ULCORNER maybe_wait(5); put_mode(enter_alt_charset_mode); put_this(ACS_ULCORNER); put_this(ACS_TTEE); put_this(ACS_URCORNER); put_this(ACS_ULCORNER); put_this(ACS_HLINE); put_this(ACS_URCORNER); char_count += 6; put_mode(exit_alt_charset_mode); put_crlf(); put_mode(enter_alt_charset_mode); put_this(ACS_LTEE); put_this(ACS_PLUS); put_this(ACS_RTEE); put_this(ACS_VLINE); if (magic_cookie_glitch >= 1) put_this(' '); else { put_mode(exit_alt_charset_mode); put_this(' '); put_mode(enter_alt_charset_mode); } put_this(ACS_VLINE); char_count += 6; put_mode(exit_alt_charset_mode); put_str(" Here are 2 boxes"); put_crlf(); put_mode(enter_alt_charset_mode); put_this(ACS_LLCORNER); put_this(ACS_BTEE); put_this(ACS_LRCORNER); put_this(ACS_LLCORNER); put_this(ACS_HLINE); put_this(ACS_LRCORNER); char_count += 6; put_mode(exit_alt_charset_mode); put_crlf();#endif}/*** charset_bel(test_list, status, ch)**** (bel) test Bell*/static voidcharset_bel( struct test_list *t, int *state, int *ch){ if (bell) { ptextln("Testing bell (bel)"); tc_putp(bell); ptext("If you did not hear the Bell then (bel) has failed. "); } else { ptext("(bel) Bell is not defined. "); } generic_done_message(t, state, ch);}/*** charset_flash(test_list, status, ch)**** (flash) test Visual bell*/static voidcharset_flash( struct test_list *t, int *state, int *ch){ if (flash_screen) { ptextln("Testing visual bell (flash)"); tc_putp(flash_screen); ptext("If you did not see the screen flash then (flash) has failed. "); } else { ptext("(flash) Flash is not defined. "); } generic_done_message(t, state, ch);}/*** charset_civis(test_list, status, ch)**** (civis) test Cursor invisible*/static voidcharset_civis( struct test_list *t, int *state, int *ch){ if (cursor_normal) { if (cursor_invisible) { ptext("(civis) Turn off the cursor. "); tc_putp(cursor_invisible); ptext("If you can still see the cursor then (civis) has failed. "); } else { ptext("(civis) Cursor-invisible is not defined. "); } generic_done_message(t, state, ch); tc_putp(cursor_normal); }}/*** charset_cvvis(test_list, status, ch)**** (cvvis) test Cursor very visible*/static voidcharset_cvvis( struct test_list *t, int *state, int *ch){ if (cursor_normal) { if (cursor_visible) { ptext("(cvvis) Make cursor very visible. "); tc_putp(cursor_visible); ptext("If the cursor is not very visible then (cvvis) has failed. "); } else { ptext("(cvvis) Cursor-very-visible is not defined. "); } generic_done_message(t, state, ch); tc_putp(cursor_normal); }}/*** charset_cnorm(test_list, status, ch)**** (cnorm) test Cursor normal*/static voidcharset_cnorm( struct test_list *t, int *state, int *ch){ if (cursor_normal) { ptext("(cnorm) Normal cursor. "); tc_putp(cursor_normal); ptext("If the cursor is not normal then (cnorm) has failed. "); } else { ptext("(cnorm) Cursor-normal is not defined. "); } generic_done_message(t, state, ch);}/*** charset_enacs(test_list, status, ch)**** test Alternate character set mode and alternate characters** (acsc) (enacs) (smacs) (rmacs)*/static voidcharset_enacs( struct test_list *t, int *state, int *ch){ int c, i; if (enter_alt_charset_mode || acs_chars) { c = 0; while (1) { put_clear(); /* for terminals that use separate fonts for attributes (such as X windows) the line drawing characters must be checked for each font. */ if (c >= '0' && c <= '9') { test_acs(alt_modes[c - '0'].number); set_attr(0); } else { test_acs(0); } while (1) { ptextln("[r] to repeat, [012345789] to test with attributes on, [?] for a list of attributes, anything else to go to next test. "); generic_done_message(t, state, ch); if (*ch != '?') { break; } for (i = 0; i <= 9; i++) { sprintf(temp, " %d %s %s", i, alt_modes[i].begin_mode, alt_modes[i].name); ptextln(temp); } } if (*ch >= '0' && *ch <= '9') { c = *ch; } else if (*ch != 'r') { break; } } } else { ptext("(smacs) Enter-alt-char-set-mode and (acsc) Alternate-char-set are not defined. "); generic_done_message(t, state, ch); }}/*** charset_can_test()**** Initialize the can_test data base*/voidcharset_can_test(void){ int i; for (i = 0; i < 9; i++) { can_test(alt_modes[i].begin_mode, FLAG_CAN_TEST); can_test(alt_modes[i].end_mode, FLAG_CAN_TEST); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -