Lines 43-53
static const luaL_Reg quvi_reg_meth[] =
Link Here
|
43 |
|
43 |
|
44 |
static const luaL_Reg quvi_http_reg_meth[] = |
44 |
static const luaL_Reg quvi_http_reg_meth[] = |
45 |
{ |
45 |
{ |
|
|
46 |
#if (LUA_VERSION_NUM == 501) |
46 |
{"metainfo", l_quvi_http_metainfo}, |
47 |
{"metainfo", l_quvi_http_metainfo}, |
47 |
{"resolve", l_quvi_http_resolve}, |
48 |
{"resolve", l_quvi_http_resolve}, |
48 |
{"cookie", l_quvi_http_cookie}, |
49 |
{"cookie", l_quvi_http_cookie}, |
49 |
{"header", l_quvi_http_header}, |
50 |
{"header", l_quvi_http_header}, |
50 |
{"fetch", l_quvi_http_fetch}, |
51 |
{"fetch", l_quvi_http_fetch}, |
|
|
52 |
#elif (LUA_VERSION_NUM >= 504) |
53 |
{"quvi.http.metainfo", l_quvi_http_metainfo}, |
54 |
{"quvi.http.resolve", l_quvi_http_resolve}, |
55 |
{"quvi.http.cookie", l_quvi_http_cookie}, |
56 |
{"quvi.http.header", l_quvi_http_header}, |
57 |
{"quvi.http.fetch", l_quvi_http_fetch}, |
58 |
#endif |
51 |
{NULL, NULL} |
59 |
{NULL, NULL} |
52 |
}; |
60 |
}; |
53 |
|
61 |
|
Lines 57-65
extern gint l_quvi_crypto_hash(lua_State
Link Here
|
57 |
|
65 |
|
58 |
static const luaL_Reg quvi_crypto_reg_meth[] = |
66 |
static const luaL_Reg quvi_crypto_reg_meth[] = |
59 |
{ |
67 |
{ |
|
|
68 |
#if (LUA_VERSION_NUM == 501) |
60 |
{"encrypt", l_quvi_crypto_encrypt}, |
69 |
{"encrypt", l_quvi_crypto_encrypt}, |
61 |
{"decrypt", l_quvi_crypto_decrypt}, |
70 |
{"decrypt", l_quvi_crypto_decrypt}, |
62 |
{"hash", l_quvi_crypto_hash}, |
71 |
{"hash", l_quvi_crypto_hash}, |
|
|
72 |
#elif (LUA_VERSION_NUM >= 504) |
73 |
{"quvi.crypto.encrypt", l_quvi_crypto_encrypt}, |
74 |
{"quvi.crypto.decrypt", l_quvi_crypto_decrypt}, |
75 |
{"quvi.crypto.hash", l_quvi_crypto_hash}, |
76 |
#endif |
63 |
{NULL, NULL} |
77 |
{NULL, NULL} |
64 |
}; |
78 |
}; |
65 |
|
79 |
|
Lines 68-75
extern gint l_quvi_base64_decode(lua_Sta
Link Here
|
68 |
|
82 |
|
69 |
static const luaL_Reg quvi_base64_reg_meth[] = |
83 |
static const luaL_Reg quvi_base64_reg_meth[] = |
70 |
{ |
84 |
{ |
|
|
85 |
#if (LUA_VERSION_NUM == 501) |
71 |
{"encode", l_quvi_base64_encode}, |
86 |
{"encode", l_quvi_base64_encode}, |
72 |
{"decode", l_quvi_base64_decode}, |
87 |
{"decode", l_quvi_base64_decode}, |
|
|
88 |
#elif (LUA_VERSION_NUM >= 504) |
89 |
{"quvi.base64.encode", l_quvi_base64_encode}, |
90 |
{"quvi.base64.decode", l_quvi_base64_decode}, |
91 |
#endif |
73 |
{NULL, NULL} |
92 |
{NULL, NULL} |
74 |
}; |
93 |
}; |
75 |
|
94 |
|
Lines 80-89
QuviError l_init(_quvi_t q)
Link Here
|
80 |
return (QUVI_ERROR_LUA_INIT); |
99 |
return (QUVI_ERROR_LUA_INIT); |
81 |
|
100 |
|
82 |
luaL_openlibs(q->handle.lua); |
101 |
luaL_openlibs(q->handle.lua); |
|
|
102 |
#if (LUA_VERSION_NUM == 501) |
83 |
luaL_register(q->handle.lua, "quvi", quvi_reg_meth); |
103 |
luaL_register(q->handle.lua, "quvi", quvi_reg_meth); |
84 |
luaL_register(q->handle.lua, "quvi.http", quvi_http_reg_meth); |
104 |
luaL_register(q->handle.lua, "quvi.http", quvi_http_reg_meth); |
85 |
luaL_register(q->handle.lua, "quvi.crypto", quvi_crypto_reg_meth); |
105 |
luaL_register(q->handle.lua, "quvi.crypto", quvi_crypto_reg_meth); |
86 |
luaL_register(q->handle.lua, "quvi.base64", quvi_base64_reg_meth); |
106 |
luaL_register(q->handle.lua, "quvi.base64", quvi_base64_reg_meth); |
|
|
107 |
#elif (LUA_VERSION_NUM >= 504) |
108 |
luaL_newlib(q->handle.lua, quvi_reg_meth); |
109 |
luaL_newlib(q->handle.lua, quvi_http_reg_meth); |
110 |
luaL_newlib(q->handle.lua, quvi_crypto_reg_meth); |
111 |
luaL_newlib(q->handle.lua, quvi_base64_reg_meth); |
112 |
#endif |
87 |
|
113 |
|
88 |
return (QUVI_OK); |
114 |
return (QUVI_OK); |
89 |
} |
115 |
} |