[comp.sources.x] v09i037: colxterm -- Color xterm, Part07/14

tomw@orac.esd.sgi.com (Tom Weinstein) (09/14/90)

Submitted-by: Tom Weinstein <tomw@orac.esd.sgi.com>
Posting-number: Volume 9, Issue 37
Archive-name: colxterm/part07

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# If this archive is complete, you will see the following message at the end:
#		"End of archive 7 (of 14)."
# Contents:  xterm/charproc.c.ac xterm/xterm.man.ab
# Wrapped by argv@turnpike on Thu Sep 13 20:42:23 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'xterm/charproc.c.ac' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xterm/charproc.c.ac'\"
else
echo shar: Extracting \"'xterm/charproc.c.ac'\" \(28743 characters\)
sed "s/^X//" >'xterm/charproc.c.ac' <<'END_OF_FILE'
X		bcnt++;
X	}
X	bcnt += (i = Tbcnt);
X	for( ; i > 0 ; i--)
X		*bptr++ = *Tbptr++;
X	bptr = buffer;
X	if(!setjmp(VTend))
X		VTparse();
X	HideCursor();
X	screen->cursor_set = OFF;
X}
X
X/*ARGSUSED*/
Xstatic void VTExpose(w, event, region)
XWidget w;
XXEvent *event;
XRegion region;
X{
X	register TScreen *screen = &term->screen;
X
X#ifdef DEBUG
X	if(debug)
X		fputs("Expose\n", stderr);
X#endif	/* DEBUG */
X	if (event->type == Expose)
X		HandleExposure (screen, (XExposeEvent *)event);
X}
X
Xstatic void VTGraphicsOrNoExpose (event)
XXEvent *event;
X    {
X	register TScreen *screen = &term->screen;
X	if (screen->incopy <= 0) {
X		screen->incopy = 1;
X		if (screen->scrolls > 0)
X			screen->scrolls--;
X	}
X	if (event->type == GraphicsExpose)
X	  if (HandleExposure (screen, (XExposeEvent *)event))
X		screen->cursor_state = OFF;
X	if ((event->type == NoExpose) || ((XGraphicsExposeEvent *)event)->count == 0) {
X		if (screen->incopy <= 0 && screen->scrolls > 0)
X			screen->scrolls--;
X		if (screen->scrolls)
X			screen->incopy = -1;
X		else
X			screen->incopy = 0;
X	}
X}
X
X/*ARGSUSED*/
Xstatic void VTNonMaskableEvent (w, closure, event)
XWidget w;
Xcaddr_t closure;
XXEvent *event;
X    {
X    switch (event->type) {
X       case MappingNotify:
X	  XRefreshKeyboardMapping (&event->xmapping);
X	  break;
X       case GraphicsExpose:
X       case NoExpose:
X	  VTGraphicsOrNoExpose (event);
X	  break;
X	  }
X    }
X
X
X
X
Xstatic void VTResize(w)
X    Widget w;
X{
X    if (XtIsRealized(w))
X      ScreenResize (&term->screen, term->core.width, term->core.height,
X		    &term->flags);
X}
X
X
Xint VTInit ()
X{
X    register TScreen *screen = &term->screen;
X
X    XtRealizeWidget (term->core.parent);
X    if (screen->allbuf == NULL) VTallocbuf ();
X    return (1);
X}
X
Xstatic void VTallocbuf ()
X{
X    register TScreen *screen = &term->screen;
X    int nrows = screen->max_row + 1;
X    extern ScrnBuf Allocate();
X
X    /* allocate screen buffer now, if necessary. */
X    if (screen->scrollWidget)
X      nrows += screen->savelines;
X    screen->allbuf = Allocate (nrows, screen->max_col + 1,
X     &screen->sbuf_address);
X    if (screen->scrollWidget)
X      screen->buf = &screen->allbuf[4 * screen->savelines];
X    else
X      screen->buf = screen->allbuf;
X    return;
X}
X
Xstatic void VTInitialize (request, new)
X   XtermWidget request, new;
X{
X   int i;
X   /* Zero out the entire "screen" component of "new" widget,
X      then do field-by-field assigment of "screen" fields
X      that are named in the resource list. */
X
X   bzero ((char *) &new->screen, sizeof(new->screen));
X   new->screen.c132 = request->screen.c132;
X   new->screen.curses = request->screen.curses;
X   new->screen.foreground = request->screen.foreground;
X   new->screen.cursorcolor = request->screen.cursorcolor;
X   new->screen.border = request->screen.border;
X   new->screen.jumpscroll = request->screen.jumpscroll;
X   new->screen.bltscroll = request->screen.bltscroll;
X   new->screen.logfile = request->screen.logfile;
X   new->screen.marginbell = request->screen.marginbell;
X   new->screen.mousecolor = request->screen.mousecolor;
X   new->screen.mousecolorback = request->screen.mousecolorback;
X   new->screen.multiscroll = request->screen.multiscroll;
X   new->screen.nmarginbell = request->screen.nmarginbell;
X   new->screen.savelines = request->screen.savelines;
X   new->screen.scrolllines = request->screen.scrolllines;
X   new->screen.scrollttyoutput = request->screen.scrollttyoutput;
X   new->screen.scrollkey = request->screen.scrollkey;
X   new->screen.visualbell = request->screen.visualbell;
X   new->screen.TekEmu = request->screen.TekEmu;
X   new->misc.re_verse = request->misc.re_verse;
X   new->screen.multiClickTime = request->screen.multiClickTime;
X   new->screen.charClass = request->screen.charClass;
X   new->screen.cutNewline = request->screen.cutNewline;
X   new->screen.cutToBeginningOfLine = request->screen.cutToBeginningOfLine;
X   new->screen.always_highlight = request->screen.always_highlight;
X   new->screen.pointer_cursor = request->screen.pointer_cursor;
X   new->screen.input_eight_bits = request->screen.input_eight_bits;
X   new->screen.output_eight_bits = request->screen.output_eight_bits;
X   new->screen.allowSendEvents = request->screen.allowSendEvents;
X   new->misc.titeInhibit = request->misc.titeInhibit;
X   for (i = 0; i < NMENUFONTS; i++) {
X       new->screen.menu_font_names[i] = request->screen.menu_font_names[i];
X   }
X   for (i = 0; i < MAXCOLORS; i++) {
X       new->screen.colors[i] = request->screen.colors[i];
X   }
X   /* set default in realize proc */
X   new->screen.menu_font_names[fontMenu_fontdefault] = NULL;
X   new->screen.menu_font_names[fontMenu_fontescape] = NULL;
X   new->screen.menu_font_names[fontMenu_fontsel] = NULL;
X   new->screen.menu_font_number = fontMenu_fontdefault;
X
X    /*
X     * The definition of -rv now is that it changes the definition of 
X     * XtDefaultForeground and XtDefaultBackground.  So, we no longer
X     * need to do anything special.
X     */
X   new->keyboard.flags = 0;
X   new->screen.display = new->core.screen->display;
X   new->core.height = new->core.width = 1;
X      /* dummy values so that we don't try to Realize the parent shell 
X	 with height or width of 0, which is illegal in X.  The real
X	 size is computed in the xtermWidget's Realize proc,
X	 but the shell's Realize proc is called first, and must see
X	 a valid size. */
X
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, (Opaque)NULL);
X   XtAddEventHandler(XtParent(new), LeaveWindowMask, FALSE,
X		HandleLeaveWindow, (Opaque)NULL);
X   XtAddEventHandler(XtParent(new), FocusChangeMask, FALSE,
X		HandleFocusChange, (Opaque)NULL);
X   XtAddEventHandler((Widget)new, 0L, TRUE,
X		VTNonMaskableEvent, (Opaque)NULL);
X
X   set_character_class (new->screen.charClass);
X
X   /* create it, but don't realize it */
X   ScrollBarOn (new, TRUE, FALSE);
X   return;
X}
X
X
Xstatic void VTDestroy (w)
XWidget w;
X{
X    XtFree(((XtermWidget)w)->screen.selection);
X}
X
X/*ARGSUSED*/
Xstatic void VTRealize (w, valuemask, values)
XWidget w;
XXtValueMask *valuemask;
XXSetWindowAttributes *values;
X{
X	unsigned int width, height;
X	register TScreen *screen = &term->screen;
X	int xpos, ypos, pr;
X	extern char *malloc();
X	XSizeHints		sizehints;
X	extern int		VTgcFontMask;
X	int scrollbar_width;
X
X	TabReset (term->tabs);
X
X	screen->menu_font_names[fontMenu_fontdefault] = term->misc.f_n;
X	screen->fnt_norm = screen->fnt_bold = NULL;
X	if (!LoadNewFont(screen, term->misc.f_n, term->misc.f_b, False, 0)) {
X	    if (XmuCompareISOLatin1(term->misc.f_n, "fixed") != 0) {
X		fprintf (stderr, 
X		     "%s:  unable to open font \"%s\", trying \"fixed\"....\n",
X		     xterm_name, term->misc.f_n);
X		(void) LoadNewFont (screen, "fixed", NULL, False, 0);
X		screen->menu_font_names[fontMenu_fontdefault] = "fixed";
X	    }
X	}
X
X	/* really screwed if we couldn't open default font */
X	if (!screen->fnt_norm) {
X	    fprintf (stderr, "%s:  unable to locate a suitable font\n",
X		     xterm_name);
X	    Exit (1);
X	}
X
X	/* making cursor */
X	if (!screen->pointer_cursor) 
X	  screen->pointer_cursor = make_colored_cursor(XC_xterm, 
X						       screen->mousecolor,
X						       screen->mousecolorback);
X	else 
X	  recolor_cursor (screen->pointer_cursor, 
X			  screen->mousecolor, screen->mousecolorback);
X
X	scrollbar_width = (term->misc.scrollbar ?
X			   screen->scrollWidget->core.width : 0);
X
X
X	/* set defaults */
X	xpos = 1; ypos = 1; width = 80; height = 24;
X	pr = XParseGeometry (term->misc.geo_metry, &xpos, &ypos,
X			     &width, &height);
X	screen->max_col = (width - 1);	/* units in character cells */
X	screen->max_row = (height - 1);	/* units in character cells */
X	update_font_info (&term->screen, False);
X
X	width = screen->fullVwin.fullwidth;
X	height = screen->fullVwin.fullheight;
X
X	if ((pr & XValue) && (XNegative&pr)) 
X	  xpos += DisplayWidth(screen->display, DefaultScreen(screen->display))
X			- width - (term->core.parent->core.border_width * 2);
X	if ((pr & YValue) && (YNegative&pr))
X	  ypos += DisplayHeight(screen->display,DefaultScreen(screen->display))
X			- height - (term->core.parent->core.border_width * 2);
X
X	/* set up size hints for window manager; min 1 char by 1 char */
X	sizehints.base_width = 2 * screen->border + scrollbar_width;
X	sizehints.base_height = 2 * screen->border;
X	sizehints.width_inc = FontWidth(screen);
X	sizehints.height_inc = FontHeight(screen);
X	sizehints.min_width = sizehints.base_width + sizehints.width_inc;
X	sizehints.min_height = sizehints.base_height + sizehints.height_inc;
X	sizehints.flags = (PBaseSize|PMinSize|PResizeInc);
X	sizehints.x = xpos;
X	sizehints.y = ypos;
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	    /* set a default size, but do *not* set position */
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) term,
X				   (Dimension)width, (Dimension)height,
X				   &term->core.width, &term->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(term), term->core.parent->core.window,
X			 sizehints.x, sizehints.y);
X
X	XSetWMNormalHints (XtDisplay(term), term->core.parent->core.window,
X			   &sizehints);
X	XFlush (XtDisplay(term));	/* get it out to window manager */
X
X	values->bit_gravity = NorthWestGravity;
X	term->screen.fullVwin.window = term->core.window =
X	  XCreateWindow(XtDisplay(term), XtWindow(term->core.parent),
X		term->core.x, term->core.y,
X		term->core.width, term->core.height, term->core.border_width,
X		(int) term->core.depth,
X		InputOutput, CopyFromParent,	
X		*valuemask|CWBitGravity, values);
X
X	set_cursor_gcs (screen);
X
X	/* Reset variables used by ANSI emulation. */
X
X	screen->gsets[0] = 'B';			/* ASCII_G		*/
X	screen->gsets[1] = 'B';
X	screen->gsets[2] = 'B';			/* DEC supplemental.	*/
X	screen->gsets[3] = 'B';
X	screen->curgl = 0;			/* G0 => GL.		*/
X	screen->curgr = 2;			/* G2 => GR.		*/
X	screen->curss = 0;			/* No single shift.	*/
X
X	XDefineCursor(screen->display, VShellWindow, screen->pointer_cursor);
X
X        screen->cur_col = screen->cur_row = 0;
X	screen->max_col = Width(screen)/screen->fullVwin.f_width - 1;
X	screen->top_marg = 0;
X	screen->bot_marg = screen->max_row = Height(screen) /
X				screen->fullVwin.f_height - 1;
X
X	screen->sc.row = screen->sc.col = screen->sc.flags = NULL;
X
X	/* Mark screen buffer as unallocated.  We wait until the run loop so
X	   that the child process does not fork and exec with all the dynamic
X	   memory it will never use.  If we were to do it here, the
X	   swap space for new process would be huge for huge savelines. */
X	if (!tekWidget)			/* if not called after fork */
X	  screen->buf = screen->allbuf = NULL;
X
X	screen->do_wrap = NULL;
X	screen->scrolls = screen->incopy = 0;
X	set_vt_box (screen);
X
X	screen->savedlines = 0;
X
X	if (term->misc.scrollbar) {
X		screen->scrollbar = 0;
X		ScrollBarOn (term, FALSE, TRUE);
X	}
X	CursorSave (term, &screen->sc);
X	return;
X}
X
X/*
X * Shows cursor at new cursor position in screen.
X */
XShowCursor()
X{
X	register TScreen *screen = &term->screen;
X	register int x, y, flags;
X	Char c;
X	GC	currentGC;
X	Boolean	in_selection;
X
X	if (eventMode != NORMAL) return;
X
X	if (screen->cur_row - screen->topline > screen->max_row)
X		return;
X	c = screen->buf[y = 4 * (screen->cursor_row = screen->cur_row)]
X	 [x = screen->cursor_col = screen->cur_col];
X	flags = screen->buf[y + 1][x];
X	if (c == 0)
X		c = ' ';
X
X	if (screen->cur_row > screen->endHRow ||
X	    (screen->cur_row == screen->endHRow &&
X	     screen->cur_col >= screen->endHCol) ||
X	    screen->cur_row < screen->startHRow ||
X	    (screen->cur_row == screen->startHRow &&
X	     screen->cur_col < screen->startHCol))
X	    in_selection = False;
X	else
X	    in_selection = True;
X
X	if(screen->select || screen->always_highlight) {
X		if (( (flags & INVERSE) && !in_selection) ||
X		    (!(flags & INVERSE) &&  in_selection)){
X		    /* text is reverse video */
X		    if (screen->cursorGC) {
X			currentGC = screen->cursorGC;
X		    } else {
X			if (flags & BOLD) {
X				currentGC = screen->normalboldGC;
X			} else {
X				currentGC = screen->normalGC;
X			}
X		    }
X		} else { /* normal video */
X		    if (screen->reversecursorGC) {
X			currentGC = screen->reversecursorGC;
X		    } else {
X			if (flags & BOLD) {
X				currentGC = screen->reverseboldGC;
X			} else {
X				currentGC = screen->reverseGC;
X			}
X		    }
X		}
X	} else { /* not selected */
X		if (( (flags & INVERSE) && !in_selection) ||
X		    (!(flags & INVERSE) &&  in_selection)) {
X		    /* text is reverse video */
X			currentGC = screen->reverseGC;
X		} else { /* normal video */
X			currentGC = screen->normalGC;
X		}
X	    
X	}
X
X	x = CursorX (screen, screen->cur_col);
X	y = CursorY(screen, screen->cur_row) + 
X	  screen->fnt_norm->ascent;
X	XDrawImageString(screen->display, TextWindow(screen), currentGC,
X		x, y, (char *) &c, 1);
X
X	if((flags & BOLD) && screen->enbolden) /* no bold font */
X		XDrawString(screen->display, TextWindow(screen), currentGC,
X			x + 1, y, (char *) &c, 1);
X	if(flags & UNDERLINE) 
X		XDrawLine(screen->display, TextWindow(screen), currentGC,
X			x, y+1, x + FontWidth(screen), y+1);
X	if (!screen->select && !screen->always_highlight) {
X		screen->box->x = x;
X		screen->box->y = y - screen->fnt_norm->ascent;
X		XDrawLines (screen->display, TextWindow(screen), 
X			    screen->cursoroutlineGC ? screen->cursoroutlineGC 
X			    			    : currentGC,
X			    screen->box, NBOX, CoordModePrevious);
X	}
X	screen->cursor_state = ON;
X}
X
X/*
X * hide cursor at previous cursor position in screen.
X */
XHideCursor()
X{
X	register TScreen *screen = &term->screen;
X	GC	currentGC;
X	register int x, y, flags;
X	char c;
X	Boolean	in_selection;
X
X	if(screen->cursor_row - screen->topline > screen->max_row)
X		return;
X	c = screen->buf[y = 4 * screen->cursor_row][x = screen->cursor_col];
X	flags = screen->buf[y + 1][x];
X
X	if (screen->cursor_row > screen->endHRow ||
X	    (screen->cursor_row == screen->endHRow &&
X	     screen->cursor_col >= screen->endHCol) ||
X	    screen->cursor_row < screen->startHRow ||
X	    (screen->cursor_row == screen->startHRow &&
X	     screen->cursor_col < screen->startHCol))
X	    in_selection = False;
X	else
X	    in_selection = True;
X
X	if (( (flags & INVERSE) && !in_selection) ||
X	    (!(flags & INVERSE) &&  in_selection)) {
X		if(flags & BOLD) {
X			currentGC = screen->reverseboldGC;
X		} else {
X			currentGC = screen->reverseGC;
X		}
X	} else {
X		if(flags & BOLD) {
X			currentGC = screen->normalboldGC;
X		} else {
X			currentGC = screen->normalGC;
X		}
X	}
X
X	if (c == 0)
X		c = ' ';
X	x = CursorX (screen, screen->cursor_col);
X	y = (((screen->cursor_row - screen->topline) * FontHeight(screen))) +
X	 screen->border;
X	y = y+screen->fnt_norm->ascent;
X	XDrawImageString(screen->display, TextWindow(screen), currentGC,
X		x, y, &c, 1);
X	if((flags & BOLD) && screen->enbolden)
X		XDrawString(screen->display, TextWindow(screen), currentGC,
X			x + 1, y, &c, 1);
X	if(flags & UNDERLINE) 
X		XDrawLine(screen->display, TextWindow(screen), currentGC,
X			x, y+1, x + FontWidth(screen), y+1);
X	screen->cursor_state = OFF;
X}
X
XVTReset(full)
Xint full;
X{
X	register TScreen *screen = &term->screen;
X
X	/* reset scrolling region */
X	screen->top_marg = 0;
X	screen->bot_marg = screen->max_row;
X	term->flags &= ~ORIGIN;
X	if(full) {
X		TabReset (term->tabs);
X		term->keyboard.flags = NULL;
X		screen->gsets[0] = 'B';
X		screen->gsets[1] = 'B';
X		screen->gsets[2] = 'B';
X		screen->gsets[3] = 'B';
X		screen->curgl = 0;
X		screen->curgr = 2;
X		screen->curss = 0;
X		ClearScreen(screen);
X		screen->cursor_state = OFF;
X		if (term->flags & REVERSE_VIDEO)
X			ReverseVideo(term);
X
X		term->flags = term->initflags;
X		if(screen->c132 && (term->flags & IN132COLUMNS)) {
X		        Dimension junk;
X			XtMakeResizeRequest(
X			    (Widget) term,
X			    (Dimension) 80*FontWidth(screen)
X				+ 2 * screen->border + screen->scrollbar,
X			    (Dimension) FontHeight(screen)
X			        * (screen->max_row + 1) + 2 * screen->border,
X			    &junk, &junk);
X			XSync(screen->display, FALSE);	/* synchronize */
X			if(QLength(screen->display) > 0)
X				xevents();
X		}
X		CursorSet(screen, 0, 0, term->flags);
X	}
X	longjmp(vtjmpbuf, 1);	/* force ground state in parser */
X}
X
X
X
X/*
X * set_character_class - takes a string of the form
X * 
X *                 low[-high]:val[,low[-high]:val[...]]
X * 
X * and sets the indicated ranges to the indicated values.
X */
X
Xint set_character_class (s)
X    register char *s;
X{
X    register int i;			/* iterator, index into s */
X    int len;				/* length of s */
X    int acc;				/* accumulator */
X    int low, high;			/* bounds of range [0..127] */
X    int base;				/* 8, 10, 16 (octal, decimal, hex) */
X    int numbers;			/* count of numbers per range */
X    int digits;				/* count of digits in a number */
X    static char *errfmt = "%s:  %s in range string \"%s\" (position %d)\n";
X    extern char *ProgramName;
X
X    if (!s || !s[0]) return -1;
X
X    base = 10;				/* in case we ever add octal, hex */
X    low = high = -1;			/* out of range */
X
X    for (i = 0, len = strlen (s), acc = 0, numbers = digits = 0;
X	 i < len; i++) {
X	char c = s[i];
X
X	if (isspace(c)) {
X	    continue;
X	} else if (isdigit(c)) {
X	    acc = acc * base + (c - '0');
X	    digits++;
X	    continue;
X	} else if (c == '-') {
X	    low = acc;
X	    acc = 0;
X	    if (digits == 0) {
X		fprintf (stderr, errfmt, ProgramName, "missing number", s, i);
X		return (-1);
X	    }
X	    digits = 0;
X	    numbers++;
X	    continue;
X	} else if (c == ':') {
X	    if (numbers == 0)
X	      low = acc;
X	    else if (numbers == 1)
X	      high = acc;
X	    else {
X		fprintf (stderr, errfmt, ProgramName, "too many numbers",
X			 s, i);
X		return (-1);
X	    }
X	    digits = 0;
X	    numbers++;
X	    acc = 0;
X	    continue;
X	} else if (c == ',') {
X	    /*
X	     * now, process it
X	     */
X
X	    if (high < 0) {
X		high = low;
X		numbers++;
X	    }
X	    if (numbers != 2) {
X		fprintf (stderr, errfmt, ProgramName, "bad value number", 
X			 s, i);
X	    } else if (SetCharacterClassRange (low, high, acc) != 0) {
X		fprintf (stderr, errfmt, ProgramName, "bad range", s, i);
X	    }
X
X	    low = high = -1;
X	    acc = 0;
X	    digits = 0;
X	    numbers = 0;
X	    continue;
X	} else {
X	    fprintf (stderr, errfmt, ProgramName, "bad character", s, i);
X	    return (-1);
X	}				/* end if else if ... else */
X
X    }
X
X    if (low < 0 && high < 0) return (0);
X
X    /*
X     * now, process it
X     */
X
X    if (high < 0) high = low;
X    if (numbers < 1 || numbers > 2) {
X	fprintf (stderr, errfmt, ProgramName, "bad value number", s, i);
X    } else if (SetCharacterClassRange (low, high, acc) != 0) {
X	fprintf (stderr, errfmt, ProgramName, "bad range", s, i);
X    }
X
X    return (0);
X}
X
X/* ARGSUSED */
Xstatic void HandleKeymapChange(w, event, params, param_count)
X    Widget w;
X    XEvent *event;
X    String *params;
X    Cardinal *param_count;
X{
X    static XtTranslations keymap, original;
X    static XtResource resources[] = {
X	{ XtNtranslations, XtCTranslations, XtRTranslationTable,
X	      sizeof(XtTranslations), 0, XtRTranslationTable, (caddr_t)NULL}
X    };
X    char mapName[1000];
X    char mapClass[1000];
X
X    if (*param_count != 1) return;
X
X    if (original == NULL) original = w->core.tm.translations;
X
X    if (strcmp(params[0], "None") == 0) {
X	XtOverrideTranslations(w, original);
X	return;
X    }
X    (void) sprintf( mapName, "%sKeymap", params[0] );
X    (void) strcpy( mapClass, mapName );
X    if (islower(mapClass[0])) mapClass[0] = toupper(mapClass[0]);
X    XtGetSubresources( w, (XtPointer)&keymap, mapName, mapClass,
X		       resources, (Cardinal)1, NULL, (Cardinal)0 );
X    if (keymap != NULL)
X	XtOverrideTranslations(w, keymap);
X}
X
X
X/* ARGSUSED */
Xstatic void HandleBell(w, event, params, param_count)
X    Widget w;
X    XEvent *event;		/* unused */
X    String *params;		/* [0] = volume */
X    Cardinal *param_count;	/* 0 or 1 */
X{
X    int percent = (*param_count) ? atoi(params[0]) : 0;
X
X    XBell( XtDisplay(w), percent );
X}
X
X
X/* ARGSUSED */
Xstatic void HandleIgnore(w, event, params, param_count)
X    Widget w;
X    XEvent *event;		/* unused */
X    String *params;		/* unused */
X    Cardinal *param_count;	/* unused */
X{
X    /* do nothing, but check for funny escape sequences */
X    (void) SendMousePosition(w, event);
X}
X
X
X/* ARGSUSED */
Xvoid DoSetSelectedFont(w, client_data, selection, type, value, length, format)
X    Widget w;
X    XtPointer client_data;
X    Atom *selection, *type;
X    XtPointer value;
X    unsigned long *length;
X    int *format;
X{
X    int len;
X    if (*type != XA_STRING || *format != 8) { Bell(); return; }
X    len = strlen(value);
X    if (len > 0) {
X	if (value[len-1] == '\n') value[len-1] = '\0';
X	if (!LoadNewFont (&term->screen, value, NULL, True, 
X			  fontMenu_fontescape))
X	  Bell();
X    }
X}
X
Xvoid FindFontSelection (atom_name, justprobe)
X    char *atom_name;
X    Bool justprobe;
X{
X    static AtomPtr *atoms;
X    static int atomCount = 0;
X    AtomPtr *pAtom;
X    int a;
X    Atom target;
X
X    if (!atom_name) atom_name = "PRIMARY";
X
X    for (pAtom = atoms, a = atomCount; a; a--, pAtom++) {
X	if (strcmp(atom_name, XmuNameOfAtom(*pAtom)) == 0) break;
X    }
X    if (!a) {
X	atoms = (AtomPtr*) XtRealloc ((char *)atoms,
X				      sizeof(AtomPtr)*(atomCount+1));
X	*(pAtom = &atoms[atomCount++]) = XmuMakeAtom(atom_name);
X    }
X
X    target = XmuInternAtom(XtDisplay(term), *pAtom);
X    if (justprobe) {
X	term->screen.menu_font_names[fontMenu_fontsel] = 
X	  XGetSelectionOwner(XtDisplay(term), target) ? _Font_Selected_ : NULL;
X    } else {
X	XtGetSelectionValue((Widget)term, target, XA_STRING,
X			    DoSetSelectedFont, NULL,
X			    XtLastTimestampProcessed(XtDisplay(term)));
X    }
X    return;
X}
X
X
X/* ARGSUSED */
Xvoid HandleSetFont(w, event, params, param_count)
X    Widget w;
X    XEvent *event;		/* unused */
X    String *params;		/* unused */
X    Cardinal *param_count;	/* unused */
X{
X    int fontnum;
X    char *name1 = NULL, *name2 = NULL;
X
X    if (*param_count == 0) {
X	fontnum = fontMenu_fontdefault;
X    } else {
X	int maxparams = 1;		/* total number of params allowed */
X
X	switch (params[0][0]) {
X	  case 'd': case 'D': case '0':
X	    fontnum = fontMenu_fontdefault; break;
X	  case '1':
X	    fontnum = fontMenu_font1; break;
X	  case '2':
X	    fontnum = fontMenu_font2; break;
X	  case '3':
X	    fontnum = fontMenu_font3; break;
X	  case '4':
X	    fontnum = fontMenu_font4; break;
X	  case 'e': case 'E':
X	    fontnum = fontMenu_fontescape; maxparams = 3; break;
X	  case 's': case 'S':
X	    fontnum = fontMenu_fontsel; maxparams = 2; break;
X	  default:
X	    Bell();
X	    return;
X	}
X	if (*param_count > maxparams) {	 /* see if extra args given */
X	    Bell();
X	    return;
X	}
X	switch (*param_count) {		/* assign 'em */
X	  case 3:
X	    name2 = params[2];
X	    /* fall through */
X	  case 2:
X	    name1 = params[1];
X	    break;
X	}
X    }
X
X    SetVTFont (fontnum, True, name1, name2);
X}
X
X
Xvoid SetVTFont (i, doresize, name1, name2)
X    int i;
X    Bool doresize;
X    char *name1, *name2;
X{
X    TScreen *screen = &term->screen;
X
X    if (i < 0 || i >= NMENUFONTS) {
X	Bell();
X	return;
X    }
X    if (i == fontMenu_fontsel) {	/* go get the selection */
X	FindFontSelection (name1, False);  /* name1 = atom, name2 is ignored */
X	return;
X    }
X    if (!name1) name1 = screen->menu_font_names[i];
X    if (!LoadNewFont(screen, name1, name2, doresize, i)) {
X	Bell();
X    }
X    return;
X}
X
X
Xint LoadNewFont (screen, nfontname, bfontname, doresize, fontnum)
X    TScreen *screen;
X    char *nfontname, *bfontname;
X    Bool doresize;
X    int fontnum;
X{
X    XFontStruct *nfs = NULL, *bfs = NULL;
X    XGCValues xgcv;
X    unsigned long mask;
X    GC new_normalGC = NULL, new_normalboldGC = NULL;
X    GC new_reverseGC = NULL, new_reverseboldGC = NULL;
X    char *tmpname = NULL;
X
X    if (!nfontname) return 0;
X
X    if (fontnum == fontMenu_fontescape &&
X	nfontname != screen->menu_font_names[fontnum]) {
X	tmpname = (char *) malloc (strlen(nfontname) + 1);
X	if (!tmpname) return 0;
X	strcpy (tmpname, nfontname);
X    }
X
X    if (!(nfs = XLoadQueryFont (screen->display, nfontname))) goto bad;
X
X    if (!(bfontname && 
X	  (bfs = XLoadQueryFont (screen->display, bfontname))))
X      bfs = nfs;
X
X    mask = (GCFont | GCForeground | GCBackground | GCGraphicsExposures |
X	    GCFunction);
X
X    xgcv.font = nfs->fid;
X    xgcv.foreground = screen->foreground;
X    xgcv.background = term->core.background_pixel;
X    xgcv.graphics_exposures = TRUE;	/* default */
X    xgcv.function = GXcopy;
X
X    new_normalGC = XCreateGC(screen->display,
X			     DefaultRootWindow(screen->display), mask, &xgcv);
X    if (!new_normalGC) goto bad;
X
X    if (nfs == bfs) {			/* there is no bold font */
X	new_normalboldGC = new_normalGC;
X    } else {
X	xgcv.font = bfs->fid;
X	new_normalboldGC = XCreateGC(screen->display,
X				     DefaultRootWindow(screen->display),
X				     mask, &xgcv);
X	if (!new_normalboldGC) goto bad;
X    }
X
X    xgcv.font = nfs->fid;
X    xgcv.foreground = term->core.background_pixel;
X    xgcv.background = screen->foreground;
X    new_reverseGC = XCreateGC(screen->display,
X			      DefaultRootWindow(screen->display), mask, &xgcv);
X    if (!new_reverseGC) goto bad;
X
X    if (nfs == bfs) {			/* there is no bold font */
X	new_reverseboldGC = new_reverseGC;
X    } else {
X	xgcv.font = bfs->fid;
X	new_reverseboldGC = XCreateGC(screen->display,
X				       DefaultRootWindow(screen->display),
X				       mask, &xgcv);
X	if (!new_reverseboldGC) goto bad;
X    }
X
X    if (screen->normalGC)
X      XFreeGC (screen->display, screen->normalGC);
X    if (screen->normalGC != screen->normalboldGC)
X      XFreeGC (screen->display, screen->normalboldGC);
X    if (screen->reverseGC)
X      XFreeGC (screen->display, screen->reverseGC);
X    if (screen->reverseGC != screen->reverseboldGC)
X      XFreeGC (screen->display, screen->reverseboldGC);
X    screen->normalGC = new_normalGC;
X    screen->normalboldGC = new_normalboldGC;
X    screen->reverseGC = new_reverseGC;
X    screen->reverseboldGC = new_reverseboldGC;
X    screen->fnt_norm = nfs;
X    screen->fnt_bold = bfs;
X    screen->fnt_bold = screen->fnt_norm;
X    screen->enbolden = (nfs == bfs);
X    set_menu_font (False);
X    screen->menu_font_number = fontnum;
X    set_menu_font (True);
X    if (tmpname) {			/* if setting escape or sel */
X	if (screen->menu_font_names[fontnum])
X	  free (screen->menu_font_names[fontnum]);
X	screen->menu_font_names[fontnum] = tmpname;
X	if (fontnum == fontMenu_fontescape) {
X	    set_sensitivity (term->screen.fontMenu,
X			     fontMenuEntries[fontMenu_fontescape].widget,
X			     TRUE);
X	}
X    }
X    set_cursor_gcs (screen);
X    update_font_info (screen, doresize);
X    return 1;
X
X  bad:
X    if (tmpname) free (tmpname);
X    if (new_normalGC)
X      XFreeGC (screen->display, screen->normalGC);
X    if (new_normalGC && new_normalGC != new_normalboldGC)
X      XFreeGC (screen->display, new_normalboldGC);
X    if (new_reverseGC)
X      XFreeGC (screen->display, new_reverseGC);
X    if (new_reverseGC && new_reverseGC != new_reverseboldGC)
X      XFreeGC (screen->display, new_reverseboldGC);
X    if (nfs) XFreeFont (screen->display, nfs);
X    if (nfs && nfs != bfs) XFreeFont (screen->display, bfs);
X    return 0;
X}
X
X
Xupdate_font_info (screen, doresize)
X    TScreen *screen;
X    Bool doresize;
X{
X    int i, j, width, height, scrollbar_width;
X
X    screen->fullVwin.f_width = screen->fnt_norm->max_bounds.width;
X    screen->fullVwin.f_height = (screen->fnt_norm->ascent +
X				 screen->fnt_norm->descent);
X    scrollbar_width = (term->misc.scrollbar ? 
X		       screen->scrollWidget->core.width : 0);
X    i = 2 * screen->border + scrollbar_width;
X    j = 2 * screen->border;
X    width = (screen->max_col + 1) * screen->fullVwin.f_width + i;
X    height = (screen->max_row + 1) * screen->fullVwin.f_height + j;
X    screen->fullVwin.fullwidth = width;
X    screen->fullVwin.fullheight = height;
X    screen->fullVwin.width = width - i;
X    screen->fullVwin.height = height - j;
X
X    if (doresize) {
X	if (VWindow(screen)) {
X	    XClearWindow (screen->display, VWindow(screen));
X	}
X	DoResizeScreen (term);		/* set to the new natural size */
X	if (screen->scrollWidget)
X	  ResizeScrollBar (screen->scrollWidget, -1, -1,
X			   Height(screen) + screen->border * 2);
X	Redraw ();
X    }
X    set_vt_box (screen);
X}
END_OF_FILE
if test 28743 -ne `wc -c <'xterm/charproc.c.ac'`; then
    echo shar: \"'xterm/charproc.c.ac'\" unpacked with wrong size!
fi
# end of 'xterm/charproc.c.ac'
fi
if test -f 'xterm/xterm.man.ab' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xterm/xterm.man.ab'\"
else
echo shar: Extracting \"'xterm/xterm.man.ab'\" \(24080 characters\)
sed "s/^X//" >'xterm/xterm.man.ab' <<'END_OF_FILE'
XUnlike the VT102 window, the Tektronix window dows not allow the copying of
Xtext.
XIt does allow Tektronix GIN mode, and in this mode
Xthe cursor will change from an arrow to a cross.
XPressing any key will send that key and the current coordinate of the
Xcross cursor.
XPressing button one, two, or three will return the letters `l', `m', and
X`r', respectively.
XIf the `shift' key is pressed when a pointer button is pressed, the corresponding
Xupper case letter is sent.
XTo distinguish a pointer button from a key, the high bit of the character is
Xset (but this is bit is normally stripped unless the terminal mode is RAW;
Xsee
X.IR tty (4)
Xfor details).
X.SH MENUS
X.PP
X.I Xterm
Xhas four menus, named
X.IR mainMenu ,
X.IR vtMenu ,
X.IR fontMenu ,
Xand
X.IR tekMenu .
XEach menu pops up under the correct combinations of key and button presses.
XMost menus are divided into two section, separated by a horizontal line.
XThe top portion contains various modes that can be altered.
XA check mark appears next to a mode that is currently active.
XSelecting one of these modes toggles its state.
XThe bottom portion of the menu are command entries; selecting one of these
Xperforms the indicated function.
X.PP
XThe
X.B xterm
Xmenu pops up when the ``control'' key and pointer button one are
Xpressed in a window.
XThe \fImainMenu\fP contains items that apply to both the VT102 and Tektronix
Xwindows.
XThe
X.B Secure Keyboard
Xmode is be used when typing in passwords or other sensitive data in an
Xunsecure environment;
Xsee \fBSECURITY\fP below.
XNotable entries in the command section of the menu are the
X.BR Continue ,
X.BR Suspend ,
X.BR Interrupt ,
X.BR Hangup ,
X.B Terminate
Xand
X.B Kill
Xwhich sends the SIGCONT, SIGTSTP, SIGINT, SIGHUP, SIGTERM and
XSIGKILL signals, respectively, to the process group of the process running
Xunder
X.I xterm
X(usually the shell).
XThe
X.B Continue
Xfunction is especially useful if the user has accidentally typed CTRL-Z,
Xsuspending the process.
X.PP
XThe
X.I vtMenu
Xsets various modes in the VT102 emulation, and is popped up when the
X``control'' key and pointer button two are pressed in the VT102 window.
XIn the command section of this menu, the soft reset entry will reset
Xscroll regions.
XThis can be convenient when some program has left the scroll regions
Xset incorrectly (often a problem when using VMS or TOPS-20).
XThe full reset entry will clear the screen, reset tabs to every
Xeight columns, and reset the terminal modes (such as wrap and smooth scroll)
Xto their initial states just after
X.I xterm
Xhas finished processing the command line options.
X.PP
XThe \fIfontMenu\fP sets the font used in the VT102 window.
X.PP
XThe
X.I tekMenu
Xsets various modes in the Tektronix emulation, and is popped up when the
X``control'' key and pointer button two are pressed in the Tektronix window.
XThe current font size is checked in the modes section of the menu.
XThe
X.B PAGE
Xentry in the command section clears the Tektronix window.
X.SH SECURITY
X.PP
XX environments differ in their security consciousness.  MIT servers, run
Xunder \fIxdm\fP, are capable of using a ``magic cookie'' authorization
Xscheme that can provide a reasonable level of security for many people.
XIf your server is only using a host-based mechanism to control access to
Xthe server (see \fIxhost(1)\fP), then if you enable access for a host and
Xother users are also permitted to run clients on that same host, there is
Xevery possibility that someone can run an application that will use the
Xbasic services of the X protocol to snoop on your activities, potentially
Xcapturing a transcript of everything you type at the keyboard.
XThis is of particular concern when you want to type in a password or other
Xsensitive data.  The best solution to this problem is to use a better
Xauthorization mechanism that host-based control, but a simple
Xmechanism exists for protecting keyboard input in \fIxterm\fP.
X.PP
XThe \fBxterm\fP menu (see \fBMENUS\fP above) contains a \fBSecure Keyboard\fP
Xentry which, when enabled, ensures that all keyboard input is directed
X\fIonly\fP to \fIxterm\fP (using the GrabKeyboard protocol request).
XWhen an application prompts you for a password
X(or other sensitive data), you can enable \fBSecure Keyboard\fP using the
Xmenu, type in the data, and then disable \fBSecure Keyboard\fP using
Xthe menu again.  Only one X client at a time can secure the keyboard,
Xso when you attempt to enable \fBSecure Keyboard\fP it may fail.  In
Xthis case, the bell will sound.  If the \fBSecure Keyboard\fP succeeds,
Xthe foreground and background colors will be exchanged (as if you
Xselected the \fBReverse Video\fP entry in the \fBModes\fP menu);
Xthey will be exchanged again when you exit secure mode.  If the colors
Xdo \fInot\fP switch, then
Xyou should be \fIvery\fP suspicious that you are being spoofed.  If
Xthe application you are running displays a prompt before asking for
Xthe password, it is safest to enter secure mode \fIbefore\fP the
Xprompt gets displayed, and to make sure that the prompt gets displayed
Xcorrectly (in the new colors), to minimize the probability of
Xspoofing.  You can also bring up the menu again and make sure that a check
Xmark appears next to the entry.
X.PP
X\fBSecure Keyboard\fP mode will be disabled automatically if your xterm
Xwindow becomes iconified (or otherwise unmapped), or if you start up
Xa reparenting window manager (that places a title bar or other decoration
Xaround the window) while in \fBSecure Keyboard\fP mode.  (This is a
Xfeature of the X protocol not easily overcome.)  When this happens,
Xthe foreground and background colors will be switched back and the bell
Xwill sound in warning.
X.SH "CHARACTER CLASSES"
XClicking the middle mouse button twice in rapid succession will cause all
Xcharacters of the same class (e.g. letters, white space, punctuation) to be
Xselected.  Since different people have different preferences for what should
Xbe selected (for example, should filenames be selected as a whole or only
Xthe separate subnames), the default mapping can be overridden through the use 
Xof the \fIcharClass\fP (class \fICharClass\fP) resource.
X.PP
XThis resource is simply a list of \fIrange\fP:\fIvalue\fP pairs where the
Xrange is either a single number or \fIlow\fP-\fIhigh\fP in the range of 0
Xto 127, corresponding to the ASCII code for the character or characters to be
Xset.  The \fIvalue\fP is arbitrary, although the default table uses the
Xcharacter number of the first character occurring in the set.
X.PP
XThe default table is:
X.sp
X.in +10
X.nf
Xstatic int charClass[128] = {
X/* NUL  SOH  STX  ETX  EOT  ENQ  ACK  BEL */
X    32,   1,   1,   1,   1,   1,   1,   1,
X/*  BS   HT   NL   VT   NP   CR   SO   SI */
X     1,  32,   1,   1,   1,   1,   1,   1,
X/* DLE  DC1  DC2  DC3  DC4  NAK  SYN  ETB */
X     1,   1,   1,   1,   1,   1,   1,   1,
X/* CAN   EM  SUB  ESC   FS   GS   RS   US */
X     1,   1,   1,   1,   1,   1,   1,   1,
X/*  SP    !    "    #    $    %    &    ' */
X    32,  33,  34,  35,  36,  37,  38,  39,
X/*   (    )    *    +    ,    -    .    / */
X    40,  41,  42,  43,  44,  45,  46,  47,
X/*   0    1    2    3    4    5    6    7 */
X    48,  48,  48,  48,  48,  48,  48,  48,
X/*   8    9    :    ;    <    =    >    ? */
X    48,  48,  58,  59,  60,  61,  62,  63,
X/*   @    A    B    C    D    E    F    G */
X    64,  48,  48,  48,  48,  48,  48,  48,
X/*   H    I    J    K    L    M    N    O */
X    48,  48,  48,  48,  48,  48,  48,  48,
X/*   P    Q    R    S    T    U    V    W */ 
X    48,  48,  48,  48,  48,  48,  48,  48,
X/*   X    Y    Z    [    \\    ]    ^    _ */
X    48,  48,  48,  91,  92,  93,  94,  48,
X/*   `    a    b    c    d    e    f    g */
X    96,  48,  48,  48,  48,  48,  48,  48,
X/*   h    i    j    k    l    m    n    o */
X    48,  48,  48,  48,  48,  48,  48,  48,
X/*   p    q    r    s    t    u    v    w */
X    48,  48,  48,  48,  48,  48,  48,  48,
X/*   x    y    z    {    |    }    ~  DEL */
X    48,  48,  48, 123, 124, 125, 126,   1};
X.fi
X.sp
X.in -10
XFor example, the string ``33:48,37:48,45-47:48,64:48'' indicates that the
Xexclamation mark, percent sign, dash, period, slash, and ampersand characters
Xshould be treated the same way as characters and numbers.  This is very useful 
Xfor cutting and pasting electronic mailing addresses and filenames.
X.SH ACTIONS
XIt is possible to rebind keys (or sequences of keys) to arbitrary strings
Xfor input, by changing the translations for the vt100 or tek4014 widgets.
XChanging the translations for events other than key and button events
Xis not expected, and will cause unpredictable behavior.  The following
Xactions are provided for using within the \fIvt100\fP or \fItek4014\fP
X\fBtranslations\fP resources:
X.TP 8
X.B "bell([\fIpercent\fP])"
XThis action rings the keyboard bell at the specified percentage
Xabove or below the base volume.
X.TP 8
X.B "ignore()"
XThis action ignores the event but checks for special pointer position
Xescape sequences.
X.TP 8
X.B "insert()"
XThis action is a synonym for \fBinsert-seven-bit()\fP
X.TP 8
X.B "insert-seven-bit()"
XThis action inserts the 7-bit USASCII character or string associated with
Xthe keysym that was pressed.
X.TP 8
X.B "insert-eight-bit()"
XThis action inserts the 8-bit ISO Latin-1 character or string associated with
Xthe keysym that was pressed.
X.TP 8
X.B "insert-selection(\fIsourcename\fP [, ...])"
XThis action inserts the string found in the selection or cutbuffer indicated
Xby \fIsourcename\fP.  Sources are checked in the order given (case is
Xsignificant) until one is found.  Commonly-used selections include:
X\fIPRIMARY\fP, \fISECONDARY\fP, and \fICLIPBOARD\fP.  Cut buffers are 
Xtypically named \fICUT_BUFFER0\fP through \fICUT_BUFFER7\fP.
X.TP 8
X.B "keymap(\fIname\fP)"
XThis action dynamically defines a new translation table whose resource 
Xname is \fIname\fP with the suffix \fIKeymap\fP (case is significant).
XThe name \fINone\fP restores the original translation table.
X.TP 8
X.B "popup-menu(\fImenuname\fP)"
XThis action displays the specified popup menu.  Valid names (case is 
Xsignificant) include:  \fImainMenu\fP, \fIvtMenu\fP, \fIfontMenu\fP, 
Xand \fItekMenu\fP.
X.TP 8
X.B "secure()"
XThis action toggles the \fISecure Keyboard\fP mode described in the
Xsection named \fBSECURITY\fP, and is invoked from the \fBsecurekbd\fP
Xentry in \fImainMenu\fP.
X.TP 8
X.B "select-start()"
XThis action begins text selection at the current pointer location.  See
Xthe section on \fBPOINTER USAGE\fP for information on making selections.
X.TP 8
X.B "select-extend()"
XThis action tracks the pointer and extends the selection.  It 
Xshould only be bound to Motion events.
X.TP 8
X.B "select-end(\fIdestname\fP [, ...])"
XThis action puts the currently selected text into all of the selections or 
Xcutbuffers specified by \fIdestname\fP.
X.TP 8
X.B "select-cursor-start()"
XThis action is similar to \fBselect-start\fP except that it begins the
Xselection at the current text cursor position.
X.TP 8
X.B "select-cursor-end(\fIdestname\fP [, ...])"
XThis action is similar to \fBselect-end\fP except that it should be used
Xwith \fBselect-cursor-start\fP.
X.TP 8
X.B "set-vt-font(\fId/1/2/3/4/e/s\fP [,\fInormalfont\fP [, \fIboldfont\fP]])"
XThis action sets the font or fonts currently being used in the VT102 window.
XThe first argument is a single character that specifies the font to be 
Xused: \fId\fP or \fID\fP indicate the default font (the font initially 
Xused when
X\fIxterm\fP was started), \fI1\fP through \fI4\fP indicate the fonts 
Xspecified by the \fIfont1\fP through \fIfont4\fP resources, \fIe\fP or \fIE\fP
Xindicate the normal and bold fonts that may be set through escape codes 
X(or specified as the second and third action arguments, respectively), and
X\fIi\fP or \fII\fP indicate the font selection (as made by programs such as
X\fIxfontsel(1)\fP) indicated by the second action argument.
X.TP 8
X.B "start-extend()"
XThis action is similar to \fBselect-start\fB except that the 
Xselection is extended to the current pointer location.
X.TP 8
X.B "start-cursor-extend()"
XThis action is similar to \fBselect-extend\fP except that the 
Xselection is extended to the current text cursor position.
X.TP 8
X.B "string(\fIstring\fP)"
XThis action inserts the specified text string as if it had been typed.
XQuotation is necessary if the string contains whitespace or
Xnon-alphanumeric characters.  If the string argument begins with the
Xcharacters ``0x'', it is interpreted
Xas a hex character constant.
X.TP 8
X.B "scroll-back(\fIcount\fP [,\fIunits\fP])"
XThis action scrolls the text window backward so that text that had previously
Xscrolled off the top of the screen is now visible.  The \fIcount\fP argument
Xindicates the number of \fIunits\fP (which may be \fIpage\fP, \fIhalfpage\fP,
X\fIpixel\fP, or \fIline\fP) by which to scroll.
X.TP 8
X.B "scroll-forw(\fIcount\fP [,\fIunits\fP])"
XThis action scrolls is similar to \fBscroll-back\fP except that it scrolls
Xthe other direction.
X.TP 8
X.B "allow-send-events(\fIon/off/toggle\fP)"
XThis action set or toggles the \fBallowSendEvents\fP resource and is also
Xinvoked by the \fBallowsends\fP entry in \fImainMenu\fP.
X.TP 8
X.B "set-logging(\fIon/off/toggle\fP)"
XThis action toggles the \fBlogging\fP resource and is also invoked
Xby the \fBlogging\fP entry in \fImainMenu\fP.
X.TP 8
X.B "redraw()"
XThis action redraws the window and is also invoked by the
X\fIredraw\fP entry in \fImainMenu\fP.
X.TP 8
X.B "send-signal(\fIsigname\fP)"
XThis action sends the signal named by \fIsigname\fP (which may also be a 
Xnumber) to the \fIxterm\fP subprocess (the shell or program specified with
Xthe \fI-e\fP command line option) and is also invoked by the
X.BR suspend ,
X.BR continue ,
X.BR interrupt ,
X.BR hangup ,
X.BR terminate ,
Xand
X.I kill 
Xentries in \fImainMenu\fP.  Allowable signal names are (case is
Xnot significant):
X\fIsuspend\fP, \fItstp\fP (if supported by the operating system), \fIcont\fP
X(if supported by the operating system), \fIint\fP, \fIhup\fP, \fIterm\fP,
Xand \fIkill\fP.
X.TP 8
X.B "quit()"
XThis action sends a SIGHUP to the subprogram and exits.  It is also invoked
Xby the \fBquit\fP entry in \fImainMenu\fP.
X.TP 8
X.B "set-scrollbar(\fIon/off/toggle\fP)"
XThis action toggles the \fBscrollbar\fP resource and is also invoked by
Xthe \fBscrollbar\fP entry in \fIvtMenu\fP.
X.TP 8
X.B "set-jumpscroll(\fIon/off/toggle\fP)"
XThis action toggles the \fBjumpscroll\fP resource and is also invoked by the
X\fBjumpscroll\fP entry in \fIvtMenu\fP.
X.TP 8
X.B "set-bltscroll(\fIon/off/toggle\fP)"
XThis action toggles the \fBbltscroll\fP resource and is also invoked by the
X\fBbltscroll\fP entry in \fIvtMenu\fP.
X.TP 8
X.B "set-reverse-video(\fIon/off/toggle\fP)"
XThis action toggles the \fIreverseVideo\fP resource and is also invoked by
Xthe \fBreversevideo\fP entry in \fIvtMenu\fP.
X.TP 8
X.B "set-autowrap(\fIon/off/toggle\fP)"
XThis action toggles automatic wrapping of long lines and is also invoked by
Xthe \fBautowrap\fP entry in \fIvtMenu\fP.
X.TP 8
X.B "set-reversewrap(\fIon/off/toggle\fP)"
XThis action toggles the \fBreverseWrap\fP resource and is also invoked by
Xthe \fBreversewrap\fP entry in \fIvtMenu\fP.
X.TP 8
X.B "set-autolinefeed(\fIon/off/toggle\fP)"
XThis action toggles automatic insertion of linefeeds and is also invoked by
Xthe \fBautolinefeed\fP entry in \fIvtMenu\fP.
X.TP 8
X.B "set-appcursor(\fIon/off/toggle\fP)"
XThis action toggles the handling Application Cursor Key mode 
Xand is also invoked by the \Bappcursor\fP entry in \fIvtMenu\fP.
X.TP 8
X.B "set-appkeypad(\fIon/off/toggle\fP)"
XThis action toggles the handling of Application Keypad mode and is also 
Xinvoked by the \fBappkeypad\fP entry in \fIvtMenu\fP.
X.TP 8
X.B "set-scroll-on-key(\fIon/off/toggle\fP)"
XThis action toggles the \fBscrollKey\fP resource and is also invoked from
Xthe \fBscrollkey\fP entry in \fIvtMenu\fP.
X.TP 8
X.B "set-scroll-on-tty-output(\fIon/off/toggle\fP)"
XThis action toggles the \fBscrollTtyOutput\fP resource and is also invoked
Xfrom the \fBscrollttyoutput\fP entry in \fIvtMenu\fP.
X.TP 8
X.B "set-allow132(\fIon/off/toggle\fP)"
XThis action toggles the \fBc132\fP resource and is also invoked from the
X\fBallow132\fP entry in \fIvtMenu\fP.
X.TP 8
X.B "set-cursesemul(\fIon/off/toggle\fP)"
XThis action toggles the \fBcurses\fP resource and is also invoked from the 
X\fBcursesemul\fP entry in \fIvtMenu\fP.
X.TP 8
X.B "set-visual-bell(\fIon/off/toggle\fP)"
XThis action toggles the \fBvisualBell\fP resource and is also invoked
Xby the \fBvisualbell\fP entry in \fIvtMenu\fP.
X.TP 8
X.B "set-marginbell(\fIon/off/toggle\fP)"
XThis action toggles the \fBmarginBell\fP resource and is also invoked from 
Xthe \fBmarginbell\fP entry in \fIvtMenu\fP.
X.TP 8
X.B "set-altscreen(\fIon/off/toggle\fP)"
XThis action toggles between the alternative and current screens.
X.TP 8
X.B "soft-reset()"
XThis action resets the scrolling region and is also invoked from the 
X\fBsoftreset\fP entry in \fIvtMenu\fP.
X.TP 8
X.B "hard-reset()"
XThis action resets the scrolling region, tabs, window size, and cursor keys
Xand clears the screen.  It is also invoked from the \fBhardreset\fP
Xentry in \fIvtMenu\fP.
X.TP 8
X.B "set-terminal-type(\fItype\fP)"
XThis action directs output to either the \fIvt\fP or \fItek\fP windows,
Xaccording to the \fItype\fP string.  It is also invoked by the
X\fBtekmode\fP entry in \fIvtMenu\fP and the \fBvtmode\fP entry in
X\fItekMenu\fP. 
X.TP 8
X.B "set-visibility(\fIvt/tek\fP,\fIon/off/toggle\fP)"
XThis action controls whether or not the \fIvt\fP or \fItek\fP windows are
Xvisible.  It is also invoked from the \fBtekshow\fP and \fBvthide\fP entries 
Xin \fIvtMenu\fP and the \fBvtshow\fP and \fBtekhide\fP entries in 
X\fItekMenu\fP.
X.TP 8
X.B "set-tek-text(\fIlarge/2/3/small\fP)"
XThis action sets font used in the Tektronix window to the value of the 
Xresources \fBtektextlarge\fP, \fBtektext2\fP, \fBtektext3\fP, and
X\fBtektextsmall\fP according to the argument.  It is also by the entries
Xof the same names as the resources in \fItekMenu\fP.
X.TP 8
X.B "tek-page()"
XThis action clears the Tektronix window and is also invoked by the
X\fBtekpage\fP entry in \fItekMenu\fP.
X.TP 8
X.B "tek-reset()"
XThis action resets the Tektronix window and is also invoked by the
X\fItekreset\fP entry in \fItekMenu\fP.
X.TP 8
X.B "tek-copy()"
XThis action copies the escape codes used to generate the current window
Xcontents to a file in the current directory beginning with the name COPY.
XIt is also invoked from the \fItekcopy\fP entry in \fItekMenu\fP.
X.PP
XThe Tektronix window also has the following action:
X.TP 8
X.B "gin-press(\fIl/L/m/M/r/R\fP)"
XThis action send the indicated graphics input code.
X.PP
XThe default bindings in the VT102 window are:
X.sp
X.in +4
X.DS
X.TA 2.5i
X.ta 2.5i
X.nf
X Shift <KeyPress> Prior:	scroll-back(1,halfpage) \\n\\
X  Shift <KeyPress> Next:	scroll-forw(1,halfpage) \\n\\
XShift <KeyPress> Select:	select-cursor-start() \\
X	select-cursor-end(PRIMARY, CUT_BUFFER0) \\n\\
XShift <KeyPress> Insert:	insert-selection(PRIMARY, CUT_BUFFER0) \\n\\
X        ~Meta<KeyPress>: 	insert-seven-bit() \\n\\
X         Meta<KeyPress>: 	insert-eight-bit() \\n\\
X   Ctrl ~Meta<Btn1Down>:	popup-menu(mainMenu) \\n\\
X       ~Meta <Btn1Down>:	select-start() \\n\\
X     ~Meta <Btn1Motion>:	select-extend() \\n\\
X  Ctrl ~Meta <Btn2Down>:	popup-menu(vtMenu) \\n\\
X ~Ctrl ~Meta <Btn2Down>:	ignore() \\n\\
X   ~Ctrl ~Meta <Btn2Up>:	insert-selection(PRIMARY, CUT_BUFFER0) \\n\\
X  Ctrl ~Meta <Btn3Down>:	popup-menu(fontMenu) \\n\\
X ~Ctrl ~Meta <Btn3Down>:	start-extend() \\n\\
X     ~Meta <Btn3Motion>:	select-extend() \\n\\
X    ~Ctrl ~Meta <BtnUp>:	select-end(PRIMARY, CUT_BUFFER0) \\n\\
X              <BtnDown>:	bell(0)
X.fi
X.DE
X.sp
X.in -4
X.PP
XThe default bindings in the Tektronix window are:
X.sp
X.in +4
X.DS
X.TA 2.5i
X.ta 2.5i
X.nf
X      ~Meta<KeyPress>: 	insert-seven-bit() \\n\\
X       Meta<KeyPress>: 	insert-eight-bit()\\n\\
X Ctrl ~Meta<Btn1Down>:	popup-menu(mainMenu) \\n\\
XCtrl ~Meta <Btn2Down>:	popup-menu(tekMenu) \\n\\
XShift ~Meta<Btn1Down>:	gin-press(L) \\n\\
X      ~Meta<Btn1Down>:	gin-press(l) \\n\\
XShift ~Meta<Btn2Down>:	gin-press(M) \\n\\
X      ~Meta<Btn2Down>:	gin-press(m) \\n\\
XShift ~Meta<Btn3Down>:	gin-press(R) \\n\\
X      ~Meta<Btn3Down>:	gin-press(r)
X.fi
X.DE
X.sp
X.in -4
X.PP
XBelow is a sample how of the \fBkeymap()\fP action is used to add special
Xkeys for entering commonly-typed works:
X.sp
X.in +4
X.nf
X.DS
X.TA .5i 1.5i
X.ta .5i 1.5i
X.nf
X*VT100.Translations: #override <Key>F13: keymap(dbx)
X*VT100.dbxKeymap.translations: \\
X	<Key>F14:	keymap(None) \\n\\
X	<Key>F17:	string("next") string(0x0d) \\n\\
X	<Key>F18:	string("step") string(0x0d) \\n\\
X	<Key>F19:	string("continue") string(0x0d) \\n\\
X	<Key>F20:	string("print ") insert-selection(PRIMARY, CUT_BUFFER0)
X.fi
X.DE
X.sp
X.in -4
X.SH "OTHER FEATURES"
X.I Xterm
Xautomatically highlights the window border and text cursor when the
Xpointer enters the window (selected) and unhighlights them when the pointer
Xleaves the window (unselected).
XIf the window is the focus window, then the window is highlighted no matter
Xwhere the pointer is.
X.PP
XIn VT102 mode, there are escape sequences to activate and deactivate
Xan alternate screen buffer, which is the same size as the display area
Xof the window.
XWhen activated, the current screen is saved and replace with the alternate
Xscreen.
XSaving of lines scrolled off the top of the window is disabled until the
Xnormal screen is restored.
XThe
X.IR termcap (5)
Xentry for
X.I xterm
Xallows the visual editor
X.IR vi (1)
Xto switch to the alternate screen for editing, and restore the screen
Xon exit.  
X.PP
XIn VT102 mode,
X.I xterm
Xsupports the ISO 6429 extension of SGR allowing the setting of foreground
Xand background colors to eight predefined values in addition to the primary
Xrendition colors.  Concealed text is not yet supported.
X.PP
XIn either VT102 or Tektronix mode, there are escape sequences to change the
Xname of the windows and to specify a new log file name.
X.PP
XIn VT102 mode, there is an escape sequence to change the setting of
Xany color resource.  You may change the VT102 foreground and background colors
X(ISO 6429 primary rendition colors), text cursor color, pointer foreground
Xand background colors or Tektronix emulator foreground and background
Xcolors.
X.SH ENVIRONMENT
X.I Xterm
Xsets the environment variables ``TERM'' and ``TERMCAP'' properly for the
Xsize window you have created.
XIt also uses and sets the environment
Xvariable ``DISPLAY'' to specify which bit map display terminal to use.
XThe environment variable ``WINDOWID'' is set to the X window id number
Xof the
X.I xterm
Xwindow.
X.SH "SEE ALSO"
Xresize(1), X(1), pty(4), tty(4)
X.br
X.I \fIXterm Control Sequences\fP
X.SH BUGS
X.PP
XThe \fIXterm Control Sequences\fP document has yet to be converted from X10.
XThe old version, along with a first stab at an update, are available in
Xthe sources.
X.PP
XThe class name is \fIXTerm\fP instead of \fIXterm\fP.
X.PP
X\fBXterm will hang forever if you try to paste too much text at one time.\fP
XIt is both producer and consumer for the pty and can deadlock.
X.PP
XVariable-width fonts are not handled.
X.PP
XThis program still needs to be rewritten.  It should be split into very
Xmodular sections, with the various emulators being completely separate
Xwidgets that don't know about each other.  Ideally, you'd like to be able to
Xpick and choose emulator widgets and stick them into a single control widget.
X.PP
XThe focus is considered lost if some other client (e.g., the window manager)
Xgrabs the pointer; it is difficult to do better without an addition to the
Xprotocol.
X.PP
XThere needs to be a dialog box to allow entry of log file name
Xand the COPY file name.
X.PP
XMany of the options are not resettable after
X.I xterm
Xstarts.
X.PP
XThe Tek widget does not support key/button re-binding.
X.SH COPYRIGHT
XCopyright 1989, Massachusetts Institute of Technology.
X.br
XSee \fIX(1)\fP for a full statement of rights and permissions.
X.SH AUTHORS
XFar too many people, including:
X.sp
XLoretta Guarino Reid (DEC-UEG-WSL), 
XJoel McCormack (DEC-UEG-WSL), Terry Weissman (DEC-UEG-WSL),
XEdward Moy (Berkeley), Ralph R. Swick (MIT-Athena),
XMark Vandevoorde (MIT-Athena), Bob McNamara (DEC-MAD),
XJim Gettys (MIT-Athena), Bob Scheifler (MIT X Consortium), Doug Mink (SAO),
XSteve Pitschke (Stellar), Ron Newman (MIT-Athena), Jim Fulton (MIT X 
XConsortium), Dave Serisky (HP)
END_OF_FILE
if test 24080 -ne `wc -c <'xterm/xterm.man.ab'`; then
    echo shar: \"'xterm/xterm.man.ab'\" unpacked with wrong size!
fi
# end of 'xterm/xterm.man.ab'
fi
echo shar: End of archive 7 \(of 14\).
cp /dev/null ark7isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 14 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
dan
----------------------------------------------------
O'Reilly && Associates   argv@sun.com / argv@ora.com
Opinions expressed reflect those of the author only.