aboutsummaryrefslogtreecommitdiff
path: root/examples/index.pd
blob: 6f1417e7445abc5b4777429997affb943ffab29f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#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 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 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 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;