rpm 5.2.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

rpmmacro.h
Go to the documentation of this file.
1 #ifndef _H_MACRO_
2 #define _H_MACRO_
3
7 typedef /*@abstract@*/ struct MacroEntry_s * MacroEntry;
8 typedef /*@abstract@*/ struct MacroContext_s * MacroContext;
9
10 #if defined(_MACRO_INTERNAL)
11
12 struct MacroEntry_s {
13 struct MacroEntry_s *prev;
14 const char *name;
15 const char *opts;
16 const char *body;
17 int used;
18 short level;
19 unsigned short flags;
20 };
21
23 struct MacroContext_s {
24 /*@owned@*//*@null@*/
25 MacroEntry *macroTable;
26 int macrosAllocated;
27 int firstFree;
28 };
29 #endif
30
31 /*@-redecl@*/
32 /*@checked@*/
33 extern MacroContext rpmGlobalMacroContext;
34
35 /*@checked@*/
36 extern MacroContext rpmCLIMacroContext;
37
43 /*@observer@*/ /*@checked@*/
44 extern const char * rpmMacrofiles;
45 /*@=redecl@*/
46
50 #define RMIL_DEFAULT -15
51 #define RMIL_MACROFILES -13
52 #define RMIL_RPMRC -11
53
54 #define RMIL_CMDLINE -7
55 #define RMIL_TARBALL -5
56 #define RMIL_SPEC -3
57 #define RMIL_OLDSPEC -1
58 #define RMIL_GLOBAL 0
59
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63
69 void rpmDumpMacroTable(/*@null@*/ MacroContext mc, /*@null@*/ FILE * fp)
70 /*@globals rpmGlobalMacroContext, fileSystem @*/
71 /*@modifies *fp, fileSystem @*/;
72
81 int
82 rpmGetMacroEntries(/*@null@*/ MacroContext mc, /*@null@*/ void * _mire,
83 int used, /*@null@*/ const char *** avp)
84 /*@globals rpmGlobalMacroContext @*/
85 /*@modifies _mire, *avp @*/;
86
92 int rpmSecuritySaneFile(const char *filename)
93 /*@globals internalState @*/;
94
102 int rpmGlob(const char * patterns, /*@out@*/ int * argcPtr,
103 /*@out@*/ const char *** argvPtr)
104 /*@globals fileSystem, internalState @*/
105 /*@modifies *argcPtr, *argvPtr, fileSystem, internalState @*/;
106
117 int expandMacros(/*@null@*/ void * spec, /*@null@*/ MacroContext mc,
118 /*@in@*/ /*@out@*/ char * sbuf, size_t slen)
119 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
120 /*@modifies *sbuf, rpmGlobalMacroContext, fileSystem, internalState @*/;
121
131 void addMacro(/*@null@*/ MacroContext mc, const char * n,
132 /*@null@*/ const char * o, /*@null@*/ const char * b, int level)
133 /*@globals rpmGlobalMacroContext, internalState @*/
134 /*@modifies mc, rpmGlobalMacroContext, internalState @*/;
135
141 void delMacro(/*@null@*/ MacroContext mc, const char * n)
142 /*@globals rpmGlobalMacroContext @*/
143 /*@modifies mc, rpmGlobalMacroContext @*/;
144
152 int rpmDefineMacro(/*@null@*/ MacroContext mc, const char * macro, int level)
153 /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
154 /*@modifies mc, rpmGlobalMacroContext, internalState @*/;
155
162 int rpmUndefineMacro(/*@null@*/ MacroContext mc, const char * macro)
163 /*@globals rpmGlobalMacroContext, internalState @*/
164 /*@modifies mc, rpmGlobalMacroContext, internalState @*/;
165
171 void rpmLoadMacros(/*@null@*/ MacroContext mc, int level)
172 /*@globals rpmGlobalMacroContext, internalState @*/
173 /*@modifies rpmGlobalMacroContext, internalState @*/;
174
180 int rpmLoadMacroFile(/*@null@*/ MacroContext mc, const char * fn)
181 /*@globals rpmGlobalMacroContext,
182 h_errno, fileSystem, internalState @*/
183 /*@modifies mc, rpmGlobalMacroContext, fileSystem, internalState @*/;
184
190 void rpmInitMacros(/*@null@*/ MacroContext mc, const char * macrofiles)
191 /*@globals rpmGlobalMacroContext, rpmCLIMacroContext,
192 h_errno, fileSystem, internalState @*/
193 /*@modifies mc, rpmGlobalMacroContext, fileSystem, internalState @*/;
194
199 void rpmFreeMacros(/*@null@*/ MacroContext mc)
200 /*@globals rpmGlobalMacroContext @*/
201 /*@modifies mc, rpmGlobalMacroContext @*/;
202
203 typedef enum rpmCompressedMagic_e {
204 COMPRESSED_NOT = 0,
205 COMPRESSED_OTHER = 1,
206 COMPRESSED_BZIP2 = 2,
207 COMPRESSED_ZIP = 3,
208 COMPRESSED_LZOP = 4,
209 COMPRESSED_LZMA = 5,
210 COMPRESSED_XZ = 6
211 } rpmCompressedMagic;
212
219 int isCompressed(const char * file, /*@out@*/ rpmCompressedMagic * compressed)
220 /*@globals h_errno, fileSystem, internalState @*/
221 /*@modifies *compressed, fileSystem, internalState @*/;
222
228 char * rpmExpand(/*@null@*/ const char * arg, ...)
229 #if defined(__GNUC__) && __GNUC__ >= 4
230 /* issue a warning if the list is not NULL-terminated */
231 __attribute__((sentinel))
232 #endif
233 /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
234 /*@modifies rpmGlobalMacroContext, internalState @*/;
235
242 char * rpmMCExpand(/*@null@*/ MacroContext mc, /*@null@*/ const char * arg, ...)
243 #if defined(__GNUC__) && __GNUC__ >= 4
244 /* issue a warning if the list is not NULL-terminated */
245 __attribute__((sentinel))
246 #endif
247 /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
248 /*@modifies rpmGlobalMacroContext, internalState @*/;
249
255 /*@null@*/
256 char * rpmCleanPath(/*@returned@*/ /*@null@*/ char * path)
257 /*@modifies *path @*/;
258
264 /*@-redecl@*/ /* LCL: shrug */
265 const char * rpmGetPath(/*@null@*/ const char * path, ...)
266 #if defined(__GNUC__) && __GNUC__ >= 4
267 /* issue a warning if the list is not NULL-terminated */
268 __attribute__((sentinel))
269 #endif
270 /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
271 /*@modifies rpmGlobalMacroContext, internalState @*/;
272 /*@=redecl@*/
273
284 /*@-redecl@*/ /* LCL: shrug */
285 const char * rpmGenPath(/*@null@*/ const char * urlroot,
286 /*@null@*/ const char * urlmdir,
287 /*@null@*/ const char * urlfile)
288 /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
289 /*@modifies rpmGlobalMacroContext, internalState @*/;
290 /*@=redecl@*/
291
299 int rpmExpandNumeric (const char * arg)
300 /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
301 /*@modifies rpmGlobalMacroContext, internalState @*/;
302
303 #ifdef __cplusplus
304 }
305 #endif
306
307 #endif /* _H_ MACRO_ */