2 * ion/ioncore/extlconv.c
4 * Copyright (c) Tuomo Valkonen 1999-2006.
6 * Ion is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
14 #include <libextl/extl.h>
22 ExtlTab extl_obj_iterable_to_table(ObjIterator *iter, void *st)
24 ExtlTab tab=extl_create_table();
32 if(extl_table_seti_o(tab, i, obj))
46 bool extl_table_is_bool_set(ExtlTab tab, const char *entry)
50 if(extl_table_gets_b(tab, entry, &b))
62 bool extl_table_to_rectangle(ExtlTab tab, WRectangle *rectret)
64 if(!extl_table_gets_i(tab, "x", &(rectret->x)) ||
65 !extl_table_gets_i(tab, "y", &(rectret->y)) ||
66 !extl_table_gets_i(tab, "w", &(rectret->w)) ||
67 !extl_table_gets_i(tab, "h", &(rectret->h)))
74 ExtlTab extl_table_from_rectangle(const WRectangle *rect)
76 ExtlTab tab=extl_create_table();
78 extl_table_sets_i(tab, "x", rect->x);
79 extl_table_sets_i(tab, "y", rect->y);
80 extl_table_sets_i(tab, "w", rect->w);
81 extl_table_sets_i(tab, "h", rect->h);
87 void extl_table_sets_rectangle(ExtlTab tab, const char *nam,
88 const WRectangle *rect)
90 ExtlTab g=extl_table_from_rectangle(rect);
91 extl_table_sets_t(tab, nam, g);
96 bool extl_table_gets_rectangle(ExtlTab tab, const char *nam,
102 if(!extl_table_gets_t(tab, nam, &g))
105 ok=extl_table_to_rectangle(g, rect);