Pristine Ack-5.5
[Ack-5.5.git] / modules / src / input / inp_pkg.spec
1 /*      This is the specification of the generic part of the input package.
2         It can be instantiated by #defining or not #defining
3         INP_TYPE, INP_VAR, INP_READ_IN_ONE, and INP_NPUSHBACK.
4         INP_TYPE is the type of the variable INP_VAR, which contains
5         all values the user wants to save when an InsertFile is done,
6         and restored when an input stream is continued after a suspend.
7         For instance, line numbers and position within a line might
8         be interesting.
9         Not defining INP_TYPE has the effect that the instantiation is
10         done without saving and restoring INP_VAR.
11         Defining INP_READ_IN_ONE has the effect that files will be read
12         completely with one "read". Only use this if you have lots of
13         memory. Not defining it causes files to be read in blocks, with
14         a suitable blocksize.
15         INP_NPUSHBACK is the number of PushBacks that are guaranteed
16         to work. Its default value is 1.
17 */
18
19 #include <ansi.h>
20
21 /* INPUT PRIMITIVES */
22
23 #define LoadChar(dest)  ((void)((dest = *_ipp++) || (dest = loadbuf())))
24 #define PushBack()      (--_ipp)
25 #define ChPushBack(ch)  (*--_ipp = (ch))
26
27 /*      EOI may be defined as -1 in most programs but the character -1 may
28         be expanded to the int -1 which causes troubles with indexing.
29 */
30 #define EOI     (0200)
31
32 extern char *_ipp;
33
34 _PROTOTYPE(int loadbuf, (void));
35 _PROTOTYPE(int AtEoIT, (void));
36 _PROTOTYPE(int AtEoIF, (void));
37 _PROTOTYPE(int InsertFile, (char *, char **, char **));
38 _PROTOTYPE(int InsertText, (char *, int));
39
40 /*      int InsertFile(filename, table, result)
41                 char *filename; 
42                 char **table;
43                 char **result;
44         
45         This function suspends input from the current input stream. The next
46         characters are obtained from the file indicated by "filename". This file
47         will be looked for in the directories, mentioned in the null-terminated
48         list indicated by "table". It returns 1 if it succeeds, 0 if it fails.
49         "result" will contain the full path if InsertFile returns 1.
50
51         int InsertText(text, length)
52                 char *text;
53                 int length;
54         This funtion suspends input from the current input stream. The next
55         input characters are obtained from the string indicated by "text",
56         whose length is indicated by "length".
57         It returns 1 if it succeeds, 0 if it fails.
58 */