1 |
/* RCSid $Id$ */ |
2 |
/* |
3 |
* eplus_idf.h |
4 |
* |
5 |
* EnergyPlus Input Data File i/o declarations |
6 |
* |
7 |
* Created by Greg Ward on 1/31/14. |
8 |
*/ |
9 |
|
10 |
#ifndef _RAD_EPLUS_IDF_H_ |
11 |
#define _RAD_EPLUS_IDF_H_ |
12 |
|
13 |
#include "lookup.h" |
14 |
|
15 |
#ifdef __cplusplus |
16 |
extern "C" { |
17 |
#endif |
18 |
|
19 |
#define IDF_MAXLINE 512 /* maximum line length */ |
20 |
#define IDF_MAXARGL 128 /* maximum argument length */ |
21 |
|
22 |
/* Input Data File parameter argument list */ |
23 |
typedef struct s_idf_field { |
24 |
struct s_idf_field *next; /* next in parameter list */ |
25 |
char *rem; /* string following argument */ |
26 |
char arg[2]; /* argument (extends struct) */ |
27 |
} IDF_FIELD; |
28 |
|
29 |
/* Input Data File parameter */ |
30 |
typedef struct s_idf_parameter { |
31 |
const char *pname; /* parameter name (type) */ |
32 |
struct s_idf_parameter *pnext; /* next parameter same type */ |
33 |
struct s_idf_parameter *dnext; /* next parameter in IDF */ |
34 |
IDF_FIELD *flist; /* field list */ |
35 |
char rem[1]; /* comment (extends struct) */ |
36 |
} IDF_PARAMETER; |
37 |
|
38 |
/* Input Data File w/ dictionary */ |
39 |
typedef struct { |
40 |
char *hrem; /* header remarks */ |
41 |
IDF_PARAMETER *pfirst; /* first parameter in file */ |
42 |
IDF_PARAMETER *plast; /* last parameter loaded */ |
43 |
LUTAB ptab; /* parameter table */ |
44 |
} IDF_LOADED; |
45 |
|
46 |
/* Create a new parameter with empty field list (comment optional) */ |
47 |
extern IDF_PARAMETER *idf_newparam(IDF_LOADED *idf, const char *pname, |
48 |
const char *comm, |
49 |
IDF_PARAMETER *prev); |
50 |
|
51 |
/* Add a field to the given parameter and follow with the given text */ |
52 |
extern int idf_addfield(IDF_PARAMETER *param, const char *fval, |
53 |
const char *comm); |
54 |
|
55 |
/* Delete the specified parameter from our IDF */ |
56 |
extern int idf_delparam(IDF_LOADED *idf, IDF_PARAMETER *param); |
57 |
|
58 |
/* Get a named parameter list */ |
59 |
extern IDF_PARAMETER *idf_getparam(IDF_LOADED *idf, const char *pname); |
60 |
|
61 |
/* Read a parameter and fields from an open file and add to end of list */ |
62 |
extern IDF_PARAMETER *idf_readparam(IDF_LOADED *idf, FILE *fp); |
63 |
|
64 |
/* Initialize an IDF struct */ |
65 |
extern IDF_LOADED *idf_create(const char *hdrcomm); |
66 |
|
67 |
/* Load an Input Data File */ |
68 |
extern IDF_LOADED *idf_load(const char *fname); |
69 |
|
70 |
/* Write a parameter and fields to an open file */ |
71 |
int idf_writeparam(IDF_PARAMETER *param, FILE *fp); |
72 |
|
73 |
/* Write out an Input Data File */ |
74 |
extern int idf_write(IDF_LOADED *idf, const char *fname); |
75 |
|
76 |
/* Free a loaded IDF */ |
77 |
extern void idf_free(IDF_LOADED *idf); |
78 |
|
79 |
#ifdef __cplusplus |
80 |
} |
81 |
#endif |
82 |
#endif /* ! _RAD_EPLUS_IDF_H_ */ |