📄 charproc.c
字号:
reply.a_final = 'c'; unparseseq(&reply, screen->respond); } parsestate = groundtable; break; case CASE_TBC:#ifdef DEBUGGING fprintf(stderr, "case TBC\n");#endif /* TBC */ if ((row = param[0]) <= 0) /* less than means default */ TabClear(term->tabs, screen->cur_col); else if (row == 3) TabZonk(term->tabs); parsestate = groundtable; break; case CASE_SET:#ifdef DEBUGGING fprintf(stderr, "case set\n");#endif /* SET */ ansi_modes(term, bitset); parsestate = groundtable; break; case CASE_RST:#ifdef DEBUGGING fprintf(stderr, "case RST\n");#endif /* RST */ ansi_modes(term, bitclr); parsestate = groundtable; break; case CASE_SGR:#ifdef DEBUGGING fprintf(stderr, "case SGR\n");#endif /* SGR */ for (row=0; row<nparam; ++row) { switch (param[row]) { case DEFAULT: case 0: term->flags &= ~(INVERSE|BOLD|BLINK|UNDERLINE|FG_COLOR|BG_COLOR); break; case 1: /* Bold */ term->flags |= BOLD; break; case 5: /* Blink */ term->flags |= BLINK; break; case 4: /* Underscore */ term->flags |= UNDERLINE; break; case 7: term->flags |= INVERSE; break; /* JLM */ case 21: /* Bold */ term->flags &= ~BOLD; break; case 25: term->flags &= ~BLINK; break; case 24: /* Underscore */ term->flags &= ~UNDERLINE; break; case 27: /* Inverse Video */ term->flags &= ~INVERSE; break; case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: term->flags |= FG_COLOR; term->cur_foreground = param[row] - 30; break; case 38: case 39: /* Turn off foreground color */ term->flags &= ~FG_COLOR; break; case 40: case 41: case 42: case 43: case 44: case 45: case 46: case 47: term->flags |= BG_COLOR; term->cur_background = param[row] - 40; break; case 48: case 49: /* Turn off background color */ term->flags &= ~BG_COLOR; break; } } parsestate = groundtable; break; case CASE_CPR:#ifdef DEBUGGING fprintf(stderr, "case CPR\n");#endif /* CPR */ if ((row = param[0]) == 5) { reply.a_type = CSI; reply.a_pintro = 0; reply.a_nparam = 1; reply.a_param[0] = 0; reply.a_inters = 0; reply.a_final = 'n'; unparseseq(&reply, screen->respond); } else if (row == 6) { reply.a_type = CSI; reply.a_pintro = 0; reply.a_nparam = 2; reply.a_param[0] = screen->cur_row+1; reply.a_param[1] = screen->cur_col+1; reply.a_inters = 0; reply.a_final = 'R'; unparseseq(&reply, screen->respond); } parsestate = groundtable; break; case CASE_DECSTBM:#ifdef DEBUGGING fprintf(stderr, "case set scrolling region\n");#endif /* DECSTBM - set scrolling region */ if((top = param[0]) < 1) top = 1; if(nparam < 2 || (bot = param[1]) == DEFAULT || bot > screen->max_row + 1 || bot == 0) bot = screen->max_row+1; if (bot > top) { if(screen->scroll_amt) FlushScroll(screen); screen->top_marg = top-1; screen->bot_marg = bot-1; CursorSet(screen, 0, 0, term->flags); } parsestate = groundtable; break; case CASE_DECREQTPARM:#ifdef DEBUGGING fprintf(stderr, "case DECREQTPARM\n");#endif /* DECREQTPARM */ if ((row = param[0]) == DEFAULT) row = 0; if (row == 0 || row == 1) { reply.a_type = CSI; reply.a_pintro = 0; reply.a_nparam = 7; reply.a_param[0] = row + 2; reply.a_param[1] = 1; /* no parity */ reply.a_param[2] = 1; /* eight bits */ reply.a_param[3] = 112; /* transmit 9600 baud */ reply.a_param[4] = 112; /* receive 9600 baud */ reply.a_param[5] = 1; /* clock multiplier ? */ reply.a_param[6] = 0; /* STP flags ? */ reply.a_inters = 0; reply.a_final = 'x'; unparseseq(&reply, screen->respond); } parsestate = groundtable; break; case CASE_DECSET:#ifdef DEBUGGING fprintf(stderr, "case DECSET\n");#endif /* DECSET */ dpmodes(term, bitset); parsestate = groundtable; if(screen->TekEmu) return; break; case CASE_DECRST:#ifdef DEBUGGING fprintf(stderr, "case DECRST\n");#endif /* DECRST */ dpmodes(term, bitclr); parsestate = groundtable; break; case CASE_DECALN:#ifdef DEBUGGING fprintf(stderr, "case DECALN\n");#endif /* DECALN */ if(screen->cursor_state) HideCursor(); for(row = screen->max_row ; row >= 0 ; row--) { bzero(screen->buf[4 * row + 1], col = screen->max_col + 1); for(cp = (unsigned char *)screen->buf[4 * row] ; col > 0 ; col--) *cp++ = (unsigned char) 'E'; } ScrnRefresh(screen, 0, 0, screen->max_row + 1, screen->max_col + 1, False); parsestate = groundtable; break; case CASE_GSETS:#ifdef DEBUGGING fprintf(stderr, "case GSETS\n");#endif screen->gsets[scstype] = c; parsestate = groundtable; break; case CASE_DECSC:#ifdef DEBUGGING fprintf(stderr, "case DECSC\n");#endif /* DECSC */ CursorSave(term, &screen->sc); parsestate = groundtable; break; case CASE_DECRC:#ifdef DEBUGGING fprintf(stderr, "case DECRC \n");#endif /* DECRC */ CursorRestore(term, &screen->sc); parsestate = groundtable; break; case CASE_DECKPAM:#ifdef DEBUGGING fprintf(stderr, "case DECKPAM\n");#endif /* DECKPAM */ term->keyboard.flags |= KYPD_APL; update_appkeypad(); parsestate = groundtable; break; case CASE_DECKPNM:#ifdef DEBUGGING fprintf(stderr, "case DECKPNM\n");#endif /* DECKPNM */ term->keyboard.flags &= ~KYPD_APL; update_appkeypad(); parsestate = groundtable; break; case CASE_IND:#ifdef DEBUGGING fprintf(stderr, "case IND\n");#endif /* IND */ Index(screen, 1); if (XtAppPending(app_con) || GetBytesAvailable (ConnectionNumber(screen->display)) > 0) xevents(); parsestate = groundtable; break; case CASE_NEL:#ifdef DEBUGGING fprintf(stderr, "case NEL\n");#endif /* NEL */ Index(screen, 1); CarriageReturn(screen); if (XtAppPending(app_con) || GetBytesAvailable (ConnectionNumber(screen->display)) > 0) xevents(); parsestate = groundtable; break; case CASE_HTS:#ifdef DEBUGGING fprintf(stderr, "case HTS\n");#endif /* HTS */ TabSet(term->tabs, screen->cur_col); parsestate = groundtable; break; case CASE_RI: /* RI */#ifdef DEBUGGING fprintf(stderr, "case RI\n");#endif RevIndex(screen, 1); parsestate = groundtable; break; case CASE_SS2:#ifdef DEBUGGING fprintf(stderr, "case SS2\n");#endif /* SS2 */ screen->curss = 2; parsestate = groundtable; break; case CASE_SS3:#ifdef DEBUGGING fprintf(stderr, "case SS3\n");#endif /* SS3 */ screen->curss = 3; parsestate = groundtable; break; case CASE_CSI_STATE: /* enter csi state */#ifdef DEBUGGING fprintf(stderr, "case CSI state\n");#endif nparam = 1; param[0] = DEFAULT; parsestate = csitable; break; case CASE_OSC:#ifdef DEBUGGING fprintf(stderr, "case OS command\n");#endif /* Operating System Command: ESC ] */ do_osc(finput); parsestate = groundtable; break; case CASE_RIS:#ifdef DEBUGGING fprintf(stderr, "case RIS\n");#endif /* RIS */ VTReset(TRUE); parsestate = groundtable; break; case CASE_LS2:#ifdef DEBUGGING fprintf(stderr, "case LS2\n");#endif /* LS2 */ screen->curgl = 2; parsestate = groundtable; break; case CASE_LS3:#ifdef DEBUGGING fprintf(stderr, "case LS3\n");#endif /* LS3 */ screen->curgl = 3; parsestate = groundtable; break; case CASE_LS3R:#ifdef DEBUGGING fprintf(stderr, "case LS3R\n");#endif /* LS3R */ parsestate = groundtable; break; case CASE_LS2R:#ifdef DEBUGGING fprintf(stderr, "case LS2R\n");#endif /* LS2R */ parsestate = groundtable; break; case CASE_LS1R:#ifdef DEBUGGING fprintf(stderr, "case LS1R\n");#endif /* LS1R */ parsestate = groundtable; break; case CASE_XTERM_SAVE:#ifdef DEBUGGING fprintf(stderr, "case savemodes\n");#endif savemodes(term); parsestate = groundtable; break; case CASE_XTERM_RESTORE:#ifdef DEBUGGING fprintf(stderr, "case restoremodes\n");#endif restoremodes(term); parsestate = groundtable; break; } }#ifdef DEBUGGING fprintf(stderr, "Leaving VTParse");#endif}static finput(){#ifdef DEBUGGING fprintf(stderr, "Entering finput()\n");#endif return(doinput());}static char *v_buffer; /* pointer to physical buffer */static char *v_bufstr = NULL; /* beginning of area to write */static char *v_bufptr; /* end of area to write */static char *v_bufend; /* end of physical buffer */#define ptymask() (v_bufptr > v_bufstr ? pty_mask : 0)/* Write data to the pty as typed by the user, pasted with the mouse, or generated by us in response to a query ESC sequence. */v_write(f, d, len) int f; char *d; int len;{ int riten; int c = len;#ifdef DEBUGGING fprintf(stderr, "entering v_write\n");#endif if (v_bufstr == NULL && len > 0) { v_buffer = XtMalloc(len); v_bufstr = v_buffer; v_bufptr = v_buffer; v_bufend = v_buffer + len; }#ifdef DEBUG fprintf(stderr, "v_write called with %d bytes (%d left over)", len, v_bufptr - v_bufstr); if (len > 1 && len < 10) fprintf(stderr, " \"%.*s\"", len, d); fprintf(stderr, "\n");#endif if ((1 << f) != pty_mask) return(write(f, d, len)); /* * Append to the block we already have. * Always doing this simplifies the code, and * isn't too bad, either. If this is a short * block, it isn't too expensive, and if this is * a long block, we won't be able to write it all * anyway. */ if (len > 0) { if (v_bufend < v_bufptr + len) { /* we've run out of room */ if (v_bufstr != v_buffer) { /* there is unused space, move everything down */ /* possibly overlapping bcopy here */#ifdef DEBUG fprintf(stderr, "moving data down %d\n", v_bufstr - v_buffer);#endif bcopy(v_bufstr, v_buffer, v_bufptr - v_bufstr); v_bufptr -= v_bufstr - v_buffer; v_bufstr = v_buffer; } if (v_bufend < v_bufptr + len) { /* still won't fit: get more space */ /* Don't use XtRealloc because an error is not fatal. */ int size = v_bufptr - v_buffer; /* save across realloc */ v_buffer = realloc(v_buffer, size + len); if (v_buffer) {#ifdef DEBUG fprintf(stderr, "expanded buffer to %d\n", size + len);#endif v_bufstr = v_buffer; v_bufptr = v_buffer + size; v_bufend = v_bufptr + len; } else { /* no memory: ignore entire write request */ fprintf(stderr, "%s: cannot allocate buffer space\n", xterm_name); v_buffer = v_bufstr; /* restore clobbered pointer */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -