Classes | Macros | Typedefs | Functions | Variables
liolib.c File Reference
#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"
Include dependency graph for liolib.c:

Go to the source code of this file.

Classes

struct  RN
 

Macros

#define IO_INPUT   (IO_PREFIX "input")
 
#define IO_OUTPUT   (IO_PREFIX "output")
 
#define IO_PREFIX   "_IO_"
 
#define IOPREF_LEN   (sizeof(IO_PREFIX)/sizeof(char) - 1)
 
#define isclosed(p)   ((p)->closef == NULL)
 
#define l_checkmodep(m)   ((m[0] == 'r' || m[0] == 'w') && m[1] == '\0')
 
#define l_fseek(f, o, w)   fseek(f,o,w)
 
#define l_ftell(f)   ftell(f)
 
#define l_getc(f)   getc(f)
 
#define l_lockfile(f)   ((void)0)
 
#define L_MAXLENNUM   200
 
#define L_MODEEXT   "b"
 
#define l_pclose(L, file)   ((void)L, (void)file, -1)
 
#define l_popen(L, c, m)
 
#define l_seeknum   long
 
#define l_unlockfile(f)   ((void)0)
 
#define liolib_c
 
#define LUA_LIB
 
#define MAXARGLINE   250
 
#define tolstream(L)   ((LStream *)luaL_checkudata(L, 1, LUA_FILEHANDLE))
 

Typedefs

typedef luaL_Stream LStream
 

Functions

static int aux_close (lua_State *L)
 
static void aux_lines (lua_State *L, int toclose)
 
static void createmeta (lua_State *L)
 
static void createstdfile (lua_State *L, FILE *f, const char *k, const char *fname)
 
static int f_close (lua_State *L)
 
static int f_flush (lua_State *L)
 
static int f_gc (lua_State *L)
 
static int f_lines (lua_State *L)
 
static int f_read (lua_State *L)
 
static int f_seek (lua_State *L)
 
static int f_setvbuf (lua_State *L)
 
static int f_tostring (lua_State *L)
 
static int f_write (lua_State *L)
 
static int g_iofile (lua_State *L, const char *f, const char *mode)
 
static int g_read (lua_State *L, FILE *f, int first)
 
static int g_write (lua_State *L, FILE *f, int arg)
 
static FILE * getiofile (lua_State *L, const char *findex)
 
static int io_close (lua_State *L)
 
static int io_fclose (lua_State *L)
 
static int io_flush (lua_State *L)
 
static int io_input (lua_State *L)
 
static int io_lines (lua_State *L)
 
static int io_noclose (lua_State *L)
 
static int io_open (lua_State *L)
 
static int io_output (lua_State *L)
 
static int io_pclose (lua_State *L)
 
static int io_popen (lua_State *L)
 
static int io_read (lua_State *L)
 
static int io_readline (lua_State *L)
 
static int io_tmpfile (lua_State *L)
 
static int io_type (lua_State *L)
 
static int io_write (lua_State *L)
 
static int l_checkmode (const char *mode)
 
LUAMOD_API int luaopen_io (lua_State *L)
 
static LStreamnewfile (lua_State *L)
 
static LStreamnewprefile (lua_State *L)
 
static int nextc (RN *rn)
 
static void opencheck (lua_State *L, const char *fname, const char *mode)
 
static void read_all (lua_State *L, FILE *f)
 
static int read_chars (lua_State *L, FILE *f, size_t n)
 
static int read_line (lua_State *L, FILE *f, int chop)
 
static int read_number (lua_State *L, FILE *f)
 
static int readdigits (RN *rn, int hex)
 
static int test2 (RN *rn, const char *set)
 
static int test_eof (lua_State *L, FILE *f)
 
static FILE * tofile (lua_State *L)
 

Variables

static const luaL_Reg iolib []
 
static const luaL_Reg metameth []
 
static const luaL_Reg meth []
 

Macro Definition Documentation

◆ IO_INPUT

#define IO_INPUT   (IO_PREFIX "input")

Definition at line 151 of file liolib.c.

◆ IO_OUTPUT

#define IO_OUTPUT   (IO_PREFIX "output")

Definition at line 152 of file liolib.c.

◆ IO_PREFIX

#define IO_PREFIX   "_IO_"

Definition at line 149 of file liolib.c.

◆ IOPREF_LEN

#define IOPREF_LEN   (sizeof(IO_PREFIX)/sizeof(char) - 1)

Definition at line 150 of file liolib.c.

◆ isclosed

#define isclosed (   p)    ((p)->closef == NULL)

Definition at line 160 of file liolib.c.

◆ l_checkmodep

#define l_checkmodep (   m)    ((m[0] == 'r' || m[0] == 'w') && m[1] == '\0')

Definition at line 89 of file liolib.c.

◆ l_fseek

#define l_fseek (   f,
  o,
 
)    fseek(f,o,w)

Definition at line 137 of file liolib.c.

◆ l_ftell

#define l_ftell (   f)    ftell(f)

Definition at line 138 of file liolib.c.

◆ l_getc

#define l_getc (   f)    getc(f)

Definition at line 102 of file liolib.c.

◆ l_lockfile

#define l_lockfile (   f)    ((void)0)

Definition at line 103 of file liolib.c.

◆ L_MAXLENNUM

#define L_MAXLENNUM   200

Definition at line 422 of file liolib.c.

◆ L_MODEEXT

#define L_MODEEXT   "b"

Definition at line 36 of file liolib.c.

◆ l_pclose

#define l_pclose (   L,
  file 
)    ((void)L, (void)file, -1)

Definition at line 80 of file liolib.c.

◆ l_popen

#define l_popen (   L,
  c,
 
)
Value:
((void)c, (void)m, \
luaL_error(L, "'popen' not supported"), \
(FILE*)0)

Definition at line 76 of file liolib.c.

◆ l_seeknum

#define l_seeknum   long

Definition at line 139 of file liolib.c.

◆ l_unlockfile

#define l_unlockfile (   f)    ((void)0)

Definition at line 104 of file liolib.c.

◆ liolib_c

#define liolib_c

Definition at line 7 of file liolib.c.

◆ LUA_LIB

#define LUA_LIB

Definition at line 8 of file liolib.c.

◆ MAXARGLINE

#define MAXARGLINE   250

Definition at line 352 of file liolib.c.

◆ tolstream

#define tolstream (   L)    ((LStream *)luaL_checkudata(L, 1, LUA_FILEHANDLE))

Definition at line 158 of file liolib.c.

Typedef Documentation

◆ LStream

Definition at line 155 of file liolib.c.

Function Documentation

◆ aux_close()

static int aux_close ( lua_State L)
static

Definition at line 214 of file liolib.c.

◆ aux_lines()

static void aux_lines ( lua_State L,
int  toclose 
)
static

Definition at line 363 of file liolib.c.

◆ createmeta()

static void createmeta ( lua_State L)
static

Definition at line 784 of file liolib.c.

◆ createstdfile()

static void createstdfile ( lua_State L,
FILE *  f,
const char *  k,
const char *  fname 
)
static

Definition at line 806 of file liolib.c.

◆ f_close()

static int f_close ( lua_State L)
static

Definition at line 222 of file liolib.c.

◆ f_flush()

static int f_flush ( lua_State L)
static

Definition at line 733 of file liolib.c.

◆ f_gc()

static int f_gc ( lua_State L)
static

Definition at line 235 of file liolib.c.

◆ f_lines()

static int f_lines ( lua_State L)
static

Definition at line 374 of file liolib.c.

◆ f_read()

static int f_read ( lua_State L)
static

Definition at line 621 of file liolib.c.

◆ f_seek()

static int f_seek ( lua_State L)
static

Definition at line 697 of file liolib.c.

◆ f_setvbuf()

static int f_setvbuf ( lua_State L)
static

Definition at line 716 of file liolib.c.

◆ f_tostring()

static int f_tostring ( lua_State L)
static

Definition at line 177 of file liolib.c.

◆ f_write()

static int f_write ( lua_State L)
static

Definition at line 690 of file liolib.c.

◆ g_iofile()

static int g_iofile ( lua_State L,
const char *  f,
const char *  mode 
)
static

Definition at line 318 of file liolib.c.

◆ g_read()

static int g_read ( lua_State L,
FILE *  f,
int  first 
)
static

Definition at line 566 of file liolib.c.

◆ g_write()

static int g_write ( lua_State L,
FILE *  f,
int  arg 
)
static

Definition at line 660 of file liolib.c.

◆ getiofile()

static FILE* getiofile ( lua_State L,
const char *  findex 
)
static

Definition at line 308 of file liolib.c.

◆ io_close()

static int io_close ( lua_State L)
static

Definition at line 228 of file liolib.c.

◆ io_fclose()

static int io_fclose ( lua_State L)
static

Definition at line 246 of file liolib.c.

◆ io_flush()

static int io_flush ( lua_State L)
static

Definition at line 728 of file liolib.c.

◆ io_input()

static int io_input ( lua_State L)
static

Definition at line 335 of file liolib.c.

◆ io_lines()

static int io_lines ( lua_State L)
static

Definition at line 386 of file liolib.c.

◆ io_noclose()

static int io_noclose ( lua_State L)
static

Definition at line 797 of file liolib.c.

◆ io_open()

static int io_open ( lua_State L)
static

Definition at line 269 of file liolib.c.

◆ io_output()

static int io_output ( lua_State L)
static

Definition at line 340 of file liolib.c.

◆ io_pclose()

static int io_pclose ( lua_State L)
static

Definition at line 283 of file liolib.c.

◆ io_popen()

static int io_popen ( lua_State L)
static

Definition at line 290 of file liolib.c.

◆ io_read()

static int io_read ( lua_State L)
static

Definition at line 616 of file liolib.c.

◆ io_readline()

static int io_readline ( lua_State L)
static

Definition at line 629 of file liolib.c.

◆ io_tmpfile()

static int io_tmpfile ( lua_State L)
static

Definition at line 301 of file liolib.c.

◆ io_type()

static int io_type ( lua_State L)
static

Definition at line 163 of file liolib.c.

◆ io_write()

static int io_write ( lua_State L)
static

Definition at line 685 of file liolib.c.

◆ l_checkmode()

static int l_checkmode ( const char *  mode)
static

Definition at line 40 of file liolib.c.

◆ luaopen_io()

LUAMOD_API int luaopen_io ( lua_State L)

Definition at line 819 of file liolib.c.

◆ newfile()

static LStream* newfile ( lua_State L)
static

Definition at line 253 of file liolib.c.

◆ newprefile()

static LStream* newprefile ( lua_State L)
static

Definition at line 201 of file liolib.c.

◆ nextc()

static int nextc ( RN rn)
static

Definition at line 438 of file liolib.c.

◆ opencheck()

static void opencheck ( lua_State L,
const char *  fname,
const char *  mode 
)
static

Definition at line 261 of file liolib.c.

◆ read_all()

static void read_all ( lua_State L,
FILE *  f 
)
static

Definition at line 540 of file liolib.c.

◆ read_chars()

static int read_chars ( lua_State L,
FILE *  f,
size_t  n 
)
static

Definition at line 553 of file liolib.c.

◆ read_line()

static int read_line ( lua_State L,
FILE *  f,
int  chop 
)
static

Definition at line 519 of file liolib.c.

◆ read_number()

static int read_number ( lua_State L,
FILE *  f 
)
static

Definition at line 477 of file liolib.c.

◆ readdigits()

static int readdigits ( RN rn,
int  hex 
)
static

Definition at line 464 of file liolib.c.

◆ test2()

static int test2 ( RN rn,
const char *  set 
)
static

Definition at line 454 of file liolib.c.

◆ test_eof()

static int test_eof ( lua_State L,
FILE *  f 
)
static

Definition at line 511 of file liolib.c.

◆ tofile()

static FILE* tofile ( lua_State L)
static

Definition at line 187 of file liolib.c.

Variable Documentation

◆ iolib

const luaL_Reg iolib[]
static
Initial value:
= {
{"close", io_close},
{"flush", io_flush},
{"input", io_input},
{"lines", io_lines},
{"open", io_open},
{"output", io_output},
{"popen", io_popen},
{"read", io_read},
{"tmpfile", io_tmpfile},
{"type", io_type},
{"write", io_write},
{NULL, NULL}
}

Definition at line 741 of file liolib.c.

◆ metameth

const luaL_Reg metameth[]
static
Initial value:
= {
{"__index", NULL},
{"__gc", f_gc},
{"__close", f_gc},
{"__tostring", f_tostring},
{NULL, NULL}
}

Definition at line 775 of file liolib.c.

◆ meth

const luaL_Reg meth[]
static
Initial value:
= {
{"read", f_read},
{"write", f_write},
{"lines", f_lines},
{"flush", f_flush},
{"seek", f_seek},
{"close", f_close},
{"setvbuf", f_setvbuf},
{NULL, NULL}
}

Definition at line 760 of file liolib.c.

f_flush
static int f_flush(lua_State *L)
Definition: liolib.c:733
io_popen
static int io_popen(lua_State *L)
Definition: liolib.c:290
f_setvbuf
static int f_setvbuf(lua_State *L)
Definition: liolib.c:716
io_write
static int io_write(lua_State *L)
Definition: liolib.c:685
f_close
static int f_close(lua_State *L)
Definition: liolib.c:222
io_output
static int io_output(lua_State *L)
Definition: liolib.c:340
f_lines
static int f_lines(lua_State *L)
Definition: liolib.c:374
f_read
static int f_read(lua_State *L)
Definition: liolib.c:621
f_gc
static int f_gc(lua_State *L)
Definition: liolib.c:235
nlohmann::detail::void
j template void())
Definition: json.hpp:4061
io_open
static int io_open(lua_State *L)
Definition: liolib.c:269
f_tostring
static int f_tostring(lua_State *L)
Definition: liolib.c:177
io_tmpfile
static int io_tmpfile(lua_State *L)
Definition: liolib.c:301
io_input
static int io_input(lua_State *L)
Definition: liolib.c:335
io_lines
static int io_lines(lua_State *L)
Definition: liolib.c:386
io_type
static int io_type(lua_State *L)
Definition: liolib.c:163
f_seek
static int f_seek(lua_State *L)
Definition: liolib.c:697
io_flush
static int io_flush(lua_State *L)
Definition: liolib.c:728
io_read
static int io_read(lua_State *L)
Definition: liolib.c:616
f_write
static int f_write(lua_State *L)
Definition: liolib.c:690
io_close
static int io_close(lua_State *L)
Definition: liolib.c:228


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Aug 11 2024 02:24:27