PageRenderTime 26ms CodeModel.GetById 12ms app.highlight 10ms RepoModel.GetById 2ms app.codeStats 0ms

/script_binding/lua/lua_ftk_dir.c

http://ftk.googlecode.com/
C | 74 lines | 57 code | 16 blank | 1 comment | 1 complexity | 8679d768687184026f2453f58401e476 MD5 | raw file
 1/*This file is generated by luagen.*/
 2#include "lua_ftk_dir.h"
 3#include "lua_ftk_callbacks.h"
 4
 5static void tolua_reg_types (lua_State* L)
 6{
 7	tolua_usertype(L, "FtkDir");
 8}
 9
10static int lua_ftk_dir_open(lua_State* L)
11{
12	tolua_Error err = {0};
13	FtkDir* retv;
14	const char* dir_name;
15	int param_ok = tolua_isstring(L, 1, 0, &err);
16
17	return_val_if_fail(param_ok, 0);
18
19	dir_name = tolua_tostring(L, 1, 0);
20	retv = ftk_dir_open(dir_name);
21	tolua_pushusertype(L, (FtkDir*)retv, "FtkDir");
22
23	return 1;
24}
25
26static int lua_ftk_dir_read(lua_State* L)
27{
28	tolua_Error err = {0};
29	Ret retv;
30	FtkDir* dir;
31	FtkFileInfo* info;
32	int param_ok = tolua_isusertype(L, 1, "FtkDir", 0, &err) && tolua_isusertype(L, 2, "FtkFileInfo", 0, &err);
33
34	return_val_if_fail(param_ok, 0);
35
36	dir = tolua_tousertype(L, 1, 0);
37	info = tolua_tousertype(L, 2, 0);
38	retv = ftk_dir_read(dir, info);
39	tolua_pushnumber(L, (lua_Number)retv);
40
41	return 1;
42}
43
44static int lua_ftk_dir_close(lua_State* L)
45{
46	tolua_Error err = {0};
47	FtkDir* dir;
48	int param_ok = tolua_isusertype(L, 1, "FtkDir", 0, &err);
49
50	return_val_if_fail(param_ok, 0);
51
52	dir = tolua_tousertype(L, 1, 0);
53	ftk_dir_close(dir);
54
55	return 1;
56}
57
58int tolua_ftk_dir_init(lua_State* L)
59{
60	tolua_open(L);
61	tolua_reg_types(L);
62	tolua_module(L, NULL, 0);
63	tolua_beginmodule(L, NULL);
64	tolua_cclass(L,"FtkDir", "FtkDir", "", NULL);
65	tolua_beginmodule(L, "FtkDir");
66	tolua_function(L, "Open", lua_ftk_dir_open);
67	tolua_function(L, "Read", lua_ftk_dir_read);
68	tolua_function(L, "Close", lua_ftk_dir_close);
69	tolua_endmodule(L);
70	tolua_endmodule(L);
71
72
73	return 1;
74}