2 * ion/ioncore/extlconv.c
4 * Copyright (c) Tuomo Valkonen 1999-2008.
6 * See the included file LICENSE for details.
11 #include <libextl/extl.h>
19 bool extl_iter_objlist_(ExtlFn fn, ObjIterator *iter, void *st)
27 if(!extl_iter_obj(fn, obj))
35 bool extl_iter_objlist(ExtlFn fn, ObjList *list)
39 objlist_iter_init(&tmp, list);
41 return extl_iter_objlist_(fn, (ObjIterator*)objlist_iter, &tmp);
45 bool extl_iter_obj(ExtlFn fn, Obj *obj)
47 bool ret1, ret2=FALSE;
51 ret1=extl_call(fn, "o", "b", obj, &ret2);
55 return (ret1 && ret2);
65 bool extl_table_is_bool_set(ExtlTab tab, const char *entry)
69 if(extl_table_gets_b(tab, entry, &b))
81 bool extl_table_to_rectangle(ExtlTab tab, WRectangle *rectret)
83 if(!extl_table_gets_i(tab, "x", &(rectret->x)) ||
84 !extl_table_gets_i(tab, "y", &(rectret->y)) ||
85 !extl_table_gets_i(tab, "w", &(rectret->w)) ||
86 !extl_table_gets_i(tab, "h", &(rectret->h)))
93 ExtlTab extl_table_from_rectangle(const WRectangle *rect)
95 ExtlTab tab=extl_create_table();
97 extl_table_sets_i(tab, "x", rect->x);
98 extl_table_sets_i(tab, "y", rect->y);
99 extl_table_sets_i(tab, "w", rect->w);
100 extl_table_sets_i(tab, "h", rect->h);
106 void extl_table_sets_rectangle(ExtlTab tab, const char *nam,
107 const WRectangle *rect)
109 ExtlTab g=extl_table_from_rectangle(rect);
110 extl_table_sets_t(tab, nam, g);
115 bool extl_table_gets_rectangle(ExtlTab tab, const char *nam,
121 if(!extl_table_gets_t(tab, nam, &g))
124 ok=extl_table_to_rectangle(g, rect);