Remove building with NOCRYPTO option
[minix.git] / external / mit / lua / dist / src / lfunc.h
blob042704e48d8f67264061d46f4f7a3c4cf60e6f87
1 /* $NetBSD: lfunc.h,v 1.3 2015/10/08 13:21:00 mbalmer Exp $ */
3 /*
4 ** Id: lfunc.h,v 2.15 2015/01/13 15:49:11 roberto Exp
5 ** Auxiliary functions to manipulate prototypes and closures
6 ** See Copyright Notice in lua.h
7 */
9 #ifndef lfunc_h
10 #define lfunc_h
13 #include "lobject.h"
16 #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \
17 cast(int, sizeof(TValue)*((n)-1)))
19 #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \
20 cast(int, sizeof(TValue *)*((n)-1)))
23 /* test whether thread is in 'twups' list */
24 #define isintwups(L) (L->twups != L)
28 ** maximum number of upvalues in a closure (both C and Lua). (Value
29 ** must fit in a VM register.)
31 #define MAXUPVAL 255
35 ** Upvalues for Lua closures
37 struct UpVal {
38 TValue *v; /* points to stack or to its own value */
39 lu_mem refcount; /* reference counter */
40 union {
41 struct { /* (when open) */
42 UpVal *next; /* linked list */
43 int touched; /* mark to avoid cycles with dead threads */
44 } open;
45 TValue value; /* the value (when closed) */
46 } u;
49 #define upisopen(up) ((up)->v != &(up)->u.value)
52 LUAI_FUNC Proto *luaF_newproto (lua_State *L);
53 LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems);
54 LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems);
55 LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl);
56 LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level);
57 LUAI_FUNC void luaF_close (lua_State *L, StkId level);
58 LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f);
59 LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number,
60 int pc);
63 #endif