
# line 2 "parser.y"
/*
    This file is part of the FElt finite element analysis package.
    Copyright (C) 1993 Jason I. Gobat and Darren C. Atkinson

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

/************************************************************************
 * File:	parser.y						*
 *									*
 * Description:	This file contains the yacc specification for the	*
 *		input file parser.					*
 ************************************************************************/

# include <stdio.h>
# include <string.h>
# include <math.h>
# include "problem.h"
# include "allocate.h"
# include "objects.h"
# include "error.h"

# define ln problem.line
# define MNPE MaxNodesPerElement

static double		  lastx;		/* last x coordinate	    */
static double		  lasty;		/* last y coordinate	    */
static double		  lastz;		/* last z coordinate	    */
static char		 *lastconstraint;	/* name of last constraint  */
static char		 *lastmaterial;		/* name of last material    */
static int		  intarray [MNPE];	/* integer array	    */
static int		 *intptr;		/* pointer into array	    */
static Pair		  pairarray [MNPE];	/* pair array		    */
static Pair		 *pairptr;		/* pointer into array	    */
static Node		  node;			/* current node		    */
static Element		  element;		/* current element	    */
static Material		  material;		/* current material	    */
static Force		  force;		/* current force	    */
static Constraint	  constraint;		/* current constraint       */
static Distributed        distributed;		/* current distributed load */
static Definition	  definition;		/* current definition	    */
static struct node	  dummy_node;		/* dummy node		    */
static struct element     dummy_element;	/* dummy element	    */
static struct force	  dummy_force;		/* dummy force		    */
static struct material    dummy_material;	/* dummy material	    */
static struct constraint  dummy_constraint;	/* dummy constraint	    */
static struct distributed dummy_distributed;	/* dummy distributed load   */

# line 63 "parser.y"
typedef union  {
    double d;
    int	   i;
    char  *s;
    Pair   p;
} YYSTYPE;
#ifdef __cplusplus
#  include <stdio.h>
   extern "C" {
     extern void yyerror(char *);
     extern int yylex();
   }
#endif	/* __cplusplus */ 
# define UNARY 257
# define DOUBLE 258
# define INTEGER 259
# define STRING 260
# define BOLINTEGER 261
# define BOLSTRING 262
# define PROBLEM 263
# define NODES 264
# define ELEMENTS 265
# define MATERIALS 266
# define FORCES 267
# define CONSTRAINTS 268
# define DISTRIBUTED 269
# define END 270
# define TITLE_EQ 271
# define NODES_EQ 272
# define ELEMENTS_EQ 273
# define MATERIAL_EQ 274
# define FORCE_EQ 275
# define CONSTRAINT_EQ 276
# define DIR_EQ 277
# define VALUES_EQ 278
# define LOAD_EQ 279
# define X_EQ 280
# define Y_EQ 281
# define Z_EQ 282
# define E_EQ 283
# define IX_EQ 284
# define IY_EQ 285
# define IZ_EQ 286
# define A_EQ 287
# define J_EQ 288
# define G_EQ 289
# define T_EQ 290
# define RHO_EQ 291
# define NU_EQ 292
# define KAPPA_EQ 293
# define FX_EQ 294
# define FY_EQ 295
# define FZ_EQ 296
# define MX_EQ 297
# define MY_EQ 298
# define MZ_EQ 299
# define TX_FIXED 300
# define TY_FIXED 301
# define TZ_FIXED 302
# define RX_FIXED 303
# define RY_FIXED 304
# define RZ_FIXED 305
# define TX_FREE 306
# define TY_FREE 307
# define TZ_FREE 308
# define RX_FREE 309
# define RY_FREE 310
# define RZ_FREE 311
# define TX_EXPR 312
# define TY_EXPR 313
# define TZ_EXPR 314
# define RX_EXPR 315
# define RY_EXPR 316
# define RZ_EXPR 317
# define RX_HINGE 318
# define RY_HINGE 319
# define RZ_HINGE 320
# define SIN 321
# define COS 322
# define TAN 323
# define SQRT 324
#define yyclearin yychar = -1
#define yyerrok yyerrflag = 0
extern int yychar;
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 150
#endif

/* __YYSCLASS defines the scoping/storage class for global objects
 * that are NOT renamed by the -p option.  By default these names
 * are going to be 'static' so that multi-definition errors
 * will not occur with multiple parsers.
 * If you want (unsupported) access to internal names you need
 * to define this to be null so it implies 'extern' scope.
 * This should not be used in conjunction with -p.
 */
#ifndef __YYSCLASS
# define __YYSCLASS static
#endif
YYSTYPE yylval;
__YYSCLASS YYSTYPE yyval;
typedef int yytabelem;
# define YYERRCODE 256
__YYSCLASS yytabelem yyexca[] ={
-1, 1,
	0, -1,
	-2, 0,
-1, 19,
	264, 12,
	265, 12,
	266, 12,
	267, 12,
	268, 12,
	269, 12,
	270, 12,
	-2, 0,
-1, 20,
	264, 13,
	265, 13,
	266, 13,
	267, 13,
	268, 13,
	269, 13,
	270, 13,
	-2, 0,
-1, 21,
	264, 14,
	265, 14,
	266, 14,
	267, 14,
	268, 14,
	269, 14,
	270, 14,
	-2, 0,
-1, 22,
	264, 15,
	265, 15,
	266, 15,
	267, 15,
	268, 15,
	269, 15,
	270, 15,
	-2, 0,
-1, 23,
	264, 16,
	265, 16,
	266, 16,
	267, 16,
	268, 16,
	269, 16,
	270, 16,
	-2, 0,
-1, 43,
	264, 18,
	265, 18,
	266, 18,
	267, 18,
	268, 18,
	269, 18,
	270, 18,
	-2, 0,
	};
# define YYNPROD 129
# define YYLAST 306
__YYSCLASS yytabelem yyact[]={

    84,    85,    86,    87,    88,    89,    90,    91,    92,    93,
    94,    95,    99,   100,   101,   102,   103,   104,    96,    97,
    98,   112,   106,   107,   111,     4,   110,    77,    78,    79,
    80,    81,    82,    65,    66,    67,    68,    69,    70,    71,
    72,    73,    74,    75,    62,    63,   150,   188,   151,    59,
    60,    61,   182,   152,     9,    14,    10,    11,    12,    13,
     7,    42,    18,    16,    17,    39,    36,    41,    33,   109,
    51,    38,    35,    30,    32,    50,   169,   181,    29,   167,
   122,   121,    27,   165,    26,    25,   166,   147,   187,   155,
   153,   146,   154,   155,   156,   186,   155,   153,   156,   154,
   148,   156,   185,   155,   153,   163,   154,   162,   156,   184,
   155,   153,   161,   154,   160,   156,   183,   155,   153,   180,
   154,   105,   156,   174,   155,   153,    83,   154,    76,   156,
   119,   120,    64,   149,    58,   123,   124,   125,   126,   127,
   128,   129,   130,   131,   132,   133,    56,   134,   135,   136,
   137,   138,   139,   155,   153,    48,   154,    55,   156,    47,
    54,    46,    53,    45,   108,    57,    52,    44,    40,   140,
   141,   142,   143,   144,   145,    37,    34,    31,    49,    28,
   157,   158,   159,    43,    24,    23,    22,    21,    20,    19,
     8,    15,     6,     3,     5,     2,     1,   168,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,   189,     0,     0,     0,     0,     0,     0,
     0,     0,     0,   170,   171,   172,   173,     0,     0,     0,
   175,   176,   177,   178,   164,   179,     0,     0,     0,   117,
   118,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,   113,   114,   115,   116 };
__YYSCLASS yytabelem yypact[]={

  -238, -3000, -3000, -3000, -3000,  -210,  -209, -3000, -3000, -3000,
 -3000, -3000, -3000, -3000, -3000, -3000,  -174,  -175,  -178,  -183,
  -188,  -190,  -191,  -195, -3000, -3000, -3000, -3000, -3000, -3000,
 -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000,
 -3000, -3000, -3000,  -186, -3000, -3000, -3000, -3000, -3000, -3000,
 -3000, -3000,  -231,  -250,  -267,  -300,  -255, -3000, -3000,   -19,
   -19,   -19,  -179,  -180, -3000,   -19,   -19,   -19,   -19,   -19,
   -19,   -19,   -19,   -19,   -19,   -19, -3000,   -19,   -19,   -19,
   -19,   -19,   -19, -3000, -3000, -3000, -3000, -3000, -3000, -3000,
 -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000,   -19,
   -19,   -19,   -19,   -19,   -19, -3000, -3000,    60,  -226,   111,
   -19,   -19,   -19,    74,    72,    67,    65, -3000, -3000,   111,
   111, -3000, -3000,   111,   111,   111,   111,   111,   111,   111,
   111,   111,   111,   111,   111,   111,   111,   111,   111,   111,
   111,   111,   111,   111,   111,   111,    60, -3000,  -176, -3000,
    -5,  -181,  -184,   -19,   -19,   -19,   -19, -3000, -3000,    82,
   -19,   -19,   -19,   -19, -3000,   -19,  -182, -3000,  -208, -3000,
    51,    51, -3000, -3000, -3000,    75,    68,    61,    54,    47,
   -46, -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000 };
__YYSCLASS yytabelem yypgo[]={

     0,   197,    69,    87,   196,   195,   194,   193,   192,   191,
   190,   189,   188,   187,   186,   185,   184,   183,   179,   178,
   177,   176,   175,   168,   167,   166,   165,   164,   163,   162,
   161,   160,   159,   157,   155,   146,   134,   133,   132,   128,
   126,   121,   119,    91 };
__YYSCLASS yytabelem yyr1[]={

     0,     4,     5,     7,     7,     8,     8,     9,     9,     9,
     6,     6,    10,    10,    10,    10,    10,    16,    10,    11,
    11,    17,    17,    12,    12,    13,    13,    14,    14,    15,
    15,    24,    18,    18,    26,    19,    19,    28,    20,    20,
    30,    21,    21,    32,    22,    22,    34,    23,    23,    25,
    25,    27,    27,    29,    29,    31,    31,    33,    33,    35,
    35,    36,    36,    36,    36,    36,    37,    37,    37,    38,
    38,    38,    38,    38,    38,    38,    38,    38,    38,    38,
    39,    39,    39,    39,    39,    39,    40,    40,    40,    40,
    40,    40,    40,    40,    40,    40,    40,    40,    40,    40,
    40,    40,    40,    40,    40,    40,    40,    41,    41,     1,
     1,    42,    42,    43,    43,     3,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2 };
__YYSCLASS yytabelem yyr2[]={

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

 -3000,    -4,    -5,    -7,   263,    -6,    -8,   270,   -10,   264,
   266,   267,   268,   269,   265,    -9,   272,   273,   271,   -11,
   -12,   -13,   -14,   -15,   -16,   259,   259,   260,   -18,   261,
   256,   -20,   262,   256,   -21,   262,   256,   -22,   262,   256,
   -23,   262,   256,   -17,   -24,   -28,   -30,   -32,   -34,   -19,
   261,   256,   -25,   -29,   -31,   -33,   -35,   -26,   -36,   280,
   281,   282,   275,   276,   -38,   283,   284,   285,   286,   287,
   288,   289,   290,   291,   292,   293,   -39,   294,   295,   296,
   297,   298,   299,   -40,   300,   301,   302,   303,   304,   305,
   306,   307,   308,   309,   310,   311,   318,   319,   320,   312,
   313,   314,   315,   316,   317,   -41,   277,   278,   -27,    -2,
    45,    43,    40,   321,   322,   323,   324,   258,   259,    -2,
    -2,   260,   260,    -2,    -2,    -2,    -2,    -2,    -2,    -2,
    -2,    -2,    -2,    -2,    -2,    -2,    -2,    -2,    -2,    -2,
    -2,    -2,    -2,    -2,    -2,    -2,   -43,    -3,    40,   -37,
   272,   274,   279,    43,    45,    42,    47,    -2,    -2,    -2,
    40,    40,    40,    40,    -3,   259,    91,   260,    -1,   260,
    -2,    -2,    -2,    -2,    41,    -2,    -2,    -2,    -2,    -2,
   -42,   259,   260,    41,    41,    41,    41,    41,    93,   259 };
__YYSCLASS yytabelem yydef[]={

     4,    -2,    11,     2,     6,     0,     3,     1,    10,    20,
    24,    26,    28,    30,    17,     5,     0,     0,     0,    -2,
    -2,    -2,    -2,    -2,    22,     7,     8,     9,    19,    31,
    33,    23,    37,    39,    25,    40,    42,    27,    43,    45,
    29,    46,    48,    -2,    50,    54,    56,    58,    60,    21,
    34,    36,    32,    38,    41,    44,    47,    52,    49,     0,
     0,     0,     0,     0,    53,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,    55,     0,     0,     0,
     0,     0,     0,    57,    86,    87,    88,    89,    90,    91,
    92,    93,    94,    95,    96,    97,    98,    99,   100,     0,
     0,     0,     0,     0,     0,    59,   107,     0,    35,    61,
     0,     0,     0,     0,     0,     0,     0,   127,   128,    62,
    63,    64,    65,    69,    70,    71,    72,    73,    74,    75,
    76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
   101,   102,   103,   104,   105,   106,   108,   114,     0,    51,
     0,     0,     0,     0,     0,     0,     0,   120,   121,     0,
     0,     0,     0,     0,   113,     0,     0,    67,    68,   110,
   116,   117,   118,   119,   122,     0,     0,     0,     0,     0,
     0,   112,   109,   123,   124,   125,   126,   115,    66,   111 };
typedef struct { char *t_name; int t_val; } yytoktype;
#ifndef YYDEBUG
#	define YYDEBUG	0	/* don't allow debugging */
#endif

#if YYDEBUG

__YYSCLASS yytoktype yytoks[] =
{
	"+",	43,
	"-",	45,
	"*",	42,
	"/",	47,
	"UNARY",	257,
	"DOUBLE",	258,
	"INTEGER",	259,
	"STRING",	260,
	"BOLINTEGER",	261,
	"BOLSTRING",	262,
	"PROBLEM",	263,
	"NODES",	264,
	"ELEMENTS",	265,
	"MATERIALS",	266,
	"FORCES",	267,
	"CONSTRAINTS",	268,
	"DISTRIBUTED",	269,
	"END",	270,
	"TITLE_EQ",	271,
	"NODES_EQ",	272,
	"ELEMENTS_EQ",	273,
	"MATERIAL_EQ",	274,
	"FORCE_EQ",	275,
	"CONSTRAINT_EQ",	276,
	"DIR_EQ",	277,
	"VALUES_EQ",	278,
	"LOAD_EQ",	279,
	"X_EQ",	280,
	"Y_EQ",	281,
	"Z_EQ",	282,
	"E_EQ",	283,
	"IX_EQ",	284,
	"IY_EQ",	285,
	"IZ_EQ",	286,
	"A_EQ",	287,
	"J_EQ",	288,
	"G_EQ",	289,
	"T_EQ",	290,
	"RHO_EQ",	291,
	"NU_EQ",	292,
	"KAPPA_EQ",	293,
	"FX_EQ",	294,
	"FY_EQ",	295,
	"FZ_EQ",	296,
	"MX_EQ",	297,
	"MY_EQ",	298,
	"MZ_EQ",	299,
	"TX_FIXED",	300,
	"TY_FIXED",	301,
	"TZ_FIXED",	302,
	"RX_FIXED",	303,
	"RY_FIXED",	304,
	"RZ_FIXED",	305,
	"TX_FREE",	306,
	"TY_FREE",	307,
	"TZ_FREE",	308,
	"RX_FREE",	309,
	"RY_FREE",	310,
	"RZ_FREE",	311,
	"TX_EXPR",	312,
	"TY_EXPR",	313,
	"TZ_EXPR",	314,
	"RX_EXPR",	315,
	"RY_EXPR",	316,
	"RZ_EXPR",	317,
	"RX_HINGE",	318,
	"RY_HINGE",	319,
	"RZ_HINGE",	320,
	"SIN",	321,
	"COS",	322,
	"TAN",	323,
	"SQRT",	324,
	"-unknown-",	-1	/* ends search */
};

__YYSCLASS char * yyreds[] =
{
	"-no such reduction-",
	"specification : description definition_list END",
	"description : optional_info",
	"optional_info : PROBLEM info_list",
	"optional_info : /* empty */",
	"info_list : info_list info",
	"info_list : /* empty */",
	"info : NODES_EQ INTEGER",
	"info : ELEMENTS_EQ INTEGER",
	"info : TITLE_EQ STRING",
	"definition_list : definition_list definition",
	"definition_list : /* empty */",
	"definition : NODES node_list",
	"definition : MATERIALS material_list",
	"definition : FORCES force_list",
	"definition : CONSTRAINTS constraint_list",
	"definition : DISTRIBUTED distributed_list",
	"definition : ELEMENTS",
	"definition : ELEMENTS element_list",
	"node_list : node_list node",
	"node_list : /* empty */",
	"element_list : element_list element",
	"element_list : /* empty */",
	"material_list : material_list material",
	"material_list : /* empty */",
	"force_list : force_list force",
	"force_list : /* empty */",
	"constraint_list : constraint_list constraint",
	"constraint_list : /* empty */",
	"distributed_list : distributed_list distributed",
	"distributed_list : /* empty */",
	"node : BOLINTEGER",
	"node : BOLINTEGER node_arg_list",
	"node : error",
	"element : BOLINTEGER",
	"element : BOLINTEGER element_arg_list",
	"element : error",
	"material : BOLSTRING",
	"material : BOLSTRING material_arg_list",
	"material : error",
	"force : BOLSTRING",
	"force : BOLSTRING force_arg_list",
	"force : error",
	"constraint : BOLSTRING",
	"constraint : BOLSTRING constraint_arg_list",
	"constraint : error",
	"distributed : BOLSTRING",
	"distributed : BOLSTRING distributed_arg_list",
	"distributed : error",
	"node_arg_list : node_arg_list node_arg",
	"node_arg_list : /* empty */",
	"element_arg_list : element_arg_list element_arg",
	"element_arg_list : /* empty */",
	"material_arg_list : material_arg_list material_arg",
	"material_arg_list : /* empty */",
	"force_arg_list : force_arg_list force_arg",
	"force_arg_list : /* empty */",
	"constraint_arg_list : constraint_arg_list constraint_arg",
	"constraint_arg_list : /* empty */",
	"distributed_arg_list : distributed_arg_list distributed_arg",
	"distributed_arg_list : /* empty */",
	"node_arg : X_EQ expression",
	"node_arg : Y_EQ expression",
	"node_arg : Z_EQ expression",
	"node_arg : FORCE_EQ STRING",
	"node_arg : CONSTRAINT_EQ STRING",
	"element_arg : NODES_EQ '[' integer_list ']'",
	"element_arg : MATERIAL_EQ STRING",
	"element_arg : LOAD_EQ string_list",
	"material_arg : E_EQ expression",
	"material_arg : IX_EQ expression",
	"material_arg : IY_EQ expression",
	"material_arg : IZ_EQ expression",
	"material_arg : A_EQ expression",
	"material_arg : J_EQ expression",
	"material_arg : G_EQ expression",
	"material_arg : T_EQ expression",
	"material_arg : RHO_EQ expression",
	"material_arg : NU_EQ expression",
	"material_arg : KAPPA_EQ expression",
	"force_arg : FX_EQ expression",
	"force_arg : FY_EQ expression",
	"force_arg : FZ_EQ expression",
	"force_arg : MX_EQ expression",
	"force_arg : MY_EQ expression",
	"force_arg : MZ_EQ expression",
	"constraint_arg : TX_FIXED",
	"constraint_arg : TY_FIXED",
	"constraint_arg : TZ_FIXED",
	"constraint_arg : RX_FIXED",
	"constraint_arg : RY_FIXED",
	"constraint_arg : RZ_FIXED",
	"constraint_arg : TX_FREE",
	"constraint_arg : TY_FREE",
	"constraint_arg : TZ_FREE",
	"constraint_arg : RX_FREE",
	"constraint_arg : RY_FREE",
	"constraint_arg : RZ_FREE",
	"constraint_arg : RX_HINGE",
	"constraint_arg : RY_HINGE",
	"constraint_arg : RZ_HINGE",
	"constraint_arg : TX_EXPR expression",
	"constraint_arg : TY_EXPR expression",
	"constraint_arg : TZ_EXPR expression",
	"constraint_arg : RX_EXPR expression",
	"constraint_arg : RY_EXPR expression",
	"constraint_arg : RZ_EXPR expression",
	"distributed_arg : DIR_EQ",
	"distributed_arg : VALUES_EQ pair_list",
	"string_list : string_list STRING",
	"string_list : STRING",
	"integer_list : integer_list INTEGER",
	"integer_list : INTEGER",
	"pair_list : pair_list pair",
	"pair_list : pair",
	"pair : '(' INTEGER expression ')'",
	"expression : expression '+' expression",
	"expression : expression '-' expression",
	"expression : expression '*' expression",
	"expression : expression '/' expression",
	"expression : '-' expression",
	"expression : '+' expression",
	"expression : '(' expression ')'",
	"expression : SIN '(' expression ')'",
	"expression : COS '(' expression ')'",
	"expression : TAN '(' expression ')'",
	"expression : SQRT '(' expression ')'",
	"expression : DOUBLE",
	"expression : INTEGER",
};
#endif /* YYDEBUG */
#define YYFLAG  (-3000)
/* @(#) $Revision: 70.7 $ */    

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

#if defined(NLS) && !defined(NL_SETN)
#include <msgbuf.h>
#endif

#ifndef nl_msg
#define nl_msg(i,s) (s)
#endif

/*
** yacc user known macros and defines
*/
#define YYERROR		goto yyerrlab

#ifndef __RUNTIME_YYMAXDEPTH
#define YYACCEPT	return(0)
#define YYABORT		return(1)
#else
#define YYACCEPT	{free_stacks(); return(0);}
#define YYABORT		{free_stacks(); return(1);}
#endif

#define YYBACKUP( newtoken, newvalue )\
{\
	if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
	{\
		yyerror( (nl_msg(30001,"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 for YYFLAG now generated by yacc program. */
/*#define YYFLAG		(FLAGVAL)*/

/*
** global variables used by the parser
*/
# ifndef __RUNTIME_YYMAXDEPTH
__YYSCLASS YYSTYPE yyv[ YYMAXDEPTH ];	/* value stack */
__YYSCLASS int yys[ YYMAXDEPTH ];		/* state stack */
# else
__YYSCLASS YYSTYPE *yyv;			/* pointer to malloc'ed value stack */
__YYSCLASS int *yys;			/* pointer to malloc'ed stack stack */

#if defined(__STDC__) || defined (__cplusplus)
#include <stdlib.h>
#else
	extern char *malloc();
	extern char *realloc();
	extern void free();
#endif /* __STDC__ or __cplusplus */


static int allocate_stacks(); 
static void free_stacks();
# ifndef YYINCREMENT
# define YYINCREMENT (YYMAXDEPTH/2) + 10
# endif
# endif	/* __RUNTIME_YYMAXDEPTH */
long  yymaxdepth = YYMAXDEPTH;

__YYSCLASS YYSTYPE *yypv;			/* top of value stack */
__YYSCLASS int *yyps;			/* top of state stack */

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

int yynerrs;			/* number of errors */
__YYSCLASS 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 */

	/*
	** Initialize externals - yyparse may be called more than once
	*/
# ifdef __RUNTIME_YYMAXDEPTH
	if (allocate_stacks()) YYABORT;
# endif
	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;

			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? */
		{
# ifndef __RUNTIME_YYMAXDEPTH
			yyerror( (nl_msg(30002,"yacc stack overflow")) );
			YYABORT;
# else
			/* save old stack bases to recalculate pointers */
			YYSTYPE * yyv_old = yyv;
			int * yys_old = yys;
			yymaxdepth += YYINCREMENT;
			yys = (int *) realloc(yys, yymaxdepth * sizeof(int));
			yyv = (YYSTYPE *) realloc(yyv, yymaxdepth * sizeof(YYSTYPE));
			if (yys==0 || yyv==0) {
			    yyerror( (nl_msg(30002,"yacc stack overflow")) );
			    YYABORT;
			    }
			/* Reset pointers into stack */
			yy_ps = (yy_ps - yys_old) + yys;
			yyps = (yyps - yys_old) + yys;
			yy_pv = (yy_pv - yyv_old) + yyv;
			yypv = (yypv - yyv_old) + yyv;
# endif

		}
		*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( (nl_msg(30003,"syntax error")) );
				yynerrs++;
				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 )
						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 96 "parser.y"
{
		if (problem.numerrors) {
		    error ("%d error(s) found in input", problem.numerrors);
		    return problem.numerrors;
		}

		if (resolvenames ( ))
		    return problem.numerrors;
	    } break;
case 2:
# line 110 "parser.y"
{
		problem.node_tree        = TreeCreate (node_cmp);
		problem.element_tree     = TreeCreate (element_cmp);
		problem.force_tree       = TreeCreate (force_cmp);
		problem.material_tree    = TreeCreate (material_cmp);
		problem.constraint_tree  = TreeCreate (constraint_cmp);
		problem.distributed_tree = TreeCreate (distributed_cmp);

		lastx = lasty = lastz = 0;
		lastconstraint = lastmaterial = NULL;

		memset (&dummy_node, 0, sizeof (struct node));
		memset (&dummy_element, 0, sizeof (struct element));
		memset (&dummy_force, 0, sizeof (struct force));
		memset (&dummy_material, 0, sizeof (struct material));
		memset (&dummy_constraint, 0, sizeof (struct constraint));
		memset (&dummy_distributed, 0, sizeof (struct distributed));
	    } break;
case 4:
# line 134 "parser.y"
{
		problem.numnodes = 0;
		problem.numelements = 0;
		problem.title = NULL;
	    } break;
case 7:
# line 149 "parser.y"
{problem.numnodes = yypvt[-0].i;} break;
case 8:
# line 151 "parser.y"
{problem.numelements = yypvt[-0].i;} break;
case 9:
# line 153 "parser.y"
{problem.title = yypvt[-0].s;} break;
case 17:
# line 170 "parser.y"
{definition = defnlookup (yypvt[-0].s); Deallocate (yypvt[-0].s);
	     if (definition == NULL) return -1;} break;
case 31:
# line 214 "parser.y"
{
		Item found;


		if (yypvt[-0].i < 1 || yypvt[-0].i > problem.numnodes) {
		    error ("node number %d is illegal (near line %d)", yypvt[-0].i, ln);
		    node = &dummy_node;
		    problem.numerrors ++;
		    break;
		}

		node = CreateNode (yypvt[-0].i);
		found = TreeInsert (problem.node_tree, node);

		if ((Node) found != node) {
		    error ("node number %d is repeated (near line %d)", yypvt[-0].i, ln);
		    DestroyNode (node);
		    node = &dummy_node;
		    problem.numerrors ++;
		    break;
		}

		node -> x	   = lastx;
		node -> y	   = lasty;
		node -> z	   = lastz;
		node -> constraint = (Constraint) lastconstraint;
	    } break;
case 34:
# line 248 "parser.y"
{
	        Item found;


		if (yypvt[-0].i < 1 || yypvt[-0].i > problem.numelements) {
		    error ("element number %d is illegal (near line %d)",yypvt[-0].i,ln);
		    element = &dummy_element;
		    problem.numerrors ++;
		    break;
		}

		element = CreateElement (yypvt[-0].i, definition);
		found = TreeInsert (problem.element_tree, element);

		if ((Element) found != element) {
		    error("element number %d is repeated (near line %d)",yypvt[-0].i,ln);
		    DestroyElement (element);
		    element = &dummy_element;
		    problem.numerrors ++;
		    break;
		}

		element -> material = (Material) lastmaterial;
	    } break;
case 37:
# line 279 "parser.y"
{
		Item found;


		material = CreateMaterial (yypvt[-0].s);
		found = TreeInsert (problem.material_tree, material);

		if ((Material) found != material) {
		    error ("material %s is previously defined", yypvt[-0].s);
		    DestroyMaterial (material);
		    material = &dummy_material;
		    problem.numerrors ++;
		}
	    } break;
case 40:
# line 300 "parser.y"
{
		Item found;


		force = CreateForce (yypvt[-0].s);
		found = TreeInsert (problem.force_tree, force);

		if ((Force) found != force) {
		    error ("force %s is previously defined", yypvt[-0].s);
		    DestroyForce (force);
		    force = &dummy_force;
		    problem.numerrors ++;
		}
	    } break;
case 43:
# line 321 "parser.y"
{
		Item found;


		constraint = CreateConstraint (yypvt[-0].s);
		found = TreeInsert (problem.constraint_tree, constraint);

		if ((Constraint) found != constraint) {
		    error ("constraint %s is previously defined", yypvt[-0].s);
		    DestroyConstraint (constraint);
		    constraint = &dummy_constraint;
		    problem.numerrors ++;
		}
	    } break;
case 46:
# line 342 "parser.y"
{
		Item found;


		distributed = CreateDistributed (yypvt[-0].s, 0);
		found = TreeInsert (problem.distributed_tree, distributed);

		if ((Distributed) found != distributed) {
		    error ("distributed load %s is previously defined", yypvt[-0].s);
		    DestroyDistributed (distributed);
		    distributed = &dummy_distributed;
		    problem.numerrors ++;
		}
	    } break;
case 61:
# line 398 "parser.y"
{lastx = node -> x = yypvt[-0].d;} break;
case 62:
# line 400 "parser.y"
{lasty = node -> y = yypvt[-0].d;} break;
case 63:
# line 402 "parser.y"
{lastz = node -> z = yypvt[-0].d;} break;
case 64:
# line 404 "parser.y"
{node -> force = (Force) yypvt[-0].s;} break;
case 65:
# line 406 "parser.y"
{node -> constraint = (Constraint) yypvt[-0].s;
				 lastconstraint = yypvt[-0].s;} break;
case 66:
# line 413 "parser.y"
{
		int i, size;


		if (element == &dummy_element)
		    break;

		size = intptr - intarray;

		if (size != element -> definition -> numnodes) {
		    error ("incorrect number of nodes for element %d",
			    element -> number);
		    problem.numerrors ++;
		    break;
		}

		for (i = 1; i <= size; i ++)
		    element -> node [i] = (Node) intarray [i - 1];
	    } break;
case 67:
# line 434 "parser.y"
{
		element -> material = (Material) (lastmaterial = yypvt[-0].s);
	    } break;
case 69:
# line 443 "parser.y"
{material -> E = yypvt[-0].d;} break;
case 70:
# line 445 "parser.y"
{material -> Ix = yypvt[-0].d;} break;
case 71:
# line 447 "parser.y"
{material -> Iy = yypvt[-0].d;} break;
case 72:
# line 449 "parser.y"
{material -> Iz = yypvt[-0].d;} break;
case 73:
# line 451 "parser.y"
{material -> A = yypvt[-0].d;} break;
case 74:
# line 453 "parser.y"
{material -> J = yypvt[-0].d;} break;
case 75:
# line 455 "parser.y"
{material -> G = yypvt[-0].d;} break;
case 76:
# line 457 "parser.y"
{material -> t = yypvt[-0].d;} break;
case 77:
# line 459 "parser.y"
{material -> rho = yypvt[-0].d;} break;
case 78:
# line 461 "parser.y"
{material -> nu = yypvt[-0].d;} break;
case 79:
# line 463 "parser.y"
{material -> kappa = yypvt[-0].d;} break;
case 80:
# line 468 "parser.y"
{force -> force [Fx] = yypvt[-0].d;} break;
case 81:
# line 470 "parser.y"
{force -> force [Fy] = yypvt[-0].d;} break;
case 82:
# line 472 "parser.y"
{force -> force [Fz] = yypvt[-0].d;} break;
case 83:
# line 474 "parser.y"
{force -> force [Mx] = yypvt[-0].d;} break;
case 84:
# line 476 "parser.y"
{force -> force [My] = yypvt[-0].d;} break;
case 85:
# line 478 "parser.y"
{force -> force [Mz] = yypvt[-0].d;} break;
case 86:
# line 484 "parser.y"
{
		constraint -> constraint [Tx] = 1;
		constraint -> dx [Tx] = 0;
	    } break;
case 87:
# line 490 "parser.y"
{
		constraint -> constraint [Ty] = 1;
		constraint -> dx [Ty] = 0;
	    } break;
case 88:
# line 496 "parser.y"
{
		constraint -> constraint [Tz] = 1;
		constraint -> dx [Tz] = 0;
	    } break;
case 89:
# line 502 "parser.y"
{
		constraint -> constraint [Rx] = 1;
		constraint -> dx [Rx] = 0;
	    } break;
case 90:
# line 508 "parser.y"
{
		constraint -> constraint [Ry] = 1;
		constraint -> dx [Ry] = 0;
	    } break;
case 91:
# line 514 "parser.y"
{
		constraint -> constraint [Rz] = 1;
		constraint -> dx [Rz] = 0;
	    } break;
case 92:
# line 520 "parser.y"
{
		constraint -> constraint [Tx] = 0;
	    } break;
case 93:
# line 525 "parser.y"
{
		constraint -> constraint [Ty] = 0;
	    } break;
case 94:
# line 530 "parser.y"
{
		constraint -> constraint [Tz] = 0;
	    } break;
case 95:
# line 535 "parser.y"
{
		constraint -> constraint [Rx] = 0;
	    } break;
case 96:
# line 540 "parser.y"
{
		constraint -> constraint [Ry] = 0;
	    } break;
case 97:
# line 545 "parser.y"
{
		constraint -> constraint [Rz] = 0;
	    } break;
case 98:
# line 550 "parser.y"
{
		constraint -> constraint [Rx] = 'h';
	    } break;
case 99:
# line 555 "parser.y"
{
		constraint -> constraint [Ry] = 'h';
	    } break;
case 100:
# line 560 "parser.y"
{
		constraint -> constraint [Rz] = 'h';
	    } break;
case 101:
# line 565 "parser.y"
{
		constraint -> constraint [Tx] = 1;
		constraint -> dx [Tx] = yypvt[-0].d;
	    } break;
case 102:
# line 571 "parser.y"
{
		constraint -> constraint [Ty] = 1;
		constraint -> dx [Ty] = yypvt[-0].d;
	    } break;
case 103:
# line 577 "parser.y"
{
		constraint -> constraint [Tz] = 1;
		constraint -> dx [Tz] = yypvt[-0].d;
	    } break;
case 104:
# line 583 "parser.y"
{
		constraint -> constraint [Rx] = 1;
		constraint -> dx [Rx] = yypvt[-0].d;
	    } break;
case 105:
# line 589 "parser.y"
{
		constraint -> constraint [Ry] = 1;
		constraint -> dx [Ry] = yypvt[-0].d;
	    } break;
case 106:
# line 595 "parser.y"
{
		constraint -> constraint [Rz] = 1;
		constraint -> dx [Rz] = yypvt[-0].d;
	    } break;
case 107:
# line 604 "parser.y"
{
		distributed -> direction = yypvt[-0].i;
	    } break;
case 108:
# line 610 "parser.y"
{
		int i, size;


		if (distributed == &dummy_distributed)
		    break;

		size = pairptr - pairarray;

		if (!(distributed -> value = Allocate (Pair, size)))
		    Fatal ("unable to allocate memory for pairs");

		UnitOffset (distributed -> value);
		distributed -> nvalues = size;

		for (i = 1; i <= size; i ++)
		    distributed -> value [i] = pairarray [i - 1];
	    } break;
case 109:
# line 633 "parser.y"
{
		if (element -> numdistributed == 3) {
		    error ("element %d has too many loads", element -> number);
		    break;
		}

		element -> distributed [++ element -> numdistributed] =
							(Distributed) yypvt[-0].s;
	    } break;
case 110:
# line 644 "parser.y"
{
		element -> distributed [++ element -> numdistributed] =
							(Distributed) yypvt[-0].s;
	    } break;
case 111:
# line 653 "parser.y"
{
		if (yypvt[-0].i < 0 || yypvt[-0].i > problem.numnodes) {
		    error ("node number %d is illegal (near line %d)", yypvt[-0].i, ln);
		    problem.numerrors ++;
		}

		*intptr ++ = yypvt[-0].i;
	    } break;
case 112:
# line 663 "parser.y"
{
		if (yypvt[-0].i < 0 || yypvt[-0].i > problem.numnodes) {
		    error ("node number %d is illegal (near line %d)", yypvt[-0].i, ln);
		    problem.numerrors ++;
		}

		intptr = intarray;
		*intptr ++ = yypvt[-0].i;
	    } break;
case 113:
# line 677 "parser.y"
{
		if (yypvt[-0].p.node < 1 || yypvt[-0].p.node > problem.numnodes) {
		    error ("node number %d is illegal (near line %d)",
			   yypvt[-0].p.node, ln);
		    problem.numerrors ++;
		}

		*pairptr ++ = yypvt[-0].p;
	    } break;
case 114:
# line 688 "parser.y"
{
		if (yypvt[-0].p.node < 1 || yypvt[-0].p.node > problem.numnodes) {
		    error ("node number %d is illegal (near line %d)",
			   yypvt[-0].p.node, ln);
		    problem.numerrors ++;
		}

		pairptr = pairarray;
		*pairptr ++ = yypvt[-0].p;
	    } break;
case 115:
# line 703 "parser.y"
{
		yyval.p.node = yypvt[-2].i;
		yyval.p.magnitude = yypvt[-1].d;
	    } break;
case 116:
# line 711 "parser.y"
{yyval.d = yypvt[-2].d + yypvt[-0].d;} break;
case 117:
# line 713 "parser.y"
{yyval.d = yypvt[-2].d - yypvt[-0].d;} break;
case 118:
# line 715 "parser.y"
{yyval.d = yypvt[-2].d * yypvt[-0].d;} break;
case 119:
# line 717 "parser.y"
{yyval.d = yypvt[-0].d ? yypvt[-2].d / yypvt[-0].d : 0;} break;
case 120:
# line 719 "parser.y"
{yyval.d = -yypvt[-0].d;} break;
case 121:
# line 721 "parser.y"
{yyval.d = yypvt[-0].d;} break;
case 122:
# line 723 "parser.y"
{yyval.d = yypvt[-1].d;} break;
case 123:
# line 725 "parser.y"
{yyval.d = sin (yypvt[-1].d * M_PI / 180);} break;
case 124:
# line 727 "parser.y"
{yyval.d = cos (yypvt[-1].d * M_PI / 180);} break;
case 125:
# line 729 "parser.y"
{yyval.d = tan (yypvt[-1].d * M_PI / 180);} break;
case 126:
# line 731 "parser.y"
{yyval.d = sqrt (yypvt[-1].d);} break;
case 127:
# line 733 "parser.y"
{yyval.d = yypvt[-0].d;} break;
case 128:
# line 735 "parser.y"
{yyval.d = yypvt[-0].i;} break;
	}
	goto yystack;		/* reset registers in driver code */
}

# ifdef __RUNTIME_YYMAXDEPTH

static int allocate_stacks() {
	/* allocate the yys and yyv stacks */
	yys = (int *) malloc(yymaxdepth * sizeof(int));
	yyv = (YYSTYPE *) malloc(yymaxdepth * sizeof(YYSTYPE));

	if (yys==0 || yyv==0) {
	   yyerror( (nl_msg(30004,"unable to allocate space for yacc stacks")) );
	   return(1);
	   }
	else return(0);

}


static void free_stacks() {
	if (yys!=0) free((char *) yys);
	if (yyv!=0) free((char *) yyv);
}

# endif  /* defined(__RUNTIME_YYMAXDEPTH) */

