aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser/luatablegen/resizable_limit_t_tablegen.c
blob: f7775109f085e22ee31981e75073142efc49733f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// automatically generated by luatablegen
#include "../lua-5.3.4/src/lua.h"
#include "../lua-5.3.4/src/lauxlib.h"
#include "../lua-5.3.4/src/lualib.h"
#include <inttypes.h>
#include <stdbool.h>
#include "./resizable_limit_t_tablegen.h"

#include "../wasm.h"

static resizable_limit_t* convert_resizable_limit_t (lua_State* __ls, int index) {
	resizable_limit_t* dummy = (resizable_limit_t*)lua_touserdata(__ls, index);
	if (dummy == NULL) printf("resizable_limit_t:bad user data type.\n");
	return dummy;
}

static resizable_limit_t* check_resizable_limit_t(lua_State* __ls, int index) {
	resizable_limit_t* dummy;
	luaL_checktype(__ls, index, LUA_TUSERDATA);
	dummy = (resizable_limit_t*)luaL_checkudata(__ls, index, "resizable_limit_t");
	if (dummy == NULL) printf("resizable_limit_t:bad user data type.\n");
	return dummy;
}

resizable_limit_t* push_resizable_limit_t(lua_State* __ls) {
	lua_checkstack(__ls, 1);
	resizable_limit_t* dummy = lua_newuserdata(__ls, sizeof(resizable_limit_t));
	luaL_getmetatable(__ls, "resizable_limit_t");
	lua_setmetatable(__ls, -2);
	return dummy;
}

int resizable_limit_t_push_args(lua_State* __ls, resizable_limit_t* _st) {
	lua_checkstack(__ls, 3);
	lua_pushinteger(__ls, _st->flags);
	lua_pushinteger(__ls, _st->initial);
	lua_pushinteger(__ls, _st->maximum);
	return 0;
}

int new_resizable_limit_t(lua_State* __ls) {
	lua_checkstack(__ls, 3);
	varuint1 flags = luaL_optinteger(__ls,-3,0);
	varuint32 initial = luaL_optinteger(__ls,-2,0);
	varuint32 maximum = luaL_optinteger(__ls,-1,0);
	resizable_limit_t* dummy = push_resizable_limit_t(__ls);
	dummy->flags = flags;
	dummy->initial = initial;
	dummy->maximum = maximum;
	return 1;
}

static int getter_resizable_limit_t_flags(lua_State* __ls) {
	resizable_limit_t* dummy = check_resizable_limit_t(__ls, 1);
	lua_pop(__ls, -1);
	lua_pushinteger(__ls, dummy->flags);
	return 1;
}
static int getter_resizable_limit_t_initial(lua_State* __ls) {
	resizable_limit_t* dummy = check_resizable_limit_t(__ls, 1);
	lua_pop(__ls, -1);
	lua_pushinteger(__ls, dummy->initial);
	return 1;
}
static int getter_resizable_limit_t_maximum(lua_State* __ls) {
	resizable_limit_t* dummy = check_resizable_limit_t(__ls, 1);
	lua_pop(__ls, -1);
	lua_pushinteger(__ls, dummy->maximum);
	return 1;
}

static int setter_resizable_limit_t_flags(lua_State* __ls) {
	resizable_limit_t* dummy = check_resizable_limit_t(__ls, 1);
	dummy->flags = luaL_checkinteger(__ls, 2);
	lua_settop(__ls, 1);
	return 1;
}
static int setter_resizable_limit_t_initial(lua_State* __ls) {
	resizable_limit_t* dummy = check_resizable_limit_t(__ls, 1);
	dummy->initial = luaL_checkinteger(__ls, 2);
	lua_settop(__ls, 1);
	return 1;
}
static int setter_resizable_limit_t_maximum(lua_State* __ls) {
	resizable_limit_t* dummy = check_resizable_limit_t(__ls, 1);
	dummy->maximum = luaL_checkinteger(__ls, 2);
	lua_settop(__ls, 1);
	return 1;
}

static const luaL_Reg resizable_limit_t_methods[] = {
	{"new", new_resizable_limit_t},
	{"set_flags", setter_resizable_limit_t_flags},
	{"set_initial", setter_resizable_limit_t_initial},
	{"set_maximum", setter_resizable_limit_t_maximum},
	{"flags", getter_resizable_limit_t_flags},
	{"initial", getter_resizable_limit_t_initial},
	{"maximum", getter_resizable_limit_t_maximum},
	{0,0}
};

static const luaL_Reg resizable_limit_t_meta[] = {
	{0, 0}
};

int resizable_limit_t_register(lua_State* __ls) {
	luaL_openlib(__ls, "resizable_limit_t", resizable_limit_t_methods, 0);
	luaL_newmetatable(__ls, "resizable_limit_t");
	luaL_openlib(__ls, 0, resizable_limit_t_meta, 0);
	lua_pushliteral(__ls, "__index");
	lua_pushvalue(__ls, -3);
	lua_rawset(__ls, -3);
	lua_pushliteral(__ls, "__metatable");
	lua_pushvalue(__ls, -3);
	lua_rawset(__ls, -3);
	lua_pop(__ls, 1);
return 1;
}