X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=ioncore%2Fextlconv.c;h=f363ec36b80a5e69906d5c75af065461f689c6de;hb=e3aec18706513a87eaa7839dfdaf7e0fcd0d8d2a;hp=5f23b7464b28de5fa69f59a4183819a5178c356c;hpb=8366314611bf30a0f31d25bf5f5023186fa87692;p=ion3.git diff --git a/ioncore/extlconv.c b/ioncore/extlconv.c index 5f23b74..f363ec3 100644 --- a/ioncore/extlconv.c +++ b/ioncore/extlconv.c @@ -1,12 +1,9 @@ /* * ion/ioncore/extlconv.c * - * Copyright (c) Tuomo Valkonen 1999-2006. + * Copyright (c) Tuomo Valkonen 1999-2009. * - * Ion is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. + * See the included file LICENSE for details. */ #include @@ -19,21 +16,43 @@ /*{{{ Object list */ -ExtlTab extl_obj_iterable_to_table(ObjIterator *iter, void *st) +bool extl_iter_objlist_(ExtlFn fn, ObjIterator *iter, void *st) { - ExtlTab tab=extl_create_table(); - int i=1; Obj *obj; while(1){ obj=iter(st); if(obj==NULL) break; - if(extl_table_seti_o(tab, i, obj)) - i++; + if(!extl_iter_obj(fn, obj)) + return FALSE; } - return tab; + return TRUE; +} + + +bool extl_iter_objlist(ExtlFn fn, ObjList *list) +{ + ObjListIterTmp tmp; + + objlist_iter_init(&tmp, list); + + return extl_iter_objlist_(fn, (ObjIterator*)objlist_iter, &tmp); +} + + +bool extl_iter_obj(ExtlFn fn, Obj *obj) +{ + bool ret1, ret2=FALSE; + + extl_protect(NULL); + + ret1=extl_call(fn, "o", "b", obj, &ret2); + + extl_unprotect(NULL); + + return (ret1 && ret2); }