Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

tolua.h

Go to the documentation of this file.
00001 /* tolua - Support code for Lua bindings.
00002 ** Written by Waldemar Celes (celes@tecgraf.puc-rio.br)
00003 ** TeCGraf/PUC-Rio
00004 ** http://www.tecgraf.puc-rio.br/~celes/tolua
00005 ** Jul 1998
00006 ** $Id: tolua.h,v 1.3 2000/07/14 15:05:02 sphair Exp $
00007 */
00008 
00009 /* This code is free software; you can redistribute it and/or modify it.
00010 ** The software provided hereunder is on an "as is" basis, and
00011 ** the author has no obligation to provide maintenance, support, updates,
00012 ** enhancements, or modifications.
00013 */
00014 
00015 
00016 #ifndef tolua_h
00017 #define tolua_h
00018 
00019 #define TOLUA_VERSION       "tolua 3.2"
00020 
00021 
00022 #include <stdlib.h>             /* NULL, malloc, free */
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 #include "lua.h"
00029 #if 0
00030 #include "luatrace.h"
00031 #endif
00032 
00033 
00034 /*************************************** Exported functions */
00035 
00036 int  tolua_open (void);
00037 void tolua_restorestate (void);
00038 void tolua_using (lua_Object module);
00039 void tolua_class (lua_Object derived, lua_Object base);
00040 void tolua_instance (lua_Object instance, lua_Object classobj);
00041 void tolua_foreach (lua_Object lo, lua_Object f);
00042 int  tolua_tag (char* type);
00043 char* tolua_type (lua_Object lo);
00044 lua_Object tolua_base (lua_Object lo);
00045 lua_Object tolua_cast (lua_Object lo, char* type);
00046 void tolua_takeownership (lua_Object lo);
00047 
00048 
00049 
00050 /*************************************** Support functions for binding code */
00051 
00052 #define TOLUA_NIL       (lua_pushnil(),lua_pop())
00053 
00054 /* Register functions */
00055 void tolua_globalvar (char* name, lua_CFunction get, lua_CFunction set);
00056 void tolua_globalarray (char* name, lua_CFunction get, lua_CFunction set);
00057 void tolua_module (char* name);
00058 void tolua_cclass (char* name, char* base);
00059 void tolua_function (char* parent, char* name, lua_CFunction func);
00060 void tolua_constant (char* parent, char* name, double value);
00061 void tolua_tablevar
00062 (char* table, char* name, lua_CFunction get, lua_CFunction set);
00063 void tolua_tablearray
00064 (char* table, char* name, lua_CFunction get, lua_CFunction set);
00065 
00066 
00067 /* Get and push functions */
00068 double tolua_getnumber (int narg, double def);
00069 char* tolua_getstring (int narg, const char* def);
00070 void* tolua_getuserdata (int narg, const void* def);
00071 void* tolua_getusertype (int narg, const void* def);
00072 lua_Object tolua_getobject (int narg, lua_Object def);
00073 double tolua_getfieldnumber (lua_Object lo, int index, double def);
00074 char* tolua_getfieldstring (lua_Object lo, int index, const char* def);
00075 void* tolua_getfielduserdata (lua_Object lo, int index, const void* def);
00076 void* tolua_getfieldusertype (lua_Object lo, int index, const void* def);
00077 lua_Object tolua_getfieldobject (lua_Object lo, int index, lua_Object def);
00078 
00079 void tolua_pushnumber (double value);
00080 void tolua_pushstring (const char* value);
00081 void tolua_pushuserdata (const void* value);
00082 void tolua_pushusertype (const void* value, int tag);
00083 void tolua_pushobject (lua_Object lo);
00084 void tolua_pushfieldnumber (lua_Object lo, int index, double v);
00085 void tolua_pushfieldstring (lua_Object lo, int index, char* v);
00086 void tolua_pushfielduserdata (lua_Object lo, int index, void* v);
00087 void tolua_pushfieldusertype (lua_Object lo, int index, void* v, int tag);
00088 void tolua_pushfieldobject (lua_Object lo, int index, lua_Object tf);
00089 
00090 
00091 #define tolua_gettable tolua_getobject
00092 #define tolua_getfieldtable tolua_getfieldobject
00093 #define tolua_getfunction tolua_getobject
00094 #define tolua_getfieldfunction tolua_getfieldobject
00095 #define tolua_pushtable tolua_pushobject
00096 #define tolua_pushfieldtable tolua_pushfieldobject
00097 #define tolua_pushfunction tolua_pushobject
00098 #define tolua_pushfieldfunction tolua_pushfieldobject
00099 
00100 /* Type & tag manipulation */
00101 void tolua_usertype (char* type);
00102 void tolua_settag (char* type, int* tag);
00103 int  tolua_istype (int narg, int tag, int dim);
00104 int  tolua_arrayistype (int narg, int tag, int dim, int def);
00105 
00106 int  tolua_isnoobj (int narg);
00107 
00108 /* Tag method manipulation */
00109 void* tolua_doclone (void* value, int tag);
00110 void* tolua_copy (void* value, unsigned int size);
00111 
00112 /* Error handling */
00113 void tolua_error (char* msg);
00114 
00115 /* Exported variables */
00116 extern int tolua_tag_nil;
00117 extern int tolua_tag_number;
00118 extern int tolua_tag_string;
00119 extern int tolua_tag_userdata;
00120 extern int tolua_tag_table;
00121 extern int tolua_tag_cfunction;
00122 extern int tolua_tag_function;
00123 
00124 #ifdef __cplusplus
00125 }
00126 #endif
00127 
00128 #endif 
00129 

Generated at Wed Apr 4 19:54:04 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001