Go to the source code of this file.
Defines | |
#define | liolib_c |
#define | LUA_LIB |
#define | IO_INPUT 1 |
#define | IO_OUTPUT 2 |
#define | tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE)) |
Functions | |
static int | pushresult (lua_State *L, int i, const char *filename) |
static void | fileerror (lua_State *L, int arg, const char *filename) |
static int | io_type (lua_State *L) |
static FILE * | tofile (lua_State *L) |
static FILE ** | newfile (lua_State *L) |
static int | io_noclose (lua_State *L) |
static int | io_pclose (lua_State *L) |
static int | io_fclose (lua_State *L) |
static int | aux_close (lua_State *L) |
static int | io_close (lua_State *L) |
static int | io_gc (lua_State *L) |
static int | io_tostring (lua_State *L) |
static int | io_open (lua_State *L) |
static int | io_popen (lua_State *L) |
static int | io_tmpfile (lua_State *L) |
static FILE * | getiofile (lua_State *L, int findex) |
static int | g_iofile (lua_State *L, int f, const char *mode) |
static int | io_input (lua_State *L) |
static int | io_output (lua_State *L) |
static int | io_readline (lua_State *L) |
static void | aux_lines (lua_State *L, int idx, int toclose) |
static int | f_lines (lua_State *L) |
static int | io_lines (lua_State *L) |
static int | read_number (lua_State *L, FILE *f) |
static int | test_eof (lua_State *L, FILE *f) |
static int | read_line (lua_State *L, FILE *f) |
static int | read_chars (lua_State *L, FILE *f, size_t n) |
static int | g_read (lua_State *L, FILE *f, int first) |
static int | io_read (lua_State *L) |
static int | f_read (lua_State *L) |
static int | g_write (lua_State *L, FILE *f, int arg) |
static int | io_write (lua_State *L) |
static int | f_write (lua_State *L) |
static int | f_seek (lua_State *L) |
static int | f_setvbuf (lua_State *L) |
static int | io_flush (lua_State *L) |
static int | f_flush (lua_State *L) |
static void | createmeta (lua_State *L) |
static void | createstdfile (lua_State *L, FILE *f, int k, const char *fname) |
static void | newfenv (lua_State *L, lua_CFunction cls) |
LUALIB_API int | luaopen_io (lua_State *L) |
Variables | |
static const char *const | fnames [] = {"input", "output"} |
static const luaL_Reg | iolib [] |
static const luaL_Reg | flib [] |
#define IO_INPUT 1 |
Definition at line 23 of file liolib.c.
Referenced by io_input(), io_lines(), io_read(), and luaopen_io().
#define IO_OUTPUT 2 |
Definition at line 24 of file liolib.c.
Referenced by io_close(), io_flush(), io_output(), io_write(), and luaopen_io().
#define tofilep | ( | L | ) | ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE)) |
Definition at line 54 of file liolib.c.
Referenced by io_fclose(), io_gc(), io_pclose(), io_tostring(), and tofile().
static int aux_close | ( | lua_State * | L | ) | [static] |
Definition at line 127 of file liolib.c.
References lua_getfenv(), lua_getfield(), and lua_tocfunction().
Referenced by io_close(), io_gc(), and io_readline().
static void aux_lines | ( | lua_State * | L, | |
int | idx, | |||
int | toclose | |||
) | [static] |
Definition at line 234 of file liolib.c.
References io_readline(), lua_pushboolean(), lua_pushcclosure(), and lua_pushvalue().
Referenced by f_lines(), and io_lines().
static void createmeta | ( | lua_State * | L | ) | [static] |
Definition at line 507 of file liolib.c.
References LUA_FILEHANDLE, lua_pushvalue(), lua_setfield(), luaL_newmetatable(), and luaL_register().
Referenced by luaopen_io().
static void createstdfile | ( | lua_State * | L, | |
FILE * | f, | |||
int | k, | |||
const char * | fname | |||
) | [static] |
Definition at line 515 of file liolib.c.
References LUA_ENVIRONINDEX, lua_pushvalue(), lua_rawseti(), lua_setfenv(), lua_setfield(), and newfile().
Referenced by luaopen_io().
static int f_flush | ( | lua_State * | L | ) | [static] |
Definition at line 472 of file liolib.c.
References pushresult(), and tofile().
static int f_lines | ( | lua_State * | L | ) | [static] |
Definition at line 241 of file liolib.c.
References aux_lines(), and tofile().
Referenced by io_lines().
static int f_read | ( | lua_State * | L | ) | [static] |
static int f_seek | ( | lua_State * | L | ) | [static] |
Definition at line 439 of file liolib.c.
References f(), lua_pushinteger(), luaL_checkoption(), luaL_optlong, pushresult(), and tofile().
static int f_setvbuf | ( | lua_State * | L | ) | [static] |
Definition at line 455 of file liolib.c.
References f(), LUAL_BUFFERSIZE, luaL_checkoption(), luaL_optinteger(), pushresult(), and tofile().
static int f_write | ( | lua_State * | L | ) | [static] |
static void fileerror | ( | lua_State * | L, | |
int | arg, | |||
const char * | filename | |||
) | [static] |
Definition at line 48 of file liolib.c.
References lua_pushfstring(), lua_tostring, and luaL_argerror().
Referenced by g_iofile(), and io_lines().
static int g_iofile | ( | lua_State * | L, | |
int | f, | |||
const char * | mode | |||
) | [static] |
Definition at line 200 of file liolib.c.
References fileerror(), LUA_ENVIRONINDEX, lua_isnoneornil, lua_pushvalue(), lua_rawgeti(), lua_rawseti(), lua_tostring, newfile(), and tofile().
Referenced by io_input(), and io_output().
static int g_read | ( | lua_State * | L, | |
FILE * | f, | |||
int | first | |||
) | [static] |
Definition at line 331 of file liolib.c.
References lua_gettop(), LUA_MINSTACK, lua_pop, lua_pushnil(), LUA_TNUMBER, lua_tointeger(), lua_tostring, lua_type(), luaL_argcheck, luaL_argerror(), luaL_checkstack(), pushresult(), read_chars(), read_line(), read_number(), and test_eof().
static int g_write | ( | lua_State * | L, | |
FILE * | f, | |||
int | arg | |||
) | [static] |
Definition at line 410 of file liolib.c.
References lua_gettop(), LUA_NUMBER_FMT, LUA_TNUMBER, lua_tonumber(), lua_type(), luaL_checklstring(), and pushresult().
Referenced by f_write(), and io_write().
static FILE* getiofile | ( | lua_State * | L, | |
int | findex | |||
) | [static] |
Definition at line 190 of file liolib.c.
References f(), fnames, LUA_ENVIRONINDEX, lua_rawgeti(), lua_touserdata(), and luaL_error().
Referenced by io_flush(), io_read(), and io_write().
static int io_close | ( | lua_State * | L | ) | [static] |
Definition at line 134 of file liolib.c.
References aux_close(), IO_OUTPUT, LUA_ENVIRONINDEX, lua_isnone, lua_rawgeti(), and tofile().
static int io_fclose | ( | lua_State * | L | ) | [static] |
Definition at line 119 of file liolib.c.
References pushresult(), and tofilep.
Referenced by luaopen_io().
static int io_flush | ( | lua_State * | L | ) | [static] |
Definition at line 467 of file liolib.c.
References getiofile(), IO_OUTPUT, and pushresult().
static int io_gc | ( | lua_State * | L | ) | [static] |
Definition at line 142 of file liolib.c.
References aux_close(), f(), and tofilep.
static int io_input | ( | lua_State * | L | ) | [static] |
Definition at line 221 of file liolib.c.
References g_iofile(), and IO_INPUT.
static int io_lines | ( | lua_State * | L | ) | [static] |
Definition at line 248 of file liolib.c.
References aux_lines(), f_lines(), fileerror(), IO_INPUT, LUA_ENVIRONINDEX, lua_gettop(), lua_isnoneornil, lua_rawgeti(), luaL_checkstring, and newfile().
static int io_noclose | ( | lua_State * | L | ) | [static] |
Definition at line 98 of file liolib.c.
References lua_pushliteral, and lua_pushnil().
Referenced by luaopen_io().
static int io_open | ( | lua_State * | L | ) | [static] |
Definition at line 161 of file liolib.c.
References luaL_checkstring, luaL_optstring, newfile(), and pushresult().
static int io_output | ( | lua_State * | L | ) | [static] |
Definition at line 226 of file liolib.c.
References g_iofile(), and IO_OUTPUT.
static int io_pclose | ( | lua_State * | L | ) | [static] |
Definition at line 108 of file liolib.c.
References lua_pclose, pushresult(), and tofilep.
Referenced by luaopen_io().
static int io_popen | ( | lua_State * | L | ) | [static] |
Definition at line 174 of file liolib.c.
References lua_popen, luaL_checkstring, luaL_optstring, newfile(), and pushresult().
static int io_read | ( | lua_State * | L | ) | [static] |
Definition at line 378 of file liolib.c.
References g_read(), getiofile(), and IO_INPUT.
static int io_readline | ( | lua_State * | L | ) | [static] |
Definition at line 388 of file liolib.c.
References aux_close(), f(), lua_pushvalue(), lua_settop(), lua_toboolean(), lua_touserdata(), lua_upvalueindex, luaL_error(), and read_line().
Referenced by aux_lines().
static int io_tmpfile | ( | lua_State * | L | ) | [static] |
Definition at line 183 of file liolib.c.
References newfile(), and pushresult().
static int io_tostring | ( | lua_State * | L | ) | [static] |
Definition at line 151 of file liolib.c.
References f(), lua_pushfstring(), lua_pushliteral, and tofilep.
static int io_type | ( | lua_State * | L | ) | [static] |
Definition at line 57 of file liolib.c.
References LUA_FILEHANDLE, lua_getfield(), lua_getmetatable(), lua_pushliteral, lua_pushnil(), lua_rawequal(), LUA_REGISTRYINDEX, lua_touserdata(), and luaL_checkany().
static int io_write | ( | lua_State * | L | ) | [static] |
Definition at line 429 of file liolib.c.
References g_write(), getiofile(), and IO_OUTPUT.
LUALIB_API int luaopen_io | ( | lua_State * | L | ) |
Definition at line 534 of file liolib.c.
References createmeta(), createstdfile(), io_fclose(), IO_INPUT, io_noclose(), IO_OUTPUT, io_pclose(), LUA_ENVIRONINDEX, lua_getfield(), LUA_IOLIBNAME, lua_pop, lua_replace(), lua_setfenv(), luaL_register(), and newfenv().
static void newfenv | ( | lua_State * | L, | |
lua_CFunction | cls | |||
) | [static] |
Definition at line 527 of file liolib.c.
References lua_createtable(), lua_pushcfunction, and lua_setfield().
Referenced by luaopen_io().
static FILE** newfile | ( | lua_State * | L | ) | [static] |
Definition at line 86 of file liolib.c.
References LUA_FILEHANDLE, lua_newuserdata(), lua_setmetatable(), and luaL_getmetatable.
Referenced by createstdfile(), g_iofile(), io_lines(), io_open(), io_popen(), and io_tmpfile().
static int pushresult | ( | lua_State * | L, | |
int | i, | |||
const char * | filename | |||
) | [static] |
Definition at line 30 of file liolib.c.
References lua_pushboolean(), lua_pushfstring(), lua_pushinteger(), and lua_pushnil().
Referenced by f_flush(), f_seek(), f_setvbuf(), g_read(), g_write(), io_fclose(), io_flush(), io_open(), io_pclose(), io_popen(), and io_tmpfile().
static int read_chars | ( | lua_State * | L, | |
FILE * | f, | |||
size_t | n | |||
) | [static] |
Definition at line 313 of file liolib.c.
References lua_objlen(), luaL_addsize, LUAL_BUFFERSIZE, luaL_buffinit(), luaL_prepbuffer(), and luaL_pushresult().
Referenced by g_read().
static int read_line | ( | lua_State * | L, | |
FILE * | f | |||
) | [static] |
Definition at line 291 of file liolib.c.
References lua_objlen(), luaL_addsize, LUAL_BUFFERSIZE, luaL_buffinit(), luaL_prepbuffer(), and luaL_pushresult().
Referenced by g_read(), and io_readline().
static int read_number | ( | lua_State * | L, | |
FILE * | f | |||
) | [static] |
Definition at line 273 of file liolib.c.
References d(), LUA_NUMBER_SCAN, and lua_pushnumber().
Referenced by g_read().
static int test_eof | ( | lua_State * | L, | |
FILE * | f | |||
) | [static] |
static FILE* tofile | ( | lua_State * | L | ) | [static] |
Definition at line 72 of file liolib.c.
References f(), luaL_error(), and tofilep.
Referenced by f_flush(), f_lines(), f_read(), f_seek(), f_setvbuf(), f_write(), g_iofile(), and io_close().
Definition at line 27 of file liolib.c.
Referenced by getiofile().
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:59 2011 by Doxygen 1.6.1