author | francesco-ST <francesco.abbate@st.com> | 2010年07月08日 09:45:28 +0200 |
---|---|---|
committer | francesco-ST <francesco.abbate@st.com> | 2010年07月08日 09:45:28 +0200 |
commit | 6089a3871d1cf7b4e3148210356043c145568004 (patch) | |
tree | 50b06c86247fa263a42de1f62407795cb360c734 /agg-plot/lua-draw.cpp | |
parent | 395c1cfb10a9f51990993d509d96f8c2f9ed47ab (diff) | |
download | gsl-shell-6089a3871d1cf7b4e3148210356043c145568004.tar.gz |
-rw-r--r-- | agg-plot/lua-draw.cpp | 66 |
diff --git a/agg-plot/lua-draw.cpp b/agg-plot/lua-draw.cpp index 94ff5ec5..4c6ae9d3 100644 --- a/agg-plot/lua-draw.cpp +++ b/agg-plot/lua-draw.cpp @@ -36,9 +36,6 @@ struct path_cmd_reg { const char *signature; }; -static int agg_obj_index (lua_State *L); -static int agg_obj_free (lua_State *L); - static int agg_path_free (lua_State *L); static int agg_path_index (lua_State *L); @@ -69,12 +66,6 @@ static const struct luaL_Reg plot_functions[] = { {NULL, NULL} }; -static const struct luaL_Reg agg_obj_methods[] = { - {"__index", agg_obj_index}, - {"__gc", agg_obj_free}, - {NULL, NULL} -}; - static const struct luaL_Reg agg_path_methods[] = { {"__index", agg_path_index}, {"__gc", agg_path_free}, @@ -222,7 +213,7 @@ agg_path_index (lua_State *L) vertex_source * check_agg_obj (lua_State *L, int index) { - int tplist[] = {GS_DRAW_OBJ, GS_DRAW_PATH, GS_DRAW_TEXT, GS_INVALID_TYPE}; + int tplist[] = {GS_DRAW_PATH, GS_DRAW_TEXT, GS_INVALID_TYPE}; void *p = NULL; int j; @@ -239,57 +230,6 @@ check_agg_obj (lua_State *L, int index) return (vertex_source *) p; } -int -agg_obj_free (lua_State *L) -{ - vertex_source *vs = check_agg_obj (L, 1); - printf("freeing OBJECT %p\n", (void *) vs); - vs->~vertex_source(); - return 0; -} - -static int -agg_obj_pcall (lua_State *L) -{ - int narg_out, narg_in = lua_gettop (L); - int status; - - pthread_mutex_lock (agg_mutex); - lua_pushvalue (L, lua_upvalueindex(1)); - lua_insert (L, 1); - status = lua_pcall (L, narg_in, LUA_MULTRET, 0); - pthread_mutex_unlock (agg_mutex); - if (status != 0) - { -#ifndef LUA_MODULE - error_report (L, status); -#else - luaL_error (L, "error in graphical object method"); -#endif - return 0; - } - narg_out = lua_gettop (L); - return narg_out; -} - -int -agg_obj_index (lua_State *L) -{ - vertex_source *vs = check_agg_obj (L, 1); - - lua_getmetatable (L, 1); - lua_insert (L, 2); - lua_gettable (L, 2); - - if (! lua_isnil (L, -1)) - { - lua_pushcclosure (L, agg_obj_pcall, 1); - return 1; - } - - return 0; -} - my::text * check_agg_text (lua_State *L, int index) { @@ -405,10 +345,6 @@ draw_register (lua_State *L) luaL_register (L, NULL, agg_text_methods); lua_pop (L, 1); - luaL_newmetatable (L, GS_METATABLE(GS_DRAW_OBJ)); - luaL_register (L, NULL, agg_obj_methods); - lua_pop (L, 1); - luaL_newmetatable (L, GS_METATABLE(GS_RGBA_COLOR)); luaL_register (L, NULL, rgba_methods); lua_pop (L, 1); |