loadlib.c File Reference

#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
Include dependency graph for loadlib.c:

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 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 590 of file loadlib.c.

Referenced by setpath().

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

Definition at line 236 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 233 of file loadlib.c.

#define LIB_FAIL   "open"

Definition at line 233 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 448 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 519 of file loadlib.c.

References i, 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 286 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 244 of file loadlib.c.

References DLMSG, lua_pushliteral, and void().

Referenced by ll_loadfunc().

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

Definition at line 294 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 251 of file loadlib.c.

References DLMSG, lua_pushliteral, and void().

Referenced by ll_loadfunc().

static void ll_unloadlib ( void *  lib  )  [static]

Definition at line 239 of file loadlib.c.

References void().

Referenced by gctm().

static int loader_C ( lua_State L  )  [static]

Definition at line 402 of file loadlib.c.

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

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

Definition at line 380 of file loadlib.c.

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

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

Definition at line 374 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 391 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 529 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 340 of file loadlib.c.

References LUA_PATHSEP, and lua_pushlstring().

Referenced by findfile().

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

Definition at line 332 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 592 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 616 of file loadlib.c.

const lua_CFunction loaders[] [static]
Initial value:

Definition at line 623 of file loadlib.c.

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

Definition at line 609 of file loadlib.c.

int sentinel_ = 0 [static]

Definition at line 447 of file loadlib.c.


Generated by  doxygen 1.6.2