lclint annotations.
[platform/upstream/rpm.git] / build / rpmspec.h
1 #ifndef _H_SPEC_
2 #define _H_SPEC_
3
4 typedef struct SpecStruct *Spec;
5 #include "rpmmacro.h"
6
7 #if 0
8 struct ReqProvTrigger {
9     int flags;
10     char *name;
11     char *version;
12     int index;      /* Only used for triggers */
13     struct ReqProvTrigger *next;
14 };
15 #endif
16
17 struct TriggerFileEntry {
18     int index;
19     /*@only@*/ char *fileName;
20     /*@only@*/ char *script;
21     /*@only@*/ char *prog;
22     /*@owned@*/ struct TriggerFileEntry *next;
23 };
24
25 #define RPMBUILD_ISSOURCE     1
26 #define RPMBUILD_ISPATCH     (1 << 1)
27 #define RPMBUILD_ISICON      (1 << 2)
28 #define RPMBUILD_ISNO        (1 << 3)
29
30 #define RPMBUILD_DEFAULT_LANG "C"
31
32 struct Source {
33     /*@owned@*/ char *fullSource;
34     /*@dependent@*/ char *source;     /* Pointer into fullSource */
35     int flags;
36     int num;
37     /*@owned@*/ struct Source *next;
38 };
39
40 typedef struct ReadLevelEntry {
41     int reading;
42     /*@dependent@*/ struct ReadLevelEntry *next;
43 } RLE_t;
44
45 typedef struct OpenFileInfo {
46     /*@only@*/ char *fileName;
47     /*@dependent@*/ FILE *file;
48     int lineNum;
49     char readBuf[BUFSIZ];
50     /*@dependent@*/ char *readPtr;
51     /*@owned@*/ struct OpenFileInfo *next;
52 } OFI_t;
53
54 struct spectag {
55     int t_tag;
56     int t_startx;
57     int t_nlines;
58     char *t_lang;
59     char *t_msgid;
60 };
61
62
63 struct spectags {
64     struct spectag *st_t;
65     int st_nalloc;
66     int st_ntags;
67 };
68
69 struct speclines {
70     /*@only@*/ char **sl_lines;
71     int sl_nalloc;
72     int sl_nlines;
73 };
74
75 struct SpecStruct {
76     /*@only@*/ char *specFile;
77     /*@only@*/ char *sourceRpmName;
78
79     struct speclines *sl;
80     struct spectags *st;
81
82     /*@owned@*/ struct OpenFileInfo *fileStack;
83     char lbuf[BUFSIZ];
84     char nextpeekc;
85     char *nextline;
86     char *line;
87     int lineNum;
88
89     /*@only@*/ struct ReadLevelEntry *readStack;
90
91     Header buildRestrictions;
92     /*@owned@*/ struct SpecStruct **buildArchitectureSpecs;
93     char ** buildArchitectures;
94     int buildArchitectureCount;
95     int inBuildArchitectures;
96
97     int force;
98     int anyarch;
99
100     int gotBuildRoot;
101     /*@only@*/ const char *buildRoot;
102     /*@only@*/ const char *buildSubdir;
103
104     char *passPhrase;
105     int timeCheck;
106     char *cookie;
107
108     /*@owned@*/ struct Source *sources;
109     int numSources;
110     int noSource;
111
112     Header sourceHeader;
113     int sourceCpioCount;
114     /*@owned@*/ struct cpioFileMapping *sourceCpioList;
115
116     /*@dependent@*/ struct MacroContext *macros;
117
118     /*@only@*/ StringBuf prep;
119     /*@only@*/ StringBuf build;
120     /*@only@*/ StringBuf install;
121     /*@only@*/ StringBuf clean;
122
123     /*@owned@*/ struct PackageStruct *packages;
124 };
125
126 struct PackageStruct {
127     /*@only@*/ Header header;
128
129     int cpioCount;
130     /*@only@*/ struct cpioFileMapping *cpioList;
131
132     /*@owned@*/ struct Source *icon;
133
134     int autoReq;
135     int autoProv;
136
137     char *preInFile;
138     char *postInFile;
139     char *preUnFile;
140     char *postUnFile;
141     char *verifyFile;
142
143     /*@only@*/ StringBuf specialDoc;
144
145 #if 0
146     struct ReqProvTrigger *triggers;
147     char *triggerScripts;
148 #endif
149
150     /*@only@*/ struct TriggerFileEntry *triggerFiles;
151
152     /*@only@*/ char *fileFile;
153     /*@only@*/ StringBuf fileList; /* If NULL, package will not be written */
154
155     /*@keep@*/ struct PackageStruct *next;
156 };
157
158 typedef struct PackageStruct *Package;
159
160 #ifdef __cplusplus
161 extern "C" {
162 #endif
163
164 /*@only@*/ Spec newSpec(void);
165 void freeSpec(/*@only@*/ Spec spec);
166 extern void (*freeSpecVec) (Spec spec); /* XXX FIXME */
167
168 struct OpenFileInfo * newOpenFileInfo(void);
169 struct spectag *stashSt(Spec spec, Header h, int tag, const char *lang);
170
171 int addSource(Spec spec, Package pkg, const char *field, int tag);
172 int parseNoSource(Spec spec, const char *field, int tag);
173
174 #ifdef __cplusplus
175 }
176 #endif
177
178 #endif /* _H_SPEC_ */