From 682acdb411514688872c8126d726a6a45ff8ef6e Mon Sep 17 00:00:00 2001 From: Thomas O Fredericks Date: Tue, 27 Oct 2009 14:45:38 +0000 Subject: Added an argument parser svn path=/trunk/externals/tof/; revision=12686 --- help/argument-help.pd | 16 +++++++++------- help/arguments-help.pd | 38 ++++++++++++++++++++++++++++++++++++++ help/test-arguments-all.pd | 9 +++++++++ help/test-arguments-comma.pd | 23 +++++++++++++++++++++++ help/test-arguments-token.pd | 15 +++++++++++++++ 5 files changed, 94 insertions(+), 7 deletions(-) create mode 100644 help/arguments-help.pd create mode 100644 help/test-arguments-all.pd create mode 100644 help/test-arguments-comma.pd create mode 100644 help/test-arguments-token.pd (limited to 'help') diff --git a/help/argument-help.pd b/help/argument-help.pd index 7c8ac56..a6fbd47 100644 --- a/help/argument-help.pd +++ b/help/argument-help.pd @@ -1,4 +1,4 @@ -#N canvas 53 62 922 529 10; +#N canvas 59 319 922 529 10; #X obj 496 461 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj -11 19 cnv 15 400 100 empty empty empty 20 12 0 14 -249661 -66577 @@ -19,7 +19,7 @@ #X obj 419 244 tof/argument 1 32; #X obj 422 325 tof/argument; #X obj 496 485 ./argument-abs a b; -#X text 9 132 [argument n default]; +#X text 5 176 [argument n default]; #X text -4 17 description: Outputs the patch's creation arguments individually. ; #X text 516 147 This help patch is a file and therefore has no creation @@ -34,17 +34,19 @@ of the printed output.; #X text 534 237 As stated before \, this help patch is a file and has no creation arguments. But the [argument] to the left has a default value and will output it.; -#X text 10 155 argument 1: patch's creation argument to output.; -#X text 9 172 argument 2: default value to output if the patch's creation +#X text 6 199 argument 1: patch's creation argument to output.; +#X text 5 216 argument 2: default value to output if the patch's creation argument is not set or if the wrong type.; -#X text 8 209 inlet 1 bang: outputs the n-th patch creation argument +#X text 4 253 inlet 1 bang: outputs the n-th patch creation argument or the default value if there is no n-th creation argument.; -#X text 9 245 outlet 1 anything: outputs the n-th patch creation argument +#X text 5 289 outlet 1 anything: outputs the n-th patch creation argument or the default value if there is no n-th creation argument.; -#X text 5 287 If the patch's n-th creation argument is not of the same +#X text 1 331 If the patch's n-th creation argument is not of the same type as the default value \, the default value will be outputed instead. ; #X text -4 46 tags: initialization patch; +#X text 1 126 see also:; +#X obj 73 129 tof/arguments; #X connect 0 0 14 0; #X connect 4 0 11 0; #X connect 5 0 12 0; diff --git a/help/arguments-help.pd b/help/arguments-help.pd new file mode 100644 index 0000000..26d4a28 --- /dev/null +++ b/help/arguments-help.pd @@ -0,0 +1,38 @@ +#N canvas 56 497 880 406 10; +#X obj 506 84 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X obj 506 333 ./test-arguments-all a bear 3 34; +#X obj 507 307 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X obj 508 181 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X obj 508 206 ./test-arguments-token @a 54 @c 764; +#X obj 506 104 ./test-arguments-comma ready \, 1 2 3 \, go speedracer +; +#X obj -1 29 cnv 15 400 100 empty empty empty 20 12 0 14 -249661 -66577 +0; +#X text 7 78 author: mrtoftrash@gmail.com; +#X text 6 56 tags: initialization patch; +#X text 6 27 description: Outputs and parses the patch's creation arguments. +; +#X text 5 98 version: 2009-10-27 (initial release); +#X text 5 139 see also:; +#X obj 77 142 tof/argument; +#X text 15 180 [arguments mode]; +#X text 15 209 argument 1 symbol: the parsing mode. If it is "comma" +or " \, " the mode is set to COMMA. If it is another symbol \, the +first character of the symbol is used as a TOKEN. If no argument is +set \, the default mode is ALL.; +#X text 17 284 inlet 1 bang: outputs parsed patch creation arguments. +; +#X text 18 308 outlet 1 variable: the parsed patch arguments.; +#X text 611 32 COMMA MODE; +#X obj 546 57 tof/arguments comma; +#X obj 681 57 tof/arguments \,; +#X text 613 265 ALL MODE; +#X text 608 132 TOKEN MODE; +#X obj 593 158 tof/arguments @; +#X obj 596 290 tof/arguments; +#X connect 0 0 5 0; +#X connect 2 0 1 0; +#X connect 3 0 4 0; diff --git a/help/test-arguments-all.pd b/help/test-arguments-all.pd new file mode 100644 index 0000000..6f4c874 --- /dev/null +++ b/help/test-arguments-all.pd @@ -0,0 +1,9 @@ +#N canvas 402 618 450 300 10; +#X obj 141 46 inlet; +#X obj 141 163 print; +#X obj 143 110 tof/arguments; +#X obj 143 76 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X connect 0 0 3 0; +#X connect 2 0 1 0; +#X connect 3 0 2 0; diff --git a/help/test-arguments-comma.pd b/help/test-arguments-comma.pd new file mode 100644 index 0000000..71afc78 --- /dev/null +++ b/help/test-arguments-comma.pd @@ -0,0 +1,23 @@ +#N canvas 402 618 450 300 10; +#X obj 140 54 inlet; +#X obj 143 110 tof/arguments comma; +#X obj 140 83 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X symbolatom 41 232 10 0 0 0 - - -; +#X obj 260 257 print; +#X obj 41 210 symbol; +#X obj 33 165 route go list; +#X obj 118 199 unpack f f f; +#X floatatom 118 231 5 0 0 0 - - -; +#X floatatom 159 231 5 0 0 0 - - -; +#X floatatom 203 232 5 0 0 0 - - -; +#X connect 0 0 2 0; +#X connect 1 0 4 0; +#X connect 1 0 6 0; +#X connect 2 0 1 0; +#X connect 5 0 3 0; +#X connect 6 0 5 0; +#X connect 6 1 7 0; +#X connect 7 0 8 0; +#X connect 7 1 9 0; +#X connect 7 2 10 0; diff --git a/help/test-arguments-token.pd b/help/test-arguments-token.pd new file mode 100644 index 0000000..89795b1 --- /dev/null +++ b/help/test-arguments-token.pd @@ -0,0 +1,15 @@ +#N canvas 402 618 450 300 10; +#X obj 141 46 inlet; +#X obj 144 108 tof/arguments @; +#X obj 144 157 route @a @c; +#X floatatom 139 194 5 0 0 0 - - -; +#X floatatom 186 193 5 0 0 0 - - -; +#X obj 142 72 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X obj 268 175 print; +#X connect 0 0 5 0; +#X connect 1 0 2 0; +#X connect 1 0 6 0; +#X connect 2 0 3 0; +#X connect 2 1 4 0; +#X connect 5 0 1 0; -- cgit v1.2.1