From 7c748a919a64d9bc1b9f47a3c65ff6a3718e0274 Mon Sep 17 00:00:00 2001 From: Luke Iannini Date: Wed, 16 Apr 2008 23:08:33 +0000 Subject: list-proc-insert, two more ds-abs svn path=/trunk/abstractions/senderfruit/; revision=9714 --- core/ds-first-help.pd | 84 +++++++++++++++++++++++++++++++++++++++++++ core/ds-first.pd | 27 ++++++++++++++ core/ds-idx-only-help.pd | 23 ++++++++++++ core/ds-idx-only.pd | 56 +++++++++++++++++++++++++++++ core/list-proc-insert-help.pd | 43 ++++++++++++++++++++++ core/list-proc-insert.pd | 14 ++++++++ 6 files changed, 247 insertions(+) create mode 100644 core/ds-first-help.pd create mode 100644 core/ds-first.pd create mode 100644 core/ds-idx-only-help.pd create mode 100644 core/ds-idx-only.pd create mode 100644 core/list-proc-insert-help.pd create mode 100644 core/list-proc-insert.pd (limited to 'core') diff --git a/core/ds-first-help.pd b/core/ds-first-help.pd new file mode 100644 index 0000000..a372af1 --- /dev/null +++ b/core/ds-first-help.pd @@ -0,0 +1,84 @@ +#N struct datatemplatered float x float y; +#N struct datatemplateblue float x float y; +#N canvas 0 22 450 300 10; +#X obj 360 250 ds-first; +#X obj 55 86 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X text 11 30 Right outlet bangs at end of data.; +#N canvas 963 339 134 109 \$0data 1; +#X scalar datatemplatered 30 10 \;; +#X scalar datatemplatered 40 20 \;; +#X scalar datatemplatered 50 30 \;; +#X scalar datatemplatered 60 40 \;; +#X scalar datatemplateblue 10 10 \;; +#X scalar datatemplateblue 20 20 \;; +#X scalar datatemplateblue 30 30 \;; +#X scalar datatemplateblue 40 40 \;; +#X restore 321 56 pd \$0data; +#X obj 55 110 t a b; +#X obj 55 200 list-extend; +#X obj 55 224 prepent set; +#X text 269 260 2008 Luke Iannini; +#X text 272 274 proyekto.net; +#X obj 298 142 bng 15 250 50 0 empty empty end 17 7 0 10 -262144 -1 +-1; +#X msg 55 251 30; +#N canvas 10 355 450 300 datatemplateblue 0; +#X msg 190 198 traverse pd-\$1data \, bang; +#X obj 190 224 pointer; +#X obj 163 128 loadbang; +#X msg 17 208 10 10 \, 20 20 \, 30 30 \, 40 40; +#X obj 144 129 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X obj 190 175 \$0; +#X msg 229 153 clear; +#X obj 229 176 s pd-\$0data; +#X obj 48 18 struct datatemplateblue float x float y; +#X obj 79 279 append datatemplateblue x y; +#X obj 48 41 drawpolygon 9 3 0 0 0 10 10 10 10 0 0 0; +#X obj 163 153 t b b b b; +#X obj 89 153 s \$0makeRed; +#X connect 0 0 1 0; +#X connect 1 0 9 2; +#X connect 2 0 11 0; +#X connect 3 0 9 0; +#X connect 4 0 11 0; +#X connect 5 0 0 0; +#X connect 6 0 7 0; +#X connect 11 0 12 0; +#X connect 11 1 3 0; +#X connect 11 2 5 0; +#X connect 11 3 6 0; +#X restore 322 81 pd datatemplateblue; +#N canvas 10 355 450 300 datatemplatered 0; +#X msg 190 198 traverse pd-\$1data \, bang; +#X obj 190 224 pointer; +#X obj 144 129 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X obj 190 175 \$0; +#X obj 79 279 append datatemplatered x y; +#X obj 48 18 struct datatemplatered float x float y; +#X obj 48 41 drawpolygon 900 3 0 0 0 10 10 10 10 0 0 0; +#X msg 17 208 30 10 \, 40 20 \, 50 30 \, 60 40; +#X obj 163 152 t b b; +#X obj 163 128 r \$0makeRed; +#X connect 0 0 1 0; +#X connect 1 0 4 2; +#X connect 2 0 8 0; +#X connect 3 0 0 0; +#X connect 7 0 4 0; +#X connect 8 0 7 0; +#X connect 8 1 3 0; +#X connect 9 0 8 0; +#X restore 322 101 pd datatemplatered; +#X obj 55 174 get datatemplatered x; +#X text 12 13 Outputs first encountered pointer of a template.; +#X obj 55 141 ds-first pd-\$0data datatemplatered; +#X connect 1 0 4 0; +#X connect 4 0 15 0; +#X connect 4 1 5 1; +#X connect 5 0 6 0; +#X connect 6 0 10 0; +#X connect 13 0 5 0; +#X connect 15 0 13 0; +#X connect 15 1 9 0; diff --git a/core/ds-first.pd b/core/ds-first.pd new file mode 100644 index 0000000..eb8ddb4 --- /dev/null +++ b/core/ds-first.pd @@ -0,0 +1,27 @@ +#N canvas 540 376 450 300 10; +#X obj 182 135 until; +#X msg 182 156 next; +#X obj 56 90 list append \$1; +#X obj 56 113 prepent traverse; +#X obj 56 53 loadbang; +#X obj 182 22 inlet; +#X obj 209 242 outlet; +#X obj 336 242 outlet; +#X obj 182 179 pointer \$2; +#X obj 182 206 t b a; +#X obj 182 52 t b b; +#X obj 297 50 t b b; +#X connect 0 0 1 0; +#X connect 1 0 8 0; +#X connect 2 0 3 0; +#X connect 3 0 8 0; +#X connect 4 0 2 0; +#X connect 5 0 10 0; +#X connect 8 0 9 0; +#X connect 8 2 11 0; +#X connect 9 0 11 0; +#X connect 9 1 6 0; +#X connect 10 0 0 0; +#X connect 10 1 2 0; +#X connect 11 0 7 0; +#X connect 11 1 0 1; diff --git a/core/ds-idx-only-help.pd b/core/ds-idx-only-help.pd new file mode 100644 index 0000000..02f3c23 --- /dev/null +++ b/core/ds-idx-only-help.pd @@ -0,0 +1,23 @@ +#N canvas 0 22 450 300 10; +#X text 16 11 ds-idx-only; +#X text 274 254 2008 Luke Iannini; +#X obj 105 89 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X text 123 88 bang for last used index; +#X msg 54 88 10; +#X obj 54 126 ds-idx-only pd-\$0data datatemplate5 3; +#X obj 273 153 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X text 16 35 outputs the nth pointer of a certain template type \, +or a bang from the right outlet if the nth pointer does not exist. +; +#X obj 54 170 get datatemplate5 x; +#X obj 70 198 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X floatatom 54 223 5 0 0 0 - - -; +#X connect 2 0 5 0; +#X connect 4 0 5 0; +#X connect 5 0 8 0; +#X connect 5 1 6 0; +#X connect 8 0 9 0; +#X connect 8 0 10 0; diff --git a/core/ds-idx-only.pd b/core/ds-idx-only.pd new file mode 100644 index 0000000..b13a7df --- /dev/null +++ b/core/ds-idx-only.pd @@ -0,0 +1,56 @@ +#N canvas 869 295 378 463 10; +#X obj 197 233 sel \$3; +#X obj 197 210 f; +#X obj 221 210 + 1; +#X obj 116 289 pointer; +#X obj 162 346 once; +#X msg 183 325 reset; +#X obj 162 426 outlet; +#X obj 240 75 list append \$1; +#X obj 240 98 prepent traverse; +#X msg 212 187 0; +#X obj 38 85 until; +#X msg 38 109 next; +#X obj 127 102 t b; +#X obj 224 161 route bang; +#X obj 38 131 pointer \$2; +#X obj 144 8 inlet; +#X obj 128 172 t b p; +#X obj 197 255 t b b; +#X obj 183 138 t b b a; +#X obj 144 37 t b b a; +#X obj 127 80 r \$0stop; +#X obj 224 278 s \$0stop; +#X obj 162 375 route bang; +#X obj 232 426 outlet; +#X connect 0 0 17 0; +#X connect 1 0 2 0; +#X connect 1 0 0 0; +#X connect 2 0 1 1; +#X connect 3 0 4 0; +#X connect 4 0 22 0; +#X connect 5 0 4 1; +#X connect 7 0 8 0; +#X connect 8 0 14 0; +#X connect 9 0 1 1; +#X connect 10 0 11 0; +#X connect 11 0 14 0; +#X connect 12 0 10 1; +#X connect 13 1 0 1; +#X connect 14 0 16 0; +#X connect 14 2 12 0; +#X connect 14 2 4 0; +#X connect 15 0 19 0; +#X connect 16 0 1 0; +#X connect 16 1 3 1; +#X connect 17 0 3 0; +#X connect 17 1 21 0; +#X connect 18 0 5 0; +#X connect 18 1 9 0; +#X connect 18 2 13 0; +#X connect 19 0 10 0; +#X connect 19 1 7 0; +#X connect 19 2 18 0; +#X connect 20 0 12 0; +#X connect 22 0 23 0; +#X connect 22 1 6 0; diff --git a/core/list-proc-insert-help.pd b/core/list-proc-insert-help.pd new file mode 100644 index 0000000..28e0d33 --- /dev/null +++ b/core/list-proc-insert-help.pd @@ -0,0 +1,43 @@ +#N canvas 246 385 587 311 10; +#X obj 58 181 list-proc-insert; +#X msg 58 96 a b c d e f g; +#X obj 182 181 list-len; +#X obj 104 130 hradio 15 1 0 8 empty empty POS_(zero-based) 0 -6 0 +8 -262144 -1 -1 0; +#X floatatom 104 155 5 0 0 0 - - -; +#X obj 58 216 print NEW_LIST; +#X text 9 65 Argument: default POS; +#X text 8 45 POS is zerobased. Negative POS will count from the end. +; +#X text 10 268 based on list-insert by frank barknecht; +#X text 429 268 2008 Luke Iannini; +#X text 235 122 POS defaults to 0 \, meaning it will prepend the result +to the original list.; +#N canvas 0 22 322 281 how_to_append 0; +#X obj 58 181 list-proc-insert; +#X msg 58 66 a b c d e f g; +#X obj 58 97 t a a; +#X obj 58 216 print NEW_LIST2; +#X obj 85 134 list-len; +#X obj 183 189 f; +#X obj 213 189 + 1; +#X obj 183 168 t b; +#X connect 0 0 3 0; +#X connect 0 1 7 0; +#X connect 1 0 2 0; +#X connect 2 0 0 0; +#X connect 2 1 4 0; +#X connect 4 0 0 1; +#X connect 5 0 0 2; +#X connect 5 0 6 0; +#X connect 6 0 5 1; +#X connect 7 0 5 0; +#X restore 310 185 pd how_to_append; +#X text 7 6 list-proc-insert: call user-defined process on incoming +list and insert result into original list at position POS.; +#X connect 0 0 5 0; +#X connect 0 1 2 0; +#X connect 1 0 0 0; +#X connect 2 0 0 2; +#X connect 3 0 4 0; +#X connect 4 0 0 1; diff --git a/core/list-proc-insert.pd b/core/list-proc-insert.pd new file mode 100644 index 0000000..89b2728 --- /dev/null +++ b/core/list-proc-insert.pd @@ -0,0 +1,14 @@ +#N canvas 433 22 275 240 10; +#X obj 35 34 inlet; +#X obj 75 34 inlet; +#X obj 35 147 list-insert \$1; +#X obj 35 62 t a a; +#X obj 176 175 outlet; +#X obj 178 39 inlet; +#X obj 35 174 outlet; +#X connect 0 0 3 0; +#X connect 1 0 2 1; +#X connect 2 0 6 0; +#X connect 3 0 4 0; +#X connect 3 1 2 2; +#X connect 5 0 2 0; -- cgit v1.2.1