1 /*-----------------------------------------------------------------------
2 
3 File  : cio_filevars.h
4 
5 Author: Stephan Schulz
6 
7 Contents
8 
9   Functions for managing file-stored "variable = value;" pairs.
10 
11   Copyright 1998, 1999 by the author.
12   This code is released under the GNU General Public Licence and
13   the GNU Lesser General Public License.
14   See the file COPYING in the main E directory for details..
15   Run "eprover -h" for contact information.
16 
17 Changes
18 
19 <1> Thu Apr  8 16:00:49 MET DST 1999
20     New
21 
22 -----------------------------------------------------------------------*/
23 
24 #ifndef CIO_FILEVARS
25 
26 #define CIO_FILEVARS
27 
28 #include <clb_stringtrees.h>
29 #include <clb_pstacks.h>
30 #include <cio_basicparser.h>
31 
32 
33 /*---------------------------------------------------------------------*/
34 /*                    Data type declarations                           */
35 /*---------------------------------------------------------------------*/
36 
37 typedef struct filevarscell
38 {
39    PStack_p  names; /* Of sources, for error messages */
40    StrTree_p vars;  /* Storing (ident, value) pairs */
41 }FileVarsCell, *FileVars_p;
42 
43 
44 
45 /*---------------------------------------------------------------------*/
46 /*                Exported Functions and Variables                     */
47 /*---------------------------------------------------------------------*/
48 
49 
50 #define FileVarsCellAlloc() (FileVarsCell*)SizeMalloc(sizeof(FileVarsCell))
51 #define FileVarsCellFree(junk)        SizeFree(junk, sizeof(FileVarsCell))
52 
53 FileVars_p FileVarsAlloc(void);
54 void       FileVarsFree(FileVars_p handle);
55 long       FileVarsParse(Scanner_p in, FileVars_p vars);
56 long       FileVarsReadFromFile(char* file, FileVars_p vars);
57 bool       FileVarsGetBool(FileVars_p vars, char* name, bool *value);
58 bool       FileVarsGetInt(FileVars_p vars, char* name,  long *value);
59 bool       FileVarsGetStr(FileVars_p vars, char* name,  char **value);
60 bool       FileVarsGetIdentifier(FileVars_p vars, char* name,  char
61              **value);
62 
63 #endif
64 
65 /*---------------------------------------------------------------------*/
66 /*                        End of File                                  */
67 /*---------------------------------------------------------------------*/
68 
69 
70 
71 
72 
73