diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-04-23 13:35:45 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-04-23 13:35:45 -0300 |
commit | 572a69b6afbd368beab8844bc876b0f9690b5253 (patch) | |
tree | f2785c52e1ee9bab5b68823b9481af2510a90829 | |
parent | beee01b170c5fea9ed4527b28b9221d2df1baaba (diff) | |
download | lua-572a69b6afbd368beab8844bc876b0f9690b5253.tar.gz lua-572a69b6afbd368beab8844bc876b0f9690b5253.tar.bz2 lua-572a69b6afbd368beab8844bc876b0f9690b5253.zip |
name changes
-rw-r--r-- | lapi.c | 27 | ||||
-rw-r--r-- | lauxlib.c | 6 | ||||
-rw-r--r-- | lbaselib.c | 26 | ||||
-rw-r--r-- | lcode.c | 18 | ||||
-rw-r--r-- | liolib.c | 14 | ||||
-rw-r--r-- | ltests.c | 6 | ||||
-rw-r--r-- | lua.h | 23 |
7 files changed, 70 insertions, 50 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.139 2001/04/11 18:39:37 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.140 2001/04/17 17:35:54 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -151,16 +151,16 @@ LUA_API int lua_type (lua_State *L, int index) { | |||
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | LUA_API const l_char *lua_typename (lua_State *L, int t) { | 154 | LUA_API const l_char *lua_tag2name (lua_State *L, int tag) { |
155 | const l_char *s; | 155 | const l_char *s; |
156 | lua_lock(L); | 156 | lua_lock(L); |
157 | s = (t == LUA_TNONE) ? l_s("no value") : basictypename(G(L), t); | 157 | s = (tag == LUA_TNONE) ? l_s("no value") : basictypename(G(L), tag); |
158 | lua_unlock(L); | 158 | lua_unlock(L); |
159 | return s; | 159 | return s; |
160 | } | 160 | } |
161 | 161 | ||
162 | 162 | ||
163 | LUA_API const l_char *lua_xtype (lua_State *L, int index) { | 163 | LUA_API const l_char *lua_xtypename (lua_State *L, int index) { |
164 | StkId o; | 164 | StkId o; |
165 | const l_char *type; | 165 | const l_char *type; |
166 | lua_lock(L); | 166 | lua_lock(L); |
@@ -621,7 +621,7 @@ LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold) { | |||
621 | ** miscellaneous functions | 621 | ** miscellaneous functions |
622 | */ | 622 | */ |
623 | 623 | ||
624 | LUA_API int lua_newtype (lua_State *L, const l_char *name, int basictype) { | 624 | LUA_API int lua_newxtype (lua_State *L, const l_char *name, int basictype) { |
625 | int tag; | 625 | int tag; |
626 | lua_lock(L); | 626 | lua_lock(L); |
627 | if (basictype != LUA_TNONE && | 627 | if (basictype != LUA_TNONE && |
@@ -636,7 +636,7 @@ LUA_API int lua_newtype (lua_State *L, const l_char *name, int basictype) { | |||
636 | } | 636 | } |
637 | 637 | ||
638 | 638 | ||
639 | LUA_API int lua_type2tag (lua_State *L, const l_char *name) { | 639 | LUA_API int lua_name2tag (lua_State *L, const l_char *name) { |
640 | int tag; | 640 | int tag; |
641 | const TObject *v; | 641 | const TObject *v; |
642 | lua_lock(L); | 642 | lua_lock(L); |
@@ -798,3 +798,18 @@ LUA_API void lua_setweakmode (lua_State *L, int mode) { | |||
798 | lua_unlock(L); | 798 | lua_unlock(L); |
799 | } | 799 | } |
800 | 800 | ||
801 | |||
802 | |||
803 | /* | ||
804 | ** deprecated function | ||
805 | */ | ||
806 | LUA_API void lua_pushusertag (lua_State *L, void *u, int tag) { | ||
807 | /* ???????? */ | ||
808 | if (lua_pushuserdata(L, u) || 1) /* new udata? */ | ||
809 | lua_settag(L, tag); /* OK, no conflit */ | ||
810 | else { | ||
811 | if (lua_tag(L, -1) != tag) { | ||
812 | lua_error(L, "conflicting tags for the same userdata"); | ||
813 | } | ||
814 | } | ||
815 | } | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.48 2001/02/23 17:17:25 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.49 2001/03/26 14:31:49 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -44,7 +44,7 @@ LUALIB_API void luaL_argerror (lua_State *L, int narg, const l_char *extramsg) { | |||
44 | 44 | ||
45 | static void type_error (lua_State *L, int narg, const l_char *tname) { | 45 | static void type_error (lua_State *L, int narg, const l_char *tname) { |
46 | l_char buff[80]; | 46 | l_char buff[80]; |
47 | sprintf(buff, l_s("%.25s expected, got %.25s"), tname, lua_xtype(L, narg)); | 47 | sprintf(buff, l_s("%.25s expected, got %.25s"), tname, lua_xtypename(L,narg)); |
48 | luaL_argerror(L, narg, buff); | 48 | luaL_argerror(L, narg, buff); |
49 | } | 49 | } |
50 | 50 | ||
@@ -74,7 +74,7 @@ LUALIB_API void luaL_checkany (lua_State *L, int narg) { | |||
74 | 74 | ||
75 | LUALIB_API void *luaL_check_userdata (lua_State *L, int narg, | 75 | LUALIB_API void *luaL_check_userdata (lua_State *L, int narg, |
76 | const l_char *name) { | 76 | const l_char *name) { |
77 | if (strcmp(lua_xtype(L, narg), name) != 0) | 77 | if (strcmp(lua_xtypename(L, narg), name) != 0) |
78 | type_error(L, narg, name); | 78 | type_error(L, narg, name); |
79 | return lua_touserdata(L, narg); | 79 | return lua_touserdata(L, narg); |
80 | } | 80 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.33 2001/04/11 14:42:41 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.34 2001/04/11 18:39:37 roberto Exp roberto $ |
3 | ** Basic library | 3 | ** Basic library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -144,7 +144,7 @@ static int gettag (lua_State *L, int narg) { | |||
144 | return (int)lua_tonumber(L, narg); | 144 | return (int)lua_tonumber(L, narg); |
145 | case LUA_TSTRING: { | 145 | case LUA_TSTRING: { |
146 | const l_char *name = lua_tostring(L, narg); | 146 | const l_char *name = lua_tostring(L, narg); |
147 | int tag = lua_type2tag(L, name); | 147 | int tag = lua_name2tag(L, name); |
148 | if (tag == LUA_TNONE) | 148 | if (tag == LUA_TNONE) |
149 | luaL_verror(L, l_s("'%.30s' is not a valid type name"), name); | 149 | luaL_verror(L, l_s("'%.30s' is not a valid type name"), name); |
150 | return tag; | 150 | return tag; |
@@ -194,7 +194,7 @@ static int luaB_weakmode (lua_State *L) { | |||
194 | 194 | ||
195 | static int luaB_newtype (lua_State *L) { | 195 | static int luaB_newtype (lua_State *L) { |
196 | const l_char *name = luaL_opt_string(L, 1, NULL); | 196 | const l_char *name = luaL_opt_string(L, 1, NULL); |
197 | lua_pushnumber(L, lua_newtype(L, name, LUA_TTABLE)); | 197 | lua_pushnumber(L, lua_newxtype(L, name, LUA_TTABLE)); |
198 | return 1; | 198 | return 1; |
199 | } | 199 | } |
200 | 200 | ||
@@ -267,14 +267,14 @@ static int luaB_collectgarbage (lua_State *L) { | |||
267 | 267 | ||
268 | static int luaB_type (lua_State *L) { | 268 | static int luaB_type (lua_State *L) { |
269 | luaL_checkany(L, 1); | 269 | luaL_checkany(L, 1); |
270 | lua_pushstring(L, lua_typename(L, lua_type(L, 1))); | 270 | lua_pushstring(L, lua_tag2name(L, lua_type(L, 1))); |
271 | return 1; | 271 | return 1; |
272 | } | 272 | } |
273 | 273 | ||
274 | 274 | ||
275 | static int luaB_xtype (lua_State *L) { | 275 | static int luaB_xtype (lua_State *L) { |
276 | luaL_checkany(L, 1); | 276 | luaL_checkany(L, 1); |
277 | lua_pushstring(L, lua_xtype(L, 1)); | 277 | lua_pushstring(L, lua_xtypename(L, 1)); |
278 | return 1; | 278 | return 1; |
279 | } | 279 | } |
280 | 280 | ||
@@ -406,19 +406,19 @@ static int luaB_require (lua_State *L) { | |||
406 | } | 406 | } |
407 | 407 | ||
408 | 408 | ||
409 | static int aux_unwrap (lua_State *L, int arg) { | 409 | static int aux_unpack (lua_State *L, int arg) { |
410 | int n, i; | 410 | int n, i; |
411 | luaL_checktype(L, arg, LUA_TTABLE); | 411 | luaL_checktype(L, arg, LUA_TTABLE); |
412 | n = lua_getn(L, arg); | 412 | n = lua_getn(L, arg); |
413 | luaL_checkstack(L, n, l_s("table too big to unwrap")); | 413 | luaL_checkstack(L, n, l_s("table too big to unpack")); |
414 | for (i=1; i<=n; i++) /* push arg[1...n] */ | 414 | for (i=1; i<=n; i++) /* push arg[1...n] */ |
415 | lua_rawgeti(L, arg, i); | 415 | lua_rawgeti(L, arg, i); |
416 | return n; | 416 | return n; |
417 | } | 417 | } |
418 | 418 | ||
419 | 419 | ||
420 | static int luaB_unwrap (lua_State *L) { | 420 | static int luaB_unpack (lua_State *L) { |
421 | return aux_unwrap(L, 1); | 421 | return aux_unpack(L, 1); |
422 | } | 422 | } |
423 | 423 | ||
424 | 424 | ||
@@ -437,7 +437,7 @@ static int luaB_call (lua_State *L) { | |||
437 | oldtop = lua_gettop(L); /* top before function-call preparation */ | 437 | oldtop = lua_gettop(L); /* top before function-call preparation */ |
438 | /* push function */ | 438 | /* push function */ |
439 | lua_pushvalue(L, 1); | 439 | lua_pushvalue(L, 1); |
440 | n = aux_unwrap(L, 2); /* push arg[1...n] */ | 440 | n = aux_unpack(L, 2); /* push arg[1...n] */ |
441 | status = lua_call(L, n, LUA_MULTRET); | 441 | status = lua_call(L, n, LUA_MULTRET); |
442 | if (err != 0) { /* restore old error method */ | 442 | if (err != 0) { /* restore old error method */ |
443 | lua_pushvalue(L, err); | 443 | lua_pushvalue(L, err); |
@@ -466,13 +466,13 @@ static int luaB_tostring (lua_State *L) { | |||
466 | lua_pushvalue(L, 1); | 466 | lua_pushvalue(L, 1); |
467 | return 1; | 467 | return 1; |
468 | case LUA_TTABLE: | 468 | case LUA_TTABLE: |
469 | sprintf(buff, l_s("%.40s: %p"), lua_xtype(L, 1), lua_topointer(L, 1)); | 469 | sprintf(buff, l_s("%.40s: %p"), lua_xtypename(L, 1), lua_topointer(L, 1)); |
470 | break; | 470 | break; |
471 | case LUA_TFUNCTION: | 471 | case LUA_TFUNCTION: |
472 | sprintf(buff, l_s("function: %p"), lua_topointer(L, 1)); | 472 | sprintf(buff, l_s("function: %p"), lua_topointer(L, 1)); |
473 | break; | 473 | break; |
474 | case LUA_TUSERDATA: { | 474 | case LUA_TUSERDATA: { |
475 | const l_char *t = lua_xtype(L, 1); | 475 | const l_char *t = lua_xtypename(L, 1); |
476 | if (strcmp(t, l_s("userdata")) == 0) | 476 | if (strcmp(t, l_s("userdata")) == 0) |
477 | sprintf(buff, l_s("userdata(%d): %p"), lua_tag(L, 1), | 477 | sprintf(buff, l_s("userdata(%d): %p"), lua_tag(L, 1), |
478 | lua_touserdata(L, 1)); | 478 | lua_touserdata(L, 1)); |
@@ -793,7 +793,7 @@ static const luaL_reg base_funcs[] = { | |||
793 | {l_s("sort"), luaB_sort}, | 793 | {l_s("sort"), luaB_sort}, |
794 | {l_s("tinsert"), luaB_tinsert}, | 794 | {l_s("tinsert"), luaB_tinsert}, |
795 | {l_s("tremove"), luaB_tremove}, | 795 | {l_s("tremove"), luaB_tremove}, |
796 | {l_s("unwrap"), luaB_unwrap}, | 796 | {l_s("unpack"), luaB_unpack}, |
797 | {l_s("xtype"), luaB_xtype}, | 797 | {l_s("xtype"), luaB_xtype}, |
798 | {l_s("weakmode"), luaB_weakmode} | 798 | {l_s("weakmode"), luaB_weakmode} |
799 | }; | 799 | }; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.c,v 1.66 2001/03/26 14:31:49 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 1.67 2001/04/06 18:25:00 roberto Exp roberto $ |
3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -265,14 +265,10 @@ void luaK_concat (FuncState *fs, int *l1, int l2) { | |||
265 | *l1 = l2; | 265 | *l1 = l2; |
266 | else { | 266 | else { |
267 | int list = *l1; | 267 | int list = *l1; |
268 | for (;;) { /* traverse `l1' */ | 268 | int next; |
269 | int next = luaK_getjump(fs, list); | 269 | while ((next = luaK_getjump(fs, list)) != NO_JUMP) /* find last element */ |
270 | if (next == NO_JUMP) { /* end of list? */ | ||
271 | luaK_fixjump(fs, list, l2); | ||
272 | return; | ||
273 | } | ||
274 | list = next; | 270 | list = next; |
275 | } | 271 | luaK_fixjump(fs, list, l2); |
276 | } | 272 | } |
277 | } | 273 | } |
278 | 274 | ||
@@ -310,8 +306,8 @@ void luaK_goiftrue (FuncState *fs, expdesc *v, int keepvalue) { | |||
310 | } | 306 | } |
311 | 307 | ||
312 | 308 | ||
313 | static void luaK_goiffalse (FuncState *fs, expdesc *v, int keepvalue) { | 309 | static void luaK_goiffalse (FuncState *fs, expdesc *v) { |
314 | luaK_testgo(fs, v, 0, keepvalue ? OP_JMPONT : OP_JMPT); | 310 | luaK_testgo(fs, v, 0, OP_JMPONT); |
315 | } | 311 | } |
316 | 312 | ||
317 | 313 | ||
@@ -385,7 +381,7 @@ void luaK_infix (LexState *ls, BinOpr op, expdesc *v) { | |||
385 | luaK_goiftrue(fs, v, 1); | 381 | luaK_goiftrue(fs, v, 1); |
386 | break; | 382 | break; |
387 | case OPR_OR: | 383 | case OPR_OR: |
388 | luaK_goiffalse(fs, v, 1); | 384 | luaK_goiffalse(fs, v); |
389 | break; | 385 | break; |
390 | default: | 386 | default: |
391 | luaK_tostack(ls, v, 1); /* all other binary operators need a value */ | 387 | luaK_tostack(ls, v, 1); /* all other binary operators need a value */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 1.110 2001/03/06 20:09:38 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 1.111 2001/03/26 14:31:49 roberto Exp roberto $ |
3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -75,14 +75,14 @@ static int pushresult (lua_State *L, int i) { | |||
75 | */ | 75 | */ |
76 | 76 | ||
77 | 77 | ||
78 | #define checkfile(L,f) (strcmp(lua_xtype(L,(f)), FILEHANDLE) == 0) | 78 | #define checkfile(L,f) (strcmp(lua_xtypename(L,(f)), FILEHANDLE) == 0) |
79 | 79 | ||
80 | 80 | ||
81 | static FILE *getopthandle (lua_State *L, int inout) { | 81 | static FILE *getopthandle (lua_State *L, int inout) { |
82 | FILE *p = (FILE *)lua_touserdata(L, 1); | 82 | FILE *p = (FILE *)lua_touserdata(L, 1); |
83 | if (p != NULL) { /* is it a userdata ? */ | 83 | if (p != NULL) { /* is it a userdata ? */ |
84 | if (!checkfile(L, 1)) { | 84 | if (!checkfile(L, 1)) { |
85 | if (strcmp(lua_xtype(L, 1), l_s("ClosedFileHandle")) == 0) | 85 | if (strcmp(lua_xtypename(L, 1), l_s("ClosedFileHandle")) == 0) |
86 | luaL_argerror(L, 1, l_s("file is closed")); | 86 | luaL_argerror(L, 1, l_s("file is closed")); |
87 | else | 87 | else |
88 | luaL_argerror(L, 1, l_s("(invalid value)")); | 88 | luaL_argerror(L, 1, l_s("(invalid value)")); |
@@ -102,7 +102,7 @@ static FILE *getopthandle (lua_State *L, int inout) { | |||
102 | 102 | ||
103 | 103 | ||
104 | static void pushfile (lua_State *L, FILE *f) { | 104 | static void pushfile (lua_State *L, FILE *f) { |
105 | lua_pushusertag(L, f, lua_type2tag(L, FILEHANDLE)); | 105 | lua_pushusertag(L, f, lua_name2tag(L, FILEHANDLE)); |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
@@ -132,7 +132,7 @@ static int closefile (lua_State *L, FILE *f) { | |||
132 | return 1; | 132 | return 1; |
133 | else { | 133 | else { |
134 | lua_pushuserdata(L, f); | 134 | lua_pushuserdata(L, f); |
135 | lua_settag(L, lua_type2tag(L, l_s("ClosedFileHandle"))); | 135 | lua_settag(L, lua_name2tag(L, l_s("ClosedFileHandle"))); |
136 | return (CLOSEFILE(L, f) == 0); | 136 | return (CLOSEFILE(L, f) == 0); |
137 | } | 137 | } |
138 | } | 138 | } |
@@ -678,8 +678,8 @@ static const luaL_reg iolib[] = { | |||
678 | 678 | ||
679 | 679 | ||
680 | LUALIB_API int lua_iolibopen (lua_State *L) { | 680 | LUALIB_API int lua_iolibopen (lua_State *L) { |
681 | int iotag = lua_newtype(L, FILEHANDLE, LUA_TUSERDATA); | 681 | int iotag = lua_newxtype(L, FILEHANDLE, LUA_TUSERDATA); |
682 | lua_newtype(L, l_s("ClosedFileHandle"), LUA_TUSERDATA); | 682 | lua_newxtype(L, l_s("ClosedFileHandle"), LUA_TUSERDATA); |
683 | luaL_openl(L, iolib); | 683 | luaL_openl(L, iolib); |
684 | /* predefined file handles */ | 684 | /* predefined file handles */ |
685 | setfile(L, stdin, INFILE); | 685 | setfile(L, stdin, INFILE); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 1.78 2001/04/11 14:42:41 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.79 2001/04/17 17:35:54 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -433,8 +433,8 @@ static int udataval (lua_State *L) { | |||
433 | } | 433 | } |
434 | 434 | ||
435 | static int newtag (lua_State *L) { | 435 | static int newtag (lua_State *L) { |
436 | lua_pushnumber(L, lua_newtype(L, lua_tostring(L, 1), | 436 | lua_pushnumber(L, lua_newxtype(L, lua_tostring(L, 1), |
437 | (int)lua_tonumber(L, 2))); | 437 | (int)lua_tonumber(L, 2))); |
438 | return 1; | 438 | return 1; |
439 | } | 439 | } |
440 | 440 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.95 2001/04/11 18:39:37 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.96 2001/04/17 17:35:54 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: info@lua.org | 5 | ** e-mail: info@lua.org |
@@ -124,8 +124,8 @@ LUA_API int lua_stackspace (lua_State *L); | |||
124 | */ | 124 | */ |
125 | 125 | ||
126 | LUA_API int lua_type (lua_State *L, int index); | 126 | LUA_API int lua_type (lua_State *L, int index); |
127 | LUA_API const lua_char *lua_typename (lua_State *L, int t); | 127 | LUA_API const lua_char *lua_tag2name (lua_State *L, int tag); |
128 | LUA_API const lua_char *lua_xtype (lua_State *L, int index); | 128 | LUA_API const lua_char *lua_xtypename (lua_State *L, int index); |
129 | LUA_API int lua_isnumber (lua_State *L, int index); | 129 | LUA_API int lua_isnumber (lua_State *L, int index); |
130 | LUA_API int lua_isstring (lua_State *L, int index); | 130 | LUA_API int lua_isstring (lua_State *L, int index); |
131 | LUA_API int lua_iscfunction (lua_State *L, int index); | 131 | LUA_API int lua_iscfunction (lua_State *L, int index); |
@@ -203,8 +203,8 @@ LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold); | |||
203 | /* | 203 | /* |
204 | ** miscellaneous functions | 204 | ** miscellaneous functions |
205 | */ | 205 | */ |
206 | LUA_API int lua_newtype (lua_State *L, const lua_char *name, int basictype); | 206 | LUA_API int lua_newxtype (lua_State *L, const lua_char *name, int basictype); |
207 | LUA_API int lua_type2tag (lua_State *L, const lua_char *name); | 207 | LUA_API int lua_name2tag (lua_State *L, const lua_char *name); |
208 | LUA_API int lua_copytagmethods (lua_State *L, int tagto, int tagfrom); | 208 | LUA_API int lua_copytagmethods (lua_State *L, int tagto, int tagfrom); |
209 | LUA_API void lua_settag (lua_State *L, int tag); | 209 | LUA_API void lua_settag (lua_State *L, int tag); |
210 | 210 | ||
@@ -223,6 +223,12 @@ LUA_API void lua_setweakmode (lua_State *L, int mode); | |||
223 | LUA_API int lua_getweakmode (lua_State *L, int index); | 223 | LUA_API int lua_getweakmode (lua_State *L, int index); |
224 | 224 | ||
225 | 225 | ||
226 | /* | ||
227 | ** deprecated function | ||
228 | */ | ||
229 | LUA_API void lua_pushusertag (lua_State *L, void *u, int tag); | ||
230 | |||
231 | |||
226 | /* | 232 | /* |
227 | ** =============================================================== | 233 | ** =============================================================== |
228 | ** some useful macros | 234 | ** some useful macros |
@@ -234,7 +240,6 @@ LUA_API int lua_getweakmode (lua_State *L, int index); | |||
234 | #define lua_pop(L,n) lua_settop(L, -(n)-1) | 240 | #define lua_pop(L,n) lua_settop(L, -(n)-1) |
235 | 241 | ||
236 | #define lua_register(L,n,f) (lua_pushcfunction(L, f), lua_setglobal(L, n)) | 242 | #define lua_register(L,n,f) (lua_pushcfunction(L, f), lua_setglobal(L, n)) |
237 | #define lua_pushusertag(L,u,t) (lua_pushuserdata(L, u), lua_settag(L, t)) | ||
238 | #define lua_pushcfunction(L,f) lua_pushcclosure(L, f, 0) | 243 | #define lua_pushcfunction(L,f) lua_pushcclosure(L, f, 0) |
239 | #define lua_clonetag(L,t) lua_copytagmethods(L, lua_newtag(L), (t)) | 244 | #define lua_clonetag(L,t) lua_copytagmethods(L, lua_newtag(L), (t)) |
240 | 245 | ||
@@ -249,7 +254,11 @@ LUA_API int lua_getweakmode (lua_State *L, int index); | |||
249 | 254 | ||
250 | 255 | ||
251 | 256 | ||
252 | #define lua_newtag(L) lua_newtype(L, NULL, LUA_TNONE) | 257 | /* |
258 | ** compatibility macros | ||
259 | */ | ||
260 | #define lua_newtag(L) lua_newxtype(L, NULL, LUA_TNONE) | ||
261 | #define lua_typename lua_tag2name | ||
253 | 262 | ||
254 | #endif | 263 | #endif |
255 | 264 | ||