aboutsummaryrefslogtreecommitdiff
path: root/src/tof.h
diff options
context:
space:
mode:
authorThomas O Fredericks <mrtof@users.sourceforge.net>2009-10-06 22:41:52 +0000
committerThomas O Fredericks <mrtof@users.sourceforge.net>2009-10-06 22:41:52 +0000
commitdcd3ce848a86fc70339ed94432d96aee73d63e62 (patch)
tree70d6735c34b0bcbad67d3c8f27a569b6c7780f53 /src/tof.h
parent513a2ac72ef3f02cba9d211b3cc79cbc140bba30 (diff)
testing a new state saving system
svn path=/trunk/externals/tof/; revision=12552
Diffstat (limited to 'src/tof.h')
-rw-r--r--src/tof.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/tof.h b/src/tof.h
index 216cb62..2f51630 100644
--- a/src/tof.h
+++ b/src/tof.h
@@ -243,3 +243,51 @@ static void tof_find_tagged_argument(char tag,t_symbol *name, int ac, t_atom *av
}
}
+
+
+static void tof_outlet_anything_prepend(t_outlet* outlet, t_symbol* s, int argc, t_atom* argv, t_symbol* pp) {
+
+ if (s == &s_list || s == &s_float || s == &s_symbol) {
+ outlet_anything(outlet,pp,argc,argv);
+ } else if (s != &s_bang) {
+ int ac = argc + 1;
+ t_atom *av = (t_atom *)getbytes(ac*sizeof(t_atom));
+ tof_copy_atoms(argv,av+1,argc);
+ SETSYMBOL(av, s);
+ outlet_anything(outlet,pp,ac,av);
+ freebytes(av, ac*sizeof(t_atom));
+ } else {
+ outlet_bang(outlet);
+ }
+}
+
+
+static void tof_send_anything_prepend(t_symbol* target,t_symbol* s, int ac, t_atom* av,t_symbol* prepend) {
+
+ if (target->s_thing) {
+ if ( s == &s_list || s == &s_float || s == &s_symbol ) {
+ typedmess(target->s_thing, prepend, ac, av);
+ } else {
+ int new_ac = ac + 1;
+ t_atom *new_av = getbytes(new_ac*sizeof(*new_av));
+ tof_copy_atoms(av,new_av+1,ac);
+ SETSYMBOL(new_av, s);
+ typedmess(target->s_thing, prepend, new_ac, new_av);
+ freebytes(new_av, new_ac*sizeof(*new_av));
+ }
+ }
+
+}
+
+
+static t_symbol* tof_remove_extension(t_symbol* s) {
+ t_symbol* newsymbol;
+ int length = strlen(s->s_name) + 1;
+ char* newstring = getbytes(length * sizeof(*newstring));
+ strcpy(newstring,s->s_name);
+ char* last = strrchr( newstring, '.');
+ *last = '\0';
+ newsymbol = gensym(newstring);
+ freebytes(newstring,length * sizeof(*newstring));
+ return newsymbol;
+}