Defines | Functions | Variables

lua/loslib.c File Reference

#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:

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 Documentation

#define l_gmtime (   t,
  r 
)    ((void)r, gmtime(t))

Definition at line 72 of file loslib.c.

Referenced by os_date().

#define l_localtime (   t,
  r 
)    ((void)r, localtime(t))

Definition at line 73 of file loslib.c.

Referenced by os_date().

#define loslib_c

Definition at line 14 of file loslib.c.

#define LUA_LIB

Definition at line 15 of file loslib.c.

#define LUA_STRFTIMEOPTIONS   { "aAbBcdHIjmMpSUwWxXyYz%", "" }

Definition at line 29 of file loslib.c.

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

Definition at line 56 of file loslib.c.

Referenced by os_tmpname().

#define LUA_TMPNAMBUFSIZE   L_tmpnam

Definition at line 55 of file loslib.c.


Function Documentation

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

LUAMOD_API int luaopen_os ( lua_State L  ) 

Definition at line 318 of file loslib.c.

References luaL_newlib.

Referenced by LuaKernel::LuaKernel().

Here is the caller graph for this function:

static int os_clock ( lua_State L  )  [static]

Definition at line 121 of file loslib.c.

References lua_pushnumber().

Here is the call graph for this function:

static int os_date ( lua_State L  )  [static]
static int os_difftime ( lua_State L  )  [static]

Definition at line 265 of file loslib.c.

References lua_pushnumber(), luaL_checknumber(), and luaL_optnumber().

Here is the call graph for this function:

static int os_execute ( lua_State L  )  [static]

Definition at line 79 of file loslib.c.

References lua_pushboolean(), luaL_execresult(), and luaL_optstring.

Here is the call graph for this function:

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.

Here is the call graph for this function:

static int os_getenv ( lua_State L  )  [static]

Definition at line 115 of file loslib.c.

References lua_pushstring(), and luaL_checkstring.

Here is the call graph for this function:

static int os_remove ( lua_State L  )  [static]

Definition at line 91 of file loslib.c.

References luaL_checkstring, and luaL_fileresult().

Here is the call graph for this function:

static int os_rename ( lua_State L  )  [static]

Definition at line 97 of file loslib.c.

References luaL_checkstring, and luaL_fileresult().

Here is the call graph for this function:

static int os_setlocale ( lua_State L  )  [static]

Definition at line 274 of file loslib.c.

References lua_pushstring(), luaL_checkoption(), and luaL_optstring.

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

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},
  {NULL, NULL}
}

Definition at line 299 of file loslib.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:07:25 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs