aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormescalinum <mescalinum@users.sourceforge.net>2011-10-13 22:25:41 +0000
committermescalinum <mescalinum@users.sourceforge.net>2011-10-13 22:25:41 +0000
commitfac4cb9db5f0587d61e4eec7f789c72230f31c9d (patch)
tree6b0bc14091e19054e19fda679028444a4eaeeab1
parent87ebb0c9845f75a6f2f43e01b8a4c9d65365a754 (diff)
add binbuf functions + test (not working yet)
svn path=/trunk/externals/loaders/tclpd/; revision=15589
-rw-r--r--examples/binbuf-test.tcl23
-rw-r--r--tcl_class.c11
-rw-r--r--tcl_extras.h2
3 files changed, 36 insertions, 0 deletions
diff --git a/examples/binbuf-test.tcl b/examples/binbuf-test.tcl
new file mode 100644
index 0000000..a39118f
--- /dev/null
+++ b/examples/binbuf-test.tcl
@@ -0,0 +1,23 @@
+package require Tclpd 0.2.2
+package require TclpdLib 0.17
+
+pd::class binbuf-test {
+ constructor {
+ pd::add_outlet $self list
+ }
+
+ destructor {
+ }
+
+ 0_bang {
+ set binbuf [tclpd_get_object_binbuf $self]
+ pd::outlet $self 0 list [list "symbol binbuf" "symbol $binbuf"]
+
+ set len [binbuf_getnatom $binbuf]
+ pd::outlet $self 0 list [list "symbol len" "symbol $len"]
+
+ #for {set i 0} {$i < $len} {incr i} {
+ # pd::post $i:[tclpd_binbuf_get_atom $binbuf $i]
+ #}
+ }
+}
diff --git a/tcl_class.c b/tcl_class.c
index c94952a..7de65b6 100644
--- a/tcl_class.c
+++ b/tcl_class.c
@@ -355,11 +355,22 @@ t_pd* tclpd_get_object_pd(const char* objectSequentialId) {
return &o->ob_pd;
}
+t_binbuf* tclpd_get_object_binbuf(const char* objectSequentialId) {
+ t_object* o = tclpd_get_object(objectSequentialId);
+ return &o->ob_binbuf;
+}
+
t_glist* tclpd_get_glist(const char* objectSequentialId) {
t_tcl* x = tclpd_get_instance(objectSequentialId);
return x->x_glist;
}
+t_atom* tclpd_binbuf_get_atom(t_binbuf* b, int n) {
+ if(binbuf_getnatom(b) <= n || n < 0)
+ return NULL;
+ return binbuf_getvec(b) + n;
+}
+
t_symbol* null_symbol() {
return (t_symbol*)0;
}
diff --git a/tcl_extras.h b/tcl_extras.h
index f4e72bf..e2406b9 100644
--- a/tcl_extras.h
+++ b/tcl_extras.h
@@ -67,7 +67,9 @@ t_pd* tclpd_get_instance_pd(const char* objectSequentialId);
t_text* tclpd_get_instance_text(const char* objectSequentialId);
t_object* tclpd_get_object(const char* objectSequentialId);
t_pd* tclpd_get_object_pd(const char* objectSequentialId);
+t_binbuf* tclpd_get_object_binbuf(const char* objectSequentialId);
t_glist* tclpd_get_glist(const char* objectSequentialId);
+t_atom* tclpd_binbuf_get_atom(t_binbuf* b, int n);
t_symbol* null_symbol();
void poststring2(const char* s);
extern void text_save(t_gobj *z, t_binbuf *b);