shithub: libmujs

Download patch

ref: 790103815fb3c5299c1b4afd2f7075dc0aca4a17
parent: 43de5a093fc40fd64180910427316b475a75d4d4
author: Tor Andersson <tor.andersson@artifex.com>
date: Thu Oct 16 09:50:44 EDT 2014

Add public property iterator function.

--- a/jsrun.c
+++ b/jsrun.c
@@ -715,6 +715,18 @@
 	return jsR_hasproperty(J, js_toobject(J, idx), name);
 }
 
+/* Iterator */
+
+void js_pushiterator(js_State *J, int idx, int own)
+{
+	js_pushobject(J, jsV_newiterator(J, js_toobject(J, idx), own));
+}
+
+const char *js_nextiterator(js_State *J, int idx)
+{
+	return jsV_nextiterator(J, js_toobject(J, idx));
+}
+
 /* Environment records */
 
 js_Environment *jsR_newenvironment(js_State *J, js_Object *vars, js_Environment *outer)
--- a/mujs.h
+++ b/mujs.h
@@ -126,6 +126,9 @@
 void js_newuserdata(js_State *J, const char *tag, void *data);
 void js_newregexp(js_State *J, const char *pattern, int flags);
 
+void js_pushiterator(js_State *J, int idx, int own);
+const char *js_nextiterator(js_State *J, int idx);
+
 int js_isdefined(js_State *J, int idx);
 int js_isundefined(js_State *J, int idx);
 int js_isnull(js_State *J, int idx);