summaryrefslogtreecommitdiff
path: root/rpmio/rpmlua.h
diff options
context:
space:
mode:
authorJinkun Jang <jinkun.jang@samsung.com>2013-03-12 15:17:20 +0900
committerJinkun Jang <jinkun.jang@samsung.com>2013-03-12 15:17:20 +0900
commit7df2385c2f6c93f96e00bc87f2086066cae89ecc (patch)
tree79d5c20a494622eb084de831a2a51530cd421e33 /rpmio/rpmlua.h
parentb7a3bffb8e0341b7e4ef69def268bca3a7f279ff (diff)
downloadrpm-submit/tizen_2.2/20130710.072219.tar.gz
rpm-submit/tizen_2.2/20130710.072219.tar.bz2
rpm-submit/tizen_2.2/20130710.072219.zip
Diffstat (limited to 'rpmio/rpmlua.h')
-rw-r--r--rpmio/rpmlua.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/rpmio/rpmlua.h b/rpmio/rpmlua.h
new file mode 100644
index 0000000..7298ed5
--- /dev/null
+++ b/rpmio/rpmlua.h
@@ -0,0 +1,92 @@
+#ifndef RPMLUA_H
+#define RPMLUA_H
+
+typedef enum rpmluavType_e {
+ RPMLUAV_NIL = 0,
+ RPMLUAV_STRING = 1,
+ RPMLUAV_NUMBER = 2
+} rpmluavType;
+
+#if defined(_RPMLUA_INTERNAL)
+
+#include <stdarg.h>
+#include <lua.h>
+
+typedef struct rpmluapb_s * rpmluapb;
+
+struct rpmlua_s {
+ lua_State *L;
+ size_t pushsize;
+ rpmluapb printbuf;
+};
+
+struct rpmluav_s {
+ rpmluavType keyType;
+ rpmluavType valueType;
+ union {
+ const char *str;
+ const void *ptr;
+ double num;
+ } key;
+ union {
+ const char *str;
+ const void *ptr;
+ double num;
+ } value;
+ int listmode;
+};
+
+#endif /* _RPMLUA_INTERNAL */
+
+typedef struct rpmlua_s * rpmlua;
+typedef struct rpmluav_s * rpmluav;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+rpmlua rpmluaNew(void);
+rpmlua rpmluaFree(rpmlua lua);
+rpmlua rpmluaGetGlobalState(void);
+
+int rpmluaCheckScript(rpmlua lua, const char *script,
+ const char *name);
+int rpmluaRunScript(rpmlua lua, const char *script,
+ const char *name);
+int rpmluaRunScriptFile(rpmlua lua, const char *filename);
+void rpmluaInteractive(rpmlua lua);
+
+void *rpmluaGetData(rpmlua lua, const char *key);
+void rpmluaSetData(rpmlua lua, const char *key, const void *data);
+
+char *rpmluaPopPrintBuffer(rpmlua lua);
+void rpmluaPushPrintBuffer(rpmlua lua);
+
+void rpmluaGetVar(rpmlua lua, rpmluav var);
+void rpmluaSetVar(rpmlua lua, rpmluav var);
+void rpmluaDelVar(rpmlua lua, const char *key, ...);
+int rpmluaVarExists(rpmlua lua, const char *key, ...);
+void rpmluaPushTable(rpmlua lua, const char *key, ...);
+void rpmluaPop(rpmlua lua);
+
+rpmluav rpmluavNew(void);
+rpmluav rpmluavFree(rpmluav var);
+void rpmluavSetListMode(rpmluav var, int flag);
+void rpmluavSetKey(rpmluav var, rpmluavType type, const void *value);
+void rpmluavSetValue(rpmluav var, rpmluavType type, const void *value);
+void rpmluavGetKey(rpmluav var, rpmluavType *type, void **value);
+void rpmluavGetValue(rpmluav var, rpmluavType *type, void **value);
+
+/* Optional helpers for numbers. */
+void rpmluavSetKeyNum(rpmluav var, double value);
+void rpmluavSetValueNum(rpmluav var, double value);
+double rpmluavGetKeyNum(rpmluav var);
+double rpmluavGetValueNum(rpmluav var);
+int rpmluavKeyIsNum(rpmluav var);
+int rpmluavValueIsNum(rpmluav var);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RPMLUA_H */