rpm
5.2.1
|
00001 #ifndef RPMLUA_H 00002 #define RPMLUA_H 00003 00004 typedef enum rpmluavType_e { 00005 RPMLUAV_NIL = 0, 00006 RPMLUAV_STRING = 1, 00007 RPMLUAV_NUMBER = 2 00008 } rpmluavType; 00009 00010 #if defined(_RPMLUA_INTERNAL) 00011 00012 #include <stdarg.h> 00013 #include <lua.h> 00014 00015 struct rpmlua_s { 00016 struct rpmioItem_s _item; 00017 lua_State *L; 00018 int pushsize; 00019 int storeprint; 00020 size_t printbufsize; 00021 size_t printbufused; 00022 /*@relnull@*/ 00023 char *printbuf; 00024 }; 00025 00026 struct rpmluav_s { 00027 struct rpmioItem_s _item; 00028 rpmluavType keyType; 00029 rpmluavType valueType; 00030 union { 00031 const char *str; 00032 const void *ptr; 00033 double num; 00034 } key; 00035 union { 00036 const char *str; 00037 const void *ptr; 00038 double num; 00039 } value; 00040 int listmode; 00041 }; 00042 00043 #endif /* _RPMLUA_INTERNAL */ 00044 00045 typedef /*@abstract@*/ struct rpmlua_s * rpmlua; 00046 typedef /*@abstract@*/ struct rpmluav_s * rpmluav; 00047 00048 #ifdef __cplusplus 00049 extern "C" { 00050 #endif 00051 00052 /*@unchecked@*/ /*@observer@*/ 00053 extern const char * rpmluaFiles; 00054 00055 /*@unchecked@*/ /*@observer@*/ 00056 extern const char * rpmluaPath; 00057 00058 /*@-exportlocal@*/ 00059 /*@only@*/ /*@exposed@*/ /*@relnull@*/ 00060 rpmlua rpmluaGetGlobalState(void) 00061 /*@*/; 00062 00063 rpmlua rpmluaNew(void) 00064 /*@globals fileSystem, internalState @*/ 00065 /*@modifies fileSystem, internalState @*/; 00066 /*@=exportlocal@*/ 00067 /*@null@*/ 00068 void *rpmluaFree(/*@only@*/ rpmlua lua) 00069 /*@globals internalState @*/ 00070 /*@modifies lua, internalState @*/; 00071 00072 int rpmluaCheckScript(/*@null@*/ rpmlua _lua, const char *script, 00073 /*@null@*/ const char *name) 00074 /*@globals fileSystem, internalState @*/ 00075 /*@modifies _lua, fileSystem, internalState @*/; 00076 int rpmluaRunScript(/*@null@*/ rpmlua _lua, const char *script, 00077 /*@null@*/ const char *name) 00078 /*@globals fileSystem, internalState @*/ 00079 /*@modifies _lua, fileSystem, internalState @*/; 00080 /*@-exportlocal@*/ 00081 int rpmluaRunScriptFile(/*@null@*/ rpmlua _lua, const char *filename) 00082 /*@globals fileSystem, internalState @*/ 00083 /*@modifies _lua, fileSystem, internalState @*/; 00084 /*@=exportlocal@*/ 00085 void rpmluaInteractive(/*@null@*/ rpmlua _lua) 00086 /*@globals fileSystem, internalState @*/ 00087 /*@modifies _lua, fileSystem, internalState @*/; 00088 00089 /*@null@*/ 00090 void *rpmluaGetData(/*@null@*/ rpmlua _lua, const char *key) 00091 /*@globals fileSystem, internalState @*/ 00092 /*@modifies _lua, fileSystem, internalState @*/; 00093 /*@-exportlocal@*/ 00094 void rpmluaSetData(/*@null@*/ rpmlua _lua, const char *key, const void *data) 00095 /*@globals fileSystem, internalState @*/ 00096 /*@modifies _lua, fileSystem, internalState @*/; 00097 /*@=exportlocal@*/ 00098 00099 /*@exposed@*/ 00100 const char *rpmluaGetPrintBuffer(/*@null@*/ rpmlua _lua) 00101 /*@globals fileSystem, internalState @*/ 00102 /*@modifies _lua, fileSystem, internalState @*/; 00103 void rpmluaSetPrintBuffer(/*@null@*/ rpmlua _lua, int flag) 00104 /*@globals fileSystem, internalState @*/ 00105 /*@modifies _lua, fileSystem, internalState @*/; 00106 00107 void rpmluaGetVar(/*@null@*/ rpmlua _lua, rpmluav var) 00108 /*@globals fileSystem, internalState @*/ 00109 /*@modifies _lua, var, fileSystem, internalState @*/; 00110 void rpmluaSetVar(/*@null@*/ rpmlua _lua, rpmluav var) 00111 /*@globals fileSystem, internalState @*/ 00112 /*@modifies _lua, var, fileSystem, internalState @*/; 00113 void rpmluaDelVar(/*@null@*/ rpmlua _lua, const char *key, ...) 00114 /*@globals fileSystem, internalState @*/ 00115 /*@modifies _lua, fileSystem, internalState @*/; 00116 int rpmluaVarExists(/*@null@*/ rpmlua _lua, const char *key, ...) 00117 /*@globals fileSystem, internalState @*/ 00118 /*@modifies _lua, fileSystem, internalState @*/; 00119 void rpmluaPushTable(/*@null@*/ rpmlua _lua, const char *key, ...) 00120 /*@globals fileSystem, internalState @*/ 00121 /*@modifies _lua, fileSystem, internalState @*/; 00122 void rpmluaPop(/*@null@*/ rpmlua _lua) 00123 /*@globals fileSystem, internalState @*/ 00124 /*@modifies _lua, fileSystem, internalState @*/; 00125 00126 /*@only@*/ 00127 rpmluav rpmluavNew(void) 00128 /*@*/; 00129 /*@null@*/ 00130 void * rpmluavFree(/*@only@*/ rpmluav var) 00131 /*@modifes var @*/; 00132 void rpmluavSetListMode(rpmluav var, int flag) 00133 /*@modifies var @*/; 00134 /*@-exportlocal@*/ 00135 void rpmluavSetKey(rpmluav var, rpmluavType type, const void *value) 00136 /*@modifies var @*/; 00137 /*@=exportlocal@*/ 00138 /*@-exportlocal@*/ 00139 void rpmluavSetValue(rpmluav var, rpmluavType type, const void *value) 00140 /*@modifies var @*/; 00141 /*@=exportlocal@*/ 00142 /*@-exportlocal@*/ 00143 void rpmluavGetKey(rpmluav var, /*@out@*/ rpmluavType *type, /*@out@*/ void **value) 00144 /*@modifies *type, *value @*/; 00145 /*@=exportlocal@*/ 00146 /*@-exportlocal@*/ 00147 void rpmluavGetValue(rpmluav var, /*@out@*/ rpmluavType *type, /*@out@*/ void **value) 00148 /*@modifies *type, *value @*/; 00149 /*@=exportlocal@*/ 00150 00151 /* Optional helpers for numbers. */ 00152 void rpmluavSetKeyNum(rpmluav var, double value) 00153 /*@modifies var @*/; 00154 void rpmluavSetValueNum(rpmluav var, double value) 00155 /*@modifies var @*/; 00156 double rpmluavGetKeyNum(rpmluav var) 00157 /*@*/; 00158 double rpmluavGetValueNum(rpmluav var) 00159 /*@*/; 00160 int rpmluavKeyIsNum(rpmluav var) 00161 /*@*/; 00162 int rpmluavValueIsNum(rpmluav var) 00163 /*@*/; 00164 00165 #ifdef __cplusplus 00166 } 00167 #endif 00168 00169 #endif /* RPMLUA_H */