#include <errno.h>#include <locale.h>#include <stdlib.h>#include <string.h>#include <time.h>#include "lua.h"#include "lauxlib.h"#include "lualib.h"
Go to the source code of this file.
Defines | |
| #define | loslib_c |
| #define | LUA_LIB |
| #define | LUA_STRFTIMEOPTIONS { "aAbBcdHIjmMpSUwWxXyYz%", "" } |
| #define | LUA_TMPNAMBUFSIZE L_tmpnam |
| #define | lua_tmpnam(b, e) { e = (tmpnam(b) == NULL); } |
| #define | l_gmtime(t, r) ((void)r, gmtime(t)) |
| #define | l_localtime(t, r) ((void)r, localtime(t)) |
Functions | |
| 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 int | getboolfield (lua_State *L, const char *key) |
| static int | getfield (lua_State *L, const char *key, int d) |
| static const char * | checkoption (lua_State *L, const char *conv, 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 [] |
| #define l_gmtime | ( | t, | ||
| r | ||||
| ) | ((void)r, gmtime(t)) |
| #define l_localtime | ( | t, | ||
| r | ||||
| ) | ((void)r, localtime(t)) |
| #define LUA_STRFTIMEOPTIONS { "aAbBcdHIjmMpSUwWxXyYz%", "" } |
| #define lua_tmpnam | ( | b, | ||
| e | ||||
| ) | { e = (tmpnam(b) == NULL); } |
Definition at line 56 of file loslib.c.
Referenced by os_tmpname().
| static const char* checkoption | ( | lua_State * | L, | |
| const char * | conv, | |||
| char * | buff | |||
| ) | [static] |
Definition at line 170 of file loslib.c.
References lua_pushfstring(), and luaL_argerror().
Referenced by os_date().


| static int getboolfield | ( | lua_State * | L, | |
| const char * | key | |||
| ) | [static] |
Definition at line 147 of file loslib.c.
References lua_getfield(), lua_isnil, lua_pop, and lua_toboolean().
Referenced by os_time().


| static int getfield | ( | lua_State * | L, | |
| const char * | key, | |||
| int | d | |||
| ) | [static] |
Definition at line 156 of file loslib.c.
References lua_getfield(), lua_pop, LUA_QS, lua_tointegerx(), and luaL_error().
Referenced by os_time().


| LUAMOD_API int luaopen_os | ( | lua_State * | L | ) |
Definition at line 318 of file loslib.c.
References luaL_newlib.
Referenced by LuaKernel::LuaKernel().

| static int os_clock | ( | lua_State * | L | ) | [static] |
Definition at line 121 of file loslib.c.
References lua_pushnumber().

| static int os_date | ( | lua_State * | L | ) | [static] |
Definition at line 194 of file loslib.c.
References checkoption(), l_gmtime, l_localtime, lua_createtable(), lua_pushnil(), luaL_addchar, luaL_addlstring(), luaL_buffinit(), luaL_checknumber(), luaL_opt, luaL_optstring, luaL_pushresult(), setboolfield(), and setfield().

| static int os_difftime | ( | lua_State * | L | ) | [static] |
Definition at line 265 of file loslib.c.
References lua_pushnumber(), luaL_checknumber(), and luaL_optnumber().

| static int os_execute | ( | lua_State * | L | ) | [static] |
Definition at line 79 of file loslib.c.
References lua_pushboolean(), luaL_execresult(), and luaL_optstring.

| static int os_exit | ( | lua_State * | L | ) | [static] |
Definition at line 286 of file loslib.c.
References lua_close(), lua_isboolean, lua_toboolean(), and luaL_optint.

| static int os_getenv | ( | lua_State * | L | ) | [static] |
Definition at line 115 of file loslib.c.
References lua_pushstring(), and luaL_checkstring.

| static int os_remove | ( | lua_State * | L | ) | [static] |
Definition at line 91 of file loslib.c.
References luaL_checkstring, and luaL_fileresult().

| static int os_rename | ( | lua_State * | L | ) | [static] |
Definition at line 97 of file loslib.c.
References luaL_checkstring, and luaL_fileresult().

| static int os_setlocale | ( | lua_State * | L | ) | [static] |
Definition at line 274 of file loslib.c.
References lua_pushstring(), luaL_checkoption(), and luaL_optstring.

| static int os_time | ( | lua_State * | L | ) | [static] |
Definition at line 240 of file loslib.c.
References getboolfield(), getfield(), lua_isnoneornil, lua_pushnil(), lua_pushnumber(), lua_settop(), LUA_TTABLE, and luaL_checktype().

| static int os_tmpname | ( | lua_State * | L | ) | [static] |
Definition at line 104 of file loslib.c.
References lg::err, lua_pushstring(), lua_tmpnam, and luaL_error().

| static void setboolfield | ( | lua_State * | L, | |
| const char * | key, | |||
| int | value | |||
| ) | [static] |
Definition at line 140 of file loslib.c.
References lua_pushboolean(), and lua_setfield().
Referenced by os_date().


| static void setfield | ( | lua_State * | L, | |
| const char * | key, | |||
| int | value | |||
| ) | [static] |
Definition at line 135 of file loslib.c.
References lua_pushinteger(), and lua_setfield().
Referenced by os_date().


{
{"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},
{NULL, NULL}
}
| Generated by doxygen 1.7.1 on Fri May 25 2012 01:07:25 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |