
# line 2 "parse.y"
/*
 * Copyright 1988 by Siemens
 *		All Rights Reserved
 *
 * Permission to use, copy, modify and distribute this software is
 * hereby granted, provided that this copyright notice appear in all
 * copies and that the copyright notice appear in supporting documentation.
 * 
 * written 16-17 Mar 1988 by claus gittinger
 *
 * q & d hacked grammar for .bdf files.
 *
 */
/*
 * Modified by Mark Moraes @ the University of Toronto to make it handle
 * a larger subset of BDF. It now reads in all the font files in X.V11R3
 * without complaints. Comments all get gathered in at the beginning
 * thanks to the kludgey way in which they're now stored -- fixes
 * welcome.
 */
#include <stdio.h>
#include "defs.h"

#define MAXROWS		512
#define INC_COMMENTS	32	/* size in which comments array grows */

extern int lineno;		/* counts lines in .bdf input file */
extern int stringMode;		/* kludge in scan.l */
extern int minx, miny, maxx, maxy;
static struct character *charp;	/* current character */
static char *bits[MAXROWS];	/* that good for long characters ... */
static int nrows;
static int npropCounted;


# line 38 "parse.y"
typedef union
#ifdef __cplusplus
	YYSTYPE
#endif
 {
	int ival;
	char *sval;
} YYSTYPE;
# define NEWLINE 257
# define DOT 258
# define STARTFONT 259
# define SIZE 260
# define FONTBOUNDINGBOX 261
# define STARTPROPERTIES 262
# define ENDPROPERTIES 263
# define CHARS 264
# define ENCODING 265
# define SWIDTH 266
# define DWIDTH 267
# define BBX 268
# define BITMAP 269
# define ENDCHAR 270
# define ENDFONT 271
# define FONT 272
# define PROPERTY 273
# define STARTCHAR 274
# define COMMENT 275
# define STRING 276
# define IDENTIFIER 277
# define NUMBER 278

#include <malloc.h>
#include <memory.h>
#include <values.h>

#ifdef __cplusplus

#ifndef yyerror
	void yyerror(const char *);
#endif
#ifndef yylex
	int yylex(void);
#endif
	int yyparse(void);

#endif
#define yyclearin yychar = -1
#define yyerrok yyerrflag = 0
extern int yychar;
extern int yyerrflag;
YYSTYPE yylval;
YYSTYPE yyval;
typedef int yytabelem;
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 150
#endif
#if YYMAXDEPTH > 0
int yy_yys[YYMAXDEPTH], *yys = yy_yys;
YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv;
#else	/* user does initial allocation */
int *yys;
YYSTYPE *yyv;
#endif
static int yymaxdepth = YYMAXDEPTH;
# define YYERRCODE 256

# line 309 "parse.y"


yyerror(s) 
char *s;
{
	fprintf(stderr, "parse error in line %d: %s\n", lineno, s);
	exit(1);
}
yytabelem yyexca[] ={
-1, 1,
	0, -1,
	-2, 0,
	};
# define YYNPROD 47
# define YYLAST 124
yytabelem yyact[]={

    82,    80,    78,    93,    90,    84,    73,    72,    71,    70,
    65,    51,    17,    18,    20,    50,    48,    42,    41,    35,
    29,    83,    81,    79,    16,    28,    24,    15,    21,    45,
    92,    34,    22,    15,    39,    60,    61,    62,    63,    34,
     7,    15,    60,    61,    62,    63,    69,     4,    75,    36,
    95,    94,    89,    88,    87,    85,    76,    74,    64,    53,
    52,    49,    47,    46,    40,    37,    27,    26,    55,    10,
    31,     9,    77,    91,    86,    68,    59,    58,    57,    56,
    25,    66,    54,    38,    23,     6,    33,    43,    30,    32,
    19,    14,    13,    12,    11,     8,     3,     5,     2,     1,
    32,    44,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,    67 };
yytabelem yypact[]={

  -212,-10000000,  -224,  -248,  -250,  -239,-10000000,  -252,  -248,-10000000,
-10000000,-10000000,-10000000,-10000000,-10000000,  -190,  -191,  -253,  -258,  -242,
  -259,  -209,  -192,  -240,  -193,-10000000,-10000000,-10000000,  -260,  -261,
  -234,-10000000,-10000000,-10000000,  -194,  -195,  -262,-10000000,-10000000,  -196,
-10000000,  -263,  -267,-10000000,-10000000,  -197,-10000000,-10000000,  -198,  -230,
  -199,  -268,-10000000,-10000000,  -223,-10000000,-10000000,-10000000,-10000000,-10000000,
  -269,  -270,  -271,  -272,-10000000,  -200,  -222,-10000000,  -201,-10000000,
  -255,  -256,  -257,  -273,-10000000,  -202,-10000000,-10000000,-10000000,  -203,
-10000000,  -204,-10000000,  -205,  -274,-10000000,  -246,-10000000,-10000000,-10000000,
  -275,-10000000,  -206,  -207,-10000000,-10000000 };
yytabelem yypgo[]={

     0,    99,    98,    97,    96,    95,    71,    69,    94,    93,
    92,    91,    90,    88,    87,    70,    86,    85,    84,    83,
    82,    81,    68,    79,    78,    77,    76,    75,    74,    73,
    72 };
yytabelem yyr1[]={

     0,     1,     2,     4,     5,     5,     6,     6,     6,     6,
     6,     7,     8,     9,    10,    11,    12,    13,    13,    15,
    15,    16,    14,     3,    17,    18,    18,    19,    20,    20,
    22,    22,    22,    22,    23,    23,    24,    24,    25,    25,
    26,    21,    27,    28,    28,    30,    29 };
yytabelem yyr2[]={

     0,     9,     4,    11,     2,     4,     2,     2,     2,     2,
     2,     5,     5,    11,    13,     6,     7,     2,     4,     2,
     2,     5,     5,     4,     7,     0,     4,    13,     2,     4,
     2,     2,     2,     2,     7,     9,     7,     9,     7,     9,
    13,     9,     5,     0,     7,     1,     1 };
yytabelem yychk[]={

-10000000,    -1,    -2,    -4,   259,    -3,   -17,   264,    -5,    -6,
    -7,    -8,    -9,   -10,   -11,   275,   272,   260,   261,   -12,
   262,   278,   271,   -18,   278,    -6,   257,   257,   278,   278,
   -13,   -15,    -7,   -16,   273,   278,   258,   257,   -19,   274,
   257,   278,   278,   -14,   -15,   263,   257,   257,   278,   257,
   278,   278,   257,   257,   -20,   -22,   -23,   -24,   -25,   -26,
   265,   266,   267,   268,   257,   278,   -21,   -22,   -27,   269,
   278,   278,   278,   278,   257,   270,   257,   -30,   257,   278,
   257,   278,   257,   278,   278,   257,   -28,   257,   257,   257,
   278,   -29,   276,   278,   257,   257 };
yytabelem yydef[]={

     0,    -2,     0,     0,     0,     0,    25,     0,     2,     4,
     6,     7,     8,     9,    10,     0,     0,     0,     0,     0,
     0,     0,     0,    23,     0,     5,    11,    12,     0,     0,
     0,    17,    19,    20,     0,     0,     0,     1,    26,     0,
    24,     0,     0,    15,    18,     0,    21,    16,     0,     0,
     0,     0,    22,     3,     0,    28,    30,    31,    32,    33,
     0,     0,     0,     0,    13,     0,     0,    29,     0,    45,
     0,     0,     0,     0,    14,     0,    43,    42,    34,     0,
    36,     0,    38,     0,     0,    27,    46,    35,    37,    39,
     0,    41,     0,     0,    44,    40 };
typedef struct
#ifdef __cplusplus
	yytoktype
#endif
{ char *t_name; int t_val; } yytoktype;
#ifndef YYDEBUG
#	define YYDEBUG	0	/* don't allow debugging */
#endif

#if YYDEBUG

yytoktype yytoks[] =
{
	"NEWLINE",	257,
	"DOT",	258,
	"STARTFONT",	259,
	"SIZE",	260,
	"FONTBOUNDINGBOX",	261,
	"STARTPROPERTIES",	262,
	"ENDPROPERTIES",	263,
	"CHARS",	264,
	"ENCODING",	265,
	"SWIDTH",	266,
	"DWIDTH",	267,
	"BBX",	268,
	"BITMAP",	269,
	"ENDCHAR",	270,
	"ENDFONT",	271,
	"FONT",	272,
	"PROPERTY",	273,
	"STARTCHAR",	274,
	"COMMENT",	275,
	"STRING",	276,
	"IDENTIFIER",	277,
	"NUMBER",	278,
	"-unknown-",	-1	/* ends search */
};

char * yyreds[] =
{
	"-no such reduction-",
	"file : definitions characters ENDFONT NEWLINE",
	"definitions : startfont fontdefs",
	"startfont : STARTFONT NUMBER DOT NUMBER NEWLINE",
	"fontdefs : fontdef",
	"fontdefs : fontdefs fontdef",
	"fontdef : comment",
	"fontdef : font",
	"fontdef : size",
	"fontdef : boundingbox",
	"fontdef : properties",
	"comment : COMMENT NEWLINE",
	"font : FONT NEWLINE",
	"size : SIZE NUMBER NUMBER NUMBER NEWLINE",
	"boundingbox : FONTBOUNDINGBOX NUMBER NUMBER NUMBER NUMBER NEWLINE",
	"properties : startprop props endprop",
	"startprop : STARTPROPERTIES NUMBER NEWLINE",
	"props : prop",
	"props : props prop",
	"prop : comment",
	"prop : junk",
	"junk : PROPERTY NEWLINE",
	"endprop : ENDPROPERTIES NEWLINE",
	"characters : chars chardefs",
	"chars : CHARS NUMBER NEWLINE",
	"chardefs : /* empty */",
	"chardefs : chardefs character",
	"character : STARTCHAR NEWLINE charprops bitmap ENDCHAR NEWLINE",
	"charprops : charprop",
	"charprops : charprops charprop",
	"charprop : encoding",
	"charprop : swidth",
	"charprop : dwidth",
	"charprop : bbx",
	"encoding : ENCODING NUMBER NEWLINE",
	"encoding : ENCODING NUMBER NUMBER NEWLINE",
	"swidth : SWIDTH NUMBER NEWLINE",
	"swidth : SWIDTH NUMBER NUMBER NEWLINE",
	"dwidth : DWIDTH NUMBER NEWLINE",
	"dwidth : DWIDTH NUMBER NUMBER NEWLINE",
	"bbx : BBX NUMBER NUMBER NUMBER NUMBER NEWLINE",
	"bitmap : bitmapstart NEWLINE numbers stringmodeoff",
	"bitmapstart : BITMAP stringmodeon",
	"numbers : /* empty */",
	"numbers : numbers STRING NEWLINE",
	"stringmodeon : /* empty */",
	"stringmodeoff : /* empty */",
};
#endif /* YYDEBUG */
#ident	"@(#)yacc:yaccpar	1.17"

/*
** Skeleton parser driver for yacc output
*/

/*
** yacc user known macros and defines
*/
#define YYERROR		goto yyerrlab
#define YYACCEPT	return(0)
#define YYABORT		return(1)
#define YYBACKUP( newtoken, newvalue )\
{\
	if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
	{\
		yyerror( "syntax error - cannot backup" );\
		goto yyerrlab;\
	}\
	yychar = newtoken;\
	yystate = *yyps;\
	yylval = newvalue;\
	goto yynewstate;\
}
#define YYRECOVERING()	(!!yyerrflag)
#define YYNEW(type)	malloc(sizeof(type) * yynewmax)
#define YYCOPY(to, from, type) \
	(type *) memcpy(to, (char *) from, yynewmax * sizeof(type))
#define YYENLARGE( from, type) \
	(type *) realloc((char *) from, yynewmax * sizeof(type))
#ifndef YYDEBUG
#	define YYDEBUG	1	/* make debugging available */
#endif

/*
** user known globals
*/
int yydebug;			/* set to 1 to get debugging */

/*
** driver internal defines
*/
#define YYFLAG		(-10000000)

/*
** global variables used by the parser
*/
YYSTYPE *yypv;			/* top of value stack */
int *yyps;			/* top of state stack */

int yystate;			/* current state */
int yytmp;			/* extra var (lasts between blocks) */

int yynerrs;			/* number of errors */
int yyerrflag;			/* error recovery flag */
int yychar;			/* current input token number */



/*
** yyparse - return 0 if worked, 1 if syntax error not recovered from
*/
#if defined(__STDC__) || defined(__cplusplus)
int yyparse(void)
#else
int yyparse()
#endif
{
	register YYSTYPE *yypvt;	/* top of value stack for $vars */

	/*
	** Initialize externals - yyparse may be called more than once
	*/
	yypv = &yyv[-1];
	yyps = &yys[-1];
	yystate = 0;
	yytmp = 0;
	yynerrs = 0;
	yyerrflag = 0;
	yychar = -1;

#if YYMAXDEPTH <= 0
	if (yymaxdepth <= 0)
	{
		if ((yymaxdepth = YYEXPAND(0)) <= 0)
		{
			yyerror("yacc initialization error");
			YYABORT;
		}
	}
#endif

	goto yystack;
	{
		register YYSTYPE *yy_pv;	/* top of value stack */
		register int *yy_ps;		/* top of state stack */
		register int yy_state;		/* current state */
		register int  yy_n;		/* internal state number info */

		/*
		** get globals into registers.
		** branch to here only if YYBACKUP was called.
		*/
	yynewstate:
		yy_pv = yypv;
		yy_ps = yyps;
		yy_state = yystate;
		goto yy_newstate;

		/*
		** get globals into registers.
		** either we just started, or we just finished a reduction
		*/
	yystack:
		yy_pv = yypv;
		yy_ps = yyps;
		yy_state = yystate;

		/*
		** top of for (;;) loop while no reductions done
		*/
	yy_stack:
		/*
		** put a state and value onto the stacks
		*/
#if YYDEBUG
		/*
		** if debugging, look up token value in list of value vs.
		** name pairs.  0 and negative (-1) are special values.
		** Note: linear search is used since time is not a real
		** consideration while debugging.
		*/
		if ( yydebug )
		{
			register int yy_i;

			printf( "State %d, token ", yy_state );
			if ( yychar == 0 )
				printf( "end-of-file\n" );
			else if ( yychar < 0 )
				printf( "-none-\n" );
			else
			{
				for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
					yy_i++ )
				{
					if ( yytoks[yy_i].t_val == yychar )
						break;
				}
				printf( "%s\n", yytoks[yy_i].t_name );
			}
		}
#endif /* YYDEBUG */
		if ( ++yy_ps >= &yys[ yymaxdepth ] )	/* room on stack? */
		{
			int yynewmax, yys_off, yyv_off;
			int *yys_base = yys;
			YYSTYPE *yyv_base = yyv;
#ifdef YYEXPAND
			yynewmax = YYEXPAND(yymaxdepth);
#else
			yynewmax = 2 * yymaxdepth;	/* double table size */
			if (yymaxdepth == YYMAXDEPTH)	/* first time growth */
			{
				char *newyys = YYNEW(int);
				char *newyyv = YYNEW(YYSTYPE);
				if (newyys != 0 && newyyv != 0)
				{
					yys = YYCOPY(newyys, yys, int);
					yyv = YYCOPY(newyyv, yyv, YYSTYPE);
				}
				else
					yynewmax = 0;	/* failed */
			}
			else				/* not first time */
			{
				yys = YYENLARGE(yys, int);
				yyv = YYENLARGE(yyv, YYSTYPE);
				if (yys == 0 || yyv == 0)
					yynewmax = 0;	/* failed */
			}
#endif
			if (yynewmax <= yymaxdepth)	/* tables not expanded */
			{
				yyerror( "yacc stack overflow" );
				YYABORT;
			}
			yymaxdepth = yynewmax;

			/* reset pointers into yys */
			yys_off = yys - yys_base;
			yy_ps = yy_ps + yys_off;
			yyps = yyps + yys_off;

			/* reset pointers into yyv */
			yyv_off = yyv - yyv_base;
			yypvt = yypvt + yyv_off;
			yy_pv = yy_pv + yyv_off;
			yypv = yypv + yyv_off;
		}
		*yy_ps = yy_state;
		*++yy_pv = yyval;

		/*
		** we have a new state - find out what to do
		*/
	yy_newstate:
		if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
			goto yydefault;		/* simple state */
#if YYDEBUG
		/*
		** if debugging, need to mark whether new token grabbed
		*/
		yytmp = yychar < 0;
#endif
		if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
			yychar = 0;		/* reached EOF */
#if YYDEBUG
		if ( yydebug && yytmp )
		{
			register int yy_i;

			printf( "Received token " );
			if ( yychar == 0 )
				printf( "end-of-file\n" );
			else if ( yychar < 0 )
				printf( "-none-\n" );
			else
			{
				for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
					yy_i++ )
				{
					if ( yytoks[yy_i].t_val == yychar )
						break;
				}
				printf( "%s\n", yytoks[yy_i].t_name );
			}
		}
#endif /* YYDEBUG */
		if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
			goto yydefault;
		if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )	/*valid shift*/
		{
			yychar = -1;
			yyval = yylval;
			yy_state = yy_n;
			if ( yyerrflag > 0 )
				yyerrflag--;
			goto yy_stack;
		}

	yydefault:
		if ( ( yy_n = yydef[ yy_state ] ) == -2 )
		{
#if YYDEBUG
			yytmp = yychar < 0;
#endif
			if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
				yychar = 0;		/* reached EOF */
#if YYDEBUG
			if ( yydebug && yytmp )
			{
				register int yy_i;

				printf( "Received token " );
				if ( yychar == 0 )
					printf( "end-of-file\n" );
				else if ( yychar < 0 )
					printf( "-none-\n" );
				else
				{
					for ( yy_i = 0;
						yytoks[yy_i].t_val >= 0;
						yy_i++ )
					{
						if ( yytoks[yy_i].t_val
							== yychar )
						{
							break;
						}
					}
					printf( "%s\n", yytoks[yy_i].t_name );
				}
			}
#endif /* YYDEBUG */
			/*
			** look through exception table
			*/
			{
				register int *yyxi = yyexca;

				while ( ( *yyxi != -1 ) ||
					( yyxi[1] != yy_state ) )
				{
					yyxi += 2;
				}
				while ( ( *(yyxi += 2) >= 0 ) &&
					( *yyxi != yychar ) )
					;
				if ( ( yy_n = yyxi[1] ) < 0 )
					YYACCEPT;
			}
		}

		/*
		** check for syntax error
		*/
		if ( yy_n == 0 )	/* have an error */
		{
			/* no worry about speed here! */
			switch ( yyerrflag )
			{
			case 0:		/* new error */
				yyerror( "syntax error" );
				goto skip_init;
			yyerrlab:
				/*
				** get globals into registers.
				** we have a user generated syntax type error
				*/
				yy_pv = yypv;
				yy_ps = yyps;
				yy_state = yystate;
				yynerrs++;
				/* FALLTHRU */
			skip_init:
			case 1:
			case 2:		/* incompletely recovered error */
					/* try again... */
				yyerrflag = 3;
				/*
				** find state where "error" is a legal
				** shift action
				*/
				while ( yy_ps >= yys )
				{
					yy_n = yypact[ *yy_ps ] + YYERRCODE;
					if ( yy_n >= 0 && yy_n < YYLAST &&
						yychk[yyact[yy_n]] == YYERRCODE)					{
						/*
						** simulate shift of "error"
						*/
						yy_state = yyact[ yy_n ];
						goto yy_stack;
					}
					/*
					** current state has no shift on
					** "error", pop stack
					*/
#if YYDEBUG
#	define _POP_ "Error recovery pops state %d, uncovers state %d\n"
					if ( yydebug )
						printf( _POP_, *yy_ps,
							yy_ps[-1] );
#	undef _POP_
#endif
					yy_ps--;
					yy_pv--;
				}
				/*
				** there is no state on stack with "error" as
				** a valid shift.  give up.
				*/
				YYABORT;
			case 3:		/* no shift yet; eat a token */
#if YYDEBUG
				/*
				** if debugging, look up token in list of
				** pairs.  0 and negative shouldn't occur,
				** but since timing doesn't matter when
				** debugging, it doesn't hurt to leave the
				** tests here.
				*/
				if ( yydebug )
				{
					register int yy_i;

					printf( "Error recovery discards " );
					if ( yychar == 0 )
						printf( "token end-of-file\n" );
					else if ( yychar < 0 )
						printf( "token -none-\n" );
					else
					{
						for ( yy_i = 0;
							yytoks[yy_i].t_val >= 0;
							yy_i++ )
						{
							if ( yytoks[yy_i].t_val
								== yychar )
							{
								break;
							}
						}
						printf( "token %s\n",
							yytoks[yy_i].t_name );
					}
				}
#endif /* YYDEBUG */
				if ( yychar == 0 )	/* reached EOF. quit */
					YYABORT;
				yychar = -1;
				goto yy_newstate;
			}
		}/* end if ( yy_n == 0 ) */
		/*
		** reduction by production yy_n
		** put stack tops, etc. so things right after switch
		*/
#if YYDEBUG
		/*
		** if debugging, print the string that is the user's
		** specification of the reduction which is just about
		** to be done.
		*/
		if ( yydebug )
			printf( "Reduce by (%d) \"%s\"\n",
				yy_n, yyreds[ yy_n ] );
#endif
		yytmp = yy_n;			/* value to switch over */
		yypvt = yy_pv;			/* $vars top of value stack */
		/*
		** Look in goto table for next state
		** Sorry about using yy_state here as temporary
		** register variable, but why not, if it works...
		** If yyr2[ yy_n ] doesn't have the low order bit
		** set, then there is no action to be done for
		** this reduction.  So, no saving & unsaving of
		** registers done.  The only difference between the
		** code just after the if and the body of the if is
		** the goto yy_stack in the body.  This way the test
		** can be made before the choice of what to do is needed.
		*/
		{
			/* length of production doubled with extra bit */
			register int yy_len = yyr2[ yy_n ];

			if ( !( yy_len & 01 ) )
			{
				yy_len >>= 1;
				yyval = ( yy_pv -= yy_len )[1];	/* $$ = $1 */
				yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
					*( yy_ps -= yy_len ) + 1;
				if ( yy_state >= YYLAST ||
					yychk[ yy_state =
					yyact[ yy_state ] ] != -yy_n )
				{
					yy_state = yyact[ yypgo[ yy_n ] ];
				}
				goto yy_stack;
			}
			yy_len >>= 1;
			yyval = ( yy_pv -= yy_len )[1];	/* $$ = $1 */
			yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
				*( yy_ps -= yy_len ) + 1;
			if ( yy_state >= YYLAST ||
				yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
			{
				yy_state = yyact[ yypgo[ yy_n ] ];
			}
		}
					/* save until reenter driver code */
		yystate = yy_state;
		yyps = yy_ps;
		yypv = yy_pv;
	}
	/*
	** code supplied by user is placed in this switch
	*/
	switch( yytmp )
	{
		
case 1:
# line 54 "parse.y"
{
			struct character *charp;
			int i;

			/*
			 * find max box for window size
			 */
			font.maxbbx.w = font.maxbbx.h = 0;
			for (i=0, charp=font.characters; i<font.nchars; i++, charp++) {
			    if (charp->bbx.w > font.maxbbx.w)
				font.maxbbx.w = charp->bbx.w;
			    if (charp->bbx.h > font.maxbbx.h)
				font.maxbbx.h = charp->bbx.h;
			}
		    } break;
case 3:
# line 75 "parse.y"
{
			font.rev = yypvt[-3].ival;
			font.subrev = yypvt[-1].ival;
			font.szcomments = INC_COMMENTS;
			font.ncomments = 0;
			font.comments = (char **) malloc(font.szcomments
							 * sizeof(char *));
			if (font.rev != 2 || font.subrev != 1)
			    fprintf(stderr, "WARNING: font is not rev 2.1\n");
		    } break;
case 11:
# line 99 "parse.y"
{
			if (font.ncomments == font.szcomments) {
			    font.szcomments += INC_COMMENTS;
			    font.comments = (char **) realloc(
				(char *) font.comments,
				font.szcomments * sizeof(char *));
			}
			font.comments[font.ncomments++] = yypvt[-1].sval;
		    } break;
case 12:
# line 111 "parse.y"
{
			font.fontname = yypvt[-1].sval;
		    } break;
case 13:
# line 117 "parse.y"
{
			font.sizes[0] = yypvt[-3].ival;
			font.sizes[1] = yypvt[-2].ival;
			font.sizes[2] = yypvt[-1].ival;
		    } break;
case 14:
# line 125 "parse.y"
{
			font.boundingbox.w = yypvt[-4].ival;
			font.boundingbox.h = yypvt[-3].ival;
			font.boundingbox.x = yypvt[-2].ival;
			font.boundingbox.y = yypvt[-1].ival;
		    } break;
case 16:
# line 137 "parse.y"
{
			font.nprops = yypvt[-1].ival;
			font.props = (char **)
			    malloc(font.nprops * sizeof(char *));
			npropCounted = 0;
		    } break;
case 21:
# line 154 "parse.y"
{
			if (npropCounted < font.nprops) {
			    font.props[npropCounted] = yypvt[-1].sval;
			}			    
			npropCounted++;
		    } break;
case 22:
# line 163 "parse.y"
{
			if (font.nprops != npropCounted)
			    fprintf(stderr,
"Warning: STARTPROPERTIES said %d, counted %d properties, skipping excess\n",
				    font.nprops, npropCounted);
		    } break;
case 24:
# line 175 "parse.y"
{
			font.nchars = yypvt[-1].ival;
			font.characters = (struct character *)
				malloc(sizeof(struct character) * yypvt[-1].ival);
			charp = font.characters;
		    } break;
case 27:
# line 188 "parse.y"
{
			charp->charId = yypvt[-5].sval;
			charp++;
		    } break;
case 34:
# line 205 "parse.y"
{
			charp->encoding = yypvt[-1].ival;
			charp->notadobe = 0;
		    } break;
case 35:
# line 210 "parse.y"
{
			if (yypvt[-2].ival != -1) {
			    fprintf(stderr, "Bad ENCODING syntax in line %d",
			     lineno);
			}
			charp->notadobe = 1;
			charp->encoding = yypvt[-1].ival;
		    } break;
case 36:
# line 221 "parse.y"
{
			charp->swidth[0] = yypvt[-1].ival;
			charp->swidth[1] = 0;
		    } break;
case 37:
# line 226 "parse.y"
{
			charp->swidth[0] = yypvt[-2].ival;
			charp->swidth[1] = yypvt[-1].ival;
		    } break;
case 38:
# line 233 "parse.y"
{
			charp->dwidth[0] = yypvt[-1].ival;
			charp->dwidth[1] = 0;
		    } break;
case 39:
# line 238 "parse.y"
{
			charp->dwidth[0] = yypvt[-2].ival;
			charp->dwidth[1] = yypvt[-1].ival;
		    } break;
case 40:
# line 245 "parse.y"
{
		    	int w, h;
			
			charp->bbx.w = yypvt[-4].ival;
			charp->bbx.h = yypvt[-3].ival;
			charp->bbx.x = yypvt[-2].ival;
			charp->bbx.y = yypvt[-1].ival;
			w = (charp->bbx.x < 0) ? charp->bbx.w : 
			 charp->bbx.x + charp->bbx.w;
			h = (charp->bbx.y < 0) ? charp->bbx.h :
			 charp->bbx.y + charp->bbx.h;
			if (charp->bbx.x < minx)
				minx = charp->bbx.x;
			if (w > maxx)
				maxx = w;
			if (charp->bbx.y < miny)
				miny = charp->bbx.y;
			if (h > maxy)
				maxy = h;
		    } break;
case 41:
# line 268 "parse.y"
{
			int i;

			charp->nrows = nrows;
			charp->rows = (char **)malloc(sizeof(char *) * nrows);
			for (i=0; i<nrows; i++) 
			    charp->rows[i] = bits[i];
		    } break;
case 42:
# line 279 "parse.y"
{
			nrows = 0;
		    } break;
case 44:
# line 286 "parse.y"
{
			if (nrows >= MAXROWS) {
			    fprintf(stderr, "Too many rows. Max %d\n",
				    MAXROWS);
			    exit(1);
			}
			bits[nrows++] = yypvt[-1].sval;
		    } break;
case 45:
# line 297 "parse.y"
{
			/* this is a kludge - sorry */
			stringMode = 1;
		    } break;
case 46:
# line 304 "parse.y"
{
			stringMode = 0;
		    } break;
	}
	goto yystack;		/* reset registers in driver code */
}
