RetroArch
Macros | Functions | Variables
loslib.c File Reference
#include "lprefix.h"
#include <errno.h>
#include <locale.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
Include dependency graph for loslib.c:

Macros

#define loslib_c
 
#define LUA_LIB
 
#define L_STRFTIMEC89   "aAbBcdHIjmMpSUwWxXyYZ%"
 
#define L_STRFTIMEC99
 
#define L_STRFTIMEWIN
 
#define LUA_STRFTIMEOPTIONS   L_STRFTIMEC99
 
#define l_timet   lua_Integer
 
#define l_pushtime(L, t)   lua_pushinteger(L,(lua_Integer)(t))
 
#define l_gmtime(t, r)   ((void)(r)->tm_sec, gmtime(t))
 
#define l_localtime(t, r)   ((void)(r)->tm_sec, localtime(t))
 
#define LUA_TMPNAMBUFSIZE   L_tmpnam
 
#define lua_tmpnam(b, e)   { e = (tmpnam(b) == NULL); }
 
#define L_MAXDATEFIELD   (INT_MAX / 2)
 
#define SIZETIMEFMT   250
 

Functions

static time_t l_checktime (lua_State *L, int arg)
 
static int os_execute (lua_State *L)
 
static int os_remove (lua_State *L)
 
static int os_rename (lua_State *L)
 
static int os_tmpname (lua_State *L)
 
static int os_getenv (lua_State *L)
 
static int os_clock (lua_State *L)
 
static void setfield (lua_State *L, const char *key, int value)
 
static void setboolfield (lua_State *L, const char *key, int value)
 
static void setallfields (lua_State *L, struct tm *stm)
 
static int getboolfield (lua_State *L, const char *key)
 
static int getfield (lua_State *L, const char *key, int d, int delta)
 
static const char * checkoption (lua_State *L, const char *conv, ptrdiff_t convlen, char *buff)
 
static int os_date (lua_State *L)
 
static int os_time (lua_State *L)
 
static int os_difftime (lua_State *L)
 
static int os_setlocale (lua_State *L)
 
static int os_exit (lua_State *L)
 
LUAMOD_API int luaopen_os (lua_State *L)
 

Variables

static const luaL_Reg syslib []
 

Macro Definition Documentation

◆ l_gmtime

#define l_gmtime (   t,
  r 
)    ((void)(r)->tm_sec, gmtime(t))

◆ l_localtime

#define l_localtime (   t,
  r 
)    ((void)(r)->tm_sec, localtime(t))

◆ L_MAXDATEFIELD

#define L_MAXDATEFIELD   (INT_MAX / 2)

◆ l_pushtime

#define l_pushtime (   L,
  t 
)    lua_pushinteger(L,(lua_Integer)(t))

◆ L_STRFTIMEC89

#define L_STRFTIMEC89   "aAbBcdHIjmMpSUwWxXyYZ%"

◆ L_STRFTIMEC99

#define L_STRFTIMEC99
Value:
"aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%" \
"||" "EcECExEXEyEY" "OdOeOHOIOmOMOSOuOUOVOwOWOy" /* two-char options */

◆ L_STRFTIMEWIN

#define L_STRFTIMEWIN
Value:
"aAbBcdHIjmMpSUwWxXyYzZ%" \
"||" "#c#x#d#H#I#j#m#M#S#U#w#W#y#Y" /* two-char options */

◆ l_timet

#define l_timet   lua_Integer

◆ loslib_c

#define loslib_c

◆ LUA_LIB

#define LUA_LIB

◆ LUA_STRFTIMEOPTIONS

#define LUA_STRFTIMEOPTIONS   L_STRFTIMEC99

◆ lua_tmpnam

#define lua_tmpnam (   b,
 
)    { e = (tmpnam(b) == NULL); }

◆ LUA_TMPNAMBUFSIZE

#define LUA_TMPNAMBUFSIZE   L_tmpnam

◆ SIZETIMEFMT

#define SIZETIMEFMT   250

Function Documentation

◆ checkoption()

static const char* checkoption ( lua_State L,
const char *  conv,
ptrdiff_t  convlen,
char *  buff 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getboolfield()

static int getboolfield ( lua_State L,
const char *  key 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getfield()

static int getfield ( lua_State L,
const char *  key,
int  d,
int  delta 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ l_checktime()

static time_t l_checktime ( lua_State L,
int  arg 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ luaopen_os()

LUAMOD_API int luaopen_os ( lua_State L)
Here is the call graph for this function:

◆ os_clock()

static int os_clock ( lua_State L)
static
Here is the call graph for this function:

◆ os_date()

static int os_date ( lua_State L)
static
Here is the call graph for this function:

◆ os_difftime()

static int os_difftime ( lua_State L)
static
Here is the call graph for this function:

◆ os_execute()

static int os_execute ( lua_State L)
static
Here is the call graph for this function:

◆ os_exit()

static int os_exit ( lua_State L)
static
Here is the call graph for this function:

◆ os_getenv()

static int os_getenv ( lua_State L)
static
Here is the call graph for this function:

◆ os_remove()

static int os_remove ( lua_State L)
static
Here is the call graph for this function:

◆ os_rename()

static int os_rename ( lua_State L)
static
Here is the call graph for this function:

◆ os_setlocale()

static int os_setlocale ( lua_State L)
static
Here is the call graph for this function:

◆ os_time()

static int os_time ( lua_State L)
static
Here is the call graph for this function:

◆ os_tmpname()

static int os_tmpname ( lua_State L)
static
Here is the call graph for this function:

◆ setallfields()

static void setallfields ( lua_State L,
struct tm *  stm 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setboolfield()

static void setboolfield ( lua_State L,
const char *  key,
int  value 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setfield()

static void setfield ( lua_State L,
const char *  key,
int  value 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ syslib

const luaL_Reg syslib[]
static
Initial value:
= {
{"clock", os_clock},
{"date", os_date},
{"difftime", os_difftime},
{"execute", os_execute},
{"exit", os_exit},
{"getenv", os_getenv},
{"remove", os_remove},
{"rename", os_rename},
{"setlocale", os_setlocale},
{"time", os_time},
{"tmpname", os_tmpname},
}
static int os_getenv(lua_State *L)
Definition: loslib.c:177
static int os_setlocale(lua_State *L)
Definition: loslib.c:361
static int os_execute(lua_State *L)
Definition: loslib.c:141
static int os_time(lua_State *L)
Definition: loslib.c:325
static int os_rename(lua_State *L)
Definition: loslib.c:159
#define NULL
Pointer to 0.
Definition: gctypes.h:65
static int os_date(lua_State *L)
Definition: loslib.c:283
static int os_exit(lua_State *L)
Definition: loslib.c:373
static int os_tmpname(lua_State *L)
Definition: loslib.c:166
static int os_remove(lua_State *L)
Definition: loslib.c:153
static int os_difftime(lua_State *L)
Definition: loslib.c:351
static int os_clock(lua_State *L)
Definition: loslib.c:183