From 19033e067c102f1245dd0640c4e437ce24f61394 Mon Sep 17 00:00:00 2001
From: Guillem <guillembartrina@gmail.com>
Date: Tue, 18 Aug 2020 21:55:53 +0200
Subject: [PATCH] add abinfo 'within' command

---
 pd/src/x_interface.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/pd/src/x_interface.c b/pd/src/x_interface.c
index 2218e3f8e..96e07d86d 100644
--- a/pd/src/x_interface.c
+++ b/pd/src/x_interface.c
@@ -1672,6 +1672,18 @@ void abinfo_instances(t_abinfo *x, t_symbol *s, int argc, t_atom *argv)
     info_out((t_text *)x, s, 1, at);
 }
 
+void abinfo_within(t_abinfo *x, t_symbol *s, int argc, t_atom *argv)
+{
+    t_binbuf *buf = binbuf_new();
+    int i;
+    for(i = 0; i < x->abdef->ad_numdep; i++)
+    {
+        binbuf_addv(buf, "s", x->abdef->ad_dep[i]->ad_name);
+    }
+    info_out((t_text *)x, s, binbuf_getnatom(buf), binbuf_getvec(buf));
+    binbuf_free(buf);
+}
+
 //ADD MORE METHODS
 
 void abinfo_setup(void)
@@ -1683,6 +1695,8 @@ void abinfo_setup(void)
         gensym("name"), A_GIMME, 0);
     class_addmethod(abinfo_class, (t_method)abinfo_instances,
         gensym("instances"), A_GIMME, 0);
+    class_addmethod(abinfo_class, (t_method)abinfo_within,
+        gensym("within"), A_GIMME, 0);
 }
 
 
-- 
GitLab