Go to the documentation of this file.
31 #if !defined(LUA_STRFTIMEOPTIONS)
34 #define L_STRFTIMEC89 "aAbBcdHIjmMpSUwWxXyYZ%"
37 #define L_STRFTIMEC99 "aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%" \
38 "||" "EcECExEXEyEY" "OdOeOHOIOmOMOSOuOUOVOwOWOy"
41 #define L_STRFTIMEWIN "aAbBcdHIjmMpSUwWxXyYzZ%" \
42 "||" "#c#x#d#H#I#j#m#M#S#U#w#W#y#Y"
44 #if defined(LUA_USE_WINDOWS)
45 #define LUA_STRFTIMEOPTIONS L_STRFTIMEWIN
46 #elif defined(LUA_USE_C89)
47 #define LUA_STRFTIMEOPTIONS L_STRFTIMEC89
49 #define LUA_STRFTIMEOPTIONS L_STRFTIMEC99
65 #if !defined(LUA_NUMTIME)
67 #define l_timet lua_Integer
68 #define l_pushtime(L,t) lua_pushinteger(L,(lua_Integer)(t))
69 #define l_gettime(L,arg) luaL_checkinteger(L, arg)
73 #define l_timet lua_Number
74 #define l_pushtime(L,t) lua_pushnumber(L,(lua_Number)(t))
75 #define l_gettime(L,arg) luaL_checknumber(L, arg)
80 #if !defined(l_gmtime)
86 #if defined(LUA_USE_POSIX)
88 #define l_gmtime(t,r) gmtime_r(t,r)
89 #define l_localtime(t,r) localtime_r(t,r)
94 #define l_gmtime(t,r) ((void)(r)->tm_sec, gmtime(t))
95 #define l_localtime(t,r) ((void)(r)->tm_sec, localtime(t))
111 #if !defined(lua_tmpnam)
113 #if defined(LUA_USE_POSIX)
117 #define LUA_TMPNAMBUFSIZE 32
119 #if !defined(LUA_TMPNAMTEMPLATE)
120 #define LUA_TMPNAMTEMPLATE "/tmp/lua_XXXXXX"
123 #define lua_tmpnam(b,e) { \
124 strcpy(b, LUA_TMPNAMTEMPLATE); \
126 if (e != -1) close(e); \
132 #define LUA_TMPNAMBUFSIZE L_tmpnam
133 #define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); }
174 return luaL_error(L,
"unable to generate a unique filename");
210 #if (defined(LUA_NUMTIME) && LUA_MAXINTEGER <= INT_MAX)
211 if (l_unlikely(value > LUA_MAXINTEGER - delta))
212 luaL_error(L,
"field '%s' is out-of-bound", key);
231 setfield(L,
"year", stm->tm_year, 1900);
232 setfield(L,
"month", stm->tm_mon, 1);
233 setfield(L,
"day", stm->tm_mday, 0);
234 setfield(L,
"hour", stm->tm_hour, 0);
237 setfield(L,
"yday", stm->tm_yday, 1);
238 setfield(L,
"wday", stm->tm_wday, 1);
257 return luaL_error(L,
"field '%s' is not an integer", key);
258 else if (l_unlikely(
d < 0))
259 return luaL_error(L,
"field '%s' missing in date table", key);
266 return luaL_error(L,
"field '%s' is out-of-bound", key);
275 ptrdiff_t convlen,
char *buff) {
278 for (; *option !=
'\0' && oplen <= convlen; option += oplen) {
281 else if (memcmp(conv, option, oplen) == 0) {
282 memcpy(buff, conv, oplen);
301 #define SIZETIMEFMT 250
308 const char *se =
s + slen;
318 "date result cannot be represented in this installation");
319 if (strcmp(
s,
"*t") == 0) {
354 ts.tm_year =
getfield(L,
"year", -1, 1900);
355 ts.tm_mon =
getfield(L,
"month", -1, 1);
356 ts.tm_mday =
getfield(L,
"day", -1, 0);
357 ts.tm_hour =
getfield(L,
"hour", 12, 0);
358 ts.tm_min =
getfield(L,
"min", 0, 0);
359 ts.tm_sec =
getfield(L,
"sec", 0, 0);
364 if (t != (time_t)(
l_timet)t || t == (time_t)(-1))
366 "time result cannot be represented in this installation");
383 static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY,
384 LC_NUMERIC, LC_TIME};
385 static const char *
const catnames[] = {
"all",
"collate",
"ctype",
"monetary",
386 "numeric",
"time", NULL};
397 status = (
lua_toboolean(L, 1) ? EXIT_SUCCESS : EXIT_FAILURE);
static int os_tmpname(lua_State *L)
#define luaL_optstring(L, n, d)
static int getfield(lua_State *L, const char *key, int d, int delta)
static int os_exit(lua_State *L)
LUA_UNSIGNED lua_Unsigned
static void setboolfield(lua_State *L, const char *key, int value)
static int os_time(lua_State *L)
#define luaL_checkstring(L, n)
LUA_API int lua_getfield(lua_State *L, int idx, const char *k)
LUALIB_API void luaL_buffinit(lua_State *L, luaL_Buffer *B)
static int os_clock(lua_State *L)
LUA_API void lua_pushinteger(lua_State *L, lua_Integer n)
static int os_setlocale(lua_State *L)
static void setfield(lua_State *L, const char *key, int value, int delta)
const LUA_API char * lua_pushfstring(lua_State *L, const char *fmt,...)
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
LUALIB_API int luaL_checkoption(lua_State *L, int arg, const char *def, const char *const lst[])
#define lua_isnoneornil(L, n)
static int os_rename(lua_State *L)
static int getboolfield(lua_State *L, const char *key)
#define LUA_TMPNAMBUFSIZE
static const luaL_Reg syslib[]
LUA_API void lua_pushnumber(lua_State *L, lua_Number n)
const LUA_API char * lua_pushstring(lua_State *L, const char *s)
LUALIB_API void luaL_pushresult(luaL_Buffer *B)
const LUALIB_API char * luaL_optlstring(lua_State *L, int arg, const char *def, size_t *len)
LUALIB_API int luaL_fileresult(lua_State *L, int stat, const char *fname)
static int os_getenv(lua_State *L)
LUA_API void lua_setfield(lua_State *L, int idx, const char *k)
LUALIB_API int luaL_execresult(lua_State *L, int stat)
LUALIB_API int luaL_argerror(lua_State *L, int arg, const char *extramsg)
#define LUA_STRFTIMEOPTIONS
#define luaL_opt(L, f, n, d)
#define luaL_argcheck(L, cond, arg, extramsg)
#define luaL_addchar(B, c)
#define lua_isboolean(L, n)
LUAMOD_API int luaopen_os(lua_State *L)
LUA_API void lua_settop(lua_State *L, int idx)
LUA_API void lua_pushboolean(lua_State *L, int b)
LUALIB_API void luaL_checktype(lua_State *L, int arg, int t)
LUA_API void lua_close(lua_State *L)
#define l_gettime(L, arg)
static time_t l_checktime(lua_State *L, int arg)
LUALIB_API char * luaL_prepbuffsize(luaL_Buffer *B, size_t sz)
static int os_date(lua_State *L)
LUALIB_API lua_Integer luaL_optinteger(lua_State *L, int arg, lua_Integer def)
static int os_execute(lua_State *L)
void remove(lua_State *L_, int rawindex, int count)
#define luaL_newlib(L, l)
LUALIB_API int luaL_error(lua_State *L, const char *fmt,...)
static const char * checkoption(lua_State *L, const char *conv, ptrdiff_t convlen, char *buff)
LUA_API lua_Integer lua_tointegerx(lua_State *L, int idx, int *pisnum)
LUA_API int lua_toboolean(lua_State *L, int idx)
static void setallfields(lua_State *L, struct tm *stm)
LUA_API void lua_createtable(lua_State *L, int narray, int nrec)
#define l_localtime(t, r)
#define luaL_addsize(B, s)
static int os_difftime(lua_State *L)
static int os_remove(lua_State *L)
plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45