std.c 84.6 KB
Newer Older
Jeff Law committed
1
/* std.c -- Implementation File (module.c template V1.0)
2
   Copyright (C) 1995, 1996, 2000, 2002, 2003 Free Software Foundation, Inc.
3
   Contributed by James Craig Burley.
Jeff Law committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172

This file is part of GNU Fortran.

GNU Fortran 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, or (at your option)
any later version.

GNU Fortran 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 GNU Fortran; see the file COPYING.  If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.

   Related Modules:
      st.c

   Description:
      Implements the various statements and such like.

   Modifications:
      21-Nov-91	 JCB  2.0
	 Split out actual code generation to ffeste.
*/

/* Include files. */

#include "proj.h"
#include "std.h"
#include "bld.h"
#include "com.h"
#include "lab.h"
#include "lex.h"
#include "malloc.h"
#include "sta.h"
#include "ste.h"
#include "stp.h"
#include "str.h"
#include "sts.h"
#include "stt.h"
#include "stv.h"
#include "stw.h"
#include "symbol.h"
#include "target.h"

/* Externals defined here. */


/* Simple definitions and enumerations. */

#define FFESTD_COPY_EASY_ 1	/* 1 for only one _subr_copy_xyz_ fn. */

#define FFESTD_IS_END_OPTIMIZED_ 1	/* 0=always gen STOP/RETURN before
					   END. */

typedef enum
  {
    FFESTD_stateletSIMPLE_,	/* Expecting simple/start. */
    FFESTD_stateletATTRIB_,	/* Expecting attrib/item/itemstart. */
    FFESTD_stateletITEM_,	/* Expecting item/itemstart/finish. */
    FFESTD_stateletITEMVALS_,	/* Expecting itemvalue/itemendvals. */
    FFESTD_
  } ffestdStatelet_;

typedef enum
  {
    FFESTD_stmtidENDDOLOOP_,
    FFESTD_stmtidENDLOGIF_,
    FFESTD_stmtidEXECLABEL_,
    FFESTD_stmtidFORMATLABEL_,
    FFESTD_stmtidR737A_,	/* let */
    FFESTD_stmtidR803_,		/* IF-block */
    FFESTD_stmtidR804_,		/* ELSE IF */
    FFESTD_stmtidR805_,		/* ELSE */
    FFESTD_stmtidR806_,		/* END IF */
    FFESTD_stmtidR807_,		/* IF-logical */
    FFESTD_stmtidR809_,		/* SELECT CASE */
    FFESTD_stmtidR810_,		/* CASE */
    FFESTD_stmtidR811_,		/* END SELECT */
    FFESTD_stmtidR819A_,	/* DO-iterative */
    FFESTD_stmtidR819B_,	/* DO WHILE */
    FFESTD_stmtidR825_,		/* END DO */
    FFESTD_stmtidR834_,		/* CYCLE */
    FFESTD_stmtidR835_,		/* EXIT */
    FFESTD_stmtidR836_,		/* GOTO */
    FFESTD_stmtidR837_,		/* GOTO-computed */
    FFESTD_stmtidR838_,		/* ASSIGN */
    FFESTD_stmtidR839_,		/* GOTO-assigned */
    FFESTD_stmtidR840_,		/* IF-arithmetic */
    FFESTD_stmtidR841_,		/* CONTINUE */
    FFESTD_stmtidR842_,		/* STOP */
    FFESTD_stmtidR843_,		/* PAUSE */
    FFESTD_stmtidR904_,		/* OPEN */
    FFESTD_stmtidR907_,		/* CLOSE */
    FFESTD_stmtidR909_,		/* READ */
    FFESTD_stmtidR910_,		/* WRITE */
    FFESTD_stmtidR911_,		/* PRINT */
    FFESTD_stmtidR919_,		/* BACKSPACE */
    FFESTD_stmtidR920_,		/* ENDFILE */
    FFESTD_stmtidR921_,		/* REWIND */
    FFESTD_stmtidR923A_,	/* INQUIRE */
    FFESTD_stmtidR923B_,	/* INQUIRE-iolength */
    FFESTD_stmtidR1001_,	/* FORMAT */
    FFESTD_stmtidR1103_,	/* END_PROGRAM */
    FFESTD_stmtidR1112_,	/* END_BLOCK_DATA */
    FFESTD_stmtidR1212_,	/* CALL */
    FFESTD_stmtidR1221_,	/* END_FUNCTION */
    FFESTD_stmtidR1225_,	/* END_SUBROUTINE */
    FFESTD_stmtidR1226_,	/* ENTRY */
    FFESTD_stmtidR1227_,	/* RETURN */
    FFESTD_stmtidV020_,		/* TYPE */
    FFESTD_stmtid_,
  } ffestdStmtId_;

/* Internal typedefs. */

typedef struct _ffestd_expr_item_ *ffestdExprItem_;
typedef struct _ffestd_stmt_ *ffestdStmt_;

/* Private include files. */


/* Internal structure definitions. */

struct _ffestd_expr_item_
  {
    ffestdExprItem_ next;
    ffebld expr;
    ffelexToken token;
  };

struct _ffestd_stmt_
  {
    ffestdStmt_ next;
    ffestdStmt_ previous;
    ffestdStmtId_ id;
    char *filename;
    int filelinenum;
    union
      {
	struct
	  {
	    ffestw block;
	  }
	enddoloop;
	struct
	  {
	    ffelab label;
	  }
	execlabel;
	struct
	  {
	    ffelab label;
	  }
	formatlabel;
	struct
	  {
	    mallocPool pool;
	    ffebld dest;
	    ffebld source;
	  }
	R737A;
	struct
	  {
	    mallocPool pool;
173
	    ffestw block;
Jeff Law committed
174 175 176 177 178 179
	    ffebld expr;
	  }
	R803;
	struct
	  {
	    mallocPool pool;
180
	    ffestw block;
Jeff Law committed
181 182 183 184 185
	    ffebld expr;
	  }
	R804;
	struct
	  {
186 187 188 189 190 191 192 193 194 195
	    ffestw block;
	  }
	R805;
	struct
	  {
	    ffestw block;
	  }
	R806;
	struct
	  {
Jeff Law committed
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419
	    mallocPool pool;
	    ffebld expr;
	  }
	R807;
	struct
	  {
	    mallocPool pool;
	    ffestw block;
	    ffebld expr;
	  }
	R809;
	struct
	  {
	    mallocPool pool;
	    ffestw block;
	    unsigned long casenum;
	  }
	R810;
	struct
	  {
	    ffestw block;
	  }
	R811;
	struct
	  {
	    mallocPool pool;
	    ffestw block;
	    ffelab label;
	    ffebld var;
	    ffebld start;
	    ffelexToken start_token;
	    ffebld end;
	    ffelexToken end_token;
	    ffebld incr;
	    ffelexToken incr_token;
	  }
	R819A;
	struct
	  {
	    mallocPool pool;
	    ffestw block;
	    ffelab label;
	    ffebld expr;
	  }
	R819B;
	struct
	  {
	    ffestw block;
	  }
	R834;
	struct
	  {
	    ffestw block;
	  }
	R835;
	struct
	  {
	    ffelab label;
	  }
	R836;
	struct
	  {
	    mallocPool pool;
	    ffelab *labels;
	    int count;
	    ffebld expr;
	  }
	R837;
	struct
	  {
	    mallocPool pool;
	    ffelab label;
	    ffebld target;
	  }
	R838;
	struct
	  {
	    mallocPool pool;
	    ffebld target;
	  }
	R839;
	struct
	  {
	    mallocPool pool;
	    ffebld expr;
	    ffelab neg;
	    ffelab zero;
	    ffelab pos;
	  }
	R840;
	struct
	  {
	    mallocPool pool;
	    ffebld expr;
	  }
	R842;
	struct
	  {
	    mallocPool pool;
	    ffebld expr;
	  }
	R843;
	struct
	  {
	    mallocPool pool;
	    ffestpOpenStmt *params;
	  }
	R904;
	struct
	  {
	    mallocPool pool;
	    ffestpCloseStmt *params;
	  }
	R907;
	struct
	  {
	    mallocPool pool;
	    ffestpReadStmt *params;
	    bool only_format;
	    ffestvUnit unit;
	    ffestvFormat format;
	    bool rec;
	    bool key;
	    ffestdExprItem_ list;
	  }
	R909;
	struct
	  {
	    mallocPool pool;
	    ffestpWriteStmt *params;
	    ffestvUnit unit;
	    ffestvFormat format;
	    bool rec;
	    ffestdExprItem_ list;
	  }
	R910;
	struct
	  {
	    mallocPool pool;
	    ffestpPrintStmt *params;
	    ffestvFormat format;
	    ffestdExprItem_ list;
	  }
	R911;
	struct
	  {
	    mallocPool pool;
	    ffestpBeruStmt *params;
	  }
	R919;
	struct
	  {
	    mallocPool pool;
	    ffestpBeruStmt *params;
	  }
	R920;
	struct
	  {
	    mallocPool pool;
	    ffestpBeruStmt *params;
	  }
	R921;
	struct
	  {
	    mallocPool pool;
	    ffestpInquireStmt *params;
	    bool by_file;
	  }
	R923A;
	struct
	  {
	    mallocPool pool;
	    ffestpInquireStmt *params;
	    ffestdExprItem_ list;
	  }
	R923B;
	struct
	  {
	    ffestsHolder str;
	  }
	R1001;
	struct
	  {
	    mallocPool pool;
	    ffebld expr;
	  }
	R1212;
	struct
	  {
	    ffesymbol entry;
	    int entrynum;
	  }
	R1226;
	struct
	  {
	    mallocPool pool;
	    ffestw block;
	    ffebld expr;
	  }
	R1227;
	struct
	  {
	    mallocPool pool;
	    ffestpTypeStmt *params;
	    ffestvFormat format;
	    ffestdExprItem_ list;
	  }
	V020;
      }
    u;
  };

/* Static objects accessed by functions in this module. */

static ffestdStatelet_ ffestd_statelet_ = FFESTD_stateletSIMPLE_;
static int ffestd_block_level_ = 0;	/* Block level for reachableness. */
static bool ffestd_is_reachable_;	/* Is the current stmt reachable?  */
static ffelab ffestd_label_formatdef_ = NULL;
static ffestdExprItem_ *ffestd_expr_list_;
static struct
  {
    ffestdStmt_ first;
    ffestdStmt_ last;
  }
420
ffestd_stmt_list_ =
Jeff Law committed
421 422 423 424
{
  NULL, NULL
};

425 426 427

/* # ENTRY statements pending. */
static int ffestd_2pass_entrypoints_ = 0;
Jeff Law committed
428 429 430 431 432 433

/* Static functions (internal). */

static void ffestd_stmt_append_ (ffestdStmt_ stmt);
static ffestdStmt_ ffestd_stmt_new_ (ffestdStmtId_ id);
static void ffestd_stmt_pass_ (void);
434
#if FFESTD_COPY_EASY_
Jeff Law committed
435 436 437 438 439 440
static ffestpInquireStmt *ffestd_subr_copy_easy_ (ffestpInquireIx max);
#endif
static void ffestd_subr_vxt_ (void);
static void ffestd_subr_labels_ (bool unexpected);
static void ffestd_R1001dump_ (ffests s, ffesttFormatList list);
static void ffestd_R1001dump_1005_1_ (ffests s, ffesttFormatList f,
Kaveh R. Ghazi committed
441
				      const char *string);
Jeff Law committed
442
static void ffestd_R1001dump_1005_2_ (ffests s, ffesttFormatList f,
Kaveh R. Ghazi committed
443
				      const char *string);
Jeff Law committed
444
static void ffestd_R1001dump_1005_3_ (ffests s, ffesttFormatList f,
Kaveh R. Ghazi committed
445
				      const char *string);
Jeff Law committed
446
static void ffestd_R1001dump_1005_4_ (ffests s, ffesttFormatList f,
Kaveh R. Ghazi committed
447
				      const char *string);
Jeff Law committed
448
static void ffestd_R1001dump_1005_5_ (ffests s, ffesttFormatList f,
Kaveh R. Ghazi committed
449
				      const char *string);
Jeff Law committed
450
static void ffestd_R1001dump_1010_1_ (ffests s, ffesttFormatList f,
Kaveh R. Ghazi committed
451
				      const char *string);
Jeff Law committed
452
static void ffestd_R1001dump_1010_2_ (ffests s, ffesttFormatList f,
Kaveh R. Ghazi committed
453
				      const char *string);
Jeff Law committed
454
static void ffestd_R1001dump_1010_4_ (ffests s, ffesttFormatList f,
Kaveh R. Ghazi committed
455
				      const char *string);
Jeff Law committed
456
static void ffestd_R1001dump_1010_5_ (ffests s, ffesttFormatList f,
Kaveh R. Ghazi committed
457
				      const char *string);
Jeff Law committed
458
static void ffestd_R1001error_ (ffesttFormatList f);
459
static void ffestd_R1001rtexpr_ (ffests s, ffesttFormatList f, ffebld expr);
Jeff Law committed
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495

/* Internal macros. */

#define ffestd_subr_line_now_()					       \
  ffeste_set_line (ffelex_token_where_filename (ffesta_tokens[0]), \
		   ffelex_token_where_filelinenum (ffesta_tokens[0]))
#define ffestd_subr_line_restore_(s) \
  ffeste_set_line ((s)->filename, (s)->filelinenum)
#define ffestd_subr_line_save_(s)					   \
  ((s)->filename = ffelex_token_where_filename (ffesta_tokens[0]),	   \
   (s)->filelinenum = ffelex_token_where_filelinenum (ffesta_tokens[0]))
#define ffestd_check_simple_() \
      assert(ffestd_statelet_ == FFESTD_stateletSIMPLE_)
#define ffestd_check_start_() \
      assert(ffestd_statelet_ == FFESTD_stateletSIMPLE_); \
      ffestd_statelet_ = FFESTD_stateletATTRIB_
#define ffestd_check_attrib_() \
      assert(ffestd_statelet_ == FFESTD_stateletATTRIB_)
#define ffestd_check_item_() \
      assert(ffestd_statelet_ == FFESTD_stateletATTRIB_	 \
	    || ffestd_statelet_ == FFESTD_stateletITEM_); \
      ffestd_statelet_ = FFESTD_stateletITEM_
#define ffestd_check_item_startvals_() \
      assert(ffestd_statelet_ == FFESTD_stateletATTRIB_	 \
	    || ffestd_statelet_ == FFESTD_stateletITEM_); \
      ffestd_statelet_ = FFESTD_stateletITEMVALS_
#define ffestd_check_item_value_() \
      assert(ffestd_statelet_ == FFESTD_stateletITEMVALS_)
#define ffestd_check_item_endvals_() \
      assert(ffestd_statelet_ == FFESTD_stateletITEMVALS_); \
      ffestd_statelet_ = FFESTD_stateletITEM_
#define ffestd_check_finish_() \
      assert(ffestd_statelet_ == FFESTD_stateletATTRIB_	 \
	    || ffestd_statelet_ == FFESTD_stateletITEM_); \
      ffestd_statelet_ = FFESTD_stateletSIMPLE_

496
#if FFESTD_COPY_EASY_
Jeff Law committed
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561
#define ffestd_subr_copy_accept_() (ffestpAcceptStmt *) \
      ffestd_subr_copy_easy_((ffestpInquireIx) FFESTP_acceptix)
#define ffestd_subr_copy_beru_() (ffestpBeruStmt *) \
      ffestd_subr_copy_easy_((ffestpInquireIx) FFESTP_beruix)
#define ffestd_subr_copy_close_() (ffestpCloseStmt *) \
      ffestd_subr_copy_easy_((ffestpInquireIx) FFESTP_closeix)
#define ffestd_subr_copy_delete_() (ffestpDeleteStmt *) \
      ffestd_subr_copy_easy_((ffestpInquireIx) FFESTP_deleteix)
#define ffestd_subr_copy_find_() (ffestpFindStmt *) \
      ffestd_subr_copy_easy_((ffestpInquireIx) FFESTP_findix)
#define ffestd_subr_copy_inquire_() (ffestpInquireStmt *) \
      ffestd_subr_copy_easy_((ffestpInquireIx) FFESTP_inquireix)
#define ffestd_subr_copy_open_() (ffestpOpenStmt *) \
      ffestd_subr_copy_easy_((ffestpInquireIx) FFESTP_openix)
#define ffestd_subr_copy_print_() (ffestpPrintStmt *) \
      ffestd_subr_copy_easy_((ffestpInquireIx) FFESTP_printix)
#define ffestd_subr_copy_read_() (ffestpReadStmt *) \
      ffestd_subr_copy_easy_((ffestpInquireIx) FFESTP_readix)
#define ffestd_subr_copy_rewrite_() (ffestpRewriteStmt *) \
      ffestd_subr_copy_easy_((ffestpInquireIx) FFESTP_rewriteix)
#define ffestd_subr_copy_type_() (ffestpTypeStmt *) \
      ffestd_subr_copy_easy_((ffestpInquireIx) FFESTP_typeix)
#define ffestd_subr_copy_vxtcode_() (ffestpVxtcodeStmt *) \
      ffestd_subr_copy_easy_((ffestpInquireIx) FFESTP_vxtcodeix)
#define ffestd_subr_copy_write_() (ffestpWriteStmt *) \
      ffestd_subr_copy_easy_((ffestpInquireIx) FFESTP_writeix)
#endif

/* ffestd_stmt_append_ -- Append statement to end of stmt list

   ffestd_stmt_append_(ffestd_stmt_new_(FFESTD_stmtidR737A_));	*/

static void
ffestd_stmt_append_ (ffestdStmt_ stmt)
{
  stmt->next = (ffestdStmt_) &ffestd_stmt_list_.first;
  stmt->previous = ffestd_stmt_list_.last;
  stmt->next->previous = stmt;
  stmt->previous->next = stmt;
}

/* ffestd_stmt_new_ -- Make new statement with given id

   ffestdStmt_ stmt;
   stmt = ffestd_stmt_new_(FFESTD_stmtidR737A_);  */

static ffestdStmt_
ffestd_stmt_new_ (ffestdStmtId_ id)
{
  ffestdStmt_ stmt;

  stmt = malloc_new_kp (ffe_pool_any_unit (), "ffestdStmt_", sizeof (*stmt));
  stmt->id = id;
  return stmt;
}

/* ffestd_stmt_pass_ -- Pass all statements on list to ffeste

   ffestd_stmt_pass_();	 */

static void
ffestd_stmt_pass_ ()
{
  ffestdStmt_ stmt;
  ffestdExprItem_ expr;		/* For traversing lists. */
562
  bool okay = (TREE_CODE (current_function_decl) != ERROR_MARK);
Jeff Law committed
563

564
  if ((ffestd_2pass_entrypoints_ != 0) && okay)
Jeff Law committed
565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612
    {
      tree which = ffecom_which_entrypoint_decl ();
      tree value;
      tree label;
      int pushok;
      int ents = ffestd_2pass_entrypoints_;
      tree duplicate;

      expand_start_case (0, which, TREE_TYPE (which), "entrypoint dispatch");

      stmt = ffestd_stmt_list_.first;
      do
	{
	  while (stmt->id != FFESTD_stmtidR1226_)
	    stmt = stmt->next;

	  if (stmt->u.R1226.entry != NULL)
	    {
	      value = build_int_2 (stmt->u.R1226.entrynum, 0);
	      /* Yes, we really want to build a null LABEL_DECL here and not
		 put it on any list.  That's what pushcase wants, so that's
		 what it gets!  */
	      label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);

	      pushok = pushcase (value, convert, label, &duplicate);
	      assert (pushok == 0);

	      label = ffecom_temp_label ();
	      TREE_USED (label) = 1;
	      expand_goto (label);

	      ffesymbol_hook (stmt->u.R1226.entry).length_tree = label;
	    }
	  stmt = stmt->next;
	}
      while (--ents != 0);

      expand_end_case (which);
    }

  for (stmt = ffestd_stmt_list_.first;
       stmt != (ffestdStmt_) &ffestd_stmt_list_.first;
       stmt = stmt->next)
    {
      switch (stmt->id)
	{
	case FFESTD_stmtidENDDOLOOP_:
	  ffestd_subr_line_restore_ (stmt);
613 614
	  if (okay)
	    ffeste_do (stmt->u.enddoloop.block);
Jeff Law committed
615 616 617 618 619
	  ffestw_kill (stmt->u.enddoloop.block);
	  break;

	case FFESTD_stmtidENDLOGIF_:
	  ffestd_subr_line_restore_ (stmt);
620 621
	  if (okay)
	    ffeste_end_R807 ();
Jeff Law committed
622 623 624
	  break;

	case FFESTD_stmtidEXECLABEL_:
625 626
	  if (okay)
	    ffeste_labeldef_branch (stmt->u.execlabel.label);
Jeff Law committed
627 628 629
	  break;

	case FFESTD_stmtidFORMATLABEL_:
630 631
	  if (okay)
	    ffeste_labeldef_format (stmt->u.formatlabel.label);
Jeff Law committed
632 633 634 635
	  break;

	case FFESTD_stmtidR737A_:
	  ffestd_subr_line_restore_ (stmt);
636 637
	  if (okay)
	    ffeste_R737A (stmt->u.R737A.dest, stmt->u.R737A.source);
Jeff Law committed
638 639 640 641 642
	  malloc_pool_kill (stmt->u.R737A.pool);
	  break;

	case FFESTD_stmtidR803_:
	  ffestd_subr_line_restore_ (stmt);
643
	  if (okay)
644
	    ffeste_R803 (stmt->u.R803.block, stmt->u.R803.expr);
Jeff Law committed
645 646 647 648 649
	  malloc_pool_kill (stmt->u.R803.pool);
	  break;

	case FFESTD_stmtidR804_:
	  ffestd_subr_line_restore_ (stmt);
650
	  if (okay)
651
	    ffeste_R804 (stmt->u.R803.block, stmt->u.R804.expr);
Jeff Law committed
652 653 654 655 656
	  malloc_pool_kill (stmt->u.R804.pool);
	  break;

	case FFESTD_stmtidR805_:
	  ffestd_subr_line_restore_ (stmt);
657
	  if (okay)
658
	    ffeste_R805 (stmt->u.R803.block);
Jeff Law committed
659 660 661 662
	  break;

	case FFESTD_stmtidR806_:
	  ffestd_subr_line_restore_ (stmt);
663
	  if (okay)
664 665
	    ffeste_R806 (stmt->u.R806.block);
	  ffestw_kill (stmt->u.R806.block);
Jeff Law committed
666 667 668 669
	  break;

	case FFESTD_stmtidR807_:
	  ffestd_subr_line_restore_ (stmt);
670 671
	  if (okay)
	    ffeste_R807 (stmt->u.R807.expr);
Jeff Law committed
672 673 674 675 676
	  malloc_pool_kill (stmt->u.R807.pool);
	  break;

	case FFESTD_stmtidR809_:
	  ffestd_subr_line_restore_ (stmt);
677 678
	  if (okay)
	    ffeste_R809 (stmt->u.R809.block, stmt->u.R809.expr);
Jeff Law committed
679 680 681 682 683
	  malloc_pool_kill (stmt->u.R809.pool);
	  break;

	case FFESTD_stmtidR810_:
	  ffestd_subr_line_restore_ (stmt);
684 685
	  if (okay)
	    ffeste_R810 (stmt->u.R810.block, stmt->u.R810.casenum);
Jeff Law committed
686 687 688 689 690
	  malloc_pool_kill (stmt->u.R810.pool);
	  break;

	case FFESTD_stmtidR811_:
	  ffestd_subr_line_restore_ (stmt);
691 692
	  if (okay)
	    ffeste_R811 (stmt->u.R811.block);
Jeff Law committed
693 694 695 696 697 698
	  malloc_pool_kill (ffestw_select (stmt->u.R811.block)->pool);
	  ffestw_kill (stmt->u.R811.block);
	  break;

	case FFESTD_stmtidR819A_:
	  ffestd_subr_line_restore_ (stmt);
699 700 701 702 703 704
	  if (okay)
	    ffeste_R819A (stmt->u.R819A.block, stmt->u.R819A.label,
			  stmt->u.R819A.var,
			  stmt->u.R819A.start, stmt->u.R819A.start_token,
			  stmt->u.R819A.end, stmt->u.R819A.end_token,
			  stmt->u.R819A.incr, stmt->u.R819A.incr_token);
Jeff Law committed
705 706 707 708 709 710 711 712 713
	  ffelex_token_kill (stmt->u.R819A.start_token);
	  ffelex_token_kill (stmt->u.R819A.end_token);
	  if (stmt->u.R819A.incr_token != NULL)
	    ffelex_token_kill (stmt->u.R819A.incr_token);
	  malloc_pool_kill (stmt->u.R819A.pool);
	  break;

	case FFESTD_stmtidR819B_:
	  ffestd_subr_line_restore_ (stmt);
714 715 716
	  if (okay)
	    ffeste_R819B (stmt->u.R819B.block, stmt->u.R819B.label,
			  stmt->u.R819B.expr);
Jeff Law committed
717 718 719 720 721
	  malloc_pool_kill (stmt->u.R819B.pool);
	  break;

	case FFESTD_stmtidR825_:
	  ffestd_subr_line_restore_ (stmt);
722 723
	  if (okay)
	    ffeste_R825 ();
Jeff Law committed
724 725 726 727
	  break;

	case FFESTD_stmtidR834_:
	  ffestd_subr_line_restore_ (stmt);
728 729
	  if (okay)
	    ffeste_R834 (stmt->u.R834.block);
Jeff Law committed
730 731 732 733
	  break;

	case FFESTD_stmtidR835_:
	  ffestd_subr_line_restore_ (stmt);
734 735
	  if (okay)
	    ffeste_R835 (stmt->u.R835.block);
Jeff Law committed
736 737 738 739
	  break;

	case FFESTD_stmtidR836_:
	  ffestd_subr_line_restore_ (stmt);
740 741
	  if (okay)
	    ffeste_R836 (stmt->u.R836.label);
Jeff Law committed
742 743 744 745
	  break;

	case FFESTD_stmtidR837_:
	  ffestd_subr_line_restore_ (stmt);
746 747 748
	  if (okay)
	    ffeste_R837 (stmt->u.R837.labels, stmt->u.R837.count,
			 stmt->u.R837.expr);
Jeff Law committed
749 750 751 752 753
	  malloc_pool_kill (stmt->u.R837.pool);
	  break;

	case FFESTD_stmtidR838_:
	  ffestd_subr_line_restore_ (stmt);
754 755
	  if (okay)
	    ffeste_R838 (stmt->u.R838.label, stmt->u.R838.target);
Jeff Law committed
756 757 758 759 760
	  malloc_pool_kill (stmt->u.R838.pool);
	  break;

	case FFESTD_stmtidR839_:
	  ffestd_subr_line_restore_ (stmt);
761 762
	  if (okay)
	    ffeste_R839 (stmt->u.R839.target);
Jeff Law committed
763 764 765 766 767
	  malloc_pool_kill (stmt->u.R839.pool);
	  break;

	case FFESTD_stmtidR840_:
	  ffestd_subr_line_restore_ (stmt);
768 769 770
	  if (okay)
	    ffeste_R840 (stmt->u.R840.expr, stmt->u.R840.neg, stmt->u.R840.zero,
			 stmt->u.R840.pos);
Jeff Law committed
771 772 773 774 775
	  malloc_pool_kill (stmt->u.R840.pool);
	  break;

	case FFESTD_stmtidR841_:
	  ffestd_subr_line_restore_ (stmt);
776 777
	  if (okay)
	    ffeste_R841 ();
Jeff Law committed
778 779 780 781
	  break;

	case FFESTD_stmtidR842_:
	  ffestd_subr_line_restore_ (stmt);
782 783 784 785
	  if (okay)
	    ffeste_R842 (stmt->u.R842.expr);
	  if (stmt->u.R842.pool != NULL)
	    malloc_pool_kill (stmt->u.R842.pool);
Jeff Law committed
786 787 788 789
	  break;

	case FFESTD_stmtidR843_:
	  ffestd_subr_line_restore_ (stmt);
790 791
	  if (okay)
	    ffeste_R843 (stmt->u.R843.expr);
Jeff Law committed
792 793 794 795 796
	  malloc_pool_kill (stmt->u.R843.pool);
	  break;

	case FFESTD_stmtidR904_:
	  ffestd_subr_line_restore_ (stmt);
797 798
	  if (okay)
	    ffeste_R904 (stmt->u.R904.params);
Jeff Law committed
799 800 801 802 803
	  malloc_pool_kill (stmt->u.R904.pool);
	  break;

	case FFESTD_stmtidR907_:
	  ffestd_subr_line_restore_ (stmt);
804 805
	  if (okay)
	    ffeste_R907 (stmt->u.R907.params);
Jeff Law committed
806 807 808 809 810
	  malloc_pool_kill (stmt->u.R907.pool);
	  break;

	case FFESTD_stmtidR909_:
	  ffestd_subr_line_restore_ (stmt);
811 812 813 814
	  if (okay)
	    ffeste_R909_start (stmt->u.R909.params, stmt->u.R909.only_format,
			       stmt->u.R909.unit, stmt->u.R909.format,
			       stmt->u.R909.rec, stmt->u.R909.key);
Jeff Law committed
815 816
	  for (expr = stmt->u.R909.list; expr != NULL; expr = expr->next)
	    {
817 818
	      if (okay)
		ffeste_R909_item (expr->expr, expr->token);
Jeff Law committed
819 820
	      ffelex_token_kill (expr->token);
	    }
821 822
	  if (okay)
	    ffeste_R909_finish ();
Jeff Law committed
823 824 825 826 827
	  malloc_pool_kill (stmt->u.R909.pool);
	  break;

	case FFESTD_stmtidR910_:
	  ffestd_subr_line_restore_ (stmt);
828 829 830
	  if (okay)
	    ffeste_R910_start (stmt->u.R910.params, stmt->u.R910.unit,
			       stmt->u.R910.format, stmt->u.R910.rec);
Jeff Law committed
831 832
	  for (expr = stmt->u.R910.list; expr != NULL; expr = expr->next)
	    {
833 834
	      if (okay)
		ffeste_R910_item (expr->expr, expr->token);
Jeff Law committed
835 836
	      ffelex_token_kill (expr->token);
	    }
837 838
	  if (okay)
	    ffeste_R910_finish ();
Jeff Law committed
839 840 841 842 843
	  malloc_pool_kill (stmt->u.R910.pool);
	  break;

	case FFESTD_stmtidR911_:
	  ffestd_subr_line_restore_ (stmt);
844 845
	  if (okay)
	    ffeste_R911_start (stmt->u.R911.params, stmt->u.R911.format);
Jeff Law committed
846 847
	  for (expr = stmt->u.R911.list; expr != NULL; expr = expr->next)
	    {
848 849
	      if (okay)
		ffeste_R911_item (expr->expr, expr->token);
Jeff Law committed
850 851
	      ffelex_token_kill (expr->token);
	    }
852 853
	  if (okay)
	    ffeste_R911_finish ();
Jeff Law committed
854 855 856 857 858
	  malloc_pool_kill (stmt->u.R911.pool);
	  break;

	case FFESTD_stmtidR919_:
	  ffestd_subr_line_restore_ (stmt);
859 860
	  if (okay)
	    ffeste_R919 (stmt->u.R919.params);
Jeff Law committed
861 862 863 864 865
	  malloc_pool_kill (stmt->u.R919.pool);
	  break;

	case FFESTD_stmtidR920_:
	  ffestd_subr_line_restore_ (stmt);
866 867
	  if (okay)
	    ffeste_R920 (stmt->u.R920.params);
Jeff Law committed
868 869 870 871 872
	  malloc_pool_kill (stmt->u.R920.pool);
	  break;

	case FFESTD_stmtidR921_:
	  ffestd_subr_line_restore_ (stmt);
873 874
	  if (okay)
	    ffeste_R921 (stmt->u.R921.params);
Jeff Law committed
875 876 877 878 879
	  malloc_pool_kill (stmt->u.R921.pool);
	  break;

	case FFESTD_stmtidR923A_:
	  ffestd_subr_line_restore_ (stmt);
880 881
	  if (okay)
	    ffeste_R923A (stmt->u.R923A.params, stmt->u.R923A.by_file);
Jeff Law committed
882 883 884 885 886
	  malloc_pool_kill (stmt->u.R923A.pool);
	  break;

	case FFESTD_stmtidR923B_:
	  ffestd_subr_line_restore_ (stmt);
887 888
	  if (okay)
	    ffeste_R923B_start (stmt->u.R923B.params);
Jeff Law committed
889
	  for (expr = stmt->u.R923B.list; expr != NULL; expr = expr->next)
890 891 892 893 894 895
	    {
	      if (okay)
		ffeste_R923B_item (expr->expr);
	    }
	  if (okay)
	    ffeste_R923B_finish ();
Jeff Law committed
896 897 898 899
	  malloc_pool_kill (stmt->u.R923B.pool);
	  break;

	case FFESTD_stmtidR1001_:
900 901
	  if (okay)
	    ffeste_R1001 (&stmt->u.R1001.str);
Jeff Law committed
902 903 904 905
	  ffests_kill (&stmt->u.R1001.str);
	  break;

	case FFESTD_stmtidR1103_:
906 907
	  if (okay)
	    ffeste_R1103 ();
Jeff Law committed
908 909 910
	  break;

	case FFESTD_stmtidR1112_:
911 912
	  if (okay)
	    ffeste_R1112 ();
Jeff Law committed
913 914 915 916
	  break;

	case FFESTD_stmtidR1212_:
	  ffestd_subr_line_restore_ (stmt);
917 918
	  if (okay)
	    ffeste_R1212 (stmt->u.R1212.expr);
Jeff Law committed
919 920 921 922
	  malloc_pool_kill (stmt->u.R1212.pool);
	  break;

	case FFESTD_stmtidR1221_:
923 924
	  if (okay)
	    ffeste_R1221 ();
Jeff Law committed
925 926 927
	  break;

	case FFESTD_stmtidR1225_:
928 929
	  if (okay)
	    ffeste_R1225 ();
Jeff Law committed
930 931 932 933 934
	  break;

	case FFESTD_stmtidR1226_:
	  ffestd_subr_line_restore_ (stmt);
	  if (stmt->u.R1226.entry != NULL)
935 936 937 938
	    {
	      if (okay)
		ffeste_R1226 (stmt->u.R1226.entry);
	    }
Jeff Law committed
939 940 941 942
	  break;

	case FFESTD_stmtidR1227_:
	  ffestd_subr_line_restore_ (stmt);
943 944
	  if (okay)
	    ffeste_R1227 (stmt->u.R1227.block, stmt->u.R1227.expr);
Jeff Law committed
945 946 947 948 949
	  malloc_pool_kill (stmt->u.R1227.pool);
	  break;

	case FFESTD_stmtidV020_:
	  ffestd_subr_line_restore_ (stmt);
950 951
	  if (okay)
	    ffeste_V020_start (stmt->u.V020.params, stmt->u.V020.format);
Jeff Law committed
952
	  for (expr = stmt->u.V020.list; expr != NULL; expr = expr->next)
953 954 955 956 957 958
	    {
	      if (okay)
		ffeste_V020_item (expr->expr);
	    }
	  if (okay)
	    ffeste_V020_finish ();
Jeff Law committed
959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979
	  malloc_pool_kill (stmt->u.V020.pool);
	  break;

	default:
	  assert ("bad stmt->id" == NULL);
	  break;
	}
    }
}

/* ffestd_subr_copy_easy_ -- Copy I/O statement data structure

   ffestd_subr_copy_easy_();

   Copies all data except tokens in the I/O data structure into a new
   structure that lasts as long as the output pool for the current
   statement.  Assumes that they are
   overlaid with each other (union) in stp.h and the typing
   and structure references assume (though not necessarily dangerous if
   FALSE) that INQUIRE has the most file elements.  */

980
#if FFESTD_COPY_EASY_
Jeff Law committed
981 982 983 984 985 986 987 988 989 990 991 992 993 994 995
static ffestpInquireStmt *
ffestd_subr_copy_easy_ (ffestpInquireIx max)
{
  ffestpInquireStmt *stmt;
  ffestpInquireIx ix;

  stmt = (ffestpInquireStmt *) malloc_new_kp (ffesta_output_pool,
				  "FFESTD easy", sizeof (ffestpFile) * max);

  for (ix = 0; ix < max; ++ix)
    {
      if ((stmt->inquire_spec[ix].kw_or_val_present
	   = ffestp_file.inquire.inquire_spec[ix].kw_or_val_present)
	  && (stmt->inquire_spec[ix].value_present
	      = ffestp_file.inquire.inquire_spec[ix].value_present))
996 997 998 999 1000 1001 1002 1003 1004
	{
	  if ((stmt->inquire_spec[ix].value_is_label
	       = ffestp_file.inquire.inquire_spec[ix].value_is_label))
	    stmt->inquire_spec[ix].u.label
	      = ffestp_file.inquire.inquire_spec[ix].u.label;
	  else
	    stmt->inquire_spec[ix].u.expr
	      = ffestp_file.inquire.inquire_spec[ix].u.expr;
	}
Jeff Law committed
1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140
    }

  return stmt;
}

#endif
/* ffestd_subr_labels_ -- Handle any undefined labels

   ffestd_subr_labels_(FALSE);

   For every undefined label, generate an error message and either define
   label as a FORMAT() statement (for FORMAT labels) or as a STOP statement
   (for all other labels).  */

static void
ffestd_subr_labels_ (bool unexpected)
{
  ffelab l;
  ffelabHandle h;
  ffelabNumber undef;
  ffesttFormatList f;

  undef = ffelab_number () - ffestv_num_label_defines_;

  for (h = ffelab_handle_first (); h != NULL; h = ffelab_handle_next (h))
    {
      l = ffelab_handle_target (h);
      if (ffewhere_line_is_unknown (ffelab_definition_line (l)))
	{			/* Undefined label. */
	  assert (!unexpected);
	  assert (undef > 0);
	  undef--;
	  ffebad_start (FFEBAD_UNDEF_LABEL);
	  if (ffelab_type (l) == FFELAB_typeLOOPEND)
	    ffebad_here (0, ffelab_doref_line (l), ffelab_doref_column (l));
	  else if (ffelab_type (l) != FFELAB_typeANY)
	    ffebad_here (0, ffelab_firstref_line (l), ffelab_firstref_column (l));
	  else if (!ffewhere_line_is_unknown (ffelab_firstref_line (l)))
	    ffebad_here (0, ffelab_firstref_line (l), ffelab_firstref_column (l));
	  else if (!ffewhere_line_is_unknown (ffelab_doref_line (l)))
	    ffebad_here (0, ffelab_doref_line (l), ffelab_doref_column (l));
	  else
	    ffebad_here (0, ffelab_definition_line (l), ffelab_definition_column (l));
	  ffebad_finish ();

	  switch (ffelab_type (l))
	    {
	    case FFELAB_typeFORMAT:
	      ffelab_set_definition_line (l,
			      ffewhere_line_use (ffelab_firstref_line (l)));
	      ffelab_set_definition_column (l,
			  ffewhere_column_use (ffelab_firstref_column (l)));
	      ffestv_num_label_defines_++;
	      f = ffestt_formatlist_create (NULL, NULL);
	      ffestd_labeldef_format (l);
	      ffestd_R1001 (f);
	      ffestt_formatlist_kill (f);
	      break;

	    case FFELAB_typeASSIGNABLE:
	      ffelab_set_definition_line (l,
			      ffewhere_line_use (ffelab_firstref_line (l)));
	      ffelab_set_definition_column (l,
			  ffewhere_column_use (ffelab_firstref_column (l)));
	      ffestv_num_label_defines_++;
	      ffelab_set_type (l, FFELAB_typeNOTLOOP);
	      ffelab_set_blocknum (l, ffestw_blocknum (ffestw_stack_top ()));
	      ffestd_labeldef_notloop (l);
	      ffestd_R842 (NULL);
	      break;

	    case FFELAB_typeNOTLOOP:
	      ffelab_set_definition_line (l,
			      ffewhere_line_use (ffelab_firstref_line (l)));
	      ffelab_set_definition_column (l,
			  ffewhere_column_use (ffelab_firstref_column (l)));
	      ffestv_num_label_defines_++;
	      ffelab_set_blocknum (l, ffestw_blocknum (ffestw_stack_top ()));
	      ffestd_labeldef_notloop (l);
	      ffestd_R842 (NULL);
	      break;

	    default:
	      assert ("bad label type" == NULL);
	      /* Fall through. */
	    case FFELAB_typeUNKNOWN:
	    case FFELAB_typeANY:
	      break;
	    }
	}
    }
  ffelab_handle_done (h);
  assert (undef == 0);
}

/* ffestd_subr_vxt_ -- Report error about lack of full VXT support

   ffestd_subr_vxt_();	*/

static void
ffestd_subr_vxt_ ()
{
  ffebad_start (FFEBAD_VXT_UNSUPPORTED);
  ffebad_here (0, ffelex_token_where_line (ffesta_tokens[0]),
	       ffelex_token_where_column (ffesta_tokens[0]));
  ffebad_finish ();
}

/* ffestd_begin_uses -- Start a bunch of USE statements

   ffestd_begin_uses();

   Invoked before handling the first USE statement in a block of one or
   more USE statements.	 _end_uses_(bool ok) is invoked before handling
   the first statement after the block (there are no BEGIN USE and END USE
   statements, but the semantics of USE statements effectively requires
   handling them as a single block rather than one statement at a time).  */

void
ffestd_begin_uses ()
{
}

/* ffestd_do -- End of statement following DO-term-stmt etc

   ffestd_do(TRUE);

   Also invoked by _labeldef_branch_finish_ (or, in cases
   of errors, other _labeldef_ functions) when the label definition is
   for a DO-target (LOOPEND) label, once per matching/outstanding DO
   block on the stack.	These cases invoke this function with ok==TRUE, so
   only forced stack popping (via ffestd_eof_()) invokes it with ok==FALSE.  */

void
ffestd_do (bool ok UNUSED)
{
1141
  ffestdStmt_ stmt;
Jeff Law committed
1142

1143 1144 1145 1146
  stmt = ffestd_stmt_new_ (FFESTD_stmtidENDDOLOOP_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.enddoloop.block = ffestw_stack_top ();
Jeff Law committed
1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164

  --ffestd_block_level_;
  assert (ffestd_block_level_ >= 0);
}

/* ffestd_end_R807 -- End of statement following logical IF

   ffestd_end_R807(TRUE);

   Applies ONLY to logical IF, not to IF-THEN.	For example, does not
   ffelex_token_kill the construct name for an IF-THEN block (the name
   field is invalid for logical IF).  ok==TRUE iff statement following
   logical IF (substatement) is valid; else, statement is invalid or
   stack forcibly popped due to ffestd_eof_().	*/

void
ffestd_end_R807 (bool ok UNUSED)
{
1165
  ffestdStmt_ stmt;
Jeff Law committed
1166

1167 1168 1169
  stmt = ffestd_stmt_new_ (FFESTD_stmtidENDLOGIF_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
Jeff Law committed
1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213

  --ffestd_block_level_;
  assert (ffestd_block_level_ >= 0);
}

/* ffestd_exec_begin -- Executable statements can start coming in now

   ffestd_exec_begin();	 */

void
ffestd_exec_begin ()
{
  ffecom_exec_transition ();

  if (ffestd_2pass_entrypoints_ != 0)
    {				/* Process pending ENTRY statements now that
				   info filled in. */
      ffestdStmt_ stmt;
      int ents = ffestd_2pass_entrypoints_;

      stmt = ffestd_stmt_list_.first;
      do
	{
	  while (stmt->id != FFESTD_stmtidR1226_)
	    stmt = stmt->next;

	  if (!ffecom_2pass_advise_entrypoint (stmt->u.R1226.entry))
	    {
	      stmt->u.R1226.entry = NULL;
	      --ffestd_2pass_entrypoints_;
	    }
	  stmt = stmt->next;
	}
      while (--ents != 0);
    }
}

/* ffestd_exec_end -- Executable statements can no longer come in now

   ffestd_exec_end();  */

void
ffestd_exec_end ()
{
1214
  location_t old_loc = input_location;
Jeff Law committed
1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245

  ffecom_end_transition ();

  ffestd_stmt_pass_ ();

  ffecom_finish_progunit ();

  if (ffestd_2pass_entrypoints_ != 0)
    {
      int ents = ffestd_2pass_entrypoints_;
      ffestdStmt_ stmt = ffestd_stmt_list_.first;

      do
	{
	  while (stmt->id != FFESTD_stmtidR1226_)
	    stmt = stmt->next;

	  if (stmt->u.R1226.entry != NULL)
	    {
	      ffestd_subr_line_restore_ (stmt);
	      ffecom_2pass_do_entrypoint (stmt->u.R1226.entry);
	    }
	  stmt = stmt->next;
	}
      while (--ents != 0);
    }

  ffestd_stmt_list_.first = NULL;
  ffestd_stmt_list_.last = NULL;
  ffestd_2pass_entrypoints_ = 0;

1246
  input_location = old_loc;
Jeff Law committed
1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273
}

/* ffestd_init_3 -- Initialize for any program unit

   ffestd_init_3();  */

void
ffestd_init_3 ()
{
  ffestd_stmt_list_.first = (ffestdStmt_) &ffestd_stmt_list_.first;
  ffestd_stmt_list_.last = (ffestdStmt_) &ffestd_stmt_list_.first;
}

/* Generate "code" for "any" label def.  */

void
ffestd_labeldef_any (ffelab label UNUSED)
{
}

/* ffestd_labeldef_branch -- Generate "code" for branch label def

   ffestd_labeldef_branch(label);  */

void
ffestd_labeldef_branch (ffelab label)
{
1274
  ffestdStmt_ stmt;
Jeff Law committed
1275

1276 1277 1278
  stmt = ffestd_stmt_new_ (FFESTD_stmtidEXECLABEL_);
  ffestd_stmt_append_ (stmt);
  stmt->u.execlabel.label = label;
Jeff Law committed
1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289

  ffestd_is_reachable_ = TRUE;
}

/* ffestd_labeldef_format -- Generate "code" for FORMAT label def

   ffestd_labeldef_format(label);  */

void
ffestd_labeldef_format (ffelab label)
{
1290
  ffestdStmt_ stmt;
Jeff Law committed
1291

1292 1293
  ffestd_label_formatdef_ = label;

1294 1295 1296
  stmt = ffestd_stmt_new_ (FFESTD_stmtidFORMATLABEL_);
  ffestd_stmt_append_ (stmt);
  stmt->u.formatlabel.label = label;
Jeff Law committed
1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307
}

/* ffestd_labeldef_useless -- Generate "code" for useless label def

   ffestd_labeldef_useless(label);  */

void
ffestd_labeldef_useless (ffelab label UNUSED)
{
}

1308 1309 1310
/* ffestd_R522 -- SAVE statement with no list

   ffestd_R522();
Jeff Law committed
1311

1312
   Verify that SAVE is valid here, and flag everything as SAVEd.  */
Jeff Law committed
1313 1314

void
1315
ffestd_R522 ()
Jeff Law committed
1316 1317 1318 1319
{
  ffestd_check_simple_ ();
}

1320 1321 1322
/* ffestd_R522start -- SAVE statement list begin

   ffestd_R522start();
Jeff Law committed
1323

1324
   Verify that SAVE is valid here, and begin accepting items in the list.  */
Jeff Law committed
1325 1326

void
1327
ffestd_R522start ()
Jeff Law committed
1328
{
1329
  ffestd_check_start_ ();
Jeff Law committed
1330 1331
}

1332
/* ffestd_R522item_object -- SAVE statement for object-name
Jeff Law committed
1333

1334
   ffestd_R522item_object(name_token);
Jeff Law committed
1335

1336
   Make sure name_token identifies a valid object to be SAVEd.	*/
Jeff Law committed
1337 1338

void
1339
ffestd_R522item_object (ffelexToken name UNUSED)
Jeff Law committed
1340
{
1341 1342
  ffestd_check_item_ ();
}
Jeff Law committed
1343

1344
/* ffestd_R522item_cblock -- SAVE statement for common-block-name
Jeff Law committed
1345

1346
   ffestd_R522item_cblock(name_token);
Jeff Law committed
1347

1348
   Make sure name_token identifies a valid common block to be SAVEd.  */
Jeff Law committed
1349

1350 1351 1352 1353
void
ffestd_R522item_cblock (ffelexToken name UNUSED)
{
  ffestd_check_item_ ();
Jeff Law committed
1354 1355
}

1356 1357 1358
/* ffestd_R522finish -- SAVE statement list complete

   ffestd_R522finish();
Jeff Law committed
1359

1360
   Just wrap up any local activities.  */
Jeff Law committed
1361 1362

void
1363
ffestd_R522finish ()
Jeff Law committed
1364
{
1365
  ffestd_check_finish_ ();
Jeff Law committed
1366 1367
}

1368
/* ffestd_R524_start -- DIMENSION statement list begin
Jeff Law committed
1369

1370
   ffestd_R524_start(bool virtual);
Jeff Law committed
1371

1372
   Verify that DIMENSION is valid here, and begin accepting items in the list.	*/
Jeff Law committed
1373 1374

void
1375
ffestd_R524_start (bool virtual UNUSED)
Jeff Law committed
1376 1377 1378 1379
{
  ffestd_check_start_ ();
}

1380
/* ffestd_R524_item -- DIMENSION statement for object-name
Jeff Law committed
1381

1382
   ffestd_R524_item(name_token,dim_list);
Jeff Law committed
1383

1384
   Make sure name_token identifies a valid object to be DIMENSIONd.  */
Jeff Law committed
1385 1386

void
1387
ffestd_R524_item (ffelexToken name UNUSED, ffesttDimList dims UNUSED)
Jeff Law committed
1388 1389 1390 1391
{
  ffestd_check_item_ ();
}

1392
/* ffestd_R524_finish -- DIMENSION statement list complete
Jeff Law committed
1393

1394
   ffestd_R524_finish();
Jeff Law committed
1395 1396 1397 1398

   Just wrap up any local activities.  */

void
1399
ffestd_R524_finish ()
Jeff Law committed
1400 1401 1402 1403
{
  ffestd_check_finish_ ();
}

1404
/* ffestd_R537_start -- PARAMETER statement list begin
Jeff Law committed
1405

1406
   ffestd_R537_start();
Jeff Law committed
1407

1408
   Verify that PARAMETER is valid here, and begin accepting items in the list.	*/
Jeff Law committed
1409 1410

void
1411
ffestd_R537_start ()
Jeff Law committed
1412 1413 1414 1415
{
  ffestd_check_start_ ();
}

1416
/* ffestd_R537_item -- PARAMETER statement assignment
Jeff Law committed
1417

1418
   ffestd_R537_item(dest,dest_token,source,source_token);
Jeff Law committed
1419

1420 1421
   Make sure the source is a valid source for the destination; make the
   assignment.	*/
Jeff Law committed
1422 1423

void
1424
ffestd_R537_item (ffebld dest UNUSED, ffebld source UNUSED)
Jeff Law committed
1425 1426 1427 1428
{
  ffestd_check_item_ ();
}

1429
/* ffestd_R537_finish -- PARAMETER statement list complete
Jeff Law committed
1430

1431
   ffestd_R537_finish();
Jeff Law committed
1432 1433 1434 1435

   Just wrap up any local activities.  */

void
1436
ffestd_R537_finish ()
Jeff Law committed
1437 1438 1439 1440
{
  ffestd_check_finish_ ();
}

1441
/* ffestd_R539 -- IMPLICIT NONE statement
Jeff Law committed
1442

1443
   ffestd_R539();
Jeff Law committed
1444

1445
   Verify that the IMPLICIT NONE statement is ok here and implement.  */
Jeff Law committed
1446 1447

void
1448
ffestd_R539 ()
Jeff Law committed
1449 1450 1451 1452
{
  ffestd_check_simple_ ();
}

1453
/* ffestd_R539start -- IMPLICIT statement
Jeff Law committed
1454

1455
   ffestd_R539start();
Jeff Law committed
1456

1457
   Verify that the IMPLICIT statement is ok here and implement.	 */
Jeff Law committed
1458 1459

void
1460
ffestd_R539start ()
Jeff Law committed
1461 1462 1463 1464
{
  ffestd_check_start_ ();
}

1465
/* ffestd_R539item -- IMPLICIT statement specification (R540)
Jeff Law committed
1466

1467
   ffestd_R539item(...);
Jeff Law committed
1468

1469
   Verify that the type and letter list are all ok and implement.  */
Jeff Law committed
1470 1471

void
1472 1473 1474
ffestd_R539item (ffestpType type UNUSED, ffebld kind UNUSED,
		 ffelexToken kindt UNUSED, ffebld len UNUSED,
		 ffelexToken lent UNUSED, ffesttImpList letters UNUSED)
Jeff Law committed
1475 1476 1477 1478
{
  ffestd_check_item_ ();
}

1479
/* ffestd_R539finish -- IMPLICIT statement
Jeff Law committed
1480

1481
   ffestd_R539finish();
Jeff Law committed
1482

1483
   Finish up any local activities.  */
Jeff Law committed
1484 1485

void
1486
ffestd_R539finish ()
Jeff Law committed
1487 1488 1489 1490
{
  ffestd_check_finish_ ();
}

1491
/* ffestd_R542_start -- NAMELIST statement list begin
Jeff Law committed
1492

1493
   ffestd_R542_start();
Jeff Law committed
1494

1495
   Verify that NAMELIST is valid here, and begin accepting items in the list.  */
Jeff Law committed
1496 1497

void
1498
ffestd_R542_start ()
Jeff Law committed
1499
{
1500
  ffestd_check_start_ ();
Jeff Law committed
1501 1502
}

1503
/* ffestd_R542_item_nlist -- NAMELIST statement for group-name
Jeff Law committed
1504

1505
   ffestd_R542_item_nlist(groupname_token);
Jeff Law committed
1506

1507
   Make sure name_token identifies a valid object to be NAMELISTd.  */
Jeff Law committed
1508 1509

void
1510
ffestd_R542_item_nlist (ffelexToken name UNUSED)
Jeff Law committed
1511
{
1512
  ffestd_check_item_ ();
Jeff Law committed
1513 1514
}

1515
/* ffestd_R542_item_nitem -- NAMELIST statement for variable-name
Jeff Law committed
1516

1517
   ffestd_R542_item_nitem(name_token);
Jeff Law committed
1518

1519
   Make sure name_token identifies a valid object to be NAMELISTd.  */
Jeff Law committed
1520 1521

void
1522
ffestd_R542_item_nitem (ffelexToken name UNUSED)
Jeff Law committed
1523 1524 1525 1526
{
  ffestd_check_item_ ();
}

1527
/* ffestd_R542_finish -- NAMELIST statement list complete
Jeff Law committed
1528

1529
   ffestd_R542_finish();
Jeff Law committed
1530 1531 1532 1533

   Just wrap up any local activities.  */

void
1534
ffestd_R542_finish ()
Jeff Law committed
1535 1536 1537 1538
{
  ffestd_check_finish_ ();
}

1539
/* ffestd_R547_start -- COMMON statement list begin
Jeff Law committed
1540

1541
   ffestd_R547_start();
Jeff Law committed
1542

1543
   Verify that COMMON is valid here, and begin accepting items in the list.  */
Jeff Law committed
1544 1545

void
1546
ffestd_R547_start ()
Jeff Law committed
1547 1548 1549 1550
{
  ffestd_check_start_ ();
}

1551
/* ffestd_R547_item_object -- COMMON statement for object-name
Jeff Law committed
1552

1553
   ffestd_R547_item_object(name_token,dim_list);
Jeff Law committed
1554

1555
   Make sure name_token identifies a valid object to be COMMONd.  */
Jeff Law committed
1556 1557

void
1558 1559
ffestd_R547_item_object (ffelexToken name UNUSED,
			 ffesttDimList dims UNUSED)
Jeff Law committed
1560 1561 1562 1563
{
  ffestd_check_item_ ();
}

1564
/* ffestd_R547_item_cblock -- COMMON statement for common-block-name
Jeff Law committed
1565

1566
   ffestd_R547_item_cblock(name_token);
Jeff Law committed
1567

1568
   Make sure name_token identifies a valid common block to be COMMONd.	*/
Jeff Law committed
1569 1570

void
1571
ffestd_R547_item_cblock (ffelexToken name UNUSED)
Jeff Law committed
1572 1573 1574 1575
{
  ffestd_check_item_ ();
}

1576
/* ffestd_R547_finish -- COMMON statement list complete
Jeff Law committed
1577

1578
   ffestd_R547_finish();
Jeff Law committed
1579 1580 1581 1582

   Just wrap up any local activities.  */

void
1583
ffestd_R547_finish ()
Jeff Law committed
1584 1585 1586 1587
{
  ffestd_check_finish_ ();
}

1588
/* ffestd_R737A -- Assignment statement outside of WHERE
Jeff Law committed
1589

1590
   ffestd_R737A(dest_expr,source_expr);	 */
Jeff Law committed
1591 1592

void
1593
ffestd_R737A (ffebld dest, ffebld source)
Jeff Law committed
1594
{
1595
  ffestdStmt_ stmt;
Jeff Law committed
1596

1597
  ffestd_check_simple_ ();
Jeff Law committed
1598

1599 1600 1601 1602 1603 1604 1605 1606
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR737A_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R737A.pool = ffesta_output_pool;
  stmt->u.R737A.dest = dest;
  stmt->u.R737A.source = source;
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
}
Jeff Law committed
1607

1608 1609

/* Block IF (IF-THEN) statement.  */
Jeff Law committed
1610 1611

void
1612
ffestd_R803 (ffelexToken construct_name UNUSED, ffebld expr)
Jeff Law committed
1613
{
1614
  ffestdStmt_ stmt;
Jeff Law committed
1615

1616
  ffestd_check_simple_ ();
Jeff Law committed
1617

1618 1619 1620 1621 1622 1623 1624
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR803_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R803.pool = ffesta_output_pool;
  stmt->u.R803.block = ffestw_use (ffestw_stack_top ());
  stmt->u.R803.expr = expr;
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
1625

1626 1627 1628 1629 1630
  ++ffestd_block_level_;
  assert (ffestd_block_level_ > 0);
}

/* ELSE IF statement.  */
Jeff Law committed
1631 1632

void
1633
ffestd_R804 (ffebld expr, ffelexToken name UNUSED)
Jeff Law committed
1634
{
1635
  ffestdStmt_ stmt;
Jeff Law committed
1636

1637
  ffestd_check_simple_ ();
Jeff Law committed
1638

1639 1640 1641 1642 1643 1644 1645 1646
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR804_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R804.pool = ffesta_output_pool;
  stmt->u.R804.block = ffestw_use (ffestw_stack_top ());
  stmt->u.R804.expr = expr;
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
}
Jeff Law committed
1647

1648
/* ELSE statement.  */
Jeff Law committed
1649 1650

void
1651
ffestd_R805 (ffelexToken name UNUSED)
Jeff Law committed
1652
{
1653
  ffestdStmt_ stmt;
Jeff Law committed
1654

1655
  ffestd_check_simple_ ();
Jeff Law committed
1656

1657 1658 1659 1660
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR805_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R805.block = ffestw_use (ffestw_stack_top ());
Jeff Law committed
1661 1662
}

1663
/* END IF statement.  */
Jeff Law committed
1664 1665

void
1666
ffestd_R806 (bool ok UNUSED)
Jeff Law committed
1667
{
1668
  ffestdStmt_ stmt;
Jeff Law committed
1669

1670 1671 1672 1673
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR806_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R806.block = ffestw_use (ffestw_stack_top ());
Jeff Law committed
1674

1675 1676
  --ffestd_block_level_;
  assert (ffestd_block_level_ >= 0);
Jeff Law committed
1677 1678
}

1679
/* ffestd_R807 -- Logical IF statement
Jeff Law committed
1680

1681
   ffestd_R807(expr,expr_token);
Jeff Law committed
1682

1683
   Make sure statement is valid here; implement.  */
Jeff Law committed
1684 1685

void
1686
ffestd_R807 (ffebld expr)
Jeff Law committed
1687
{
1688
  ffestdStmt_ stmt;
Jeff Law committed
1689

1690
  ffestd_check_simple_ ();
Jeff Law committed
1691

1692 1693 1694 1695 1696 1697 1698 1699 1700
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR807_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R807.pool = ffesta_output_pool;
  stmt->u.R807.expr = expr;
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);

  ++ffestd_block_level_;
  assert (ffestd_block_level_ > 0);
Jeff Law committed
1701 1702
}

1703
/* ffestd_R809 -- SELECT CASE statement
Jeff Law committed
1704

1705
   ffestd_R809(construct_name,expr,expr_token);
Jeff Law committed
1706

1707
   Make sure statement is valid here; implement.  */
Jeff Law committed
1708 1709

void
1710
ffestd_R809 (ffelexToken construct_name UNUSED, ffebld expr)
Jeff Law committed
1711
{
1712
  ffestdStmt_ stmt;
Jeff Law committed
1713

1714
  ffestd_check_simple_ ();
Jeff Law committed
1715

1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR809_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R809.pool = ffesta_output_pool;
  stmt->u.R809.block = ffestw_use (ffestw_stack_top ());
  stmt->u.R809.expr = expr;
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
  malloc_pool_use (ffestw_select (ffestw_stack_top ())->pool);

  ++ffestd_block_level_;
  assert (ffestd_block_level_ > 0);
Jeff Law committed
1727 1728
}

1729
/* ffestd_R810 -- CASE statement
Jeff Law committed
1730

1731
   ffestd_R810(case_value_range_list,name);
Jeff Law committed
1732

1733 1734 1735
   If casenum is 0, it's CASE DEFAULT.	Else it's the case ranges at
   the start of the first_stmt list in the select object at the top of
   the stack that match casenum.  */
Jeff Law committed
1736 1737

void
1738
ffestd_R810 (unsigned long casenum)
Jeff Law committed
1739
{
1740
  ffestdStmt_ stmt;
Jeff Law committed
1741

1742
  ffestd_check_simple_ ();
Jeff Law committed
1743

1744 1745 1746 1747 1748 1749 1750
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR810_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R810.pool = ffesta_output_pool;
  stmt->u.R810.block = ffestw_stack_top ();
  stmt->u.R810.casenum = casenum;
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
1751 1752
}

1753
/* ffestd_R811 -- End a SELECT
Jeff Law committed
1754

1755
   ffestd_R811(TRUE);  */
Jeff Law committed
1756 1757

void
1758
ffestd_R811 (bool ok UNUSED)
Jeff Law committed
1759
{
1760
  ffestdStmt_ stmt;
Jeff Law committed
1761

1762 1763 1764 1765
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR811_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R811.block = ffestw_stack_top ();
Jeff Law committed
1766

1767 1768
  --ffestd_block_level_;
  assert (ffestd_block_level_ >= 0);
Jeff Law committed
1769 1770
}

1771
/* ffestd_R819A -- Iterative DO statement
Jeff Law committed
1772

1773
   ffestd_R819A(construct_name,label_token,expr,expr_token);
Jeff Law committed
1774

1775
   Make sure statement is valid here; implement.  */
Jeff Law committed
1776 1777

void
1778 1779 1780 1781
ffestd_R819A (ffelexToken construct_name UNUSED, ffelab label,
	      ffebld var, ffebld start, ffelexToken start_token,
	      ffebld end, ffelexToken end_token,
	      ffebld incr, ffelexToken incr_token)
Jeff Law committed
1782
{
1783
  ffestdStmt_ stmt;
Jeff Law committed
1784

1785
  ffestd_check_simple_ ();
Jeff Law committed
1786

1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR819A_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R819A.pool = ffesta_output_pool;
  stmt->u.R819A.block = ffestw_use (ffestw_stack_top ());
  stmt->u.R819A.label = label;
  stmt->u.R819A.var = var;
  stmt->u.R819A.start = start;
  stmt->u.R819A.start_token = ffelex_token_use (start_token);
  stmt->u.R819A.end = end;
  stmt->u.R819A.end_token = ffelex_token_use (end_token);
  stmt->u.R819A.incr = incr;
  stmt->u.R819A.incr_token = (incr_token == NULL) ? NULL
    : ffelex_token_use (incr_token);
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);

  ++ffestd_block_level_;
  assert (ffestd_block_level_ > 0);
Jeff Law committed
1805 1806
}

1807
/* ffestd_R819B -- DO WHILE statement
Jeff Law committed
1808

1809
   ffestd_R819B(construct_name,label_token,expr,expr_token);
Jeff Law committed
1810

1811
   Make sure statement is valid here; implement.  */
Jeff Law committed
1812 1813

void
1814 1815
ffestd_R819B (ffelexToken construct_name UNUSED, ffelab label,
	      ffebld expr)
Jeff Law committed
1816
{
1817
  ffestdStmt_ stmt;
Jeff Law committed
1818

1819
  ffestd_check_simple_ ();
Jeff Law committed
1820

1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR819B_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R819B.pool = ffesta_output_pool;
  stmt->u.R819B.block = ffestw_use (ffestw_stack_top ());
  stmt->u.R819B.label = label;
  stmt->u.R819B.expr = expr;
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);

  ++ffestd_block_level_;
  assert (ffestd_block_level_ > 0);
Jeff Law committed
1832 1833
}

1834
/* ffestd_R825 -- END DO statement
Jeff Law committed
1835

1836
   ffestd_R825(name_token);
Jeff Law committed
1837

1838 1839 1840 1841 1842 1843
   Make sure ffestd_kind_ identifies a DO block.  If not
   NULL, make sure name_token gives the correct name.  Do whatever
   is specific to seeing END DO with a DO-target label definition on it,
   where the END DO is really treated as a CONTINUE (i.e. generate th
   same code you would for CONTINUE).  ffestd_do handles the actual
   generation of end-loop code.	 */
Jeff Law committed
1844 1845

void
1846
ffestd_R825 (ffelexToken name UNUSED)
Jeff Law committed
1847
{
1848
  ffestdStmt_ stmt;
Jeff Law committed
1849

1850
  ffestd_check_simple_ ();
Jeff Law committed
1851

1852 1853 1854
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR825_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
Jeff Law committed
1855 1856
}

1857
/* ffestd_R834 -- CYCLE statement
Jeff Law committed
1858

1859
   ffestd_R834(name_token);
Jeff Law committed
1860

1861
   Handle a CYCLE within a loop.  */
Jeff Law committed
1862 1863

void
1864
ffestd_R834 (ffestw block)
Jeff Law committed
1865
{
1866
  ffestdStmt_ stmt;
Jeff Law committed
1867

1868
  ffestd_check_simple_ ();
Jeff Law committed
1869

1870 1871 1872 1873
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR834_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R834.block = block;
Jeff Law committed
1874 1875
}

1876
/* ffestd_R835 -- EXIT statement
Jeff Law committed
1877

1878
   ffestd_R835(name_token);
Jeff Law committed
1879

1880
   Handle a EXIT within a loop.	 */
Jeff Law committed
1881 1882

void
1883
ffestd_R835 (ffestw block)
Jeff Law committed
1884
{
1885
  ffestdStmt_ stmt;
Jeff Law committed
1886 1887

  ffestd_check_simple_ ();
1888 1889 1890 1891 1892

  stmt = ffestd_stmt_new_ (FFESTD_stmtidR835_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R835.block = block;
Jeff Law committed
1893 1894
}

1895
/* ffestd_R836 -- GOTO statement
Jeff Law committed
1896

1897
   ffestd_R836(label);
Jeff Law committed
1898

1899 1900
   Make sure label_token identifies a valid label for a GOTO.  Update
   that label's info to indicate it is the target of a GOTO.  */
Jeff Law committed
1901 1902

void
1903
ffestd_R836 (ffelab label)
Jeff Law committed
1904
{
1905
  ffestdStmt_ stmt;
Jeff Law committed
1906

1907
  ffestd_check_simple_ ();
Jeff Law committed
1908

1909 1910 1911 1912
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR836_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R836.label = label;
Jeff Law committed
1913

1914 1915
  if (ffestd_block_level_ == 0)
    ffestd_is_reachable_ = FALSE;
Jeff Law committed
1916 1917
}

1918
/* ffestd_R837 -- Computed GOTO statement
Jeff Law committed
1919

1920
   ffestd_R837(labels,expr);
Jeff Law committed
1921

1922 1923
   Make sure label_list identifies valid labels for a GOTO.  Update
   each label's info to indicate it is the target of a GOTO.  */
Jeff Law committed
1924 1925

void
1926
ffestd_R837 (ffelab *labels, int count, ffebld expr)
Jeff Law committed
1927
{
1928
  ffestdStmt_ stmt;
Jeff Law committed
1929

1930
  ffestd_check_simple_ ();
Jeff Law committed
1931

1932 1933 1934 1935 1936 1937 1938 1939
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR837_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R837.pool = ffesta_output_pool;
  stmt->u.R837.labels = labels;
  stmt->u.R837.count = count;
  stmt->u.R837.expr = expr;
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
1940 1941
}

1942
/* ffestd_R838 -- ASSIGN statement
Jeff Law committed
1943

1944
   ffestd_R838(label_token,target_variable,target_token);
Jeff Law committed
1945

1946 1947 1948 1949
   Make sure label_token identifies a valid label for an assignment.  Update
   that label's info to indicate it is the source of an assignment.  Update
   target_variable's info to indicate it is the target the assignment of that
   label.  */
Jeff Law committed
1950 1951

void
1952
ffestd_R838 (ffelab label, ffebld target)
Jeff Law committed
1953
{
1954
  ffestdStmt_ stmt;
Jeff Law committed
1955

1956
  ffestd_check_simple_ ();
Jeff Law committed
1957

1958 1959 1960 1961 1962 1963 1964
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR838_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R838.pool = ffesta_output_pool;
  stmt->u.R838.label = label;
  stmt->u.R838.target = target;
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
1965 1966
}

1967
/* ffestd_R839 -- Assigned GOTO statement
Jeff Law committed
1968

1969
   ffestd_R839(target,labels);
Jeff Law committed
1970

1971 1972
   Make sure label_list identifies valid labels for a GOTO.  Update
   each label's info to indicate it is the target of a GOTO.  */
Jeff Law committed
1973 1974

void
1975
ffestd_R839 (ffebld target, ffelab *labels UNUSED, int count UNUSED)
Jeff Law committed
1976
{
1977
  ffestdStmt_ stmt;
Jeff Law committed
1978

1979
  ffestd_check_simple_ ();
Jeff Law committed
1980

1981 1982 1983 1984 1985 1986
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR839_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R839.pool = ffesta_output_pool;
  stmt->u.R839.target = target;
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
1987

1988 1989
  if (ffestd_block_level_ == 0)
    ffestd_is_reachable_ = FALSE;
Jeff Law committed
1990 1991
}

1992
/* ffestd_R840 -- Arithmetic IF statement
Jeff Law committed
1993

1994
   ffestd_R840(expr,expr_token,neg,zero,pos);
Jeff Law committed
1995

1996
   Make sure the labels are valid; implement.  */
Jeff Law committed
1997 1998

void
1999
ffestd_R840 (ffebld expr, ffelab neg, ffelab zero, ffelab pos)
Jeff Law committed
2000
{
2001
  ffestdStmt_ stmt;
Jeff Law committed
2002

2003
  ffestd_check_simple_ ();
Jeff Law committed
2004

2005 2006 2007 2008 2009 2010 2011 2012 2013
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR840_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R840.pool = ffesta_output_pool;
  stmt->u.R840.expr = expr;
  stmt->u.R840.neg = neg;
  stmt->u.R840.zero = zero;
  stmt->u.R840.pos = pos;
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
2014

2015 2016
  if (ffestd_block_level_ == 0)
    ffestd_is_reachable_ = FALSE;
Jeff Law committed
2017 2018
}

2019
/* ffestd_R841 -- CONTINUE statement
Jeff Law committed
2020

2021
   ffestd_R841();  */
Jeff Law committed
2022 2023

void
2024
ffestd_R841 (bool in_where UNUSED)
Jeff Law committed
2025
{
2026
  ffestdStmt_ stmt;
Jeff Law committed
2027

2028
  ffestd_check_simple_ ();
Jeff Law committed
2029

2030 2031 2032 2033
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR841_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
}
Jeff Law committed
2034

2035 2036 2037
/* ffestd_R842 -- STOP statement

   ffestd_R842(expr);  */
Jeff Law committed
2038 2039

void
2040
ffestd_R842 (ffebld expr)
Jeff Law committed
2041
{
2042
  ffestdStmt_ stmt;
Jeff Law committed
2043

2044
  ffestd_check_simple_ ();
Jeff Law committed
2045

2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR842_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  if (ffesta_outpooldisp () == FFESTA_pooldispPRESERVE)
    {
      /* This is a "spurious" (automatically-generated) STOP
	 that follows a previous STOP or other statement.
	 Make sure we don't have an expression in the pool,
	 and then mark that the pool has already been killed.  */
      assert (expr == NULL);
      stmt->u.R842.pool = NULL;
      stmt->u.R842.expr = NULL;
    }
  else
    {
      stmt->u.R842.pool = ffesta_output_pool;
      stmt->u.R842.expr = expr;
      ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
    }
Jeff Law committed
2065

2066 2067
  if (ffestd_block_level_ == 0)
    ffestd_is_reachable_ = FALSE;
Jeff Law committed
2068 2069
}

2070
/* ffestd_R843 -- PAUSE statement
Jeff Law committed
2071

2072
   ffestd_R843(expr,expr_token);
Jeff Law committed
2073

2074 2075
   Make sure statement is valid here; implement.  expr and expr_token are
   both NULL if there was no expression.  */
Jeff Law committed
2076 2077

void
2078
ffestd_R843 (ffebld expr)
Jeff Law committed
2079
{
2080
  ffestdStmt_ stmt;
Jeff Law committed
2081 2082 2083

  ffestd_check_simple_ ();

2084 2085 2086 2087 2088 2089
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR843_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R843.pool = ffesta_output_pool;
  stmt->u.R843.expr = expr;
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
2090 2091
}

2092
/* ffestd_R904 -- OPEN statement
Jeff Law committed
2093

2094
   ffestd_R904();
Jeff Law committed
2095

2096
   Make sure an OPEN is valid in the current context, and implement it.	 */
Jeff Law committed
2097 2098

void
2099
ffestd_R904 ()
Jeff Law committed
2100
{
2101
  ffestdStmt_ stmt;
Jeff Law committed
2102

2103
  ffestd_check_simple_ ();
Jeff Law committed
2104

2105 2106
#define specified(something) \
      (ffestp_file.open.open_spec[something].kw_or_val_present)
Jeff Law committed
2107

2108
  /* Warn if there are any thing we don't handle via f2c libraries. */
Jeff Law committed
2109

2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135
  if (specified (FFESTP_openixACTION)
      || specified (FFESTP_openixASSOCIATEVARIABLE)
      || specified (FFESTP_openixBLOCKSIZE)
      || specified (FFESTP_openixBUFFERCOUNT)
      || specified (FFESTP_openixCARRIAGECONTROL)
      || specified (FFESTP_openixDEFAULTFILE)
      || specified (FFESTP_openixDELIM)
      || specified (FFESTP_openixDISPOSE)
      || specified (FFESTP_openixEXTENDSIZE)
      || specified (FFESTP_openixINITIALSIZE)
      || specified (FFESTP_openixKEY)
      || specified (FFESTP_openixMAXREC)
      || specified (FFESTP_openixNOSPANBLOCKS)
      || specified (FFESTP_openixORGANIZATION)
      || specified (FFESTP_openixPAD)
      || specified (FFESTP_openixPOSITION)
      || specified (FFESTP_openixREADONLY)
      || specified (FFESTP_openixRECORDTYPE)
      || specified (FFESTP_openixSHARED)
      || specified (FFESTP_openixUSEROPEN))
    {
      ffebad_start (FFEBAD_OPEN_UNSUPPORTED);
      ffebad_here (0, ffelex_token_where_line (ffesta_tokens[0]),
		   ffelex_token_where_column (ffesta_tokens[0]));
      ffebad_finish ();
    }
Jeff Law committed
2136

2137
#undef specified
Jeff Law committed
2138

2139 2140 2141 2142 2143 2144
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR904_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R904.pool = ffesta_output_pool;
  stmt->u.R904.params = ffestd_subr_copy_open_ ();
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
2145 2146
}

2147
/* ffestd_R907 -- CLOSE statement
Jeff Law committed
2148

2149 2150 2151
   ffestd_R907();

   Make sure a CLOSE is valid in the current context, and implement it.	 */
Jeff Law committed
2152 2153

void
2154
ffestd_R907 ()
Jeff Law committed
2155
{
2156 2157
  ffestdStmt_ stmt;

2158 2159
  ffestd_check_simple_ ();

2160
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR907_);
2161 2162
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
2163 2164
  stmt->u.R907.pool = ffesta_output_pool;
  stmt->u.R907.params = ffestd_subr_copy_close_ ();
2165
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
2166 2167
}

2168 2169 2170
/* ffestd_R909_start -- READ(...) statement list begin

   ffestd_R909_start(FALSE);
Jeff Law committed
2171

2172 2173
   Verify that READ is valid here, and begin accepting items in the
   list.  */
Jeff Law committed
2174 2175

void
2176 2177
ffestd_R909_start (bool only_format, ffestvUnit unit,
		   ffestvFormat format, bool rec, bool key)
Jeff Law committed
2178
{
2179
  ffestdStmt_ stmt;
Jeff Law committed
2180

2181
  ffestd_check_start_ ();
Jeff Law committed
2182

2183 2184
#define specified(something) \
      (ffestp_file.read.read_spec[something].kw_or_val_present)
Jeff Law committed
2185

2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200
  /* Warn if there are any thing we don't handle via f2c libraries. */
  if (specified (FFESTP_readixADVANCE)
      || specified (FFESTP_readixEOR)
      || specified (FFESTP_readixKEYEQ)
      || specified (FFESTP_readixKEYGE)
      || specified (FFESTP_readixKEYGT)
      || specified (FFESTP_readixKEYID)
      || specified (FFESTP_readixNULLS)
      || specified (FFESTP_readixSIZE))
    {
      ffebad_start (FFEBAD_READ_UNSUPPORTED);
      ffebad_here (0, ffelex_token_where_line (ffesta_tokens[0]),
		   ffelex_token_where_column (ffesta_tokens[0]));
      ffebad_finish ();
    }
Jeff Law committed
2201

2202
#undef specified
Jeff Law committed
2203

2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR909_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R909.pool = ffesta_output_pool;
  stmt->u.R909.params = ffestd_subr_copy_read_ ();
  stmt->u.R909.only_format = only_format;
  stmt->u.R909.unit = unit;
  stmt->u.R909.format = format;
  stmt->u.R909.rec = rec;
  stmt->u.R909.key = key;
  stmt->u.R909.list = NULL;
  ffestd_expr_list_ = &stmt->u.R909.list;
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
2217 2218
}

2219
/* ffestd_R909_item -- READ statement i/o item
Jeff Law committed
2220

2221
   ffestd_R909_item(expr,expr_token);
Jeff Law committed
2222

2223
   Implement output-list expression.  */
Jeff Law committed
2224 2225

void
2226
ffestd_R909_item (ffebld expr, ffelexToken expr_token)
Jeff Law committed
2227
{
2228 2229 2230 2231 2232 2233
  ffestdExprItem_ item;

  ffestd_check_item_ ();

  item = (ffestdExprItem_) malloc_new_kp (ffesta_output_pool,
					  "ffestdExprItem_", sizeof (*item));
Jeff Law committed
2234

2235 2236 2237 2238 2239
  item->next = NULL;
  item->expr = expr;
  item->token = ffelex_token_use (expr_token);
  *ffestd_expr_list_ = item;
  ffestd_expr_list_ = &item->next;
Jeff Law committed
2240 2241
}

2242
/* ffestd_R909_finish -- READ statement list complete
Jeff Law committed
2243

2244
   ffestd_R909_finish();
Jeff Law committed
2245

2246
   Just wrap up any local activities.  */
Jeff Law committed
2247 2248

void
2249
ffestd_R909_finish ()
Jeff Law committed
2250
{
2251
  ffestd_check_finish_ ();
Jeff Law committed
2252 2253
}

2254
/* ffestd_R910_start -- WRITE(...) statement list begin
Jeff Law committed
2255

2256
   ffestd_R910_start();
Jeff Law committed
2257

2258 2259
   Verify that WRITE is valid here, and begin accepting items in the
   list.  */
Jeff Law committed
2260 2261

void
2262
ffestd_R910_start (ffestvUnit unit, ffestvFormat format, bool rec)
Jeff Law committed
2263
{
2264
  ffestdStmt_ stmt;
Jeff Law committed
2265

2266
  ffestd_check_start_ ();
Jeff Law committed
2267

2268 2269
#define specified(something) \
      (ffestp_file.write.write_spec[something].kw_or_val_present)
Jeff Law committed
2270

2271 2272 2273 2274 2275 2276 2277 2278 2279
  /* Warn if there are any thing we don't handle via f2c libraries. */
  if (specified (FFESTP_writeixADVANCE)
      || specified (FFESTP_writeixEOR))
    {
      ffebad_start (FFEBAD_WRITE_UNSUPPORTED);
      ffebad_here (0, ffelex_token_where_line (ffesta_tokens[0]),
		   ffelex_token_where_column (ffesta_tokens[0]));
      ffebad_finish ();
    }
Jeff Law committed
2280

2281
#undef specified
Jeff Law committed
2282

2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR910_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R910.pool = ffesta_output_pool;
  stmt->u.R910.params = ffestd_subr_copy_write_ ();
  stmt->u.R910.unit = unit;
  stmt->u.R910.format = format;
  stmt->u.R910.rec = rec;
  stmt->u.R910.list = NULL;
  ffestd_expr_list_ = &stmt->u.R910.list;
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
2294 2295
}

2296
/* ffestd_R910_item -- WRITE statement i/o item
Jeff Law committed
2297

2298 2299 2300
   ffestd_R910_item(expr,expr_token);

   Implement output-list expression.  */
Jeff Law committed
2301 2302

void
2303
ffestd_R910_item (ffebld expr, ffelexToken expr_token)
Jeff Law committed
2304
{
2305
  ffestdExprItem_ item;
2306

2307
  ffestd_check_item_ ();
Jeff Law committed
2308

2309 2310
  item = (ffestdExprItem_) malloc_new_kp (ffesta_output_pool,
					  "ffestdExprItem_", sizeof (*item));
Jeff Law committed
2311

2312 2313 2314 2315 2316
  item->next = NULL;
  item->expr = expr;
  item->token = ffelex_token_use (expr_token);
  *ffestd_expr_list_ = item;
  ffestd_expr_list_ = &item->next;
Jeff Law committed
2317 2318
}

2319 2320 2321 2322 2323
/* ffestd_R910_finish -- WRITE statement list complete

   ffestd_R910_finish();

   Just wrap up any local activities.  */
Jeff Law committed
2324 2325

void
2326
ffestd_R910_finish ()
Jeff Law committed
2327
{
2328 2329
  ffestd_check_finish_ ();
}
2330

2331
/* ffestd_R911_start -- PRINT statement list begin
Jeff Law committed
2332

2333
   ffestd_R911_start();
Jeff Law committed
2334

2335 2336
   Verify that PRINT is valid here, and begin accepting items in the
   list.  */
Jeff Law committed
2337 2338

void
2339
ffestd_R911_start (ffestvFormat format)
Jeff Law committed
2340
{
2341
  ffestdStmt_ stmt;
Jeff Law committed
2342

2343
  ffestd_check_start_ ();
Jeff Law committed
2344

2345
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR911_);
2346 2347
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
2348 2349 2350 2351 2352 2353
  stmt->u.R911.pool = ffesta_output_pool;
  stmt->u.R911.params = ffestd_subr_copy_print_ ();
  stmt->u.R911.format = format;
  stmt->u.R911.list = NULL;
  ffestd_expr_list_ = &stmt->u.R911.list;
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
2354 2355
}

2356 2357 2358 2359 2360
/* ffestd_R911_item -- PRINT statement i/o item

   ffestd_R911_item(expr,expr_token);

   Implement output-list expression.  */
Jeff Law committed
2361 2362

void
2363
ffestd_R911_item (ffebld expr, ffelexToken expr_token)
Jeff Law committed
2364
{
2365
  ffestdExprItem_ item;
Jeff Law committed
2366

2367
  ffestd_check_item_ ();
Jeff Law committed
2368

2369 2370 2371 2372 2373 2374 2375 2376
  item = (ffestdExprItem_) malloc_new_kp (ffesta_output_pool,
					  "ffestdExprItem_", sizeof (*item));

  item->next = NULL;
  item->expr = expr;
  item->token = ffelex_token_use (expr_token);
  *ffestd_expr_list_ = item;
  ffestd_expr_list_ = &item->next;
Jeff Law committed
2377 2378
}

2379
/* ffestd_R911_finish -- PRINT statement list complete
Jeff Law committed
2380

2381
   ffestd_R911_finish();
Jeff Law committed
2382

2383
   Just wrap up any local activities.  */
Jeff Law committed
2384 2385

void
2386
ffestd_R911_finish ()
Jeff Law committed
2387
{
2388
  ffestd_check_finish_ ();
Jeff Law committed
2389 2390
}

2391
/* ffestd_R919 -- BACKSPACE statement
Jeff Law committed
2392

2393
   ffestd_R919();
Jeff Law committed
2394

2395
   Make sure a BACKSPACE is valid in the current context, and implement it.  */
Jeff Law committed
2396 2397

void
2398
ffestd_R919 ()
Jeff Law committed
2399
{
2400 2401
  ffestdStmt_ stmt;

Jeff Law committed
2402 2403
  ffestd_check_simple_ ();

2404
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR919_);
2405 2406
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
2407 2408
  stmt->u.R919.pool = ffesta_output_pool;
  stmt->u.R919.params = ffestd_subr_copy_beru_ ();
2409
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
2410 2411
}

2412
/* ffestd_R920 -- ENDFILE statement
Jeff Law committed
2413

2414
   ffestd_R920();
Jeff Law committed
2415

2416
   Make sure a ENDFILE is valid in the current context, and implement it.  */
Jeff Law committed
2417 2418

void
2419
ffestd_R920 ()
Jeff Law committed
2420
{
2421 2422
  ffestdStmt_ stmt;

Jeff Law committed
2423 2424
  ffestd_check_simple_ ();

2425
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR920_);
2426 2427
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
2428 2429
  stmt->u.R920.pool = ffesta_output_pool;
  stmt->u.R920.params = ffestd_subr_copy_beru_ ();
2430
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
2431 2432
}

2433
/* ffestd_R921 -- REWIND statement
Jeff Law committed
2434

2435 2436 2437
   ffestd_R921();

   Make sure a REWIND is valid in the current context, and implement it.  */
Jeff Law committed
2438 2439

void
2440
ffestd_R921 ()
Jeff Law committed
2441
{
2442
  ffestdStmt_ stmt;
Jeff Law committed
2443

2444 2445 2446
  ffestd_check_simple_ ();

  stmt = ffestd_stmt_new_ (FFESTD_stmtidR921_);
2447 2448
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
2449 2450 2451
  stmt->u.R921.pool = ffesta_output_pool;
  stmt->u.R921.params = ffestd_subr_copy_beru_ ();
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
2452 2453
}

2454
/* ffestd_R923A -- INQUIRE statement (non-IOLENGTH version)
Jeff Law committed
2455

2456
   ffestd_R923A(bool by_file);
Jeff Law committed
2457

2458
   Make sure an INQUIRE is valid in the current context, and implement it.  */
Jeff Law committed
2459 2460

void
2461
ffestd_R923A (bool by_file)
Jeff Law committed
2462
{
2463 2464
  ffestdStmt_ stmt;

Jeff Law committed
2465 2466
  ffestd_check_simple_ ();

2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492
#define specified(something) \
      (ffestp_file.inquire.inquire_spec[something].kw_or_val_present)

  /* Warn if there are any thing we don't handle via f2c libraries. */
  if (specified (FFESTP_inquireixACTION)
      || specified (FFESTP_inquireixCARRIAGECONTROL)
      || specified (FFESTP_inquireixDEFAULTFILE)
      || specified (FFESTP_inquireixDELIM)
      || specified (FFESTP_inquireixKEYED)
      || specified (FFESTP_inquireixORGANIZATION)
      || specified (FFESTP_inquireixPAD)
      || specified (FFESTP_inquireixPOSITION)
      || specified (FFESTP_inquireixREAD)
      || specified (FFESTP_inquireixREADWRITE)
      || specified (FFESTP_inquireixRECORDTYPE)
      || specified (FFESTP_inquireixWRITE))
    {
      ffebad_start (FFEBAD_INQUIRE_UNSUPPORTED);
      ffebad_here (0, ffelex_token_where_line (ffesta_tokens[0]),
		   ffelex_token_where_column (ffesta_tokens[0]));
      ffebad_finish ();
    }

#undef specified

  stmt = ffestd_stmt_new_ (FFESTD_stmtidR923A_);
2493 2494
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
2495 2496 2497
  stmt->u.R923A.pool = ffesta_output_pool;
  stmt->u.R923A.params = ffestd_subr_copy_inquire_ ();
  stmt->u.R923A.by_file = by_file;
2498
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
2499 2500
}

2501
/* ffestd_R923B_start -- INQUIRE(IOLENGTH=expr) statement list begin
Jeff Law committed
2502

2503
   ffestd_R923B_start();
Jeff Law committed
2504

2505 2506
   Verify that INQUIRE is valid here, and begin accepting items in the
   list.  */
Jeff Law committed
2507 2508

void
2509
ffestd_R923B_start ()
Jeff Law committed
2510
{
2511 2512
  ffestdStmt_ stmt;

2513
  ffestd_check_start_ ();
Jeff Law committed
2514

2515
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR923B_);
2516 2517
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
2518 2519 2520 2521
  stmt->u.R923B.pool = ffesta_output_pool;
  stmt->u.R923B.params = ffestd_subr_copy_inquire_ ();
  stmt->u.R923B.list = NULL;
  ffestd_expr_list_ = &stmt->u.R923B.list;
2522
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
2523 2524
}

2525
/* ffestd_R923B_item -- INQUIRE statement i/o item
Jeff Law committed
2526

2527
   ffestd_R923B_item(expr,expr_token);
Jeff Law committed
2528

2529
   Implement output-list expression.  */
Jeff Law committed
2530 2531

void
2532
ffestd_R923B_item (ffebld expr)
Jeff Law committed
2533
{
2534
  ffestdExprItem_ item;
Jeff Law committed
2535

2536
  ffestd_check_item_ ();
Jeff Law committed
2537

2538 2539 2540 2541 2542 2543 2544
  item = (ffestdExprItem_) malloc_new_kp (ffesta_output_pool,
					  "ffestdExprItem_", sizeof (*item));

  item->next = NULL;
  item->expr = expr;
  *ffestd_expr_list_ = item;
  ffestd_expr_list_ = &item->next;
Jeff Law committed
2545 2546
}

2547
/* ffestd_R923B_finish -- INQUIRE statement list complete
Jeff Law committed
2548

2549
   ffestd_R923B_finish();
Jeff Law committed
2550

2551
   Just wrap up any local activities.  */
Jeff Law committed
2552 2553

void
2554
ffestd_R923B_finish ()
Jeff Law committed
2555
{
2556 2557
  ffestd_check_finish_ ();
}
Jeff Law committed
2558

2559
/* ffestd_R1001 -- FORMAT statement
Jeff Law committed
2560

2561
   ffestd_R1001(format_list);  */
Jeff Law committed
2562 2563

void
2564
ffestd_R1001 (ffesttFormatList f)
Jeff Law committed
2565
{
2566 2567
  ffestsHolder str;
  ffests s = &str;
2568
  ffestdStmt_ stmt;
Jeff Law committed
2569

2570
  ffestd_check_simple_ ();
Jeff Law committed
2571

2572 2573
  if (ffestd_label_formatdef_ == NULL)
    return;			/* Nothing to hook it up to (no label def). */
Jeff Law committed
2574

2575 2576 2577 2578
  ffests_new (s, malloc_pool_image (), 80);
  ffests_putc (s, '(');
  ffestd_R1001dump_ (s, f);	/* Build the string in s. */
  ffests_putc (s, ')');
Jeff Law committed
2579

2580
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR1001_);
2581
  ffestd_stmt_append_ (stmt);
2582
  stmt->u.R1001.str = str;
Jeff Law committed
2583

2584
  ffestd_label_formatdef_ = NULL;
Jeff Law committed
2585 2586
}

2587
/* ffestd_R1001dump_ -- Dump list of formats
Jeff Law committed
2588

2589 2590
   ffesttFormatList list;
   ffestd_R1001dump_(list,0);
Jeff Law committed
2591

2592
   The formats in the list are dumped.	*/
Jeff Law committed
2593

2594 2595
static void
ffestd_R1001dump_ (ffests s, ffesttFormatList list)
Jeff Law committed
2596
{
2597
  ffesttFormatList next;
Jeff Law committed
2598

2599 2600 2601 2602 2603 2604 2605 2606 2607
  for (next = list->next; next != list; next = next->next)
    {
      if (next != list->next)
	ffests_putc (s, ',');
      switch (next->type)
	{
	case FFESTP_formattypeI:
	  ffestd_R1001dump_1005_3_ (s, next, "I");
	  break;
Jeff Law committed
2608

2609 2610 2611
	case FFESTP_formattypeB:
	  ffestd_R1001error_ (next);
	  break;
Jeff Law committed
2612

2613 2614 2615
	case FFESTP_formattypeO:
	  ffestd_R1001dump_1005_3_ (s, next, "O");
	  break;
Jeff Law committed
2616

2617 2618 2619
	case FFESTP_formattypeZ:
	  ffestd_R1001dump_1005_3_ (s, next, "Z");
	  break;
Jeff Law committed
2620

2621 2622 2623
	case FFESTP_formattypeF:
	  ffestd_R1001dump_1005_4_ (s, next, "F");
	  break;
Jeff Law committed
2624

2625 2626 2627
	case FFESTP_formattypeE:
	  ffestd_R1001dump_1005_5_ (s, next, "E");
	  break;
Jeff Law committed
2628

2629 2630 2631
	case FFESTP_formattypeEN:
	  ffestd_R1001error_ (next);
	  break;
Jeff Law committed
2632

2633 2634 2635
	case FFESTP_formattypeG:
	  ffestd_R1001dump_1005_5_ (s, next, "G");
	  break;
Jeff Law committed
2636

2637 2638 2639
	case FFESTP_formattypeL:
	  ffestd_R1001dump_1005_2_ (s, next, "L");
	  break;
Jeff Law committed
2640

2641 2642 2643
	case FFESTP_formattypeA:
	  ffestd_R1001dump_1005_1_ (s, next, "A");
	  break;
Jeff Law committed
2644

2645 2646 2647
	case FFESTP_formattypeD:
	  ffestd_R1001dump_1005_4_ (s, next, "D");
	  break;
Jeff Law committed
2648

2649 2650 2651
	case FFESTP_formattypeQ:
	  ffestd_R1001error_ (next);
	  break;
Jeff Law committed
2652

2653 2654 2655
	case FFESTP_formattypeDOLLAR:
	  ffestd_R1001dump_1010_1_ (s, next, "$");
	  break;
Jeff Law committed
2656

2657 2658 2659
	case FFESTP_formattypeP:
	  ffestd_R1001dump_1010_4_ (s, next, "P");
	  break;
Jeff Law committed
2660

2661 2662 2663
	case FFESTP_formattypeT:
	  ffestd_R1001dump_1010_5_ (s, next, "T");
	  break;
Jeff Law committed
2664

2665 2666 2667
	case FFESTP_formattypeTL:
	  ffestd_R1001dump_1010_5_ (s, next, "TL");
	  break;
Jeff Law committed
2668

2669 2670 2671
	case FFESTP_formattypeTR:
	  ffestd_R1001dump_1010_5_ (s, next, "TR");
	  break;
Jeff Law committed
2672

2673 2674 2675
	case FFESTP_formattypeX:
	  ffestd_R1001dump_1010_2_ (s, next, "X");
	  break;
Jeff Law committed
2676

2677 2678 2679
	case FFESTP_formattypeS:
	  ffestd_R1001dump_1010_1_ (s, next, "S");
	  break;
Jeff Law committed
2680

2681 2682 2683
	case FFESTP_formattypeSP:
	  ffestd_R1001dump_1010_1_ (s, next, "SP");
	  break;
Jeff Law committed
2684

2685 2686 2687
	case FFESTP_formattypeSS:
	  ffestd_R1001dump_1010_1_ (s, next, "SS");
	  break;
Jeff Law committed
2688

2689 2690 2691
	case FFESTP_formattypeBN:
	  ffestd_R1001dump_1010_1_ (s, next, "BN");
	  break;
Jeff Law committed
2692

2693 2694 2695
	case FFESTP_formattypeBZ:
	  ffestd_R1001dump_1010_1_ (s, next, "BZ");
	  break;
Jeff Law committed
2696

2697 2698 2699
	case FFESTP_formattypeSLASH:
	  ffestd_R1001dump_1010_2_ (s, next, "/");
	  break;
Jeff Law committed
2700

2701 2702 2703
	case FFESTP_formattypeCOLON:
	  ffestd_R1001dump_1010_1_ (s, next, ":");
	  break;
Jeff Law committed
2704

2705 2706 2707 2708 2709 2710 2711
	case FFESTP_formattypeR1016:
	  switch (ffelex_token_type (next->t))
	    {
	    case FFELEX_typeCHARACTER:
	      {
		char *p = ffelex_token_text (next->t);
		ffeTokenLength i = ffelex_token_length (next->t);
Jeff Law committed
2712

2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723
		ffests_putc (s, '\002');
		while (i-- != 0)
		  {
		    if (*p == '\002')
		      ffests_putc (s, '\002');
		    ffests_putc (s, *p);
		    ++p;
		  }
		ffests_putc (s, '\002');
	      }
	      break;
Jeff Law committed
2724

2725 2726 2727 2728
	    case FFELEX_typeHOLLERITH:
	      {
		char *p = ffelex_token_text (next->t);
		ffeTokenLength i = ffelex_token_length (next->t);
Jeff Law committed
2729

2730 2731 2732 2733 2734 2735 2736 2737
		ffests_printf (s, "%" ffeTokenLength_f "uH", i);
		while (i-- != 0)
		  {
		    ffests_putc (s, *p);
		    ++p;
		  }
	      }
	      break;
Jeff Law committed
2738

2739 2740 2741 2742
	    default:
	      assert (FALSE);
	    }
	  break;
Jeff Law committed
2743

2744 2745 2746 2747 2748 2749 2750 2751
	case FFESTP_formattypeFORMAT:
	  if (next->u.R1003D.R1004.present)
	    {
	      if (next->u.R1003D.R1004.rtexpr)
		ffestd_R1001rtexpr_ (s, next, next->u.R1003D.R1004.u.expr);
	      else
		ffests_printf (s, "%lu", next->u.R1003D.R1004.u.unsigned_val);
	    }
Jeff Law committed
2752

2753 2754 2755 2756
	  ffests_putc (s, '(');
	  ffestd_R1001dump_ (s, next->u.R1003D.format);
	  ffests_putc (s, ')');
	  break;
Jeff Law committed
2757

2758 2759 2760 2761
	default:
	  assert (FALSE);
	}
    }
Jeff Law committed
2762 2763
}

2764
/* ffestd_R1001dump_1005_1_ -- Dump a particular format
Jeff Law committed
2765

2766 2767
   ffesttFormatList f;
   ffestd_R1001dump_1005_1_(f,"I");
Jeff Law committed
2768

2769
   The format is dumped with form [r]X[w].  */
Jeff Law committed
2770

2771 2772
static void
ffestd_R1001dump_1005_1_ (ffests s, ffesttFormatList f, const char *string)
Jeff Law committed
2773
{
2774 2775 2776 2777 2778 2779 2780 2781 2782 2783
  assert (!f->u.R1005.R1007_or_R1008.present);
  assert (!f->u.R1005.R1009.present);

  if (f->u.R1005.R1004.present)
    {
      if (f->u.R1005.R1004.rtexpr)
	ffestd_R1001rtexpr_ (s, f, f->u.R1005.R1004.u.expr);
      else
	ffests_printf (s, "%lu", f->u.R1005.R1004.u.unsigned_val);
    }
Jeff Law committed
2784

2785
  ffests_puts (s, string);
Jeff Law committed
2786

2787 2788 2789 2790 2791 2792 2793
  if (f->u.R1005.R1006.present)
    {
      if (f->u.R1005.R1006.rtexpr)
	ffestd_R1001rtexpr_ (s, f, f->u.R1005.R1006.u.expr);
      else
	ffests_printf (s, "%lu", f->u.R1005.R1006.u.unsigned_val);
    }
Jeff Law committed
2794 2795
}

2796
/* ffestd_R1001dump_1005_2_ -- Dump a particular format
Jeff Law committed
2797

2798 2799
   ffesttFormatList f;
   ffestd_R1001dump_1005_2_(f,"I");
Jeff Law committed
2800

2801
   The format is dumped with form [r]Xw.  */
Jeff Law committed
2802

2803 2804
static void
ffestd_R1001dump_1005_2_ (ffests s, ffesttFormatList f, const char *string)
Jeff Law committed
2805
{
2806 2807 2808
  assert (!f->u.R1005.R1007_or_R1008.present);
  assert (!f->u.R1005.R1009.present);
  assert (f->u.R1005.R1006.present);
Jeff Law committed
2809

2810 2811 2812 2813 2814 2815 2816
  if (f->u.R1005.R1004.present)
    {
      if (f->u.R1005.R1004.rtexpr)
	ffestd_R1001rtexpr_ (s, f, f->u.R1005.R1004.u.expr);
      else
	ffests_printf (s, "%lu", f->u.R1005.R1004.u.unsigned_val);
    }
Jeff Law committed
2817

2818
  ffests_puts (s, string);
Jeff Law committed
2819

2820 2821 2822 2823
  if (f->u.R1005.R1006.rtexpr)
    ffestd_R1001rtexpr_ (s, f, f->u.R1005.R1006.u.expr);
  else
    ffests_printf (s, "%lu", f->u.R1005.R1006.u.unsigned_val);
Jeff Law committed
2824 2825
}

2826
/* ffestd_R1001dump_1005_3_ -- Dump a particular format
Jeff Law committed
2827

2828 2829
   ffesttFormatList f;
   ffestd_R1001dump_1005_3_(f,"I");
Jeff Law committed
2830

2831
   The format is dumped with form [r]Xw[.m].  */
Jeff Law committed
2832

2833 2834
static void
ffestd_R1001dump_1005_3_ (ffests s, ffesttFormatList f, const char *string)
Jeff Law committed
2835
{
2836 2837
  assert (!f->u.R1005.R1009.present);
  assert (f->u.R1005.R1006.present);
Jeff Law committed
2838

2839 2840 2841 2842 2843 2844 2845
  if (f->u.R1005.R1004.present)
    {
      if (f->u.R1005.R1004.rtexpr)
	ffestd_R1001rtexpr_ (s, f, f->u.R1005.R1004.u.expr);
      else
	ffests_printf (s, "%lu", f->u.R1005.R1004.u.unsigned_val);
    }
Jeff Law committed
2846

2847
  ffests_puts (s, string);
Jeff Law committed
2848

2849 2850 2851 2852
  if (f->u.R1005.R1006.rtexpr)
    ffestd_R1001rtexpr_ (s, f, f->u.R1005.R1006.u.expr);
  else
    ffests_printf (s, "%lu", f->u.R1005.R1006.u.unsigned_val);
Jeff Law committed
2853

2854 2855 2856 2857 2858 2859 2860 2861
  if (f->u.R1005.R1007_or_R1008.present)
    {
      ffests_putc (s, '.');
      if (f->u.R1005.R1007_or_R1008.rtexpr)
	ffestd_R1001rtexpr_ (s, f, f->u.R1005.R1007_or_R1008.u.expr);
      else
	ffests_printf (s, "%lu", f->u.R1005.R1007_or_R1008.u.unsigned_val);
    }
Jeff Law committed
2862 2863
}

2864
/* ffestd_R1001dump_1005_4_ -- Dump a particular format
Jeff Law committed
2865

2866 2867
   ffesttFormatList f;
   ffestd_R1001dump_1005_4_(f,"I");
Jeff Law committed
2868

2869
   The format is dumped with form [r]Xw.d.  */
Jeff Law committed
2870

2871 2872
static void
ffestd_R1001dump_1005_4_ (ffests s, ffesttFormatList f, const char *string)
Jeff Law committed
2873
{
2874 2875 2876
  assert (!f->u.R1005.R1009.present);
  assert (f->u.R1005.R1007_or_R1008.present);
  assert (f->u.R1005.R1006.present);
Jeff Law committed
2877

2878 2879 2880 2881 2882 2883 2884
  if (f->u.R1005.R1004.present)
    {
      if (f->u.R1005.R1004.rtexpr)
	ffestd_R1001rtexpr_ (s, f, f->u.R1005.R1004.u.expr);
      else
	ffests_printf (s, "%lu", f->u.R1005.R1004.u.unsigned_val);
    }
Jeff Law committed
2885

2886
  ffests_puts (s, string);
Jeff Law committed
2887

2888 2889 2890 2891
  if (f->u.R1005.R1006.rtexpr)
    ffestd_R1001rtexpr_ (s, f, f->u.R1005.R1006.u.expr);
  else
    ffests_printf (s, "%lu", f->u.R1005.R1006.u.unsigned_val);
Jeff Law committed
2892

2893 2894 2895 2896 2897
  ffests_putc (s, '.');
  if (f->u.R1005.R1007_or_R1008.rtexpr)
    ffestd_R1001rtexpr_ (s, f, f->u.R1005.R1007_or_R1008.u.expr);
  else
    ffests_printf (s, "%lu", f->u.R1005.R1007_or_R1008.u.unsigned_val);
Jeff Law committed
2898 2899
}

2900
/* ffestd_R1001dump_1005_5_ -- Dump a particular format
Jeff Law committed
2901

2902 2903
   ffesttFormatList f;
   ffestd_R1001dump_1005_5_(f,"I");
Jeff Law committed
2904

2905
   The format is dumped with form [r]Xw.d[Ee].	*/
Jeff Law committed
2906

2907 2908
static void
ffestd_R1001dump_1005_5_ (ffests s, ffesttFormatList f, const char *string)
Jeff Law committed
2909
{
2910 2911
  assert (f->u.R1005.R1007_or_R1008.present);
  assert (f->u.R1005.R1006.present);
Jeff Law committed
2912

2913 2914 2915 2916 2917 2918 2919
  if (f->u.R1005.R1004.present)
    {
      if (f->u.R1005.R1004.rtexpr)
	ffestd_R1001rtexpr_ (s, f, f->u.R1005.R1004.u.expr);
      else
	ffests_printf (s, "%lu", f->u.R1005.R1004.u.unsigned_val);
    }
Jeff Law committed
2920

2921
  ffests_puts (s, string);
Jeff Law committed
2922

2923 2924 2925 2926
  if (f->u.R1005.R1006.rtexpr)
    ffestd_R1001rtexpr_ (s, f, f->u.R1005.R1006.u.expr);
  else
    ffests_printf (s, "%lu", f->u.R1005.R1006.u.unsigned_val);
Jeff Law committed
2927

2928 2929 2930 2931 2932
  ffests_putc (s, '.');
  if (f->u.R1005.R1007_or_R1008.rtexpr)
    ffestd_R1001rtexpr_ (s, f, f->u.R1005.R1007_or_R1008.u.expr);
  else
    ffests_printf (s, "%lu", f->u.R1005.R1007_or_R1008.u.unsigned_val);
Jeff Law committed
2933

2934 2935 2936 2937 2938 2939 2940 2941
  if (f->u.R1005.R1009.present)
    {
      ffests_putc (s, 'E');
      if (f->u.R1005.R1009.rtexpr)
	ffestd_R1001rtexpr_ (s, f, f->u.R1005.R1009.u.expr);
      else
	ffests_printf (s, "%lu", f->u.R1005.R1009.u.unsigned_val);
    }
Jeff Law committed
2942 2943
}

2944
/* ffestd_R1001dump_1010_1_ -- Dump a particular format
Jeff Law committed
2945

2946 2947
   ffesttFormatList f;
   ffestd_R1001dump_1010_1_(f,"I");
Jeff Law committed
2948

2949
   The format is dumped with form X.  */
Jeff Law committed
2950

2951 2952
static void
ffestd_R1001dump_1010_1_ (ffests s, ffesttFormatList f, const char *string)
Jeff Law committed
2953
{
2954
  assert (!f->u.R1010.val.present);
Jeff Law committed
2955

2956
  ffests_puts (s, string);
2957
}
Jeff Law committed
2958

2959
/* ffestd_R1001dump_1010_2_ -- Dump a particular format
Jeff Law committed
2960

2961 2962
   ffesttFormatList f;
   ffestd_R1001dump_1010_2_(f,"I");
Jeff Law committed
2963

2964
   The format is dumped with form [r]X.	 */
Jeff Law committed
2965

2966 2967 2968 2969 2970 2971 2972 2973 2974 2975
static void
ffestd_R1001dump_1010_2_ (ffests s, ffesttFormatList f, const char *string)
{
  if (f->u.R1010.val.present)
    {
      if (f->u.R1010.val.rtexpr)
	ffestd_R1001rtexpr_ (s, f, f->u.R1010.val.u.expr);
      else
	ffests_printf (s, "%lu", f->u.R1010.val.u.unsigned_val);
    }
Jeff Law committed
2976

2977
  ffests_puts (s, string);
2978
}
Jeff Law committed
2979

2980
/* ffestd_R1001dump_1010_4_ -- Dump a particular format
Jeff Law committed
2981

2982 2983
   ffesttFormatList f;
   ffestd_R1001dump_1010_4_(f,"I");
Jeff Law committed
2984

2985
   The format is dumped with form kX.  Note that k is signed.  */
Jeff Law committed
2986

2987 2988
static void
ffestd_R1001dump_1010_4_ (ffests s, ffesttFormatList f, const char *string)
Jeff Law committed
2989
{
2990
  assert (f->u.R1010.val.present);
Jeff Law committed
2991

2992 2993 2994 2995
  if (f->u.R1010.val.rtexpr)
    ffestd_R1001rtexpr_ (s, f, f->u.R1010.val.u.expr);
  else
    ffests_printf (s, "%ld", f->u.R1010.val.u.signed_val);
Jeff Law committed
2996

2997
  ffests_puts (s, string);
Jeff Law committed
2998 2999
}

3000
/* ffestd_R1001dump_1010_5_ -- Dump a particular format
Jeff Law committed
3001

3002 3003
   ffesttFormatList f;
   ffestd_R1001dump_1010_5_(f,"I");
3004

3005
   The format is dumped with form Xn.  */
Jeff Law committed
3006

3007 3008 3009 3010
static void
ffestd_R1001dump_1010_5_ (ffests s, ffesttFormatList f, const char *string)
{
  assert (f->u.R1010.val.present);
Jeff Law committed
3011

3012
  ffests_puts (s, string);
Jeff Law committed
3013

3014 3015 3016 3017
  if (f->u.R1010.val.rtexpr)
    ffestd_R1001rtexpr_ (s, f, f->u.R1010.val.u.expr);
  else
    ffests_printf (s, "%lu", f->u.R1010.val.u.unsigned_val);
Jeff Law committed
3018 3019
}

3020
/* ffestd_R1001error_ -- Complain about FORMAT specification not supported
Jeff Law committed
3021

3022 3023
   ffesttFormatList f;
   ffestd_R1001error_(f);
Jeff Law committed
3024

3025
   An error message is produced.  */
Jeff Law committed
3026

3027 3028
static void
ffestd_R1001error_ (ffesttFormatList f)
Jeff Law committed
3029
{
3030 3031 3032 3033
  ffebad_start (FFEBAD_FORMAT_UNSUPPORTED);
  ffebad_here (0, ffelex_token_where_line (f->t), ffelex_token_where_column (f->t));
  ffebad_finish ();
}
Jeff Law committed
3034

3035 3036 3037 3038 3039 3040 3041
static void
ffestd_R1001rtexpr_ (ffests s, ffesttFormatList f, ffebld expr)
{
  if ((expr == NULL)
      || (ffebld_op (expr) != FFEBLD_opCONTER)
      || (ffeinfo_basictype (ffebld_info (expr)) != FFEINFO_basictypeINTEGER)
      || (ffeinfo_kindtype (ffebld_info (expr)) == FFEINFO_kindtypeINTEGER4))
Jeff Law committed
3042
    {
3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069
      ffebad_start (FFEBAD_FORMAT_VARIABLE);
      ffebad_here (0, ffelex_token_where_line (f->t), ffelex_token_where_column (f->t));
      ffebad_finish ();
    }
  else
    {
      int val;

      switch (ffeinfo_kindtype (ffebld_info (expr)))
	{
#if FFETARGET_okINTEGER1
	case FFEINFO_kindtypeINTEGER1:
	  val = ffebld_constant_integer1 (ffebld_conter (expr));
	  break;
#endif

#if FFETARGET_okINTEGER2
	case FFEINFO_kindtypeINTEGER2:
	  val = ffebld_constant_integer2 (ffebld_conter (expr));
	  break;
#endif

#if FFETARGET_okINTEGER3
	case FFEINFO_kindtypeINTEGER3:
	  val = ffebld_constant_integer3 (ffebld_conter (expr));
	  break;
#endif
Jeff Law committed
3070

3071 3072 3073 3074 3075 3076 3077
	default:
	  assert ("bad INTEGER constant kind type" == NULL);
	  /* Fall through. */
	case FFEINFO_kindtypeANY:
	  return;
	}
      ffests_printf (s, "%ld", (long) val);
Jeff Law committed
3078 3079 3080
    }
}

3081
/* ffestd_R1102 -- PROGRAM statement
Jeff Law committed
3082

3083
   ffestd_R1102(name_token);
Jeff Law committed
3084

3085 3086
   Make sure ffestd_kind_ identifies an empty block.  Make sure name_token
   gives a valid name.	Implement the beginning of a main program.  */
Jeff Law committed
3087 3088

void
3089
ffestd_R1102 (ffesymbol s, ffelexToken name UNUSED)
Jeff Law committed
3090 3091 3092
{
  ffestd_check_simple_ ();

3093 3094
  assert (ffestd_block_level_ == 0);
  ffestd_is_reachable_ = TRUE;
Jeff Law committed
3095

3096 3097 3098 3099 3100
  ffecom_notify_primary_entry (s);
  ffe_set_is_mainprog (TRUE);	/* Is a main program. */
  ffe_set_is_saveall (TRUE);	/* Main program always has implicit SAVE. */

  ffestw_set_sym (ffestw_stack_top (), s);
Jeff Law committed
3101 3102
}

3103
/* ffestd_R1103 -- End a PROGRAM
Jeff Law committed
3104

3105
   ffestd_R1103();  */
Jeff Law committed
3106 3107

void
3108
ffestd_R1103 (bool ok UNUSED)
Jeff Law committed
3109
{
3110
  ffestdStmt_ stmt;
Jeff Law committed
3111

3112
  assert (ffestd_block_level_ == 0);
Jeff Law committed
3113

3114 3115
  if (FFESTD_IS_END_OPTIMIZED_ && ffestd_is_reachable_)
    ffestd_R842 (NULL);		/* Generate STOP. */
Jeff Law committed
3116

3117 3118
  if (ffestw_state (ffestw_stack_top ()) != FFESTV_statePROGRAM5)
    ffestd_subr_labels_ (FALSE);/* Handle any undefined labels. */
Jeff Law committed
3119

3120 3121
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR1103_);
  ffestd_stmt_append_ (stmt);
Jeff Law committed
3122 3123
}

3124
/* ffestd_R1111 -- BLOCK DATA statement
Jeff Law committed
3125

3126
   ffestd_R1111(name_token);
Jeff Law committed
3127

3128 3129 3130
   Make sure ffestd_kind_ identifies no current program unit.  If not
   NULL, make sure name_token gives a valid name.  Implement the beginning
   of a block data program unit.  */
Jeff Law committed
3131 3132

void
3133
ffestd_R1111 (ffesymbol s, ffelexToken name UNUSED)
Jeff Law committed
3134
{
3135 3136
  assert (ffestd_block_level_ == 0);
  ffestd_is_reachable_ = TRUE;
Jeff Law committed
3137

3138
  ffestd_check_simple_ ();
Jeff Law committed
3139

3140 3141 3142
  ffecom_notify_primary_entry (s);
  ffestw_set_sym (ffestw_stack_top (), s);
}
Jeff Law committed
3143

3144
/* ffestd_R1112 -- End a BLOCK DATA
Jeff Law committed
3145

3146
   ffestd_R1112(TRUE);	*/
Jeff Law committed
3147 3148

void
3149
ffestd_R1112 (bool ok UNUSED)
Jeff Law committed
3150
{
3151
  ffestdStmt_ stmt;
Jeff Law committed
3152

3153
  assert (ffestd_block_level_ == 0);
Jeff Law committed
3154

3155
  /* Generate any return-like code here (not likely for BLOCK DATA!). */
Jeff Law committed
3156

3157 3158
  if (ffestw_state (ffestw_stack_top ()) != FFESTV_stateBLOCKDATA5)
    ffestd_subr_labels_ (TRUE);	/* Handle any undefined labels. */
Jeff Law committed
3159

3160 3161
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR1112_);
  ffestd_stmt_append_ (stmt);
Jeff Law committed
3162 3163
}

3164
/* ffestd_R1207_start -- EXTERNAL statement list begin
Jeff Law committed
3165

3166
   ffestd_R1207_start();
Jeff Law committed
3167

3168
   Verify that EXTERNAL is valid here, and begin accepting items in the list.  */
Jeff Law committed
3169 3170

void
3171
ffestd_R1207_start ()
Jeff Law committed
3172 3173 3174 3175
{
  ffestd_check_start_ ();
}

3176
/* ffestd_R1207_item -- EXTERNAL statement for name
Jeff Law committed
3177

3178
   ffestd_R1207_item(name_token);
Jeff Law committed
3179

3180
   Make sure name_token identifies a valid object to be EXTERNALd.  */
Jeff Law committed
3181 3182

void
3183
ffestd_R1207_item (ffelexToken name)
Jeff Law committed
3184 3185
{
  ffestd_check_item_ ();
3186
  assert (name != NULL);
Jeff Law committed
3187 3188
}

3189
/* ffestd_R1207_finish -- EXTERNAL statement list complete
Jeff Law committed
3190

3191
   ffestd_R1207_finish();
Jeff Law committed
3192 3193 3194 3195

   Just wrap up any local activities.  */

void
3196
ffestd_R1207_finish ()
Jeff Law committed
3197 3198 3199 3200
{
  ffestd_check_finish_ ();
}

3201
/* ffestd_R1208_start -- INTRINSIC statement list begin
Jeff Law committed
3202

3203
   ffestd_R1208_start();
Jeff Law committed
3204

3205
   Verify that INTRINSIC is valid here, and begin accepting items in the list.	*/
Jeff Law committed
3206 3207

void
3208
ffestd_R1208_start ()
Jeff Law committed
3209
{
3210
  ffestd_check_start_ ();
Jeff Law committed
3211 3212
}

3213
/* ffestd_R1208_item -- INTRINSIC statement for name
Jeff Law committed
3214

3215
   ffestd_R1208_item(name_token);
Jeff Law committed
3216

3217
   Make sure name_token identifies a valid object to be INTRINSICd.  */
Jeff Law committed
3218 3219

void
3220
ffestd_R1208_item (ffelexToken name)
Jeff Law committed
3221
{
3222 3223
  ffestd_check_item_ ();
  assert (name != NULL);
Jeff Law committed
3224 3225
}

3226 3227 3228
/* ffestd_R1208_finish -- INTRINSIC statement list complete

   ffestd_R1208_finish();
Jeff Law committed
3229

3230
   Just wrap up any local activities.  */
Jeff Law committed
3231 3232

void
3233
ffestd_R1208_finish ()
Jeff Law committed
3234
{
3235
  ffestd_check_finish_ ();
Jeff Law committed
3236 3237
}

3238
/* ffestd_R1212 -- CALL statement
Jeff Law committed
3239

3240
   ffestd_R1212(expr,expr_token);
Jeff Law committed
3241

3242
   Make sure statement is valid here; implement.  */
Jeff Law committed
3243 3244

void
3245
ffestd_R1212 (ffebld expr)
Jeff Law committed
3246
{
3247
  ffestdStmt_ stmt;
Jeff Law committed
3248

3249
  ffestd_check_simple_ ();
Jeff Law committed
3250

3251 3252 3253 3254 3255 3256
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR1212_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R1212.pool = ffesta_output_pool;
  stmt->u.R1212.expr = expr;
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
3257 3258
}

3259
/* ffestd_R1219 -- FUNCTION statement
Jeff Law committed
3260

3261 3262
   ffestd_R1219(funcname,arglist,ending_token,kind,kindt,len,lent,
	 recursive);
Jeff Law committed
3263

3264 3265 3266 3267 3268
   Make sure statement is valid here, register arguments for the
   function name, and so on.

   06-Jun-90  JCB  2.0
      Added the kind, len, and recursive arguments.  */
Jeff Law committed
3269 3270

void
3271 3272 3273 3274 3275 3276
ffestd_R1219 (ffesymbol s, ffelexToken funcname UNUSED,
	      ffesttTokenList args UNUSED, ffestpType type UNUSED,
	      ffebld kind UNUSED, ffelexToken kindt UNUSED,
	      ffebld len UNUSED, ffelexToken lent UNUSED,
	      bool recursive UNUSED, ffelexToken result UNUSED,
	      bool separate_result UNUSED)
Jeff Law committed
3277
{
3278 3279
  assert (ffestd_block_level_ == 0);
  ffestd_is_reachable_ = TRUE;
Jeff Law committed
3280

3281
  ffestd_check_simple_ ();
Jeff Law committed
3282

3283 3284
  ffecom_notify_primary_entry (s);
  ffestw_set_sym (ffestw_stack_top (), s);
Jeff Law committed
3285 3286
}

3287
/* ffestd_R1221 -- End a FUNCTION
Jeff Law committed
3288

3289
   ffestd_R1221(TRUE);	*/
Jeff Law committed
3290 3291

void
3292
ffestd_R1221 (bool ok UNUSED)
Jeff Law committed
3293
{
3294
  ffestdStmt_ stmt;
Jeff Law committed
3295

3296
  assert (ffestd_block_level_ == 0);
Jeff Law committed
3297

3298 3299
  if (FFESTD_IS_END_OPTIMIZED_ && ffestd_is_reachable_)
    ffestd_R1227 (NULL);	/* Generate RETURN. */
Jeff Law committed
3300

3301 3302
  if (ffestw_state (ffestw_stack_top ()) != FFESTV_stateFUNCTION5)
    ffestd_subr_labels_ (FALSE);/* Handle any undefined labels. */
Jeff Law committed
3303

3304 3305
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR1221_);
  ffestd_stmt_append_ (stmt);
Jeff Law committed
3306 3307
}

3308 3309 3310
/* ffestd_R1223 -- SUBROUTINE statement

   ffestd_R1223(subrname,arglist,ending_token,recursive_token);
Jeff Law committed
3311

3312 3313
   Make sure statement is valid here, register arguments for the
   subroutine name, and so on.
Jeff Law committed
3314

3315 3316
   06-Jun-90  JCB  2.0
      Added the recursive argument.  */
Jeff Law committed
3317 3318

void
3319 3320 3321
ffestd_R1223 (ffesymbol s, ffelexToken subrname UNUSED,
	      ffesttTokenList args UNUSED, ffelexToken final UNUSED,
	      bool recursive UNUSED)
Jeff Law committed
3322
{
3323 3324
  assert (ffestd_block_level_ == 0);
  ffestd_is_reachable_ = TRUE;
Jeff Law committed
3325

3326
  ffestd_check_simple_ ();
Jeff Law committed
3327

3328 3329
  ffecom_notify_primary_entry (s);
  ffestw_set_sym (ffestw_stack_top (), s);
Jeff Law committed
3330 3331
}

3332
/* ffestd_R1225 -- End a SUBROUTINE
Jeff Law committed
3333

3334
   ffestd_R1225(TRUE);	*/
Jeff Law committed
3335 3336

void
3337
ffestd_R1225 (bool ok UNUSED)
Jeff Law committed
3338
{
3339
  ffestdStmt_ stmt;
Jeff Law committed
3340

3341
  assert (ffestd_block_level_ == 0);
Jeff Law committed
3342

3343 3344
  if (FFESTD_IS_END_OPTIMIZED_ && ffestd_is_reachable_)
    ffestd_R1227 (NULL);	/* Generate RETURN. */
Jeff Law committed
3345

3346 3347
  if (ffestw_state (ffestw_stack_top ()) != FFESTV_stateSUBROUTINE5)
    ffestd_subr_labels_ (FALSE);/* Handle any undefined labels. */
Jeff Law committed
3348

3349 3350
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR1225_);
  ffestd_stmt_append_ (stmt);
Jeff Law committed
3351 3352
}

3353
/* ffestd_R1226 -- ENTRY statement
Jeff Law committed
3354

3355
   ffestd_R1226(entryname,arglist,ending_token);
Jeff Law committed
3356

3357 3358
   Make sure we're in a SUBROUTINE or FUNCTION, register arguments for the
   entry point name, and so on.	 */
Jeff Law committed
3359 3360

void
3361
ffestd_R1226 (ffesymbol entry)
Jeff Law committed
3362
{
3363
  ffestd_check_simple_ ();
Jeff Law committed
3364

3365 3366 3367
  if (!ffesta_seen_first_exec || ffecom_2pass_advise_entrypoint (entry))
    {
      ffestdStmt_ stmt;
Jeff Law committed
3368

3369 3370 3371 3372 3373 3374
      stmt = ffestd_stmt_new_ (FFESTD_stmtidR1226_);
      ffestd_stmt_append_ (stmt);
      ffestd_subr_line_save_ (stmt);
      stmt->u.R1226.entry = entry;
      stmt->u.R1226.entrynum = ++ffestd_2pass_entrypoints_;
    }
Jeff Law committed
3375

3376
  ffestd_is_reachable_ = TRUE;
Jeff Law committed
3377 3378
}

3379
/* ffestd_R1227 -- RETURN statement
Jeff Law committed
3380

3381
   ffestd_R1227(expr);
Jeff Law committed
3382

3383 3384
   Make sure statement is valid here; implement.  expr and expr_token are
   both NULL if there was no expression.  */
Jeff Law committed
3385 3386

void
3387
ffestd_R1227 (ffebld expr)
Jeff Law committed
3388
{
3389
  ffestdStmt_ stmt;
Jeff Law committed
3390

3391
  ffestd_check_simple_ ();
Jeff Law committed
3392

3393 3394 3395 3396 3397 3398 3399
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR1227_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
  stmt->u.R1227.pool = ffesta_output_pool;
  stmt->u.R1227.block = ffestw_stack_top ();
  stmt->u.R1227.expr = expr;
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
3400

3401 3402
  if (ffestd_block_level_ == 0)
    ffestd_is_reachable_ = FALSE;
Jeff Law committed
3403 3404
}

3405
/* ffestd_R1229_start -- STMTFUNCTION statement begin
Jeff Law committed
3406

3407
   ffestd_R1229_start(func_name,func_arg_list,close_paren);
Jeff Law committed
3408

3409 3410 3411 3412 3413 3414 3415
   This function does not really need to do anything, since _finish_
   gets all the info needed, and ffestc_R1229_start has already
   done all the stuff that makes a two-phase operation (start and
   finish) for handling statement functions necessary.

   03-Jan-91  JCB  2.0
      Do nothing, now that _finish_ does everything.  */
Jeff Law committed
3416 3417

void
3418
ffestd_R1229_start (ffelexToken name UNUSED, ffesttTokenList args UNUSED)
Jeff Law committed
3419 3420 3421 3422
{
  ffestd_check_start_ ();
}

3423
/* ffestd_R1229_finish -- STMTFUNCTION statement list complete
Jeff Law committed
3424

3425
   ffestd_R1229_finish(s);
Jeff Law committed
3426

3427 3428 3429
   The statement function's symbol is passed.  Its list of dummy args is
   accessed via ffesymbol_dummyargs and its expansion expression (expr)
   is accessed via ffesymbol_sfexpr.
Jeff Law committed
3430

3431 3432 3433 3434
   If sfexpr is NULL, an error occurred parsing the expansion expression, so
   just cancel the effects of ffestd_R1229_start and pretend nothing
   happened.  Otherwise, install the expression as the expansion for the
   statement function, then clean up.
Jeff Law committed
3435

3436 3437 3438 3439
   03-Jan-91  JCB  2.0
      Takes sfunc sym instead of just the expansion expression as an
      argument, so this function can do all the work, and _start_ is just
      a nicety than can do nothing in a back end.  */
Jeff Law committed
3440 3441

void
3442
ffestd_R1229_finish (ffesymbol s)
Jeff Law committed
3443
{
3444
  ffebld expr = ffesymbol_sfexpr (s);
Jeff Law committed
3445

3446
  ffestd_check_finish_ ();
Jeff Law committed
3447

3448 3449
  if (expr == NULL)
    return;			/* Nothing to do, definition didn't work. */
Jeff Law committed
3450

3451 3452 3453
  /* With gcc, cannot do anything here, because the backend hasn't even
     (necessarily) been notified that we're compiling a program unit! */
  ffesta_set_outpooldisp (FFESTA_pooldispPRESERVE);
Jeff Law committed
3454 3455
}

3456
/* ffestd_S3P4 -- INCLUDE line
Jeff Law committed
3457

3458
   ffestd_S3P4(filename,filename_token);
Jeff Law committed
3459

3460
   Make sure INCLUDE not preceded by any semicolons or a label def; implement.	*/
Jeff Law committed
3461 3462

void
3463
ffestd_S3P4 (ffebld filename)
Jeff Law committed
3464
{
3465 3466 3467 3468
  FILE *fi;
  ffetargetCharacterDefault buildname;
  ffewhereFile wf;

Jeff Law committed
3469
  ffestd_check_simple_ ();
3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488

  assert (filename != NULL);
  if (ffebld_op (filename) != FFEBLD_opANY)
    {
      assert (ffebld_op (filename) == FFEBLD_opCONTER);
      assert (ffeinfo_basictype (ffebld_info (filename))
	      == FFEINFO_basictypeCHARACTER);
      assert (ffeinfo_kindtype (ffebld_info (filename))
	      == FFEINFO_kindtypeCHARACTERDEFAULT);
      buildname = ffebld_constant_characterdefault (ffebld_conter (filename));
      wf = ffewhere_file_new (ffetarget_text_characterdefault (buildname),
			      ffetarget_length_characterdefault (buildname));
      fi = ffecom_open_include (ffewhere_file_name (wf),
				ffelex_token_where_line (ffesta_tokens[0]),
				ffelex_token_where_column (ffesta_tokens[0]));
      if (fi != NULL)
	ffelex_set_include (wf, (ffelex_token_type (ffesta_tokens[0])
				 == FFELEX_typeNAME), fi);
    }
Jeff Law committed
3489 3490
}

3491
/* ffestd_V014_start -- VOLATILE statement list begin
Jeff Law committed
3492

3493
   ffestd_V014_start();
Jeff Law committed
3494

3495
   Verify that VOLATILE is valid here, and begin accepting items in the list.  */
Jeff Law committed
3496 3497

void
3498
ffestd_V014_start ()
Jeff Law committed
3499 3500 3501 3502
{
  ffestd_check_start_ ();
}

3503
/* ffestd_V014_item_object -- VOLATILE statement for object-name
Jeff Law committed
3504

3505
   ffestd_V014_item_object(name_token);
Jeff Law committed
3506

3507
   Make sure name_token identifies a valid object to be VOLATILEd.  */
Jeff Law committed
3508 3509

void
3510
ffestd_V014_item_object (ffelexToken name UNUSED)
Jeff Law committed
3511 3512 3513 3514
{
  ffestd_check_item_ ();
}

3515
/* ffestd_V014_item_cblock -- VOLATILE statement for common-block-name
Jeff Law committed
3516

3517
   ffestd_V014_item_cblock(name_token);
Jeff Law committed
3518

3519
   Make sure name_token identifies a valid common block to be VOLATILEd.  */
Jeff Law committed
3520 3521

void
3522
ffestd_V014_item_cblock (ffelexToken name UNUSED)
Jeff Law committed
3523 3524 3525 3526
{
  ffestd_check_item_ ();
}

3527
/* ffestd_V014_finish -- VOLATILE statement list complete
Jeff Law committed
3528

3529
   ffestd_V014_finish();
Jeff Law committed
3530 3531 3532 3533

   Just wrap up any local activities.  */

void
3534
ffestd_V014_finish ()
Jeff Law committed
3535 3536 3537 3538
{
  ffestd_check_finish_ ();
}

3539
/* ffestd_V020_start -- TYPE statement list begin
Jeff Law committed
3540

3541
   ffestd_V020_start();
Jeff Law committed
3542

3543
   Verify that TYPE is valid here, and begin accepting items in the
Jeff Law committed
3544 3545 3546
   list.  */

void
3547
ffestd_V020_start (ffestvFormat format UNUSED)
Jeff Law committed
3548 3549 3550 3551 3552
{
  ffestd_check_start_ ();
  ffestd_subr_vxt_ ();
}

3553
/* ffestd_V020_item -- TYPE statement i/o item
Jeff Law committed
3554

3555
   ffestd_V020_item(expr,expr_token);
Jeff Law committed
3556

3557
   Implement output-list expression.  */
Jeff Law committed
3558 3559

void
3560
ffestd_V020_item (ffebld expr UNUSED)
Jeff Law committed
3561 3562 3563 3564
{
  ffestd_check_item_ ();
}

3565
/* ffestd_V020_finish -- TYPE statement list complete
Jeff Law committed
3566

3567
   ffestd_V020_finish();
Jeff Law committed
3568 3569 3570 3571

   Just wrap up any local activities.  */

void
3572
ffestd_V020_finish ()
Jeff Law committed
3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619
{
  ffestd_check_finish_ ();
}

/* ffestd_V027_start -- VXT PARAMETER statement list begin

   ffestd_V027_start();

   Verify that PARAMETER is valid here, and begin accepting items in the list.	*/

void
ffestd_V027_start ()
{
  ffestd_check_start_ ();
  ffestd_subr_vxt_ ();
}

/* ffestd_V027_item -- VXT PARAMETER statement assignment

   ffestd_V027_item(dest,dest_token,source,source_token);

   Make sure the source is a valid source for the destination; make the
   assignment.	*/

void
ffestd_V027_item (ffelexToken dest_token UNUSED, ffebld source UNUSED)
{
  ffestd_check_item_ ();
}

/* ffestd_V027_finish -- VXT PARAMETER statement list complete

   ffestd_V027_finish();

   Just wrap up any local activities.  */

void
ffestd_V027_finish ()
{
  ffestd_check_finish_ ();
}

/* Any executable statement.  */

void
ffestd_any ()
{
3620
  ffestdStmt_ stmt;
Jeff Law committed
3621

3622
  ffestd_check_simple_ ();
Jeff Law committed
3623

3624 3625 3626
  stmt = ffestd_stmt_new_ (FFESTD_stmtidR841_);
  ffestd_stmt_append_ (stmt);
  ffestd_subr_line_save_ (stmt);
Jeff Law committed
3627
}