aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/index.pd214
1 files changed, 125 insertions, 89 deletions
diff --git a/examples/index.pd b/examples/index.pd
index 836f86f..6f1417e 100644
--- a/examples/index.pd
+++ b/examples/index.pd
@@ -1,92 +1,128 @@
-#N canvas 347 343 854 550 10;
-#X msg 117 288 reset;
-#X msg 216 288 auto 0;
-#X msg 354 287 help;
-#X floatatom 441 288 0 0 0 0 - - -;
-#X floatatom 192 439 0 0 0 0 - - -;
-#X obj 117 419 index 128 3;
-#X text 224 441 index;
-#X msg 216 313 auto 1;
-#X msg 128 85 add alias;
-#X msg 128 103 add bind;
-#X msg 128 121 add break;
-#X msg 128 140 add built-in;
-#X msg 128 159 add case;
-#X msg 384 103 delete bind;
-#X msg 384 121 delete break;
-#X msg 384 140 delete built-in;
-#X msg 384 159 delete case;
-#X obj 231 179 symbol;
-#X msg 250 159 case;
-#X msg 250 140 built-in;
-#X msg 250 121 break;
-#X msg 250 103 bind;
-#X msg 250 85 alias;
-#X obj 231 197 send 2index;
-#X obj 117 372 receive 2index;
-#X obj 372 197 send 2index;
-#X obj 114 197 send 2index;
-#X text 239 48 get item index;
-#X text 233 62 (evt. add new item);
-#X text 106 269 clear map;
-#X text 68 48 add new item to map;
-#X text 382 46 delete item from map;
-#X text 190 269 set/reset AUTO-adding;
-#X text 353 271 help;
-#X text 440 272 debug: which item has index #;
-#X text 61 9 index: create a symbol->int map;
-#X text 349 402 creation : "index [<n> [<auto>]]";
-#X text 290 517 in NON-AUTO mode \, only ADDED symbols (eg. "add <symbol>")
-are added to the map;
-#X text 289 495 in AUTO mode \, unknown symbols are automatically added
+#N canvas 13 96 1051 669 10;
+#X msg 33 374 help;
+#X floatatom 682 190 0 0 128 0 - - -;
+#X msg 58 185 add alias;
+#X msg 58 203 add bind;
+#X msg 58 221 add break;
+#X msg 58 240 add built-in;
+#X msg 58 259 add case;
+#X msg 642 417 delete bind;
+#X msg 642 435 delete break;
+#X msg 642 454 delete built-in;
+#X msg 642 473 delete case;
+#X obj 514 287 symbol;
+#X msg 533 267 case;
+#X msg 533 248 built-in;
+#X msg 533 229 break;
+#X msg 533 211 bind;
+#X msg 533 193 alias;
+#X obj 514 305 send 2index;
+#X obj 61 431 receive 2index;
+#X obj 630 511 send 2index;
+#X obj 44 297 send 2index;
+#X text 522 156 get item index;
+#X text 516 170 (evt. add new item);
+#X text 33 154 add new item to map;
+#X text 640 360 delete item from map;
+#X text 128 39 creation : "index [<n> [<auto>]]";
+#X msg 642 399 delete alias;
+#X text 162 73 auto :: 1_sets auto ON \, 0_sets auto OFF (default off)
+;
+#X text 705 14 part of zexy;
+#X floatatom 61 573 0 0 0 0 - - -;
+#X symbolatom 121 572 0 0 0 0 - - -;
+#X obj 61 552 route float symbol;
+#X obj 196 552 print INDEX;
+#X obj 682 294 send 2index;
+#X text 673 168 query an item at index #;
+#X text 61 9 index:: create a symbol->int map;
+#X text 164 59 n :: initial max. number of elements in list (default:
+128);
+#X obj 460 7 index;
+#N canvas 0 0 849 372 administrative 0;
+#X obj 61 268 outlet;
+#X msg 61 77 reset;
+#X text 50 58 clear map;
+#X msg 103 155 auto \$1;
+#X obj 103 134 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X obj 156 205 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X msg 156 226 resize \$1;
+#X text 174 116 in AUTO mode \, unknown symbols are automatically added
to the map \;;
-#X msg 384 85 delete alias;
-#N canvas 601 96 333 308 print2screen 0;
-#X obj 114 58 inlet;
-#X obj 157 59 inlet;
-#X obj 114 231 pack 0 s;
-#X msg 114 252 \$2 -> \$1;
-#X obj 114 271 print mapped;
-#X obj 157 192 route add symbol delete;
-#X obj 157 212 symbol;
-#X obj 246 173 loadbang;
-#X connect 0 0 2 0;
-#X connect 1 0 5 0;
-#X connect 2 0 3 0;
-#X connect 3 0 4 0;
+#X text 175 143 in NON-AUTO mode (default) \, only ADDed symbols (eg.
+"add <symbol>") are added to the map;
+#X text 235 197 normally \, the map will resize automatically if it
+gets to small. you can prevent it from resizing by sending a "resize
+0" message.;
+#X connect 1 0 0 0;
+#X connect 3 0 0 0;
+#X connect 4 0 3 0;
#X connect 5 0 6 0;
-#X connect 5 1 6 0;
-#X connect 5 2 6 0;
-#X connect 6 0 2 1;
-#X connect 7 0 6 0;
-#X restore 117 488 pd print2screen;
-#X text 387 420 n :: max. number of elements in list (defaults to 128)
+#X connect 6 0 0 0;
+#X restore 187 450 pd administrative;
+#N canvas 0 0 673 455 advanced 0;
+#X obj 76 298 outlet;
+#X msg 90 109 dump;
+#X msg 111 251 sort;
+#X msg 76 56 bang;
+#X text 124 56 output the number of stored entries;
+#X text 128 109 dump each entry in the format "list <symbol> <index>"
;
-#X text 369 429 auto :: 1_sets auto ON \, 0_sets auto OFF (default
-off);
-#X text 705 14 part of zexy;
-#X connect 0 0 5 0;
-#X connect 1 0 5 0;
-#X connect 2 0 5 0;
-#X connect 3 0 5 0;
-#X connect 5 0 4 0;
-#X connect 5 0 40 0;
-#X connect 7 0 5 0;
-#X connect 8 0 26 0;
-#X connect 9 0 26 0;
-#X connect 10 0 26 0;
-#X connect 11 0 26 0;
-#X connect 12 0 26 0;
-#X connect 13 0 25 0;
-#X connect 14 0 25 0;
-#X connect 15 0 25 0;
-#X connect 16 0 25 0;
-#X connect 17 0 23 0;
-#X connect 18 0 17 0;
-#X connect 19 0 17 0;
-#X connect 20 0 17 0;
-#X connect 21 0 17 0;
-#X connect 22 0 17 0;
-#X connect 24 0 40 1;
-#X connect 24 0 5 0;
-#X connect 39 0 25 0;
+#X msg 114 161 compact;
+#X text 173 161 compact the entries \, so there are no holes in the
+map;
+#X text 159 253 sort the elements alphabetically;
+#X text 172 198 this does not produce any immediate output!;
+#X text 177 179 (e.g. "1 ... foo \, 3 ... bar" --> "1 ... foo \, 2
+... bar");
+#X text 156 270 (e.g. "1 ... foo \, 2 ... bar" --> "1 ... bar \, 2
+... foo");
+#X text 161 288 this does not produce any immediate output!;
+#X connect 1 0 0 0;
+#X connect 2 0 0 0;
+#X connect 3 0 0 0;
+#X connect 6 0 0 0;
+#X restore 190 480 pd advanced;
+#X text 320 450 open subpatch for administrative messages;
+#X text 320 480 open subpatch for advanced messages;
+#X obj 61 507 index 10 1;
+#X obj 210 299 send 2index;
+#X text 199 156 add new item to map at index#;
+#X msg 224 187 add foo 7;
+#X msg 231 221 add bar 2;
+#X text 205 168 (if that slot is still free);
+#X obj 824 514 send 2index;
+#X text 834 363 delete item at index# from map;
+#X msg 824 402 delete 6;
+#X text 88 123 "0" indicates success \; "-1" indicates an error;
+#X text 45 105 NOTE: indices start counting from "1" !!!;
+#X connect 0 0 42 0;
+#X connect 1 0 33 0;
+#X connect 2 0 20 0;
+#X connect 3 0 20 0;
+#X connect 4 0 20 0;
+#X connect 5 0 20 0;
+#X connect 6 0 20 0;
+#X connect 7 0 19 0;
+#X connect 8 0 19 0;
+#X connect 9 0 19 0;
+#X connect 10 0 19 0;
+#X connect 11 0 17 0;
+#X connect 12 0 11 0;
+#X connect 13 0 11 0;
+#X connect 14 0 11 0;
+#X connect 15 0 11 0;
+#X connect 16 0 11 0;
+#X connect 18 0 42 0;
+#X connect 26 0 19 0;
+#X connect 31 0 29 0;
+#X connect 31 1 30 0;
+#X connect 31 2 32 0;
+#X connect 38 0 42 0;
+#X connect 39 0 42 0;
+#X connect 42 0 31 0;
+#X connect 45 0 43 0;
+#X connect 46 0 43 0;
+#X connect 50 0 48 0;