X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fextlconv.c;h=b0a2bb86f5c04cf33820e14dd70e91b0a7bdddf4;hb=7c392448b0d2efcc6bb959063dcaa8b2c5ea0964;hp=5f23b7464b28de5fa69f59a4183819a5178c356c;hpb=8366314611bf30a0f31d25bf5f5023186fa87692;p=ion3.git diff --git a/ioncore/extlconv.c b/ioncore/extlconv.c index 5f23b74..b0a2bb8 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-2007. * - * 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); }