[4.0] Use strip (instead of eu-strip) to support --strip-debug of *.so at build time
[platform/upstream/rpm.git] / rpmio / rpmlua.h
1 #ifndef RPMLUA_H
2 #define RPMLUA_H
3
4 typedef enum rpmluavType_e {
5     RPMLUAV_NIL         = 0,
6     RPMLUAV_STRING      = 1,
7     RPMLUAV_NUMBER      = 2
8 } rpmluavType;
9
10 #if defined(_RPMLUA_INTERNAL)
11
12 #include <stdarg.h>
13 #include <lua.h>
14
15 typedef struct rpmluapb_s * rpmluapb;
16
17 struct rpmlua_s {
18     lua_State *L;
19     size_t pushsize;
20     rpmluapb printbuf;
21 };
22
23 struct rpmluav_s {
24     rpmluavType keyType;
25     rpmluavType valueType;
26     union {
27         const char *str;
28         const void *ptr;
29         double num;
30     } key;
31     union {
32         const char *str;
33         const void *ptr;
34         double num;
35     } value;
36     int listmode;
37 };
38
39 #endif /* _RPMLUA_INTERNAL */
40
41 typedef struct rpmlua_s * rpmlua;
42 typedef struct rpmluav_s * rpmluav;
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48 rpmlua rpmluaNew(void);
49 rpmlua rpmluaFree(rpmlua lua);
50 rpmlua rpmluaGetGlobalState(void);
51
52 int rpmluaCheckScript(rpmlua lua, const char *script,
53                       const char *name);
54 int rpmluaRunScript(rpmlua lua, const char *script,
55                     const char *name);
56 int rpmluaRunScriptFile(rpmlua lua, const char *filename);
57 void rpmluaInteractive(rpmlua lua);
58
59 void *rpmluaGetData(rpmlua lua, const char *key);
60 void rpmluaSetData(rpmlua lua, const char *key, const void *data);
61
62 char *rpmluaPopPrintBuffer(rpmlua lua);
63 void rpmluaPushPrintBuffer(rpmlua lua);
64
65 void rpmluaGetVar(rpmlua lua, rpmluav var);
66 void rpmluaSetVar(rpmlua lua, rpmluav var);
67 void rpmluaDelVar(rpmlua lua, const char *key, ...);
68 int rpmluaVarExists(rpmlua lua, const char *key, ...);
69 void rpmluaPushTable(rpmlua lua, const char *key, ...);
70 void rpmluaPop(rpmlua lua);
71
72 rpmluav rpmluavNew(void);
73 rpmluav rpmluavFree(rpmluav var);
74 void rpmluavSetListMode(rpmluav var, int flag);
75 void rpmluavSetKey(rpmluav var, rpmluavType type, const void *value);
76 void rpmluavSetValue(rpmluav var, rpmluavType type, const void *value);
77 void rpmluavGetKey(rpmluav var, rpmluavType *type, void **value);
78 void rpmluavGetValue(rpmluav var, rpmluavType *type, void **value);
79
80 /* Optional helpers for numbers. */
81 void rpmluavSetKeyNum(rpmluav var, double value);
82 void rpmluavSetValueNum(rpmluav var, double value);
83 double rpmluavGetKeyNum(rpmluav var);
84 double rpmluavGetValueNum(rpmluav var);
85 int rpmluavKeyIsNum(rpmluav var);
86 int rpmluavValueIsNum(rpmluav var);
87
88 #ifdef __cplusplus
89 }
90 #endif
91
92 #endif /* RPMLUA_H */