ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/eplus_idf.h
Revision: 2.8
Committed: Sun Mar 6 01:13:18 2016 UTC (6 years, 6 months ago) by schorsch
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R2, rad5R1, rad5R3, HEAD
Changes since 2.7: +2 -1 lines
Log Message:
Prepare for SCons build on Win32 and Win64

File Contents

# Content
1 /* RCSid $Id: eplus_idf.h,v 2.7 2014/02/12 17:40:07 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 "platform.h"
14 #include "lookup.h"
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 #define IDF_MAXLINE 512 /* maximum line length */
21 #define IDF_MAXARGL 104 /* maximum argument length */
22
23 /* Input Data File object argument list */
24 typedef struct s_idf_field {
25 struct s_idf_field *next; /* next in object list */
26 char *rem; /* string following argument */
27 char val[2]; /* value (extends struct) */
28 } IDF_FIELD;
29
30 /* Input Data File object */
31 typedef struct s_idf_object {
32 const char *pname; /* object name (type) */
33 struct s_idf_object *pnext; /* next object same type */
34 struct s_idf_object *dnext; /* next object in IDF */
35 int nfield; /* field count */
36 IDF_FIELD *flist; /* field list */
37 char rem[1]; /* comment (extends struct) */
38 } IDF_OBJECT;
39
40 /* Input Data File w/ dictionary */
41 typedef struct {
42 char *hrem; /* header remarks */
43 IDF_OBJECT *pfirst; /* first object in file */
44 IDF_OBJECT *plast; /* last object loaded */
45 LUTAB ptab; /* object hash table */
46 } IDF_LOADED;
47
48 /* Create a new object with empty field list (comment & prev optional) */
49 extern IDF_OBJECT *idf_newobject(IDF_LOADED *idf, const char *pname,
50 const char *comm, IDF_OBJECT *prev);
51
52 /* Add a field to the given object and follow with the given text */
53 extern int idf_addfield(IDF_OBJECT *param, const char *fval,
54 const char *comm);
55
56 /* Retrieve the indexed field from object (first field index is 1) */
57 extern IDF_FIELD *idf_getfield(IDF_OBJECT *param, int fn);
58
59 /* Delete the specified object from the IDF */
60 extern int idf_delobject(IDF_LOADED *idf, IDF_OBJECT *param);
61
62 /* Move the specified object to the given position in the IDF */
63 extern int idf_movobject(IDF_LOADED *idf, IDF_OBJECT *param,
64 IDF_OBJECT *prev);
65
66 /* Get a named object list */
67 extern IDF_OBJECT *idf_getobject(IDF_LOADED *idf, const char *pname);
68
69 /* Read a object and fields from an open file and add to end of list */
70 extern IDF_OBJECT *idf_readobject(IDF_LOADED *idf, FILE *fp);
71
72 /* Initialize an IDF struct */
73 extern IDF_LOADED *idf_create(const char *hdrcomm);
74
75 /* Add comment(s) to header */
76 extern int idf_add2hdr(IDF_LOADED *idf, const char *hdrcomm);
77
78 /* Load an Input Data File */
79 extern IDF_LOADED *idf_load(const char *fname);
80
81 /* Write a object and fields to an open file */
82 int idf_writeparam(IDF_OBJECT *param, FILE *fp,
83 int incl_comm);
84
85 /* Write out an Input Data File */
86 extern int idf_write(IDF_LOADED *idf, const char *fname,
87 int incl_comm);
88
89 /* Free a loaded IDF */
90 extern void idf_free(IDF_LOADED *idf);
91
92 #ifdef __cplusplus
93 }
94 #endif
95 #endif /* ! _RAD_EPLUS_IDF_H_ */