home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
games
/
volume15
/
reversi2
/
part01
/
makeedge.c
next >
Wrap
C/C++ Source or Header
|
1993-01-27
|
30KB
|
1,079 lines
extern char *malloc(), *realloc();
# line 2 "makeedge.y"
/*
* ex:set ts=8 sw=8:
*/
int score;
extern int position;
# line 8 "makeedge.y"
typedef union {
struct {
int width;
int position;
int base;
} field;
int ival;
} YYSTYPE;
# define WHITE 257
# define BLACK 258
# define EMPTY 259
# define NL 260
#define yyclearin yychar = -1
#define yyerrok yyerrflag = 0
extern int yychar;
extern int yyerrflag;
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 150
#endif
YYSTYPE yylval, yyval;
# define YYERRCODE 256
# line 381 "makeedge.y"
# include <stdio.h>
main ()
{
return yyparse ();
}
char line[80];
char *lp = line;
yyerror (s)
char *s;
{
fprintf (stderr, "%s in %s\n", s, line);
}
yywrap ()
{
return 1;
}
int position = 1;
int base[] = { 0, 20, -30, 15, -5, -5, 15, -30, 20, 0 };
yylex ()
{
char *gets();
if (*lp == '\0')
if (fgets (line, 80, stdin) == 0)
return -1;
else
lp = line;
for (;;) {
switch (*lp++) {
case ' ':
case '\t':
break;
case '\n':
lp[-1] = '\0';
position = 1;
return NL;
case 'O':
yylval.field.base = -
base[yylval.field.position = position++];
yylval.field.width = 1;
return BLACK;
case '*':
yylval.field.base =
base[yylval.field.position = position++];
yylval.field.width = 1;
return WHITE;
case '-':
yylval.field.base = 0;
yylval.field.position = position++;
yylval.field.width = 1;
return EMPTY;
}
}
}
int yyexca[] ={
-1, 1,
0, -1,
-2, 0,
};
# define YYNPROD 50
# define YYLAST 189
int yyact[]={
6, 14, 12, 9, 7, 12, 6, 7, 26, 6,
14, 50, 9, 7, 47, 6, 14, 41, 9, 7,
38, 6, 7, 12, 6, 7, 5, 14, 12, 9,
56, 12, 25, 36, 32, 22, 6, 7, 6, 26,
7, 59, 1, 31, 30, 27, 29, 60, 4, 35,
10, 37, 20, 21, 17, 2, 0, 46, 8, 0,
0, 0, 33, 0, 13, 0, 39, 55, 0, 0,
10, 0, 0, 0, 0, 49, 0, 66, 0, 69,
0, 68, 45, 0, 72, 65, 74, 62, 63, 10,
62, 0, 0, 0, 28, 0, 3, 71, 54, 15,
19, 64, 78, 0, 58, 23, 80, 0, 39, 0,
83, 0, 84, 0, 0, 42, 0, 81, 82, 0,
0, 0, 62, 62, 52, 70, 0, 0, 15, 11,
16, 18, 73, 57, 15, 61, 24, 75, 61, 0,
0, 34, 67, 76, 0, 40, 43, 77, 0, 44,
0, 79, 0, 0, 48, 51, 0, 42, 0, 53,
0, 0, 0, 0, 0, 16, 0, 0, 11, 0,
61, 61, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 40, 43 };
int yypact[]={
-1000, -233, -1000, -254, -257, -236, -1000, -1000, -225, -1000,
-257, -251, -1000, -226, -1000, -254, -251, -227, -251, -239,
-242, -1000, -1000, -254, -251, -1000, -1000, -1000, -245, -248,
-1000, -1000, -1000, -257, -251, -1000, -1000, -230, -219, -257,
-251, -218, -254, -251, -251, -1000, -1000, -219, -251, -231,
-218, -251, -228, -251, -1000, -1000, -1000, -228, -1000, -1000,
-1000, -254, -257, -231, -1000, -1000, -1000, -228, -1000, -221,
-220, -231, -1000, -221, -1000, -221, -221, -221, -1000, -221,
-1000, -1000, -1000, -1000, -1000 };
int yypgo[]={
0, 55, 94, 46, 125, 79, 58, 64, 41, 47,
54, 32, 45, 44, 43, 42 };
int yyr1[]={
0, 15, 15, 1, 1, 1, 1, 6, 6, 6,
6, 6, 6, 7, 7, 7, 7, 7, 7, 11,
11, 2, 2, 3, 3, 4, 4, 8, 8, 10,
10, 10, 9, 9, 9, 9, 9, 9, 12, 12,
12, 12, 12, 12, 12, 12, 13, 14, 5, 5 };
int yyr2[]={
0, 5, 0, 7, 7, 7, 9, 9, 7, 7,
3, 5, 1, 9, 7, 7, 3, 5, 1, 3,
1, 5, 3, 5, 3, 5, 3, 3, 1, 11,
11, 2, 7, 7, 7, 7, 3, 3, 11, 7,
11, 7, 3, 3, 3, 3, 9, 9, 3, 1 };
int yychk[]={
-1000, -15, -1, -2, -3, 259, 257, 258, -6, 257,
-3, -4, 259, -7, 258, -2, -4, -10, -4, -2,
-3, -9, 260, -2, -4, -11, 259, -12, -2, -3,
-13, -14, 260, -3, -4, -11, 260, -11, 259, -3,
-4, 259, -2, -4, -4, -6, -11, 259, -4, -3,
259, -4, -2, -4, -7, -11, 260, -2, -7, -8,
-9, -2, -3, -3, -6, -8, -11, -2, -11, -5,
-4, -3, -11, -5, -11, -5, -5, -5, -11, -5,
-11, -8, -8, -11, -11 };
int yydef[]={
2, -2, 1, 12, 18, 0, 22, 24, 0, 21,
10, 20, 26, 0, 23, 16, 20, 0, 20, 36,
37, 31, 3, 12, 20, 11, 25, 19, 42, 43,
44, 45, 4, 18, 20, 17, 5, 0, 26, 18,
28, 26, 12, 28, 20, 8, 9, 26, 20, 49,
26, 20, 49, 20, 14, 15, 6, 49, 32, 34,
27, 36, 37, 49, 33, 35, 7, 49, 39, 20,
48, 49, 41, 20, 13, 28, 28, 20, 46, 20,
47, 29, 30, 38, 40 };
typedef struct { char *t_name; int t_val; } yytoktype;
#ifndef YYDEBUG
# define YYDEBUG 0 /* don't allow debugging */
#endif
#if YYDEBUG
yytoktype yytoks[] =
{
"WHITE", 257,
"BLACK", 258,
"EMPTY", 259,
"NL", 260,
"-unknown-", -1 /* ends search */
};
char * yyreds[] =
{
"-no such reduction-",
"lines : lines line",
"lines : /* empty */",
"line : whites type1 NL",
"line : blacks type2 NL",
"line : EMPTY type3 NL",
"line : EMPTY empties otype4 NL",
"type1 : blacks whites empties otype4",
"type1 : blacks whites type1",
"type1 : blacks empties otype4",
"type1 : blacks",
"type1 : empties otype4",
"type1 : /* empty */",
"type2 : whites blacks empties otype4",
"type2 : whites blacks type2",
"type2 : whites empties otype4",
"type2 : whites",
"type2 : empties otype4",
"type2 : /* empty */",
"otype4 : type4",
"otype4 : /* empty */",
"whites : whites WHITE",
"whites : WHITE",
"blacks : blacks BLACK",
"blacks : BLACK",
"empties : empties EMPTY",
"empties : EMPTY",
"otype3e : type3e",
"otype3e : /* empty */",
"type3 : whites EMPTY whites oempties otype3e",
"type3 : blacks EMPTY blacks oempties otype3e",
"type3 : type3e",
"type3e : whites blacks type2",
"type3e : blacks whites type1",
"type3e : whites empties otype3e",
"type3e : blacks empties otype3e",
"type3e : whites",
"type3e : blacks",
"type4 : whites EMPTY whites oempties otype4",
"type4 : whites empties otype4",
"type4 : blacks EMPTY blacks oempties otype4",
"type4 : blacks empties otype4",
"type4 : whites",
"type4 : blacks",
"type4 : type4.w",
"type4 : type4.b",
"type4.w : whites blacks oempties otype4",
"type4.b : blacks whites oempties otype4",
"oempties : empties",
"oempties : /* empty */",
};
#endif /* YYDEBUG */
#line 1 "/usr/lib/yaccpar"
/* @(#)yaccpar 1.10 89/04/04 SMI; from S5R3 1.10 */
/*
** Skeleton parser driver for yacc output
*/
/*
** yacc user known macros and defines
*/
#define YYERROR goto yyerrlab
#define YYACCEPT { free(yys); free(yyv); return(0); }
#define YYABORT { free(yys); free(yyv); 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)
#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 (-1000)
/*
** static variables used by the parser
*/
static YYSTYPE *yyv; /* value stack */
static int *yys; /* state stack */
static YYSTYPE *yypv; /* top of value stack */
static int *yyps; /* top of state stack */
static int yystate; /* current state */
static 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
*/
int
yyparse()
{
register YYSTYPE *yypvt; /* top of value stack for $vars */
unsigned yymaxdepth = YYMAXDEPTH;
/*
** Initialize externals - yyparse may be called more than once
*/
yyv = (YYSTYPE*)malloc(yymaxdepth*sizeof(YYSTYPE));
yys = (int*)malloc(yymaxdepth*sizeof(int));
if (!yyv || !yys)
{
yyerror( "out of memory" );
return(1);
}
yypv = &yyv[-1];
yyps = &yys[-1];
yystate = 0;
yytmp = 0;
yynerrs = 0;
yyerrflag = 0;
yychar = -1;
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;
(void)printf( "State %d, token ", yy_state );
if ( yychar == 0 )
(void)printf( "end-of-file\n" );
else if ( yychar < 0 )
(void)printf( "-none-\n" );
else
{
for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
yy_i++ )
{
if ( yytoks[yy_i].t_val == yychar )
break;
}
(void)printf( "%s\n", yytoks[yy_i].t_name );
}
}
#endif /* YYDEBUG */
if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */
{
/*
** reallocate and recover. Note that pointers
** have to be reset, or bad things will happen
*/
int yyps_index = (yy_ps - yys);
int yypv_index = (yy_pv - yyv);
int yypvt_index = (yypvt - yyv);
yymaxdepth += YYMAXDEPTH;
yyv = (YYSTYPE*)realloc((char*)yyv,
yymaxdepth * sizeof(YYSTYPE));
yys = (int*)realloc((char*)yys,
yymaxdepth * sizeof(int));
if (!yyv || !yys)
{
yyerror( "yacc stack overflow" );
return(1);
}
yy_ps = yys + yyps_index;
yy_pv = yyv + yypv_index;
yypvt = yyv + yypvt_index;
}
*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;
(void)printf( "Received token " );
if ( yychar == 0 )
(void)printf( "end-of-file\n" );
else if ( yychar < 0 )
(void)printf( "-none-\n" );
else
{
for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
yy_i++ )
{
if ( yytoks[yy_i].t_val == yychar )
break;
}
(void)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;
(void)printf( "Received token " );
if ( yychar == 0 )
(void)printf( "end-of-file\n" );
else if ( yychar < 0 )
(void)printf( "-none-\n" );
else
{
for ( yy_i = 0;
yytoks[yy_i].t_val >= 0;
yy_i++ )
{
if ( yytoks[yy_i].t_val
== yychar )
{
break;
}
}
(void)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++;
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 )
(void)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;
(void)printf( "Error recovery discards " );
if ( yychar == 0 )
(void)printf( "token end-of-file\n" );
else if ( yychar < 0 )
(void)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;
}
}
(void)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 )
(void)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 22 "makeedge.y"
{ printf ("\t%5d,\t/*%s */\n", yypvt[-0].field.base, line); } break;
case 3:
# line 26 "makeedge.y"
{ yyval.field.base = 20 * yypvt[-2].field.width + yypvt[-1].field.base; } break;
case 4:
# line 28 "makeedge.y"
{ yyval.field.base = -20 * yypvt[-2].field.width + yypvt[-1].field.base; } break;
case 5:
# line 30 "makeedge.y"
{ yyval.field.base = yypvt[-1].field.base; } break;
case 6:
# line 32 "makeedge.y"
{ yyval.field.base = yypvt[-1].field.base; } break;
case 7:
# line 35 "makeedge.y"
{
yyval.field.base = yypvt[-0].field.base;
switch (yypvt[-2].field.position) {
case 7:
yyval.field.base -= (yypvt[-2].field.width + yypvt[-3].field.width+1) * 15;
break;
default:
if (yypvt[-1].field.width == 1)
yyval.field.base -=
(yypvt[-3].field.width + yypvt[-2].field.width+1) * 15;
else
yyval.field.base +=
(yypvt[-2].field.width - yypvt[-3].field.width) * 20;
break;
}
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-3].field.width + yypvt[-2].field.width + yypvt[-1].field.width;
} break;
case 8:
# line 54 "makeedge.y"
{
yyval.field.base = yypvt[-0].field.base;
yyval.field.base -= (yypvt[-2].field.width - yypvt[-1].field.width) * 20;
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-2].field.width + yypvt[-1].field.width + yypvt[-0].field.width;
} break;
case 9:
# line 61 "makeedge.y"
{
yyval.field.base = (yypvt[-2].field.width + 1) * 15 + yypvt[-0].field.base;
yyval.field.width = yypvt[-2].field.width + yypvt[-1].field.width + yypvt[-0].field.width;
yyval.field.position = yypvt[-0].field.position;
} break;
case 10:
# line 67 "makeedge.y"
{
yyval.field = yypvt[-0].field;
yyval.field.base = - yypvt[-0].field.width * 20;
} break;
case 11:
# line 72 "makeedge.y"
{
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-1].field.width+yypvt[-0].field.width;
yyval.field.base = yypvt[-0].field.base;
} break;
case 12:
# line 78 "makeedge.y"
{ yyval.field.position = position; yyval.field.width = 0; yyval.field.base = 0; } break;
case 13:
# line 81 "makeedge.y"
{
yyval.field.base = yypvt[-0].field.base;
switch (yypvt[-2].field.position) {
case 7:
yyval.field.base += (yypvt[-2].field.width + yypvt[-3].field.width+1) * 15;
break;
default:
if (yypvt[-1].field.width == 1)
yyval.field.base +=
(yypvt[-3].field.width + yypvt[-2].field.width+1) * 15;
else
yyval.field.base -=
(yypvt[-2].field.width - yypvt[-3].field.width) * 20;
break;
}
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-3].field.width + yypvt[-2].field.width + yypvt[-1].field.width
+ yypvt[-0].field.width;
} break;
case 14:
# line 101 "makeedge.y"
{
yyval.field.base = yypvt[-0].field.base;
yyval.field.base += (yypvt[-2].field.width - yypvt[-1].field.width) * 20;
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-2].field.width + yypvt[-1].field.width + yypvt[-0].field.width;
} break;
case 15:
# line 108 "makeedge.y"
{
yyval.field.base = - (yypvt[-2].field.width + 1) * 15 + yypvt[-0].field.base;
yyval.field.width = yypvt[-2].field.width + yypvt[-1].field.width + yypvt[-0].field.width;
yyval.field.position = yypvt[-0].field.position;
} break;
case 16:
# line 114 "makeedge.y"
{
yyval.field = yypvt[-0].field;
yyval.field.base = yypvt[-0].field.width * 20;
} break;
case 17:
# line 119 "makeedge.y"
{
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-1].field.width+yypvt[-0].field.width;
yyval.field.base = yypvt[-0].field.base;
} break;
case 18:
# line 125 "makeedge.y"
{ yyval.field.position = 0; yyval.field.width = 0; yyval.field.base = 0; } break;
case 19:
# line 128 "makeedge.y"
{ yyval.field = yypvt[-0].field; } break;
case 20:
# line 130 "makeedge.y"
{ yyval.field.position = position; yyval.field.width = 0; yyval.field.base = 0; } break;
case 21:
# line 133 "makeedge.y"
{
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-1].field.width + yypvt[-0].field.width;
yyval.field.base = yypvt[-1].field.base + yypvt[-0].field.base;
} break;
case 22:
# line 139 "makeedge.y"
{ yyval.field = yypvt[-0].field; } break;
case 23:
# line 142 "makeedge.y"
{
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-1].field.width + yypvt[-0].field.width;
yyval.field.base = yypvt[-1].field.base + yypvt[-0].field.base;
} break;
case 24:
# line 148 "makeedge.y"
{ yyval.field = yypvt[-0].field; } break;
case 25:
# line 151 "makeedge.y"
{
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-1].field.width + yypvt[-0].field.width;
yyval.field.base = yypvt[-1].field.base + yypvt[-0].field.base;
} break;
case 26:
# line 157 "makeedge.y"
{ yyval.field = yypvt[-0].field; } break;
case 27:
# line 160 "makeedge.y"
{ yyval.field = yypvt[-0].field; } break;
case 28:
# line 162 "makeedge.y"
{ yyval.field.position = position; yyval.field.width = 0; yyval.field.base = 0; } break;
case 29:
# line 165 "makeedge.y"
{
yyval.field.base = -(yypvt[-4].field.width + yypvt[-2].field.width + 2) * 15 +
yypvt[-0].field.base;
yyval.field.width = yypvt[-4].field.width + yypvt[-3].field.width + yypvt[-2].field.width
+ yypvt[-1].field.width + yypvt[-0].field.width;
yyval.field.position = yypvt[-0].field.position;
} break;
case 30:
# line 173 "makeedge.y"
{
yyval.field.base = (yypvt[-4].field.width + yypvt[-2].field.width + 2) * 15 +
yypvt[-0].field.base;
yyval.field.width = yypvt[-4].field.width + yypvt[-3].field.width + yypvt[-2].field.width
+ yypvt[-1].field.width + yypvt[-0].field.width;
yyval.field.position = yypvt[-0].field.position;
} break;
case 32:
# line 183 "makeedge.y"
{
yyval.field.base = -15 * (yypvt[-2].field.width + yypvt[-1].field.width + 1);
yyval.field.width = yypvt[-2].field.width + yypvt[-1].field.width + yypvt[-0].field.width;
yyval.field.position = yypvt[-0].field.position;
} break;
case 33:
# line 189 "makeedge.y"
{
yyval.field.base = 15 * (yypvt[-2].field.width + yypvt[-1].field.width + 1);
yyval.field.width = yypvt[-2].field.width + yypvt[-1].field.width + yypvt[-0].field.width;
yyval.field.position = yypvt[-0].field.position;
} break;
case 34:
# line 195 "makeedge.y"
{
if (yypvt[-2].field.position - yypvt[-2].field.width == 1) {
switch (yypvt[-2].field.width) {
case 1:
yyval.field.base = -30;
break;
case 6:
yyval.field.base = -20;
break;
case 2:
yyval.field.base = -15;
break;
case 3:
yyval.field.base = -10;
break;
case 4:
yyval.field.base = -5;
break;
case 5:
yyval.field.base = 10;
break;
default:
yyerror ("weirdo");
break;
}
} else {
yyval.field.base = yypvt[-2].field.base;
}
yyval.field.base += yypvt[-0].field.base;
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-2].field.width + yypvt[-1].field.width + yypvt[-0].field.width;
} break;
case 35:
# line 228 "makeedge.y"
{
if (yypvt[-2].field.position - yypvt[-2].field.width == 1) {
switch (yypvt[-2].field.width) {
case 1:
yyval.field.base = 30;
break;
case 6:
yyval.field.base = 20;
break;
case 2:
yyval.field.base = 15;
break;
case 3:
yyval.field.base = 10;
break;
case 4:
yyval.field.base = 5;
break;
case 5:
yyval.field.base = -10;
break;
default:
yyerror ("weirdo");
break;
}
} else {
yyval.field.base = yypvt[-2].field.base;
}
yyval.field.base += yypvt[-0].field.base;
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-2].field.width + yypvt[-1].field.width + yypvt[-0].field.width;
} break;
case 36:
# line 261 "makeedge.y"
{
yyval.field.base = 20 * yypvt[-0].field.width;
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-0].field.width;
} break;
case 37:
# line 267 "makeedge.y"
{
yyval.field.base = -20 * yypvt[-0].field.width;
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-0].field.width;
} break;
case 38:
# line 274 "makeedge.y"
{
if (yypvt[-1].field.position == 8) {
yyval.field.base = -(yypvt[-4].field.width + yypvt[-2].field.width + 2) * 15;
} else {
yyval.field.base = 0;
if (yypvt[-4].field.position - yypvt[-4].field.width + 1 == 3)
yyval.field.base = yypvt[-4].field.width * 15;
else
yyval.field.base = yypvt[-4].field.base;
if (yypvt[-2].field.position == 6)
yyval.field.base += yypvt[-2].field.width * 15;
else
yyval.field.base += yypvt[-2].field.base;
yyval.field.base += yypvt[-0].field.base;
}
yyval.field.width = yypvt[-4].field.width + yypvt[-3].field.width + yypvt[-2].field.width
+ yypvt[-1].field.width + yypvt[-0].field.width;
yyval.field.position = yypvt[-0].field.position;
} break;
case 39:
# line 294 "makeedge.y"
{
if (yypvt[-2].field.position - yypvt[-2].field.width + 1 == 3)
yyval.field.base = yypvt[-2].field.width * 15 + yypvt[-0].field.base;
else if (yypvt[-2].field.position == 6)
yyval.field.base = yypvt[-2].field.width * 15 + yypvt[-0].field.base;
else
yyval.field.base = yypvt[-2].field.base + yypvt[-0].field.base;
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-2].field.width + yypvt[-1].field.width + yypvt[-0].field.width;
} break;
case 40:
# line 305 "makeedge.y"
{
if (yypvt[-1].field.position == 8) {
yyval.field.base = (yypvt[-4].field.width + yypvt[-2].field.width + 2) * 15;
} else {
yyval.field.base = 0;
if (yypvt[-4].field.position - yypvt[-4].field.width + 1 == 3)
yyval.field.base = -yypvt[-4].field.width * 15;
else
yyval.field.base = yypvt[-4].field.base;
if (yypvt[-2].field.position == 6)
yyval.field.base += -yypvt[-2].field.width * 15;
else
yyval.field.base += yypvt[-2].field.base;
yyval.field.base += yypvt[-0].field.base;
}
yyval.field.width = yypvt[-4].field.width + yypvt[-3].field.width + yypvt[-2].field.width
+ yypvt[-1].field.width + yypvt[-0].field.width;
yyval.field.position = yypvt[-0].field.position;
} break;
case 41:
# line 325 "makeedge.y"
{
if (yypvt[-2].field.position - yypvt[-2].field.width + 1 == 3)
yyval.field.base = -yypvt[-2].field.width * 15 + yypvt[-0].field.base;
else if (yypvt[-2].field.position == 6)
yyval.field.base = -yypvt[-2].field.width * 15 + yypvt[-0].field.base;
else
yyval.field.base = yypvt[-2].field.base + yypvt[-0].field.base;
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-2].field.width + yypvt[-1].field.width + yypvt[-0].field.width;
} break;
case 42:
# line 336 "makeedge.y"
{
yyval.field.base = 20 * yypvt[-0].field.width;
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-0].field.width;
} break;
case 43:
# line 342 "makeedge.y"
{
yyval.field.base = -20 * yypvt[-0].field.width;
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-0].field.width;
} break;
case 44:
# line 348 "makeedge.y"
{ yyval.field = yypvt[-0].field; } break;
case 45:
# line 350 "makeedge.y"
{ yyval.field = yypvt[-0].field; } break;
case 46:
# line 353 "makeedge.y"
{
if (yypvt[-2].field.position == 8)
yyval.field.base = - (yypvt[-3].field.width + yypvt[-2].field.width + 1) * 15;
else if (yypvt[-1].field.position == 8 && yypvt[-1].field.width == 1)
yyval.field.base = (yypvt[-3].field.width + yypvt[-2].field.width + 1) * 10;
else
yyval.field.base = yypvt[-3].field.base + yypvt[-2].field.base + yypvt[-0].field.base;
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-3].field.width + yypvt[-2].field.width + yypvt[-1].field.width + yypvt[-0].field.width;
} break;
case 47:
# line 365 "makeedge.y"
{
if (yypvt[-2].field.position == 8)
yyval.field.base = (yypvt[-3].field.width + yypvt[-2].field.width + 1) * 15;
else if (yypvt[-1].field.position == 8 && yypvt[-1].field.width == 1)
yyval.field.base = - (yypvt[-3].field.width + yypvt[-2].field.width + 1) * 10;
else
yyval.field.base = yypvt[-3].field.base + yypvt[-2].field.base + yypvt[-0].field.base;
yyval.field.position = yypvt[-0].field.position;
yyval.field.width = yypvt[-3].field.width + yypvt[-2].field.width + yypvt[-1].field.width + yypvt[-0].field.width;
} break;
case 48:
# line 377 "makeedge.y"
{ yyval.field = yypvt[-0].field; } break;
case 49:
# line 379 "makeedge.y"
{ yyval.field.position = position; yyval.field.width = 0; yyval.field.base = 0; } break;
}
goto yystack; /* reset registers in driver code */
}