author | francesco-ST <francesco.abbate@st.com> | 2010年08月09日 15:50:43 +0200 |
---|---|---|
committer | francesco-ST <francesco.abbate@st.com> | 2010年08月09日 15:50:43 +0200 |
commit | 129604a18b0f93e89cf638a079b6f1ab349fbe8f (patch) | |
tree | 8abeb52bc7a01472ba505aebaa36fb2ef1765646 | |
parent | 99c6c9b47f25eb7bc8756d5b2a5fd5ec7dac73e6 (diff) | |
download | gsl-shell-129604a18b0f93e89cf638a079b6f1ab349fbe8f.tar.gz |
-rw-r--r-- | agg-plot/Makefile | 2 | ||||
-rw-r--r-- | agg-plot/canvas.h | 6 | ||||
-rw-r--r-- | agg-plot/lua-plot-cpp.h | 33 | ||||
-rw-r--r-- | agg-plot/lua-plot.cpp | 278 | ||||
-rw-r--r-- | agg-plot/lua-plot.h | 12 | ||||
-rw-r--r-- | agg-plot/plot.h | 36 | ||||
-rw-r--r-- | agg-plot/trans.h | 3 | ||||
-rw-r--r-- | agg-plot/window-cpp.h | 70 | ||||
-rw-r--r-- | agg-plot/window.cpp | 208 | ||||
-rw-r--r-- | agg-plot/window.h | 17 | ||||
-rw-r--r-- | gs-types.c | 8 | ||||
-rw-r--r-- | gs-types.h | 6 | ||||
-rw-r--r-- | lua-gsl.c | 8 | ||||
-rw-r--r-- | window-refs.c | 8 | ||||
-rw-r--r-- | window-refs.h | 3 |
diff --git a/agg-plot/Makefile b/agg-plot/Makefile index 67870461..7931bb82 100644 --- a/agg-plot/Makefile +++ b/agg-plot/Makefile @@ -44,7 +44,7 @@ endif INCLUDES += $(AGG_INCLUDES) -I$(GSH_BASE_DIR) -I$(LUADIR)/src -AGGPLOT_SRC_FILES = $(PLATSUP_SRC_FILES) utils.cpp units.cpp colors.cpp markers.cpp lua-draw.cpp lua-text.cpp text.cpp drawable.cpp agg-parse-trans.cpp canvas-window.cpp plot-window.cpp +AGGPLOT_SRC_FILES = $(PLATSUP_SRC_FILES) utils.cpp units.cpp colors.cpp markers.cpp lua-draw.cpp lua-text.cpp text.cpp drawable.cpp agg-parse-trans.cpp window.cpp lua-plot.cpp canvas-window.cpp AGGPLOT_OBJ_FILES := $(AGGPLOT_SRC_FILES:%.cpp=%.o) diff --git a/agg-plot/canvas.h b/agg-plot/canvas.h index 6599a246..3349ef73 100644 --- a/agg-plot/canvas.h +++ b/agg-plot/canvas.h @@ -79,7 +79,11 @@ public: void clear() { rb.clear(bg_color); }; const agg::trans_affine& trans_matrix() const { return mtx; }; - void scale(agg::trans_affine& m) const { trans_affine_compose (m, mtx); }; + + void premultiply(agg::trans_affine& m) const + { + trans_affine_compose (m, mtx); + }; template<class VertexSource> void draw(VertexSource& vs, agg::rgba8 c) diff --git a/agg-plot/lua-plot-cpp.h b/agg-plot/lua-plot-cpp.h new file mode 100644 index 00000000..5e318dd0 --- /dev/null +++ b/agg-plot/lua-plot-cpp.h @@ -0,0 +1,33 @@ +#ifndef AGGPLOT_LUA_PLOT_CPP_H +#define AGGPLOT_LUA_PLOT_CPP_H + +#include "lua-plot.h" + +extern "C" { +#include "lua.h" +} + +#include "plot.h" +#include "resource-manager.h" +#include "drawable.h" + +class lua_plot { +public: + typedef plot<drawable, lua_management> plot_type; + +private: + plot_type m_plot; + +public: + lua_plot() : m_plot(), id(-1) { }; + + void update_window(lua_State *L); + + plot_type& self() { return m_plot; }; + + static lua_plot *check(lua_State *L, int index); + + int id; +}; + +#endif diff --git a/agg-plot/lua-plot.cpp b/agg-plot/lua-plot.cpp new file mode 100644 index 00000000..5f780f88 --- /dev/null +++ b/agg-plot/lua-plot.cpp @@ -0,0 +1,278 @@ + +/* lua-plot.cpp + * + * Copyright (C) 2009, 2010 Francesco Abbate + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +extern "C" { +#include "lua.h" +#include "lauxlib.h" +} + +#include "lua-plot.h" +#include "lua-plot-cpp.h" +#include "window-refs.h" +#include "window.h" +#include "gs-types.h" +#include "lua-utils.h" +#include "object-refs.h" +#include "lua-cpp-utils.h" +#include "lua-draw.h" +#include "colors.h" +#include "plot.h" +#include "drawable.h" +#include "resource-manager.h" +#include "agg-parse-trans.h" + +__BEGIN_DECLS + +static int plot_new (lua_State *L); +static int plot_add (lua_State *L); +static int plot_update (lua_State *L); +static int plot_add_line (lua_State *L); +static int plot_index (lua_State *L); +static int plot_newindex (lua_State *L); +static int plot_free (lua_State *L); +// static int plot_show (lua_State *L); +static int plot_title_set (lua_State *L); +static int plot_title_get (lua_State *L); +static int plot_units_set (lua_State *L); +static int plot_units_get (lua_State *L); + +static int plot_add_gener (lua_State *L, bool as_line); + +static const struct luaL_Reg plot_functions[] = { + {"plot", plot_new}, + {NULL, NULL} +}; + +static const struct luaL_Reg plot_methods[] = { + {"add", plot_add }, + {"addline", plot_add_line }, + {"update", plot_update }, + // {"show", plot_show }, + {"__index", plot_index }, + {"__newindex", plot_newindex }, + {"__gc", plot_free }, + {NULL, NULL} +}; + +static const struct luaL_Reg plot_properties_get[] = { + {"title", plot_title_get }, + {"units", plot_units_get }, + {NULL, NULL} +}; + +static const struct luaL_Reg plot_properties_set[] = { + {"title", plot_title_set }, + {"units", plot_units_set }, + {NULL, NULL} +}; + +__END_DECLS + +lua_plot * +lua_plot::check(lua_State *L, int index) +{ + return (lua_plot *) gs_check_userdata (L, index, GS_PLOT); +} + +void +lua_plot::update_window(lua_State *L) +{ + window_ref_get (L, this->id); + + if (gs_is_userdata (L, lua_gettop (L), GS_WINDOW)) + { + lua_pushcfunction (L, window_update_unprotected); + lua_insert (L, -2); + lua_call (L, 1, 0); + } + else + { + lua_pop (L, 1); + } +} + +int +plot_new (lua_State *L) +{ + lua_plot *p = new(L, GS_PLOT) lua_plot(); + + if (lua_isstring (L, 1)) + { + const char *title = lua_tostring (L, 1); + if (title) + p->self().set_title(title); + } + + return 1; +} + +int +plot_free (lua_State *L) +{ + lua_plot *p = lua_plot::check(L, 1); + p->~lua_plot(); + return 0; +} + +int +plot_add_gener (lua_State *L, bool as_line) +{ + lua_plot *p = lua_plot::check(L, 1); + drawable *obj = parse_graph_args (L); + agg::rgba8 *color = check_color_rgba8 (L, 3); + + object_ref_add (L, 1, 2); + + AGG_LOCK(); + + p->self().add(obj, color, as_line); + p->update_window(L); + + AGG_UNLOCK(); + + return 0; +} + +int +plot_add (lua_State *L) +{ + return plot_add_gener (L, false); +} + +int +plot_add_line (lua_State *L) +{ + return plot_add_gener (L, true); +} + +int +plot_title_set (lua_State *L) +{ + lua_plot *p = lua_plot::check(L, 1); + const char *title = lua_tostring (L, 2); + + if (title == NULL) + return gs_type_error (L, 2, "string"); + + AGG_LOCK(); + + p->self().set_title(title); + p->update_window(L); + + AGG_UNLOCK(); + + return 0; +} + +int +plot_title_get (lua_State *L) +{ + lua_plot *p = lua_plot::check(L, 1); + + AGG_LOCK(); + + const char *title = p->self().get_title(); + lua_pushstring (L, title); + + AGG_UNLOCK(); + + return 1; +} + +int +plot_units_set (lua_State *L) +{ + lua_plot *p = lua_plot::check(L, 1); + bool request = (bool) lua_toboolean (L, 2); + + AGG_LOCK(); + + lua_plot::plot_type& plt = p->self(); + bool current = plt.use_units(); + + if (current != request) + { + plt.set_units(request); + p->update_window(L); + } + + AGG_UNLOCK(); + + return 0; +} + +int +plot_units_get (lua_State *L) +{ + lua_plot *p = lua_plot::check(L, 1); + + AGG_LOCK(); + + lua_plot::plot_type& plt = p->self(); + lua_pushboolean (L, plt.use_units()); + + AGG_UNLOCK(); + + return 1; +} + +int +plot_index (lua_State *L) +{ + return mlua_index_with_properties (L, plot_properties_get, false); +} + +int +plot_newindex (lua_State *L) +{ + return mlua_newindex_with_properties (L, plot_properties_set); +} + +int +plot_update (lua_State *L) +{ + lua_plot *p = lua_plot::check(L, 1); + AGG_LOCK(); + p->update_window(L); + AGG_UNLOCK(); + return 0; +} + +/* +int +plot_show (lua_State *L) +{ + lua_plot *p = lua_plot::check(L, 1); + p->start_new_thread (L); + return 1; +} +*/ + +void +plot_register (lua_State *L) +{ + /* plot declaration */ + luaL_newmetatable (L, GS_METATABLE(GS_PLOT)); + luaL_register (L, NULL, plot_methods); + lua_pop (L, 1); + + /* gsl module registration */ + luaL_register (L, NULL, plot_functions); +} diff --git a/agg-plot/lua-plot.h b/agg-plot/lua-plot.h new file mode 100644 index 00000000..6c069e85 --- /dev/null +++ b/agg-plot/lua-plot.h @@ -0,0 +1,12 @@ +#ifndef AGGPLOT_LUA_PLOT_H +#define AGGPLOT_LUA_PLOT_H + +#include "defs.h" + +__BEGIN_DECLS + +extern void plot_register (lua_State *L); + +__END_DECLS + +#endif diff --git a/agg-plot/plot.h b/agg-plot/plot.h index cc717232..9f485bb0 100644 --- a/agg-plot/plot.h +++ b/agg-plot/plot.h @@ -21,10 +21,6 @@ #ifndef AGGPLOT_CPLOT_H #define AGGPLOT_CPLOT_H -#include <stdio.h> -#include <stdlib.h> -#include <limits.h> - #include "utils.h" #include "drawable.h" #include "canvas.h" @@ -117,7 +113,7 @@ public: resource_manager::acquire(vs); }; - void draw(canvas &canvas); + void draw(canvas &canvas, agg::trans_affine& m); void trans_matrix_update(); void user_transform(agg::trans_affine& m) @@ -127,9 +123,9 @@ public: }; private: - void draw_elements(canvas &canvas); - void draw_title(canvas& canvas); - void draw_axis(canvas& can); + void draw_elements(canvas &canvas, agg::trans_affine& m); + void draw_title(canvas& canvas, agg::trans_affine& m); + void draw_axis(canvas& can, agg::trans_affine& m); void update_viewport_trans(); @@ -153,23 +149,24 @@ private: }; template <class VS, class RM> -void plot<VS,RM>::draw(canvas &canvas) +void plot<VS,RM>::draw(canvas &canvas, agg::trans_affine& canvas_mtx) { trans_matrix_update(); - draw_title(canvas); + draw_title(canvas, canvas_mtx); if (m_use_units) - draw_axis(canvas); - draw_elements(canvas); + draw_axis(canvas, canvas_mtx); + draw_elements(canvas, canvas_mtx); }; template <class VS, class RM> -void plot<VS,RM>::draw_title(canvas &canvas) +void plot<VS,RM>::draw_title(canvas &canvas, agg::trans_affine& canvas_mtx) { double xt = 0.5, yt = 1; agg::trans_affine m; this->viewport_scale(m); - canvas.scale(m); + trans_affine_compose (m, canvas_mtx); + // canvas.scale(m); agg::gsv_text title; agg::conv_stroke<agg::gsv_text> titlestroke(title); @@ -191,11 +188,13 @@ void plot<VS,RM>::draw_title(canvas &canvas) } template<class VS, class RM> -void plot<VS,RM>::draw_elements(canvas &canvas) +void plot<VS,RM>::draw_elements(canvas &canvas, agg::trans_affine& canvas_mtx) { agg::trans_affine m = m_trans; viewport_scale(m); - canvas.scale(m); + + trans_affine_compose (m, canvas_mtx); + // canvas.scale(m); for (unsigned j = 0; j < m_elements.size(); j++) { @@ -284,14 +283,15 @@ void plot<VS,RM>::calc_bounding_box() } template <class VS, class RM> -void plot<VS,RM>::draw_axis(canvas &canvas) +void plot<VS,RM>::draw_axis(canvas &canvas, agg::trans_affine& canvas_mtx) { typedef agg::path_storage path_type; typedef agg::conv_dash<agg::conv_transform<path_type>, agg::vcgen_markers_term> dash_type; agg::trans_affine m; this->viewport_scale(m); - canvas.scale(m); + trans_affine_compose (m, canvas_mtx); + // canvas.scale(m); agg::path_storage mark; agg::conv_transform<path_type> mark_tr(mark, m); diff --git a/agg-plot/trans.h b/agg-plot/trans.h index 4fb0d5b1..f2b234c6 100644 --- a/agg-plot/trans.h +++ b/agg-plot/trans.h @@ -5,6 +5,7 @@ #include "drawable.h" #include "markers.h" #include "utils.h" +#include "resource-manager.h" #include "agg_trans_affine.h" #include "agg_path_storage.h" @@ -121,7 +122,7 @@ struct trans { ~marker() { - delete m_symbol; + lua_management::dispose(m_symbol); }; virtual void apply_transform(const agg::trans_affine& m, double as) diff --git a/agg-plot/window-cpp.h b/agg-plot/window-cpp.h new file mode 100644 index 00000000..1c09ad69 --- /dev/null +++ b/agg-plot/window-cpp.h @@ -0,0 +1,70 @@ + +extern "C" { +#include "lua.h" +} + +#include "window.h" +#include "canvas-window-cpp.h" +#include "resource-manager.h" +#include "lua-plot-cpp.h" +#include "plot.h" +#include "drawable.h" + +#include "agg_color_rgba.h" +#include "agg_trans_affine.h" + +template <class T> +class pod_list { + T m_content; + pod_list *m_next; + +public: + pod_list(const T& c, pod_list* next = NULL) : m_content(c), m_next(next) { }; + + void free_subtree() + { + if (m_next) + { + m_next->free_subtree(); + delete m_next; + } + }; + + T& content() { return m_content; }; + const T& content() const { return m_content; }; + + pod_list *next() { return m_next; }; + + static void free(pod_list *list); +}; + +template <class T> +void pod_list<T>::free(pod_list<T> *list) +{ + list->free_subtree(); + delete list; +} + +class window : public canvas_window { + typedef plot<drawable, lua_management> plot_type; + + struct plot_matrix { + plot_type *plot; + agg::trans_affine matrix; + + plot_matrix(plot_type *p) : plot(p), matrix() {}; + }; + + pod_list<plot_matrix> *m_plot_matrix; + +public: + window(agg::rgba& bgcol) : canvas_window(bgcol), m_plot_matrix(NULL) {}; + + static window *check (lua_State *L, int index); + + void split3(); + bool attach(lua_plot *plot, int slot); + + void on_draw_unprotected(); + virtual void on_draw(); +}; diff --git a/agg-plot/window.cpp b/agg-plot/window.cpp new file mode 100644 index 00000000..6c5df1a7 --- /dev/null +++ b/agg-plot/window.cpp @@ -0,0 +1,208 @@ + +extern "C" { +#include "lua.h" +#include "lauxlib.h" +} + +#include "window-cpp.h" +#include "lua-draw.h" +#include "lua-cpp-utils.h" +#include "gs-types.h" +#include "object-refs.h" +#include "colors.h" +#include "lua-plot-cpp.h" + +__BEGIN_DECLS + +static int window_new (lua_State *L); +static int window_free (lua_State *L); +static int window_split3 (lua_State *L); +static int window_attach (lua_State *L); + +static const struct luaL_Reg window_functions[] = { + {"window", window_new}, + {NULL, NULL} +}; + +static const struct luaL_Reg window_methods[] = { + {"attach", window_attach }, + {"split3", window_split3 }, + {"update", window_update }, + {"__gc", window_free }, + {NULL, NULL} +}; + +__END_DECLS + +void +window::on_draw_unprotected() +{ + if (! m_canvas) + return; + + m_canvas->clear(); + + pod_list<plot_matrix> *ls; + + for (ls = m_plot_matrix; ls != NULL; ls = ls->next()) + { + plot_matrix& pm = ls->content(); + + if (pm.plot) + { + agg::trans_affine mtx(pm.matrix); + m_canvas->premultiply(mtx); + pm.plot->draw(*m_canvas, mtx); + } + } +} + +void +window::on_draw() +{ + AGG_LOCK(); + on_draw_unprotected(); + AGG_UNLOCK(); +} + +window * +window::check (lua_State *L, int index) +{ + return (window *) gs_check_userdata (L, index, GS_WINDOW); +} + +static void +set_matrix(agg::trans_affine& m, double x, double y, double sx, double sy) +{ + m.tx = x; + m.ty = y; + m.sx = sx; + m.sy = sy; +} + +void +window::split3() +{ + plot_matrix empty(NULL); + + pod_list<plot_matrix> *p = new pod_list<plot_matrix>(empty); + set_matrix (p->content().matrix, 0.0, 0.5, 0.5, 0.5); + + p = new pod_list<plot_matrix>(empty, p); + set_matrix (p->content().matrix, 0.5, 0.5, 0.5, 0.5); + + p = new pod_list<plot_matrix>(empty, p); + set_matrix (p->content().matrix, 0.0, 0.0, 1.0, 0.5); + + m_plot_matrix = p; +} + +bool +window::attach(lua_plot *plot, int slot) +{ + pod_list<plot_matrix> *ls; + for (ls = m_plot_matrix; ls != NULL; ls = ls->next(), slot--) + { + if (slot == 0) + break; + } + + if (! ls) + return false; + + ls->content().plot = & plot->self(); + return true; +} + +int +window_new (lua_State *L) +{ + window *win = new(L, GS_WINDOW) window(colors::white); + + win->start_new_thread (L); + + return 1; +} + +int +window_free (lua_State *L) +{ + window *win = window::check (L, 1); + win->~window(); + return 0; +} + + +int +window_split3 (lua_State *L) +{ + window *win = window::check (L, 1); + win->split3(); + return 0; +} + +int +window_attach (lua_State *L) +{ + window *win = window::check (L, 1); + lua_plot *plot = lua_plot::check (L, 2); + int slot = luaL_checkinteger (L, 3); + + win->lock(); + + if (win->attach (plot, slot)) + { + plot->id = win->id; + + win->on_draw(); + win->update_window(); + + win->unlock(); + + object_ref_add (L, 1, 2); + } + else + { + win->unlock(); + luaL_error (L, "invalid slot"); + } + + return 0; +} + +int +window_update_unprotected (lua_State *L) +{ + window *win = window::check (L, 1); + + win->on_draw_unprotected(); + win->update_window(); + + return 0; +} + +int +window_update (lua_State *L) +{ + window *win = window::check (L, 1); + + AGG_LOCK(); + win->on_draw_unprotected(); + win->update_window(); + AGG_UNLOCK(); + + return 0; +} + +void +window_register (lua_State *L) +{ + luaL_newmetatable (L, GS_METATABLE(GS_WINDOW)); + lua_pushvalue (L, -1); + lua_setfield (L, -2, "__index"); + luaL_register (L, NULL, window_methods); + lua_pop (L, 1); + + /* gsl module registration */ + luaL_register (L, NULL, window_functions); +} diff --git a/agg-plot/window.h b/agg-plot/window.h new file mode 100644 index 00000000..1f8d7ced --- /dev/null +++ b/agg-plot/window.h @@ -0,0 +1,17 @@ +#ifndef AGGPLOT_WINDOW_H +#define AGGPLOT_WINDOW_H + +#include "defs.h" + +__BEGIN_DECLS + +#include "lua.h" + +extern void window_register (lua_State *L); + +extern int window_update_unprotected (lua_State *L); +extern int window_update (lua_State *L); + +__END_DECLS + +#endif diff --git a/gs-types.c b/gs-types.c index 0750ff66..817385b5 100644 --- a/gs-types.c +++ b/gs-types.c @@ -30,7 +30,8 @@ static int gs_type_string (lua_State *L); #define GS_DRAW_TEXT_NAME_DEF "GSL.text" #define GS_RGBA_COLOR_NAME_DEF "GSL.rgba" #define GS_CANVAS_WINDOW_NAME_DEF "GSL.canvas" -#define GS_PLOT_WINDOW_NAME_DEF "GSL.pltcanvas" +#define GS_WINDOW_NAME_DEF "GSL.window" +#define GS_PLOT_NAME_DEF "GSL.plot" #endif #define MYCAT2x(a,b) a ## _ ## b @@ -62,8 +63,9 @@ const struct gs_type gs_type_table[] = { MY_EXPAND(DRAW_DRAWABLE, "window graphical object"), MY_EXPAND_DER(DRAW_TEXT, "graphical text", DRAW_DRAWABLE), MY_EXPAND(RGBA_COLOR, "color"), - MY_EXPAND(CANVAS_WINDOW, "graphical window"), - MY_EXPAND_DER(PLOT_WINDOW, "plot window", CANVAS_WINDOW), + MY_EXPAND(CANVAS_WINDOW, "bare graphical window"), + MY_EXPAND(WINDOW, "graphical window"), + MY_EXPAND(PLOT, "plot"), #endif {GS_INVALID_TYPE, NULL, NULL, GS_NO_TYPE} }; diff --git a/gs-types.h b/gs-types.h index 8e14a575..9bc99628 100644 --- a/gs-types.h +++ b/gs-types.h @@ -31,9 +31,9 @@ enum gs_type_e { GS_DRAW_DRAWABLE, GS_DRAW_TEXT, GS_RGBA_COLOR, - GS_CANVAS_WINDOW, /* derived types should be declared only after its - base class */ - GS_PLOT_WINDOW, + GS_CANVAS_WINDOW, /* derived types should be declared only after its base class */ + GS_WINDOW, + GS_PLOT, #endif GS_INVALID_TYPE, }; @@ -49,8 +49,8 @@ #include "object-refs.h" #include "lua-draw.h" #include "lua-text.h" -#include "canvas-window.h" -#include "plot-window.h" +#include "window.h" +#include "lua-plot.h" #endif static const struct luaL_Reg gsl_methods_dummy[] = {{NULL, NULL}}; @@ -90,8 +90,8 @@ luaopen_gsl (lua_State *L) #ifdef AGG_PLOT_ENABLED draw_register (L); text_register (L); - canvas_window_register (L); - plot_window_register (L); + window_register (L); + plot_register (L); #endif #ifdef LNUM_COMPLEX diff --git a/window-refs.c b/window-refs.c index dc694d2d..ad4d31b0 100644 --- a/window-refs.c +++ b/window-refs.c @@ -31,6 +31,14 @@ window_ref_add(lua_State *L, int index) } void +window_ref_get (lua_State *L, int id) +{ + lua_getfield (L, LUA_REGISTRYINDEX, window_ref_table_name); + lua_rawgeti (L, -1, id); + lua_remove (L, -2); +} + +void window_ref_remove (lua_State *L, int id) { lua_getfield (L, LUA_REGISTRYINDEX, window_ref_table_name); diff --git a/window-refs.h b/window-refs.h index 48ddba94..3cf26d5f 100644 --- a/window-refs.h +++ b/window-refs.h @@ -5,10 +5,11 @@ __BEGIN_DECLS -#include <lua.h> +#include "lua.h" extern void window_ref_prepare (lua_State *L); extern size_t window_ref_add (lua_State *L, int index); +extern void window_ref_get (lua_State *L, int id); extern void window_ref_remove (lua_State *L, int id); extern void window_ref_close_all (lua_State *L); extern int window_ref_count (lua_State *L); |