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