rpm  4.5
rpmfc.h
Go to the documentation of this file.
1 #ifndef _H_RPMFC_
2 #define _H_RPMFC_
3 
4 #include <regex.h>
5 #undef FILE_RCSID
6 #include "magic.h"
7 
8 /*@-exportlocal@*/
9 /*@unchecked@*/
10 extern int _rpmfc_debug;
11 /*@=exportlocal@*/
12 
15 typedef /*@abstract@*/ struct rpmfc_s * rpmfc;
16 
19 typedef enum FCOLOR_e FCOLOR_t;
20 
23 typedef struct rpmfcTokens_s * rpmfcToken;
24 
27 enum FCOLOR_e {
29  RPMFC_ELF32 = (1 << 0),
30  RPMFC_ELF64 = (1 << 1),
31  RPMFC_ELFMIPSN32 = (1 << 2),
33 
34  /* bits 4-7 unused */
35  RPMFC_DESKTOP_FILE = (1 << 7), /* XXX */
36 
37  RPMFC_PKGCONFIG = (1 << 8),
38  RPMFC_LIBTOOL = (1 << 9),
39  RPMFC_BOURNE = (1 << 10),
40  RPMFC_MONO = (1 << 11),
41 
42  RPMFC_SCRIPT = (1 << 12),
43  RPMFC_STATIC = (1 << 13),
44  RPMFC_NOTSTRIPPED = (1 << 14),
45  /* bit 15 unused */
46 
47  /* bits 16-19 are enumerated, not bits */
48  RPMFC_DIRECTORY = (1 << 16),
49  RPMFC_SYMLINK = (2 << 16),
50  RPMFC_DEVICE = (3 << 16),
51  RPMFC_LIBRARY = (4 << 16),
52  RPMFC_FONT = (5 << 16),
53  RPMFC_IMAGE = (6 << 16),
54  RPMFC_MANPAGE = (7 << 16),
55  RPMFC_TEXT = (8 << 16),
56  RPMFC_DOCUMENT = (9 << 16),
57 
58  RPMFC_ARCHIVE = (1 << 20),
59  RPMFC_COMPRESSED = (1 << 21),
60  RPMFC_MODULE = (1 << 22),
61  RPMFC_EXECUTABLE = (1 << 23),
62 
63  RPMFC_PERL = (1 << 24),
64  RPMFC_JAVA = (1 << 25),
65  RPMFC_PYTHON = (1 << 26),
66  RPMFC_PHP = (1 << 27),
67  RPMFC_TCL = (1 << 28),
68 
69  RPMFC_WHITE = (1 << 29),
70  RPMFC_INCLUDE = (1 << 30),
71  RPMFC_ERROR = (1 << 31)
72 };
73 
74 #if defined(_RPMFC_INTERNAL)
75 
77 struct rpmfc_s {
78  int nfiles;
79  int fknown;
80  int fwhite;
81  int ix;
82  int skipProv;
83  int skipReq;
84  int tracked;
85  size_t brlen;
87  ARGV_t fn;
88  ARGI_t fcolor;
89  ARGI_t fcdictx;
90  ARGI_t fddictx;
91  ARGI_t fddictn;
92  ARGV_t cdict;
93  ARGV_t ddict;
94  ARGI_t ddictx;
96 /*@relnull@*/
97  rpmds provides;
98 /*@relnull@*/
99  rpmds requires;
101  StringBuf sb_java;
102  StringBuf sb_perl;
103  StringBuf sb_python;
104  StringBuf sb_php;
106  int findprov, findreq;
107  regex_t *noautoprov;
108  int noautoprov_c;
109  regex_t *noautoreq;
110  int noautoreq_c;
111 };
112 
115 struct rpmfcTokens_s {
116 /*@observer@*/
117  const char * token;
118  int colors;
119 };
120 #endif
121 
122 #ifdef __cplusplus
123 extern "C" {
124 #endif
125 
133 int rpmfcExec(ARGV_t av, StringBuf sb_stdin, /*@out@*/ StringBuf * sb_stdoutp,
134  int failnonzero)
135  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
136  /*@modifies *sb_stdoutp, rpmGlobalMacroContext,
137  fileSystem, internalState @*/
138  /*@requires maxSet(sb_stdoutp) >= 0 @*/;
139 
145 /*@-exportlocal@*/
146 int rpmfcColoring(const char * fmstr)
147  /*@*/;
148 /*@=exportlocal@*/
149 
157 /*@-exportlocal@*/
158 void rpmfcPrint(/*@null@*/ const char * msg, rpmfc fc, /*@null@*/ FILE * fp)
159  /*@globals fileSystem @*/
160  /*@modifies *fp, fc, fileSystem @*/;
161 /*@=exportlocal@*/
162 
168 /*@-exportlocal@*/
169 /*@null@*/
170 rpmfc rpmfcFree(/*@only@*/ /*@null@*/ rpmfc fc)
171  /*@modifies fc @*/;
172 /*@=exportlocal@*/
173 
178 /*@-exportlocal@*/
179 rpmfc rpmfcNew(void)
180  /*@*/;
181 /*@=exportlocal@*/
182 
190 /*@-exportlocal@*/
191 int rpmfcClassify(rpmfc fc, ARGV_t argv, /*@null@*/ int16_t * fmode)
192  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
193  /*@modifies fc, rpmGlobalMacroContext, fileSystem, internalState @*/;
194 /*@=exportlocal@*/
195 
201 /*@-exportlocal@*/
202 int rpmfcApply(rpmfc fc)
203  /*@modifies fc @*/;
204 /*@=exportlocal@*/
205 
212 int rpmfcGenerateDepends(void * specp, void * pkgp)
213  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
214  /*@modifies *pkgp,
215  rpmGlobalMacroContext, fileSystem, internalState @*/;
216 
217 #ifdef __cplusplus
218 }
219 #endif
220 
221 #endif /* _H_RPMFC_ */