--- a/lm_proxy.c Mon Feb 23 19:19:13 2009 +0200
+++ b/lm_proxy.c Sun Mar 08 00:48:19 2009 +0200
@@ -16,7 +16,7 @@
/// proxy type
/// Stirng, specifying proxy-server type. The only type supported for now is http.
/// G:
-const string2enum_t llm_proxy_type[] = {
+const string2enum_t type_lm_proxy[] = {
{ "http", LM_PROXY_TYPE_HTTP },
{ "none", LM_PROXY_TYPE_NONE },
{ NULL, LM_PROXY_TYPE_HTTP },
@@ -27,15 +27,15 @@
/// Note, you should specify either none of args or both.
/// A: proxy type, string (optional proxy server name), integer (optional server port)
/// R: lm proxy object
-static int llm_proxy_new (lua_State *L)
+static int new_lm_proxy (lua_State *L)
{
- int type = luaL_checkenum (L, 1, llm_proxy_type);
+ int type = luaL_checkenum (L, 1, type_lm_proxy);
LmProxy *proxy;
if (lua_gettop (L) > 0)
proxy = lm_proxy_new_with_server (type, luaL_checkstring (L, 2), luaL_checkint (L, 3));
else
proxy = lm_proxy_new (type);
- llm_proxy_bless (L, proxy);
+ bless_lm_proxy (L, proxy);
lm_proxy_unref (proxy); // XXX
D ("Proxy %X created", (int) proxy);
return 1;
@@ -45,10 +45,10 @@
/// Blesses given pointer to lm proxy object.
/// A: lightuserdata (C lm proxy object)
/// R: lm proxy object
-static int llm_proxy_bless_lua (lua_State *L)
+static int bless_lua_lm_proxy (lua_State *L)
{
luaL_argcheck (L, lua_islightuserdata (L, 1), 1, "lm proxy lightuserdata expected");
- llm_proxy_bless (L, lua_touserdata (L, 1));
+ bless_lm_proxy (L, lua_touserdata (L, 1));
return 1;
}
@@ -56,14 +56,14 @@
/// Gets or sets proxy server type.
/// A: proxy type (optional)
/// R: proxy type (when called with no args) or lm proxy object
-static int llm_proxy_kind (lua_State *L)
+static int kind_lm_proxy (lua_State *L)
{
llm_proxy_t *proxy = luaL_checklm_proxy (L, 1);
if (lua_gettop (L) > 1) { // Set
- lm_proxy_set_type (proxy->proxy, luaL_checkenum (L, 2, llm_proxy_type));
+ lm_proxy_set_type (proxy->proxy, luaL_checkenum (L, 2, type_lm_proxy));
lua_pop (L, 1);
} else // Get
- luaL_pushenum (L, lm_proxy_get_type (proxy->proxy), llm_proxy_type);
+ luaL_pushenum (L, lm_proxy_get_type (proxy->proxy), type_lm_proxy);
return 1;
}
@@ -71,7 +71,7 @@
/// Gets or sets proxy server name.
/// A: string (optional)
/// R: string (when called with no args) or lm proxy object
-static int llm_proxy_server (lua_State *L)
+static int server_lm_proxy (lua_State *L)
{
llm_proxy_t *object = luaL_checklm_proxy (L, 1);
if (lua_gettop (L) > 1) { // Set
@@ -86,7 +86,7 @@
/// Gets or sets proxy server port.
/// A: integer (optional)
/// R: integer (when called with no args) or lm proxy object
-static int llm_proxy_port (lua_State *L)
+static int port_lm_proxy (lua_State *L)
{
llm_proxy_t *object = luaL_checklm_proxy (L, 1);
if (lua_gettop (L) > 1) { // Set
@@ -101,7 +101,7 @@
/// Gets or sets username to authenticate to proxy server with.
/// A: string (optional)
/// R: string (when called with no args) or lm proxy object
-static int llm_proxy_username (lua_State *L)
+static int username_lm_proxy (lua_State *L)
{
llm_proxy_t *object = luaL_checklm_proxy (L, 1);
if (lua_gettop (L) > 1) { // Set
@@ -116,7 +116,7 @@
/// Gets or sets password to authenticate to proxy server with.
/// A: string (optional)
/// R: string (when called with no args) or lm proxy object
-static int llm_proxy_password (lua_State *L)
+static int password_lm_proxy (lua_State *L)
{
llm_proxy_t *object = luaL_checklm_proxy (L, 1);
if (lua_gettop (L) > 1) { // Set
@@ -130,14 +130,14 @@
/// proxy:pointer
/// Returns pointer to underlying C structure.
/// R: lightuserdata
-static int llm_proxy_pointer (lua_State *L)
+static int pointer_lm_proxy (lua_State *L)
{
llm_proxy_t *object = luaL_checklm_proxy (L, 1);
lua_pushlightuserdata (L, object->proxy);
return 1;
}
-static int llm_proxy_gc (lua_State *L)
+static int gc_lm_proxy (lua_State *L)
{
llm_proxy_t *object = luaL_checklm_proxy (L, 1);
D ("Proxy %X gc called", (int) object);
@@ -145,20 +145,20 @@
return 0;
}
-static const luaL_Reg llm_proxy_reg_f[] = {
- { "new", llm_proxy_new },
- { "bless", llm_proxy_bless_lua },
+static const luaL_Reg reg_f_lm_proxy[] = {
+ { "new", new_lm_proxy },
+ { "bless", bless_lua_lm_proxy },
{ NULL, NULL },
};
-static const luaL_Reg llm_proxy_reg_m[] = {
- { "port", llm_proxy_port },
- { "server", llm_proxy_server },
- { "type", llm_proxy_kind },
- { "username", llm_proxy_username },
- { "password", llm_proxy_password },
- { "pointer", llm_proxy_pointer },
- { "__gc", llm_proxy_gc },
+static const luaL_Reg reg_m_lm_proxy[] = {
+ { "port", port_lm_proxy },
+ { "server", server_lm_proxy },
+ { "type", kind_lm_proxy },
+ { "username", username_lm_proxy },
+ { "password", password_lm_proxy },
+ { "pointer", pointer_lm_proxy },
+ { "__gc", gc_lm_proxy },
{ NULL, NULL },
};
@@ -168,9 +168,9 @@
lua_pushstring (L, "__index");
lua_pushvalue (L, -2);
lua_settable (L, -3);
- luaL_register (L, NULL, llm_proxy_reg_m);
+ luaL_register (L, NULL, reg_m_lm_proxy);
lua_pop (L, 1);
- luaL_register (L, "lm.proxy", llm_proxy_reg_f);
+ luaL_register (L, "lm.proxy", reg_f_lm_proxy);
return 1;
}