diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-23 14:17:25 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-23 14:17:25 -0300 |
| commit | 39b79783297bee79db9853b63d199e120a009a8f (patch) | |
| tree | c738c621c4c28d8822c2f785400786301985273b /lua.h | |
| parent | d164e2294f73d8e69f00d95a66014514b2dd0ec0 (diff) | |
| download | lua-39b79783297bee79db9853b63d199e120a009a8f.tar.gz lua-39b79783297bee79db9853b63d199e120a009a8f.tar.bz2 lua-39b79783297bee79db9853b63d199e120a009a8f.zip | |
first (big) step to support wide chars
Diffstat (limited to 'lua.h')
| -rw-r--r-- | lua.h | 41 |
1 files changed, 22 insertions, 19 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.h,v 1.87 2001/02/20 18:15:33 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.88 2001/02/22 17:15:18 roberto Exp roberto $ |
| 3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension Language |
| 4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil | 4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil |
| 5 | ** e-mail: lua@tecgraf.puc-rio.br | 5 | ** e-mail: lua@tecgraf.puc-rio.br |
| @@ -79,6 +79,8 @@ typedef int (*lua_CFunction) (lua_State *L); | |||
| 79 | /* Lua numerical type */ | 79 | /* Lua numerical type */ |
| 80 | typedef double lua_Number; | 80 | typedef double lua_Number; |
| 81 | 81 | ||
| 82 | /* Lua character type */ | ||
| 83 | typedef char l_char; | ||
| 82 | 84 | ||
| 83 | 85 | ||
| 84 | /* mark for all API functions */ | 86 | /* mark for all API functions */ |
| @@ -111,8 +113,8 @@ LUA_API int lua_stackspace (lua_State *L); | |||
| 111 | */ | 113 | */ |
| 112 | 114 | ||
| 113 | LUA_API int lua_type (lua_State *L, int index); | 115 | LUA_API int lua_type (lua_State *L, int index); |
| 114 | LUA_API const char *lua_typename (lua_State *L, int t); | 116 | LUA_API const l_char *lua_typename (lua_State *L, int t); |
| 115 | LUA_API const char *lua_xtype (lua_State *L, int index); | 117 | LUA_API const l_char *lua_xtype (lua_State *L, int index); |
| 116 | LUA_API int lua_isnumber (lua_State *L, int index); | 118 | LUA_API int lua_isnumber (lua_State *L, int index); |
| 117 | LUA_API int lua_isstring (lua_State *L, int index); | 119 | LUA_API int lua_isstring (lua_State *L, int index); |
| 118 | LUA_API int lua_iscfunction (lua_State *L, int index); | 120 | LUA_API int lua_iscfunction (lua_State *L, int index); |
| @@ -122,7 +124,7 @@ LUA_API int lua_equal (lua_State *L, int index1, int index2); | |||
| 122 | LUA_API int lua_lessthan (lua_State *L, int index1, int index2); | 124 | LUA_API int lua_lessthan (lua_State *L, int index1, int index2); |
| 123 | 125 | ||
| 124 | LUA_API lua_Number lua_tonumber (lua_State *L, int index); | 126 | LUA_API lua_Number lua_tonumber (lua_State *L, int index); |
| 125 | LUA_API const char *lua_tostring (lua_State *L, int index); | 127 | LUA_API const l_char *lua_tostring (lua_State *L, int index); |
| 126 | LUA_API size_t lua_strlen (lua_State *L, int index); | 128 | LUA_API size_t lua_strlen (lua_State *L, int index); |
| 127 | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int index); | 129 | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int index); |
| 128 | LUA_API void *lua_touserdata (lua_State *L, int index); | 130 | LUA_API void *lua_touserdata (lua_State *L, int index); |
| @@ -134,8 +136,8 @@ LUA_API const void *lua_topointer (lua_State *L, int index); | |||
| 134 | */ | 136 | */ |
| 135 | LUA_API void lua_pushnil (lua_State *L); | 137 | LUA_API void lua_pushnil (lua_State *L); |
| 136 | LUA_API void lua_pushnumber (lua_State *L, lua_Number n); | 138 | LUA_API void lua_pushnumber (lua_State *L, lua_Number n); |
| 137 | LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len); | 139 | LUA_API void lua_pushlstring (lua_State *L, const l_char *s, size_t len); |
| 138 | LUA_API void lua_pushstring (lua_State *L, const char *s); | 140 | LUA_API void lua_pushstring (lua_State *L, const l_char *s); |
| 139 | LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n); | 141 | LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n); |
| 140 | LUA_API int lua_pushuserdata (lua_State *L, void *u); | 142 | LUA_API int lua_pushuserdata (lua_State *L, void *u); |
| 141 | 143 | ||
| @@ -143,12 +145,12 @@ LUA_API int lua_pushuserdata (lua_State *L, void *u); | |||
| 143 | /* | 145 | /* |
| 144 | ** get functions (Lua -> stack) | 146 | ** get functions (Lua -> stack) |
| 145 | */ | 147 | */ |
| 146 | LUA_API void lua_getglobal (lua_State *L, const char *name); | 148 | LUA_API void lua_getglobal (lua_State *L, const l_char *name); |
| 147 | LUA_API void lua_gettable (lua_State *L, int index); | 149 | LUA_API void lua_gettable (lua_State *L, int index); |
| 148 | LUA_API void lua_rawget (lua_State *L, int index); | 150 | LUA_API void lua_rawget (lua_State *L, int index); |
| 149 | LUA_API void lua_rawgeti (lua_State *L, int index, int n); | 151 | LUA_API void lua_rawgeti (lua_State *L, int index, int n); |
| 150 | LUA_API void lua_getglobals (lua_State *L); | 152 | LUA_API void lua_getglobals (lua_State *L); |
| 151 | LUA_API void lua_gettagmethod (lua_State *L, int tag, const char *event); | 153 | LUA_API void lua_gettagmethod (lua_State *L, int tag, const l_char *event); |
| 152 | LUA_API int lua_getref (lua_State *L, int ref); | 154 | LUA_API int lua_getref (lua_State *L, int ref); |
| 153 | LUA_API void lua_newtable (lua_State *L); | 155 | LUA_API void lua_newtable (lua_State *L); |
| 154 | 156 | ||
| @@ -156,23 +158,24 @@ LUA_API void lua_newtable (lua_State *L); | |||
| 156 | /* | 158 | /* |
| 157 | ** set functions (stack -> Lua) | 159 | ** set functions (stack -> Lua) |
| 158 | */ | 160 | */ |
| 159 | LUA_API void lua_setglobal (lua_State *L, const char *name); | 161 | LUA_API void lua_setglobal (lua_State *L, const l_char *name); |
| 160 | LUA_API void lua_settable (lua_State *L, int index); | 162 | LUA_API void lua_settable (lua_State *L, int index); |
| 161 | LUA_API void lua_rawset (lua_State *L, int index); | 163 | LUA_API void lua_rawset (lua_State *L, int index); |
| 162 | LUA_API void lua_rawseti (lua_State *L, int index, int n); | 164 | LUA_API void lua_rawseti (lua_State *L, int index, int n); |
| 163 | LUA_API void lua_setglobals (lua_State *L); | 165 | LUA_API void lua_setglobals (lua_State *L); |
| 164 | LUA_API void lua_settagmethod (lua_State *L, int tag, const char *event); | 166 | LUA_API void lua_settagmethod (lua_State *L, int tag, const l_char *event); |
| 165 | LUA_API int lua_ref (lua_State *L, int lock); | 167 | LUA_API int lua_ref (lua_State *L, int lock); |
| 166 | 168 | ||
| 167 | 169 | ||
| 168 | /* | 170 | /* |
| 169 | ** "do" functions (run Lua code) | 171 | ** `do' functions (run Lua code) |
| 170 | */ | 172 | */ |
| 171 | LUA_API int lua_call (lua_State *L, int nargs, int nresults); | 173 | LUA_API int lua_call (lua_State *L, int nargs, int nresults); |
| 172 | LUA_API void lua_rawcall (lua_State *L, int nargs, int nresults); | 174 | LUA_API void lua_rawcall (lua_State *L, int nargs, int nresults); |
| 173 | LUA_API int lua_dofile (lua_State *L, const char *filename); | 175 | LUA_API int lua_dofile (lua_State *L, const l_char *filename); |
| 174 | LUA_API int lua_dostring (lua_State *L, const char *str); | 176 | LUA_API int lua_dostring (lua_State *L, const l_char *str); |
| 175 | LUA_API int lua_dobuffer (lua_State *L, const char *buff, size_t size, const char *name); | 177 | LUA_API int lua_dobuffer (lua_State *L, const l_char *buff, size_t size, |
| 178 | const l_char *name); | ||
| 176 | 179 | ||
| 177 | /* | 180 | /* |
| 178 | ** Garbage-collection functions | 181 | ** Garbage-collection functions |
| @@ -184,12 +187,12 @@ LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold); | |||
| 184 | /* | 187 | /* |
| 185 | ** miscellaneous functions | 188 | ** miscellaneous functions |
| 186 | */ | 189 | */ |
| 187 | LUA_API int lua_newtype (lua_State *L, const char *name, int basictype); | 190 | LUA_API int lua_newtype (lua_State *L, const l_char *name, int basictype); |
| 188 | LUA_API int lua_type2tag (lua_State *L, const char *name); | 191 | LUA_API int lua_type2tag (lua_State *L, const l_char *name); |
| 189 | LUA_API int lua_copytagmethods (lua_State *L, int tagto, int tagfrom); | 192 | LUA_API int lua_copytagmethods (lua_State *L, int tagto, int tagfrom); |
| 190 | LUA_API void lua_settag (lua_State *L, int tag); | 193 | LUA_API void lua_settag (lua_State *L, int tag); |
| 191 | 194 | ||
| 192 | LUA_API void lua_error (lua_State *L, const char *s); | 195 | LUA_API void lua_error (lua_State *L, const l_char *s); |
| 193 | 196 | ||
| 194 | LUA_API void lua_unref (lua_State *L, int ref); | 197 | LUA_API void lua_unref (lua_State *L, int ref); |
| 195 | 198 | ||
| @@ -222,8 +225,8 @@ LUA_API void *lua_newuserdata (lua_State *L, size_t size); | |||
| 222 | 225 | ||
| 223 | #define lua_getregistry(L) lua_getref(L, LUA_REFREGISTRY) | 226 | #define lua_getregistry(L) lua_getref(L, LUA_REFREGISTRY) |
| 224 | 227 | ||
| 225 | #define lua_pushliteral(L, s) lua_pushlstring(L, "" s, \ | 228 | #define lua_pushliteral(L, s) lua_pushlstring(L, l_s("") s, \ |
| 226 | (sizeof(s)/sizeof(char))-1) | 229 | (sizeof(s)/sizeof(l_char))-1) |
| 227 | 230 | ||
| 228 | 231 | ||
| 229 | 232 | ||
