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 /liolib.c | |
parent | beee01b170c5fea9ed4527b28b9221d2df1baaba (diff) | |
download | lua-572a69b6afbd368beab8844bc876b0f9690b5253.tar.gz lua-572a69b6afbd368beab8844bc876b0f9690b5253.tar.bz2 lua-572a69b6afbd368beab8844bc876b0f9690b5253.zip |
name changes
Diffstat (limited to 'liolib.c')
-rw-r--r-- | liolib.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -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); |