snoot: immed_and_type_for_C_intconst: properly parse "0"
[suif.git] / html / suif1_8.html
blob02c12e751b62eb240541cefe8b1872a0910fd453
1 <HTML>
2 <HEAD>
3 <!-- This HTML file has been created by texi2html 1.54
4 from suif1.texi on 28 April 1999 -->
6 <TITLE>The SUIF Version 1 Library - File Set</TITLE>
7 <link href="suif1_9.html" rel=Next>
8 <link href="suif1_7.html" rel=Previous>
9 <link href="suif1_toc.html" rel=ToC>
11 </HEAD>
12 <BODY>
13 <p>Go to the <A HREF="suif1_1.html">first</A>, <A HREF="suif1_7.html">previous</A>, <A HREF="suif1_9.html">next</A>, <A HREF="suif1_113.html">last</A> section, <A HREF="suif1_toc.html">table of contents</A>.
14 <P><HR><P>
17 <H2><A NAME="SEC8" HREF="suif1_toc.html#TOC8">The File Set</A></H2>
18 <P>
19 <A NAME="IDX5"></A>
21 </P>
22 <P>
23 <A NAME="IDX6"></A>
24 <A NAME="IDX7"></A>
25 <A NAME="IDX8"></A>
26 <A NAME="IDX9"></A>
27 <A NAME="IDX10"></A>
28 The file set, which contains a list of file set entries, is implemented
29 by the <CODE>file_set</CODE> class. The list of files can be accessed
30 directly using the <CODE>file_list</CODE> method, but most users will not need
31 to do that because other methods are available to perform the common
32 operations. The <CODE>add_file</CODE> method adds a new file set entry to the
33 list. This method takes the names of the input file and output file and
34 returns the new file set entry. Either the input file or the output
35 file may be <CODE>NULL</CODE>. The <CODE>file_set</CODE> class also contains an
36 iterator, as most SUIF programmers will want to iterate through the list
37 of files. The <CODE>reset_iter</CODE> method resets the iterator to the first
38 file set entry. The <CODE>next_file</CODE> method returns the next file set
39 entry in the list.
41 </P>
42 <P>
43 <A NAME="IDX11"></A>
44 Besides the list of files, the file set also contains the global symbol
45 table (see section <A HREF="suif1_42.html#SEC42">The Global Symbol Table</A>) which can be accessed using the
46 <CODE>globals</CODE> method. This symbol table contains the symbols and types
47 that are visible in all of the source files. Before a group of files
48 can be combined into a file set, their global symbol tables must be
49 merged together. A separate SUIF linker is provided for this purpose.
50 The library will complain if the files in the file set have not been
51 properly linked.
53 </P>
54 <P>
55 <A NAME="IDX12"></A>
56 Currently, only one file set is allowed per SUIF program. This
57 restriction was made so that predefined types could be entered into the
58 global symbol table at initialization time. See section <A HREF="suif1_68.html#SEC68">Predefined Types</A>.
59 If multiple file sets were permitted, these predefined types would be
60 duplicated. A single global file set is created when the SUIF library
61 is initialized; the <CODE>fileset</CODE> global variable points to this file
62 set.
64 </P>
65 <P>
66 All of the low-level access to SUIF files is performed automatically by
67 the library. The global and file symbol tables are read from the input
68 files when they are added to the file set. Users can then read and
69 write individual procedure bodies using methods on the procedure symbols
70 (see section <A HREF="suif1_53.html#SEC53">Procedure Symbols</A>). The global symbol tables are not written
71 out until the file set is destroyed. Throughout this process, the file
72 set keeps track of the number of open files in order to avoid exceeding
73 the OS limit. If there are too many files open at once, the file set
74 will automatically find one to close. This is totally invisible to
75 users. Files that are temporarily closed are automatically reopened as
76 needed.
78 </P>
79 <P>
80 As an example of using the file set, the following code reads in the
81 files <CODE>infile1</CODE> and <CODE>infile2</CODE> and writes them out to
82 <CODE>outfile1</CODE> and <CODE>outfile2</CODE>, respectively, after processing them
83 with the user-defined routine <CODE>process_file</CODE>.
85 </P>
87 <PRE>
88 fileset-&#62;add_file("infile1", "outfile1");
89 fileset-&#62;add_file("infile2", "outfile2");
91 file_set_entry *fse;
93 fileset-&#62;reset_iter();
94 while (fse = fileset-&#62;next_file()) {
95 process_file(fse);
98 delete fileset;
99 </PRE>
101 <P><HR><P>
102 <p>Go to the <A HREF="suif1_1.html">first</A>, <A HREF="suif1_7.html">previous</A>, <A HREF="suif1_9.html">next</A>, <A HREF="suif1_113.html">last</A> section, <A HREF="suif1_toc.html">table of contents</A>.
103 </BODY>
104 </HTML>