Go to the first, previous, next, last section, table of contents.


Procedure Iterators

Most SUIF programs work on one procedure at a time. These programs require basically the same code to iterate through the file set entries and procedures. The suif_proc_iter routine is provided to handle this common case.

Before calling the procedure iterator, you must initialize the SUIF library (see section Initialization and Finalization), which also parses and removes some standard options from the command-line arguments. Either the SUIF library's command-line parser (see section Command-Line Parser) or the getopt function (from the standard C library) may be called before the procedure iterator to parse command-line options not removed by the library initialization. The suif_proc_iter function then reads the input and output file names from the command-line. The first file name on the command line is treated as an input file. If the writeback flag is set, the second file is treated as an output file and any additional file names on the command line are alternately treated as input and output files. If the writeback flag is not set, all the file names are treated as input files.

The procedure bodies are then read one at a time and processed by a user-specified function. This function must be of the type prociter_f, which takes a single tree_proc argument and has a void return type. When a procedure is read, the exp_trees and use_fortran_form parameters are passed on to the read_proc method for the proc_sym. The exp_trees argument specifies whether the procedure bodies are converted to expression trees (see section Expression Trees), and the use_fortran_form argument determines whether Fortran form is used (see section Features for Compiling Fortran). The defaults are to create expression trees but not to use Fortran form. If the writeback flag is set, the procedure bodies are written to the output files after they have been processed.


Go to the first, previous, next, last section, table of contents.