
/*  A Bison parser, made from star.yac with Bison version GNU Bison version 1.22
  */

#define YYBISON 1  /* Identify Bison output.  */

#define	FRAME_CODE	258
#define	DATA_HEADING	259
#define	DATA_NAME	260
#define	DOUBLE_QUOTED_TEXT_STRING	261
#define	GLOBAL_HEADING	262
#define	LOOP_	263
#define	NON_QUOTED_TEXT_STRING	264
#define	SAVE_HEADING	265
#define	SAVE_END	266
#define	SEMI_COLON_BOUNDED_TEXT_STRING	267
#define	SINGLE_QUOTED_TEXT_STRING	268
#define	STOP_	269

#line 11 "star.yac"

#include "diagmesg.h"
#include "sf_space.h"

/* local variables */
Data_Seq *		temp_DS = NULL;
char *			current_GH = NULL;
char *			next_GH = NULL;
char *			current_DH = NULL;
char *			next_DH = NULL;
char *			current_SH = NULL;
char *			current_DN = NULL;
Data_Item *		current_di = NULL;
char		*root_Block_Names;
char		*root_Data_Names;
char		*root_Data_Names_save;
Block_Seq	*last_BS;
/* null terminated arrary of ptrs to the global blocks */
Global_Seq	*globals; 
Data_Seq	*last_DS;
Data_Seq	*last_DS_save;
int		star_line_count = 1;
char		*last_star_token = NULL;
char *tsearch();

#include "star_scanner.c"
/* star_scanner defines malloc so 
 * its important that it comes in before utilitys
 */
#include "utilitys.h"
#include "star.h"

/* redefine yylex */
#ifdef yylex
#undef yylex
#endif
#define yylex star_scanner

/* BOTCHES to help in compiling */
/* redefine yyparse */
#ifdef yyparse
#undef yyparse
#endif
#define yyparse	parse_star

#define yyerror	star_error

#ifdef YYDEBUG
#define xmalloc malloc
#endif 

/* end BOTCHES */

/* global variables */
extern Block_Seq	*beginning_of_BS;


#line 72 "star.yac"
typedef union {
   char *		string;
   Block_Seq *		star_file_val;
   Data_Seq *		data_block_body_val;
   Data_Name_Seq *	data_loop_definition_val;
   Data_Item *		data_item_val;
   } YYSTYPE;

#ifndef YYLTYPE
typedef
  struct yyltype
    {
      int timestamp;
      int first_line;
      int first_column;
      int last_line;
      int last_column;
      char *text;
   }
  yyltype;

#define YYLTYPE yyltype
#endif

#include <stdio.h>

#ifndef __cplusplus
#ifndef __STDC__
#define const
#endif
#endif



#define	YYFINAL		44
#define	YYFLAG		-32768
#define	YYNTBASE	15

#define YYTRANSLATE(x) ((unsigned)(x) <= 269 ? yytranslate[x] : 34)

static const char yytranslate[] = {     0,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
     6,     7,     8,     9,    10,    11,    12,    13,    14
};

#if YYDEBUG != 0
static const short yyprhs[] = {     0,
     0,     1,     4,     6,     8,    11,    14,    15,    18,    21,
    23,    25,    29,    30,    33,    36,    38,    39,    44,    46,
    49,    51,    53,    57,    59,    60,    62,    64,    67,    69,
    71,    73,    75,    77,    79
};

static const short yyrhs[] = {    -1,
    15,    16,     0,    17,     0,    18,     0,     7,    19,     0,
     4,    19,     0,     0,    19,    20,     0,     5,    33,     0,
    24,     0,    21,     0,    10,    22,    11,     0,     0,    22,
    23,     0,     5,    33,     0,    24,     0,     0,    29,    26,
    25,    31,     0,    27,     0,    26,    27,     0,     5,     0,
    28,     0,    29,    26,    30,     0,     8,     0,     0,    14,
     0,    32,     0,    31,    32,     0,    33,     0,    30,     0,
     9,     0,     6,     0,    13,     0,    12,     0,     3,     0
};

#endif

#if YYDEBUG != 0
static const short yyrline[] = { 0,
    90,    99,   136,   142,   149,   179,   204,   210,   245,   258,
   263,   270,   288,   294,   329,   342,   349,   415,   423,   431,
   443,   455,   468,   478,   485,   490,   496,   501,   507,   513,
   520,   526,   531,   536,   541
};

static const char * const yytname[] = {   "$","error","$illegal.","FRAME_CODE",
"DATA_HEADING","DATA_NAME","DOUBLE_QUOTED_TEXT_STRING","GLOBAL_HEADING","LOOP_",
"NON_QUOTED_TEXT_STRING","SAVE_HEADING","SAVE_END","SEMI_COLON_BOUNDED_TEXT_STRING",
"SINGLE_QUOTED_TEXT_STRING","STOP_","star_file","block","global_block","data_block",
"data_block_body","data","save_frame","save_frame_body","save_item","data_loop",
"@1","data_loop_definition","data_loop_field","nested_data_loop","loop_","stop_",
"data_loop_values","data_loop_item","data_item",""
};
#endif

static const short yyr1[] = {     0,
    15,    15,    16,    16,    17,    18,    19,    19,    20,    20,
    20,    21,    22,    22,    23,    23,    25,    24,    26,    26,
    27,    27,    28,    29,    30,    30,    31,    31,    32,    32,
    33,    33,    33,    33,    33
};

static const short yyr2[] = {     0,
     0,     2,     1,     1,     2,     2,     0,     2,     2,     1,
     1,     3,     0,     2,     2,     1,     0,     4,     1,     2,
     1,     1,     3,     1,     0,     1,     1,     2,     1,     1,
     1,     1,     1,     1,     1
};

static const short yydefact[] = {     1,
     0,     7,     7,     2,     3,     4,     6,     5,     0,    24,
    13,     8,    11,    10,     0,    35,    32,    31,    34,    33,
     9,     0,    21,    17,    19,    22,     0,     0,    12,    14,
    16,    25,    20,    25,    15,    26,    30,    18,    27,    29,
    23,    28,     0,     0
};

static const short yydefgoto[] = {     1,
     4,     5,     6,     7,    12,    13,    22,    30,    14,    32,
    24,    25,    26,    27,    37,    38,    39,    40
};

static const short yypact[] = {-32768,
     4,-32768,-32768,-32768,-32768,-32768,    26,    26,    12,-32768,
-32768,-32768,-32768,-32768,    27,-32768,-32768,-32768,-32768,-32768,
-32768,    22,-32768,    27,-32768,-32768,    27,    12,-32768,-32768,
-32768,     0,-32768,    15,-32768,-32768,-32768,     0,-32768,-32768,
-32768,-32768,     5,-32768
};

static const short yypgoto[] = {-32768,
-32768,-32768,-32768,     7,-32768,-32768,-32768,-32768,     6,-32768,
    -5,   -17,-32768,    -6,    -8,-32768,    -1,    -9
};


#define	YYLAST		37


static const short yytable[] = {    21,
    15,    15,    16,    43,    44,    17,    33,     2,    18,     8,
     3,    19,    20,    36,    16,    15,    33,    17,    35,    23,
    18,    34,    10,    19,    20,    41,    28,    31,    36,    10,
     9,    23,    29,    10,    10,    11,    42
};

static const short yycheck[] = {     9,
     7,     8,     3,     0,     0,     6,    24,     4,     9,     3,
     7,    12,    13,    14,     3,    22,    34,     6,    28,     5,
     9,    27,     8,    12,    13,    34,     5,    22,    14,     8,
     5,     5,    11,     8,     8,    10,    38
};
/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
#line 3 "/pb2/gnu/gcc/lib/bison.simple"

/* Skeleton output parser for bison,
   Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman

   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 1, 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.  */


#ifndef alloca
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not GNU C.  */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
#include <alloca.h>
#else /* not sparc */
#if defined (MSDOS) && !defined (__TURBOC__)
#include <malloc.h>
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
#include <malloc.h>
 #pragma alloca
#else /* not MSDOS, __TURBOC__, or _AIX */
#ifdef __hpux
#ifdef __cplusplus
extern "C" {
void *alloca (unsigned int);
};
#else /* not __cplusplus */
void *alloca ();
#endif /* not __cplusplus */
#endif /* __hpux */
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc.  */
#endif /* not GNU C.  */
#endif /* alloca not defined.  */

/* This is the parser code that is written into each bison parser
  when the %semantic_parser declaration is not specified in the grammar.
  It was written by Richard Stallman by simplifying the hairy parser
  used when %semantic_parser is specified.  */

/* Note: there must be only one dollar sign in this file.
   It is replaced by the list of actions, each action
   as one case of the switch.  */

#define yyerrok		(yyerrstatus = 0)
#define yyclearin	(yychar = YYEMPTY)
#define YYEMPTY		-2
#define YYEOF		0
#define YYACCEPT	return(0)
#define YYABORT 	return(1)
#define YYERROR		goto yyerrlab1
/* Like YYERROR except do call yyerror.
   This remains here temporarily to ease the
   transition to the new meaning of YYERROR, for GCC.
   Once GCC version 2 has supplanted version 1, this can go.  */
#define YYFAIL		goto yyerrlab
#define YYRECOVERING()  (!!yyerrstatus)
#define YYBACKUP(token, value) \
do								\
  if (yychar == YYEMPTY && yylen == 1)				\
    { yychar = (token), yylval = (value);			\
      yychar1 = YYTRANSLATE (yychar);				\
      YYPOPSTACK;						\
      goto yybackup;						\
    }								\
  else								\
    { yyerror ("syntax error: cannot back up"); YYERROR; }	\
while (0)

#define YYTERROR	1
#define YYERRCODE	256

#ifndef YYPURE
#define YYLEX		yylex()
#endif

#ifdef YYPURE
#ifdef YYLSP_NEEDED
#define YYLEX		yylex(&yylval, &yylloc)
#else
#define YYLEX		yylex(&yylval)
#endif
#endif

/* If nonreentrant, generate the variables here */

#ifndef YYPURE

int	yychar;			/*  the lookahead symbol		*/
YYSTYPE	yylval;			/*  the semantic value of the		*/
				/*  lookahead symbol			*/

#ifdef YYLSP_NEEDED
YYLTYPE yylloc;			/*  location data for the lookahead	*/
				/*  symbol				*/
#endif

int yynerrs;			/*  number of parse errors so far       */
#endif  /* not YYPURE */

#if YYDEBUG != 0
int yydebug;			/*  nonzero means print parse trace	*/
/* Since this is uninitialized, it does not stop multiple parsers
   from coexisting.  */
#endif

/*  YYINITDEPTH indicates the initial size of the parser's stacks	*/

#ifndef	YYINITDEPTH
#define YYINITDEPTH 200
#endif

/*  YYMAXDEPTH is the maximum size the stacks can grow to
    (effective only if the built-in stack extension method is used).  */

#if YYMAXDEPTH == 0
#undef YYMAXDEPTH
#endif

#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif

/* Prevent warning if -Wstrict-prototypes.  */
#ifdef __GNUC__
int yyparse (void);
#endif

#if __GNUC__ > 1		/* GNU C and GNU C++ define this.  */
#define __yy_bcopy(FROM,TO,COUNT)	__builtin_memcpy(TO,FROM,COUNT)
#else				/* not GNU C or C++ */
#ifndef __cplusplus

/* This is the most reliable way to avoid incompatibilities
   in available built-in functions on various systems.  */
static void
__yy_bcopy (from, to, count)
     char *from;
     char *to;
     int count;
{
  register char *f = from;
  register char *t = to;
  register int i = count;

  while (i-- > 0)
    *t++ = *f++;
}

#else /* __cplusplus */

/* This is the most reliable way to avoid incompatibilities
   in available built-in functions on various systems.  */
static void
__yy_bcopy (char *from, char *to, int count)
{
  register char *f = from;
  register char *t = to;
  register int i = count;

  while (i-- > 0)
    *t++ = *f++;
}

#endif
#endif

#line 184 "/pb2/gnu/gcc/lib/bison.simple"
int
yyparse()
{
  register int yystate;
  register int yyn;
  register short *yyssp;
  register YYSTYPE *yyvsp;
  int yyerrstatus;	/*  number of tokens to shift before error messages enabled */
  int yychar1 = 0;		/*  lookahead token as an internal (translated) token number */

  short	yyssa[YYINITDEPTH];	/*  the state stack			*/
  YYSTYPE yyvsa[YYINITDEPTH];	/*  the semantic value stack		*/

  short *yyss = yyssa;		/*  refer to the stacks thru separate pointers */
  YYSTYPE *yyvs = yyvsa;	/*  to allow yyoverflow to reallocate them elsewhere */

#ifdef YYLSP_NEEDED
  YYLTYPE yylsa[YYINITDEPTH];	/*  the location stack			*/
  YYLTYPE *yyls = yylsa;
  YYLTYPE *yylsp;

#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
#else
#define YYPOPSTACK   (yyvsp--, yyssp--)
#endif

  int yystacksize = YYINITDEPTH;

#ifdef YYPURE
  int yychar;
  YYSTYPE yylval;
  int yynerrs;
#ifdef YYLSP_NEEDED
  YYLTYPE yylloc;
#endif
#endif

  YYSTYPE yyval;		/*  the variable used to return		*/
				/*  semantic values from the action	*/
				/*  routines				*/

  int yylen;

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Starting parse\n");
#endif

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY;		/* Cause a token to be read.  */

  /* Initialize stack pointers.
     Waste one element of value and location stack
     so that they stay on the same level as the state stack.
     The wasted elements are never initialized.  */

  yyssp = yyss - 1;
  yyvsp = yyvs;
#ifdef YYLSP_NEEDED
  yylsp = yyls;
#endif

/* Push a new state, which is found in  yystate  .  */
/* In all cases, when you get here, the value and location stacks
   have just been pushed. so pushing a state here evens the stacks.  */
yynewstate:

  *++yyssp = yystate;

  if (yyssp >= yyss + yystacksize - 1)
    {
      /* Give user a chance to reallocate the stack */
      /* Use copies of these so that the &'s don't force the real ones into memory. */
      YYSTYPE *yyvs1 = yyvs;
      short *yyss1 = yyss;
#ifdef YYLSP_NEEDED
      YYLTYPE *yyls1 = yyls;
#endif

      /* Get the current used size of the three stacks, in elements.  */
      int size = yyssp - yyss + 1;

#ifdef yyoverflow
      /* Each stack pointer address is followed by the size of
	 the data in use in that stack, in bytes.  */
#ifdef YYLSP_NEEDED
      /* This used to be a conditional around just the two extra args,
	 but that might be undefined if yyoverflow is a macro.  */
      yyoverflow("parser stack overflow",
		 &yyss1, size * sizeof (*yyssp),
		 &yyvs1, size * sizeof (*yyvsp),
		 &yyls1, size * sizeof (*yylsp),
		 &yystacksize);
#else
      yyoverflow("parser stack overflow",
		 &yyss1, size * sizeof (*yyssp),
		 &yyvs1, size * sizeof (*yyvsp),
		 &yystacksize);
#endif

      yyss = yyss1; yyvs = yyvs1;
#ifdef YYLSP_NEEDED
      yyls = yyls1;
#endif
#else /* no yyoverflow */
      /* Extend the stack our own way.  */
      if (yystacksize >= YYMAXDEPTH)
	{
	  yyerror("parser stack overflow");
	  return 2;
	}
      yystacksize *= 2;
      if (yystacksize > YYMAXDEPTH)
	yystacksize = YYMAXDEPTH;
      yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
      __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
      yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
      __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
#ifdef YYLSP_NEEDED
      yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
      __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
#endif
#endif /* no yyoverflow */

      yyssp = yyss + size - 1;
      yyvsp = yyvs + size - 1;
#ifdef YYLSP_NEEDED
      yylsp = yyls + size - 1;
#endif

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Stack size increased to %d\n", yystacksize);
#endif

      if (yyssp >= yyss + yystacksize - 1)
	YYABORT;
    }

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Entering state %d\n", yystate);
#endif

  goto yybackup;
 yybackup:

/* Do appropriate processing given the current state.  */
/* Read a lookahead token if we need one and don't already have one.  */
/* yyresume: */

  /* First try to decide what to do without reference to lookahead token.  */

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* yychar is either YYEMPTY or YYEOF
     or a valid token in external form.  */

  if (yychar == YYEMPTY)
    {
#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Reading a token: ");
#endif
      yychar = YYLEX;
    }

  /* Convert token to internal form (in yychar1) for indexing tables with */

  if (yychar <= 0)		/* This means end of input. */
    {
      yychar1 = 0;
      yychar = YYEOF;		/* Don't call YYLEX any more */

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Now at end of input.\n");
#endif
    }
  else
    {
      yychar1 = YYTRANSLATE(yychar);

#if YYDEBUG != 0
      if (yydebug)
	{
	  fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
	  /* Give the individual parser a way to print the precise meaning
	     of a token, for further debugging info.  */
#ifdef YYPRINT
	  YYPRINT (stderr, yychar, yylval);
#endif
	  fprintf (stderr, ")\n");
	}
#endif
    }

  yyn += yychar1;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
    goto yydefault;

  yyn = yytable[yyn];

  /* yyn is what to do for this token type in this state.
     Negative => reduce, -yyn is rule number.
     Positive => shift, yyn is new state.
       New state is final state => don't bother to shift,
       just return success.
     0, or most negative number => error.  */

  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrlab;

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
#endif

  /* Discard the token being shifted unless it is eof.  */
  if (yychar != YYEOF)
    yychar = YYEMPTY;

  *++yyvsp = yylval;
#ifdef YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  /* count tokens shifted since error; after three, turn off error status.  */
  if (yyerrstatus) yyerrstatus--;

  yystate = yyn;
  goto yynewstate;

/* Do the default action for the current state.  */
yydefault:

  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;

/* Do a reduction.  yyn is the number of a rule to reduce with.  */
yyreduce:
  yylen = yyr2[yyn];
  if (yylen > 0)
    yyval = yyvsp[1-yylen]; /* implement default value of the action */

#if YYDEBUG != 0
  if (yydebug)
    {
      int i;

      fprintf (stderr, "Reducing via rule %d (line %d), ",
	       yyn, yyrline[yyn]);

      /* Print the symbols being reduced, and their result.  */
      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
	fprintf (stderr, "%s ", yytname[yyrhs[i]]);
      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
    }
#endif


  switch (yyn) {

case 1:
#line 92 "star.yac"
{  
		   INFORM_MSG("Starting Parser for STAR File.");
		   DEBUG_MSG("star_file : empty"); 
                   /* initialise the global function */
                   globals = NULL;
		   yyval.star_file_val = NULL; 
		;
    break;}
case 2:
#line 100 "star.yac"
{  
                   register Block_Seq	*t = yyvsp[0].star_file_val;
		   char			**found;
		   Boolean		force = FALSE;

		   DEBUG_MSG("star_file : star_file block"); 

	           if( t->tag == GLOBAL_BLOCK )
                      /* for global blocks don't check the name, 
	                 but force the insertion */
	              force = TRUE;
		   else
		      /* check that the name is not already present */
		      found = (char **)tsearch(t->name, &root_Block_Names, strcmp);

		   if( yyvsp[-1].star_file_val == NULL ) {
		      /* forget the empty and return the block as the head of
		       * the sequence */
		      beginning_of_BS = yyval.star_file_val = last_BS = t;
		   }
		   else {
		      /* Place the Block at the end of the sequence */
                      if( force || *found == t->name ) {
		         last_BS->next = t;
		         last_BS = t;
		      }
                      else {
		         ERROR_MSG("Block Name is already present:");
		         ERROR_MSG(t->name);
		         free_Block_Seq(t);
		      }
		      yyval.star_file_val = yyvsp[-1].star_file_val;
		   }
		;
    break;}
case 3:
#line 138 "star.yac"
{  
		   DEBUG_MSG("block : global_block");
		   yyval.star_file_val = yyvsp[0].star_file_val; 
		;
    break;}
case 4:
#line 143 "star.yac"
{  
		   DEBUG_MSG("block : data_block");
		   yyval.star_file_val = yyvsp[0].star_file_val; 
		;
    break;}
case 5:
#line 152 "star.yac"
{  
                   register Block_Seq	*t;
                   register Global_Seq	*tmp_globals;

		   DEBUG_MSG("global_block : GLOBAL_HEADING data_block_body");
		   Malloc( Block_Seq, t);
		   t->tag = GLOBAL_BLOCK;
                   if( current_GH ) {
		      t->name = current_GH;
                      current_GH = NULL;
                   }
                   else {
		      t->name = next_GH;
		      next_GH = NULL;
		   }
		   t->block.global_block = yyvsp[0].data_block_body_val;
		   root_Data_Names = NULL;
		   t->next = NULL;
                   /* add this to the head of the list of globals */
                   Malloc( Global_Seq, tmp_globals );
                   tmp_globals->global_entry = t;
                   tmp_globals->next = globals;
                   globals = tmp_globals;
		   yyval.star_file_val = t;
		;
    break;}
case 6:
#line 182 "star.yac"
{  
                   register Block_Seq	*t;

		   DEBUG_MSG("data_block : DATA_HEADING data_block_body");
		   Malloc( Block_Seq, t);
		   t->tag = DATA_BLOCK;
                   if( current_DH ) {
		      t->name = current_DH;
                      current_DH = NULL;
                   }
                   else {
		      t->name = next_DH;
                      next_DH = NULL;
	           }
		   t->block.data_block.actual_data = yyvsp[0].data_block_body_val;
		   root_Data_Names = NULL;
		   t->block.data_block.global_data = globals;
		   t->next = NULL;
		   yyval.star_file_val = t;
		;
    break;}
case 7:
#line 206 "star.yac"
{
		   DEBUG_MSG("data_block_body : empty");
		   yyval.data_block_body_val = NULL
		;
    break;}
case 8:
#line 211 "star.yac"
{  
                   register Data_Seq	*t = yyvsp[0].data_block_body_val;
		   register Data_Seq	*body = yyvsp[-1].data_block_body_val;
		   char			**found;

		   DEBUG_MSG("data_block_body : data_block_body data");

		   for(; t; t = t->next ) {
		      /* check that the name is not already present */
		      found = (char **)tsearch(t->name, &root_Data_Names, strcmp);

		      if( body == NULL ) {
		         /* forget the empty and return the data as the head of
		          * the sequence */
		         body = last_DS = t;
		      }
		      else
		         /* Place the Data at the end of the sequence */
                         if( *found == t->name ) {
		            last_DS->next = t;
		            last_DS = t;
		         }
                         else {
		            ERROR_MSG("Data Name is already present:");
		            ERROR_MSG(t->name);
/* must solve the problem of doing a t = t->next later
		            free_Data_Seq(t);
*/
		         }
		   }
		   yyval.data_block_body_val = body;
		;
    break;}
case 9:
#line 247 "star.yac"
{
		   register Data_Seq	*d;
		
		   DEBUG_MSG("data : DATA_NAME data_item");
		   Malloc( Data_Seq, d);
		   d->name = current_DN;
		   d->tag = DATA_ITEM;
		   d->data.data_item = yyvsp[0].data_item_val;
		   d->next = NULL;
 		   yyval.data_block_body_val = d; 
		;
    break;}
case 10:
#line 259 "star.yac"
{
		   DEBUG_MSG("data : data_loop");
 		   yyval.data_block_body_val = yyvsp[0].data_block_body_val; 
		;
    break;}
case 11:
#line 264 "star.yac"
{
		   DEBUG_MSG("data : save_frame");
		   yyval.data_block_body_val = yyvsp[0].data_block_body_val;
		;
    break;}
case 12:
#line 274 "star.yac"
{
		   register Data_Seq	*d;
		
		   DEBUG_MSG("save_frame : SAVE_HEADING save_frame_body SAVE_END");
		   Malloc( Data_Seq, d);
		   d->tag = SAVE_BLOCK;
		   d->name = current_SH;
		   d->data.save_block = yyvsp[-1].data_block_body_val; 
		   root_Data_Names_save = NULL;
		   d->next = NULL;
 		   yyval.data_block_body_val = d; 
		;
    break;}
case 13:
#line 290 "star.yac"
{
		   DEBUG_MSG("save_frame_body : empty");
		   yyval.data_block_body_val = NULL;
		;
    break;}
case 14:
#line 295 "star.yac"
{  
                   register Data_Seq	*t = yyvsp[0].data_block_body_val;
		   register Data_Seq	*body = yyvsp[-1].data_block_body_val;
		   char			**found;

		   DEBUG_MSG("save_frame_body : save_frame_body save_item");

		   for(; t; t = t->next ) {
		      /* check that the name is not already present */
		      found = (char **)tsearch(t->name, &root_Data_Names_save, strcmp);

		      if( body == NULL ) {
		         /* forget the empty and return the data as the head of
		          * the sequence */
		         body = last_DS_save = t;
		      }
		      else
		         /* Place the Data at the end of the sequence */
                         if( *found == t->name ) {
		            last_DS_save->next = t;
		            last_DS_save = t;
		         }
                         else {
		            ERROR_MSG("Data Name is already present:");
		            ERROR_MSG(t->name);
/* must solve the problem of doing a t = t->next later
		            free_Data_Seq(t);
*/
		         }
		   }
		   yyval.data_block_body_val = body;
		;
    break;}
case 15:
#line 331 "star.yac"
{
		   register Data_Seq	*d;
		
		   DEBUG_MSG("save_item : DATA_NAME data_item");
		   Malloc( Data_Seq, d);
		   d->name = current_DN;
		   d->tag = DATA_ITEM;
		   d->data.data_item = yyvsp[0].data_item_val;
		   d->next = NULL;
 		   yyval.data_block_body_val = d; 
		;
    break;}
case 16:
#line 343 "star.yac"
{
		   DEBUG_MSG("save_item : data_loop");
 		   yyval.data_block_body_val = yyvsp[0].data_block_body_val; 
		;
    break;}
case 17:
#line 352 "star.yac"
{
                   Data_Seq	*t;
                   register int	i, n;

		   /* take a definition and decompose it into a sequence of data
                   */
		   temp_DS = Data_Seq_froma_Data_Name_Seq( yyvsp[0].data_loop_definition_val, yyvsp[0].data_loop_definition_val );

                   /* Set up stacks for processing in data_loop_values parsing.
                   */
                   if( ! RPIV )
                      if( RPIV = (int *)malloc( ++N_blocks_RPIV * BLOCK_SIZE * sizeof( int )) )
                         Sizeof_RPIV += BLOCK_SIZE;
                      else
                         ERROR_MSG("Out of memory, for RPIV.");
                   if( ! NPIV )
                      if( NPIV = (int *)malloc( ++N_blocks_NPIV * BLOCK_SIZE * sizeof( int )) )
                         Sizeof_NPIV += BLOCK_SIZE;
                      else
                         ERROR_MSG("Out of memory, for NPIV.");
                   if( ! tail_positions )
                      if( tail_positions = (ptrptrLVS *)malloc( ++N_blocks_tp * BLOCK_SIZE * sizeof( ptrptrLVS )) )
                         Sizeof_tp += BLOCK_SIZE;
                      else
                         ERROR_MSG("Out of memory, for tail_positions.");
                   if( ! restart_positions )
                      if( restart_positions = (ptrDNS *)malloc( ++N_blocks_rp * BLOCK_SIZE * sizeof( ptrDNS )) )
                         Sizeof_rp += BLOCK_SIZE;
                      else
                         ERROR_MSG("Out of memory, for restart_positions.");
                   if( ! next_positions )
                      if( next_positions = (ptrDNS *)malloc( ++N_blocks_np * BLOCK_SIZE * sizeof( ptrDNS )) )
                         Sizeof_np += BLOCK_SIZE;
                      else
                         ERROR_MSG("Out of memory, for next_positions.");

                   /* Set the beginning of the loop to be the first
                   ** restart position.
                   */
                   Push_Restart_Name_Posn( temp_DS->data.loop.packet_members );

                   /* Set the next node to be processed to be the beginning 
                   ** of the loop.
                   */
                   Push_Next_Name_Posn( temp_DS->data.loop.packet_members );
/* fprintf(stderr,"packet_members = %p\n",temp_DS->data.loop.packet_members); */

                   /* Initialise the stack. */
                   t = temp_DS;
                   n = Number_of_Names( t->data.loop.packet_members );
/* fprintf(stderr,"number of names in the loop = %d\n",n); */
                   for( i = 0; i < n; i++ ) {
                      /* Add where each node's data is to be placed 
                      ** onto the stack.
                      */
                      Push_Tail_Posn( &(t->data.loop.values) );
                      t = t->next;
                   }
                   /* Set the data positions at the bottom of the stack */
                   Push_Restart_Data_Posn( 0 );
                   Push_Next_Data_Posn( 0 );
		;
    break;}
case 18:
#line 415 "star.yac"
{
		   DEBUG_MSG("data_loop : LOOP_ data_loop_definition data_loop_values");
                   Stop_Loop( BOTTOM );
		   yyval.data_block_body_val = temp_DS;
		   temp_DS = NULL;
		;
    break;}
case 19:
#line 425 "star.yac"
{
		/* first piece of data */
		   DEBUG_MSG("data_loop_definition : data_loop_field");
/* ??? recursive use of data_loop_definition is the problem */
		   yyval.data_loop_definition_val = yyvsp[0].data_loop_definition_val;
		;
    break;}
case 20:
#line 432 "star.yac"
{
                   register Data_Name_Seq	*i;

		   DEBUG_MSG("data_loop_definition : data_loop_definition data_loop_field");
		   /* add the last one to the end of the list */
                   for( i = yyval.data_loop_definition_val; i->next; i = i->next ); /* scan to the end of the list */
		   i->next = yyvsp[0].data_loop_definition_val;
		   yyval.data_loop_definition_val = yyvsp[-1].data_loop_definition_val;
		;
    break;}
case 21:
#line 445 "star.yac"
{
		   register Data_Name_Seq	*n;

		   DEBUG_MSG("data_loop_field : DATA_NAME");
		   Malloc( Data_Name_Seq, n);
		   n->tag = NAME;
		   n->node.name = current_DN;
		   n->next = NULL;
		   yyval.data_loop_definition_val = n;
		;
    break;}
case 22:
#line 456 "star.yac"
{
		   register Data_Name_Seq	*n;

		   DEBUG_MSG("data_loop_field : nested_data_loop");
		   Malloc( Data_Name_Seq, n);
		   n->tag = SUB_LOOP;
		   n->node.sub_loop = yyvsp[0].data_loop_definition_val;
		   n->next = NULL;
		   yyval.data_loop_definition_val = n;
		;
    break;}
case 23:
#line 472 "star.yac"
{
		   DEBUG_MSG("nested_data_loop : LOOP_ data_loop_definition stop_");
		   yyval.data_loop_definition_val = yyvsp[-1].data_loop_definition_val;
		;
    break;}
case 24:
#line 480 "star.yac"
{
		   DEBUG_MSG("loop_ : LOOP_");
		;
    break;}
case 25:
#line 487 "star.yac"
{
		   DEBUG_MSG("stop_ : empty");
		;
    break;}
case 26:
#line 491 "star.yac"
{
		   DEBUG_MSG("stop_ : STOP_");
		;
    break;}
case 27:
#line 498 "star.yac"
{
                   DEBUG_MSG("data_loop_values : data_loop_item ");
		;
    break;}
case 28:
#line 502 "star.yac"
{
                   DEBUG_MSG("data_loop_values : data_loop_values data_loop_item");
		;
    break;}
case 29:
#line 509 "star.yac"
{
                   DEBUG_MSG("data_loop_item : data_item ");
                   Add_Data_Item( yyvsp[0].data_item_val );
		;
    break;}
case 30:
#line 514 "star.yac"
{
                   DEBUG_MSG("data_loop_item : stop_ ");
                   Stop_Loop(STOP_);
		;
    break;}
case 31:
#line 522 "star.yac"
{
                   DEBUG_MSG("data_item : NON_QUOTED_TEXT_STRING ");
		   yyval.data_item_val = current_di;
		;
    break;}
case 32:
#line 527 "star.yac"
{
                   DEBUG_MSG("data_item : DOUBLE_QUOTED_TEXT_STRING ");
		   yyval.data_item_val = current_di;
		;
    break;}
case 33:
#line 532 "star.yac"
{
                   DEBUG_MSG("data_item : SINGLE_QUOTED_TEXT_STRING ");
		   yyval.data_item_val = current_di;
		;
    break;}
case 34:
#line 537 "star.yac"
{
                   DEBUG_MSG("data_item : SEMI_COLON_BOUNDED_TEXT_STRING ");
		   yyval.data_item_val = current_di;
		;
    break;}
case 35:
#line 542 "star.yac"
{
                   DEBUG_MSG("data_item : FRAME_CODE ");
		   yyval.data_item_val = current_di;
		;
    break;}
}
   /* the action file gets copied in in place of this dollarsign */
#line 465 "/pb2/gnu/gcc/lib/bison.simple"

  yyvsp -= yylen;
  yyssp -= yylen;
#ifdef YYLSP_NEEDED
  yylsp -= yylen;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

  *++yyvsp = yyval;

#ifdef YYLSP_NEEDED
  yylsp++;
  if (yylen == 0)
    {
      yylsp->first_line = yylloc.first_line;
      yylsp->first_column = yylloc.first_column;
      yylsp->last_line = (yylsp-1)->last_line;
      yylsp->last_column = (yylsp-1)->last_column;
      yylsp->text = 0;
    }
  else
    {
      yylsp->last_line = (yylsp+yylen-1)->last_line;
      yylsp->last_column = (yylsp+yylen-1)->last_column;
    }
#endif

  /* Now "shift" the result of the reduction.
     Determine what state that goes to,
     based on the state we popped back to
     and the rule number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTBASE];

  goto yynewstate;

yyerrlab:   /* here on detecting error */

  if (! yyerrstatus)
    /* If not already recovering from an error, report this error.  */
    {
      ++yynerrs;

#ifdef YYERROR_VERBOSE
      yyn = yypact[yystate];

      if (yyn > YYFLAG && yyn < YYLAST)
	{
	  int size = 0;
	  char *msg;
	  int x, count;

	  count = 0;
	  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
	  for (x = (yyn < 0 ? -yyn : 0);
	       x < (sizeof(yytname) / sizeof(char *)); x++)
	    if (yycheck[x + yyn] == x)
	      size += strlen(yytname[x]) + 15, count++;
	  msg = (char *) malloc(size + 15);
	  if (msg != 0)
	    {
	      strcpy(msg, "parse error");

	      if (count < 5)
		{
		  count = 0;
		  for (x = (yyn < 0 ? -yyn : 0);
		       x < (sizeof(yytname) / sizeof(char *)); x++)
		    if (yycheck[x + yyn] == x)
		      {
			strcat(msg, count == 0 ? ", expecting `" : " or `");
			strcat(msg, yytname[x]);
			strcat(msg, "'");
			count++;
		      }
		}
	      yyerror(msg);
	      free(msg);
	    }
	  else
	    yyerror ("parse error; also virtual memory exceeded");
	}
      else
#endif /* YYERROR_VERBOSE */
	yyerror("parse error");
    }

  goto yyerrlab1;
yyerrlab1:   /* here on error raised explicitly by an action */

  if (yyerrstatus == 3)
    {
      /* if just tried and failed to reuse lookahead token after an error, discard it.  */

      /* return failure if at end of input */
      if (yychar == YYEOF)
	YYABORT;

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
#endif

      yychar = YYEMPTY;
    }

  /* Else will try to reuse lookahead token
     after shifting the error token.  */

  yyerrstatus = 3;		/* Each real token shifted decrements this */

  goto yyerrhandle;

yyerrdefault:  /* current state does not do anything special for the error token. */

#if 0
  /* This is wrong; only states that explicitly want error tokens
     should shift them.  */
  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  if (yyn) goto yydefault;
#endif

yyerrpop:   /* pop the current state because it cannot handle the error token */

  if (yyssp == yyss) YYABORT;
  yyvsp--;
  yystate = *--yyssp;
#ifdef YYLSP_NEEDED
  yylsp--;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "Error: state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

yyerrhandle:

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yyerrdefault;

  yyn += YYTERROR;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
    goto yyerrdefault;

  yyn = yytable[yyn];
  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrpop;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrpop;

  if (yyn == YYFINAL)
    YYACCEPT;

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting error token, ");
#endif

  *++yyvsp = yylval;
#ifdef YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  yystate = yyn;
  goto yynewstate;
}
#line 548 "star.yac"

/* ancillary functions for parsing and building the internal representation */
Data_Seq *
Data_Seq_froma_Data_Name_Seq(
Data_Name_Seq	*packet,
Data_Name_Seq	*list )
{
   Data_Seq	*i;
   Data_Seq	*t = NULL;

   if( list ) {
      switch( list->tag ) {

      case NAME:
         /* build a data node */
         Malloc( Data_Seq, t);
         DEBUG_MSG("Data_Seq_froma_Data_Name_Seq, DATA_NAME:");
         DEBUG_MSG(list->node.name);
         t->name = list->node.name;
         t->tag = LOOP;
         t->data.loop.values = NULL;
         t->data.loop.packet_members = packet;
         /* recursively proceed along the list */
         t->next = Data_Seq_froma_Data_Name_Seq( packet, list->next );
         break;

      case SUB_LOOP:
         /* recursively descend into the Nested Loop */
         DEBUG_MSG("Data_Seq_froma_Data_Name_Seq, Recursive call for Sub Loop.");
         t = Data_Seq_froma_Data_Name_Seq( packet, list->node.sub_loop );
         /* recursively proceed along the list,
            placing the rest of the list after the Sub Loop */
         for( i = t; i->next; i = i->next ); /* scan to the end of the list */
         i->next = Data_Seq_froma_Data_Name_Seq( packet, list->next );
         break;

      default:
         ERROR_MSG("Data_Seq_froma_Data_Name_Seq: Unknown node type in sequence.");
      }
   }
   return( t );
} /* Data_Seq_froma_Data_Name_Seq */

/*
********************************************************************************
*/

/* Various Stacks for retaining state information between calls
*/

/* Operations on a stack of 
** Restart Positions In List_Value_Sequence
*/
int *RPIV = NULL;	/* stack of restart positions within the L_V_Ss */
int current_RPIV = -1;	/* the current top of the stack */
int Sizeof_RPIV = 0;	/* the current size of the stack */
int N_blocks_RPIV = 0;	/* the number of blocks in the stack */

/*
********************************************************************************
*/

/* Operations on a stack of 
** The Next Tail Position In List_Value_Sequence
*/
int *NPIV = NULL;	/* stack of offsets into the stack of tail positions
                	** within the L_V_Ss */
int current_NPIV = -1;	/* the current top of the stack */
int Sizeof_NPIV = 0;	/* the current size of the stack */
int N_blocks_NPIV = 0;	/* the number of blocks in the stack */

/*
********************************************************************************
*/

/* Operations on a stack of
** Pointers into List_Value_Sequence
*/
ptrptrLVS	*tail_positions = NULL;	/* stack of pointers to pointers */
int current_tp = -1;	/* the current top of the stack */
int Sizeof_tp = 0;	/* the current size of the stack */
int N_blocks_tp = 0;	/* the number of blocks in the stack */

/*
********************************************************************************
*/

/* Operations on a stack of
** Pointers into a Data_Name_Sequence,
** indicating the restart position for a packet
*/
ptrDNS	*restart_positions = NULL;	/* stack of pointers */
int current_rp = -1;	/* the current top of the stack */
int Sizeof_rp = 0;	/* the current size of the stack */
int N_blocks_rp = 0;	/* the number of blocks in the stack */

/*
********************************************************************************
*/

/* Operations on a stack of
** Pointers into a Data_Name_Sequence,
** indicating the next position in the packet
*/
ptrDNS	*next_positions = NULL;	/* stack of pointers */
int current_np = -1;	/* the current top of the stack */
int Sizeof_np = 0;	/* the current size of the stack */
int N_blocks_np = 0;	/* the number of blocks in the stack */

/*
********************************************************************************
*/

void
Add_Data_Item(
Data_Item *	data)
{
   ptrDNS		t = NULL;
   List_Value_Seq	*u = NULL;
   int			n,j,i = -1;
   
   if( !( t = Pop_Next_Name_Posn) ){
      /* at the end of a packet, go back to the beginning */
      DEBUG_MSG("Add_Data_Item: At the end of a packet, going back to the beginning.");
      t = Top_Restart_Name_Posn;
      (void) Pop_Next_Data_Posn;
      i = Top_Restart_Data_Posn;
      Push_Next_Data_Posn( i );
   }
   
/* debug
fprintf(stderr,"t = %p\n",t);
*/
   switch( t->tag ) {
   case NAME:
      DEBUG_MSG("Add_Data_Item: data for,");
      DEBUG_MSG(t->node.name);
      /* build a data node */
      Malloc( List_Value_Seq, u);
      u->tag = DATA_ITEM;
      u->element.data_item = data;
      u->next = NULL;
      /* add the node to the values already held */
      *(tail_positions[ Top_Next_Data_Posn ]) = u;
      /* replace the next position for the next time around */
      tail_positions[ Top_Next_Data_Posn ] = &(u->next);
      /* shift to the next data position */
      i = Pop_Next_Data_Posn;
      Push_Next_Data_Posn( i + 1 );
      /* shift to the next node in Data_Name_Sequence */
      Push_Next_Name_Posn( t->next );
      break;

   case SUB_LOOP:
      DEBUG_MSG("Add_Data_Item: Set up a sub-loop.");
      /* set up the name stacks for step down into the next level */
      /* shift to the next node in Data_Name_Sequence, at this higher level */
      Push_Next_Name_Posn( t->next );
      /* push the beginning of the sub_loop onto the restart stack */
      Push_Restart_Name_Posn( t->node.sub_loop );
      /* set the next name to the beginning of the sub_loop */
      Push_Next_Name_Posn( t->node.sub_loop );

      n = Number_of_Names( t->node.sub_loop );
      for( j = 0; j < n; j++ ) {
         /* build a sub_loop node */
         Malloc( List_Value_Seq, u);
         u->tag = SUB_LOOP;
         u->element.sub_loop = NULL;
         u->next = NULL;
         /* get the next data to be updated */
         i = Pop_Next_Data_Posn;
         /* add the node to the values already held */
         *(tail_positions[ i ]) = u;
         /* overwrite the next position for the next time around */
         tail_positions[ i ] = &(u->next);
         /* push the sub_loop position onto the top, for the lower level */
         Push_Tail_Posn( &(u->element.sub_loop) ); 
         if( ! j )
            /* the first time */
            /* so place the restart position */
            Push_Restart_Data_Posn( current_tp );
         /* shift to the next data position */
         Push_Next_Data_Posn( i + 1 );
      }
      /* set the next data position for the sub_loop */
      i = Top_Restart_Data_Posn;
      Push_Next_Data_Posn( i );
      /* recall yourself with the same input */
      Add_Data_Item( data );
      break;

   default:
      ERROR_MSG("Add_Data_Item: Unknown node in a Data_Name_Sequence.");
   }
} /* Add_Data_Item */

void
Stop_Loop(
Domain	token)
{
   ptrDNS	last;

   if( last = Pop_Next_Name_Posn ) {
      /* there is still some data left to be processed */
      /* Assume the incoming data has its data "stop_" in the right position.
      ** For now, ignore the rest of the loop structure, even though this will
      ** put loop data out of allignment for future processing.
      */
      ERROR_MSG("Misaligned loop data, expecting data for:");
      switch( last->tag ) {
      case NAME:
         ERROR_MSG(last->node.name);
         break;
      case SUB_LOOP:
         /* what we really need to do is to set up a sub_loop on the stacks,
         ** proceed down into that next level, get the names, and then come
         ** back up to the next level.
         */
         ERROR_MSG("a whole Sub-Loop");
         break;
      default:
         ERROR_MSG("Stop_Loop: Unexpected node in a Data Name Sequence");
      }
   }
   /* Now proceed back up to the previous level */
   (void) Pop_Restart_Name_Posn;
   /* shrink down the Data Stack */
   while( current_tp >= Top_Restart_Data_Posn ) Decrement_Tail_Posn;
   (void) Pop_Restart_Data_Posn;
   (void) Pop_Next_Data_Posn;
   /* if there is no more data and we still arn't at the top of the loop,
   ** then keep going
   */
   if( token == BOTTOM && current_rp >= 0 ) Stop_Loop( token );
} /* Stop_Loop */

yyerror(char *s)
{
  char	*t;
  int	i = YYTRANSLATE(yychar);

  /* assume 12 chars will be enough to print an int */
  t = (char *)malloc( (22 + 12 + 1) * sizeof(char));
  ERROR_MSG(sprintf( t, "Syntax Error in line: %-12d", star_line_count));
  free( t );
  t = (char *)malloc( (12 + strlen(yytname[i]) + 1) * sizeof(char));
  ERROR_MSG(sprintf( t, "Unexpected %s,", yytname[i]));
  ERROR_MSG(last_star_token);
  free( t );
}

