📄 vt320.java
字号:
0x255a, // #BOX DRAWINGS DOUBLE UP AND RIGHT 0x2554, // #BOX DRAWINGS DOUBLE DOWN AND RIGHT 0x2569, // #BOX DRAWINGS DOUBLE UP AND HORIZONTAL 0x2566, // #BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL 0x2560, // #BOX DRAWINGS DOUBLE VERTICAL AND RIGHT 0x2550, // #BOX DRAWINGS DOUBLE HORIZONTAL 0x256c, // #BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL 0x2567, // #BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE 0x2568, // #BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE 0x2564, // #BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE 0x2565, // #BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE 0x2559, // #BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE 0x2558, // #BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE 0x2552, // #BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE 0x2553, // #BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE 0x256b, // #BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE 0x256a, // #BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE 0x2518, // #BOX DRAWINGS LIGHT UP AND LEFT 0x250c, // #BOX DRAWINGS LIGHT DOWN AND RIGHT 0x2588, // #FULL BLOCK 0x2584, // #LOWER HALF BLOCK 0x258c, // #LEFT HALF BLOCK 0x2590, // #RIGHT HALF BLOCK 0x2580, // #UPPER HALF BLOCK 0x03b1, // #GREEK SMALL LETTER ALPHA 0x00df, // #LATIN SMALL LETTER SHARP S 0x0393, // #GREEK CAPITAL LETTER GAMMA 0x03c0, // #GREEK SMALL LETTER PI 0x03a3, // #GREEK CAPITAL LETTER SIGMA 0x03c3, // #GREEK SMALL LETTER SIGMA 0x00b5, // #MICRO SIGN 0x03c4, // #GREEK SMALL LETTER TAU 0x03a6, // #GREEK CAPITAL LETTER PHI 0x0398, // #GREEK CAPITAL LETTER THETA 0x03a9, // #GREEK CAPITAL LETTER OMEGA 0x03b4, // #GREEK SMALL LETTER DELTA 0x221e, // #INFINITY 0x03c6, // #GREEK SMALL LETTER PHI 0x03b5, // #GREEK SMALL LETTER EPSILON 0x2229, // #INTERSECTION 0x2261, // #IDENTICAL TO 0x00b1, // #PLUS-MINUS SIGN 0x2265, // #GREATER-THAN OR EQUAL TO 0x2264, // #LESS-THAN OR EQUAL TO 0x2320, // #TOP HALF INTEGRAL 0x2321, // #BOTTOM HALF INTEGRAL 0x00f7, // #DIVISION SIGN 0x2248, // #ALMOST EQUAL TO 0x00b0, // #DEGREE SIGN 0x2219, // #BULLET OPERATOR 0x00b7, // #MIDDLE DOT 0x221a, // #SQUARE ROOT 0x207f, // #SUPERSCRIPT LATIN SMALL LETTER N 0x00b2, // #SUPERSCRIPT TWO 0x25a0, // #BLACK SQUARE 0x00a0, // #NO-BREAK SPACE }; public char map_cp850_unicode(char x) { if (x >= 0x100) return x; return unimap[x]; } private void _SetCursor(int row, int col) { int maxr = getRows(); int tm = getTopMargin(); R = (row < 0)?0:row; C = (col < 0)?0:col; if (!moveoutsidemargins) { R += tm; maxr = getBottomMargin(); } if (R > maxr) R = maxr; } private void putChar(char c, boolean doshowcursor) { int rows = getRows(); //statusline int columns = getColumns(); int tm = getTopMargin(); int bm = getBottomMargin(); // byte msg[]; boolean mapped = false; if (debug > 4) System.out.println("putChar(" + c + " [" + ((int) c) + "]) at R=" + R + " , C=" + C + ", columns=" + columns + ", rows=" + rows); markLine(R, 1); if (c > 255) { if (debug > 0) System.out.println("char > 255:" + (int) c); //return; } switch (term_state) { case TSTATE_DATA: /* FIXME: we shouldn't use chars with bit 8 set if ibmcharset. * probably... but some BBS do anyway... */ if (!useibmcharset) { boolean doneflag = true; switch (c) { case OSC: osc = ""; term_state = TSTATE_OSC; break; case RI: if (R > tm) R--; else insertLine(R, 1, SCROLL_DOWN); if (debug > 1) System.out.println("RI"); break; case IND: if (debug > 2) System.out.println("IND at " + R + ", tm is " + tm + ", bm is " + bm); if (R == bm || R == rows - 1) insertLine(R, 1, SCROLL_UP); else R++; if (debug > 1) System.out.println("IND (at " + R + " )"); break; case NEL: if (R == bm || R == rows - 1) insertLine(R, 1, SCROLL_UP); else R++; C = 0; if (debug > 1) System.out.println("NEL (at " + R + " )"); break; case HTS: Tabs[C] = 1; if (debug > 1) System.out.println("HTS"); break; case DCS: dcs = ""; term_state = TSTATE_DCS; break; default: doneflag = false; break; } if (doneflag) break; } switch (c) { case SS3: onegl = 3; break; case SS2: onegl = 2; break; case CSI: // should be in the 8bit section, but some BBS use this DCEvar = 0; DCEvars[0] = 0; DCEvars[1] = 0; DCEvars[2] = 0; DCEvars[3] = 0; term_state = TSTATE_CSI; break; case ESC: term_state = TSTATE_ESC; lastwaslf = 0; break; case 5: /* ENQ */ write(answerBack, false); break; case 12: /* FormFeed, Home for the BBS world */ deleteArea(0, 0, columns, rows, attributes); C = R = 0; break; case '\b': /* 8 */ C--; if (C < 0) C = 0; lastwaslf = 0; break; case '\t': do { // Don't overwrite or insert! TABS are not destructive, but movement! C++; } while (C < columns && (Tabs[C] == 0)); lastwaslf = 0; break; case '\r': C = 0; break; case '\n': if (debug > 3) System.out.println("R= " + R + ", bm " + bm + ", tm=" + tm + ", rows=" + rows); if (!vms) { if (lastwaslf != 0 && lastwaslf != c) // Ray: I do not understand this logic. break; lastwaslf = c; /*C = 0;*/ } if (R == bm || R >= rows - 1) insertLine(R, 1, SCROLL_UP); else R++; break; case 7: beep(); break; case '\016': /* SMACS , as */ /* ^N, Shift out - Put G1 into GL */ gl = 1; usedcharsets = true; break; case '\017': /* RMACS , ae */ /* ^O, Shift in - Put G0 into GL */ gl = 0; usedcharsets = true; break; default: { int thisgl = gl; if (onegl >= 0) { thisgl = onegl; onegl = -1; } lastwaslf = 0; if (c < 32) { if (c != 0) if (debug > 0) System.out.println("TSTATE_DATA char: " + ((int) c)); /*break; some BBS really want those characters, like hearst etc. */ if (c == 0) /* print 0 ... you bet */ break; } if (C >= columns) { if (wraparound) { if (R < rows - 1) R++; else insertLine(R, 1, SCROLL_UP); C = 0; } else { // cursor stays on last character. C = columns - 1; } } // Mapping if DEC Special is chosen charset if (usedcharsets) { if (c >= '\u0020' && c <= '\u007f') { switch (gx[thisgl]) { case '0': // Remap SCOANSI line drawing to VT100 line drawing chars // for our SCO using customers. if (terminalID.equals("scoansi") || terminalID.equals("ansi")) { for (int i = 0; i < scoansi_acs.length(); i += 2) { if (c == scoansi_acs.charAt(i)) { c = scoansi_acs.charAt(i + 1); break; } } } if (c >= '\u005f' && c <= '\u007e') { c = DECSPECIAL[(short) c - 0x5f]; mapped = true; } break; case '<': // 'user preferred' is currently 'ISO Latin-1 suppl c = (char) (((int) c & 0x7f) | 0x80); mapped = true; break; case 'A': case 'B': // Latin-1 , ASCII -> fall through mapped = true; break; default: System.out.println("Unsupported GL mapping: " + gx[thisgl]); break; } } if (!mapped && (c >= '\u0080' && c <= '\u00ff')) { switch (gx[gr]) { case '0': if (c >= '\u00df' && c <= '\u00fe') { c = DECSPECIAL[c - '\u00df']; mapped = true; } break; case '<': case 'A': case 'B': mapped = true; break; default: System.out.println("Unsupported GR mapping: " + gx[gr]); break; } } } if (!mapped && useibmcharset) c = map_cp850_unicode(c); /*if(true || (statusmode == 0)) { */ if (insertmode == 1) { insertChar(C, R, c, attributes); } else { putChar(C, R, c, attributes); } /* } else { if (insertmode==1) { insertChar(C, rows, c, attributes); } else { putChar(C, rows, c, attributes); } } */ C++; break; } } /* switch(c) */ break; case TSTATE_OSC: if ((c < 0x20) && (c != ESC)) {// NP - No printing character handle_osc(osc); term_state = TSTATE_DATA; break; } //but check for vt102 ESC \ if (c == '\\' && osc.charAt(osc.length() - 1) == ESC) { handle_osc(osc); term_state = TSTATE_DATA; break; } osc = osc + c; break; case TSTATE_ESCSPACE: term_state = TSTATE_DATA; switch (c) { case 'F': /* S7C1T, Disable output of 8-bit controls, use 7-bit */ output8bit = false; break; case 'G': /* S8C1T, Enable output of 8-bit control codes*/ output8bit = true; break; default: System.out.println("ESC <space> " + c + " unhandled."); } break; case TSTATE_ESC: term_state = TSTATE_DATA; switch (c) { case ' ': term_state = TSTATE_ESCSPACE; break; case '#': term_state = TSTATE_ESCSQUARE; break; case 'c': /* Hard terminal reset */ /* reset character sets */ gx[0] = 'B'; gx[1] = '0'; gx[2] = 'B'; gx[3] = 'B'; gl = 0; // default GL to G0 gr = 1; // default GR to G1 /* reset tabs */ int nw = getColumns(); if (nw < 132) nw = 132; Tabs = new byte[nw]; for (int i = 0; i < nw; i += 8) { Tabs[i] = 1; } /*FIXME:*/ break; case '[': DCEvar = 0; DCEvars[0] = 0; DCEvars[1] = 0; DCEvars[2] = 0; DCEvars[3] = 0; term_state = TSTATE_CSI; break; case ']': osc = ""; term_state = TSTATE_OSC; break; case 'P': dcs = ""; term_state = TSTATE_DCS; break; case 'A': /* CUU */ R--; if (R < 0) R = 0; break; case 'B': /* CUD */ R++; if (R > rows - 1) R = rows - 1; break; case 'C': C++; if (C >= columns) C = columns - 1; break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -