loadlib.c File Reference

Go to the source code of this file.

Defines

#define loadlib_c
#define LUA_LIB
#define LUA_POF   "luaopen_"
#define LUA_OFSEP   "_"
#define LIBPREFIX   "LOADLIB: "
#define POF   LUA_POF
#define LIB_FAIL   "open"
#define ERRLIB   1
#define ERRFUNC   2
#define setprogdir(L)   ((void)0)
#define LIB_FAIL   "absent"
#define DLMSG   "dynamic libraries not enabled; check your Lua installation"
#define sentinel   ((void *)&sentinel_)
#define AUXMARK   "\1"

Functions

static void ll_unloadlib (void *lib)
static void * ll_load (lua_State *L, const char *path)
static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym)
static void ** ll_register (lua_State *L, const char *path)
static int gctm (lua_State *L)
static int ll_loadfunc (lua_State *L, const char *path, const char *sym)
static int ll_loadlib (lua_State *L)
static int readable (const char *filename)
static const char * pushnexttemplate (lua_State *L, const char *path)
static const char * findfile (lua_State *L, const char *name, const char *pname)
static void loaderror (lua_State *L, const char *filename)
static int loader_Lua (lua_State *L)
static const char * mkfuncname (lua_State *L, const char *modname)
static int loader_C (lua_State *L)
static int loader_Croot (lua_State *L)
static int loader_preload (lua_State *L)
static int ll_require (lua_State *L)
static void setfenv (lua_State *L)
static void dooptions (lua_State *L, int n)
static void modinit (lua_State *L, const char *modname)
static int ll_module (lua_State *L)
static int ll_seeall (lua_State *L)
static void setpath (lua_State *L, const char *fieldname, const char *envname, const char *def)
LUALIB_API int luaopen_package (lua_State *L)

Variables

static const int sentinel_ = 0
static const luaL_Reg pk_funcs []
static const luaL_Reg ll_funcs []
static const lua_CFunction loaders []

Define Documentation

#define AUXMARK   "\1"

Definition at line 627 of file loadlib.c.

Referenced by setpath().

#define DLMSG   "dynamic libraries not enabled; check your Lua installation"

Definition at line 273 of file loadlib.c.

Referenced by ll_load(), and ll_sym().

#define ERRFUNC   2

Definition at line 40 of file loadlib.c.

Referenced by ll_loadfunc(), and loader_Croot().

#define ERRLIB   1

Definition at line 39 of file loadlib.c.

Referenced by ll_loadfunc(), and ll_loadlib().

#define LIB_FAIL   "absent"

Definition at line 270 of file loadlib.c.

#define LIB_FAIL   "open"

Definition at line 270 of file loadlib.c.

Referenced by ll_loadlib().

#define LIBPREFIX   "LOADLIB: "

Definition at line 32 of file loadlib.c.

Referenced by ll_register().

#define loadlib_c

Definition at line 16 of file loadlib.c.

#define LUA_LIB

Definition at line 17 of file loadlib.c.

#define LUA_OFSEP   "_"

Definition at line 29 of file loadlib.c.

Referenced by mkfuncname().

#define LUA_POF   "luaopen_"

Definition at line 26 of file loadlib.c.

#define POF   LUA_POF

Definition at line 34 of file loadlib.c.

Referenced by mkfuncname().

#define sentinel   ((void *)&sentinel_)

Definition at line 485 of file loadlib.c.

Referenced by ll_require().

#define setprogdir (  )     ((void)0)

Definition at line 42 of file loadlib.c.

Referenced by setpath().


Function Documentation

static void dooptions ( lua_State L,
int  n 
) [static]

Definition at line 556 of file loadlib.c.

References lua_call(), and lua_pushvalue().

Referenced by ll_module().

static const char* findfile ( lua_State L,
const char *  name,
const char *  pname 
) [static]
static int gctm ( lua_State L  )  [static]

Definition at line 323 of file loadlib.c.

References ll_unloadlib(), and luaL_checkudata().

Referenced by luaopen_package().

static void * ll_load ( lua_State L,
const char *  path 
) [static]

Definition at line 281 of file loadlib.c.

References DLMSG, and lua_pushliteral.

Referenced by ll_loadfunc().

static int ll_loadfunc ( lua_State L,
const char *  path,
const char *  sym 
) [static]

Definition at line 331 of file loadlib.c.

References ERRFUNC, ERRLIB, ll_load(), ll_register(), ll_sym(), and lua_pushcfunction.

Referenced by ll_loadlib(), loader_C(), and loader_Croot().

static int ll_loadlib ( lua_State L  )  [static]
static int ll_module ( lua_State L  )  [static]
static void** ll_register ( lua_State L,
const char *  path 
) [static]
static int ll_require ( lua_State L  )  [static]
static int ll_seeall ( lua_State L  )  [static]
static lua_CFunction ll_sym ( lua_State L,
void *  lib,
const char *  sym 
) [static]

Definition at line 288 of file loadlib.c.

References DLMSG, and lua_pushliteral.

Referenced by ll_loadfunc().

static void ll_unloadlib ( void *  lib  )  [static]

Definition at line 276 of file loadlib.c.

Referenced by gctm().

static int loader_C ( lua_State L  )  [static]

Definition at line 439 of file loadlib.c.

References findfile(), funcname(), ll_loadfunc(), loaderror(), luaL_checkstring, and mkfuncname().

static int loader_Croot ( lua_State L  )  [static]
static int loader_Lua ( lua_State L  )  [static]

Definition at line 417 of file loadlib.c.

References findfile(), loaderror(), luaL_checkstring, and luaL_loadfile().

static int loader_preload ( lua_State L  )  [static]
static void loaderror ( lua_State L,
const char *  filename 
) [static]

Definition at line 411 of file loadlib.c.

References LUA_QS, lua_tostring, and luaL_error().

Referenced by loader_C(), loader_Croot(), and loader_Lua().

LUALIB_API int luaopen_package ( lua_State L  ) 
static const char* mkfuncname ( lua_State L,
const char *  modname 
) [static]

Definition at line 428 of file loadlib.c.

References funcname(), LUA_IGMARK, LUA_OFSEP, lua_pushfstring(), lua_remove(), luaL_gsub(), and POF.

Referenced by loader_C(), and loader_Croot().

static void modinit ( lua_State L,
const char *  modname 
) [static]

Definition at line 566 of file loadlib.c.

References lua_pushlstring(), lua_pushstring(), lua_pushvalue(), and lua_setfield().

Referenced by ll_module().

static const char* pushnexttemplate ( lua_State L,
const char *  path 
) [static]

Definition at line 377 of file loadlib.c.

References LUA_PATHSEP, and lua_pushlstring().

Referenced by findfile().

static int readable ( const char *  filename  )  [static]

Definition at line 369 of file loadlib.c.

Referenced by findfile().

static void setfenv ( lua_State L  )  [static]
static void setpath ( lua_State L,
const char *  fieldname,
const char *  envname,
const char *  def 
) [static]

Definition at line 629 of file loadlib.c.

References AUXMARK, LUA_PATHSEP, lua_pushstring(), lua_remove(), lua_setfield(), luaL_gsub(), and setprogdir.

Referenced by luaopen_package().


Variable Documentation

const luaL_Reg ll_funcs[] [static]
Initial value:
 {
  {"module", ll_module},
  {"require", ll_require},
  {NULL, NULL}
}

Definition at line 653 of file loadlib.c.

const lua_CFunction loaders[] [static]
Initial value:

Definition at line 660 of file loadlib.c.

const luaL_Reg pk_funcs[] [static]
Initial value:
 {
  {"loadlib", ll_loadlib},
  {"seeall", ll_seeall},
  {NULL, NULL}
}

Definition at line 646 of file loadlib.c.

const int sentinel_ = 0 [static]

Definition at line 484 of file loadlib.c.


ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:50:00 2011 by Doxygen 1.6.1