xref: /freebsd-src/sys/contrib/openzfs/module/lua/lapi.h (revision c03c5b1c80914ec656fbee84539355d1fad68bf9)
1*eda14cbcSMatt Macy /*
2*eda14cbcSMatt Macy ** $Id: lapi.h,v 2.7.1.1 2013/04/12 18:48:47 roberto Exp $
3*eda14cbcSMatt Macy ** Auxiliary functions from Lua API
4*eda14cbcSMatt Macy ** See Copyright Notice in lua.h
5*eda14cbcSMatt Macy */
6*eda14cbcSMatt Macy 
7*eda14cbcSMatt Macy #ifndef lapi_h
8*eda14cbcSMatt Macy #define lapi_h
9*eda14cbcSMatt Macy 
10*eda14cbcSMatt Macy 
11*eda14cbcSMatt Macy #include "llimits.h"
12*eda14cbcSMatt Macy #include "lstate.h"
13*eda14cbcSMatt Macy 
14*eda14cbcSMatt Macy #define api_incr_top(L)   {L->top++; api_check(L, L->top <= L->ci->top, \
15*eda14cbcSMatt Macy 				"stack overflow");}
16*eda14cbcSMatt Macy 
17*eda14cbcSMatt Macy #define adjustresults(L,nres) \
18*eda14cbcSMatt Macy     { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; }
19*eda14cbcSMatt Macy 
20*eda14cbcSMatt Macy #define api_checknelems(L,n)	api_check(L, (n) < (L->top - L->ci->func), \
21*eda14cbcSMatt Macy 				  "not enough elements in the stack")
22*eda14cbcSMatt Macy 
23*eda14cbcSMatt Macy 
24*eda14cbcSMatt Macy #endif
25