2 * ion/ioncore/extlconv.c
4 * Copyright (c) Tuomo Valkonen 1999-2007.
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 bool extl_iter_objlist_(ExtlFn fn, ObjIterator *iter, void *st)
30 if(!extl_iter_obj(fn, obj))
38 bool extl_iter_objlist(ExtlFn fn, ObjList *list)
42 objlist_iter_init(&tmp, list);
44 return extl_iter_objlist_(fn, (ObjIterator*)objlist_iter, &tmp);
48 bool extl_iter_obj(ExtlFn fn, Obj *obj)
50 bool ret1, ret2=FALSE;
54 ret1=extl_call(fn, "o", "b", obj, &ret2);
58 return (ret1 && ret2);
68 bool extl_table_is_bool_set(ExtlTab tab, const char *entry)
72 if(extl_table_gets_b(tab, entry, &b))
84 bool extl_table_to_rectangle(ExtlTab tab, WRectangle *rectret)
86 if(!extl_table_gets_i(tab, "x", &(rectret->x)) ||
87 !extl_table_gets_i(tab, "y", &(rectret->y)) ||
88 !extl_table_gets_i(tab, "w", &(rectret->w)) ||
89 !extl_table_gets_i(tab, "h", &(rectret->h)))
96 ExtlTab extl_table_from_rectangle(const WRectangle *rect)
98 ExtlTab tab=extl_create_table();
100 extl_table_sets_i(tab, "x", rect->x);
101 extl_table_sets_i(tab, "y", rect->y);
102 extl_table_sets_i(tab, "w", rect->w);
103 extl_table_sets_i(tab, "h", rect->h);
109 void extl_table_sets_rectangle(ExtlTab tab, const char *nam,
110 const WRectangle *rect)
112 ExtlTab g=extl_table_from_rectangle(rect);
113 extl_table_sets_t(tab, nam, g);
118 bool extl_table_gets_rectangle(ExtlTab tab, const char *nam,
124 if(!extl_table_gets_t(tab, nam, &g))
127 ok=extl_table_to_rectangle(g, rect);