rpmio/rpmlua.h

Go to the documentation of this file.
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     lua_State *L;
00017     int pushsize;
00018     int storeprint;
00019     int printbufsize;
00020     int printbufused;
00021     char *printbuf;
00022 };
00023 
00024 struct rpmluav_s {
00025     rpmluavType keyType;
00026     rpmluavType valueType;
00027     union {
00028         const char *str;
00029         const void *ptr;
00030         double num;
00031     } key;
00032     union {
00033         const char *str;
00034         const void *ptr;
00035         double num;
00036     } value;
00037     int listmode;
00038 };
00039 
00040 #endif /* _RPMLUA_INTERNAL */
00041 
00042 typedef /*@abstract@*/ struct rpmlua_s * rpmlua;
00043 typedef /*@abstract@*/ struct rpmluav_s * rpmluav;
00044 
00045 /*@-exportlocal@*/
00046 /*@only@*/
00047 rpmlua rpmluaNew(void)
00048         /*@globals fileSystem @*/
00049         /*@modifies fileSystem @*/;
00050 /*@=exportlocal@*/
00051 void *rpmluaFree(/*@only@*/ rpmlua lua)
00052         /*@modifies lua @*/;
00053 
00054 int rpmluaCheckScript(/*@null@*/ rpmlua lua, const char *script,
00055                       /*@null@*/ const char *name)
00056         /*@globals fileSystem @*/
00057         /*@modifies lua, fileSystem @*/;
00058 int rpmluaRunScript(/*@null@*/ rpmlua lua, const char *script,
00059                     /*@null@*/ const char *name)
00060         /*@globals fileSystem @*/
00061         /*@modifies lua, fileSystem @*/;
00062 /*@-exportlocal@*/
00063 int rpmluaRunScriptFile(/*@null@*/ rpmlua lua, const char *filename)
00064         /*@globals fileSystem @*/
00065         /*@modifies lua, fileSystem @*/;
00066 /*@=exportlocal@*/
00067 void rpmluaInteractive(/*@null@*/ rpmlua lua)
00068         /*@globals fileSystem @*/
00069         /*@modifies lua, fileSystem @*/;
00070 
00071 void *rpmluaGetData(/*@null@*/ rpmlua lua, const char *key)
00072         /*@globals fileSystem @*/
00073         /*@modifies lua, fileSystem @*/;
00074 /*@-exportlocal@*/
00075 void rpmluaSetData(/*@null@*/ rpmlua lua, const char *key, const void *data)
00076         /*@globals fileSystem @*/
00077         /*@modifies lua, fileSystem @*/;
00078 /*@=exportlocal@*/
00079 
00080 /*@exposed@*/
00081 const char *rpmluaGetPrintBuffer(/*@null@*/ rpmlua lua)
00082         /*@globals fileSystem @*/
00083         /*@modifies lua, fileSystem @*/;
00084 void rpmluaSetPrintBuffer(/*@null@*/ rpmlua lua, int flag)
00085         /*@globals fileSystem @*/
00086         /*@modifies lua, fileSystem @*/;
00087 
00088 void rpmluaGetVar(/*@null@*/ rpmlua lua, rpmluav var)
00089         /*@globals fileSystem @*/
00090         /*@modifies lua, var, fileSystem @*/;
00091 void rpmluaSetVar(/*@null@*/ rpmlua lua, rpmluav var)
00092         /*@globals fileSystem @*/
00093         /*@modifies lua, var, fileSystem @*/;
00094 void rpmluaDelVar(/*@null@*/ rpmlua lua, const char *key, ...)
00095         /*@globals fileSystem @*/
00096         /*@modifies lua, fileSystem @*/;
00097 int rpmluaVarExists(/*@null@*/ rpmlua lua, const char *key, ...)
00098         /*@globals fileSystem @*/
00099         /*@modifies lua, fileSystem @*/;
00100 void rpmluaPushTable(/*@null@*/ rpmlua lua, const char *key, ...)
00101         /*@globals fileSystem @*/
00102         /*@modifies lua, fileSystem @*/;
00103 void rpmluaPop(/*@null@*/ rpmlua lua)
00104         /*@globals fileSystem @*/
00105         /*@modifies lua, fileSystem @*/;
00106 
00107 /*@only@*/
00108 rpmluav rpmluavNew(void)
00109         /*@*/;
00110 void * rpmluavFree(/*@only@*/ rpmluav var)
00111         /*@modifes var @*/;
00112 void rpmluavSetListMode(rpmluav var, int flag)
00113         /*@modifies var @*/;
00114 /*@-exportlocal@*/
00115 void rpmluavSetKey(rpmluav var, rpmluavType type, const void *value)
00116         /*@modifies var @*/;
00117 /*@=exportlocal@*/
00118 /*@-exportlocal@*/
00119 void rpmluavSetValue(rpmluav var, rpmluavType type, const void *value)
00120         /*@modifies var @*/;
00121 /*@=exportlocal@*/
00122 /*@-exportlocal@*/
00123 void rpmluavGetKey(rpmluav var, /*@out@*/ rpmluavType *type, /*@out@*/ void **value)
00124         /*@modifies *type, *value @*/;
00125 /*@=exportlocal@*/
00126 /*@-exportlocal@*/
00127 void rpmluavGetValue(rpmluav var, /*@out@*/ rpmluavType *type, /*@out@*/ void **value)
00128         /*@modifies *type, *value @*/;
00129 /*@=exportlocal@*/
00130 
00131 /* Optional helpers for numbers. */
00132 void rpmluavSetKeyNum(rpmluav var, double value)
00133         /*@modifies var @*/;
00134 void rpmluavSetValueNum(rpmluav var, double value)
00135         /*@modifies var @*/;
00136 double rpmluavGetKeyNum(rpmluav var)
00137         /*@*/;
00138 double rpmluavGetValueNum(rpmluav var)
00139         /*@*/;
00140 int rpmluavKeyIsNum(rpmluav var)
00141         /*@*/;
00142 int rpmluavValueIsNum(rpmluav var)
00143         /*@*/;
00144 
00145 #endif /* RPMLUA_H */

Generated on Mon Mar 5 14:31:00 2007 for rpm by  doxygen 1.5.1