Github User Fetcher 1.0.0
C Application with Server and GUI
|
#include "lprefix.h"
#include <ctype.h>
#include <errno.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
Go to the source code of this file.
Data Structures | |
struct | RN |
Macros | |
#define | liolib_c |
#define | LUA_LIB |
#define | L_MODEEXT "b" |
#define | l_popen(L, c, m) |
#define | l_pclose(L, file) ((void)L, (void)file, -1) |
#define | l_checkmodep(m) ((m[0] == 'r' || m[0] == 'w') && m[1] == '\0') |
#define | l_getc(f) getc(f) |
#define | l_lockfile(f) ((void)0) |
#define | l_unlockfile(f) ((void)0) |
#define | l_fseek(f, o, w) fseek(f,o,w) |
#define | l_ftell(f) ftell(f) |
#define | l_seeknum long |
#define | IO_PREFIX "_IO_" |
#define | IOPREF_LEN (sizeof(IO_PREFIX)/sizeof(char) - 1) |
#define | IO_INPUT (IO_PREFIX "input") |
#define | IO_OUTPUT (IO_PREFIX "output") |
#define | tolstream(L) ((LStream *)luaL_checkudata(L, 1, LUA_FILEHANDLE)) |
#define | isclosed(p) ((p)->closef == NULL) |
#define | MAXARGLINE 250 |
#define | L_MAXLENNUM 200 |
Typedefs | |
typedef luaL_Stream | LStream |
Functions | |
static int | l_checkmode (const char *mode) |
static int | io_type (lua_State *L) |
static int | f_tostring (lua_State *L) |
static FILE * | tofile (lua_State *L) |
static LStream * | newprefile (lua_State *L) |
static int | aux_close (lua_State *L) |
static int | f_close (lua_State *L) |
static int | io_close (lua_State *L) |
static int | f_gc (lua_State *L) |
static int | io_fclose (lua_State *L) |
static LStream * | newfile (lua_State *L) |
static void | opencheck (lua_State *L, const char *fname, const char *mode) |
static int | io_open (lua_State *L) |
static int | io_pclose (lua_State *L) |
static int | io_popen (lua_State *L) |
static int | io_tmpfile (lua_State *L) |
static FILE * | getiofile (lua_State *L, const char *findex) |
static int | g_iofile (lua_State *L, const char *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 toclose) |
static int | f_lines (lua_State *L) |
static int | io_lines (lua_State *L) |
static int | nextc (RN *rn) |
static int | test2 (RN *rn, const char *set) |
static int | readdigits (RN *rn, int hex) |
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, int chop) |
static void | read_all (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 int | io_noclose (lua_State *L) |
static void | createstdfile (lua_State *L, FILE *f, const char *k, const char *fname) |
LUAMOD_API int | luaopen_io (lua_State *L) |
Variables | |
static const luaL_Reg | iolib [] |
static const luaL_Reg | meth [] |
static const luaL_Reg | metameth [] |
#define IO_INPUT (IO_PREFIX "input") |
Definition at line 151 of file lua-5.4.3/src/liolib.c.
Referenced by io_input(), io_lines(), io_read(), and luaopen_io().
#define IO_OUTPUT (IO_PREFIX "output") |
Definition at line 152 of file lua-5.4.3/src/liolib.c.
Referenced by io_close(), io_flush(), io_output(), io_write(), and luaopen_io().
#define IO_PREFIX "_IO_" |
Definition at line 149 of file lua-5.4.3/src/liolib.c.
#define IOPREF_LEN (sizeof(IO_PREFIX)/sizeof(char) - 1) |
Definition at line 150 of file lua-5.4.3/src/liolib.c.
Referenced by getiofile().
#define isclosed | ( | p | ) | ((p)->closef == NULL) |
Definition at line 160 of file lua-5.4.3/src/liolib.c.
Referenced by f_gc(), f_tostring(), getiofile(), io_readline(), io_type(), and tofile().
#define l_checkmodep | ( | m | ) | ((m[0] == 'r' || m[0] == 'w') && m[1] == '\0') |
Definition at line 89 of file lua-5.4.3/src/liolib.c.
Referenced by io_popen().
#define l_fseek | ( | f, | |
o, | |||
w ) fseek(f,o,w) |
Definition at line 137 of file lua-5.4.3/src/liolib.c.
Referenced by f_seek().
#define l_ftell | ( | f | ) | ftell(f) |
Definition at line 138 of file lua-5.4.3/src/liolib.c.
Referenced by f_seek().
#define l_getc | ( | f | ) | getc(f) |
Definition at line 102 of file lua-5.4.3/src/liolib.c.
Referenced by nextc(), read_line(), and read_number().
#define l_lockfile | ( | f | ) | ((void)0) |
Definition at line 103 of file lua-5.4.3/src/liolib.c.
Referenced by read_line(), and read_number().
#define L_MAXLENNUM 200 |
Definition at line 422 of file lua-5.4.3/src/liolib.c.
Referenced by nextc().
#define L_MODEEXT "b" |
Definition at line 36 of file lua-5.4.3/src/liolib.c.
Referenced by l_checkmode().
#define l_pclose | ( | L, | |
file ) ((void)L, (void)file, -1) |
Definition at line 80 of file lua-5.4.3/src/liolib.c.
Referenced by io_pclose().
#define l_popen | ( | L, | |
c, | |||
m ) |
Definition at line 76 of file lua-5.4.3/src/liolib.c.
Referenced by io_popen().
#define l_seeknum long |
Definition at line 139 of file lua-5.4.3/src/liolib.c.
Referenced by f_seek().
#define l_unlockfile | ( | f | ) | ((void)0) |
Definition at line 104 of file lua-5.4.3/src/liolib.c.
Referenced by read_line(), and read_number().
#define liolib_c |
Definition at line 7 of file lua-5.4.3/src/liolib.c.
#define LUA_LIB |
Definition at line 8 of file lua-5.4.3/src/liolib.c.
#define MAXARGLINE 250 |
Definition at line 352 of file lua-5.4.3/src/liolib.c.
Referenced by aux_lines().
#define tolstream | ( | L | ) | ((LStream *)luaL_checkudata(L, 1, LUA_FILEHANDLE)) |
Definition at line 158 of file lua-5.4.3/src/liolib.c.
Referenced by aux_close(), f_gc(), f_tostring(), io_fclose(), io_noclose(), io_pclose(), and tofile().
typedef luaL_Stream LStream |
Definition at line 155 of file lua-5.4.3/src/liolib.c.
|
static |
Definition at line 214 of file lua-5.4.3/src/liolib.c.
References luaL_Stream::closef, NULL, and tolstream.
Referenced by f_close(), f_gc(), and io_readline().
|
static |
Definition at line 363 of file lua-5.4.3/src/liolib.c.
References io_readline(), lua_gettop(), lua_pushboolean(), lua_pushcclosure(), lua_pushinteger(), lua_pushvalue(), lua_rotate(), luaL_argcheck, and MAXARGLINE.
Referenced by f_lines(), and io_lines().
|
static |
Definition at line 784 of file lua-5.4.3/src/liolib.c.
References LUA_FILEHANDLE, lua_pop, lua_setfield(), luaL_newlibtable, luaL_newmetatable(), luaL_setfuncs(), metameth, and meth.
Referenced by luaopen_io().
|
static |
Definition at line 806 of file lua-5.4.3/src/liolib.c.
References luaL_Stream::closef, luaL_Stream::f, io_noclose(), lua_pushvalue(), LUA_REGISTRYINDEX, lua_setfield(), newprefile(), and NULL.
Referenced by luaopen_io().
|
static |
Definition at line 222 of file lua-5.4.3/src/liolib.c.
References aux_close(), and tofile().
Referenced by io_close().
|
static |
Definition at line 733 of file lua-5.4.3/src/liolib.c.
References luaL_fileresult(), NULL, and tofile().
|
static |
Definition at line 235 of file lua-5.4.3/src/liolib.c.
References aux_close(), luaL_Stream::f, isclosed, NULL, and tolstream.
|
static |
Definition at line 374 of file lua-5.4.3/src/liolib.c.
References aux_lines(), and tofile().
|
static |
Definition at line 621 of file lua-5.4.3/src/liolib.c.
|
static |
Definition at line 697 of file lua-5.4.3/src/liolib.c.
References l_fseek, l_ftell, l_seeknum, lua_pushinteger(), luaL_argcheck, luaL_checkoption(), luaL_fileresult(), luaL_optinteger(), NULL, and tofile().
|
static |
Definition at line 716 of file lua-5.4.3/src/liolib.c.
References LUAL_BUFFERSIZE, luaL_checkoption(), luaL_fileresult(), luaL_optinteger(), NULL, and tofile().
|
static |
Definition at line 177 of file lua-5.4.3/src/liolib.c.
References luaL_Stream::f, isclosed, lua_pushfstring(), lua_pushliteral, and tolstream.
|
static |
Definition at line 690 of file lua-5.4.3/src/liolib.c.
References g_write(), lua_pushvalue(), and tofile().
|
static |
Definition at line 318 of file lua-5.4.3/src/liolib.c.
References lua_getfield(), lua_isnoneornil, lua_pushvalue(), LUA_REGISTRYINDEX, lua_setfield(), lua_tostring, opencheck(), and tofile().
Referenced by io_input(), and io_output().
|
static |
Definition at line 566 of file lua-5.4.3/src/liolib.c.
References lua_gettop(), LUA_MINSTACK, lua_pop, LUA_TNUMBER, lua_type(), luaL_argerror(), luaL_checkinteger(), luaL_checkstack(), luaL_checkstring, luaL_fileresult(), luaL_pushfail, NULL, read_all(), read_chars(), read_line(), read_number(), and test_eof().
Referenced by f_read(), io_read(), and io_readline().
|
static |
Definition at line 660 of file lua-5.4.3/src/liolib.c.
References arg, fwrite(), lua_gettop(), LUA_INTEGER_FMT, lua_isinteger(), LUA_NUMBER_FMT, LUA_TNUMBER, lua_tointeger, lua_tonumber, lua_type(), LUAI_UACINT, LUAI_UACNUMBER, luaL_checklstring(), luaL_fileresult(), NULL, and s.
Referenced by f_write(), and io_write().
|
static |
Definition at line 308 of file lua-5.4.3/src/liolib.c.
References luaL_Stream::f, IOPREF_LEN, isclosed, lua_getfield(), LUA_REGISTRYINDEX, lua_touserdata(), and luaL_error().
Referenced by io_flush(), io_read(), and io_write().
|
static |
Definition at line 228 of file lua-5.4.3/src/liolib.c.
References f_close(), IO_OUTPUT, lua_getfield(), lua_isnone, and LUA_REGISTRYINDEX.
|
static |
Definition at line 246 of file lua-5.4.3/src/liolib.c.
References luaL_Stream::f, luaL_fileresult(), NULL, and tolstream.
Referenced by newfile().
|
static |
Definition at line 728 of file lua-5.4.3/src/liolib.c.
References getiofile(), IO_OUTPUT, luaL_fileresult(), and NULL.
|
static |
Definition at line 335 of file lua-5.4.3/src/liolib.c.
References g_iofile(), and IO_INPUT.
|
static |
Definition at line 386 of file lua-5.4.3/src/liolib.c.
References aux_lines(), IO_INPUT, lua_getfield(), lua_isnil, lua_isnone, lua_pushnil(), lua_pushvalue(), LUA_REGISTRYINDEX, lua_replace, luaL_checkstring, opencheck(), and tofile().
|
static |
Definition at line 797 of file lua-5.4.3/src/liolib.c.
References luaL_Stream::closef, io_noclose(), lua_pushliteral, luaL_pushfail, and tolstream.
Referenced by createstdfile(), and io_noclose().
|
static |
Definition at line 269 of file lua-5.4.3/src/liolib.c.
References luaL_Stream::f, l_checkmode(), luaL_argcheck, luaL_checkstring, luaL_fileresult(), luaL_optstring, newfile(), and NULL.
|
static |
Definition at line 340 of file lua-5.4.3/src/liolib.c.
References g_iofile(), and IO_OUTPUT.
|
static |
Definition at line 283 of file lua-5.4.3/src/liolib.c.
References luaL_Stream::f, l_pclose, luaL_execresult(), and tolstream.
Referenced by io_popen().
|
static |
Definition at line 290 of file lua-5.4.3/src/liolib.c.
References luaL_Stream::closef, luaL_Stream::f, io_pclose(), l_checkmodep, l_popen, luaL_argcheck, luaL_checkstring, luaL_fileresult(), luaL_optstring, newprefile(), and NULL.
|
static |
Definition at line 616 of file lua-5.4.3/src/liolib.c.
References g_read(), getiofile(), and IO_INPUT.
|
static |
Definition at line 629 of file lua-5.4.3/src/liolib.c.
References aux_close(), luaL_Stream::f, g_read(), isclosed, lua_assert, lua_pushvalue(), lua_settop(), lua_toboolean(), lua_tointeger, lua_tostring, lua_touserdata(), lua_upvalueindex, luaL_checkstack(), and luaL_error().
Referenced by aux_lines().
|
static |
Definition at line 301 of file lua-5.4.3/src/liolib.c.
References luaL_Stream::f, luaL_fileresult(), newfile(), and NULL.
|
static |
Definition at line 163 of file lua-5.4.3/src/liolib.c.
References isclosed, LUA_FILEHANDLE, lua_pushliteral, luaL_checkany(), luaL_pushfail, luaL_testudata(), and NULL.
|
static |
Definition at line 685 of file lua-5.4.3/src/liolib.c.
References g_write(), getiofile(), and IO_OUTPUT.
|
static |
Definition at line 40 of file lua-5.4.3/src/liolib.c.
References L_MODEEXT, and NULL.
Referenced by io_open().
LUAMOD_API int luaopen_io | ( | lua_State * | L | ) |
Definition at line 819 of file lua-5.4.3/src/liolib.c.
References createmeta(), createstdfile(), IO_INPUT, IO_OUTPUT, iolib, luaL_newlib, and NULL.
Definition at line 253 of file lua-5.4.3/src/liolib.c.
References luaL_Stream::closef, luaL_Stream::f, io_fclose(), newprefile(), and NULL.
Referenced by io_open(), io_tmpfile(), and opencheck().
Definition at line 201 of file lua-5.4.3/src/liolib.c.
References luaL_Stream::closef, LUA_FILEHANDLE, lua_newuserdatauv(), luaL_setmetatable(), and NULL.
Referenced by createstdfile(), io_popen(), and newfile().
|
static |
Definition at line 438 of file lua-5.4.3/src/liolib.c.
References RN::buff, RN::c, RN::f, l_getc, L_MAXLENNUM, and RN::n.
Referenced by readdigits(), and test2().
|
static |
Definition at line 261 of file lua-5.4.3/src/liolib.c.
References luaL_Stream::f, luaL_error(), newfile(), and NULL.
Referenced by g_iofile(), and io_lines().
|
static |
Definition at line 540 of file lua-5.4.3/src/liolib.c.
References fread(), luaL_addsize, LUAL_BUFFERSIZE, luaL_buffinit(), luaL_prepbuffer, and luaL_pushresult().
Referenced by g_read().
|
static |
Definition at line 553 of file lua-5.4.3/src/liolib.c.
References fread(), luaL_addsize, luaL_buffinit(), luaL_prepbuffsize(), and luaL_pushresult().
Referenced by g_read().
|
static |
Definition at line 519 of file lua-5.4.3/src/liolib.c.
References l_getc, l_lockfile, l_unlockfile, lua_rawlen, luaL_addchar, luaL_addsize, LUAL_BUFFERSIZE, luaL_buffinit(), luaL_prepbuffer, and luaL_pushresult().
Referenced by g_read().
|
static |
Definition at line 477 of file lua-5.4.3/src/liolib.c.
References RN::buff, RN::c, RN::f, l_getc, l_lockfile, l_unlockfile, lua_getlocaledecpoint, lua_pushnil(), lua_stringtonumber(), RN::n, readdigits(), and test2().
Referenced by g_read().
|
static |
Definition at line 464 of file lua-5.4.3/src/liolib.c.
References RN::c, and nextc().
Referenced by read_number().
|
static |
Definition at line 454 of file lua-5.4.3/src/liolib.c.
References RN::c, and nextc().
Referenced by read_number().
|
static |
Definition at line 511 of file lua-5.4.3/src/liolib.c.
References lua_pushliteral.
Referenced by g_read().
|
static |
Definition at line 187 of file lua-5.4.3/src/liolib.c.
References luaL_Stream::f, isclosed, lua_assert, luaL_error(), and tolstream.
Referenced by f_close(), f_flush(), f_lines(), f_read(), f_seek(), f_setvbuf(), f_write(), g_iofile(), and io_lines().
|
static |
Definition at line 741 of file lua-5.4.3/src/liolib.c.
Referenced by luaopen_io().
|
static |
Definition at line 775 of file lua-5.4.3/src/liolib.c.
Referenced by createmeta().