]> git.decadent.org.uk Git - ion3.git/blobdiff - ioncore/extlconv.c
Imported Upstream version 20090110
[ion3.git] / ioncore / extlconv.c
index 5f23b7464b28de5fa69f59a4183819a5178c356c..f363ec36b80a5e69906d5c75af065461f689c6de 100644 (file)
@@ -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 <string.h>
 /*{{{ 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);
 }