mleisher@NMSU.Edu (05/08/91)
Submitted-by: mleisher@NMSU.Edu Posting-number: Volume 12, Issue 84 Archive-name: kterm/part03 #!/bin/sh # this is kt412.03 (part 3 of kterm-4.1.2) # do not concatenate these parts, unpack them in order with /bin/sh # file kterm-4.1.2/Tekproc.c continued # if test ! -r _shar_seq_.tmp; then echo 'Please unpack part 1 first!' exit 1 fi (read Scheck if test "$Scheck" != 3; then echo Please unpack part "$Scheck" next! exit 1 else exit 0 fi ) < _shar_seq_.tmp || exit 1 if test ! -f _shar_wnt_.tmp; then echo 'x - still skipping kterm-4.1.2/Tekproc.c' else echo 'x - continuing file kterm-4.1.2/Tekproc.c' sed 's/^X//' << 'SHAR_EOF' >> 'kterm-4.1.2/Tekproc.c' && X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, X * provided that the above copyright notice appear in all copies and that X * both that copyright notice and this permission notice appear in X * supporting documentation, and that the name of Digital Equipment X * Corporation not be used in advertising or publicity pertaining to X * distribution of the software without specific, written prior permission. X * X * X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS X * SOFTWARE. X */ X /* Tekproc.c */ X #include <X11/Xos.h> #include "ptyx.h" #include <X11/Xatom.h> #include <X11/Xutil.h> #include <X11/cursorfont.h> #include <X11/StringDefs.h> #include <X11/Shell.h> #include <X11/Xmu/CharSet.h> #include "Tekparse.h" #include <stdio.h> #ifdef umips # ifndef SYSTYPE_SYSV # include <sgtty.h> # endif /* not SYSTYPE_SYSV */ #else # ifndef CRAY # include <sgtty.h> # endif #endif /* umips */ #include <ctype.h> #include <errno.h> #include <setjmp.h> #include <pwd.h> #include "data.h" #include "error.h" #include "menu.h" X #if !defined(EWOULDBLOCK) && defined(EAGAIN) #define EWOULDBLOCK EAGAIN #endif X extern void exit(); extern long time(); X #define TekColormap DefaultColormap( screen->display, \ X DefaultScreen(screen->display) ) #define DefaultGCID DefaultGC(screen->display, DefaultScreen(screen->display))->gid X /* Tek defines */ X #define BEL 07 #define CANCEL 030 #define DOTDASHEDLINE 2 #define DOTTEDLINE 1 #define EAST 01 #define ETX 03 #define LINEMASK 07 #define LONGDASHEDLINE 4 #define MARGIN1 0 #define MARGIN2 1 #define MAX_PTS 150 #define MAX_VTX 300 #define NAK 025 #define NORTH 04 #define PENDOWN 1 #define PENUP 0 #define SHORTDASHEDLINE 3 #define SOLIDLINE 0 #define SOUTH 010 #define TEKBOTTOMPAD 23 #define TEKDEFHEIGHT 565 #define TEKDEFWIDTH 750 #define TEKHEIGHT 3072 #define TEKHOME ((TekChar[screen->page.fontsize].nlines - 1)\ X * TekChar[screen->page.fontsize].vsize) #define TEKMINHEIGHT 452 #define TEKMINWIDTH 600 #define TEKTOPPAD 34 #define TEKWIDTH 4096 #define TEXT_BUF_SIZE 256 #define WEST 02 X #define TekMove(x,y) screen->cur_X = x; screen->cur_Y = y #define input() Tinput() #define unput(c) *Tpushback++ = c X #ifndef lint static char rcs_id[] = "$XConsortium: Tekproc.c,v 1.77 89/12/22 11:37:41 jim Exp $"; #endif /* lint */ X extern Widget toplevel; X static XPoint *T_box[TEKNUMFONTS] = { X T_boxlarge, X T_box2, X T_box3, X T_boxsmall, }; static struct Tek_Char { X int hsize; /* in Tek units */ X int vsize; /* in Tek units */ X int charsperline; X int nlines; } TekChar[TEKNUMFONTS] = { X {56, 88, 74, 35}, /* large */ X {51, 82, 81, 38}, /* #2 */ X {34, 53, 121, 58}, /* #3 */ X {31, 48, 133, 64}, /* small */ }; X static Cursor GINcursor; static XSegment *line_pt; static int nplot; static TekLink Tek0; static jmp_buf Tekjump; static TekLink *TekRecord; static XSegment *Tline; X extern int Talptable[]; extern int Tbestable[]; extern int Tbyptable[]; extern int Tesctable[]; extern int Tipltable[]; extern int Tplttable[]; extern int Tpttable[]; extern int Tspttable[]; X static int *curstate = Talptable; static int *Tparsestate = Talptable; X /* event handlers */ extern void HandleKeyPressed(), HandleEightBitKeyPressed(); extern void HandleStringEvent(); extern void HandleEnterWindow(); extern void HandleLeaveWindow(); extern void HandleFocusChange(); extern void HandleSecure(); extern void HandleGINInput(); extern void HandleCreateMenu(), HandlePopupMenu(); X static char defaultTranslations[] = "\ X ~Meta<KeyPress>: insert-seven-bit() \n\ X Meta<KeyPress>: insert-eight-bit()\n\ X Ctrl ~Meta<Btn1Down>: popup-menu(mainMenu) \n\ X Ctrl ~Meta <Btn2Down>: popup-menu(tekMenu) \n\ X Shift ~Meta<Btn1Down>: gin-press(L) \n\ X ~Meta<Btn1Down>: gin-press(l) \n\ X Shift ~Meta<Btn2Down>: gin-press(M) \n\ X ~Meta<Btn2Down>: gin-press(m) \n\ X Shift ~Meta<Btn3Down>: gin-press(R) \n\ X ~Meta<Btn3Down>: gin-press(r)"; X X static XtActionsRec actionsList[] = { X { "string", HandleStringEvent }, X { "insert", HandleKeyPressed }, /* alias for insert-seven-bit */ X { "insert-seven-bit", HandleKeyPressed }, X { "insert-eight-bit", HandleEightBitKeyPressed }, X { "gin-press", HandleGINInput }, X { "secure", HandleSecure }, X { "create-menu", HandleCreateMenu }, X { "popup-menu", HandlePopupMenu }, X /* menu actions */ X { "allow-send-events", HandleAllowSends }, X { "set-visual-bell", HandleVisualBell }, X { "set-logging", HandleLogging }, X { "redraw", HandleRedraw }, X { "send-signal", HandleSendSignal }, X { "quit", HandleQuit }, X { "set-scrollbar", HandleScrollbar }, X { "set-jumpscroll", HandleJumpscroll }, X { "set-reverse-video", HandleReverseVideo }, X { "set-autowrap", HandleAutoWrap }, X { "set-reversewrap", HandleReverseWrap }, X { "set-autolinefeed", HandleAutoLineFeed }, X { "set-appcursor", HandleAppCursor }, X { "set-appkeypad", HandleAppKeypad }, X { "set-scroll-on-key", HandleScrollKey }, X { "set-scroll-on-tty-output", HandleScrollTtyOutput }, X { "set-allow132", HandleAllow132 }, X { "set-cursesemul", HandleCursesEmul }, X { "set-marginbell", HandleMarginBell }, X { "set-altscreen", HandleAltScreen }, X { "soft-reset", HandleSoftReset }, X { "hard-reset", HandleHardReset }, X { "set-terminal-type", HandleSetTerminalType }, X { "set-visibility", HandleVisibility }, X { "set-tek-text", HandleSetTekText }, X { "tek-page", HandleTekPage }, X { "tek-reset", HandleTekReset }, X { "tek-copy", HandleTekCopy }, }; X static Dimension defOne = 1; X static XtResource resources[] = { X {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), X XtOffset(Widget, core.width), XtRDimension, (caddr_t)&defOne}, X {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), X XtOffset(Widget, core.height), XtRDimension, (caddr_t)&defOne}, X {"fontLarge", XtCFont, XtRFontStruct, sizeof(XFontStruct *), X XtOffset(TekWidget, tek.Tfont[TEK_FONT_LARGE]), X XtRString, "9x15"}, X {"font2", XtCFont, XtRFontStruct, sizeof(XFontStruct *), X XtOffset(TekWidget, tek.Tfont[TEK_FONT_2]), X XtRString, "6x13"}, X {"font3", XtCFont, XtRFontStruct, sizeof(XFontStruct *), X XtOffset(TekWidget, tek.Tfont[TEK_FONT_3]), X XtRString, "8x13"}, X {"fontSmall", XtCFont, XtRFontStruct, sizeof(XFontStruct *), X XtOffset(TekWidget, tek.Tfont[TEK_FONT_SMALL]), X XtRString, "6x10"}, X {"initialFont", "InitialFont", XtRString, sizeof(char *), X XtOffset(TekWidget, tek.initial_font), X XtRString, "large"}, }; X static void TekInitialize(), TekRealize(), TekConfigure(); void TekExpose(); X WidgetClassRec tekClassRec = { X { /* core_class fields */ X /* superclass */ (WidgetClass) &widgetClassRec, X /* class_name */ "Tek4014", X /* widget_size */ sizeof(TekWidgetRec), X /* class_initialize */ NULL, X /* class_part_initialize */ NULL, X /* class_inited */ FALSE, X /* initialize */ TekInitialize, X /* initialize_hook */ NULL, X /* realize */ TekRealize, X /* actions */ actionsList, X /* num_actions */ XtNumber(actionsList), X /* resources */ resources, X /* num_resources */ XtNumber(resources), X /* xrm_class */ NULLQUARK, X /* compress_motion */ TRUE, X /* compress_exposure */ TRUE, X /* compress_enterleave */ TRUE, X /* visible_interest */ FALSE, X /* destroy */ NULL, X /* resize */ TekConfigure, X /* expose */ TekExpose, X /* set_values */ NULL, X /* set_values_hook */ NULL, X /* set_values_almost */ NULL, X /* get_values_hook */ NULL, X /* accept_focus */ NULL, X /* version */ XtVersion, X /* callback_offsets */ NULL, X /* tm_table */ defaultTranslations, X /* query_geometry */ XtInheritQueryGeometry, X /* display_accelerator*/ XtInheritDisplayAccelerator, X /* extension */ NULL X } }; #define tekWidgetClass ((WidgetClass)&tekClassRec) X static Boolean Tfailed = FALSE; X TekWidget CreateTekWidget () { X Widget tekshellwidget; X extern Arg ourTopLevelShellArgs[]; X extern int number_ourTopLevelShellArgs; X X /* this causes the Initialize method to be called */ X tekshellwidget = XtCreatePopupShell ("tektronix", topLevelShellWidgetClass, X toplevel, ourTopLevelShellArgs, X number_ourTopLevelShellArgs); X X /* this causes the Realize method to be called */ X tekWidget = (TekWidget) XtCreateManagedWidget ("tek4014", tekWidgetClass, X tekshellwidget, NULL, 0); X return (tekWidget); } X X int TekInit () { X if (Tfailed) return (0); X if (tekWidget) return (1); X if (CreateTekWidget()) { X return (1); X } X return (0); } X Tekparse() { X register TScreen *screen = &term->screen; X register int c, x, y; X char ch; X int Tinput(); X X for( ; ; ) X switch(Tparsestate[c = input()]) { X case CASE_REPORT: X /* report address */ X if(screen->TekGIN) { X TekGINoff(); X TekEnqMouse(0); X } else { X c = 064; /* has hard copy unit */ X if(screen->margin == MARGIN2) X c |= 02; X TekEnq(c, screen->cur_X, screen->cur_Y); X } X TekRecord->ptr[-1] = NAK; /* remove from recording */ X Tparsestate = curstate; X break; X X case CASE_VT_MODE: X /* special return to vt102 mode */ X Tparsestate = curstate; X TekRecord->ptr[-1] = NAK; /* remove from recording */ X if(screen->logging) { X FlushLog(screen); X screen->logstart = buffer; X } X return; X X case CASE_SPT_STATE: X /* Enter Special Point Plot mode */ X if(screen->TekGIN) X TekGINoff(); X Tparsestate = curstate = Tspttable; X break; X X case CASE_GIN: X /* Do Tek GIN mode */ X screen->TekGIN = &TekRecord->ptr[-1]; X /* Set cross-hair cursor raster array */ X if (GINcursor = X make_colored_cursor (XC_tcross, screen->mousecolor, X screen->mousecolorback)) X XDefineCursor (screen->display, TShellWindow, X GINcursor); X Tparsestate = Tbyptable; /* Bypass mode */ X break; X X case CASE_BEL: X /* BEL */ X if(screen->TekGIN) X TekGINoff(); X if(!TekRefresh) X Bell(); X Tparsestate = curstate; /* clear bypass condition */ X break; X X case CASE_BS: X /* BS */ X if(screen->TekGIN) X TekGINoff(); X Tparsestate = curstate; /* clear bypass condition */ X TCursorBack(); X break; X X case CASE_PT_STATE: X /* Enter Tek Point Plot mode */ X if(screen->TekGIN) X TekGINoff(); X Tparsestate = curstate = Tpttable; X break; X X case CASE_PLT_STATE: X /* Enter Tek Plot mode */ X if(screen->TekGIN) X TekGINoff(); X Tparsestate = curstate = Tplttable; X if((c = input()) == BEL) X screen->pen = PENDOWN; X else { X unput(c); X screen->pen = PENUP; X } X break; X X case CASE_TAB: X /* HT */ X if(screen->TekGIN) X TekGINoff(); X Tparsestate = curstate; /* clear bypass condition */ X TCursorForward(); X break; X X case CASE_IPL_STATE: X /* Enter Tek Incremental Plot mode */ X if(screen->TekGIN) X TekGINoff(); X Tparsestate = curstate = Tipltable; X break; X X case CASE_ALP_STATE: X /* Enter Tek Alpha mode from any other mode */ X if(screen->TekGIN) X TekGINoff(); X /* if in one of graphics states, move alpha cursor */ X if(nplot > 0) /* flush line Tbuffer */ X TekFlush(); X Tparsestate = curstate = Talptable; X break; X X case CASE_UP: X /* cursor up */ X if(screen->TekGIN) X TekGINoff(); X Tparsestate = curstate; /* clear bypass condition */ X TCursorUp(); X break; X X case CASE_COPY: X /* make copy */ X if(screen->TekGIN) X TekGINoff(); X TekCopy(); X TekRecord->ptr[-1] = NAK; /* remove from recording */ X Tparsestate = curstate; /* clear bypass condition */ X break; X X case CASE_PAGE: X /* Page Function */ X if(screen->TekGIN) X TekGINoff(); X TekPage(); /* clear bypass condition */ X break; X X case CASE_BES_STATE: X /* Byp: an escape char */ X Tparsestate = Tbestable; X break; X X case CASE_BYP_STATE: X /* set bypass condition */ X Tparsestate = Tbyptable; X break; X X case CASE_IGNORE: X /* Esc: totally ignore CR, ESC, LF, ~ */ X break; X X case CASE_ASCII: X /* Select ASCII char set */ X /* ignore for now */ X Tparsestate = curstate; X break; X X case CASE_APL: X /* Select APL char set */ X /* ignore for now */ X Tparsestate = curstate; X break; X X case CASE_CHAR_SIZE: X /* character size selector */ X TekSetGCFont (screen->cur.fontsize = (c & 03)); X Tparsestate = curstate; X break; X X case CASE_BEAM_VEC: X /* beam and vector selector */ X /* only line types */ X if((c &= LINEMASK) != screen->cur.linetype) { X if(nplot > 0) X TekFlush(); X screen->cur.linetype = c; X } X Tparsestate = curstate; X break; X X case CASE_CURSTATE: X Tparsestate = curstate; X break; X X case CASE_PENUP: X /* Ipl: penup */ X screen->pen = PENUP; X break; X X case CASE_PENDOWN: X /* Ipl: pendown */ X screen->pen = PENDOWN; X break; X X case CASE_IPL_POINT: X /* Ipl: point */ X x = screen->cur_X; X y = screen->cur_Y; X if(c & NORTH) X y++; X else if(c & SOUTH) X y--; X if(c & EAST) X x++; X else if(c & WEST) X x--; X if(screen->pen == PENDOWN) X TekDraw(x, y); X else X TekMove(x, y); X break; X X case CASE_PLT_VEC: X /* Plt: vector */ X unput(c); X if(getpoint()) { X if(screen->pen == PENDOWN) X TekDraw(screen->cur.x, screen->cur.y); X else X TekMove(screen->cur.x, screen->cur.y); X screen->pen = PENDOWN; X } X break; X X case CASE_PT_POINT: X /* Pt: point */ X unput(c); X if(getpoint()) { X TekMove(screen->cur.x, screen->cur.y); X TekDraw(screen->cur.x, screen->cur.y); X } X break; X X case CASE_SPT_POINT: X /* Spt: point */ X /* ignore intensity character in c */ X if(getpoint()) { X TekMove(screen->cur.x, screen->cur.y); X TekDraw(screen->cur.x, screen->cur.y); X } X break; X X case CASE_CR: X /* CR */ X if(screen->TekGIN) X TekGINoff(); X if(nplot > 0) /* flush line Tbuffer */ X TekFlush(); X screen->cur_X = screen->margin == MARGIN1 ? 0 : X TEKWIDTH / 2; X Tparsestate = curstate = Talptable; X break; X X case CASE_ESC_STATE: X /* ESC */ X Tparsestate = Tesctable; X break; X X case CASE_LF: X /* LF */ X if(screen->TekGIN) X TekGINoff(); X TCursorDown(); X if (!TekRefresh && (screen->display->qlen > 0 || X GetBytesAvailable (screen->display->fd) > 0)) X xevents(); X break; X X case CASE_SP: X /* SP */ X TCursorForward(); X break; X X case CASE_PRINT: X /* printable character */ X ch = c; X c = screen->cur.fontsize; X X XDrawString( X screen->display, X TWindow(screen), X screen->TnormalGC, X (int)(screen->cur_X * TekScale(screen)) + screen->border, X (int)((TEKHEIGHT + TEKTOPPAD - screen->cur_Y) * TekScale(screen)) + screen->border, X &ch, X 1); X TCursorForward(); X break; X case CASE_OSC: X /* do osc escape */ X do_osc(Tinput); X Tparsestate = curstate; X break; X } } X TekSetGCFont (size) X int size; /* TEK_FONT_{LARGE,2,3,SMALL} */ X { X register TScreen *screen = &term->screen; X Font fid = tekWidget->tek.Tfont[size]->fid; X if (fid == DefaultGCID) X /* we didn't succeed in opening a real font X for this size. Instead, use server default. */ X XCopyGC (screen->display, X DefaultGC(screen->display, DefaultScreen(screen->display)), X GCFont, screen->TnormalGC); X else X XSetFont (screen->display, screen->TnormalGC, fid); X } X static int rcnt; static char *rptr; static int Tselect_mask; X Tinput() { X register TScreen *screen = &term->screen; X register int i; X register TekLink *tek; X extern char *malloc(); X X if(Tpushback > Tpushb) X return(*--Tpushback); X if(TekRefresh) { X if(rcnt-- > 0) X return(*rptr++); X if(tek = TekRefresh->next) { X TekRefresh = tek; X rcnt = tek->count - 1; X rptr = tek->data; X return(*rptr++); X } X TekRefresh = (TekLink *)0; X longjmp(Tekjump, 1); X } again: X if(Tbcnt-- <= 0) { X if(nplot > 0) /* flush line Tbuffer */ X TekFlush(); X Tselect_mask = pty_mask; /* force a read */ X for( ; ; ) { #ifdef CRAY X struct timeval crocktimeout; X crocktimeout.tv_sec = 0; X crocktimeout.tv_usec = 0; X (void) select (max_plus1, &Tselect_mask, (int *) NULL, X (int *) NULL, &crocktimeout); #endif X if(Tselect_mask & pty_mask) { X if(screen->logging) X FlushLog(screen); X if((Tbcnt = read(screen->respond, X Tbptr = Tbuffer, BUF_SIZE)) < 0) { X if(errno == EIO) X Cleanup (0); X else if(errno != EWOULDBLOCK) X Panic( X "Tinput:read returned unexpected error (%d)\n", X errno); X } else if(Tbcnt == 0) X Panic("input: read returned zero\n", 0); X else { X break; X } X } X if (Ttoggled && curstate == Talptable) { X TCursorToggle(TOGGLE); X Ttoggled = FALSE; X } X if(QLength(screen->display)) X Tselect_mask = X_mask; X else { X XFlush(screen->display); X Tselect_mask = Select_mask; X if((i = select(max_plus1, &Tselect_mask, X (int *)NULL, (int *)NULL, X (struct timeval *)NULL)) < 0){ X if (errno != EINTR) X SysError(ERROR_TSELECT); X continue; X } X } X if(Tselect_mask & X_mask) { X xevents(); X if(Tbcnt > 0) X goto again; X } X } X Tbcnt--; X if (!Ttoggled && curstate == Talptable) { X TCursorToggle(TOGGLE); X Ttoggled = TRUE; X } X } X if((tek = TekRecord)->count >= TEK_LINK_BLOCK_SIZE) { X if((TekRecord = tek->next = (TekLink *)malloc(sizeof(TekLink))) X == (TekLink *)0) X Panic("Tinput: malloc error (%d)\n", errno); X tek = tek->next; X tek->next = (TekLink *)0; X tek->count = 0; X tek->ptr = tek->data; X } X tek->count++; X return(*tek->ptr++ = *Tbptr++); } X /* this should become the Tek Widget's Resize proc */ static void TekConfigure(w) X Widget w; { X register TScreen *screen = &term->screen; X register int border = 2 * screen->border; X register double d; X X if (TWindow(screen)) XClearWindow(screen->display, TWindow(screen)); X TWidth(screen) = w->core.width - border; X THeight(screen) = w->core.height - border; X TekScale(screen) = (double)TWidth(screen) / TEKWIDTH; X if((d = (double)THeight(screen) / (TEKHEIGHT + TEKTOPPAD + TEKBOTTOMPAD)) X < TekScale(screen)) X TekScale(screen) = d; X TFullWidth(screen) = w->core.width; X TFullHeight(screen) = w->core.height; } X /* this should become the Tek Widget's Expose proc */ /* need to use compress_events = TRUE so you don't need to X look at the "count" in the exposure event ! */ /*ARGSUSED*/ void TekExpose(w, event, region) Widget w; XXExposeEvent *event; Region region; { X register TScreen *screen = &term->screen; X #ifdef lint X region = region; #endif X if(!Ttoggled) X TCursorToggle(CLEAR); X Ttoggled = TRUE; X Tpushback = Tpushb; X screen->cur_X = 0; X screen->cur_Y = TEKHOME; X screen->cur = screen->page; X TekSetGCFont (screen->cur.fontsize); X screen->margin = MARGIN1; X if(screen->TekGIN) { X screen->TekGIN = NULL; X TekGINoff(); X } X TekRefresh = &Tek0; X rptr = TekRefresh->data; X rcnt = TekRefresh->count; X Tparsestate = curstate = Talptable; X if(!screen->waitrefresh) X dorefresh(); } X dorefresh() { X register TScreen *screen = &term->screen; X static Cursor wait_cursor = None; X X if (wait_cursor == None) X wait_cursor = make_colored_cursor (XC_watch, screen->mousecolor, X screen->mousecolorback); X XDefineCursor(screen->display, TShellWindow, wait_cursor); X XFlush(screen->display); X if(!setjmp(Tekjump)) X Tekparse(); X XDefineCursor(screen->display, TShellWindow, X (screen->TekGIN && GINcursor) ? GINcursor : screen->arrow); } X TekPage() { X register TScreen *screen = &term->screen; X register TekLink *tek, *tek2; X X XClearWindow(screen->display, TWindow(screen)); X screen->cur_X = 0; X screen->cur_Y = TEKHOME; X screen->margin = MARGIN1; X screen->page = screen->cur; X if(screen->TekGIN) X TekGINoff(); X tek = TekRecord = &Tek0; X tek->count = 0; X tek->ptr = tek->data; X if(tek = tek->next) X do { X tek2 = tek->next; X free((char *)tek); X } while(tek = tek2); X TekRecord->next = (TekLink *)0; X TekRefresh = (TekLink *)0; X Ttoggled = TRUE; X Tparsestate = curstate = Talptable; /* Tek Alpha mode */ } X #define EXTRABITS 017 #define FIVEBITS 037 #define HIBITS (FIVEBITS << SHIFTHI) #define LOBITS (FIVEBITS << SHIFTLO) #define SHIFTHI 7 #define SHIFTLO 2 #define TWOBITS 03 X getpoint() { X register int c, x, y, e, lo_y = 0; X register TScreen *screen = &term->screen; X X x = screen->cur.x; X y = screen->cur.y; X for( ; ; ) { X if((c = input()) < ' ') { /* control character */ X unput(c); X return(0); X } X if(c < '@') { /* Hi X or Hi Y */ X if(lo_y) { /* seen a Lo Y, so this must be Hi X */ X x &= ~HIBITS; X x |= (c & FIVEBITS) << SHIFTHI; X continue; X } X /* else Hi Y */ X y &= ~HIBITS; X y |= (c & FIVEBITS) << SHIFTHI; X continue; X } X if(c < '`') { /* Lo X */ X x &= ~LOBITS; X x |= (c & FIVEBITS) << SHIFTLO; X screen->cur.x = x; X screen->cur.y = y; X return(1); /* OK */ X } X /* else Lo Y */ X if(lo_y) { /* seen a Lo Y, so other must be extra bits */ X e = (y >> SHIFTLO) & EXTRABITS; X x &= ~TWOBITS; X x |= e & TWOBITS; X y &= ~TWOBITS; X y |= (e >> SHIFTLO) & TWOBITS; X } X y &= ~LOBITS; X y |= (c & FIVEBITS) << SHIFTLO; X lo_y++; X } } X TCursorBack() { X register TScreen *screen = &term->screen; X register struct Tek_Char *t; X register int x, l; X X x = ( screen->cur_X -= X (t = &TekChar[screen->cur.fontsize])->hsize X ); X X if(screen->margin == MARGIN1 && x < 0 || screen->margin == MARGIN2 X && x < TEKWIDTH / 2) { X if((l = (screen->cur_Y + (t->vsize - 1)) / t->vsize + 1) >= X t->nlines) { X screen->margin = !screen->margin; X l = 0; X } X screen->cur_Y = l * t->vsize; X screen->cur_X = (t->charsperline - 1) * t->hsize; X } } X TCursorForward() { X register TScreen *screen = &term->screen; X register struct Tek_Char *t; X register int l; X X if( ( screen->cur_X += X ( t = &TekChar[screen->cur.fontsize])->hsize X ) > TEKWIDTH X ) { X if((l = screen->cur_Y / t->vsize - 1) < 0) { X screen->margin = !screen->margin; X l = t->nlines - 1; X } X screen->cur_Y = l * t->vsize; X screen->cur_X = screen->margin == MARGIN1 ? 0 : TEKWIDTH / 2; X } } X TCursorUp() { X register TScreen *screen = &term->screen; X register struct Tek_Char *t; X register int l; X X t = &TekChar[screen->cur.fontsize]; X X if((l = (screen->cur_Y + (t->vsize - 1)) / t->vsize + 1) >= t->nlines) { X l = 0; X if((screen->margin = !screen->margin) != MARGIN1) { X if(screen->cur_X < TEKWIDTH / 2) X screen->cur_X += TEKWIDTH / 2; X } else if(screen->cur_X >= TEKWIDTH / 2) X screen->cur_X -= TEKWIDTH / 2; X } X screen->cur_Y = l * t->vsize; } X TCursorDown() { X register TScreen *screen = &term->screen; X register struct Tek_Char *t; X register int l; X X t = &TekChar[screen->cur.fontsize]; X X if((l = screen->cur_Y / t->vsize - 1) < 0) { X l = t->nlines - 1; X if((screen->margin = !screen->margin) != MARGIN1) { X if(screen->cur_X < TEKWIDTH / 2) X screen->cur_X += TEKWIDTH / 2; X } else if(screen->cur_X >= TEKWIDTH / 2) X screen->cur_X -= TEKWIDTH / 2; X } X screen->cur_Y = l * t->vsize; } X TekDraw (x, y) int x, y; { X register TScreen *screen = &term->screen; X X if(nplot == 0 || T_lastx != screen->cur_X || T_lasty != screen->cur_Y) { X /* X * We flush on each unconnected line segment if the line X * type is not solid. This solves a bug in X when drawing X * points while the line type is not solid. X */ X if(nplot > 0 && screen->cur.linetype != SOLIDLINE) X TekFlush(); X } X AddToDraw(screen->cur_X, screen->cur_Y, x, y); X T_lastx = screen->cur_X = x; X T_lasty = screen->cur_Y = y; } X AddToDraw(x1, y1, x2, y2) int x1, y1, x2, y2; { X register TScreen *screen = &term->screen; X register XSegment *lp; X X if(nplot >= MAX_PTS) { X TekFlush(); X } X lp = line_pt++; X lp->x1 = x1 = x1 * TekScale(screen) + screen->border; X lp->y1 = y1 = (TEKHEIGHT + TEKTOPPAD - y1) * TekScale(screen) + X screen->border; X lp->x2 = x2 = x2 * TekScale(screen) + screen->border; X lp->y2 = y2 = (TEKHEIGHT + TEKTOPPAD - y2) * TekScale(screen) + X screen->border; X nplot++; } X TekFlush () { X register TScreen *screen = &term->screen; X X XDrawSegments(screen->display, TWindow(screen), X ((screen->cur.linetype == SOLIDLINE)? screen->TnormalGC : X screen->linepat[screen->cur.linetype - 1]), X Tline, nplot); X nplot = 0; X line_pt = Tline; } X TekGINoff() { X register TScreen *screen = &term->screen; X X XDefineCursor(screen->display, TShellWindow, screen->arrow); X if(GINcursor) X XFreeCursor(screen->display, GINcursor); X if(screen->TekGIN) { X *screen->TekGIN = CANCEL; /* modify recording */ X screen->TekGIN = NULL; X } } X TekEnqMouse(c) int c; { X register TScreen *screen = &term->screen; X int mousex, mousey, rootx, rooty; X unsigned int mask; /* XQueryPointer */ X Window root, subw; X X XQueryPointer( X screen->display, TWindow(screen), X &root, &subw, X &rootx, &rooty, X &mousex, &mousey, X &mask); X if((mousex = (mousex - screen->border) / TekScale(screen)) < 0) X mousex = 0; X else if(mousex >= TEKWIDTH) X mousex = TEKWIDTH - 1; X if((mousey = TEKHEIGHT + TEKTOPPAD - (mousey - screen->border) / X TekScale(screen)) < 0) X mousey = 0; X else if(mousey >= TEKHEIGHT) X mousey = TEKHEIGHT - 1; X TekEnq(c, mousex, mousey); } X TekEnq (status, x, y) int status; register int x, y; { X register TScreen *screen = &term->screen; X int pty = screen->respond; X char cplot [5]; X X /* Translate x and y to Tektronix code */ X cplot[1] = 040 | ((x >> SHIFTHI) & FIVEBITS); X cplot[2] = 040 | ((x >> SHIFTLO) & FIVEBITS); X cplot[3] = 040 | ((y >> SHIFTHI) & FIVEBITS); X cplot[4] = 040 | ((y >> SHIFTLO) & FIVEBITS); X if(cplot[0] = status) X write (pty, cplot, 5); X else X write (pty, &cplot[1], 4); } X TekRun() { X register TScreen *screen = &term->screen; X register int i; X X if(!TWindow(screen) && !TekInit()) { X if(VWindow(screen)) { X screen->TekEmu = FALSE; X return; X } X Exit(ERROR_TINIT); X } X if(!screen->Tshow) { X XtRealizeWidget (tekWidget->core.parent); X set_tek_visibility (TRUE); X } X update_vttekmode(); X update_vtshow(); X update_tekshow(); X set_tekhide_sensitivity(); X X Tpushback = Tpushb; X Tbptr = Tbuffer; X for(i = Tbcnt = bcnt ; i > 0 ; i--) X *Tbptr++ = *bptr++; X Tbptr = Tbuffer; X Ttoggled = TRUE; X if(!setjmp(Tekend)) X Tekparse(); X if(!Ttoggled) { X TCursorToggle(TOGGLE); X Ttoggled = TRUE; X } X screen->TekEmu = FALSE; } X #define DOTTED_LENGTH 2 #define DOT_DASHED_LENGTH 4 #define SHORT_DASHED_LENGTH 2 #define LONG_DASHED_LENGTH 2 X static int dash_length[TEKNUMLINES] = { X DOTTED_LENGTH, X DOT_DASHED_LENGTH, X SHORT_DASHED_LENGTH, X LONG_DASHED_LENGTH, }; X static unsigned char dotted[DOTTED_LENGTH] = {3, 1}; static unsigned char dot_dashed[DOT_DASHED_LENGTH] = {3, 4, 3, 1}; static unsigned char short_dashed[SHORT_DASHED_LENGTH] = {4, 4}; static unsigned char long_dashed[LONG_DASHED_LENGTH] = {4, 7}; X static unsigned char *dashes[TEKNUMLINES] = { X dotted, X dot_dashed, X short_dashed, X long_dashed, }; X X X /* X * The following is called the create the tekWidget X */ X static void TekInitialize(request, new) X Widget request, new; { X /* look for focus related events on the shell, because we need X * to care about the shell's border being part of our focus. X */ X XtAddEventHandler(XtParent(new), EnterWindowMask, FALSE, X HandleEnterWindow, (caddr_t)NULL); X XtAddEventHandler(XtParent(new), LeaveWindowMask, FALSE, X HandleLeaveWindow, (caddr_t)NULL); X XtAddEventHandler(XtParent(new), FocusChangeMask, FALSE, X HandleFocusChange, (caddr_t)NULL); } X X static void TekRealize (gw, valuemaskp, values) X Widget gw; X XtValueMask *valuemaskp; X XSetWindowAttributes *values; { X TekWidget tw = (TekWidget) gw; X register TScreen *screen = &term->screen; X register int i; X register TekLink *tek; X register double d; X register int border = 2 * screen->border; X int pr; X XGCValues gcv; X int winX, winY, width, height; X XSizeHints sizehints; X char Tdefault[32]; X extern char *malloc(); X X tw->core.border_pixel = term->core.border_pixel; X X for (i = 0; i < TEKNUMFONTS; i++) { X if (!tw->tek.Tfont[i]) X tw->tek.Tfont[i] = XQueryFont (screen->display, DefaultGCID); X tw->tek.tobaseline[i] = tw->tek.Tfont[i]->ascent; X } X X if((Tbuffer = (Char *)malloc(BUF_SIZE)) == NULL || X (Tpushb = (Char *)malloc(10)) == NULL || X (Tline = (XSegment *)malloc(MAX_VTX * sizeof(XSegment))) == NULL) { X fprintf (stderr, "%s: Not enough core for Tek mode\n", xterm_name); X goto mallocfailed; X } X X screen->xorplane = 1; X X screen->Tbackground = term->core.background_pixel; X screen->Tforeground = screen->foreground; X screen->Tcursorcolor = screen->foreground; X X if (term->misc.T_geometry == NULL) { X int defwidth, defheight; X X if (term->misc.tekSmall) { X defwidth = TEKMINWIDTH; X defheight = TEKMINHEIGHT; X } else { X defwidth = TEKDEFWIDTH; X defheight = TEKDEFHEIGHT; X } X sprintf (Tdefault, "=%dx%d", defwidth + border, defheight + border); X term->misc.T_geometry = Tdefault; X } X X winX = 1; X winY = 1; X width = TEKDEFWIDTH + border; X height = TEKDEFHEIGHT + border; X X pr = XParseGeometry(term->misc.T_geometry, &winX, &winY, (unsigned int *)&width, (unsigned int *)&height); X if ((pr & XValue) && (pr & XNegative)) X winX += DisplayWidth(screen->display, DefaultScreen(screen->display)) X - width - (term->core.parent->core.border_width * 2); X if ((pr & YValue) && (pr & YNegative)) X winY += DisplayHeight(screen->display, DefaultScreen(screen->display)) X - height - (term->core.parent->core.border_width * 2); X X /* set up size hints */ X sizehints.min_width = TEKMINWIDTH + border; X sizehints.min_height = TEKMINHEIGHT + border; X sizehints.width_inc = 1; X sizehints.height_inc = 1; X sizehints.flags = PMinSize|PResizeInc; X sizehints.x = winX; X sizehints.y = winY; X if ((XValue&pr) || (YValue&pr)) { X sizehints.flags |= USSize|USPosition; X sizehints.flags |= PWinGravity; X switch (pr & (XNegative | YNegative)) { X case 0: X sizehints.win_gravity = NorthWestGravity; X break; X case XNegative: X sizehints.win_gravity = NorthEastGravity; X break; X case YNegative: X sizehints.win_gravity = SouthWestGravity; X break; X default: X sizehints.win_gravity = SouthEastGravity; X break; X } X } else { X sizehints.flags |= PSize; X } X sizehints.width = width; X sizehints.height = height; X if ((WidthValue&pr) || (HeightValue&pr)) X sizehints.flags |= USSize; X else sizehints.flags |= PSize; X X (void) XtMakeResizeRequest ((Widget) tw, width, height, X &tw->core.width, &tw->core.height); X X /* XXX This is bogus. We are parsing geometries too late. This X * is information that the shell widget ought to have before we get X * realized, so that it can do the right thing. X */ X if (sizehints.flags & USPosition) X XMoveWindow (XtDisplay(tw), tw->core.parent->core.window, X sizehints.x, sizehints.y); X X XSetWMNormalHints (XtDisplay(tw), tw->core.parent->core.window, X &sizehints); X X values->win_gravity = NorthWestGravity; X values->background_pixel = screen->Tbackground; X X if((tw->core.window = TWindow(screen) = X XCreateWindow (screen->display, X tw->core.parent->core.window, X tw->core.x, tw->core.y, X tw->core.width, tw->core.height, tw->core.border_width, X (int) tw->core.depth, X InputOutput, CopyFromParent, X ((*valuemaskp)|CWBackPixel|CWWinGravity), X values)) == NULL) { X fprintf(stderr, "%s: Can't create Tek window\n", xterm_name); X free((char *)Tline); X mallocfailed: X if(Tpushb) free((char *)Tpushb); X if(Tbuffer) free((char *)Tbuffer); X Tfailed = TRUE; X return; X } X X screen->Tbox = T_box; X X TFullWidth(screen) = width; X TFullHeight(screen) = height; X TWidth(screen) = width - border; X THeight(screen) = height - border; X TekScale(screen) = (double)TWidth(screen) / TEKWIDTH; X if((d = (double)THeight(screen) / (TEKHEIGHT + TEKTOPPAD + X TEKBOTTOMPAD)) < TekScale(screen)) X TekScale(screen) = d; X X X screen->cur.fontsize = TEK_FONT_LARGE; X if (tw->tek.initial_font) { X char *s = tw->tek.initial_font; X X XmuCopyISOLatin1Lowered (s, s); X if (strcmp (s, "large") == 0) X screen->cur.fontsize = TEK_FONT_LARGE; X else if (strcmp (s, "2") == 0 || strcmp (s, "two") == 0) X screen->cur.fontsize = TEK_FONT_2; X else if (strcmp (s, "3") == 0 || strcmp (s, "three") == 0) X screen->cur.fontsize = TEK_FONT_3; X else if (strcmp (s, "small") == 0) X screen->cur.fontsize = TEK_FONT_SMALL; X } X X gcv.graphics_exposures = TRUE; /* default */ X gcv.font = tw->tek.Tfont[screen->cur.fontsize]->fid; X gcv.foreground = screen->Tforeground; X gcv.background = screen->Tbackground; X X /* if font wasn't successfully opened, then gcv.font will contain X the Default GC's ID, meaning that we must use the server default font. X */ X TEKgcFontMask = (gcv.font == DefaultGCID) ? 0 : GCFont; X screen->TnormalGC = XCreateGC (screen->display, TWindow(screen), X (TEKgcFontMask|GCGraphicsExposures| X GCForeground|GCBackground), &gcv); X X gcv.function = GXinvert; X gcv.plane_mask = screen->xorplane = (screen->Tbackground ^ X screen->Tcursorcolor); X screen->TcursorGC = XCreateGC (screen->display, TWindow(screen), X (GCFunction|GCPlaneMask), &gcv); X X gcv.foreground = screen->Tforeground; X gcv.line_style = LineOnOffDash; X for(i = 0 ; i < TEKNUMLINES ; i++) { X screen->linepat[i] = XCreateGC (screen->display, TWindow(screen), X (GCForeground|GCLineStyle), &gcv); X XSetDashes (screen->display, screen->linepat[i], 0, X (char *) dashes[i], dash_length[i]); X } X X TekBackground(screen); X X screen->margin = MARGIN1; /* Margin 1 */ X screen->TekGIN = FALSE; /* GIN off */ X X X XDefineCursor(screen->display, TShellWindow, screen->pointer_cursor); X X { /* there's gotta be a better way... */ X static Arg args[] = { X {XtNtitle, NULL}, X {XtNiconName, NULL}, X }; X char *icon_name, *title, *tek_icon_name, *tek_title; X X args[0].value = (XtArgVal)&icon_name; X args[1].value = (XtArgVal)&title; X XtGetValues (tw->core.parent, args, 2); X tek_icon_name = XtMalloc(strlen(icon_name)+7); X strcpy(tek_icon_name, icon_name); X strcat(tek_icon_name, "(Tek)"); X tek_title = XtMalloc(strlen(title)+7); X strcpy(tek_title, title); X strcat(tek_title, "(Tek)"); X args[0].value = (XtArgVal)tek_icon_name; X args[1].value = (XtArgVal)tek_title; X XtSetValues (tw->core.parent, args, 2); X XtFree( tek_icon_name ); X XtFree( tek_title ); X } X X tek = TekRecord = &Tek0; X tek->next = (TekLink *)0; X tek->count = 0; X tek->ptr = tek->data; X Tpushback = Tpushb; X Tbptr = Tbuffer; X screen->cur_X = 0; X screen->cur_Y = TEKHOME; X line_pt = Tline; X Ttoggled = TRUE; X screen->page = screen->cur; X return; } X void TekSetFontSize (gw, newitem) X Widget gw; X int newitem; { X register TScreen *screen = &term->screen; X int oldsize = screen->cur.fontsize; X int newsize = MI2FS(newitem); X X if (oldsize == newsize) return; X if (!Ttoggled) TCursorToggle(TOGGLE); X set_tekfont_menu_item (oldsize, FALSE); X TekSetGCFont (newsize); X screen->cur.fontsize = newsize; X set_tekfont_menu_item (newsize, TRUE); X if (!Ttoggled) TCursorToggle(TOGGLE); } X TekReverseVideo(screen) register TScreen *screen; { X register int i; X XGCValues gcv; X X X i = screen->Tbackground; X screen->Tbackground = screen->Tforeground; X screen->Tforeground = i; X X XSetForeground(screen->display, screen->TnormalGC, X screen->Tforeground); X XSetBackground(screen->display, screen->TnormalGC, X screen->Tbackground); X X if (tekWidget) { X if (tekWidget->core.border_pixel == screen->Tbackground) { X tekWidget->core.border_pixel = screen->Tforeground; X tekWidget->core.parent->core.border_pixel = X screen->Tforeground; X if (tekWidget->core.parent->core.window) X XSetWindowBorder (screen->display, X tekWidget->core.parent->core.window, X tekWidget->core.border_pixel); X } X } X X for(i = 0 ; i < TEKNUMLINES ; i++) { X XSetForeground(screen->display, screen->linepat[i], X screen->Tforeground); X } X X screen->Tcursorcolor = screen->Tforeground; X X gcv.plane_mask = screen->xorplane = (screen->Tbackground ^ X screen->Tcursorcolor); X XChangeGC (screen->display, screen->TcursorGC, GCPlaneMask, &gcv); X TekBackground(screen); } X TekBackground(screen) register TScreen *screen; { X if(TWindow(screen)) X XSetWindowBackground(screen->display, TWindow(screen), X screen->Tbackground); } X /* X * Toggles cursor on or off at cursor position in screen. X */ TCursorToggle(toggle) int toggle; { X register TScreen *screen = &term->screen; X register int c, x, y; X unsigned int cellwidth, cellheight; X X if (!screen->Tshow) return; X X c = screen->cur.fontsize; X cellwidth = (unsigned) tekWidget->tek.Tfont[c]->max_bounds.width; X cellheight = (unsigned) (tekWidget->tek.Tfont[c]->ascent + X tekWidget->tek.Tfont[c]->descent); X X x = (screen->cur_X * TekScale(screen)) + screen->border; X y = ((TEKHEIGHT + TEKTOPPAD - screen->cur_Y) * TekScale(screen)) + X screen->border - tekWidget->tek.tobaseline[c]; X if (toggle) { X if (screen->select || screen->always_highlight) X XFillRectangle( X screen->display, TWindow(screen), screen->TcursorGC, X x, y, cellwidth, cellheight); X else { /* fix to use different GC! */ X screen->Tbox[c]->x = x; X screen->Tbox[c]->y = y ; X XDrawLines(screen->display, TWindow(screen), X screen->TcursorGC, X screen->Tbox[c], NBOX, CoordModePrevious); X } X } else { X if (screen->select || screen->always_highlight) X XClearArea(screen->display, TWindow(screen), x, y, X cellwidth, cellheight, FALSE); X else { X screen->Tbox[c]->x = x; X screen->Tbox[c]->y = y ; X XDrawLines(screen->display, TWindow(screen), X screen->TcursorGC, X screen->Tbox[c], NBOX, CoordModePrevious); X } X } } X void TekSimulatePageButton (reset) X Bool reset; { X register TScreen *screen = &term->screen; X X if (reset) { /* bzero ((char *)&curmodes, sizeof(Tmodes)); */ X bzero ((char *) &screen->cur, sizeof screen->cur); X } X TekRefresh = (TekLink *)0; /* screen->cur = curmodes; */ X TekPage (); X screen->cur_X = 0; X screen->cur_Y = TEKHOME; } X X TekCopy() { X register TekLink *Tp; X register int fd; X register TScreen *screen = &term->screen; X register struct tm *tp; X long l; X char buf[32]; X X time(&l); X tp = localtime(&l); X sprintf(buf, "COPY%02d-%02d-%02d.%02d:%02d:%02d", tp->tm_year, X tp->tm_mon, tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec); X if(access(buf, F_OK) >= 0) { /* file exists */ X if(access(buf, W_OK) < 0) { X Bell(); X return; X } X } else if(access(".", W_OK) < 0) { /* can't write in directory */ X Bell(); X return; X } X if((fd = open(buf, O_WRONLY | O_CREAT | O_TRUNC, 0644)) < 0) { X Bell(); X return; X } X chown(buf, screen->uid, screen->gid); X sprintf(buf, "\033%c\033%c", screen->page.fontsize + '8', X screen->page.linetype + '`'); X write(fd, buf, 4); X Tp = &Tek0; X do X write(fd, (char *)Tp->data, Tp->count); X while(Tp = Tp->next); X close(fd); } X X X SHAR_EOF echo 'File kterm-4.1.2/Tekproc.c is complete' && chmod 0664 kterm-4.1.2/Tekproc.c || echo 'restore of kterm-4.1.2/Tekproc.c failed' Wc_c="`wc -c < 'kterm-4.1.2/Tekproc.c'`" test 39998 -eq "$Wc_c" || echo 'kterm-4.1.2/Tekproc.c: original size 39998, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= kterm-4.1.2/VTPrsTbl.c ============== if test -f 'kterm-4.1.2/VTPrsTbl.c' -a X"$1" != X"-c"; then echo 'x - skipping kterm-4.1.2/VTPrsTbl.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting kterm-4.1.2/VTPrsTbl.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'kterm-4.1.2/VTPrsTbl.c' && /* X * $XConsortium: VTPrsTbl.c,v 1.4 89/03/01 19:59:43 jim Exp $ X * $Kagotani: /usr/src.yoshi/X/KTerm/4.1.0/RCS/VTPrsTbl.c,v 1.1 90/06/27 09:38:19 kagotani Rel $ X * X * $Header: /usr/local/src/X11/contrib/clients/kterm-4.1.2/RCS/VTPrsTbl.c,v 1.3 1991/01/16 07:06:00 mleisher Exp $ X */ X /* X * Modified for Hanzi support: X * Mark Leisher mleisher@nmsu.edu Fri Nov 9 09:22:33 1990 X */ X #include "kterm.h" X X #include <X11/copyright.h> X /* X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. X * X * All Rights Reserved X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, X * provided that the above copyright notice appear in all copies and that X * both that copyright notice and this permission notice appear in X * supporting documentation, and that the name of Digital Equipment X * Corporation not be used in advertising or publicity pertaining to X * distribution of the software without specific, written prior permission. X * X * X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS X * SOFTWARE. X */ X #ifndef lint static char *rcsid_VTparsetable_c = "$XConsortium: VTPrsTbl.c,v 1.4 89/03/01 19:59:43 jim Exp $"; #endif /* lint */ X #include "VTparse.h" #ifndef lint static char rcs_id[] = "$XConsortium: VTPrsTbl.c,v 1.4 89/03/01 19:59:43 jim Exp $"; #endif /* lint */ X /* X * Stupid Apollo C preprocessor can't handle long lines. So... To keep X * it happy, we put each onto a seperate line.... Sigh... X */ X int groundtable[] = { /* NUL SOH STX ETX */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ CASE_BS, CASE_TAB, CASE_VMOT, CASE_VMOT, /* NP CR SO SI */ CASE_VMOT, CASE_CR, CASE_SO, CASE_SI, /* DLE DC1 DC2 DC3 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* DC4 NAK SYN ETB */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* $ % & ' */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* ( ) * + */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* , - . / */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* 0 1 2 3 */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* 4 5 6 7 */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* 8 9 : ; */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* < = > ? */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* @ A B C */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* D E F G */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* H I J K */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* L M N O */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* P Q R S */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* T U V W */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* X Y Z [ */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* \ ] ^ _ */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* ` a b c */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* d e f g */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* h i j k */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* l m n o */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* p q r s */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* t u v w */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* x y z { */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* | } ~ DEL */ CASE_PRINT, CASE_PRINT, CASE_PRINT, #ifdef KTERM CASE_PRINT, #else /* !KTERM */ CASE_GROUND_STATE, #endif /* !KTERM */ /* 0x80 0x81 0x82 0x83 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x84 0x85 0x86 0x87 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x88 0x89 0x8a 0x8b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x8c 0x8d 0x8e 0x8f */ CASE_IGNORE, CASE_IGNORE, #ifdef KTERM CASE_SS2, CASE_SS3, #else /* !KTERM */ CASE_IGNORE, CASE_IGNORE, #endif /* !KTERM */ /* 0x90 0x91 0x92 0x93 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x94 0x95 0x96 0x97 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x98 0x99 0x9a 0x9b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, #ifdef KTERM CASE_CSI_STATE, #else /* !KTERM */ CASE_IGNORE, #endif /* !KTERM */ /* 0x9c 0x9d 0x9e 0x9f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* nobreakspace exclamdown cent sterling */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* currency yen brokenbar section */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* diaeresis copyright ordfeminine guillemotleft */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* notsign hyphen registered macron */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* degree plusminus twosuperior threesuperior */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* acute mu paragraph periodcentered */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* cedilla onesuperior masculine guillemotright */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* onequarter onehalf threequarters questiondown */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* Agrave Aacute Acircumflex Atilde */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* Adiaeresis Aring AE Ccedilla */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* Egrave Eacute Ecircumflex Ediaeresis */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* Igrave Iacute Icircumflex Idiaeresis */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* Eth Ntilde Ograve Oacute */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* Ocircumflex Otilde Odiaeresis multiply */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* Ooblique Ugrave Uacute Ucircumflex */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* Udiaeresis Yacute Thorn ssharp */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* agrave aacute acircumflex atilde */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* adiaeresis aring ae ccedilla */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* egrave eacute ecircumflex ediaeresis */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* igrave iacute icircumflex idiaeresis */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* eth ntilde ograve oacute */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* ocircumflex otilde odiaeresis division */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* oslash ugrave uacute ucircumflex */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* udiaeresis yacute thorn ydiaeresis */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, }; X int csitable[] = { /* NUL SOH STX ETX */ SHAR_EOF true || echo 'restore of kterm-4.1.2/VTPrsTbl.c failed' fi echo 'End of kterm-4.1.2 part 3' echo 'File kterm-4.1.2/VTPrsTbl.c is continued in part 4' echo 4 > _shar_seq_.tmp exit 0 ----------------------------------------------------------------------------- mleisher@nmsu.edu "I laughed. Mark Leisher I cried. Computing Research Lab I fell down. New Mexico State University It changed my life." Las Cruces, NM - Rich [Cowboy Feng's Space Bar and Grille] -- Dan Heller O'Reilly && Associates Z-Code Software Comp-sources-x: Senior Writer President comp-sources.x@uunet.uu.net argv@ora.com argv@zipcode.com