From a699b13f94c0d6ed1c08e3641564b8e77583b8f6 Mon Sep 17 00:00:00 2001 From: Nicola Fontana Date: Thu, 22 Mar 2012 19:21:12 +0100 Subject: [PATCH] Applied Kernighan and Ritchie indentation with 4 spaces --- adg/adg.c | 8 ++++---- cpml/cpml.c | 45 ++++++++++++++++++++++----------------------- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/adg/adg.c b/adg/adg.c index cb467d7..50b977e 100644 --- a/adg/adg.c +++ b/adg/adg.c @@ -24,7 +24,7 @@ #include -static const struct luaL_reg _global[]; +static const struct luaL_reg _st__global[]; static const struct luaL_reg adg[] = { { NULL, NULL } }; @@ -245,10 +245,10 @@ static void _wrap_adg_init(lua_State *L) { luaL_register(L, "adg", adg); - luaL_register(L, NULL, _global); + luaL_register(L, NULL, _st__global); - luaL_loadstring(L, "require 'lgob.cpml'\n" - "require 'lgob.gtk'\n" + luaL_loadstring(L, "require('lgob.cpml')\n" + "require('lgob.gtk')\n" "adg.Object = gobject.Object\n" "adg.InitiallyUnowned = gobject.Object\n"); lua_call(L, 0, 0); diff --git a/cpml/cpml.c b/cpml/cpml.c index a791585..d940afa 100644 --- a/cpml/cpml.c +++ b/cpml/cpml.c @@ -23,41 +23,40 @@ #include -static const struct luaL_reg _global[]; -static const struct luaL_reg cpml[] = -{ - {NULL, NULL} +static const struct luaL_reg _st__global[]; +static const struct luaL_reg cpml[] = { + { NULL, NULL } }; static void register_class(lua_State* L, const char* name, const char* base, const luaL_Reg* reg) { - lua_pushstring(L, name); - lua_newtable(L); - luaL_register(L, NULL, reg); + lua_pushstring(L, name); + lua_newtable(L); + luaL_register(L, NULL, reg); + + if(base) { + lua_newtable(L); + lua_pushliteral(L, "__index"); + lua_pushstring(L, base); + lua_rawget(L, -6); + lua_rawset(L, -3); + lua_setmetatable(L, -2); + } - if(base) - { - lua_newtable(L); - lua_pushliteral(L, "__index"); - lua_pushstring(L, base); - lua_rawget(L, -6); - lua_rawset(L, -3); - lua_setmetatable(L, -2); - } - - lua_rawset(L, -3); + lua_rawset(L, -3); } static void _wrap_cpml_init(lua_State* L) { - luaL_register(L, "cpml", cpml); - luaL_register(L, NULL, _global); + luaL_register(L, "cpml", cpml); + luaL_register(L, NULL, _st__global); - luaL_loadstring(L, "require('lgob.cairo')"); lua_call(L, 0, 0); + luaL_loadstring(L, "require('lgob.cairo')"); + lua_call(L, 0, 0); - lua_getfield(L, LUA_REGISTRYINDEX, "lgobPrefix"); - lua_pop(L, 1); + lua_getfield(L, LUA_REGISTRYINDEX, "lgobPrefix"); + lua_pop(L, 1); } static void _wrap_cpml_ret(lua_State* L) -- 2.11.4.GIT