From 924acb222e574ed0ed141e13ffbeb3f115fad001 Mon Sep 17 00:00:00 2001 From: Georg Holzmann Date: Fri, 5 Jan 2007 16:56:29 +0000 Subject: new helpfile standard svn path=/trunk/externals/grh/; revision=7218 --- PDContainer/help/h_list-help.pd | 526 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 526 insertions(+) create mode 100755 PDContainer/help/h_list-help.pd (limited to 'PDContainer/help/h_list-help.pd') diff --git a/PDContainer/help/h_list-help.pd b/PDContainer/help/h_list-help.pd new file mode 100755 index 0000000..9e0f6ab --- /dev/null +++ b/PDContainer/help/h_list-help.pd @@ -0,0 +1,526 @@ +#N canvas 535 40 834 856 10; +#X obj 36 29 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 +; +#X obj 38 31 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 +-66577 0; +#X text 298 41 help file of; +#X text 39 103 init arg: namespace; +#X msg 483 298 print; +#X msg 483 372 clear; +#X msg 483 643 help; +#X obj 604 702 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 483 239 getnamespace; +#X msg 483 410 clearall; +#X obj 483 759 print BBB; +#X text 594 264 <- change namespace; +#X msg 483 263 namespace grix; +#X text 530 299 <- print all the data of the; +#X text 549 314 current namespace; +#X text 531 372 <- clear all the data of the; +#X text 552 387 current namespace; +#X text 551 412 <- clear all the data in all; +#X text 572 427 same containers (maybe; +#X text 574 442 you shouldn't use this); +#X text 583 241 <- get current namespace; +#X text 514 198 general operations:; +#X msg 483 568 getsize; +#X floatatom 523 739 5 0 0 0 - - -; +#X text 570 581 outlet); +#X text 290 58 ::: h_list :::; +#X text 40 133 Fast insertion and removal anywhere \, all the other +elements move up. But a list provides only sequential access (not via +index !). A list is a doubly linked list.; +#X obj 483 681 h_list simonatbase; +#X text 604 720 <- size of the list; +#X obj 192 721 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 71 700 h_list simonatbase; +#X obj 71 674 r \$0-list; +#X obj 71 739 print AAA; +#N canvas 523 246 495 416 pusch_pop_back_front 0; +#X msg 66 229 popback; +#X floatatom 76 120 5 0 0 0 - - -; +#X msg 66 140 pushback \$1; +#X text 180 140 <- inserts the data at the; +#X symbolatom 121 120 10 0 0 0 - - -; +#X msg 66 180 pushfront \$1; +#X floatatom 76 161 5 0 0 0 - - -; +#X symbolatom 119 161 10 0 0 0 - - -; +#X msg 66 252 popfront; +#X msg 66 302 back; +#X msg 66 324 front; +#X obj 66 367 s \$0-list; +#X text 200 155 front/back of the list; +#X text 152 244 the back/front; +#X text 130 231 <- removes the element from; +#X text 143 316 the back/front; +#X text 121 301 <- gives out the element from; +#X text 27 28 insert/remove/get data at the back/front of the list. +; +#X text 27 44 These methods won't change the current iterator position +!!!; +#X connect 0 0 11 0; +#X connect 1 0 2 0; +#X connect 2 0 11 0; +#X connect 4 0 2 0; +#X connect 5 0 11 0; +#X connect 6 0 5 0; +#X connect 7 0 5 0; +#X connect 8 0 11 0; +#X connect 9 0 11 0; +#X connect 10 0 11 0; +#X restore 136 494 pd pusch_pop_back_front; +#X text 40 452 insert/remove/get data at the back/front of the list +\,; +#X text 43 247 You can use so called "iterators" to navigate through +; +#X text 40 468 _without_ changing the current iterator position:; +#N canvas 843 44 493 562 iterator_navigation 0; +#X text 39 73 Iterators are a generalization of pointers: they are +objects that point to other objects. Via an iterator you can navigate +through the container. You can ask a list for an iterator that points +to the first element with the message begin. You can get a past-the-end +iterator with the message end.; +#X text 182 35 ::: ITERATORS :::; +#X msg 43 216 begin; +#X msg 43 321 next; +#X text 40 179 iterator navigation:; +#X obj 43 505 s \$0-list; +#X text 91 217 <- points to the first element fo the h_list; +#X text 87 244 <- points _after_ the last element of the h_list; +#X text 94 259 (so that you can insert data there for example \,; +#X text 99 274 but attention: you can't remove an element at; +#X text 98 289 that position !!!); +#X text 85 321 <- increment the iterator - so it will point to; +#X text 107 335 the next element of h_list; +#X msg 43 244 end; +#X msg 43 357 last; +#X text 84 358 <- decrement the iterator - so it will point to; +#X text 106 372 the previous element of h_list; +#X msg 43 400 getiter; +#X text 113 401 <- puts out the current iterator position; +#X text 134 416 at second outlet; +#X msg 57 467 setiter \$1; +#X floatatom 57 448 5 0 0 0 - - -; +#X text 147 467 <- set specific iterator position; +#X connect 2 0 5 0; +#X connect 3 0 5 0; +#X connect 13 0 5 0; +#X connect 14 0 5 0; +#X connect 17 0 5 0; +#X connect 20 0 5 0; +#X connect 21 0 20 0; +#X restore 137 303 pd iterator_navigation; +#X text 43 261 the h_list. Here is a short explanation of iterators +; +#X text 43 275 and how you can use it in with h_list:; +#X text 45 364 operations at a specific iterator position:; +#N canvas 0 469 468 430 iterator_operations 0; +#X obj 54 389 s \$0-list; +#X msg 54 283 delete; +#X msg 54 113 insert \$1; +#X floatatom 54 92 5 0 0 0 - - -; +#X msg 54 338 get; +#X symbolatom 100 92 10 0 0 0 - - -; +#X text 48 33 Operations at a specific iterator position :; +#X msg 54 137 insert bla sdflj 34 fd; +#X text 235 126 current iterator position; +#X text 212 111 <- inserts the data at the; +#X text 139 299 current iterator position; +#X text 116 284 <- deletes the data at the; +#X text 138 355 current iterator position; +#X text 115 340 <- get the data at the; +#X msg 54 230 modify hallo da du; +#X floatatom 68 171 5 0 0 0 - - -; +#X symbolatom 68 189 10 0 0 0 - - -; +#X msg 54 208 modify \$1; +#X text 211 188 <- modifies the data at the; +#X text 232 203 current iterator position; +#X text 231 219 (it overrides the data); +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X connect 3 0 2 0; +#X connect 4 0 0 0; +#X connect 5 0 2 0; +#X connect 7 0 0 0; +#X connect 14 0 0 0; +#X connect 15 0 17 0; +#X connect 16 0 17 0; +#X connect 17 0 0 0; +#X restore 138 388 pd iterator_operations; +#X text 39 550 special operations with h_list:; +#N canvas 705 269 550 449 special_operations 0; +#X msg 54 289 unique; +#X msg 54 237 reverse; +#X msg 54 189 sort; +#X obj 54 369 s \$0-list; +#X text 30 28 special operations with h_list:; +#X floatatom 54 92 5 0 0 0 - - -; +#X symbolatom 100 92 10 0 0 0 - - -; +#X msg 54 113 remove \$1; +#X msg 54 137 remove bla sdflj 34 fd; +#X text 212 111 <- removes the element with; +#X text 235 126 the given data; +#X text 124 237 <- reverses the h_list; +#X text 102 190 <- sorts the h_list; +#X text 113 289 <- Removes all but the first element in every consecutive +group of equal elements. The relative order of elements that are not +removed is unchanged.; +#X connect 0 0 3 0; +#X connect 1 0 3 0; +#X connect 2 0 3 0; +#X connect 5 0 7 0; +#X connect 6 0 7 0; +#X connect 7 0 3 0; +#X connect 8 0 3 0; +#X restore 134 578 pd special_operations; +#X text 217 720 <- bang if not found; +#X floatatom 563 720 5 0 0 0 - - -; +#X text 565 740 <- current iterator position; +#X floatatom 151 721 5 0 0 0 - - -; +#X floatatom 111 721 5 0 0 0 - - -; +#X msg 483 600 getiter; +#X text 548 567 <- get the size (at 3nd; +#X text 574 616 (2nd outlet); +#X text 553 601 <- get current iterator pos; +#X obj 500 28 cnv 15 204 120 empty empty empty 20 12 0 14 -66577 -66577 +0; +#X obj 502 30 cnv 15 200 116 empty empty ReadMe: 65 15 0 14 -262131 +-143491 0; +#N canvas 674 0 511 843 General_Concept 0; +#X text 37 165 This library was made for algorithmic composition and +of course for all other algorithms. I came into troubles with making +bigger musical structures in PD with send-receive pairs \, arrays \, +etc. So I tried to make it possible \, to have access to some storage +in a whole patch.; +#X text 131 131 ::: GOAL OF THE LIBRARY :::; +#X text 39 428 For communication I use namespaces. Every Container +with the same namespace (and the same container type) has access to +the same data. So you can modify and get this data everywhere in the +patch. For local namespaces use names with \$0.; +#X text 140 266 ::: DATASTRUCTURES :::; +#X text 156 397 ::: NAMESPACES :::; +#X obj 33 24 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 +; +#X obj 35 26 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 +-66577 0; +#N canvas 434 247 671 362 namespace_example 0; +#X obj 43 176 h_stack hallawum; +#X msg 43 151 push some data; +#X text 34 25 ::: NAMESPACE EXAMPLE :::; +#X text 166 150 <- add the list "some data" to the stack; +#X text 187 167 (namespace "hallawum"); +#X obj 41 254 h_stack hallawum; +#X msg 41 231 top; +#X text 76 231 <- get the data (same namespace); +#X msg 341 235 top; +#X obj 341 258 h_stack kaletom; +#X obj 341 281 print BBB; +#X obj 41 277 print AAA; +#X text 376 235 <- get the data (different namespace); +#X text 475 271 not possible !!!; +#X text 35 65 In different namespaces you have access to different +data. Here with the datastructure "stack". The two objects with the +same namespace (here "hallawum") are sharing their data!; +#X connect 1 0 0 0; +#X connect 5 0 11 0; +#X connect 6 0 5 0; +#X connect 8 0 9 0; +#X connect 9 0 10 0; +#X restore 39 503 pd namespace_example; +#X text 161 554 ::: DATATYPES :::; +#X text 38 296 As storage datastructures I implemented the C++ STL +(Standard Template Library) Containers in PD. Currently following datastructures +are available (prefixed with h_): h_map \, h_multimap \, h_set \, h_multiset +\, h_vector \, h_list \, h_deque \, h_queue \, h_priority_queue and +h_stack.; +#N canvas 438 21 583 739 map_example 0; +#X obj 45 297 h_map \$0-data; +#X msg 45 256 add data1; +#X msg 131 273 1 4 3 5 6; +#X obj 45 220 t b b; +#X obj 45 194 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 321 303 h_map \$0-data; +#X obj 321 226 t b b; +#X obj 321 200 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 321 262 add data2; +#X msg 407 279 6 4 5 1 2; +#X obj 118 402 h_map \$0-data; +#X msg 118 376 print; +#X text 170 375 <- see whats in the container; +#X obj 118 556 h_map \$0-data; +#X msg 118 485 get data1; +#X msg 142 519 get data2; +#X obj 118 578 print AAA; +#X text 202 485 <- get data1; +#X text 229 520 <- get data2; +#X text 345 199 <- add to key data2 a list; +#X text 69 193 <- add to key data1 a list; +#X text 32 32 ::: MAP_EXAMPLE :::; +#X text 34 72 With the datastructure "map" it's for example possible +to make send-receive pairs \, you don't have to update the send-receive +pairs all the time (like [value]) \, you can use send-receive "namespaces" +\, ...; +#X text 111 659 ( If you use lists as key you can also make a multidimensional +matrix ... ); +#X connect 1 0 0 0; +#X connect 2 0 0 1; +#X connect 3 0 1 0; +#X connect 3 1 2 0; +#X connect 4 0 3 0; +#X connect 6 0 8 0; +#X connect 6 1 9 0; +#X connect 7 0 6 0; +#X connect 8 0 5 0; +#X connect 9 0 5 1; +#X connect 11 0 10 0; +#X connect 13 0 16 0; +#X connect 14 0 13 0; +#X connect 15 0 13 0; +#X restore 41 615 pd map_example; +#X text 273 34 general concept of; +#X text 274 52 PDContainer; +#X text 41 579 In the containers you can save all of the PD build-in +datatypes: lists \, floats \, and symbol.; +#N canvas 215 140 716 600 save_load_example 0; +#X text 27 23 ::: SAVE/LOAD EXAMPLE :::; +#X msg 68 229 pushback one word; +#X msg 90 260 pushback an other word; +#X msg 114 290 pushback something else; +#X obj 68 198 t b b b; +#X obj 68 168 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 68 324 h_list \$0-local; +#X text 93 168 <- add these three lists to h_list; +#X obj 333 321 h_list \$0-local; +#X msg 358 285 print; +#X obj 140 477 h_set blablu; +#X msg 140 413 read example.dat; +#X text 274 413 <- read the same data now into a h_set; +#X text 26 67 You can save and load data from and to disk. So you can +also exchange data through different datastructures with the same data-format +(here from a h_list to a h_set).; +#X msg 178 441 print; +#X msg 333 207 saveXML example.xml; +#X text 457 238 <- save data as file; +#X msg 333 238 save example.dat; +#X text 477 208 <- save data as XML file; +#X msg 140 378 readXML example.xml; +#X text 283 379 <- read the same XML data now into a h_set; +#X text 22 529 Please use the XML fileformat if possible \, because +it's easier to edit in an external editor and the XML parser is much +more stable !; +#X connect 1 0 6 0; +#X connect 2 0 6 0; +#X connect 3 0 6 0; +#X connect 4 0 1 0; +#X connect 4 1 2 0; +#X connect 4 2 3 0; +#X connect 5 0 4 0; +#X connect 9 0 8 0; +#X connect 11 0 10 0; +#X connect 14 0 10 0; +#X connect 15 0 8 0; +#X connect 17 0 8 0; +#X connect 19 0 10 0; +#X restore 40 797 pd save_load_example; +#X text 41 696 All the data of all containers can be saved to disk. +So you can also manually edit the file with an editor (which is sometimes +much faster) and then load it in PD into a container. You can also +load data from other containers. Please use the XML fileformat if possible +\, because it's easier to edit in an external editor and the XML parser +is much more stable.; +#X text 164 671 ::: SAVE/LOAD :::; +#X restore 536 66 pd General_Concept; +#N canvas 205 0 993 742 Container_Explanation 0; +#X obj 14 13 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 +; +#X obj 16 15 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 +-66577 0; +#X text 254 23 general explation of; +#X text 254 40 the datastructures; +#X text 23 655 A vector is a sequence that supports access to all elements +via index (like an array) and fast insertion and removal of elements +at the end. The number of elements in a vector may vary dynamically. +; +#X obj 189 627 h_vector; +#X text 500 654 Fast insertion and removal anywhere \, all the other +elements move up. But a list provides only sequential access (not via +index !). A list is a doubly linked list.; +#X obj 680 628 h_list; +#X obj 189 773 h_deque; +#X text 498 801 A queue is a "first in first out" (FIFO) data structure. +That is \, elements are added to the back of the queue (push) and may +be removed from the front (pop).; +#X obj 679 774 h_queue; +#X text 22 951 A priority queue is also a "first in first out" (FIFO) +data structure \, but you can give the elements a priority. So the +elements with a higher priority are automatically inserted before all +other elements with a lower priority.; +#X obj 154 924 h_priority_queue; +#X text 20 800 A deque (double ended queue \, pronounced "deck") is +very much like a vector: like vector \, it is a sequence that supports +access to all elements via index. The main way in which deque differs +from vector is that fast insertion and removal of elements is possible +at the beginning _and_ the end.; +#X text 22 232 Maps represent a mapping from one type (the key type) +to another type (the value type). You can associate a value with a +key \, or find the value associated with a key \, very efficiently. +Map is a Sorted Associative Container and it is also a Unique Associative +Container \, meaning that no two elements have the same key. (see Multimap +for more elements with the same key); +#X obj 188 203 h_map; +#X text 492 231 Multimaps are just like maps except that a key can +be associated with several values. Multimap is a Sorted Associative +Container and also a Multiple Associative Container \, meaning that +there is no limit on the number of elements with the same key. (see +also Map); +#X obj 643 201 h_multimap; +#X text 24 419 Sets allow you to add and delete elements. Afterwards +you can look if an element is set. Set is a Sorted Associative Container +and a Unique Associative Container \, meaning that no two elements +are the same. (see Multiset to have several copies of the same element) +; +#X obj 187 392 h_set; +#X text 493 419 Multisets are just like sets \, except that you can +have several copies of the same element. Multiset is a Sorted Associative +Container and a Multiple Associative Container \, meaning that two +or more elements may be identical. (see also Set); +#X obj 642 391 h_multiset; +#X text 339 167 :::: ASSOCIATIVE CONTAINERS ::::; +#X text 393 592 :::: SEQUENCES ::::; +#X text 289 1099 (look for help at all the objects for more information) +; +#X text 35 87 PDContainer contains the following datastructures:; +#X text 399 86 map \, nultimap \, set \, multiset \, vector \, list +\, deque \, queue \, stack \, priority queue; +#X obj 679 916 h_stack; +#X text 495 950 Stack is a "last in first out" (LIFO) data structure: +the element at the top of a stack is the one that was most recently +added (push). Top outputs the elements from the top without removing +it \, pop outputs and removes it.; +#X restore 518 94 pd Container_Explanation; +#N canvas 254 0 927 786 Fileformats 0; +#X obj 38 27 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 +; +#X obj 40 29 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 +-66577 0; +#X text 259 56 PDContainer; +#X text 257 38 different fileformats of; +#X text 472 116 Please use the XML fileformat if possible \, because +it's easier to edit in an external editor and the XML parser is much +more stable!; +#X text 40 582 s go; +#X text 40 569 f 2 s wow f 2; +#X text 40 599 f 23; +#X text 38 634 (f=float \, s=symbol); +#X text 37 171 a) single elements: are the containers h_vector \, h_list +\, h_deque \, h_set \, h_multiset; +#X text 471 172 b) key-value pairs: are the containers h_map and h_multimap +; +#X text 469 276 2.element: symbol go; +#X text 476 698 f 2 s wow - f 2; +#X text 476 712 s go - s not f 34; +#X text 476 729 f 23 - s op; +#X text 488 244 key: list 2 wow; +#X text 470 229 1.element:; +#X text 488 258 value: float 2; +#X text 490 291 key: symbol go; +#X text 490 305 value: list symbol not float 34; +#X text 39 243 1.element: list 2 wow 2; +#X text 39 257 2.element: symbol go; +#X text 38 272 3.element: float 23; +#X text 37 223 a) example1:; +#X text 470 212 b) example2:; +#X text 37 312 a) example1 \, XML:; +#X text 37 339 ; +#X text 37 353 ; +#X text 54 366 ; +#X text 70 379 2 ; +#X text 70 405 2 ; +#X text 56 418 ; +#X text 70 391 wow ; +#X text 56 431 ; +#X text 57 455 ; +#X text 72 443 go ; +#X text 56 468 ; +#X text 57 492 ; +#X text 72 480 23 ; +#X text 41 506 ; +#X text 41 542 a) example1 \, textfile:; +#X text 39 115 You can save the data of the containers to XML files +and normal textfiles (see General_Concept).; +#X text 469 375 ; +#X text 469 389 ; +#X text 486 402 ; +#X text 519 430 2 ; +#X text 520 482 2 ; +#X text 488 506 ; +#X text 519 442 wow ; +#X text 475 634 ; +#X text 469 348 b) example2 \, XML:; +#X text 503 415 ; +#X text 504 456 ; +#X text 503 468 ; +#X text 504 494 ; +#X text 487 519 ; +#X text 489 621 ; +#X text 504 532 ; +#X text 505 559 ; +#X text 504 571 ; +#X text 505 609 ; +#X text 520 545 go ; +#X text 521 584 not ; +#X text 521 597 34 ; +#X text 476 668 b) example2 \, textfile:; +#X restore 550 120 pd Fileformats; +#N canvas 174 18 646 317 read_save_possibilities 0; +#X obj 50 258 outlet; +#X msg 50 158 save data.dat; +#X msg 50 194 read data.dat; +#X text 155 158 <- save all the data of the current namespace as textfile +; +#X text 149 194 <- read this textfile to the current namespace and +insert it at the back (so the size will increase); +#X text 173 83 <- read this XML-file to the current namespace and insert +it at the back (so the size will increase); +#X text 176 50 <- save all the data of the current namespace as XML-file +; +#X msg 51 50 saveXML data.xml; +#X msg 51 82 readXML data.xml; +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X connect 7 0 0 0; +#X connect 8 0 0 0; +#X restore 483 477 pd read_save_possibilities; +#X text 523 501 different possiblities to read; +#X text 523 515 and write from and to files; +#X text 522 530 (XML and textfiles); +#X text 229 822 htttp://grh.mur.at/software/pdcontainer.html; +#X text 189 806 =%)!(%= PDContainer \, by Georg Holzmann +\, 2004; +#X msg 483 335 getall; +#X text 535 335 <- dumps out all data sequentially; +#X text 556 349 at the first outlet; +#X connect 4 0 27 0; +#X connect 5 0 27 0; +#X connect 6 0 27 0; +#X connect 8 0 27 0; +#X connect 9 0 27 0; +#X connect 12 0 27 0; +#X connect 22 0 27 0; +#X connect 27 0 10 0; +#X connect 27 1 23 0; +#X connect 27 2 45 0; +#X connect 27 3 7 0; +#X connect 30 0 32 0; +#X connect 30 1 48 0; +#X connect 30 2 47 0; +#X connect 30 3 29 0; +#X connect 31 0 30 0; +#X connect 49 0 27 0; +#X connect 58 0 27 0; +#X connect 64 0 27 0; -- cgit v1.2.1