PageRenderTime 12ms CodeModel.GetById 1ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/script_binding/lua/lua_ftk_mmap.c

http://ftk.googlecode.com/
C | 93 lines | 72 code | 20 blank | 1 comment | 2 complexity | dda139227caebbd473652c9d3de68a42 MD5 | raw file
 1/*This file is generated by luagen.*/
 2#include "lua_ftk_mmap.h"
 3#include "lua_ftk_callbacks.h"
 4
 5static void tolua_reg_types (lua_State* L)
 6{
 7	tolua_usertype(L, "FtkMmap");
 8}
 9
10static int lua_ftk_mmap_create(lua_State* L)
11{
12	tolua_Error err = {0};
13	FtkMmap* retv;
14	const char* filename;
15	int offset;
16	int size;
17	int param_ok = tolua_isstring(L, 1, 0, &err) && tolua_isnumber(L, 2, 0, &err) && tolua_isnumber(L, 3, 0, &err);
18
19	return_val_if_fail(param_ok, 0);
20
21	filename = tolua_tostring(L, 1, 0);
22	offset = tolua_tonumber(L, 2, 0);
23	size = tolua_tonumber(L, 3, 0);
24	retv = ftk_mmap_create(filename, offset, size);
25	tolua_pushusertype(L, (FtkMmap*)retv, "FtkMmap");
26
27	return 1;
28}
29
30static int lua_ftk_mmap_data(lua_State* L)
31{
32	tolua_Error err = {0};
33	void* retv;
34	FtkMmap* thiz;
35	int param_ok = tolua_isusertype(L, 1, "FtkMmap", 0, &err);
36
37	return_val_if_fail(param_ok, 0);
38
39	thiz = tolua_tousertype(L, 1, 0);
40	retv = ftk_mmap_data(thiz);
41	tolua_pushusertype(L, (void*)retv, "void");
42
43	return 1;
44}
45
46static int lua_ftk_mmap_length(lua_State* L)
47{
48	tolua_Error err = {0};
49	int retv;
50	FtkMmap* thiz;
51	int param_ok = tolua_isusertype(L, 1, "FtkMmap", 0, &err);
52
53	return_val_if_fail(param_ok, 0);
54
55	thiz = tolua_tousertype(L, 1, 0);
56	retv = ftk_mmap_length(thiz);
57	tolua_pushnumber(L, (lua_Number)retv);
58
59	return 1;
60}
61
62static int lua_ftk_mmap_destroy(lua_State* L)
63{
64	tolua_Error err = {0};
65	FtkMmap* thiz;
66	int param_ok = tolua_isusertype(L, 1, "FtkMmap", 0, &err);
67
68	return_val_if_fail(param_ok, 0);
69
70	thiz = tolua_tousertype(L, 1, 0);
71	ftk_mmap_destroy(thiz);
72
73	return 1;
74}
75
76int tolua_ftk_mmap_init(lua_State* L)
77{
78	tolua_open(L);
79	tolua_reg_types(L);
80	tolua_module(L, NULL, 0);
81	tolua_beginmodule(L, NULL);
82	tolua_cclass(L,"FtkMmap", "FtkMmap", "", NULL);
83	tolua_beginmodule(L, "FtkMmap");
84	tolua_function(L, "Create", lua_ftk_mmap_create);
85	tolua_function(L, "Data", lua_ftk_mmap_data);
86	tolua_function(L, "Length", lua_ftk_mmap_length);
87	tolua_function(L, "Destroy", lua_ftk_mmap_destroy);
88	tolua_endmodule(L);
89	tolua_endmodule(L);
90
91
92	return 1;
93}