Skip to content
Snippets Groups Projects
Gmsh.tab.cpp 280 KiB
Newer Older

/*----------.
| yyparse.  |
`----------*/

#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
int yyparse (void *YYPARSE_PARAM)
# else
int yyparse (YYPARSE_PARAM)
  void *YYPARSE_PARAM;
# endif
#else /* ! YYPARSE_PARAM */
#if defined (__STDC__) || defined (__cplusplus)
yyparse (void)
#else
int
yyparse ()

#endif
#endif
  register int yystate;
  register int yyn;
  int yyresult;
  /* Number of tokens to shift before error messages enabled.  */
  int yyerrstatus;
  /* Look-ahead token as an internal (translated) token number.  */
  int yytoken = 0;

  /* Three stacks and their tools:
     `yyss': related to states,
     `yyvs': related to semantic values,
     `yyls': related to locations.

     Refer to the stacks thru separate pointers, to allow yyoverflow
     to reallocate them elsewhere.  */

  /* The state stack.  */
  short int yyssa[YYINITDEPTH];
  short int *yyss = yyssa;
  register short int *yyssp;

  /* The semantic value stack.  */
  YYSTYPE yyvsa[YYINITDEPTH];
  YYSTYPE *yyvs = yyvsa;
  register YYSTYPE *yyvsp;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#define YYPOPSTACK   (yyvsp--, yyssp--)
  YYSIZE_T yystacksize = YYINITDEPTH;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

  /* When reducing, the number of symbols on the RHS of the reduced
     rule.  */
  YYDPRINTF ((stderr, "Starting parse\n"));

  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;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

  yyvsp[0] = yylval;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

  goto yysetstate;

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

  if (yyss + yystacksize - 1 <= yyssp)
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYSIZE_T yysize = yyssp - yyss + 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 int *yyss1 = yyss;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed


	/* Each stack pointer address is followed by the size of the
	   data in use in that stack, in bytes.  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, yysize * sizeof (*yyssp),
		    &yyvs1, yysize * sizeof (*yyvsp),

		    &yystacksize);

	yyss = yyss1;
	yyvs = yyvs1;
      }
# ifndef YYSTACK_RELOCATE
      goto yyoverflowlab;
# else
      if (YYMAXDEPTH <= yystacksize)
	goto yyoverflowlab;
      if (YYMAXDEPTH < yystacksize)

      {
	short int *yyss1 = yyss;
	union yyalloc *yyptr =
	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
	if (! yyptr)
	  goto yyoverflowlab;
	YYSTACK_RELOCATE (yyss);
	YYSTACK_RELOCATE (yyvs);

#  undef YYSTACK_RELOCATE
	if (yyss1 != yyssa)
	  YYSTACK_FREE (yyss1);
      }
# endif
      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
		  (unsigned long int) yystacksize));

      if (yyss + yystacksize - 1 <= yyssp)
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));

/*-----------.
| yybackup.  |
`-----------*/
yybackup:

/* Do appropriate processing given the current state.  */
/* Read a look-ahead token if we need one and don't already have one.  */
  /* First try to decide what to do without reference to look-ahead token.  */
  if (yyn == YYPACT_NINF)
  /* Not known => get a look-ahead token if don't already have one.  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
      YYDPRINTF ((stderr, "Reading a token: "));
  if (yychar <= YYEOF)
      yychar = yytoken = YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
      yytoken = YYTRANSLATE (yychar);
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
  /* If the proper action on seeing token YYTOKEN is to reduce or to
     detect an error, take that action.  */
  yyn += yytoken;
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  if (yyn <= 0)
      if (yyn == 0 || yyn == YYTABLE_NINF)
	goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the look-ahead token.  */
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);

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

  *++yyvsp = yylval;


  /* Count tokens shifted since error; after three, turn off error
     status.  */
  if (yyerrstatus)
    yyerrstatus--;
/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed


/*-----------------------------.
| yyreduce -- Do a reduction.  |
`-----------------------------*/
  /* yyn is the number of a rule to reduce with.  */
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

  /* If YYLEN is nonzero, implement the default value of the action:
     `$$ = $1'.
     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];
  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
        case 3:
#line 145 "Gmsh.y"
    { yyerrok; return 1; ;}
    break;

  case 6:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 156 "Gmsh.y"
    { return 1; ;}
    break;

  case 7:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 157 "Gmsh.y"
    { return 1; ;}
    break;

  case 8:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 158 "Gmsh.y"
    { return 1; ;}
    break;

  case 9:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 159 "Gmsh.y"
    { return 1; ;}
    break;

  case 10:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 160 "Gmsh.y"
    { List_Delete((yyvsp[0].l)); return 1; ;}
    break;

  case 11:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 161 "Gmsh.y"
    { List_Delete((yyvsp[0].l)); return 1; ;}
    break;

  case 12:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 162 "Gmsh.y"
    { return 1; ;}
    break;

  case 13:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 163 "Gmsh.y"
    { return 1; ;}
    break;

  case 14:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 164 "Gmsh.y"
    { return 1; ;}
    break;

  case 15:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 165 "Gmsh.y"
    { List_Delete((yyvsp[0].l)); return 1; ;}
    break;

  case 16:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 166 "Gmsh.y"
    { return 1; ;}
    break;

  case 17:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 167 "Gmsh.y"
    { return 1; ;}
    break;

  case 18:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 168 "Gmsh.y"
    { return 1; ;}
    break;

  case 19:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 169 "Gmsh.y"
    { return 1; ;}
    break;

  case 20:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 174 "Gmsh.y"
    {
      Msg(DIRECT, (yyvsp[-2].c));
      Free((yyvsp[-2].c));
    ;}
    break;

  case 21:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 179 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      char tmpstring[1024];
      int i = PrintListOfDouble((yyvsp[-4].c), (yyvsp[-2].l), tmpstring);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(i < 0) 
	yymsg(GERROR, "Too few arguments in Printf");
      else if(i > 0)
	yymsg(GERROR, "%d extra argument%s in Printf", i, (i>1)?"s":"");
      else
	Msg(DIRECT, tmpstring);
      Free((yyvsp[-4].c));
      List_Delete((yyvsp[-2].l));
    ;}
    break;

  case 22:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 197 "Gmsh.y"
    { 
      if(!strcmp((yyvsp[-5].c), "View") && !CheckViewErrorFlags(View)){
	EndView(View, 0, yyname, (yyvsp[-4].c));
      }
      Free((yyvsp[-5].c)); Free((yyvsp[-4].c));
    ;}
    break;

  case 23:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 204 "Gmsh.y"
    {
      if(!strcmp((yyvsp[-7].c), "View") && !CheckViewErrorFlags(View)){
	EndView(View, 0, yyname, (yyvsp[-6].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
      Free((yyvsp[-7].c)); Free((yyvsp[-6].c)); Free((yyvsp[-5].c));
    ;}
    break;

  case 24:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 214 "Gmsh.y"
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      View = BeginView(1); 
      for(int i = 0; i < VIEW_NB_ELEMENT_TYPES; i++){
	ViewErrorFlags[i] = 0;
      }
    ;}
    break;

  case 31:
#line 230 "Gmsh.y"
    { ViewCoord[ViewCoordIdx] = (yyvsp[0].d); ViewCoordIdx++; ;}
    break;

  case 32:
#line 232 "Gmsh.y"
    { ViewCoord[ViewCoordIdx] = (yyvsp[0].d); ViewCoordIdx++; ;}
    break;

  case 33:
#line 237 "Gmsh.y"
    { if(ViewValueList) List_Add(ViewValueList, &(yyvsp[0].d)); ;}
    break;

  case 34:
#line 239 "Gmsh.y"
    { if(ViewValueList) List_Add(ViewValueList, &(yyvsp[0].d)); ;}
    break;

  case 35:
#line 244 "Gmsh.y"
    {
      if(!strcmp((yyvsp[0].c), "SP")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 0; ViewNumNodes = 1; ViewNumComp = 1;
	ViewValueList = View->SP; ViewNumList = &View->NbSP;
      }
      else if(!strcmp((yyvsp[0].c), "VP")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 1; ViewNumNodes = 1; ViewNumComp = 3;
	ViewValueList = View->VP; ViewNumList = &View->NbVP;
      }
      else if(!strcmp((yyvsp[0].c), "TP")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 2; ViewNumNodes = 1; ViewNumComp = 9;
	ViewValueList = View->TP; ViewNumList = &View->NbTP;
      }
      else if(!strcmp((yyvsp[0].c), "SL")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 3; ViewNumNodes = 2; ViewNumComp = 1;
	ViewValueList = View->SL; ViewNumList = &View->NbSL;
      }
      else if(!strcmp((yyvsp[0].c), "VL")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 4; ViewNumNodes = 2; ViewNumComp = 3;
	ViewValueList = View->VL; ViewNumList = &View->NbVL;
      }
      else if(!strcmp((yyvsp[0].c), "TL")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 5; ViewNumNodes = 2; ViewNumComp = 9;
	ViewValueList = View->TL; ViewNumList = &View->NbTL;
      }
      else if(!strcmp((yyvsp[0].c), "ST")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 6; ViewNumNodes = 3; ViewNumComp = 1;
	ViewValueList = View->ST; ViewNumList = &View->NbST;
      }
      else if(!strcmp((yyvsp[0].c), "VT")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 7; ViewNumNodes = 3; ViewNumComp = 3;
	ViewValueList = View->VT; ViewNumList = &View->NbVT;
      }
      else if(!strcmp((yyvsp[0].c), "TT")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 8; ViewNumNodes = 3; ViewNumComp = 9;
	ViewValueList = View->TT; ViewNumList = &View->NbTT;
      }
      else if(!strcmp((yyvsp[0].c), "SQ")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 9; ViewNumNodes = 4; ViewNumComp = 1;
	ViewValueList = View->SQ; ViewNumList = &View->NbSQ;
      }
      else if(!strcmp((yyvsp[0].c), "VQ")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 10; ViewNumNodes = 4; ViewNumComp = 3;
	ViewValueList = View->VQ; ViewNumList = &View->NbVQ;
      }
      else if(!strcmp((yyvsp[0].c), "TQ")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 11; ViewNumNodes = 4; ViewNumComp = 9;
	ViewValueList = View->TQ; ViewNumList = &View->NbTQ;
      }
      else if(!strcmp((yyvsp[0].c), "SS")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 12; ViewNumNodes = 4; ViewNumComp = 1;
	ViewValueList = View->SS; ViewNumList = &View->NbSS;
      }
      else if(!strcmp((yyvsp[0].c), "VS")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 13; ViewNumNodes = 4; ViewNumComp = 3;
	ViewValueList = View->VS; ViewNumList = &View->NbVS;
      }
      else if(!strcmp((yyvsp[0].c), "TS")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 14; ViewNumNodes = 4; ViewNumComp = 9;
	ViewValueList = View->TS; ViewNumList = &View->NbTS;
      }
      else if(!strcmp((yyvsp[0].c), "SH")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 15; ViewNumNodes = 8; ViewNumComp = 1;
	ViewValueList = View->SH; ViewNumList = &View->NbSH;
      }
      else if(!strcmp((yyvsp[0].c), "VH")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 16; ViewNumNodes = 8; ViewNumComp = 3;
	ViewValueList = View->VH; ViewNumList = &View->NbVH;
      }
      else if(!strcmp((yyvsp[0].c), "TH")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 17; ViewNumNodes = 8; ViewNumComp = 9;
	ViewValueList = View->TH; ViewNumList = &View->NbTH;
      }
      else if(!strcmp((yyvsp[0].c), "SI")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 18; ViewNumNodes = 6; ViewNumComp = 1;
	ViewValueList = View->SI; ViewNumList = &View->NbSI;
      }
      else if(!strcmp((yyvsp[0].c), "VI")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 19; ViewNumNodes = 6; ViewNumComp = 3;
	ViewValueList = View->VI; ViewNumList = &View->NbVI;
      }
      else if(!strcmp((yyvsp[0].c), "TI")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 20; ViewNumNodes = 6; ViewNumComp = 9;
	ViewValueList = View->TI; ViewNumList = &View->NbTI;
      }
      else if(!strcmp((yyvsp[0].c), "SY")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 21; ViewNumNodes = 5; ViewNumComp = 1;
	ViewValueList = View->SY; ViewNumList = &View->NbSY;
      }
      else if(!strcmp((yyvsp[0].c), "VY")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 22; ViewNumNodes = 5; ViewNumComp = 3;
	ViewValueList = View->VY; ViewNumList = &View->NbVY;
      }
      else if(!strcmp((yyvsp[0].c), "TY")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 23; ViewNumNodes = 5; ViewNumComp = 9;
	ViewValueList = View->TY; ViewNumList = &View->NbTY;
      }
      else if(!strcmp((yyvsp[0].c), "SL2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 3; ViewNumNodes = 3; ViewNumComp = 1;
	ViewValueList = View->SL2; ViewNumList = &View->NbSL2;
      }
      else if(!strcmp((yyvsp[0].c), "VL2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 4; ViewNumNodes = 3; ViewNumComp = 3;
	ViewValueList = View->VL2; ViewNumList = &View->NbVL2;
      }
      else if(!strcmp((yyvsp[0].c), "TL2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 5; ViewNumNodes = 3; ViewNumComp = 9;
	ViewValueList = View->TL2; ViewNumList = &View->NbTL2;
      }
      else if(!strcmp((yyvsp[0].c), "ST2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 6; ViewNumNodes = 6; ViewNumComp = 1;
	ViewValueList = View->ST2; ViewNumList = &View->NbST2;
      }
      else if(!strcmp((yyvsp[0].c), "VT2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 7; ViewNumNodes = 6; ViewNumComp = 3;
	ViewValueList = View->VT2; ViewNumList = &View->NbVT2;
      }
      else if(!strcmp((yyvsp[0].c), "TT2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 8; ViewNumNodes = 6; ViewNumComp = 9;
	ViewValueList = View->TT2; ViewNumList = &View->NbTT2;
      }
      else if(!strcmp((yyvsp[0].c), "SQ2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 9; ViewNumNodes = 9; ViewNumComp = 1;
	ViewValueList = View->SQ2; ViewNumList = &View->NbSQ2;
      }
      else if(!strcmp((yyvsp[0].c), "VQ2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 10; ViewNumNodes = 9; ViewNumComp = 3;
	ViewValueList = View->VQ2; ViewNumList = &View->NbVQ2;
      }
      else if(!strcmp((yyvsp[0].c), "TQ2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 11; ViewNumNodes = 9; ViewNumComp = 9;
	ViewValueList = View->TQ2; ViewNumList = &View->NbTQ2;
      }
      else if(!strcmp((yyvsp[0].c), "SS2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 12; ViewNumNodes = 10; ViewNumComp = 1;
	ViewValueList = View->SS2; ViewNumList = &View->NbSS2;
      }
      else if(!strcmp((yyvsp[0].c), "VS2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 13; ViewNumNodes = 10; ViewNumComp = 3;
	ViewValueList = View->VS2; ViewNumList = &View->NbVS2;
      }
      else if(!strcmp((yyvsp[0].c), "TS2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 14; ViewNumNodes = 10; ViewNumComp = 9;
	ViewValueList = View->TS2; ViewNumList = &View->NbTS2;
      }
      else if(!strcmp((yyvsp[0].c), "SH2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 15; ViewNumNodes = 27; ViewNumComp = 1;
	ViewValueList = View->SH2; ViewNumList = &View->NbSH2;
      }
      else if(!strcmp((yyvsp[0].c), "VH2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 16; ViewNumNodes = 27; ViewNumComp = 3;
	ViewValueList = View->VH2; ViewNumList = &View->NbVH2;
      }
      else if(!strcmp((yyvsp[0].c), "TH2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 17; ViewNumNodes = 27; ViewNumComp = 9;
	ViewValueList = View->TH2; ViewNumList = &View->NbTH2;
      }
      else if(!strcmp((yyvsp[0].c), "SI2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 18; ViewNumNodes = 18; ViewNumComp = 1;
	ViewValueList = View->SI2; ViewNumList = &View->NbSI2;
      }
      else if(!strcmp((yyvsp[0].c), "VI2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 19; ViewNumNodes = 18; ViewNumComp = 3;
	ViewValueList = View->VI2; ViewNumList = &View->NbVI2;
      }
      else if(!strcmp((yyvsp[0].c), "TI2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 20; ViewNumNodes = 18; ViewNumComp = 9;
	ViewValueList = View->TI2; ViewNumList = &View->NbTI2;
      }
      else if(!strcmp((yyvsp[0].c), "SY2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 21; ViewNumNodes = 14; ViewNumComp = 1;
	ViewValueList = View->SY2; ViewNumList = &View->NbSY2;
      }
      else if(!strcmp((yyvsp[0].c), "VY2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 22; ViewNumNodes = 14; ViewNumComp = 3;
	ViewValueList = View->VY2; ViewNumList = &View->NbVY2;
      }
      else if(!strcmp((yyvsp[0].c), "TY2")){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = 23; ViewNumNodes = 14; ViewNumComp = 9;
	ViewValueList = View->TY2; ViewNumList = &View->NbTY2;
      }
      else{
	yymsg(GERROR, "Unknown element type '%s'", (yyvsp[0].c));	
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	ViewElementIdx = -1; ViewNumNodes = 0; ViewNumComp = 0;
	ViewValueList = NULL; ViewNumList = NULL;
      }
      Free((yyvsp[0].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      ViewCoordIdx = 0;
    ;}
    break;

  case 36:
#line 434 "Gmsh.y"
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(ViewValueList){
	if(ViewCoordIdx != 3 * ViewNumNodes){
	  yymsg(GERROR, "Wrong number of node coordinates (%d != %d)", 
		ViewCoordIdx, 3 * ViewNumNodes);
	  double d = 0;
	  for(int i = 0; i < 3 * ViewNumNodes; i++)
	    List_Add(ViewValueList, &d);
	}
	else{
	  for(int i = 0; i < 3; i++)
	    for(int j = 0; j < ViewNumNodes; j++)
	      List_Add(ViewValueList, &ViewCoord[3*j+i]);
	}
	ViewNumListTmp = List_Nbr(ViewValueList);
      }
    ;}
    break;

  case 37:
#line 452 "Gmsh.y"
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(ViewValueList){  
	if((List_Nbr(ViewValueList) - ViewNumListTmp) % (ViewNumComp * ViewNumNodes)) 
	  ViewErrorFlags[ViewElementIdx]++;
	(*ViewNumList)++;
      }
    ;}
    break;

  case 38:
#line 463 "Gmsh.y"
    { 
      for(int i = 0; i < (int)strlen((yyvsp[0].c))+1; i++) List_Add(View->T2C, &(yyvsp[0].c)[i]); 
      Free((yyvsp[0].c));
    ;}
    break;

  case 39:
#line 468 "Gmsh.y"
    { 
      for(int i = 0; i < (int)strlen((yyvsp[0].c))+1; i++) List_Add(View->T2C, &(yyvsp[0].c)[i]); 
      Free((yyvsp[0].c));
    ;}
    break;

  case 40:
#line 476 "Gmsh.y"
    { 
      List_Add(View->T2D, &(yyvsp[-5].d)); List_Add(View->T2D, &(yyvsp[-3].d));
      List_Add(View->T2D, &(yyvsp[-1].d)); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      double d = List_Nbr(View->T2C);
      List_Add(View->T2D, &d); 
    ;}
    break;

  case 41:
#line 483 "Gmsh.y"
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      View->NbT2++;
    ;}
    break;

  case 42:
#line 490 "Gmsh.y"
    { 
      for(int i = 0; i < (int)strlen((yyvsp[0].c))+1; i++) List_Add(View->T3C, &(yyvsp[0].c)[i]); 
      Free((yyvsp[0].c));
    ;}
    break;

  case 43:
#line 495 "Gmsh.y"
    { 
      for(int i = 0; i < (int)strlen((yyvsp[0].c))+1; i++) List_Add(View->T3C, &(yyvsp[0].c)[i]); 
      Free((yyvsp[0].c));
    ;}
    break;

  case 44:
#line 503 "Gmsh.y"
    { 
      List_Add(View->T3D, &(yyvsp[-7].d)); List_Add(View->T3D, &(yyvsp[-5].d));
      List_Add(View->T3D, &(yyvsp[-3].d)); List_Add(View->T3D, &(yyvsp[-1].d)); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      double d = List_Nbr(View->T3C);
      List_Add(View->T3D, &d); 
    ;}
    break;

  case 45:
#line 510 "Gmsh.y"
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      View->NbT3++;
    ;}
    break;

  case 46:
#line 518 "Gmsh.y"
    {
      View->adaptive = new Adaptive_Post_View(View, (yyvsp[-5].l), (yyvsp[-2].l));
    ;}
    break;

  case 47:
#line 525 "Gmsh.y"
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      ViewValueList = View->Time;
    ;}
    break;

  case 48:
#line 529 "Gmsh.y"
    {
    ;}
    break;

  case 49:
#line 533 "Gmsh.y"
    {
      View->Grains [(int)(yyvsp[-3].d)] = (yyvsp[-1].l);
    ;}
    break;

  case 50:
#line 541 "Gmsh.y"
    { (yyval.i) = 0; ;}
    break;

  case 51:
#line 542 "Gmsh.y"
    { (yyval.i) = 1; ;}
    break;

  case 52:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 543 "Gmsh.y"
    { (yyval.i) = 2; ;}
    break;

  case 53:
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#line 544 "Gmsh.y"
    { (yyval.i) = 3; ;}
    break;

  case 54:
#line 545 "Gmsh.y"
    { (yyval.i) = 4; ;}
    break;

  case 55:
#line 549 "Gmsh.y"
    { (yyval.i) = 1; ;}
    break;

  case 56:
#line 550 "Gmsh.y"
    { (yyval.i) = -1; ;}
    break;

  case 57:
#line 558 "Gmsh.y"
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol TheSymbol;
      TheSymbol.Name = (yyvsp[-3].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol *pSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))){
	if(!(yyvsp[-2].i)){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  TheSymbol.val = List_Create(1, 1, sizeof(double));
	  List_Put(TheSymbol.val, 0, &(yyvsp[-1].d));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  Tree_Add(Symbol_T, &TheSymbol);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	else{
	  yymsg(GERROR, "Unknown variable '%s'", (yyvsp[-3].c));
	  Free((yyvsp[-3].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	double *pd = (double*)List_Pointer_Fast(pSymbol->val, 0); 
	switch((yyvsp[-2].i)){
	case 0 : *pd = (yyvsp[-1].d); break;
	case 1 : *pd += (yyvsp[-1].d); break;
	case 2 : *pd -= (yyvsp[-1].d); break;
	case 3 : *pd *= (yyvsp[-1].d); break;
	  if((yyvsp[-1].d)) *pd /= (yyvsp[-1].d); 
	  else yymsg(GERROR, "Division by zero in '%s /= %g'", (yyvsp[-3].c), (yyvsp[-1].d));
	Free((yyvsp[-3].c));
    ;}
    break;

  case 58:
#line 589 "Gmsh.y"
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol TheSymbol;
      TheSymbol.Name = (yyvsp[-6].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol *pSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))){
	if(!(yyvsp[-2].i)){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  TheSymbol.val = List_Create(5, 5, sizeof(double));
	  List_Put(TheSymbol.val, (int)(yyvsp[-4].d), &(yyvsp[-1].d));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  Tree_Add(Symbol_T, &TheSymbol);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	else{
	  yymsg(GERROR, "Unknown variable '%s'", (yyvsp[-6].c));
	  Free((yyvsp[-6].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	}
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	double *pd;
	if((pd = (double*)List_Pointer_Test(pSymbol->val, (int)(yyvsp[-4].d)))){
	  switch((yyvsp[-2].i)){
	  case 0 : *pd = (yyvsp[-1].d); break;
	  case 1 : *pd += (yyvsp[-1].d); break;
	  case 2 : *pd -= (yyvsp[-1].d); break;
	  case 3 : *pd *= (yyvsp[-1].d); break;
	    if((yyvsp[-1].d)) *pd /= (yyvsp[-1].d); 
	    else yymsg(GERROR, "Division by zero in '%s[%d] /= %g'", (yyvsp[-6].c), (int)(yyvsp[-4].d), (yyvsp[-1].d));
	  if(!(yyvsp[-2].i))
	    List_Put(pSymbol->val, (int)(yyvsp[-4].d), &(yyvsp[-1].d));
	    yymsg(GERROR, "Uninitialized variable '%s[%d]'", (yyvsp[-6].c), (int)(yyvsp[-4].d));
	Free((yyvsp[-6].c));
    ;}
    break;

  case 59:
#line 628 "Gmsh.y"
    {
      if(List_Nbr((yyvsp[-5].l)) != List_Nbr((yyvsp[-1].l))){
	yymsg(GERROR, "Incompatible array dimensions in affectation");
	Free((yyvsp[-8].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      }
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Symbol TheSymbol;
	TheSymbol.Name = (yyvsp[-8].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Symbol *pSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))){
	  if(!(yyvsp[-2].i)){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    TheSymbol.val = List_Create(5, 5, sizeof(double));
	    for(int i = 0; i < List_Nbr((yyvsp[-5].l)); i++){
	      List_Put(TheSymbol.val, (int)(*(double*)List_Pointer((yyvsp[-5].l), i)),
		       (double*)List_Pointer((yyvsp[-1].l), i));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    Tree_Add(Symbol_T, &TheSymbol);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  else{
	    yymsg(GERROR, "Unknown variable '%s'", (yyvsp[-8].c));
	    Free((yyvsp[-8].c));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	  }
	  for(int i = 0; i < List_Nbr((yyvsp[-5].l)); i++){
	    int j = (int)(*(double*)List_Pointer((yyvsp[-5].l), i));
	    double d = *(double*)List_Pointer((yyvsp[-1].l), i);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	    double *pd;
	    if((pd = (double*)List_Pointer_Test(pSymbol->val, j))){
	      switch((yyvsp[-2].i)){
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	      case 0 : *pd = d; break;
	      case 1 : *pd += d; break;
	      case 2 : *pd -= d; break;
	      case 3 : *pd *= d; break;
	      case 4 : 
		if((yyvsp[-1].l)) *pd /= d; 
		else yymsg(GERROR, "Division by zero in '%s[%d] /= %g'", (yyvsp[-8].c), j, d);
	      if(!(yyvsp[-2].i))
		List_Put(pSymbol->val, j, &d);
	      else
		yymsg(GERROR, "Uninitialized variable '%s[%d]'", (yyvsp[-8].c), j);	  
	  Free((yyvsp[-8].c));
      List_Delete((yyvsp[-5].l));
      List_Delete((yyvsp[-1].l));
    ;}
    break;

  case 60:
#line 682 "Gmsh.y"
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol TheSymbol;
      TheSymbol.Name = (yyvsp[-5].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol *pSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))){
	TheSymbol.val = List_Create(5, 5, sizeof(double));
	List_Copy((yyvsp[-1].l), TheSymbol.val);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Tree_Add(Symbol_T, &TheSymbol);
      }
      else{
	List_Reset(pSymbol->val);
	List_Copy((yyvsp[-1].l), pSymbol->val);
	Free((yyvsp[-5].c));
      }
      List_Delete((yyvsp[-1].l));
    ;}
    break;

  case 61:
#line 699 "Gmsh.y"
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      // appends to the list
      Symbol TheSymbol;
      TheSymbol.Name = (yyvsp[-5].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol *pSymbol;
      if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol))){
	TheSymbol.val = List_Create(5, 5, sizeof(double));
	List_Copy((yyvsp[-1].l), TheSymbol.val);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	Tree_Add(Symbol_T, &TheSymbol);
      }
      else{
	for(int i = 0; i < List_Nbr((yyvsp[-1].l)); i++)
	  List_Add(pSymbol->val, List_Pointer((yyvsp[-1].l), i));
	Free((yyvsp[-5].c));
      }
      List_Delete((yyvsp[-1].l));
    ;}
    break;

  case 62:
#line 717 "Gmsh.y"
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol TheSymbol;
      TheSymbol.Name = (yyvsp[-2].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol *pSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol)))
	yymsg(GERROR, "Unknown variable '%s'", (yyvsp[-2].c)); 
	*(double*)List_Pointer_Fast(pSymbol->val, 0) += (yyvsp[-1].i);
      Free((yyvsp[-2].c));
    ;}
    break;

  case 63:
#line 728 "Gmsh.y"
    {
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol TheSymbol;
      TheSymbol.Name = (yyvsp[-5].c);
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      Symbol *pSymbol;
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      if(!(pSymbol = (Symbol*)Tree_PQuery(Symbol_T, &TheSymbol)))
	yymsg(GERROR, "Unknown variable '%s'", (yyvsp[-5].c)); 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
	double *pd;
	if((pd = (double*)List_Pointer_Test(pSymbol->val, (int)(yyvsp[-3].d))))
	  *pd += (yyvsp[-1].i);
	  yymsg(GERROR, "Uninitialized variable '%s[%d]'", (yyvsp[-5].c), (int)(yyvsp[-3].d));
      }
      Free((yyvsp[-5].c));
    ;}
    break;

  case 64:
#line 747 "Gmsh.y"
    { 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      char* (*pStrOpt)(int num, int action, char *value);
      StringXString *pStrCat;
      if(!(pStrCat = Get_StringOptionCategory((yyvsp[-5].c))))
	yymsg(GERROR, "Unknown string option class '%s'", (yyvsp[-5].c));
	if(!(pStrOpt = (char *(*) (int, int, char *))Get_StringOption((yyvsp[-3].c), pStrCat)))
	  yymsg(GERROR, "Unknown string option '%s.%s'", (yyvsp[-5].c), (yyvsp[-3].c));
	  pStrOpt(0, GMSH_SET|GMSH_GUI, (yyvsp[-1].c));
      }
      Free((yyvsp[-5].c)); Free((yyvsp[-3].c)); //FIXME: somtimes leak $5
    ;}
    break;

  case 65:
#line 761 "Gmsh.y"
    { 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
      char* (*pStrOpt)(int num, int action, char *value);
      StringXString *pStrCat;
      if(!(pStrCat = Get_StringOptionCategory((yyvsp[-8].c))))