From 60745f7898be9a36bda18f94ad98a592f4b3fce9 Mon Sep 17 00:00:00 2001 From: mescalinum Date: Thu, 13 Oct 2011 16:01:07 +0000 Subject: fix the tclpd_get_instance_text bug in slider2 svn path=/trunk/externals/loaders/tclpd/; revision=15582 --- examples/dynroute-help.pd | 52 +++++++++++++++++++++++------------------------ tcl_class.c | 8 ++++++-- tcl_extras.h | 1 + 3 files changed, 33 insertions(+), 28 deletions(-) diff --git a/examples/dynroute-help.pd b/examples/dynroute-help.pd index 86d173e..e421978 100644 --- a/examples/dynroute-help.pd +++ b/examples/dynroute-help.pd @@ -1,26 +1,26 @@ -#N canvas 1022 530 786 430 10; -#X obj 93 268 dynroute 4; -#X msg 41 147 apple red \, banana yellow \, pear green \, apple yellow -\, strawberry red; -#X obj 41 194 list prepend; -#X msg 200 224 clear \, add apple 0 \, add banana 1 \, add pear 2; -#X msg 206 258 remove pear 2 \, add pear 0 \, add strawberry 2; -#X text 39 32 Dynamically route lists based on first element \, according -to the mapping specified on right inlet. Creation argument (float) -specifies how many outlet to have (including last outlet \, which is -used for sending unmatching items); -#X text 44 120 Test it with some data:; -#X obj 93 379 print out1; -#X obj 115 352 print out2; -#X obj 137 325 print out3; -#X obj 160 298 print other; -#X text 256 293 <-- non-matching stuff is sent here; -#X text 196 192 Change the mapping:; -#X connect 0 0 7 0; -#X connect 0 1 8 0; -#X connect 0 2 9 0; -#X connect 0 3 10 0; -#X connect 1 0 2 0; -#X connect 2 0 0 0; -#X connect 3 0 0 1; -#X connect 4 0 0 1; +#N canvas 342 108 616 430 10; +#X obj 93 268 dynroute 4; +#X msg 41 147 apple red \, banana yellow \, pear green \, apple yellow +\, strawberry red; +#X obj 41 194 list prepend; +#X msg 200 224 clear \, add apple 0 \, add banana 1 \, add pear 2; +#X msg 206 258 remove pear 2 \, add pear 0 \, add strawberry 2; +#X text 39 32 Dynamically route lists based on first element \, according +to the mapping specified on right inlet. Creation argument (float) +specifies how many outlet to have (including last outlet \, which is +used for sending unmatching items); +#X text 44 120 Test it with some data:; +#X obj 93 379 print out1; +#X obj 115 352 print out2; +#X obj 137 325 print out3; +#X obj 160 298 print other; +#X text 256 293 <-- non-matching stuff is sent here; +#X text 196 192 Change the mapping:; +#X connect 0 0 7 0; +#X connect 0 1 8 0; +#X connect 0 2 9 0; +#X connect 0 3 10 0; +#X connect 1 0 2 0; +#X connect 2 0 0 0; +#X connect 3 0 0 1; +#X connect 4 0 0 1; diff --git a/tcl_class.c b/tcl_class.c index 4e17bc7..307f4bf 100644 --- a/tcl_class.c +++ b/tcl_class.c @@ -104,7 +104,7 @@ static inline t_class* class_table_get(const char* name) return (t_class*)list_get(class_tbl[h], name); } -static inline void object_table_add(const char* name, t_pd* o) +static inline void object_table_add(const char* name, t_tcl* o) { uint32_t h = hash_str(name) % OBJECT_TABLE_SIZE; object_tbl[h] = list_add(object_tbl[h], name, (void*)o); @@ -116,7 +116,7 @@ static inline void object_table_remove(const char* name) object_tbl[h] = list_remove(object_tbl[h], name); } -static inline t_pd* object_table_get(const char* name) +static inline t_tcl* object_table_get(const char* name) { uint32_t h = hash_str(name) % OBJECT_TABLE_SIZE; return (t_pd*)list_get(object_tbl[h], name); @@ -333,6 +333,10 @@ t_pd* tclpd_get_instance_pd(const char* objectSequentialId) { return (t_pd*)object_table_get(objectSequentialId); } +t_text* tclpd_get_instance_text(const char* objectSequentialId) { + return (t_text*)object_table_get(objectSequentialId); +} + t_object* tclpd_get_object(const char* objectSequentialId) { t_tcl* x = tclpd_get_instance(objectSequentialId); return &x->o; diff --git a/tcl_extras.h b/tcl_extras.h index d209b8e..7e9fb5c 100644 --- a/tcl_extras.h +++ b/tcl_extras.h @@ -64,6 +64,7 @@ void tclpd_loadbang(t_tcl* x); t_proxyinlet* tclpd_add_proxyinlet(t_tcl* x); t_tcl* tclpd_get_instance(const char* objectSequentialId); 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_glist* tclpd_get_glist(const char* objectSequentialId); -- cgit v1.2.1