v04i057: xtroff -- troff previewer for X11, Part12/18

Dan Heller argv at island.uu.net
Tue Jul 18 17:27:13 AEST 1989


Submitted-by: Mark Moraes <moraes at ai.toronto.edu>
Posting-number: Volume 4, Issue 57
Archive-name: xtroff/part12



#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 12 (of 18)."
# Contents:  xtroff/XtStuff/Menu.c xtroff/devpsc/bdfdit.awk
# Wrapped by moraes at neat.ai on Thu Jul 13 20:55:18 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'xtroff/XtStuff/Menu.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xtroff/XtStuff/Menu.c'\"
else
echo shar: Extracting \"'xtroff/XtStuff/Menu.c'\" \(19435 characters\)
sed "s/^X//" >'xtroff/XtStuff/Menu.c' <<'END_OF_FILE'
X#ifndef lint
Xstatic char rcsid[] = "$Header: Menu.c,v 1.3 88/06/01 02:22:16 moraes Exp $";
X#endif lint
X
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/* 
X * Menu.c -
X *   
X * Author:       Robert P. Shen
X *               Malcolm Forbes
X *               Digital Equipment Corporation
X *               ESG Systems Engineering
X *
X * Date:         February 1, 1988
X */
X
X#include	<X11/IntrinsicP.h>
X#include	<X11/StringDefs.h>
X#include	<X11/XawMisc.h>
X#include	<X11/Xmu.h>
X#include	"MenuP.h"
X#include	"MenuItem.h"
X#include	"CheckItem.h"
X#include 	<X11/Label.h>
X#include	<ctype.h>
X
X/****************************************************************
X *
X * Menu Resources
X *
X ****************************************************************/
X
Xstatic XtOrientation init_orient = XtorientVertical;
Xstatic XtResource resources[] = {
X    {XtNxMargin, XtCHSpace, XtRInt, sizeof(int),
X	 XtOffset(MenuWidget, menu.x_margin), XtRString, "0"},
X    {XtNyMargin, XtCVSpace, XtRInt, sizeof(int),
X	 XtOffset(MenuWidget, menu.y_margin), XtRString, "0"},
X    {XtNx, XtCPosition, XtRPosition, sizeof(Position),
X         XtOffset(MenuWidget,core.x),XtRString, "800"},
X    {XtNy, XtCPosition, XtRPosition, sizeof(Position),
X         XtOffset(MenuWidget,core.y),XtRString, "800"},
X    {XtNborder,"MyBorder",XtRPixel,sizeof(Pixel),
X         XtOffset(MenuWidget,core.border_pixel),XtRString, "Black"},
X/*
X    {XtNborder,XtCBorderColor,XtRPixel,sizeof(Pixel),
X         XtOffset(MenuWidget,core.border_pixel),XtRString, "White"},
X*/
X    {XtNmenuForeground, XtCForeground,XtRPixel, sizeof(Pixel),
X         XtOffset(MenuWidget,menu.menu_foreground_pixel),XtRString, "Black"},
X    {XtNcheckForeground, XtCForeground,XtRPixel, sizeof(Pixel),
X         XtOffset(MenuWidget,menu.check_foreground_pixel),XtRString, "Black"},
X    {XtNbackground, XtCBackground,XtRPixel, sizeof(Pixel),
X         XtOffset(MenuWidget,core.background_pixel),XtRString, "White"},
X    {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension),
X         XtOffset(MenuWidget,core.border_width),XtRString, "2"},
X    {XtNorientation, XtCOrientation, XtROrientation, sizeof(XtOrientation),
X         XtOffset(MenuWidget,menu.orient),XtRString, "vertical"},
X    {XtNmenuItemsList, "MenuItemsList", XtRPointer, sizeof(MenuItems),
X         XtOffset(MenuWidget,menu.items),XtRPointer, NULL},
X};
X/****************************************************************
X *
X * Full class record constant
X *
X ****************************************************************/
X
Xstatic void Initialize();
Xstatic void Realize();
Xstatic void Resize();
Xstatic Boolean SetValues();
Xstatic XtGeometryResult GeometryManager();
Xstatic void ChangeManaged();
Xstatic void ClassInitialize();
X
XMenuClassRec menuClassRec = {
X  {
X/* core_class fields      */
X    /* superclass         */    (WidgetClass) &compositeClassRec,
X    /* class_name         */    "Menu",
X    /* widget_size        */    sizeof(MenuRec),
X    /* class_initialize   */    ClassInitialize,
X    /* class_part_init    */				NULL,
X    /* class_inited       */	FALSE,
X    /* initialize         */    Initialize,
X    /* initialize_hook 	  */		NULL,
X    /* realize            */    Realize,
X    /* actions            */    NULL,
X    /* num_actions	  */	0,
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             */    Resize,
X    /* expose             */    NULL,
X    /* set_values         */    SetValues,
X    /* set_values_hook    */	NULL,
X    /* set_values_almost  */	NULL,
X    /* get_values_hook    */	NULL,
X    /* accept_focus       */    NULL,
X    /* version            */	XtVersion,
X    /* callback_private   */    NULL,
X    /* tm_table           */	NULL,
X    /* query_geometry     */    NULL,
X    /* display_accelerator	*/	XtInheritDisplayAccelerator,
X    /* extension		*/	NULL
X  },{
X/* composite_class fields */
X    /* geometry_manager   */    GeometryManager,
X    /* change_managed     */    ChangeManaged,
X    /* insert_child	  */	NULL,	/* Inherit from superclass */
X    /* delete_child	  */	NULL,	/* Inherit from superclass */
X  },{
X    /* mumble		  */	0	/* Make C compiler happy   */
X  }
X};
X
XWidgetClass menuWidgetClass = (WidgetClass)&menuClassRec;
Xstatic Dimension no_resize_width, no_resize_height;
X
X
X
X
Xstatic void CvtStringToOrientation();
X
Xstatic XrmQuark	XrmQEvertical;
Xstatic XrmQuark	XrmQEhorizontal;
X/* ARGSUSED */
Xstatic void CvtStringToOrientation(args, pargs, fromVal, toVal)
X    XrmValuePtr	args;
X    Cardinal	pargs;
X    XrmValuePtr fromVal;
X    XrmValuePtr toVal;
X{
X    static XtOrientation	e;
X    XrmQuark    q;
X    char	*s = (char *) fromVal->addr;
X    char        lowerName[1000];
X    int		i;
X
X    if (s == NULL) return;
X
X    for (i=0; i<=strlen(s); i++) {
X        char c = s[i];
X	lowerName[i] = isupper(c) ? (char) tolower(c) : c;
X    }
X
X    q = XrmStringToQuark(lowerName);
X
X    toVal->size = sizeof(XtOrientation);
X    toVal->addr = (caddr_t) &e;
X
X    if (q == XrmQEvertical)   { e = XtorientVertical;   return; }
X    if (q == XrmQEhorizontal) { e = XtorientHorizontal; return; }
X
X    toVal->size = 0;
X    toVal->addr = NULL;
X};
X
X/****************************************************************
X *
X * Private Routines
X *
X ****************************************************************/
X
Xstatic void ClassInitialize()
X{
X    CompositeWidgetClass superclass;
X    MenuWidgetClass myclass;
X
X    myclass = (MenuWidgetClass) menuWidgetClass;
X    superclass = (CompositeWidgetClass) myclass->core_class.superclass;
X
X    /* Inherit insert_child and delete_child from Composite */
X    myclass->composite_class.insert_child =
X        superclass->composite_class.insert_child;
X    myclass->composite_class.delete_child =
X        superclass->composite_class.delete_child;
X
X    XrmQEvertical   = XrmStringToQuark("vertical");
X    XrmQEhorizontal = XrmStringToQuark("horizontal");
X
X    XtAddConverter(XtRString, XtROrientation, CvtStringToOrientation,
X		   NULL, (Cardinal)0 );
X}
X
X/*
X *
X * Do a layout, either actually assigning positions, or just calculating size.
X * Returns TRUE on success; FALSE if it couldn't make things fit.
X *
X */
X
Xstatic void horizontal_layout_plan(menuw, width, height, position)
X     MenuWidget menuw;
X     Dimension *width, *height;
X{
X  Widget kid;
X  Dimension w, h;
X  Dimension child_w, child_h, x, y, x_margin, y_margin;
X  int i;
X
X    /* Menu width and height */
X    w = x = child_w = x_margin = menuw->menu.x_margin;
X    h = y = child_h = y_margin = menuw->menu.y_margin;
X
X    for (i = 0; i < menuw->composite.num_children; i++) {
X	kid = menuw->composite.children[i];
X	if (kid->core.managed) {
X	    /* Compute menu width */
X	    child_w = kid->core.width + 2*kid->core.border_width + x_margin;
X	    AssignMax(child_h, kid->core.height);
X	    w += child_w;
X	    h = child_h + 2*kid->core.border_width+2* y_margin;
X
X	    if (position) {
X
X	      XtMoveWidget(kid, (int)x, (int)y);
X              XtResizeWidget(kid,kid->core.width,child_h,kid->core.border_width);
X
X            }
X	    x = w;
X	} /* if managed */
X    } /* for */
X
X  *width = w;
X  *height = h;
X
X}
X
Xstatic void redeploy_kids(menuw)
X     MenuWidget menuw;
X{
X  Widget kid;
X  int i;
X  Dimension menu_width, kid_width;
X  Dimension x, y;
X  Dimension x_margin, y_margin;
X
X  menu_width = menuw->core.width;
X  x = x_margin = menuw->menu.x_margin;
X  y = y_margin = menuw->menu.y_margin;
X
X  for (i = 0; i <menuw->composite.num_children; i++) {
X    kid = menuw->composite.children[i];
X    if (kid->core.managed) {
X      kid_width = menu_width - 2*kid->core.border_width - 2*x_margin;
X/*
X      XtResizeWidget(kid,kid_width,kid->core.height,kid->core.border_width);
X*/
X      XtMoveWidget(kid, (int)x, (int)y);
X      y += kid->core.height + 2*kid->core.border_width + y_margin;
X    }
X  }
X}
X
X
X/* ARGSUSED */
Xstatic LayoutPlan(menuw, width, height, replyWidth, replyHeight, position)
X    MenuWidget	menuw;
X    Dimension		width, height;
X    Dimension		*replyWidth, *replyHeight;	/* RETURN */
X    Boolean		position;	/* actually reposition the windows? */
X{
X    Cardinal  i;
X    Dimension w, h;	/* Width and height needed for menu panel 	*/
X    Dimension x, y;
X    Dimension child_w, child_h;
X    Dimension x_margin, y_margin;  /* Local copy of menuw->menu.x_margin 	*/
X    Dimension hlayout_width, hlayout_height;
X    Widget    kid;	/* Current menu 				*/
X
X    /* Menu width and height */
X    w = x = x_margin = menuw->menu.x_margin;
X    h = y = y_margin = menuw->menu.y_margin;
X
X    for (i = 0; i < menuw->composite.num_children; i++) {
X	kid = menuw->composite.children[i];
X	if (kid->core.managed) {
X	    /* Compute menu width */
X	    child_w = kid->core.width + 2*kid->core.border_width + 2*x_margin;
X	    child_h = kid->core.height + 2*kid->core.border_width + y_margin;
X	    AssignMax(w, child_w);
X	    h += child_h + y_margin;
X
X	    if (position) {
X
X	      XtMoveWidget(kid, (int)x, (int)y);
X              XtResizeWidget(kid,(width-2*kid->core.border_width-2*x_margin),
X		     kid->core.height,kid->core.border_width);
X
X            }
X	    y = h;
X	} /* if managed */
X    } /* for */
X
X    h += y_margin;
X
X    *replyWidth = Max(w, 1);
X    *replyHeight = Max(h, 1);
X}
X
X/*
X *
X * Calculate preferred size, given constraining box
X *
X */
X
Xstatic Boolean PreferredSize(menuw, width, height, replyWidth, replyHeight)
X    MenuWidget	menuw;
X    Dimension		width, height;
X    Dimension		*replyWidth, *replyHeight;
X{
X    LayoutPlan(menuw, width, height, replyWidth, replyHeight, FALSE);
X    return ((*replyWidth <= width) && (*replyHeight <= height));
X}
X
X/*
X *
X * Actually layout the menu panel
X *
X */
X
Xstatic void Resize(menuw)
X    MenuWidget	menuw;
X{
X    Widget kid;
X    Dimension junk, width, height;
X
X    if (menuw->menu.orient == XtorientVertical) {
X      LayoutPlan((MenuWidget)menuw, menuw->core.width, menuw->core.height,
X	     &junk, &junk, TRUE);
X    }
X    else if (menuw->menu.orient == XtorientHorizontal) {
X      	horizontal_layout_plan (menuw, &width, &height, TRUE);
X      }
X/*
X    redeploy_kids(w);
X*/
X} /* Resize */
X
X/*
X *
X * Try to do a new layout within the current width and height;
X * if that fails try to do it within the box returned by PreferredSize.
X *
X * TryNewLayout just says if it's possible, and doesn't actually move the kids
X */
X
Xstatic Boolean TryNewLayout(menuw)
X    MenuWidget	menuw;
X{
X    Dimension		width, height, junk_w, junk_h;
X
X    if (!PreferredSize(menuw, menuw->core.width, menuw->core.height, &width, &height))
X	(void) PreferredSize(menuw, width, height, &width, &height);
X
X    if ((menuw->core.width == width) && (menuw->core.height == height)) {
X        /* Same size */
X	return (TRUE);
X    }
X
X    /* let's see if our parent will go for a new size. */
X    switch (XtMakeResizeRequest((Widget) menuw, width, height, &width, &height)) {
X
X	case XtGeometryYes:
X	    return (TRUE);
X
X	case XtGeometryNo:
X	    if ((width <= menuw->core.width) && (height <= menuw->core.height))
X	        return (TRUE);
X	    else
X	        return (FALSE);
X
X	case XtGeometryAlmost:
X	    if (! PreferredSize(menuw, width, height, &junk_w, &junk_h))
X	        return (FALSE);
X	    (void) XtMakeResizeRequest((Widget) menuw, width, height, 
X					&width, &height);
X	    return (TRUE);
X    }
X}
X
X/*
X *
X * Geometry Manager
X *
X */
X
X/*ARGSUSED*/
Xstatic XtGeometryResult GeometryManager(w, request, reply)
X    Widget		w;
X    XtWidgetGeometry	*request;
X    XtWidgetGeometry	*reply;	/* RETURN */
X
X{
X    Dimension	width, height, borderWidth;
X    MenuWidget menuw;
X
X    /* Position request always denied */
X    if (request->request_mode & (CWX | CWY))
X        return (XtGeometryNo);
X
X    /* Size changes must see if the new size can be accomodated */
X    if (request->request_mode & (CWWidth | CWHeight | CWBorderWidth)) {
X
X	/* Make all three fields in the request valid */
X	if ((request->request_mode & CWWidth) == 0)
X	    request->width = w->core.width;
X	if ((request->request_mode & CWHeight) == 0)
X	    request->height = w->core.height;
X        if ((request->request_mode & CWBorderWidth) == 0)
X	    request->border_width = w->core.border_width;
X
X	/* Save current size and set to new size */
X	width = w->core.width;
X	height = w->core.height;
X	borderWidth = w->core.border_width;
X	w->core.width = request->width;
X	w->core.height = request->height;
X	w->core.border_width = request->border_width;
X
X	/* Decide if new layout works: (1) new menu is smaller,
X	   (2) new menu fits in existing Menu, (3) Menu can be
X	   expanded to allow new menu to fit */
X
X	menuw = (MenuWidget) w->core.parent;
X
X/* whenever a child changes his geometry, we attempt to
X * change ours to be the minimum enclosing size...
X	if (((request->width + request->border_width <= width + borderWidth) &&
X	    (request->height + request->border_width <= height + borderWidth))
X	|| PreferredSize(menuw, menuw->core.width, menuw->core.height, &junk, &junk)
X	|| TryNewLayout(menuw)) {
X */
X	if (TryNewLayout(menuw)) {
X	    /* Fits in existing or new space, relayout */
X	    Resize((Widget)menuw);
X	    return (XtGeometryYes);
X	} else {
X	    /* Cannot satisfy request, change back to original geometry */
X	    w->core.width = width;
X	    w->core.height = height;
X	    w->core.border_width = borderWidth;
X	    return (XtGeometryNo);
X	}
X    }; /* if any size changes requested */
X
X    /* Any stacking changes don't make a difference, so allow if that's all */
X    return (XtGeometryYes);
X}
X
Xstatic void ChangeManaged(w)
X    MenuWidget w;
X{
X    Dimension hlayout_width, h_layout_height, kid_height;
X    Dimension x_margin, y_margin;
X    Dimension width, height;
X
X    if (w->menu.orient == XtorientVertical)
X      {
X
X	(void) TryNewLayout((MenuWidget)w);
X
X	Resize(w);
X/*
X    redeploy_kids(w);
X*/
X      }
X    else if (w->menu.orient == XtorientHorizontal)
X      {
X	horizontal_layout_plan (w, &width, &height, FALSE);
X	switch (XtMakeResizeRequest((Widget)w, width, height, &width, &height))
X	  {
X	    case XtGeometryYes: break;
X            case XtGeometryNo: break;
X            case XtGeometryAlmost: break;
X	  }
X	horizontal_layout_plan (w, &width, &height, TRUE);
X      }
X}
X
X/* ARGSUSED */
Xstatic void Initialize(request, new)
X	Widget	request, new;
X    {
X	MenuWidget	newmenuw = (MenuWidget)new;
X	Widget	cmd;
X	MenuItems	items;
X	int		i, j;
X/*	char		str[32];		*/
X/*	static char	check_pad[] = "    ";	*/
X/*	static char	space_pad[] = "    ";	*/
X
X	static Arg labelArgs[] = {
X	        {XtNbackground,  (XtArgVal) NULL},
X		{XtNforeground,  (XtArgVal) NULL}
X	    };
X	static Arg menuArgs[] = {
X	        {XtNbackground,  (XtArgVal) NULL},
X		{XtNforeground,  (XtArgVal) NULL},
X	        {XtNborderWidth, (XtArgVal) 0},
X		{XtNcallback,    (XtArgVal) NULL}
X	    };
X	static Arg checkArgs[] = {
X	        {XtNbackground,  (XtArgVal) NULL},
X		{XtNforeground,  (XtArgVal) NULL},
X	        {XtNborderWidth, (XtArgVal) 0},
X		{XtNcheckState, (XtArgVal)  TRUE},
X		{XtNcallback,    (XtArgVal) NULL}
X	    };
X	static Arg uncheckArgs[] = {
X	        {XtNbackground,  (XtArgVal) NULL},
X		{XtNforeground,  (XtArgVal) NULL},
X	        {XtNborderWidth, (XtArgVal) 0},
X		{XtNcheckState, (XtArgVal) FALSE},
X		{XtNcallback,    (XtArgVal) NULL}
X	    };
X
X
X/* ||| What are consequences of letting height, width be 0? If okay, then
X       Initialize can be NULL */
X
X    if (newmenuw->core.width == 0)
X        newmenuw->core.width = ((newmenuw->menu.x_margin != 0)
X			      ? newmenuw->menu.x_margin : 1);	/* MOD */
X    if (newmenuw->core.height == 0)
X	newmenuw->core.height = ((newmenuw->menu.y_margin != 0)
X			       ? newmenuw->menu.y_margin : 1);	/* MOD */
X
X    XtSetArg(labelArgs[0], XtNbackground,newmenuw->menu.menu_foreground_pixel);
X    XtSetArg(labelArgs[1], XtNforeground,newmenuw->core.background_pixel);
X    XtSetArg(menuArgs[0], XtNbackground,newmenuw->core.background_pixel);
X    XtSetArg(menuArgs[1],XtNforeground,newmenuw->menu.menu_foreground_pixel);
X    XtSetArg(checkArgs[0], XtNbackground, newmenuw->core.background_pixel);
X    XtSetArg(checkArgs[1],XtNforeground,newmenuw->menu.check_foreground_pixel);
X    XtSetArg(uncheckArgs[0], XtNbackground, newmenuw->core.background_pixel);
X    XtSetArg(uncheckArgs[1],XtNforeground,newmenuw->menu.check_foreground_pixel);
X    cmd = XtCreateManagedWidget (newmenuw->core.name,
X       				labelWidgetClass, new,
X				labelArgs, XtNumber(labelArgs));
X
X    if( newmenuw->menu.items )
X    {
X	    XtCallbackList  temprec;
X	    
X	    items = newmenuw->menu.items;
X	    for (; items->proc; items++) {     /* at least proc must exist! */
X		temprec = (XtCallbackList)XtMalloc(sizeof(XtCallbackRec)*2);
X		temprec->callback = items->proc;
X		temprec->closure = items->closure;
X		(temprec+1)->callback = NULL;
X		(temprec+1)->closure = NULL;
X		if (items->flags & (XtitemCheckable | XtitemIsChecked)) {
X		    XtSetArg(checkArgs[4], XtNcallback, temprec);
X		    XtSetArg(uncheckArgs[4], XtNcallback, temprec);
X		    cmd = XtCreateManagedWidget (items->text,
X					checkitemWidgetClass, new,
X					(items->flags & XtitemIsChecked ?
X						(ArgList) checkArgs :
X						(ArgList) uncheckArgs),
X					(items->flags & XtitemIsChecked ?
X					 XtNumber(checkArgs) :
X					 XtNumber(uncheckArgs)));
X
X	    }
X		else {
X		    XtSetArg(menuArgs[3], XtNcallback, temprec);
X		    cmd = XtCreateManagedWidget (items->text,
X					menuitemWidgetClass, new,
X						 (ArgList) menuArgs,
X						 XtNumber(menuArgs));
X		}
X		XtSetSensitive (cmd, !(items->flags & XtitemUnselectable));
X	}
X    }
X} /* Initialize */
X
X/* ||| Should Realize just return a modified mask and attributes?  Or will some
X   of the other parameters change from class to class? */
Xstatic void Realize(w, valueMask, attributes)
X
X    register Widget w;
X    Mask *valueMask;
X    XSetWindowAttributes *attributes;
X{
X    MenuWidget newmenuw = (MenuWidget)w;
X
X    attributes->bit_gravity = NorthWestGravity;
X    *valueMask |= CWBitGravity;
X
X    XtCreateWindow( w, (unsigned)InputOutput, (Visual *)CopyFromParent,
X		    *valueMask, attributes);
X} /* Realize */
X
X/*
X *
X * Set Values
X *
X */
X
X/* ARGSUSED */
Xstatic Boolean SetValues (current, request, new, last)
X    Widget current, request, new;
X    Boolean last;
X{
X    /* ||| Old code completely bogus, need background, etc. then relayout */
X
X    /*XtSetValuesGeometryRequest( current, new, (XtWidgetGeometry *)NULL );*/
X
X    /* ||| should handle XtGeometryAlmost */
X
X    return (FALSE);
X}
END_OF_FILE
if test 19435 -ne `wc -c <'xtroff/XtStuff/Menu.c'`; then
    echo shar: \"'xtroff/XtStuff/Menu.c'\" unpacked with wrong size!
fi
# end of 'xtroff/XtStuff/Menu.c'
fi
if test -f 'xtroff/devpsc/bdfdit.awk' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xtroff/devpsc/bdfdit.awk'\"
else
echo shar: Extracting \"'xtroff/devpsc/bdfdit.awk'\" \(17215 characters\)
sed "s/^X//" >'xtroff/devpsc/bdfdit.awk' <<'END_OF_FILE'
X# devpsc/bdfdit.awk
X#
X# Copyright (c) 1988 Cray Research, Inc. All Rights Reserved.
X#
X# This awk(1) program serves two purposes.  It helps convert
X# X11 bdf font metrics files (bdf files) into ditroff
X# font description files (as input to makedev), and it
X# helps create the ditroff device description file (DESC) for
X# bdf fonts.
X#
X
XBEGIN {
X	SCALE = 5.0		# font width scale factor to 
X				# achieve proper dynamic range
X				# (ditroff widths are <= 256)
X
X	# file names for pieces. These are cat'ed together.
X	header = "temp.header"	# comments and ligature list
X	spaces = "temp.spaces"	# space widths and "charset" header
X	trailer = "temp.trailer"# actual character data
X	aux = "temp.aux"
X
X	isspecial = 0
X	istext = 1
X
X# ligatures
X
X	ligature["ff"] = "ff"
X	ligature["ffi"] = "Fi"
X	ligature["ffl"] = "Fl"
X	ligature["fi"] = "fi"
X	ligature["fl"] = "fl"
X
X# ditmap is a mapping from non-ascii bdf file character names
X#	(plus a few special ones) to DITROFF \( special codes.
X#	Note that some chars have more than one code (separated by spaces).
X
X	ditmap[".ditspace"] = "\\^ \\| \\&"
X	ditmap["AE"] = "AE"
X	ditmap["Alpha"] = "*A"
X	ditmap["Beta"] = "*B"
X	ditmap["Chi"] = "*X"
X	ditmap["Delta"] = "*D"
X	ditmap["Epsilon"] = "*E"
X	ditmap["Eta"] = "*Y"
X	ditmap["Gamma"] = "*G"
X	ditmap["Iota"] = "*I"
X	ditmap["Kappa"] = "*K"
X	ditmap["Lambda"] = "*L"
X	ditmap["Lslash"] = "PL"
X	ditmap["Mu"] = "*M"
X	ditmap["Nu"] = "*N"
X	ditmap["OE"] = "OE"
X	ditmap["Omega"] = "*W"
X	ditmap["Omicron"] = "*O"
X	ditmap["Oslash"] = "O/"
X	ditmap["Phi"] = "*F"
X	ditmap["Pi"] = "*P"
X	ditmap["Psi"] = "*Q"
X	ditmap["Rho"] = "*R"
X	ditmap["Sigma"] = "*S"
X	ditmap["Tau"] = "*T"
X	ditmap["Theta"] = "*H"
X	ditmap["Upsilon"] = "*U"
X	ditmap["Xi"] = "*C"
X	ditmap["Zeta"] = "*Z"
X 	ditmap["acute"] = "aa \\'"
X	ditmap["ae"] = "ae"
X	ditmap["aleph"] = "al"
X	ditmap["alpha"] = "*a"
X 	ditmap["angle"] = "ag"
X 	ditmap["angleleft"] = "l< L<"
X 	ditmap["angleright"] = "r> R>"
X	ditmap["apple"] = "AL"
X	ditmap["approxequal"] = "~="
X 	ditmap["arrowboth"] = "<>"
X 	ditmap["arrowdbldown"] = "d="
X 	ditmap["arrowdblboth"] = "io"
X 	ditmap["arrowdblleft"] = "<: lh"	# left double arrow (& hand)
X 	ditmap["arrowdblright"] = ":> im rh"	# right double arrow (& hand)
X 	ditmap["arrowdblup"] = "u="
X	ditmap["arrowdown"] = "da"
X	ditmap["arrowleft"] = "<-"
X	ditmap["arrowright"] = "->"
X	ditmap["arrowup"] = "ua"
X	ditmap["asciicircum"] = "a^"
X	ditmap["asciitilde"] = "a~"
X	ditmap["asteriskmath"] = "**"
X	ditmap["bar"] = "or"
X	ditmap["beta"] = "*b"
X# 	ditmap["br"] = "br"	# box rule
X# 	ditmap["bu"] = "bu"	# bullet
X# 	ditmap["bv"] = "bv"	# bold vertical
X# 	ditmap["bx"] = "bx"	# box
X	ditmap["breve"] = "be"
X	ditmap["bullet"] = "bu"
X	ditmap["caron"] = "hc"
X	ditmap["cedilla"] = "cd"
X	ditmap["cent"] = "ct"
X	ditmap["chi"] = "*x"
X	ditmap["circumflex"] = "^"
X 	ditmap["carriagereturn"] = "cr"
X# 	ditmap["ci"] = "ci"	# circle
X 	ditmap["circlemultiply"] = "ax"
X 	ditmap["circleplus"] = "a+"
X	ditmap["club"] = "Cc"
X	ditmap["congruent"] = "=~"
X	ditmap["copyrightserif"] = "co"
X	ditmap["dagger"] = "dg"
X	ditmap["daggerdbl"] = "dd"
X	ditmap["degree"] = "de"
X	ditmap["delta"] = "*d"
X 	ditmap["diamond"] = "Cd"
X 	ditmap["dieresis"] = "um .."	# umlaut
X 	ditmap["dotaccent"] = "dt"
X	ditmap["dotlessi"] = "ui"
X	ditmap["divide"] = "di"
X 	ditmap["dotmath"] = "m."
X 	ditmap["element"] = "mo"
X	ditmap["emdash"] = "em"
X	ditmap["emptyset"] = "es"
X	ditmap["endash"] = "en"
X	ditmap["epsilon"] = "*e"
X	ditmap["equal"] = "eq"	;	mathonly["eq"] = "equal"
X	ditmap["equivalence"] = "=="
X	ditmap["eta"] = "*y"
X 	ditmap["exclamdown"] = "!! I!"
X	ditmap["existential"] = "te"
X	ditmap["ff"] = "ff"
X	ditmap["ffi"] = "Fi"
X	ditmap["ffl"] = "Fl"
X	ditmap["fi"] = "fi"
X	ditmap["fl"] = "fl"
X 	ditmap["florin"] = "$D"
X	ditmap["germandbls"] = "ss"
X	ditmap["gamma"] = "*g"
X	ditmap["gradient"] = "gr"
X 	ditmap["grave"] = "ga \\`"
X	ditmap["greaterequal"] = ">="
X	ditmap["guillemotleft"] = "d<"
X	ditmap["guillemotright"] = "d>"
X	ditmap["guillmotleft"] = "d<"
X	ditmap["guillmotright"] = "d>"
X	ditmap["guilsinglleft"] = "l<"
X	ditmap["guilsinglright"] = "r>"
X	ditmap["heart"] = "bs Ch"
X	ditmap["hungarumlaut"] = "''"
X	ditmap["hyphen"] = "hy"
X	ditmap["infinity"] = "if"
X	ditmap["integral"] = "is"
X# 	ditmap["lb"] = "lb"	# left bot curly
X# 	ditmap["lc"] = "lc"	# left ceil
X# 	ditmap["lf"] = "lf"	# left floor
X# 	ditmap["lk"] = "lk"	# left center curly
X 	ditmap["logicaland"] = "an la"
X 	ditmap["logicalor"] = "lo"
X	ditmap["lozenge"] = "dm"
X	ditmap["intersection"] = "ca"
X	ditmap["iota"] = "*i"
X	ditmap["kappa"] = "*k"
X	ditmap["lambda"] = "*l"
X	ditmap["lessequal"] = "<="
X	ditmap["logicalnot"] = "no"
X	ditmap["lslash"] = "Pl"
X	ditmap["onequarter"] = "14"
X	ditmap["onehalf"] = "12"
X	ditmap["threequarters"] = "34"
X 	ditmap["macron"] = "mc ma"
X	ditmap["minus"] = "\\- mi"	;	mathonly["mi"] = "minus"
X# 	ditmap["minus"] = "\\- mi"
X 	ditmap["minute"] = "fm mt"
X	ditmap["mu"] = "*m"
X	ditmap["multiply"] = "mu"
X 	ditmap["notelement"] = "!m"
X 	ditmap["notsubset"] = "!s"
X	ditmap["notequal"] = "!="
X	ditmap["nu"] = "*n"
X 	ditmap["ogonek"] = "og"
X	ditmap["oe"] = "oe"
X	ditmap["omega"] = "*w"
X	ditmap["omicron"] = "*o"
X	ditmap["oslash"] = "o/"
X 	ditmap["onehalf"] = "12"
X 	ditmap["onequarter"] = "14"
X	ditmap["paragraph"] = "pp"
X	ditmap["partialdiff"] = "pd"
X	ditmap["phi"] = "*f"
X	ditmap["pi"] = "*p"
X	ditmap["plus"] = "pl"	;	mathonly["pl"] = "plus"
X	ditmap["plusminus"] = "+-"
X	ditmap["propersubset"] = "sb"
X	ditmap["propersuperset"] = "sp"
X	ditmap["proportional"] = "pt"
X	ditmap["psi"] = "*q"
X 	ditmap["questiondown"] = "?? I?"
X	ditmap["quotedblbase"] = "bq"
X 	ditmap["quotedblleft"] = "lq oq"
X 	ditmap["quotedblright"] = "rq cq"
X 	ditmap["quotesingle"] = "n'"
X	ditmap["radical"] = "sr"
X	ditmap["radicalex"] = "rn"
X	ditmap["reflexsubset"] = "ib"
X	ditmap["reflexsuperset"] = "ip"
X	ditmap["registerserif"] = "rg"
X	ditmap["rho"] = "*r"
X 	ditmap["ring"] = "ri"
X 	ditmap["second"] = "sd"
X	ditmap["section"] = "sc"
X	ditmap["sigma"] = "*s"
X	ditmap["sigma1"] = "ts"
X	ditmap["similar"] = "ap"
X	ditmap["slash"] = "sl"
X	ditmap["spade"] = "Cs"
X 	ditmap["sterling"] = "ps po"
X	ditmap["suchthat"] = "cm"
X	ditmap["tau"] = "*t"
X	ditmap["therefore"] = "tf"
X	ditmap["theta"] = "*h"
X	ditmap["tilde"] = "~"
X	ditmap["trademarkserif"] = "tm"
X	ditmap["underscore"] = "ul \\_"
X# 	ditmap["ul"] = "ul"	# under rule
X# 	ditmap["underscore"] = "\\_"
X# 	ditmap["vr"] = "vr"	# vertical rule
X	ditmap["union"] = "cu"
X	ditmap["universal"] = "fa"
X	ditmap["upsilon"] = "*u"
X	ditmap["xi"] = "*c"
X	ditmap["yen"] = "yn"
X 	ditmap["yen"] = "yi yn $J"
X	ditmap["zeta"] = "*z"
X	ditmap["circle"] = "ci"
X	ditmap["square"] = "sq"
X
X# Additional troff characters.  The mod to add these special
X# characters to the bdf character set is needed.
X
X	ditmap["box"] = "bx"
X	ditmap["boxrule"] = "br"
X	ditmap["rule"] = "ru"
X	ditmap["boldvertical"] = "bv"
X	ditmap["lefttopcurly"] = "lt"
X	ditmap["leftbotcurly"] = "lb"
X	ditmap["righttopcurly"] = "rt"
X	ditmap["rightbotcurly"] = "rb"
X# 	ditmap["lt"] = "lt"	# left top curly
X# 	ditmap["ob"] = "ob"	# outline bullet
X# 	ditmap["rb"] = "rb"	# right bot curly
X# 	ditmap["rc"] = "rc"	# right ceil
X# 	ditmap["rf"] = "rf"	# right floor
X# 	ditmap["rk"] = "rk"	# right center curly
X# 	ditmap["rn"] = "rn"	# root extender
X# 	ditmap["rt"] = "rt"	# rith top curly
X# 	ditmap["ru"] = "ru"	# rule
X	ditmap["leftmidcurly"] = "lk"
X	ditmap["rightmidcurly"] = "rk"
X	ditmap["leftfloor"] = "lf"
X	ditmap["rightfloor"] = "rf"
X	ditmap["leftceiling"] = "lc"
X	ditmap["rightceiling"] = "rc"
X	ditmap["outlinebullet"] = "ob"
X 	ditmap["perpendicular"] = "bt"
X 	ditmap["perthousand"] = "pm"
X
X#  Characters in the ISO Latan 1 set
X#  Assignment of troff characters made by D. A. Cahlander 89/01/09.
X#  Disabled since the DESC.out file can only describe 256-character fonts.
X
X#	ditmap["Aacute"] = "A'"
X#	ditmap["Acircumflex"] = "A^"
X	ditmap["Adieresis"] = "A:"
X#	ditmap["Agrave"] = "A`"
X#	ditmap["Aring"] = "Ao"
X#	ditmap["Atilde"] = "A~"
X#	ditmap["Ccedilla"] = "Cc"
X#	ditmap["Eacute"] = "E'"
X#	ditmap["Ecircumflex"] = "E^"
X#	ditmap["Edieresis"] = "E."
X#	ditmap["Egrave"] = "E`"
X#	ditmap["Iacute"] = "I'"
X#	ditmap["Icircumflex"] = "I^"
X#	ditmap["Idieresis"] = "I."
X#	ditmap["Igrave"] = "I`"
X#	ditmap["Ntilde"] = "N~"
X#	ditmap["Oacute"] = "O'"
X#	ditmap["Ocircumflex"] = "O^"
X	ditmap["Odieresis"] = "O:"
X#	ditmap["Ograve"] = "O`"
X#	ditmap["Otilde"] = "O~"
X#	ditmap["Scaron"] = "Sc"
X#	ditmap["Uacute"] = "U'"
X#	ditmap["Ucircumflex"] = "U^"
X	ditmap["Udieresis"] = "U:"
X#	ditmap["Ugrave"] = "U`"
X#	ditmap["Ydieresis"] = "Y."
X#	ditmap["Zcaron"] = "Zc"
X#	ditmap["aacute"] = "a'"
X#	ditmap["acircumflex"] = "a^"
X	ditmap["adieresis"] = "a:"
X#	ditmap["agrave"] = "a`"
X#	ditmap["aring"] = "ao"
X#	ditmap["atilde"] = "a~"
X#	ditmap["ccedilla"] = "cc"
X#	ditmap["eacute"] = "e'"
X#	ditmap["ecircumflex"] = "e^"
X#	ditmap["edieresis"] = "e."
X#	ditmap["egrave"] = "e`"
X#	ditmap["iacute"] = "i'"
X#	ditmap["icircumflex"] = "i^"
X#	ditmap["idieresis"] = "i."
X#	ditmap["igrave"] = "i`"
X#	ditmap["ntilde"] = "n~"
X#	ditmap["oacute"] = "o'"
X#	ditmap["ocircumflex"] = "o^"
X	ditmap["odieresis"] = "o:"
X#	ditmap["ograve"] = "o`"
X#	ditmap["otilde"] = "o~"
X#	ditmap["scaron"] = "sc"
X#	ditmap["uacute"] = "u'"
X#	ditmap["ucircumflex"] = "u^"
X	ditmap["udieresis"] = "u:"
X#	ditmap["ugrave"] = "u`"
X#	ditmap["ydieresis"] = "y."
X#	ditmap["zcaron"] = "zc"
X
X# Characters that have subroutine proceedures that are used
X# to draw them with psdit.
X
X	psdit["onequarter"] = "14"
X	psdit["onehalf"] = "12"
X	psdit["threequarters"] = "34"
X
X	psdit["square"] = 1
X	psdit["box"] = 1
X	psdit["circle"] = 1
X	psdit["boxrule"] = 1
X	psdit["boldvertical"] = 1
X	psdit["rule"] = 1
X
X	psdit["lefttopcurly"] = 1
X	psdit["leftbotcurly"] = 1
X	psdit["righttopcurly"] = 1
X	psdit["rightbotcurly"] = 1
X	psdit["leftmidcurly"] = 1
X	psdit["rightmidcurly"] = 1
X	psdit["leftfloor"] = 1
X	psdit["rightfloor"] = 1
X	psdit["leftceiling"] = 1
X	psdit["rightceiling"] = 1
X
X# No mapping exists for these characters.
X
X	ditmap[".noPS1"] = "ma fe"	# male female
X	ditmap[".noPS2"] = "~~" 	# almost exactly equals
X	ditmap[".noPS3"] = ">< <> !> !<"	# funny relations
X	ditmap[".noPS4"] = "uj"		# dotless (undotted) j
X	ditmap[".noPS5"] = "cp"		# cap (upside down breve)
X	ditmap[".noPS6"] = "-+"		# - over + ?
X	ditmap[".noPS7"] = "vr"		# vertical rule 
X
X#	ditmap[".noPS90"] = "wi tp sg sa rd ra os =p =. 4d"
X#	ditmap[".noPS91"] = "le ld hi gp ge el eg dc"
X#	ditmap[".noPS92"] = "cy bc b9 b0 as an ai \\` \\_ \\'"
X#	ditmap[".noPS93"] = "UT Sl SQ RC RB LE GE EL EG DT CB *V"
X
X# L. and l. are used for line drawing on systems without graphics
X
X# ascii is a mapping which contains the troff character names
X#	for the printable ascii characters.  The values are the ascii
X#	character codes but are not used in this program.  A test is
X#	made to see if a specific name is in the table.
X
X	ascii["space"] = 32
X	ascii["exclam"] = 33
X	ascii["quotedbl"] = 34
X	ascii["numbersign"] = 35
X	ascii["dollar"] = 36
X	ascii["percent"] = 37
X	ascii["ampersand"] = 38
X	ascii["quoteright"] = 39
X	ascii["parenleft"] = 40
X	ascii["parenright"] = 41
X	ascii["asterisk"] = 42
X	ascii["plus"] = 43
X	ascii["comma"] = 44
X	ascii["hyphen"] = 45
X#	ascii["minus"] = 45
X	ascii["period"] = 46
X	ascii["slash"] = 47
X	ascii["zero"] = 48
X	ascii["one"] = 49
X	ascii["two"] = 50
X	ascii["three"] = 51
X	ascii["four"] = 52
X	ascii["five"] = 53
X	ascii["six"] = 54
X	ascii["seven"] = 55
X	ascii["eight"] = 56
X	ascii["nine"] = 57
X	ascii["colon"] = 58
X	ascii["semicolon"] = 59
X	ascii["less"] = 60
X	ascii["equal"] = 61
X	ascii["greater"] = 62
X	ascii["question"] = 63
X	ascii["at"] = 64
X	ascii["A"] = 65
X	ascii["B"] = 66
X	ascii["C"] = 67
X	ascii["D"] = 68
X	ascii["E"] = 69
X	ascii["F"] = 70
X	ascii["G"] = 71
X	ascii["H"] = 72
X	ascii["I"] = 73
X	ascii["J"] = 74
X	ascii["K"] = 75
X	ascii["L"] = 76
X	ascii["M"] = 77
X	ascii["N"] = 78
X	ascii["O"] = 79
X	ascii["P"] = 80
X	ascii["Q"] = 81
X	ascii["R"] = 82
X	ascii["S"] = 83
X	ascii["T"] = 84
X	ascii["U"] = 85
X	ascii["V"] = 86
X	ascii["W"] = 87
X	ascii["X"] = 88
X	ascii["Y"] = 89
X	ascii["Z"] = 90
X	ascii["bracketleft"] = 91
X	ascii["backslash"] = 92
X	ascii["bracketright"] = 93
X#	ascii["asciicircum"] = 94	# 195 see ditmap, should be ascii!
X	ascii["underscore"] = 95
X	ascii["quoteleft"] = 96
X	ascii["a"] = 97
X	ascii["b"] = 98
X	ascii["c"] = 99
X	ascii["d"] = 100
X	ascii["e"] = 101
X	ascii["f"] = 102
X	ascii["g"] = 103
X	ascii["h"] = 104
X	ascii["i"] = 105
X	ascii["j"] = 106
X	ascii["k"] = 107
X	ascii["l"] = 108
X	ascii["m"] = 109
X	ascii["n"] = 110
X	ascii["o"] = 111
X	ascii["p"] = 112
X	ascii["q"] = 113
X	ascii["r"] = 114
X	ascii["s"] = 115
X	ascii["t"] = 116
X	ascii["u"] = 117
X	ascii["v"] = 118
X	ascii["w"] = 119
X	ascii["x"] = 120
X	ascii["y"] = 121
X	ascii["z"] = 122
X	ascii["braceleft"] = 123
X	ascii["bar"] = 124
X	ascii["braceright"] = 125
X#	ascii["asciitilde"] = 126	# 196 see ditmap, should be ascii !
X
X	ditmap[".proctext"] = "18 38 58 78 13 23"
X
X	# character-code and width info for synthetic characters
X
X	cc = 132	# manufacture unique character codes
X	proc["18"] = cc++ " 0 833"	# 1/8
X	proc["38"] = cc++ " 0 833"	# 3/8
X	proc["58"] = cc++ " 0 833"	# 5/8
X	proc["78"] = cc++ " 0 833"	# 7/8
X	proc["13"] = cc++ " 0 833"	# 1/3
X	proc["23"] = cc++ " 0 833"	# 2/3
X} # BEGIN
X
X# The following dumps the character set defined above to standard
X# output.  It is triggared if the input file is named "DESC".
X# This info is used in the device description DESC to describe the
X# global (over all fonts) character set of the device.
X# Note that this dumps the information in random order (awk's
X# enumeration of ditmap), but troff (makedev) shouldn't care.  This
X# is the only place the resolution, font sizes, unitwidth, etc. are
X# wired.  If they get too large, troff will explode, so change them
X# at your own risk.
X
XFILENAME == "DESC" {
X	SIZES = "6 8 10 12 14 18 24"
X	RES = 72 * 8
X	print "sizes", SIZES, 0
X	print "res", RES
X	print "hor 1"
X	print "vert 1"
X	print "unitwidth", int((1000.0 / SCALE) * (72.0 / RES))
X	print "charset"
X	outstr = ""
X	for (i in ditmap) {
X		n = ditmap[i]
X		if ((length(outstr)+length(n)) > 60) {
X			print outstr
X			outstr = n " "
X		} else {
X			outstr = outstr n " "
X		}
X	}
X	if (length(outstr) != 0) print outstr
X	exit
X}
X
X# Define the actions on the fields in the BDF format.
X#	Note that 3 files are generated which are cat'ed together
X#	outside this program.
X
X# handle header information
X
X/^STARTFONT/ {
X	print "#", $0 > header
X	next
X}
X
X/^COMMENT Begin LogicalFontDescription/ {next}
X/^COMMENT END LogicalFontDescription/ {next}
X/^COMMENT .* end of inserted font properties/	{next}
X
X/^COMMENT/ {
X	$1 = "# "
X	print > header
X	next
X} 
X
X/^FONT / {
X	print "#  " $2 > header
X	split($0, arg, ".")
X	print "name", arg[2] > header
X	if (arg[2] == "S") {
X		print "special" > header
X		isspecial = 1
X		istext = 0
X	}
X	next
X}
X
X/^X_HEIGHT / {
X	ascender = $2
X	next
X}
X
X/^ENDPROPERTIES/ { next }
X
X# set character name
X
X/^STARTCHAR .*/ {
X	charname = $2
X	next
X}
X
X# set encoding
X
X/^ENCODING .*/ {
X	charcode = $2
X	next
X}
X
X/^SWIDTH [0-9]* [0-9]*/ {
X	width = $2
X	next
X}
X
X/^DWIDTH [0-9]* [0-9]*/ {
X	dwidth = $2
X	next
X}
X
X# 1   2       3       4       5
X/^BBX [-0-9]* [-0-9]* [-0-9]* [-0-9]*/ {
X	if (charcode == -1)			# unused character
X		next
X
X	bblly = $5
X	bbury = $3 + $5
X
X#	ignore out of range characters
X	if (charcode >= 256)
X		next
X
X#	compute width
X	scaledwidth = int(0.5 + (width / SCALE))
X	if ((scaledwidth < 0) || (scaledwidth > 256)) {
X		print "ERROR! Width out of range!"
X		exit 2
X	}
X
X#	handle space
X	if (charname == "space") {		# special char widths
X		spacewidth = scaledwidth
X		printf "ligatures " > header
X		printf "spacewidth %d\n", spacewidth > spaces
X		print "charset" > spaces
X		printf "\\|\t%d 0 000\t1/6 em space\n", int (0.5 + (1000.0/6.0) / SCALE) > trailer
X		printf "\\^\t%d 0 000\t1/12 em space\n", int (0.5 + (1000.0/12.0) / SCALE) > trailer
X		printf "\\&\t00 0 000\tno space\n" > trailer
X		next
X	}
X
X#	parse ligatures
X	if (length(ligature[charname]))
X		printf "%s ", charname > header
X
X#	ascender/descender flags
X	ad = 0
X	if (bblly < 0) ad += 1
X	if (bbury > ascender) ad += 2
X
X#	dump the description line
X	if (length(ascii[charname]) > 0) {
X		printf "%c\t%d %d 0%2o\t%s\n", charcode, scaledwidth, ad, charcode, charname  > trailer
X		# look for ditmap synonyms
X		if (length(ditmap[charname]) > 0) {
X			n = split(ditmap[charname],others," ")
X			for (i = 1; i <= n; i++) {
X				oth = others[i];
X				if ((length(mathonly[oth]) > 0) && (isspecial != 1)) continue;
X				printf "%s\t\"\n", others[i]  > trailer
X			}
X		}
X	} else if (length(ditmap[charname]) > 0) {
X		# not a printable ascii character
X		n = split(ditmap[charname],others," ")
X		printf "%s\t%d %d 0%o\t%s\n", others[1], scaledwidth, ad, charcode, charname  > trailer
X		for (i = 2; i <= n; i++) {
X			printf "%s\t\"\n", others[i]  > trailer
X		}
X	}
X
X# dump a line for PS specific actual width/hack table
X
X	specialcode = 0
X	if (length(psdit[charname]) != 0)
X		specialcode = 1
X	printf "%d %d %d\n", charcode, width, specialcode > aux
X	next
X}
X
XEND	{
X	printf "0\n" > header
X
X	# dump the "fudged" characters.
X	for (i in proc) {
X		p = proc[i]
X		split(p,vals," ")
X		scaledwidth = int(0.5 + (vals[3] / SCALE))
X		if (((istext == 1) && (index(ditmap[".proctext"],i) != 0)) || ((isspecial == 1) && (index(ditmap[".procspecial"],i) != 0))) {
X			printf "%s\t%d %d 0%o\tfudgedproc!\n", i, scaledwidth, vals[2], vals[1] > trailer
X
X			printf "%d %d %d\n", vals[1], vals[3], 1 > aux
X		}
X	}
X	exit
X
X}
END_OF_FILE
if test 17215 -ne `wc -c <'xtroff/devpsc/bdfdit.awk'`; then
    echo shar: \"'xtroff/devpsc/bdfdit.awk'\" unpacked with wrong size!
fi
# end of 'xtroff/devpsc/bdfdit.awk'
fi
echo shar: End of archive 12 \(of 18\).
cp /dev/null ark12isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 18 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



More information about the Comp.sources.x mailing list