1 /* Header for module multfile, generated by p2c 1.21alpha-07.Dec.93 */
2 #ifndef MULTFILE_H
3 #define MULTFILE_H
4 
5 
6 #ifdef MULTFILE_G
7 # define vextern
8 #else
9 # define vextern extern
10 #endif
11 /* DPL 2004-03-06
12 (* Support for including files into an input stream.
13 (* Intended for an application that does not require Pascal formatting,
14 (*   but reads complete lines one at a time.
15 (* You never actually work with any files, except by supplying the
16 (    filename when the file is opened.
17 (* At any stage, you can switch the input to a new file.
18 (* When the new file is at EOF, and a "read" is issued, the file is
19 (*   closed and the previous one resumed transparently.    This inclusion
20 (*   can be nested to any level, memory permitting.
21 (* --- Normal mode of operation, replacing the usual Pascal style ---
22    Instead of:  assign(textfile,filename); reset(textfile)
23           use:  pushFile(filename)
24    When another file should be included before the current file is done,
25           use:  pushFile(newfilename)
26    Instead of:  readln(textfile,line)
27           use:  line:=readLine
28    Instead of:  eof(textfilen)
29            or:  eofAll;    {Are all files at EOF?}
30 (* --- Abnormal mode of operation ---
31    To abort a file before EOF is reached:
32           use:  popFile;
33    To abort all files:
34           use:  closeAll;
35    To test whether only the current file is at EOF:
36           use:  eofCurrent;
37 (* Additional features:
38    fileError: boolean function, was there an error during file open or read?
39    currentFilename: string function, name of current file
40    currentLineNo: integer function, number of line just read from current file
41    isEmpty(var s: string): boolean function, is s empty?
42    readData: string function, like readLine, but continue reading until
43      a non-blank line is found, return blank only at EOF
44    skipBlanks: skip blank lines in input: next call to readLine will be
45      non-blank unless EOF is encountered
46    report(items): procedure to control which messages are printed,
47      "items" is the sum of the following options
48      (constants with the appropriate values are defined in the interface)
49      1: reportnewfile - file is opened
50      2: reportoldfile - file is resumed
51      4: reportclose - file is closed
52      8: reporterror - a file error is encountered
53     16: reportrecursive - there is a recursive include
54         The default value is items=27 (all the above except reportclose)
55      At present you cannot turn reportrecursive off.
56    */
57 
58 extern void pushFile(Char *filename);
59 extern void popFile(void);
60 extern void closeAll(void);
61 extern void report(short items);
62 extern Char *currentFilename(Char *Result);
63 extern boolean eofAll(void);
64 extern boolean eofCurrent(void);
65 extern boolean fileError(void);
66 extern Char *readLine(Char *Result);
67 extern Char *readData(Char *Result);
68 extern boolean isEmpty(Char *s);
69 extern short currentLineNo(void);
70 extern void skipBlanks(void);
71 
72 
73 #define reportnewfile   1
74 #define reportoldfile   2
75 #define reportclose     4
76 #define reporterror     8
77 #define reportrecursive  16
78 
79 
80 extern Char nextData[256];
81 
82 
83 #undef vextern
84 
85 #endif /*MULTFILE_H*/
86 
87 /* End. */
88