ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/eplus_idf.h
Revision: 2.3
Committed: Sun Feb 9 02:18:16 2014 UTC (10 years, 1 month ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.2: +7 -5 lines
Log Message:
Fixed bug in comment reader and added idf_getfield() call

File Contents

# Content
1 /* RCSid $Id: eplus_idf.h,v 2.2 2014/02/01 02:13:24 greg Exp $ */
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 104 /* 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 hash table */
44 } IDF_LOADED;
45
46 /* Create a new parameter with empty field list (comment & prev optional) */
47 extern IDF_PARAMETER *idf_newparam(IDF_LOADED *idf, const char *pname,
48 const char *comm, IDF_PARAMETER *prev);
49
50 /* Add a field to the given parameter and follow with the given text */
51 extern int idf_addfield(IDF_PARAMETER *param, const char *fval,
52 const char *comm);
53
54 /* Retrieve the indexed field from parameter (first field index is 1) */
55 extern IDF_FIELD *idf_getfield(IDF_PARAMETER *param, int fn);
56
57 /* Delete the specified parameter from our IDF */
58 extern int idf_delparam(IDF_LOADED *idf, IDF_PARAMETER *param);
59
60 /* Get a named parameter list */
61 extern IDF_PARAMETER *idf_getparam(IDF_LOADED *idf, const char *pname);
62
63 /* Read a parameter and fields from an open file and add to end of list */
64 extern IDF_PARAMETER *idf_readparam(IDF_LOADED *idf, FILE *fp);
65
66 /* Initialize an IDF struct */
67 extern IDF_LOADED *idf_create(const char *hdrcomm);
68
69 /* Load an Input Data File */
70 extern IDF_LOADED *idf_load(const char *fname);
71
72 /* Write a parameter and fields to an open file */
73 int idf_writeparam(IDF_PARAMETER *param, FILE *fp);
74
75 /* Write out an Input Data File */
76 extern int idf_write(IDF_LOADED *idf, const char *fname);
77
78 /* Free a loaded IDF */
79 extern void idf_free(IDF_LOADED *idf);
80
81 #ifdef __cplusplus
82 }
83 #endif
84 #endif /* ! _RAD_EPLUS_IDF_H_ */