rpm  5.4.15
rpmlua.h
Go to the documentation of this file.
1 #ifndef RPMLUA_H
2 #define RPMLUA_H
3 
4 typedef enum rpmluavType_e {
9 
10 #if defined(_RPMLUA_INTERNAL)
11 
12 #include <stdarg.h>
13 #include <lua.h>
14 
15 struct rpmlua_s {
16  struct rpmioItem_s _item;
17  lua_State *L;
18  int pushsize;
19  int storeprint;
20  size_t printbufsize;
21  size_t printbufused;
22 /*@relnull@*/
23  char *printbuf;
24 #if defined(__LCLINT__)
25 /*@refs@*/
26  int nrefs;
27 #endif
28 };
29 
30 struct rpmluav_s {
31  struct rpmioItem_s _item;
32  rpmluavType keyType;
33  rpmluavType valueType;
34  union {
35  const char *str;
36  const void *ptr;
37  double num;
38  } key;
39  union {
40  const char *str;
41  const void *ptr;
42  double num;
43  } value;
44  int listmode;
45 #if defined(__LCLINT__)
46 /*@refs@*/
47  int nrefs;
48 #endif
49 };
50 
51 #endif /* _RPMLUA_INTERNAL */
52 
53 typedef /*@abstract@*/ struct rpmlua_s * rpmlua;
54 typedef /*@abstract@*/ struct rpmluav_s * rpmluav;
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
60 /*@unchecked@*/ /*@observer@*/
61 extern const char * rpmluaFiles;
62 
63 /*@unchecked@*/ /*@observer@*/
64 extern const char * rpmluaPath;
65 
66 /*@-exportlocal@*/
67 /*@only@*/ /*@exposed@*/ /*@relnull@*/
68 rpmlua rpmluaGetGlobalState(void)
69  /*@*/;
70 
71 rpmlua rpmluaNew(void)
72  /*@globals fileSystem, internalState @*/
73  /*@modifies fileSystem, internalState @*/;
74 /*@=exportlocal@*/
75 /*@null@*/
76 void *rpmluaFree(/*@only@*/ rpmlua lua)
77  /*@globals internalState @*/
78  /*@modifies lua, internalState @*/;
79 
80 int rpmluaCheckScript(/*@null@*/ rpmlua _lua, const char *script,
81  /*@null@*/ const char *name)
82  /*@globals fileSystem, internalState @*/
83  /*@modifies _lua, fileSystem, internalState @*/;
84 int rpmluaRunScript(/*@null@*/ rpmlua _lua, const char *script,
85  /*@null@*/ const char *name)
86  /*@globals fileSystem, internalState @*/
87  /*@modifies _lua, fileSystem, internalState @*/;
88 /*@-exportlocal@*/
89 int rpmluaRunScriptFile(/*@null@*/ rpmlua _lua, const char *filename)
90  /*@globals fileSystem, internalState @*/
91  /*@modifies _lua, fileSystem, internalState @*/;
92 /*@=exportlocal@*/
93 void rpmluaInteractive(/*@null@*/ rpmlua _lua)
94  /*@globals fileSystem, internalState @*/
95  /*@modifies _lua, fileSystem, internalState @*/;
96 
97 /*@null@*/
98 void *rpmluaGetData(/*@null@*/ rpmlua _lua, const char *key)
99  /*@globals fileSystem, internalState @*/
100  /*@modifies _lua, fileSystem, internalState @*/;
101 /*@-exportlocal@*/
102 void rpmluaSetData(/*@null@*/ rpmlua _lua, const char *key, const void *data)
103  /*@globals fileSystem, internalState @*/
104  /*@modifies _lua, fileSystem, internalState @*/;
105 /*@=exportlocal@*/
106 
107 /*@exposed@*/
108 const char *rpmluaGetPrintBuffer(/*@null@*/ rpmlua _lua)
109  /*@globals fileSystem, internalState @*/
110  /*@modifies _lua, fileSystem, internalState @*/;
111 void rpmluaSetPrintBuffer(/*@null@*/ rpmlua _lua, int flag)
112  /*@globals fileSystem, internalState @*/
113  /*@modifies _lua, fileSystem, internalState @*/;
114 
115 void rpmluaGetVar(/*@null@*/ rpmlua _lua, rpmluav var)
116  /*@globals fileSystem, internalState @*/
117  /*@modifies _lua, var, fileSystem, internalState @*/;
118 void rpmluaSetVar(/*@null@*/ rpmlua _lua, rpmluav var)
119  /*@globals fileSystem, internalState @*/
120  /*@modifies _lua, var, fileSystem, internalState @*/;
121 void rpmluaDelVar(/*@null@*/ rpmlua _lua, const char *key, ...)
122  /*@globals fileSystem, internalState @*/
123  /*@modifies _lua, fileSystem, internalState @*/;
124 int rpmluaVarExists(/*@null@*/ rpmlua _lua, const char *key, ...)
125  /*@globals fileSystem, internalState @*/
126  /*@modifies _lua, fileSystem, internalState @*/;
127 void rpmluaPushTable(/*@null@*/ rpmlua _lua, const char *key, ...)
128  /*@globals fileSystem, internalState @*/
129  /*@modifies _lua, fileSystem, internalState @*/;
130 void rpmluaPop(/*@null@*/ rpmlua _lua)
131  /*@globals fileSystem, internalState @*/
132  /*@modifies _lua, fileSystem, internalState @*/;
133 
134 /*@only@*/
135 rpmluav rpmluavNew(void)
136  /*@*/;
137 /*@null@*/
138 void * rpmluavFree(/*@only@*/ rpmluav var)
139  /*@modifes var @*/;
140 void rpmluavSetListMode(rpmluav var, int flag)
141  /*@modifies var @*/;
142 /*@-exportlocal@*/
143 void rpmluavSetKey(rpmluav var, rpmluavType type, const void *value)
144  /*@modifies var @*/;
145 /*@=exportlocal@*/
146 /*@-exportlocal@*/
147 void rpmluavSetValue(rpmluav var, rpmluavType type, const void *value)
148  /*@modifies var @*/;
149 /*@=exportlocal@*/
150 /*@-exportlocal@*/
151 void rpmluavGetKey(rpmluav var, /*@out@*/ rpmluavType *type, /*@out@*/ void **value)
152  /*@modifies *type, *value @*/;
153 /*@=exportlocal@*/
154 /*@-exportlocal@*/
155 void rpmluavGetValue(rpmluav var, /*@out@*/ rpmluavType *type, /*@out@*/ void **value)
156  /*@modifies *type, *value @*/;
157 /*@=exportlocal@*/
158 
159 /* Optional helpers for numbers. */
160 void rpmluavSetKeyNum(rpmluav var, double value)
161  /*@modifies var @*/;
162 void rpmluavSetValueNum(rpmluav var, double value)
163  /*@modifies var @*/;
164 double rpmluavGetKeyNum(rpmluav var)
165  /*@*/;
166 double rpmluavGetValueNum(rpmluav var)
167  /*@*/;
168 int rpmluavKeyIsNum(rpmluav var)
169  /*@*/;
170 int rpmluavValueIsNum(rpmluav var)
171  /*@*/;
172 
173 #ifdef __cplusplus
174 }
175 #endif
176 
177 #endif /* RPMLUA_H */
void rpmluavGetKey(rpmluav var, rpmluavType *type, void **value)
int rpmluaCheckScript(rpmlua _lua, const char *script, const char *name)
enum rpmluavType_e rpmluavType
const char * rpmluaPath
void rpmluavSetValueNum(rpmluav var, double value)
void * rpmluavFree(rpmluav var)
void rpmluaSetPrintBuffer(rpmlua _lua, int flag)
void rpmluaGetVar(rpmlua _lua, rpmluav var)
void rpmluavSetListMode(rpmluav var, int flag)
void rpmluavSetKey(rpmluav var, rpmluavType type, const void *value)
rpmlua rpmluaGetGlobalState(void)
void * rpmluaGetData(rpmlua _lua, const char *key)
double rpmluavGetValueNum(rpmluav var)
void rpmluavSetKeyNum(rpmluav var, double value)
void rpmluaPushTable(rpmlua _lua, const char *key,...)
void rpmluavSetValue(rpmluav var, rpmluavType type, const void *value)
void rpmluaPop(rpmlua _lua)
const char * str
Definition: bson.h:593
double rpmluavGetKeyNum(rpmluav var)
const char const bson * data
Definition: mongo.h:463
struct rpmluav_s * rpmluav
Definition: rpmlua.h:54
const char * rpmluaGetPrintBuffer(rpmlua _lua)
const char * rpmluaFiles
rpmluav rpmluavNew(void)
void * rpmluaFree(rpmlua lua)
rpmluavType_e
Definition: rpmlua.h:4
void rpmluaInteractive(rpmlua _lua)
void rpmluaDelVar(rpmlua _lua, const char *key,...)
rpmlua rpmluaNew(void)
void rpmluaSetData(rpmlua _lua, const char *key, const void *data)
#define L(CS)
Definition: fnmatch.c:161
const char const bson * key
Definition: mongo.h:717
int rpmluaVarExists(rpmlua _lua, const char *key,...)
void rpmluaSetVar(rpmlua _lua, rpmluav var)
int rpmluavKeyIsNum(rpmluav var)
int rpmluavValueIsNum(rpmluav var)
const char char type
Definition: bson.h:908
struct rpmlua_s * rpmlua
Definition: rpmlua.h:53
int rpmluaRunScriptFile(rpmlua _lua, const char *filename)
static const char * name
void rpmluavGetValue(rpmluav var, rpmluavType *type, void **value)
int rpmluaRunScript(rpmlua _lua, const char *script, const char *name)
const char const bson int num
Definition: mongo.h:485