-
Notifications
You must be signed in to change notification settings - Fork 237
/
text-object-help.pd
698 lines (698 loc) · 25.1 KB
/
text-object-help.pd
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
#N struct text-help-struct float x float y text z;
#N canvas 583 92 562 579 12;
#X obj 123 531 list;
#X obj 68 12 text;
#X text 46 530 see also:;
#N canvas 0 50 600 400 (subpatch) 0;
#N canvas 0 50 450 250 (subpatch) 0;
#X array table4 100 float 0;
#X coords 0 1 99 -1 500 300 1;
#X restore 50 50 graph;
#X restore 163 531 array;
#X obj 280 196 text define;
#X text 97 147 The text object's first argument sets its function:
, f 27;
#N canvas 573 69 710 786 define 0;
#X msg 49 106 clear;
#X msg 67 132 read text-object-help.txt;
#X msg 80 161 write text-object-help.txt;
#X text 109 25 "text define" maintains a text object and can name it
so that other objects can find it (and later should have some alternative
\, anonymous way to be found).;
#X text 158 462 click to open and edit text:;
#X text 395 472 creation arguments:;
#X text 423 490 optional -k flag to keep contents;
#X text 425 507 optional name;
#X text 254 130 read from a file;
#X text 276 161 write to a file;
#X text 98 105 clear;
#X obj 98 193 bng 17 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 88 550 t b p;
#X obj 88 602 text get -s text t;
#X msg 88 577 0;
#X obj 88 652 print;
#X obj 88 627 list trim;
#X obj 88 489 text define -k text-help-1;
#A set this is a message \; this is another 1 ... \;;
#X msg 151 373 write -c /tmp/test-cr.txt;
#X obj 267 519 print notify-outlet;
#X text 173 633 First outlet is pointer to a "text" scalar containing
the text \, which is output when the object is sent a "bang". For example
\, here's machinery for printing out first line of text., f 46;
#X text 119 187 bang to output a pointer to a scalar (struct) containing
the text - see first outlet below, f 45;
#X text 265 544 Second outlet notifies you when text changes. As of
Pd 0.48 this only outputs the message "updated" when text changes \,
but this might be extended to offer more information in the future.
, f 42;
#X msg 149 416 click;
#X msg 197 416 close;
#X text 245 416 open and close text window;
#X msg 129 275 send text-help-send;
#X text 275 275 send pointer to a named receive object;
#X obj 101 521 r text-help-send;
#X text 147 308 (optionally you can read or write to/from a file interpreting
carriage returns as separators \; this should allow reading some text
file formats - like this:), f 48;
#X msg 118 239 sort;
#N canvas 797 203 637 524 sorting-text 0;
#X obj 64 264 text define text-help-sorting;
#X msg 84 59 sort;
#X msg 101 86 sort -r;
#X msg 110 120 sort -k 1;
#X msg 65 26 set zz \\\; yy \\\; 1 2 \\\; 1 2 3 \\\; 2 1 4 \\\; 1 \\\;
2 \\\; 1 2 3;
#X msg 119 207 sort -u;
#X text 86 313 Numbers come before symbols \, which are sorted alphabetically
(in the sense of "strcmp" - this will probably yield nonsense for non-ASCII
symbols \, but even in that case it should give some repeatable order).
Shorter lines come before longer ones that match the entire shorter
lines. As a special case empty lines come before anything else., f
61;
#X text 187 111 only compare contents of line starting at field 1 (counting
from zero). If two lines are identical (even if both are empty) starting
at the first field compared \, we preserve the original order the lines
appeared in \, even if earlier fields then appear out of order., f
56;
#X text 187 192 unique - suppress identical lines if they are sorted
to consecutive positions (this is not always true when "-k" is also
present)., f 45;
#X text 165 86 reverse order;
#X text 86 407 If the last line in the text isn't terminated a semicolon
is added to it before sorting., f 61;
#X text 86 446 linee terminated by commas are treated as equal to ones
terminated by semicolons. There is probably only confusion to be won
from sorting texts mixing commas and semicolons., f 61;
#X connect 1 0 0 0;
#X connect 2 0 0 0;
#X connect 3 0 0 0;
#X connect 4 0 0 0;
#X connect 5 0 0 0;
#X restore 419 238 pd sorting-text;
#X text 164 238 sort the contents - details here =>;
#X connect 0 0 17 0;
#X connect 1 0 17 0;
#X connect 2 0 17 0;
#X connect 11 0 17 0;
#X connect 12 0 14 0;
#X connect 12 1 13 3;
#X connect 13 0 16 0;
#X connect 14 0 13 0;
#X connect 16 0 15 0;
#X connect 17 0 12 0;
#X connect 17 1 19 0;
#X connect 18 0 17 0;
#X connect 23 0 17 0;
#X connect 24 0 17 0;
#X connect 26 0 17 0;
#X connect 28 0 12 0;
#X connect 30 0 17 0;
#X restore 392 196 pd define;
#X obj 280 219 text get;
#N canvas 475 169 901 610 get 0;
#X floatatom 142 119 5 0 5 0 - - -;
#X msg 66 88 0;
#X msg 142 88 2;
#X msg 102 88 1;
#X obj 142 303 print;
#X obj 230 304 print type;
#X msg 179 88 3;
#X msg 219 88 4;
#X text 312 300 "type" is 0 if terminated by a semicolon \, 1 if by
a comma \, or 2 if the line number was out of range.;
#X obj 126 545 text define -k text-help-get;
#A set 1 2 3 \; a b c \; 4 5 6 \, 7 8 9 10 \;;
#X obj 142 234 text get text-help-get, f 13;
#X floatatom 120 422 5 0 0 0 - - -;
#X msg 44 391 0;
#X msg 120 391 2;
#X msg 80 391 1;
#X obj 120 493 print;
#X msg 157 391 3;
#X msg 197 391 4;
#X obj 120 466 text get text-help-get 1;
#X text 260 221 arguments: name of the text object or "-s struct-name"
;
#X floatatom 531 432 5 0 0 0 - - -;
#X msg 460 401 0;
#X msg 530 401 2;
#X msg 495 401 1;
#X obj 531 483 print;
#X msg 567 401 3;
#X msg 607 401 4;
#X text 301 461 read field number 1 (zero for first field), f 23;
#X obj 531 456 text get text-help-get 1 3;
#X text 40 358 examples showing field selection:;
#X text 62 15 "text get" reads the nth line from the named text and
outputs it \, or optionally reads one or more specific fields (atoms)
from the line.;
#X text 196 119 specify line number (0 for first line);
#X floatatom 171 144 5 0 5 0 - - -;
#X floatatom 200 167 5 0 5 0 - - -;
#X text 248 166 specify number of fields (1 by default \, but ignored
if whole line), f 66;
#X text 726 452 read 3 fields starting at field 1, f 21;
#X text 219 143 starting field number (-1 \, the default \, gives the
whole line), f 61;
#X text 257 241 next optional arg to set starting field number (first
inlet -- none to specify whole line), f 63;
#X text 261 278 next optional arg to set inlet 2 (number of fields
\, defaults to one), f 68;
#X msg 231 193 symbol text-help-get;
#X text 378 192 find another text by name or pointer;
#X connect 0 0 10 0;
#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 connect 7 0 0 0;
#X connect 10 0 4 0;
#X connect 10 1 5 0;
#X connect 11 0 18 0;
#X connect 12 0 11 0;
#X connect 13 0 11 0;
#X connect 14 0 11 0;
#X connect 16 0 11 0;
#X connect 17 0 11 0;
#X connect 18 0 15 0;
#X connect 20 0 28 0;
#X connect 21 0 20 0;
#X connect 22 0 20 0;
#X connect 23 0 20 0;
#X connect 25 0 20 0;
#X connect 26 0 20 0;
#X connect 28 0 24 0;
#X connect 32 0 10 1;
#X connect 33 0 10 2;
#X connect 39 0 10 3;
#X restore 392 219 pd get;
#N canvas 533 146 716 526 text-and-data-structures 0;
#X floatatom 80 193 5 0 0 0 - - -;
#X msg 80 162 0;
#X msg 155 162 2;
#X msg 115 162 1;
#X obj 80 390 print;
#X obj 203 390 print type;
#X obj 203 312 pointer;
#X obj 80 344 text get -s text-help-struct z, f 18;
#N canvas 807 416 450 300 text-help-struct 0;
#X scalar text-help-struct 20 20 \; a b c d \;;
#X obj 232 209 pointer;
#X msg 232 151 traverse pd-text-help-struct \, bang, f 21;
#X obj 46 238 append text-help-struct x y;
#X msg 46 173 20 20;
#X obj 13 56 struct text-help-struct float x float y text z;
#X obj 13 83 filledpolygon 0 0 0 0 0 0 10 10 10 10 0 0 0;
#X obj 14 115 drawtext z 16 -3 0;
#X connect 1 0 3 2;
#X connect 2 0 1 0;
#X connect 4 0 3 0;
#X restore 205 116 pd text-help-struct;
#X obj 80 215 t f b;
#X text 73 32 a simple example showing how to access text in data structures
via pointers., f 38;
#N canvas 851 144 430 177 text-help-data 0;
#X scalar text-help-struct 20 20 \; 1 2 3 \\\; a b c d \\\; \;;
#X text 13 86 We have one datum (above) whose "z" field is text.;
#X restore 206 88 pd text-help-data;
#X msg 202 255 traverse pd-text-help-data \, next, f 18;
#X text 103 463 bug - saving multi-line texts inside structures;
#X obj 524 325 pointer;
#X msg 524 268 traverse pd-text-help-data \, next, f 18;
#X obj 401 351 text set -s text-help-struct z, f 18;
#X floatatom 442 323 5 0 0 0 - - -;
#X msg 408 293 0;
#X msg 477 293 2;
#X msg 442 293 1;
#X msg 401 164 1 2 3;
#X msg 410 200 list a b c d;
#X obj 401 242 trigger list bang;
#X connect 0 0 9 0;
#X connect 1 0 0 0;
#X connect 2 0 0 0;
#X connect 3 0 0 0;
#X connect 6 0 7 3;
#X connect 7 0 4 0;
#X connect 7 1 5 0;
#X connect 9 0 7 0;
#X connect 9 1 12 0;
#X connect 12 0 6 0;
#X connect 14 0 16 3;
#X connect 15 0 14 0;
#X connect 17 0 16 1;
#X connect 18 0 17 0;
#X connect 19 0 17 0;
#X connect 20 0 17 0;
#X connect 21 0 23 0;
#X connect 22 0 23 0;
#X connect 23 0 16 0;
#X connect 23 1 15 0;
#X restore 273 480 pd text-and-data-structures;
#X text 100 458 here's how to access texts inside data structures:
, f 27;
#X text 113 12 - manage a list of messages;
#X obj 211 531 scalar;
#X obj 279 318 text size;
#N canvas 847 155 566 324 size 0;
#X obj 74 68 bng 17 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 71 266 text define -k text-help-size;
#A set;
#X obj 74 188 text size text-help-size;
#X floatatom 74 213 5 0 0 0 - - -;
#X floatatom 98 101 5 0 2 0 - - -;
#X text 50 16 "text size" reports the number of lines in the text or
the length of a specified line.;
#X text 100 67 bang for number of lines;
#X text 140 95 float for length of nth line (-1 if line number out
of range), f 35;
#X text 402 137 find another text by name or pointer, f 18;
#X msg 239 143 symbol text-help-size;
#X text 266 183 arguments: name of the text object or "-s struct-name"
, f 30;
#X connect 0 0 2 0;
#X connect 2 0 3 0;
#X connect 4 0 2 0;
#X connect 9 0 2 1;
#X restore 392 318 pd size;
#X obj 280 243 text set;
#N canvas 710 310 688 563 set 0;
#X floatatom 127 206 5 0 0 0 - - -;
#X msg 95 172 0;
#X msg 160 172 2;
#X msg 127 172 1;
#X msg 59 110 list x y z w;
#X msg 77 136 1 2 3;
#X msg 40 83 12 23 34 45 56 56;
#X obj 127 516 text define -k text-help-3;
#A set x y z w \; x y z w \; 1 2 3 \; 12 23 34 45 56 56 \; 12 23 34
45 56 56 \; 12 23 34 45 56 56 \; 12 23 34 45 56 56 \;;
#X obj 77 302 text set text-help-3, f 22;
#X floatatom 177 235 5 0 0 0 - - -;
#X text 174 84 list to write into the text;
#X text 170 206 line number - use a large number to append a line;
#X text 253 304 arguments: name of the text object or "-s struct-name"
;
#X text 253 325 next optional arg to set inlet 1 (line number);
#X msg 228 272 symbol text-help-get;
#X text 382 272 find another text by name or pointer;
#X text 224 229 field number - if 0 or positive \, replace text starting
at this field \, or if negative (or not supplied) \, replace whole
line., f 62;
#X text 79 14 "text set" replaces the nth line with the incoming list.
If the number n is greater than the number of lines in the text the
new line is added.;
#X text 252 346 next optional arg to set inlet 2 (field number \, defaults
to whole line), f 47;
#X msg 193 172 1e+15;
#X text 101 395 If inlet 2 is unset or set to a negative number \,
the entire line is replaced \, but if it is set to 0 or more to specify
a starting field \, the line is not resized - instead \, as many items
are replaced as were already in the list. In this case \, an out-of-range
line number will not cause a new line to be added - instead \, the
last existing line is modified.;
#X text 328 517 <= click here to see text;
#X connect 0 0 8 1;
#X connect 1 0 0 0;
#X connect 2 0 0 0;
#X connect 3 0 0 0;
#X connect 4 0 8 0;
#X connect 5 0 8 0;
#X connect 6 0 8 0;
#X connect 9 0 8 2;
#X connect 14 0 8 3;
#X connect 19 0 0 0;
#X restore 392 243 pd set;
#X text 391 155 (click for details), f 11;
#X text 76 195 create \, store \, and/or edit;
#X text 104 218 read and output a line;
#X text 110 242 replace or add a line;
#X text 124 317 get number of lines;
#X text 63 50 In Pd a "text" refers to a list of atoms that can include
commas \, semicolons \, and dollar-sign constructs - anything that
can go in a message box or a patch (as a saved file). You can use them
to store a semicolon-separated list of lists \, or as messages to "execute"
as in a sequencer or message box., f 62;
#X text 152 341 convert to list;
#X obj 279 342 text tolist;
#N canvas 842 231 575 410 tolist 0;
#X obj 76 103 bng 17 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X text 48 13 "text tolist" outputs the entire contents as a list.
Semicolons \, commas \, and dollar signs are output as symbols (and
so \, if symbols like " \, " are encountered \, they're escaped with
backslashes).;
#X text 103 101 bang to output list;
#X obj 76 184 text tolist text-help-1;
#X obj 163 222 list prepend set;
#X obj 163 245 list trim;
#X msg 163 295 this is a message \\\; this is another 1 ... \\\;;
#X msg 177 269 set;
#X obj 76 232 print;
#X text 78 336 N.B.: text-help-1 is defined in 'pd define' subwindow.
;
#X text 328 133 find another text by name or pointer, f 18;
#X msg 234 135 symbol text-help-1, f 11;
#X text 270 176 arguments: name of the text object or "-s struct-name"
, f 30;
#X connect 0 0 3 0;
#X connect 3 0 4 0;
#X connect 3 0 8 0;
#X connect 4 0 5 0;
#X connect 5 0 6 0;
#X connect 7 0 6 0;
#X connect 11 0 3 1;
#X restore 392 342 pd tolist;
#X obj 279 366 text fromlist;
#N canvas 836 231 604 318 fromlist 0;
#X obj 81 202 text fromlist text-help-fromlist;
#X obj 114 263 text define text-help-fromlist;
#X text 46 21 "text fromlist" converts a list such as "text tolist"
would output and fills the text with it. Whatever the text had previously
contained is discarded.;
#X msg 81 115 list this is a message \\\; this is another 1 ... \\\;
;
#X text 135 241 click here to see contents;
#X msg 92 145 list 1 2 3;
#X text 405 157 find another text by name or pointer, f 18;
#X msg 302 159 symbol text-help-1, f 11;
#X text 121 92 set contents of text;
#X connect 3 0 0 0;
#X connect 5 0 0 0;
#X connect 7 0 0 1;
#X restore 392 366 pd fromlist;
#X text 138 365 convert from list;
#X text 215 388 search;
#X obj 279 389 text search;
#N canvas 419 23 944 793 search 0;
#X floatatom 63 315 5 0 0 0 - - -;
#X text 350 239 find another text by name or pointer, f 18;
#X text 189 275 arguments: name of the text object or "-s struct-name"
, f 30;
#X text 49 14 "text search" outputs the line number of the line that
best matches a search key. By default it seeks a line whose leading
fields match the incoming list.;
#X obj 261 710 text define -k text-help-search;
#A set 1 2 3 dog \; 7 8 9 cat \; 4 5 3 dog \; 7 8 9 alligator \; random
line that won't match numbers \;;
#X obj 63 272 text search text-help-search, f 16;
#X msg 172 246 symbol text-help-search;
#X msg 39 80 1;
#X msg 50 104 2;
#X msg 63 128 4;
#X msg 81 192 4 5;
#X msg 91 218 4 13;
#X msg 71 157 7;
#X text 70 79 matches first line (number 0);
#X text 78 103 doesn't match first field of any line so -1;
#X text 125 217 fails on second field so no match;
#X text 158 311 ... then optional search fields. Each is a field number
(starting from 0) optionally preceded by ">". ">=" \, "<" \, "<=" \,
or "near"., f 44;
#X text 101 151 if two lines match only the first is output (but see
below for finding best matches).;
#X msg 50 360 7 cat;
#X msg 64 386 7 alligator;
#X floatatom 64 494 5 0 0 0 - - -;
#X msg 73 411 7 dog;
#X obj 64 438 text search text-help-search 0 3, f 16;
#X floatatom 636 358 5 0 0 0 - - -;
#X obj 636 299 text search text-help-search 1, f 16;
#X msg 636 236 8 9;
#X msg 674 239 8 9 alligator;
#X msg 597 237 8;
#X msg 688 268 symbol line;
#X text 193 436 in this example we ask to match both field 0 and field
3 exactly. In field 3 we're testing symbols for equality., f 39;
#X text 553 80 If the search pattern (the incoming list) has more fields
than we have specified search fields \, extra search patterns match
succeeding fields starting from the last one give as an argument. So
for example if there are no arguments we look for matches to any number
of fields starting from the beginning of the line in the text., f
42;
#X floatatom 102 746 5 0 0 0 - - -;
#X obj 102 690 text search text-help-search > 0, f 16;
#X text 164 509 Match a line for which the search key is greater than
field zero of that line. The line getting closest to the key wins.
, f 41;
#X msg 82 584 2;
#X msg 102 625 4;
#X text 119 577 lines 1 \, 2 \, and 3 match \, but 2 wins because its
first field (4) is closest to the search key 2, f 48;
#X text 141 615 this matches lines 1 and 3 \, and each is equally good
\, so line 1 wins., f 43;
#X text 155 656 nobody's first field is greater than 10;
#X msg 118 657 10;
#X obj 546 621 text search text-help-search 2 near 0, f 18;
#X floatatom 546 678 5 0 0 0 - - -;
#X msg 546 485 3 3;
#X msg 563 525 3 2.5 1;
#X msg 574 574 3 3 1;
#X text 586 484 field 2 is 3 and field 0 nearest 3;
#X text 622 514 here lines 0 and 2 tie over 2.4 (1 and 4 are equally
far from it) so line 0 whose second field is closer to 1 wins., f
40;
#X text 625 564 Here line 2 wins because its field 0 is nearer to 3
\, notwithstanding that its field 1 is farther from 1, f 34;
#X text 91 129 matches line number 2 (third line);
#X text 115 191 matches two fields of line number 2;
#X text 593 423 Here we ask for field 2 to equal 3 and fields starting
at 0 to be 'near' the following arguments., f 33;
#X connect 5 0 0 0;
#X connect 6 0 5 1;
#X connect 7 0 5 0;
#X connect 8 0 5 0;
#X connect 9 0 5 0;
#X connect 10 0 5 0;
#X connect 11 0 5 0;
#X connect 12 0 5 0;
#X connect 18 0 22 0;
#X connect 19 0 22 0;
#X connect 21 0 22 0;
#X connect 22 0 20 0;
#X connect 24 0 23 0;
#X connect 25 0 24 0;
#X connect 26 0 24 0;
#X connect 27 0 24 0;
#X connect 28 0 24 0;
#X connect 32 0 31 0;
#X connect 34 0 32 0;
#X connect 35 0 32 0;
#X connect 39 0 32 0;
#X connect 40 0 41 0;
#X connect 42 0 40 0;
#X connect 43 0 40 0;
#X connect 44 0 40 0;
#X restore 392 389 pd search;
#X text 89 412 sequencer/message-sender;
#X obj 279 413 text sequence;
#N canvas 256 43 1139 770 sequence 0;
#X msg 198 408 symbol text-help-search;
#X text 371 400 specify another text by name or pointer, f 20;
#X msg 92 203 bang;
#X obj 110 624 print out1;
#X obj 198 624 print out2;
#X msg 157 370 args 1 2 fuzz;
#X msg 46 144 line 0;
#X obj 678 224 text sequence text-help-seq2 -g, f 17;
#X obj 912 235 text define -k text-help-seq2;
#A set test1 1 2 3 \; 1000 test2 6 7 8 \; test1 9 10 \, 21 22 23 \,
walk the dog \; 500 1500 test1 \; test2 13 14 \;;
#X msg 638 189 bang;
#X msg 539 189 line 0;
#X obj 361 677 print test1;
#X obj 361 650 r test1;
#X obj 458 650 r test2;
#X obj 458 677 print test2;
#X obj 794 271 print done;
#X obj 157 346 loadbang;
#X text 274 369 set values for \$1 \, \$2 \, etc;
#X msg 72 175 step;
#X text 116 175 output next line;
#X text 106 137 set current line number (counting from 0), f 23;
#X msg 678 189 auto;
#X msg 726 189 stop;
#X msg 110 241 auto;
#X text 132 197 output all lines starting from current one to next
waiting point, f 34;
#X text 116 649 lists;
#X text 193 649 bang if done;
#X text 237 476 -g to specify global mode (each line begins with a
symbolic destination), f 43;
#X text 237 508 -w <symbol> specifies that lines beginning with the
symbol are waiting points, f 43;
#X text 237 541 -w <number> specifies that every line's leading n atoms
are used as a waiting point, f 43;
#X obj 110 444 text sequence text-help-seq, f 13;
#X text 226 436 creation arguments:;
#X text 239 457 name of the text object or "-s struct-name";
#X obj 131 695 text define -k text-help-seq;
#A set 1 2 3 \; 4 5 symbol 7 \; 8 \$1 \$2 \; 9 \$3 \$1-\$2-\$3 \;;
#X obj 678 270 print wait;
#X msg 127 281 stop;
#X text 174 282 stop the sequence;
#X text 35 13 "text sequence" outputs lines from a text buffer \, either
to an outlet \, or as messages to named destinations. The text is interpreted
as a sequence of lists \, and possibly some interspersed waiting instructions
(called "waits" here). You can ask for one line at a time ("step" message")
\, or to proceed without delay to the next wait ("bang") \, or to automatically
sequence through a series of waits (with each wait specifying a delay
in milliseconds), f 70;
#X text 151 227 automatically sequence \, interpreting waits as delay
times (but note there aren't any waits in this example - see at right)
, f 42;
#X text 537 169 rewind;
#X text 910 212 click to see the sequence:;
#X msg 597 189 step;
#X msg 670 396 bang;
#X msg 575 396 line 0;
#X obj 823 477 print done;
#X msg 712 396 auto;
#X msg 755 396 stop;
#X obj 726 477 print wait;
#X msg 630 396 step;
#X obj 879 421 text define -k text-help-seq3;
#A set 1 2 3 \; fred 1000 \; 4 5 6 \; blanch 7 8 \; fred 500 \; 9 10
\;;
#X obj 630 430 text sequence text-help-seq3 -w fred, f 28;
#X obj 630 477 print out1;
#X text 619 313 Alternatively \, with the "-w" flag (with or without
"-g" but most usefully without) \, you can specify a symbol that tags
an entire line as a wait. Here the three outlets are for lists (regular
lines) \, waits \, and a bang at end of sequence:;
#X msg 710 641 bang;
#X msg 614 641 line 0;
#X msg 755 641 auto;
#X msg 798 642 stop;
#X msg 669 641 step;
#X text 879 400 sequence:;
#X text 908 636 sequence:;
#X obj 895 660 text define -k text-help-seq4;
#A set 0 1 2 3 \; 1000 4 5 6 \; 500 7 8 9 \; 500 10 11 12 \;;
#X obj 669 675 text sequence text-help-seq4 -w 1, f 28;
#X obj 862 717 print done;
#X obj 765 717 print wait;
#X obj 669 717 print out1;
#X msg 146 315 tempo 1 msec;
#X obj 466 315 delay;
#X text 250 304 set tempo in msec \, sec \, min \, samples \, permin
\, etc. -- see 'delay' help for details...., f 28;
#X text 237 575 -t <tempo> <units> initializes tempo as with the "tempo"
message above., f 43;
#X msg 773 189 tempo 2 permsec;
#X text 793 168 set 2x tempo;
#X text 581 22 The -g flag (which must be given after specifying the
text with a name or a "-s" argument) specifies that the text contains
messages to send to global symbols. Lines beginning with symbols are
sent to the corresponding receive (or other named object). Leading
numbers are then interpreted as waits. If you use "bang" to sequence
the text the waits will be output as lists for you to interpret as
you wish. If you send an "auto" message \, waits that consist of a
single number are interpreted as delay times in milliseconds (but waits
with 2 or more arguments are treated as in "bang"). Here the two waits
are "1000" and "500 1500"., f 76;
#X text 617 515 If you want to use leading numbers in lists as waits
without having to specify "-g" \, specify "-w 3" for example and up
to 3 leading numbers (fewer if there's a symbol among the first 3 items)
will be taken as a wait. Waits specified this way can only have numeric
elements (while waits specified with a symbol tag as above could have
symbols too if desired.) Here we use "-w 1" so the "auto" feature can
simply sequence a list of numbers:, f 71;
#X connect 0 0 30 1;
#X connect 2 0 30 0;
#X connect 5 0 30 0;
#X connect 6 0 30 0;
#X connect 7 0 34 0;
#X connect 7 1 15 0;
#X connect 9 0 7 0;
#X connect 10 0 7 0;
#X connect 12 0 11 0;
#X connect 13 0 14 0;
#X connect 16 0 5 0;
#X connect 18 0 30 0;
#X connect 21 0 7 0;
#X connect 22 0 7 0;
#X connect 23 0 30 0;
#X connect 30 0 3 0;
#X connect 30 1 4 0;
#X connect 35 0 30 0;
#X connect 41 0 7 0;
#X connect 42 0 50 0;
#X connect 43 0 50 0;
#X connect 45 0 50 0;
#X connect 46 0 50 0;
#X connect 48 0 50 0;
#X connect 50 0 51 0;
#X connect 50 1 47 0;
#X connect 50 2 44 0;
#X connect 53 0 61 0;
#X connect 54 0 61 0;
#X connect 55 0 61 0;
#X connect 56 0 61 0;
#X connect 57 0 61 0;
#X connect 61 0 64 0;
#X connect 61 1 63 0;
#X connect 61 2 62 0;
#X connect 65 0 30 0;
#X connect 69 0 7 0;
#X restore 392 413 pd sequence;
#X text 103 291 delete a line or clear;
#X obj 279 292 text delete;
#N canvas 692 191 748 405 delete 0;
#X text 415 117 find another text by name or pointer;
#X obj 49 150 text delete text-help-delete;
#X text 264 151 argument: name of the text object or "-s struct-name"
;
#X msg 242 117 symbol text-help-delete;
#X obj 70 212 text define -k text-help-delete;
#A set line 0 \; line 1 \; line 2 \; line 3 \; line 4 \;;
#X msg 49 63 2;
#X msg 64 93 -1;
#X text 97 93 clear whole text;
#X obj 141 322 text fromlist text-help-delete;
#X msg 141 297 list line 0 \\\; line 1 \\\; line 2 \\\; line 3 \\\;
line 4 \\\;;
#X text 162 274 click below to get original text back:;
#X text 47 12 "text delete" deletes the nth line.;
#X text 84 63 delete line number 2 (counting from 0);
#X text 304 212 <= click here to see text;
#X connect 3 0 1 1;
#X connect 5 0 1 0;
#X connect 6 0 1 0;
#X connect 9 0 8 0;
#X restore 392 292 pd delete;
#X text 166 266 insert a line;
#X obj 280 267 text insert;
#N canvas 338 254 744 450 insert 0;
#X text 448 177 find another text by name or pointer;
#X msg 275 177 symbol text-help-delete;
#X msg 171 109 2;
#X msg 163 353 list line 0 \\\; line 1 \\\; line 2 \\\; line 3 \\\;
line 4 \\\;;
#X text 184 330 click below to get original text back:;
#X obj 163 378 text fromlist text-help-insert;
#X obj 98 283 text define -k text-help-insert;
#A set line 0 \; line 1 \; line 2 \; line 3 \; line 4 \;;
#X msg 183 137 1e+09;
#X text 232 139 insert after end;
#X msg 69 84 list x y z w;
#X msg 85 111 1 2 3;
#X msg 50 57 12 23 34 45 56 56;
#X text 183 57 list to insert into the text;
#X text 292 210 arguments: name of the text object or "-s struct-name"
;
#X text 293 231 one optional arg to set inlet 1 (line number);
#X obj 68 210 text insert text-help-insert 3;
#X text 71 14 "text insert" inserts a line.;
#X text 210 109 insert before line number 2 (counting from 0);
#X text 333 285 <= click here to see text;
#X connect 1 0 15 2;
#X connect 2 0 15 1;
#X connect 3 0 5 0;
#X connect 7 0 15 1;
#X connect 9 0 15 0;
#X connect 10 0 15 0;
#X connect 11 0 15 0;
#X restore 392 267 pd insert;
#X text 323 527 updated for Pd version 0.49;