From 26ee20ec18d74ad4975fecfe17cc61590ec6a681 Mon Sep 17 00:00:00 2001 From: Thomas O Fredericks Date: Fri, 16 Oct 2009 13:24:15 +0000 Subject: Restricted path to symbols svn path=/trunk/externals/tof/; revision=12595 --- abs/paramGui.pd | 10 ++--- help/path-help.pd | 116 +++++++++++++++++++++++++++--------------------------- src/path.c | 24 ++--------- 3 files changed, 67 insertions(+), 83 deletions(-) diff --git a/abs/paramGui.pd b/abs/paramGui.pd index 335b26b..d3305ed 100644 --- a/abs/paramGui.pd +++ b/abs/paramGui.pd @@ -26,13 +26,13 @@ #X obj 54 344 zexy/makesymbol %s%s%s; #X obj -2 210 t b a a a; #X obj -5 386 pack f s s s; -#X msg -37 460 obj 0 \$1 bng 15 250 50 0 \$2 \$3 \$4 17 7 0 10 -262144 +#X msg -37 460 obj 0 \$1 bng 15 250 50 0 \$2 \$3 \$4 17 7 0 8 -262144 -1 -1; -#X msg 132 483 obj 0 \$1 nbx 5 14 -1e+37 1e+37 0 0 \$2 \$3 \$4 57 7 -0 10 -262144 -1 -1 0 256; +#X msg 132 483 obj 0 \$1 nbx 5 14 -1e+37 1e+37 0 0 \$2 \$3 \$4 48 7 +0 8 -262144 -1 -1 0 256; #X msg 527 521 obj 0 \$1 hsl 100 15 \$5 \$6 0 0 \$2 \$3 \$4 105 7 0 -10 -262144 -1 -1 0 1; -#X msg 528 476 obj 0 \$1 tgl 15 0 \$2 \$3 \$4 17 7 0 10 -262144 -1 +8 -262144 -1 -1 0 1; +#X msg 528 476 obj 0 \$1 tgl 15 0 \$2 \$3 \$4 17 7 0 8 -262144 -1 -1 0 1; #X msg 490 451 symbolatom 0 \$1 17 0 0 1 \$4 \$3 \$2; #X msg 496 89 clear \, text 0 0 YOU MUST COPY AND PASTE THE FOLLOWING diff --git a/help/path-help.pd b/help/path-help.pd index 4c3cfc3..41eaedc 100644 --- a/help/path-help.pd +++ b/help/path-help.pd @@ -1,25 +1,19 @@ -#N canvas 0 24 1018 689 10; -#X obj 54 585 print RESULT; -#X obj 54 334 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +#N canvas 0 24 1018 686 10; +#X obj 47 587 print RESULT; +#X obj 47 336 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; -#X msg 95 353 samples/; -#X msg 113 509 C:/Documents and Settings/tom/My Documents/pd/parent.test.pd -; -#X obj 54 558 path; -#X obj 52 12 cnv 15 400 100 empty empty empty 20 12 0 14 -249661 -66577 +#X obj 47 560 path; +#X obj 32 11 cnv 15 400 100 empty empty empty 20 12 0 14 -249661 -66577 0; -#X text 57 57 author: mrtoftrash@gmail.com; -#X text 57 68 version: 2009-06-07 (initial release); -#X text 79 330 <- a bang will output the root patch's path; -#X text 159 352 <- Sending a relative path will append that path to +#X text 37 56 author: mrtoftrash@gmail.com; +#X text 37 67 version: 2009-06-07 (initial release); +#X text 72 332 <- a bang will output the root patch's path; +#X text 191 355 <- Sending a relative path will append that path to the root patch's path; -#X text 113 427 Linux and OS X; -#X text 120 467 Windows; -#X msg 114 448 /unchanged/because/of/the/slash/at/the/start; -#X msg 113 487 C:/unchanged/because/of/the/:/as/second/char; +#X text 106 429 Linux and OS X; +#X text 113 469 Windows; #X obj 544 44 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; -#X msg 593 158 samples/; #X text 569 42 <- a bang will output the root patch's path; #X obj 570 112 openpanel; #X obj 570 92 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 @@ -28,67 +22,73 @@ the root patch's path; #X symbolatom 544 233 50 0 0 0 - - -; #X text 575 60 Anything else will be treated as a path; #X obj 544 202 path relative; -#X text 653 156 <- Relative paths are unchanged; -#X text 111 414 Absolute paths are unchanged; +#X text 699 158 <- Relative paths are unchanged; +#X text 104 416 Absolute paths are unchanged; #X obj 545 282 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 545 395 print CURRENT; #X obj 545 368 path current; #X text 575 282 <- a bang will output the current patch's path; -#X text 58 12 description: outputs or transform paths.; -#X text 57 46 tags: file tof; -#X text 49 114 [path] can convert relative paths to absolute paths -or the other way around. The base path can be either the path of the -current patch \, or the path of the root patch.; -#X text 196 157 -- keywords --; -#X text 47 220 current: use the current patch's path (instead of using -the root patch's path).; -#X text 47 254 relative: transform absolute paths into relative paths -(instead of the other way around).; -#X text 177 306 -- default behavior --; +#X text 38 11 description: outputs or transform paths.; +#X text 37 45 tags: file tof; +#X text 176 162 -- keywords --; #X text 710 260 -- current --; -#X msg 573 315 samples/; -#X text 637 314 <- Sending a relative path will append that path to +#X text 675 314 <- Sending a relative path will append that path to the current patch's path; #X text 685 9 -- relative --; #X obj 545 455 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; -#X msg 594 569 samples/; #X obj 571 523 openpanel; #X obj 571 503 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X symbolatom 571 545 50 0 0 0 - - -; #X symbolatom 545 634 50 0 0 0 - - -; #X text 576 471 Anything else will be treated as a path; -#X text 654 567 <- Relative paths are unchanged; +#X text 698 567 <- Relative paths are unchanged; #X text 680 427 -- relative & current --; #X obj 545 603 path relative current; -#X text 48 176 You can use the "current" and "relative" keywords to -change the default behavior. The order of the keywords is not important. -; #X text 570 453 <- a bang will output the current patch's path; #X text 591 82 Absolute paths will be made relative to the root patch's path; #X text 596 494 Absolute paths will be made relative to the current patch's path; -#X connect 1 0 4 0; -#X connect 2 0 4 0; -#X connect 3 0 4 0; -#X connect 4 0 0 0; -#X connect 12 0 4 0; -#X connect 13 0 4 0; -#X connect 14 0 22 0; -#X connect 15 0 22 0; -#X connect 17 0 19 0; -#X connect 18 0 17 0; -#X connect 19 0 22 0; -#X connect 22 0 20 0; -#X connect 25 0 27 0; -#X connect 27 0 26 0; -#X connect 37 0 27 0; -#X connect 40 0 49 0; -#X connect 41 0 49 0; -#X connect 42 0 44 0; -#X connect 43 0 42 0; -#X connect 44 0 49 0; -#X connect 49 0 45 0; +#X msg 593 158 symbol samples/; +#X msg 573 315 symbol samples/; +#X msg 594 569 symbol samples/; +#X msg 88 355 symbol samples/; +#X msg 107 450 symbol /unchanged/because/of/the/slash/at/the/start +; +#X msg 106 489 symbol C:/unchanged/because/of/the/:/as/second/char +; +#X msg 106 511 symbol C:/Documents and Settings/tom/My Documents/pd/parent.test.pd +; +#X text 148 309 -- default behavior (absolute root) --; +#X text 27 191 current: use the current patch's path.; +#X text 26 207 root: use the root patch's path.; +#X text 24 242 relative: transform absolute paths into relative paths +; +#X text 24 255 absolute: transform relative paths into absolute paths +; +#X text 29 113 [path] can convert relative paths to absolute paths +or the other way around.; +#X connect 1 0 2 0; +#X connect 2 0 0 0; +#X connect 10 0 17 0; +#X connect 12 0 14 0; +#X connect 13 0 12 0; +#X connect 14 0 17 0; +#X connect 17 0 15 0; +#X connect 20 0 22 0; +#X connect 22 0 21 0; +#X connect 30 0 38 0; +#X connect 31 0 33 0; +#X connect 32 0 31 0; +#X connect 33 0 38 0; +#X connect 38 0 34 0; +#X connect 42 0 17 0; +#X connect 43 0 22 0; +#X connect 44 0 38 0; +#X connect 45 0 2 0; +#X connect 46 0 2 0; +#X connect 47 0 2 0; +#X connect 48 0 2 0; diff --git a/src/path.c b/src/path.c index f18698a..d44ab95 100644 --- a/src/path.c +++ b/src/path.c @@ -140,11 +140,11 @@ static void path_bang(t_path *x) } -static void path_anything(t_path *x, t_symbol *s, int ac, t_atom* av) { +static void path_symbol(t_path *x, t_symbol *s) { - - int length = tof_anything_to_string(s,ac,av,tof_buf_temp_a); + strcpy(tof_buf_temp_a,s->s_name); + int length = strlen(tof_buf_temp_a); t_symbol* result; if ( x->mode == x->s_relative ) { @@ -193,22 +193,6 @@ static void path_anything(t_path *x, t_symbol *s, int ac, t_atom* av) { -/* -void path_list(t_path *x,t_symbol *s, int argc, t_atom *argv) -{ - - - if ( argc >= 2) { - x->value = atom_getfloat(argv); - x->inc = atom_getfloat(argv+1); - } - - -} -*/ - - - static void path_free(t_path *x) @@ -269,7 +253,7 @@ void path_setup(void) { A_GIMME, 0); class_addbang(path_class, path_bang); - class_addanything(path_class,path_anything); + class_addsymbol(path_class,path_symbol); //class_addmethod(path_class, // (t_method)path_append, gensym("append"), -- cgit v1.2.1