summaryrefslogtreecommitdiff
path: root/src/nsgenbind-ast.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2013-12-29 15:25:39 +0000
committerVincent Sanders <vince@kyllikki.org>2014-05-16 14:38:56 +0100
commit0c9803cf78453a19ec37fbc2b3fdba3c106cfd84 (patch)
tree7c16ce916986e137c15634fdf6fd9ace120e0d31 /src/nsgenbind-ast.c
parentc25cc0e348a1abf0ee0719cf30515b3cc07f1848 (diff)
downloadnsgenbind-0c9803cf78453a19ec37fbc2b3fdba3c106cfd84.tar.gz
nsgenbind-0c9803cf78453a19ec37fbc2b3fdba3c106cfd84.tar.bz2
construct topoligicaly consitant (dependancy correct) interface map
use dependancy map to generate javascript prototype for all interfaces in the binding.
Diffstat (limited to 'src/nsgenbind-ast.c')
-rw-r--r--src/nsgenbind-ast.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/nsgenbind-ast.c b/src/nsgenbind-ast.c
index fc1e196..2f630b7 100644
--- a/src/nsgenbind-ast.c
+++ b/src/nsgenbind-ast.c
@@ -68,6 +68,8 @@ genbind_new_node(enum genbind_node_type type, struct genbind_node *l, void *r)
return nn;
}
+
+/* exported interface defined in nsgenbind-ast.h */
int
genbind_node_foreach_type(struct genbind_node *node,
enum genbind_node_type type,
@@ -92,6 +94,25 @@ genbind_node_foreach_type(struct genbind_node *node,
return 0;
}
+static int genbind_enumerate_node(struct genbind_node *node, void *ctx)
+{
+ node = node;
+ (*((int *)ctx))++;
+ return 0;
+}
+
+/* exported interface defined in nsgenbind-ast.h */
+int
+genbind_node_enumerate_type(struct genbind_node *node,
+ enum genbind_node_type type)
+{
+ int count = 0;
+ genbind_node_foreach_type(node,
+ type,
+ genbind_enumerate_node,
+ &count);
+ return count;
+}
/* exported interface defined in nsgenbind-ast.h */
struct genbind_node *