aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Holzmann <grholzi@users.sourceforge.net>2005-10-21 11:56:32 +0000
committerGeorg Holzmann <grholzi@users.sourceforge.net>2005-10-21 11:56:32 +0000
commit1d6d1e8c73193f57a9c98387ea42eb91eb4d21d1 (patch)
tree8d0853fe30b12c73774c786f02f3d3011b147d4c
parentdf8ac7c52ff0dfc8e2ba828c4226ed34b0e9ebfc (diff)
only moving to a new directory
svn path=/trunk/externals/grh/; revision=3740
-rwxr-xr-xPDContainer/CHANGELOG13
-rwxr-xr-xPDContainer/ClassHierarchy143
-rwxr-xr-xPDContainer/gpl.txt346
-rwxr-xr-xPDContainer/help/help-h_deque.pd456
-rwxr-xr-xPDContainer/help/help-h_list.pd522
-rwxr-xr-xPDContainer/help/help-h_map.pd430
-rwxr-xr-xPDContainer/help/help-h_multimap.pd422
-rwxr-xr-xPDContainer/help/help-h_multiset.pd407
-rwxr-xr-xPDContainer/help/help-h_priority_queue.pd377
-rwxr-xr-xPDContainer/help/help-h_queue.pd363
-rwxr-xr-xPDContainer/help/help-h_set.pd408
-rwxr-xr-xPDContainer/help/help-h_stack.pd367
-rwxr-xr-xPDContainer/help/help-h_vector.pd444
-rwxr-xr-xPDContainer/include/ContainerBase.h136
-rwxr-xr-xPDContainer/include/GlobalStuff.h274
-rwxr-xr-xPDContainer/include/HDeque.h80
-rwxr-xr-xPDContainer/include/HList.h250
-rwxr-xr-xPDContainer/include/HMap.h67
-rwxr-xr-xPDContainer/include/HMultiMap.h80
-rwxr-xr-xPDContainer/include/HMultiSet.h81
-rwxr-xr-xPDContainer/include/HPrioQueue.h100
-rwxr-xr-xPDContainer/include/HQueue.h77
-rwxr-xr-xPDContainer/include/HSet.h82
-rwxr-xr-xPDContainer/include/HStack.h77
-rwxr-xr-xPDContainer/include/HVector.h66
-rwxr-xr-xPDContainer/include/MapBase.h655
-rwxr-xr-xPDContainer/include/QueueStack.h61
-rwxr-xr-xPDContainer/include/SequBase.h341
-rwxr-xr-xPDContainer/include/SimpleBase.h539
-rwxr-xr-xPDContainer/makefile120
-rwxr-xr-xPDContainer/makefile_darwin120
-rwxr-xr-xPDContainer/makefile_mingw120
-rwxr-xr-xPDContainer/makefile_msvc121
-rwxr-xr-xPDContainer/pdcontainer_multi.dtd17
-rwxr-xr-xPDContainer/pdcontainer_simple.dtd14
-rwxr-xr-xPDContainer/readme.txt47
-rwxr-xr-xPDContainer/src/HDeque.cpp15
-rwxr-xr-xPDContainer/src/HList.cpp111
-rwxr-xr-xPDContainer/src/HMap.cpp15
-rwxr-xr-xPDContainer/src/HMultiMap.cpp38
-rwxr-xr-xPDContainer/src/HMultiSet.cpp15
-rwxr-xr-xPDContainer/src/HPrioQueue.cpp15
-rwxr-xr-xPDContainer/src/HQueue.cpp15
-rwxr-xr-xPDContainer/src/HSet.cpp15
-rwxr-xr-xPDContainer/src/HStack.cpp15
-rwxr-xr-xPDContainer/src/HVector.cpp15
-rwxr-xr-xPDContainer/src/PDContainer.cpp78
-rwxr-xr-xPDContainer/src/h_deque.cpp578
-rwxr-xr-xPDContainer/src/h_list.cpp442
-rwxr-xr-xPDContainer/src/h_map.cpp334
-rwxr-xr-xPDContainer/src/h_multimap.cpp331
-rwxr-xr-xPDContainer/src/h_multiset.cpp220
-rwxr-xr-xPDContainer/src/h_prioqueue.cpp250
-rwxr-xr-xPDContainer/src/h_queue.cpp165
-rwxr-xr-xPDContainer/src/h_set.cpp220
-rwxr-xr-xPDContainer/src/h_stack.cpp165
-rwxr-xr-xPDContainer/src/h_vector.cpp488
-rwxr-xr-xPDContainer/tinyxml/tinystr.cpp318
-rwxr-xr-xPDContainer/tinyxml/tinystr.h250
-rwxr-xr-xPDContainer/tinyxml/tinyxml.cpp1592
-rwxr-xr-xPDContainer/tinyxml/tinyxml.h1426
-rwxr-xr-xPDContainer/tinyxml/tinyxmlerror.cpp51
-rwxr-xr-xPDContainer/tinyxml/tinyxmlparser.cpp1508
63 files changed, 16908 insertions, 0 deletions
diff --git a/PDContainer/CHANGELOG b/PDContainer/CHANGELOG
new file mode 100755
index 0000000..41212e5
--- /dev/null
+++ b/PDContainer/CHANGELOG
@@ -0,0 +1,13 @@
+
+version 0.2
+ - possible to store pointers now as keys, values, ... (for pd graphical datastructures)
+ - h_map: IMPORTANT: [add ( has changed !!! now it resets the value,
+ if the key is already in the map !
+ (this should break no patches I hope !)
+ - compiles with gcc4 now (templates reworked)
+ - huge memory leak fixed
+ - some bug fixes
+ - some internal changes
+
+version 0.1
+ - basic functionality
diff --git a/PDContainer/ClassHierarchy b/PDContainer/ClassHierarchy
new file mode 100755
index 0000000..8fa687c
--- /dev/null
+++ b/PDContainer/ClassHierarchy
@@ -0,0 +1,143 @@
+Class Hierarchy of PDContainer:
+-------------------------------
+
+
+
+class ContainerBase (includes GlobalStuff.h)
+{
+ static map data_
+ sting h_namespace_
+ string dataname_
+
+ void setNamespace(string h_namespace)
+ string getNamespace() const
+ virtual void help()
+ virtual void clearNamespace()
+ virtual void clearAll()
+ virtual int getSize() const
+}
+
+
+class SimpleBase : public ContainerBase
+{
+ virtual void printAll()
+ virtual void printAllIndex()
+ virtual bool saveToFile(string filename)
+ virtual bool readFromFile(string filename)
+}
+
+
+class MapBase : public ContainerBase
+{
+ virtual void add(Element key, Element value)
+ virtual Element &get(Element &key) const
+ virtual void remove(const Element &key)
+ virtual void printAll()
+ virtual bool saveToFile(string filename)
+ virtual bool readFromFile(string filename)
+}
+
+
+class HMap : public MapBase
+
+
+class HMultiMap : public MapBase
+{
+ virtual int getNr(Element &key) const
+ virtual Element &get(Element &key, int index) const
+}
+
+
+class HSet : public SimpleBase
+{
+ virtual void add(Element key)
+ virtual int get(const Element &key) const
+ virtual void remove(const Element &key) const
+}
+
+
+class HMultiSet : public SimpleBase
+{
+ virtual void add(Element key)
+ virtual int get(const Element &key) const
+ virtual void remove(const Element &key) const
+}
+
+
+class SequBase : public SimpleBase
+{
+ virtual void set(int index, Element value)
+ virtual Element &get(int index) const
+ virtual void resize(int size)
+ virtual void pushBack(Element value)
+ virtual void popBack()
+ virtual Element &back() const
+ virtual Element &front() const
+ virtual void insert(int index, Element value)
+ virtual void remove(int index)
+ virtual bool readFromFile2(string filename, int index);
+}
+
+
+class HVector : public SequBase
+
+
+class HDeque : public SequBase
+{
+ virtual void pushFront(Element value)
+ virtual void popFront()
+}
+
+
+class HList : public SimpleBase
+{
+ int i_pos_
+ list<Element>::iterator iter_
+
+ virtual void pushBack(Element value)
+ virtual void popBack()
+ virtual void pushFront(Element value)
+ virtual void popFront()
+ virtual Element &back() const
+ virtual Element &front() const
+ virtual void insert(Element value)
+ virtual Element get()
+ virtual void remove(Element value)
+ virtual void del()
+ virtual int getSize() const
+ virtual void begin()
+ virtual void end()
+ virtual void next()
+ virtual void last()
+ virtual void unique()
+ virtual void reverse()
+ virtual void sort()
+ virtual bool readFromFile(string filename)
+}
+
+
+class QueueStack : public ContainerBase
+{
+ virtual void pop()
+}
+
+
+class HQueue : public QueueStack
+{
+ virtual void push(Element value)
+ virtual Element &front() const
+}
+
+
+class HPrioQueue : public QueueStack
+{
+ virtual void push(float prio, Element value)
+ virtual Element top() const
+}
+
+
+class HStack : public QueueStack
+{
+ virtual void push(Element value)
+ virtual Element &top() const
+} \ No newline at end of file
diff --git a/PDContainer/gpl.txt b/PDContainer/gpl.txt
new file mode 100755
index 0000000..5ea29a7
--- /dev/null
+++ b/PDContainer/gpl.txt
@@ -0,0 +1,346 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
diff --git a/PDContainer/help/help-h_deque.pd b/PDContainer/help/help-h_deque.pd
new file mode 100755
index 0000000..eda26ba
--- /dev/null
+++ b/PDContainer/help/help-h_deque.pd
@@ -0,0 +1,456 @@
+#N canvas 344 22 799 883 10;
+#X obj 147 379 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 498 23 cnv 15 204 120 empty empty empty 20 12 0 14 -66577 -66577
+0;
+#X obj 500 25 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 534 61 pd General_Concept;
+#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;
+#X text 295 36 help file of;
+#X text 36 98 init arg: namespace;
+#X msg 480 293 print;
+#X msg 480 337 clear;
+#X msg 480 637 help;
+#X obj 559 688 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X msg 480 234 getnamespace;
+#X msg 480 375 clearall;
+#X obj 480 736 print BBB;
+#X obj 68 380 print AAA;
+#X text 591 259 <- change namespace;
+#X msg 480 258 namespace grix;
+#X text 527 294 <- print all the data of the;
+#X text 546 309 current namespace;
+#X text 528 337 <- clear all the data of the;
+#X text 549 352 current namespace;
+#X text 548 377 <- clear all the data in all;
+#X text 569 392 same containers (maybe;
+#X text 571 407 you shouldn't use this);
+#X text 580 236 <- get current namespace;
+#X text 512 193 general operations:;
+#X msg 294 341 list damm 4345 it;
+#X floatatom 294 247 5 0 0 0 - - -;
+#X symbolatom 294 265 10 0 0 0 - - -;
+#X msg 294 317 hacka 45;
+#X msg 294 294 3 4 krschi;
+#X text 304 216 value:;
+#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 516 89 pd Container_Explanation;
+#X msg 480 574 resize \$1;
+#X msg 480 608 getsize;
+#X floatatom 488 546 5 0 0 0 - - -;
+#X floatatom 519 707 5 0 0 0 - - -;
+#X text 545 607 <- get the size (at 2nd;
+#X text 567 621 outlet);
+#X msg 68 290 get \$1;
+#X floatatom 74 269 5 0 0 0 - - -;
+#X floatatom 74 226 5 0 0 0 - - -;
+#X msg 68 247 set \$1;
+#X msg 71 706 insert \$1;
+#X floatatom 80 687 5 0 0 0 - - -;
+#X floatatom 79 731 5 0 0 0 - - -;
+#X msg 70 752 remove \$1;
+#X text 124 246 <- changes the value;
+#X text 145 260 at that index;
+#X text 142 304 at that index;
+#X text 121 290 <- get the value;
+#X text 167 379 <- bang if not found;
+#X msg 69 519 popback;
+#X floatatom 79 429 5 0 0 0 - - -;
+#X msg 69 449 pushback \$1;
+#X text 209 456 <- inserts the data at the;
+#X msg 178 776 some data;
+#X text 152 679 remove and insert at index:;
+#X text 188 716 If you need this very often you;
+#X text 188 730 should better use a list or a map;
+#X text 188 743 (or something else) !;
+#X symbolatom 124 429 10 0 0 0 - - -;
+#X text 283 54 ::: h_deque :::;
+#X text 37 126 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 obj 68 358 h_deque havi;
+#X obj 70 776 h_deque havi;
+#X obj 69 619 h_deque havi;
+#X obj 480 664 h_deque havi;
+#X text 560 708 <- size of deque;
+#X text 556 575 <- resizes the deque;
+#X text 187 702 Thats not very fast with a deque!;
+#X msg 69 489 pushfront \$1;
+#X floatatom 79 470 5 0 0 0 - - -;
+#X symbolatom 122 470 10 0 0 0 - - -;
+#X msg 69 542 popfront;
+#X msg 69 572 back;
+#X msg 69 594 front;
+#X text 229 471 front/back of the deque;
+#X text 208 485 (so the size will increase);
+#X text 143 521 <- removes the element from the;
+#X text 143 539 back/front (so the size will decrease);
+#X text 124 571 <- gives out the element from the;
+#X text 146 586 back/front;
+#X obj 69 641 print CCC;
+#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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 37 353 <PDContainer type="h_list">;
+#X text 54 366 <element>;
+#X text 70 379 <f> 2 </f>;
+#X text 70 405 <f> 2 </f>;
+#X text 56 418 </element>;
+#X text 70 391 <s> wow </s>;
+#X text 56 431 <element>;
+#X text 57 455 </element>;
+#X text 72 443 <s> go </s>;
+#X text 56 468 <element>;
+#X text 57 492 </element>;
+#X text 72 480 <f> 23 </f>;
+#X text 41 506 </PDContainer>;
+#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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 469 389 <PDContainer type="h_list">;
+#X text 486 402 <element>;
+#X text 519 430 <f> 2 </f>;
+#X text 520 482 <f> 2 </f>;
+#X text 488 506 </element>;
+#X text 519 442 <s> wow </s>;
+#X text 475 634 </PDContainer>;
+#X text 469 348 b) example2 \, XML:;
+#X text 503 415 <key>;
+#X text 504 456 </key>;
+#X text 503 468 <value>;
+#X text 504 494 </value>;
+#X text 487 519 <element>;
+#X text 489 621 </element>;
+#X text 504 532 <key>;
+#X text 505 559 </key>;
+#X text 504 571 <value>;
+#X text 505 609 </value>;
+#X text 520 545 <s> go </s>;
+#X text 521 584 <s> not </s>;
+#X text 521 597 <f> 34 </f>;
+#X text 476 668 b) example2 \, textfile:;
+#X restore 548 115 pd Fileformats;
+#N canvas 174 18 646 402 read_save_possibilities 0;
+#X obj 44 336 outlet;
+#X msg 44 208 save data.dat;
+#X msg 44 244 read data.dat;
+#X msg 44 288 readat data.dat 0;
+#X text 149 208 <- save all the data of the current namespace as textfile
+;
+#X text 143 244 <- read this textfile to the current namespace and
+insert it at the back (so the size will increase);
+#X text 177 287 <- read the textfile and insert it at the given index
+(so the size won't increase !);
+#X text 166 94 <- read this XML-file to the current namespace and insert
+it at the back (so the size will increase);
+#X text 169 61 <- save all the data of the current namespace as XML-file
+;
+#X text 196 139 <- read the XML-file and insert it at the given index
+(so the size won't increase !);
+#X msg 44 61 saveXML data.xml;
+#X msg 44 93 readXML data.xml;
+#X msg 44 139 readatXML data.xml 0;
+#X connect 1 0 0 0;
+#X connect 2 0 0 0;
+#X connect 3 0 0 0;
+#X connect 10 0 0 0;
+#X connect 11 0 0 0;
+#X connect 12 0 0 0;
+#X restore 480 456 pd read_save_possibilities;
+#X text 520 480 different possiblities to read;
+#X text 520 494 and write from and to files;
+#X text 519 509 (XML and textfiles);
+#X text 216 844 htttp://grh.mur.at/software/pdcontainer.html;
+#X text 180 827 =%)!(%= PDContainer \, by Georg Holzmann <grh@mur.at>
+\, 2005;
+#X connect 8 0 68 0;
+#X connect 9 0 68 0;
+#X connect 10 0 68 0;
+#X connect 12 0 68 0;
+#X connect 13 0 68 0;
+#X connect 17 0 68 0;
+#X connect 27 0 65 1;
+#X connect 28 0 65 1;
+#X connect 29 0 65 1;
+#X connect 30 0 65 1;
+#X connect 31 0 65 1;
+#X connect 34 0 68 0;
+#X connect 35 0 68 0;
+#X connect 36 0 34 0;
+#X connect 40 0 65 0;
+#X connect 41 0 40 0;
+#X connect 42 0 43 0;
+#X connect 43 0 65 0;
+#X connect 44 0 66 0;
+#X connect 45 0 44 0;
+#X connect 46 0 47 0;
+#X connect 47 0 66 0;
+#X connect 53 0 67 0;
+#X connect 54 0 55 0;
+#X connect 55 0 67 0;
+#X connect 57 0 66 1;
+#X connect 62 0 55 0;
+#X connect 65 0 15 0;
+#X connect 65 2 0 0;
+#X connect 67 0 84 0;
+#X connect 68 0 14 0;
+#X connect 68 1 37 0;
+#X connect 68 2 11 0;
+#X connect 72 0 67 0;
+#X connect 73 0 72 0;
+#X connect 74 0 72 0;
+#X connect 75 0 67 0;
+#X connect 76 0 67 0;
+#X connect 77 0 67 0;
+#X connect 86 0 68 0;
diff --git a/PDContainer/help/help-h_list.pd b/PDContainer/help/help-h_list.pd
new file mode 100755
index 0000000..86bf16d
--- /dev/null
+++ b/PDContainer/help/help-h_list.pd
@@ -0,0 +1,522 @@
+#N canvas 535 40 834 864 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 342 clear;
+#X msg 483 653 help;
+#X obj 604 712 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X msg 483 239 getnamespace;
+#X msg 483 380 clearall;
+#X obj 483 769 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 342 <- clear all the data of the;
+#X text 552 357 current namespace;
+#X text 551 382 <- clear all the data in all;
+#X text 572 397 same containers (maybe;
+#X text 574 412 you shouldn't use this);
+#X text 583 241 <- get current namespace;
+#X text 514 198 general operations:;
+#X msg 483 561 getsize;
+#X floatatom 523 749 5 0 0 0 - - -;
+#X text 570 574 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 691 h_list simonatbase;
+#X text 604 730 <- 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 730 5 0 0 0 - - -;
+#X text 565 750 <- current iterator position;
+#X floatatom 151 721 5 0 0 0 - - -;
+#X floatatom 111 721 5 0 0 0 - - -;
+#X msg 483 604 getiter;
+#X text 548 560 <- get the size (at 3nd;
+#X text 574 620 (2nd outlet);
+#X text 553 605 <- 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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 37 353 <PDContainer type="h_list">;
+#X text 54 366 <element>;
+#X text 70 379 <f> 2 </f>;
+#X text 70 405 <f> 2 </f>;
+#X text 56 418 </element>;
+#X text 70 391 <s> wow </s>;
+#X text 56 431 <element>;
+#X text 57 455 </element>;
+#X text 72 443 <s> go </s>;
+#X text 56 468 <element>;
+#X text 57 492 </element>;
+#X text 72 480 <f> 23 </f>;
+#X text 41 506 </PDContainer>;
+#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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 469 389 <PDContainer type="h_list">;
+#X text 486 402 <element>;
+#X text 519 430 <f> 2 </f>;
+#X text 520 482 <f> 2 </f>;
+#X text 488 506 </element>;
+#X text 519 442 <s> wow </s>;
+#X text 475 634 </PDContainer>;
+#X text 469 348 b) example2 \, XML:;
+#X text 503 415 <key>;
+#X text 504 456 </key>;
+#X text 503 468 <value>;
+#X text 504 494 </value>;
+#X text 487 519 <element>;
+#X text 489 621 </element>;
+#X text 504 532 <key>;
+#X text 505 559 </key>;
+#X text 504 571 <value>;
+#X text 505 609 </value>;
+#X text 520 545 <s> go </s>;
+#X text 521 584 <s> not </s>;
+#X text 521 597 <f> 34 </f>;
+#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 459 pd read_save_possibilities;
+#X text 523 483 different possiblities to read;
+#X text 523 497 and write from and to files;
+#X text 522 512 (XML and textfiles);
+#X text 234 821 htttp://grh.mur.at/software/pdcontainer.html;
+#X text 194 805 =%)!(%= PDContainer \, by Georg Holzmann <grh@mur.at>
+\, 2004;
+#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;
diff --git a/PDContainer/help/help-h_map.pd b/PDContainer/help/help-h_map.pd
new file mode 100755
index 0000000..1d4df0e
--- /dev/null
+++ b/PDContainer/help/help-h_map.pd
@@ -0,0 +1,430 @@
+#N canvas 0 0 818 882 10;
+#X msg 82 407 add ge;
+#X obj 175 494 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#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;
+#X text 295 36 help file of;
+#X text 292 53 ::: h_map :::;
+#X text 40 98 init arg: namespace;
+#X msg 474 379 print;
+#X msg 474 423 clear;
+#X msg 474 643 help;
+#X obj 567 704 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X msg 474 320 getnamespace;
+#X msg 474 461 clearall;
+#X obj 474 681 h_map druschka;
+#X obj 474 757 print BBB;
+#X obj 82 495 print AAA;
+#X text 585 345 <- change namespace;
+#X msg 474 344 namespace grix;
+#X text 521 380 <- print all the data of the;
+#X text 540 395 current namespace;
+#X text 522 423 <- clear all the data of the;
+#X text 543 438 current namespace;
+#X text 542 463 <- clear all the data in all;
+#X text 563 478 same containers (maybe;
+#X text 565 493 you shouldn't use this);
+#X text 574 322 <- get current namespace;
+#X text 473 268 general operations:;
+#X msg 82 381 add bla bal tuff;
+#X msg 82 431 add 4 f 3;
+#X msg 82 356 add \$1;
+#X floatatom 82 318 5 0 0 0 - - -;
+#X symbolatom 129 320 10 0 0 0 - - -;
+#X obj 82 472 h_map druschka;
+#X msg 244 433 list damm 4345 it;
+#X floatatom 244 339 5 0 0 0 - - -;
+#X symbolatom 244 357 10 0 0 0 - - -;
+#X msg 244 409 hacka 45;
+#X msg 244 386 3 4 krschi;
+#X text 37 130 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 text 110 293 key:;
+#X text 254 308 value:;
+#X text 127 269 add data to the map:;
+#X obj 172 748 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 79 749 print AAA;
+#X floatatom 79 572 5 0 0 0 - - -;
+#X symbolatom 126 574 10 0 0 0 - - -;
+#X obj 79 726 h_map druschka;
+#X text 136 541 get \, remove data:;
+#X msg 79 610 get \$1;
+#X msg 79 635 get bla bal tuff;
+#X msg 79 661 get ge;
+#X msg 79 685 get 4 f 3;
+#X floatatom 222 576 5 0 0 0 - - -;
+#X symbolatom 269 578 10 0 0 0 - - -;
+#X msg 222 614 remove \$1;
+#X msg 222 639 remove bla bal tuff;
+#X msg 222 665 remove ge;
+#X msg 222 689 remove 4 f 3;
+#X text 195 748 <- bang if the key isn't found;
+#X msg 474 609 getsize;
+#X text 539 608 <- get the size (at 2nd;
+#X text 561 622 outlet);
+#X obj 520 730 print size;
+#X obj 504 26 cnv 15 204 120 empty empty empty 20 12 0 14 -66577 -66577
+0;
+#X obj 506 28 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 540 64 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 522 92 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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 37 353 <PDContainer type="h_list">;
+#X text 54 366 <element>;
+#X text 70 379 <f> 2 </f>;
+#X text 70 405 <f> 2 </f>;
+#X text 56 418 </element>;
+#X text 70 391 <s> wow </s>;
+#X text 56 431 <element>;
+#X text 57 455 </element>;
+#X text 72 443 <s> go </s>;
+#X text 56 468 <element>;
+#X text 57 492 </element>;
+#X text 72 480 <f> 23 </f>;
+#X text 41 506 </PDContainer>;
+#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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 469 389 <PDContainer type="h_list">;
+#X text 486 402 <element>;
+#X text 519 430 <f> 2 </f>;
+#X text 520 482 <f> 2 </f>;
+#X text 488 506 </element>;
+#X text 519 442 <s> wow </s>;
+#X text 475 634 </PDContainer>;
+#X text 469 348 b) example2 \, XML:;
+#X text 503 415 <key>;
+#X text 504 456 </key>;
+#X text 503 468 <value>;
+#X text 504 494 </value>;
+#X text 487 519 <element>;
+#X text 489 621 </element>;
+#X text 504 532 <key>;
+#X text 505 559 </key>;
+#X text 504 571 <value>;
+#X text 505 609 </value>;
+#X text 520 545 <s> go </s>;
+#X text 521 584 <s> not </s>;
+#X text 521 597 <f> 34 </f>;
+#X text 476 668 b) example2 \, textfile:;
+#X restore 554 118 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 474 522 pd read_save_possibilities;
+#X text 512 543 different possiblities to read;
+#X text 512 557 and write from and to files;
+#X text 511 571 (XML and textfiles);
+#X text 248 827 htttp://grh.mur.at/software/pdcontainer.html;
+#X text 208 811 =%)!(%= PDContainer \, by Georg Holzmann <grh@mur.at>
+\, 2004;
+#X connect 0 0 32 0;
+#X connect 7 0 13 0;
+#X connect 8 0 13 0;
+#X connect 9 0 13 0;
+#X connect 11 0 13 0;
+#X connect 12 0 13 0;
+#X connect 13 0 14 0;
+#X connect 13 1 62 0;
+#X connect 13 2 10 0;
+#X connect 17 0 13 0;
+#X connect 27 0 32 0;
+#X connect 28 0 32 0;
+#X connect 29 0 32 0;
+#X connect 30 0 29 0;
+#X connect 31 0 29 0;
+#X connect 32 0 15 0;
+#X connect 32 2 1 0;
+#X connect 33 0 32 1;
+#X connect 34 0 32 1;
+#X connect 35 0 32 1;
+#X connect 36 0 32 1;
+#X connect 37 0 32 1;
+#X connect 44 0 48 0;
+#X connect 45 0 48 0;
+#X connect 46 0 43 0;
+#X connect 46 2 42 0;
+#X connect 48 0 46 0;
+#X connect 49 0 46 0;
+#X connect 50 0 46 0;
+#X connect 51 0 46 0;
+#X connect 52 0 54 0;
+#X connect 53 0 54 0;
+#X connect 54 0 46 0;
+#X connect 55 0 46 0;
+#X connect 56 0 46 0;
+#X connect 57 0 46 0;
+#X connect 59 0 13 0;
+#X connect 68 0 13 0;
diff --git a/PDContainer/help/help-h_multimap.pd b/PDContainer/help/help-h_multimap.pd
new file mode 100755
index 0000000..4895db8
--- /dev/null
+++ b/PDContainer/help/help-h_multimap.pd
@@ -0,0 +1,422 @@
+#N canvas 556 0 813 872 10;
+#X msg 82 407 add ge;
+#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;
+#X text 295 36 help file of;
+#X text 40 98 init arg: namespace;
+#X msg 479 373 print;
+#X msg 479 417 clear;
+#X msg 479 655 help;
+#X msg 479 314 getnamespace;
+#X msg 479 455 clearall;
+#X obj 479 708 print BBB;
+#X obj 82 495 print AAA;
+#X text 590 339 <- change namespace;
+#X msg 479 338 namespace grix;
+#X text 526 374 <- print all the data of the;
+#X text 545 389 current namespace;
+#X text 527 417 <- clear all the data of the;
+#X text 548 432 current namespace;
+#X text 547 457 <- clear all the data in all;
+#X text 568 472 same containers (maybe;
+#X text 570 487 you shouldn't use this);
+#X text 579 316 <- get current namespace;
+#X text 478 262 general operations:;
+#X msg 82 381 add bla bal tuff;
+#X msg 82 431 add 4 f 3;
+#X msg 82 356 add \$1;
+#X floatatom 82 318 5 0 0 0 - - -;
+#X symbolatom 129 320 10 0 0 0 - - -;
+#X msg 232 429 list damm 4345 it;
+#X floatatom 232 335 5 0 0 0 - - -;
+#X symbolatom 232 353 10 0 0 0 - - -;
+#X msg 232 405 hacka 45;
+#X msg 232 382 3 4 krschi;
+#X text 110 293 key:;
+#X text 242 304 value:;
+#X obj 79 749 print AAA;
+#X floatatom 79 572 5 0 0 0 - - -;
+#X symbolatom 126 574 10 0 0 0 - - -;
+#X text 136 541 get \, remove data:;
+#X msg 79 610 get \$1;
+#X msg 79 635 get bla bal tuff;
+#X msg 79 661 get ge;
+#X msg 79 685 get 4 f 3;
+#X floatatom 222 576 5 0 0 0 - - -;
+#X symbolatom 269 578 10 0 0 0 - - -;
+#X msg 222 614 remove \$1;
+#X msg 222 639 remove bla bal tuff;
+#X msg 222 665 remove ge;
+#X msg 222 689 remove 4 f 3;
+#X text 40 131 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 text 275 53 ::: h_multimap :::;
+#X obj 82 472 h_multimap dampta;
+#X obj 79 726 h_multimap dampta;
+#X obj 479 686 h_multimap dampta;
+#X floatatom 136 782 5 0 0 0 - - -;
+#X text 111 263 add data to the multimap:;
+#X text 180 783 <- nr of values at the specific key;
+#X msg 479 600 getsize;
+#X text 566 613 outlet);
+#X text 544 599 <- get the size (at 3rd;
+#X obj 593 709 print size;
+#X obj 500 24 cnv 15 204 120 empty empty empty 20 12 0 14 -66577 -66577
+0;
+#X obj 502 26 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 62 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 90 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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 37 353 <PDContainer type="h_list">;
+#X text 54 366 <element>;
+#X text 70 379 <f> 2 </f>;
+#X text 70 405 <f> 2 </f>;
+#X text 56 418 </element>;
+#X text 70 391 <s> wow </s>;
+#X text 56 431 <element>;
+#X text 57 455 </element>;
+#X text 72 443 <s> go </s>;
+#X text 56 468 <element>;
+#X text 57 492 </element>;
+#X text 72 480 <f> 23 </f>;
+#X text 41 506 </PDContainer>;
+#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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 469 389 <PDContainer type="h_list">;
+#X text 486 402 <element>;
+#X text 519 430 <f> 2 </f>;
+#X text 520 482 <f> 2 </f>;
+#X text 488 506 </element>;
+#X text 519 442 <s> wow </s>;
+#X text 475 634 </PDContainer>;
+#X text 469 348 b) example2 \, XML:;
+#X text 503 415 <key>;
+#X text 504 456 </key>;
+#X text 503 468 <value>;
+#X text 504 494 </value>;
+#X text 487 519 <element>;
+#X text 489 621 </element>;
+#X text 504 532 <key>;
+#X text 505 559 </key>;
+#X text 504 571 <value>;
+#X text 505 609 </value>;
+#X text 520 545 <s> go </s>;
+#X text 521 584 <s> not </s>;
+#X text 521 597 <f> 34 </f>;
+#X text 476 668 b) example2 \, textfile:;
+#X restore 550 116 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 479 515 pd read_save_possibilities;
+#X text 517 536 different possiblities to read;
+#X text 517 550 and write from and to files;
+#X text 516 564 (XML and textfiles);
+#X text 260 835 htttp://grh.mur.at/software/pdcontainer.html;
+#X text 220 819 =%)!(%= PDContainer \, by Georg Holzmann <grh@mur.at>
+\, 2004;
+#X connect 0 0 51 0;
+#X connect 5 0 53 0;
+#X connect 6 0 53 0;
+#X connect 7 0 53 0;
+#X connect 8 0 53 0;
+#X connect 9 0 53 0;
+#X connect 13 0 53 0;
+#X connect 23 0 51 0;
+#X connect 24 0 51 0;
+#X connect 25 0 51 0;
+#X connect 26 0 25 0;
+#X connect 27 0 25 0;
+#X connect 28 0 51 1;
+#X connect 29 0 51 1;
+#X connect 30 0 51 1;
+#X connect 31 0 51 1;
+#X connect 32 0 51 1;
+#X connect 36 0 39 0;
+#X connect 37 0 39 0;
+#X connect 39 0 52 0;
+#X connect 40 0 52 0;
+#X connect 41 0 52 0;
+#X connect 42 0 52 0;
+#X connect 43 0 45 0;
+#X connect 44 0 45 0;
+#X connect 45 0 52 0;
+#X connect 46 0 52 0;
+#X connect 47 0 52 0;
+#X connect 48 0 52 0;
+#X connect 51 0 11 0;
+#X connect 52 0 35 0;
+#X connect 52 1 54 0;
+#X connect 53 0 10 0;
+#X connect 53 2 60 0;
+#X connect 57 0 53 0;
+#X connect 66 0 53 0;
diff --git a/PDContainer/help/help-h_multiset.pd b/PDContainer/help/help-h_multiset.pd
new file mode 100755
index 0000000..b97dd8a
--- /dev/null
+++ b/PDContainer/help/help-h_multiset.pd
@@ -0,0 +1,407 @@
+#N canvas 0 0 817 875 10;
+#X msg 154 388 add ge;
+#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;
+#X text 295 36 help file of;
+#X text 37 100 init arg: namespace;
+#X msg 470 377 print;
+#X msg 470 421 clear;
+#X msg 470 642 help;
+#X msg 470 318 getnamespace;
+#X msg 470 459 clearall;
+#X text 581 343 <- change namespace;
+#X msg 470 342 namespace grix;
+#X text 517 378 <- print all the data of the;
+#X text 536 393 current namespace;
+#X text 518 421 <- clear all the data of the;
+#X text 539 436 current namespace;
+#X text 538 461 <- clear all the data in all;
+#X text 559 476 same containers (maybe;
+#X text 561 491 you shouldn't use this);
+#X text 570 320 <- get current namespace;
+#X text 469 266 general operations:;
+#X msg 154 362 add bla bal tuff;
+#X msg 154 412 add 4 f 3;
+#X msg 154 337 add \$1;
+#X floatatom 154 299 5 0 0 0 - - -;
+#X symbolatom 201 301 10 0 0 0 - - -;
+#X floatatom 84 578 5 0 0 0 - - -;
+#X symbolatom 131 580 10 0 0 0 - - -;
+#X text 139 544 get \, remove data:;
+#X msg 84 616 get \$1;
+#X msg 84 641 get bla bal tuff;
+#X msg 84 667 get ge;
+#X msg 84 691 get 4 f 3;
+#X floatatom 227 582 5 0 0 0 - - -;
+#X symbolatom 274 584 10 0 0 0 - - -;
+#X msg 227 620 remove \$1;
+#X msg 227 645 remove bla bal tuff;
+#X msg 227 671 remove ge;
+#X msg 227 695 remove 4 f 3;
+#X floatatom 84 757 5 0 0 0 - - -;
+#X floatatom 470 696 5 0 0 0 - - -;
+#X floatatom 154 477 5 0 0 0 - - -;
+#X text 275 52 ::: h_multiset :::;
+#X obj 154 453 h_multiset \$0-pscht;
+#X obj 84 731 h_multiset \$0-pscht;
+#X obj 470 673 h_multiset \$0-pscht;
+#X text 131 757 <- the number how often the data is set;
+#X text 37 137 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 text 140 268 add data to the multiset:;
+#X msg 470 605 getsize;
+#X text 535 604 <- get the size (at 2nd;
+#X text 557 618 outlet);
+#X obj 598 695 print size;
+#X obj 500 24 cnv 15 204 120 empty empty empty 20 12 0 14 -66577 -66577
+0;
+#X obj 502 26 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 62 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 90 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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 37 353 <PDContainer type="h_list">;
+#X text 54 366 <element>;
+#X text 70 379 <f> 2 </f>;
+#X text 70 405 <f> 2 </f>;
+#X text 56 418 </element>;
+#X text 70 391 <s> wow </s>;
+#X text 56 431 <element>;
+#X text 57 455 </element>;
+#X text 72 443 <s> go </s>;
+#X text 56 468 <element>;
+#X text 57 492 </element>;
+#X text 72 480 <f> 23 </f>;
+#X text 41 506 </PDContainer>;
+#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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 469 389 <PDContainer type="h_list">;
+#X text 486 402 <element>;
+#X text 519 430 <f> 2 </f>;
+#X text 520 482 <f> 2 </f>;
+#X text 488 506 </element>;
+#X text 519 442 <s> wow </s>;
+#X text 475 634 </PDContainer>;
+#X text 469 348 b) example2 \, XML:;
+#X text 503 415 <key>;
+#X text 504 456 </key>;
+#X text 503 468 <value>;
+#X text 504 494 </value>;
+#X text 487 519 <element>;
+#X text 489 621 </element>;
+#X text 504 532 <key>;
+#X text 505 559 </key>;
+#X text 504 571 <value>;
+#X text 505 609 </value>;
+#X text 520 545 <s> go </s>;
+#X text 521 584 <s> not </s>;
+#X text 521 597 <f> 34 </f>;
+#X text 476 668 b) example2 \, textfile:;
+#X restore 550 116 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 470 524 pd read_save_possibilities;
+#X text 508 545 different possiblities to read;
+#X text 508 559 and write from and to files;
+#X text 507 573 (XML and textfiles);
+#X text 244 827 htttp://grh.mur.at/software/pdcontainer.html;
+#X text 204 811 =%)!(%= PDContainer \, by Georg Holzmann <grh@mur.at>
+\, 2004;
+#X connect 0 0 43 0;
+#X connect 5 0 45 0;
+#X connect 6 0 45 0;
+#X connect 7 0 45 0;
+#X connect 8 0 45 0;
+#X connect 9 0 45 0;
+#X connect 11 0 45 0;
+#X connect 21 0 43 0;
+#X connect 22 0 43 0;
+#X connect 23 0 43 0;
+#X connect 24 0 23 0;
+#X connect 25 0 23 0;
+#X connect 26 0 29 0;
+#X connect 27 0 29 0;
+#X connect 29 0 44 0;
+#X connect 30 0 44 0;
+#X connect 31 0 44 0;
+#X connect 32 0 44 0;
+#X connect 33 0 35 0;
+#X connect 34 0 35 0;
+#X connect 35 0 44 0;
+#X connect 36 0 44 0;
+#X connect 37 0 44 0;
+#X connect 38 0 44 0;
+#X connect 43 0 41 0;
+#X connect 44 0 39 0;
+#X connect 45 0 40 0;
+#X connect 45 1 52 0;
+#X connect 49 0 45 0;
+#X connect 58 0 45 0;
diff --git a/PDContainer/help/help-h_priority_queue.pd b/PDContainer/help/help-h_priority_queue.pd
new file mode 100755
index 0000000..de43ceb
--- /dev/null
+++ b/PDContainer/help/help-h_priority_queue.pd
@@ -0,0 +1,377 @@
+#N canvas 354 37 801 853 10;
+#X obj 261 702 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#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;
+#X text 295 36 help file of;
+#X text 40 98 init arg: namespace;
+#X msg 430 438 clear;
+#X msg 430 532 help;
+#X obj 607 586 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X msg 430 335 getnamespace;
+#X msg 430 476 clearall;
+#X obj 430 630 print BBB;
+#X text 541 360 <- change namespace;
+#X msg 430 359 namespace grix;
+#X text 478 438 <- clear all the data of the;
+#X text 499 453 current namespace;
+#X text 498 478 <- clear all the data in all;
+#X text 519 493 same containers (maybe;
+#X text 521 508 you shouldn't use this);
+#X text 530 337 <- get current namespace;
+#X text 429 283 general operations:;
+#X floatatom 518 606 5 0 0 0 - - -;
+#X floatatom 172 717 5 0 0 0 - - -;
+#X msg 430 391 getsize;
+#X text 493 391 <- puts out the size of the;
+#X text 514 407 stack at the 2nd outlet;
+#X text 153 600 removing it;
+#X msg 84 626 pop;
+#X text 285 53 ::: h_queue :::;
+#X text 562 606 <- nr of elements;
+#X text 119 627 <- removes the data fom the front;
+#X text 40 128 A priority queue is also a "first in first out" (FIFO)
+data structure like a queue \, 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 msg 84 571 top;
+#X text 132 572 <- get the data from the top;
+#X text 153 587 of the container without;
+#X text 140 642 of the container;
+#X text 287 702 <- bang if container is empty;
+#X obj 79 486 print AAA;
+#X msg 256 431 list damm 4345 it;
+#X floatatom 256 337 5 0 0 0 - - -;
+#X symbolatom 256 355 10 0 0 0 - - -;
+#X msg 256 407 hacka 45;
+#X msg 256 384 3 4 krschi;
+#X text 253 309 value:;
+#X msg 79 358 push \$1;
+#X floatatom 79 336 5 0 0 0 - - -;
+#X text 77 308 priority:;
+#X text 81 263 add data to the priority_queue:;
+#X obj 79 463 h_priority_queue \$0-aetsch;
+#X obj 84 743 print CCC;
+#X obj 84 678 h_priority_queue \$0-aetsch;
+#X obj 430 563 h_priority_queue \$0-aetsch;
+#X obj 500 24 cnv 15 204 120 empty empty empty 20 12 0 14 -66577 -66577
+0;
+#X obj 502 26 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 62 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 90 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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 37 353 <PDContainer type="h_list">;
+#X text 54 366 <element>;
+#X text 70 379 <f> 2 </f>;
+#X text 70 405 <f> 2 </f>;
+#X text 56 418 </element>;
+#X text 70 391 <s> wow </s>;
+#X text 56 431 <element>;
+#X text 57 455 </element>;
+#X text 72 443 <s> go </s>;
+#X text 56 468 <element>;
+#X text 57 492 </element>;
+#X text 72 480 <f> 23 </f>;
+#X text 41 506 </PDContainer>;
+#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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 469 389 <PDContainer type="h_list">;
+#X text 486 402 <element>;
+#X text 519 430 <f> 2 </f>;
+#X text 520 482 <f> 2 </f>;
+#X text 488 506 </element>;
+#X text 519 442 <s> wow </s>;
+#X text 475 634 </PDContainer>;
+#X text 469 348 b) example2 \, XML:;
+#X text 503 415 <key>;
+#X text 504 456 </key>;
+#X text 503 468 <value>;
+#X text 504 494 </value>;
+#X text 487 519 <element>;
+#X text 489 621 </element>;
+#X text 504 532 <key>;
+#X text 505 559 </key>;
+#X text 504 571 <value>;
+#X text 505 609 </value>;
+#X text 520 545 <s> go </s>;
+#X text 521 584 <s> not </s>;
+#X text 521 597 <f> 34 </f>;
+#X text 476 668 b) example2 \, textfile:;
+#X restore 550 116 pd Fileformats;
+#X text 224 810 htttp://grh.mur.at/software/pdcontainer.html;
+#X text 184 794 =%)!(%= PDContainer \, by Georg Holzmann <grh@mur.at>
+\, 2004;
+#X connect 5 0 50 0;
+#X connect 6 0 50 0;
+#X connect 8 0 50 0;
+#X connect 9 0 50 0;
+#X connect 12 0 50 0;
+#X connect 22 0 50 0;
+#X connect 26 0 49 0;
+#X connect 31 0 49 0;
+#X connect 37 0 47 1;
+#X connect 38 0 47 1;
+#X connect 39 0 47 1;
+#X connect 40 0 47 1;
+#X connect 41 0 47 1;
+#X connect 43 0 47 0;
+#X connect 44 0 43 0;
+#X connect 47 0 36 0;
+#X connect 49 0 48 0;
+#X connect 49 1 21 0;
+#X connect 49 2 0 0;
+#X connect 50 0 10 0;
+#X connect 50 1 20 0;
+#X connect 50 2 7 0;
diff --git a/PDContainer/help/help-h_queue.pd b/PDContainer/help/help-h_queue.pd
new file mode 100755
index 0000000..339f5f3
--- /dev/null
+++ b/PDContainer/help/help-h_queue.pd
@@ -0,0 +1,363 @@
+#N canvas 529 37 794 742 10;
+#X obj 154 536 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#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;
+#X text 295 36 help file of;
+#X text 40 98 init arg: namespace;
+#X msg 430 438 clear;
+#X msg 430 532 help;
+#X obj 502 587 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X msg 430 335 getnamespace;
+#X msg 430 476 clearall;
+#X obj 430 630 print BBB;
+#X obj 82 579 print AAA;
+#X text 541 360 <- change namespace;
+#X msg 430 359 namespace grix;
+#X text 478 438 <- clear all the data of the;
+#X text 499 453 current namespace;
+#X text 498 478 <- clear all the data in all;
+#X text 519 493 same containers (maybe;
+#X text 521 508 you shouldn't use this);
+#X text 530 337 <- get current namespace;
+#X text 429 283 general operations:;
+#X floatatom 466 606 5 0 0 0 - - -;
+#X floatatom 118 556 5 0 0 0 - - -;
+#X msg 430 391 getsize;
+#X text 493 391 <- puts out the size of the;
+#X text 514 407 stack at the 2nd outlet;
+#X msg 82 358 push \$1;
+#X floatatom 82 332 5 0 0 0 - - -;
+#X symbolatom 130 332 10 0 0 0 - - -;
+#X text 151 436 removing it;
+#X msg 82 462 pop;
+#X text 285 53 ::: h_queue :::;
+#X obj 82 514 h_queue xlt;
+#X obj 430 563 h_queue xlt;
+#X text 39 136 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 text 510 606 <- nr of elements;
+#X text 180 536 <- bang if queue is empty;
+#X text 148 359 <- push some data in the queue;
+#X msg 82 407 front;
+#X text 130 408 <- get the data from the front;
+#X text 151 423 of the queue without;
+#X text 138 478 of the queue;
+#X text 117 463 <- removes the data fom the front;
+#X obj 500 24 cnv 15 204 120 empty empty empty 20 12 0 14 -66577 -66577
+0;
+#X obj 502 26 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 62 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 90 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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 37 353 <PDContainer type="h_list">;
+#X text 54 366 <element>;
+#X text 70 379 <f> 2 </f>;
+#X text 70 405 <f> 2 </f>;
+#X text 56 418 </element>;
+#X text 70 391 <s> wow </s>;
+#X text 56 431 <element>;
+#X text 57 455 </element>;
+#X text 72 443 <s> go </s>;
+#X text 56 468 <element>;
+#X text 57 492 </element>;
+#X text 72 480 <f> 23 </f>;
+#X text 41 506 </PDContainer>;
+#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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 469 389 <PDContainer type="h_list">;
+#X text 486 402 <element>;
+#X text 519 430 <f> 2 </f>;
+#X text 520 482 <f> 2 </f>;
+#X text 488 506 </element>;
+#X text 519 442 <s> wow </s>;
+#X text 475 634 </PDContainer>;
+#X text 469 348 b) example2 \, XML:;
+#X text 503 415 <key>;
+#X text 504 456 </key>;
+#X text 503 468 <value>;
+#X text 504 494 </value>;
+#X text 487 519 <element>;
+#X text 489 621 </element>;
+#X text 504 532 <key>;
+#X text 505 559 </key>;
+#X text 504 571 <value>;
+#X text 505 609 </value>;
+#X text 520 545 <s> go </s>;
+#X text 521 584 <s> not </s>;
+#X text 521 597 <f> 34 </f>;
+#X text 476 668 b) example2 \, textfile:;
+#X restore 550 116 pd Fileformats;
+#X text 211 703 htttp://grh.mur.at/software/pdcontainer.html;
+#X text 171 687 =%)!(%= PDContainer \, by Georg Holzmann <grh@mur.at>
+\, 2004;
+#X connect 5 0 33 0;
+#X connect 6 0 33 0;
+#X connect 8 0 33 0;
+#X connect 9 0 33 0;
+#X connect 13 0 33 0;
+#X connect 23 0 33 0;
+#X connect 26 0 32 0;
+#X connect 27 0 26 0;
+#X connect 28 0 26 0;
+#X connect 30 0 32 0;
+#X connect 32 0 11 0;
+#X connect 32 1 22 0;
+#X connect 32 2 0 0;
+#X connect 33 0 10 0;
+#X connect 33 1 21 0;
+#X connect 33 2 7 0;
+#X connect 38 0 32 0;
diff --git a/PDContainer/help/help-h_set.pd b/PDContainer/help/help-h_set.pd
new file mode 100755
index 0000000..aadf628
--- /dev/null
+++ b/PDContainer/help/help-h_set.pd
@@ -0,0 +1,408 @@
+#N canvas 0 0 800 865 10;
+#X msg 154 388 add ge;
+#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;
+#X text 295 36 help file of;
+#X text 37 100 init arg: namespace;
+#X msg 477 380 print;
+#X msg 477 424 clear;
+#X msg 477 644 help;
+#X msg 477 321 getnamespace;
+#X msg 477 462 clearall;
+#X text 588 346 <- change namespace;
+#X msg 477 345 namespace grix;
+#X text 524 381 <- print all the data of the;
+#X text 543 396 current namespace;
+#X text 525 424 <- clear all the data of the;
+#X text 546 439 current namespace;
+#X text 545 464 <- clear all the data in all;
+#X text 566 479 same containers (maybe;
+#X text 568 494 you shouldn't use this);
+#X text 577 323 <- get current namespace;
+#X text 476 269 general operations:;
+#X msg 154 362 add bla bal tuff;
+#X msg 154 412 add 4 f 3;
+#X msg 154 337 add \$1;
+#X floatatom 154 299 5 0 0 0 - - -;
+#X symbolatom 201 301 10 0 0 0 - - -;
+#X floatatom 84 578 5 0 0 0 - - -;
+#X symbolatom 131 580 10 0 0 0 - - -;
+#X text 139 544 get \, remove data:;
+#X msg 84 616 get \$1;
+#X msg 84 641 get bla bal tuff;
+#X msg 84 667 get ge;
+#X msg 84 691 get 4 f 3;
+#X floatatom 227 582 5 0 0 0 - - -;
+#X symbolatom 274 584 10 0 0 0 - - -;
+#X msg 227 620 remove \$1;
+#X msg 227 645 remove bla bal tuff;
+#X msg 227 671 remove ge;
+#X msg 227 695 remove 4 f 3;
+#X floatatom 84 757 5 0 0 0 - - -;
+#X floatatom 477 698 5 0 0 0 - - -;
+#X text 291 51 ::: h_set :::;
+#X text 37 129 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 text 140 268 add data to the set:;
+#X obj 154 453 h_set krx;
+#X floatatom 154 477 5 0 0 0 - - -;
+#X obj 84 732 h_set krx;
+#X text 131 757 <- 1 if the data is set (otherwise 0);
+#X obj 477 675 h_set krx;
+#X obj 535 698 print size;
+#X msg 477 609 getsize;
+#X text 542 608 <- get the size (at 2nd;
+#X text 564 622 outlet);
+#X obj 500 24 cnv 15 204 120 empty empty empty 20 12 0 14 -66577 -66577
+0;
+#X obj 502 26 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 62 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 90 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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 37 353 <PDContainer type="h_list">;
+#X text 54 366 <element>;
+#X text 70 379 <f> 2 </f>;
+#X text 70 405 <f> 2 </f>;
+#X text 56 418 </element>;
+#X text 70 391 <s> wow </s>;
+#X text 56 431 <element>;
+#X text 57 455 </element>;
+#X text 72 443 <s> go </s>;
+#X text 56 468 <element>;
+#X text 57 492 </element>;
+#X text 72 480 <f> 23 </f>;
+#X text 41 506 </PDContainer>;
+#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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 469 389 <PDContainer type="h_list">;
+#X text 486 402 <element>;
+#X text 519 430 <f> 2 </f>;
+#X text 520 482 <f> 2 </f>;
+#X text 488 506 </element>;
+#X text 519 442 <s> wow </s>;
+#X text 475 634 </PDContainer>;
+#X text 469 348 b) example2 \, XML:;
+#X text 503 415 <key>;
+#X text 504 456 </key>;
+#X text 503 468 <value>;
+#X text 504 494 </value>;
+#X text 487 519 <element>;
+#X text 489 621 </element>;
+#X text 504 532 <key>;
+#X text 505 559 </key>;
+#X text 504 571 <value>;
+#X text 505 609 </value>;
+#X text 520 545 <s> go </s>;
+#X text 521 584 <s> not </s>;
+#X text 521 597 <f> 34 </f>;
+#X text 476 668 b) example2 \, textfile:;
+#X restore 550 116 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 477 525 pd read_save_possibilities;
+#X text 515 546 different possiblities to read;
+#X text 515 560 and write from and to files;
+#X text 514 574 (XML and textfiles);
+#X text 283 824 htttp://grh.mur.at/software/pdcontainer.html;
+#X text 243 808 =%)!(%= PDContainer \, by Georg Holzmann <grh@mur.at>
+\, 2004;
+#X connect 0 0 44 0;
+#X connect 5 0 48 0;
+#X connect 6 0 48 0;
+#X connect 7 0 48 0;
+#X connect 8 0 48 0;
+#X connect 9 0 48 0;
+#X connect 11 0 48 0;
+#X connect 21 0 44 0;
+#X connect 22 0 44 0;
+#X connect 23 0 44 0;
+#X connect 24 0 23 0;
+#X connect 25 0 23 0;
+#X connect 26 0 29 0;
+#X connect 27 0 29 0;
+#X connect 29 0 46 0;
+#X connect 30 0 46 0;
+#X connect 31 0 46 0;
+#X connect 32 0 46 0;
+#X connect 33 0 35 0;
+#X connect 34 0 35 0;
+#X connect 35 0 46 0;
+#X connect 36 0 46 0;
+#X connect 37 0 46 0;
+#X connect 38 0 46 0;
+#X connect 44 0 45 0;
+#X connect 46 0 39 0;
+#X connect 48 0 40 0;
+#X connect 48 1 49 0;
+#X connect 50 0 7 0;
+#X connect 58 0 48 0;
diff --git a/PDContainer/help/help-h_stack.pd b/PDContainer/help/help-h_stack.pd
new file mode 100755
index 0000000..7e090ac
--- /dev/null
+++ b/PDContainer/help/help-h_stack.pd
@@ -0,0 +1,367 @@
+#N canvas 0 0 796 754 10;
+#X obj 161 579 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#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;
+#X text 295 36 help file of;
+#X text 40 98 init arg: namespace;
+#X msg 430 438 clear;
+#X msg 430 532 help;
+#X obj 509 588 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X msg 430 335 getnamespace;
+#X msg 430 476 clearall;
+#X obj 430 630 print BBB;
+#X obj 82 622 print AAA;
+#X text 541 360 <- change namespace;
+#X msg 430 359 namespace grix;
+#X text 478 438 <- clear all the data of the;
+#X text 499 453 current namespace;
+#X text 498 478 <- clear all the data in all;
+#X text 519 493 same containers (maybe;
+#X text 521 508 you shouldn't use this);
+#X text 530 337 <- get current namespace;
+#X text 429 283 general operations:;
+#X text 287 53 ::: h_stack :::;
+#X obj 430 563 h_stack data;
+#X floatatom 469 606 5 0 0 0 - - -;
+#X obj 82 557 h_stack data;
+#X floatatom 121 599 5 0 0 0 - - -;
+#X msg 430 391 getsize;
+#X text 493 391 <- puts out the size of the;
+#X text 514 407 stack at the 2nd outlet;
+#X msg 82 358 push \$1;
+#X floatatom 82 332 5 0 0 0 - - -;
+#X symbolatom 130 332 10 0 0 0 - - -;
+#X text 148 359 <- push some data to the;
+#X text 169 374 top of the stack;
+#X msg 82 407 top;
+#X text 117 408 <- get the data from the top;
+#X text 138 423 of the stack without;
+#X text 138 436 removing it;
+#X msg 82 462 pop;
+#X text 513 606 <- nr of elements;
+#X text 187 579 <- bang if stack is empty;
+#X text 117 463 <- removes the data from the;
+#X text 138 478 top of the stack;
+#X text 137 494 (but without putting it;
+#X text 146 508 out !!!);
+#X text 38 133 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 removes it without putting it out.;
+#X obj 500 24 cnv 15 204 120 empty empty empty 20 12 0 14 -66577 -66577
+0;
+#X obj 502 26 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 62 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 90 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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 37 353 <PDContainer type="h_list">;
+#X text 54 366 <element>;
+#X text 70 379 <f> 2 </f>;
+#X text 70 405 <f> 2 </f>;
+#X text 56 418 </element>;
+#X text 70 391 <s> wow </s>;
+#X text 56 431 <element>;
+#X text 57 455 </element>;
+#X text 72 443 <s> go </s>;
+#X text 56 468 <element>;
+#X text 57 492 </element>;
+#X text 72 480 <f> 23 </f>;
+#X text 41 506 </PDContainer>;
+#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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 469 389 <PDContainer type="h_list">;
+#X text 486 402 <element>;
+#X text 519 430 <f> 2 </f>;
+#X text 520 482 <f> 2 </f>;
+#X text 488 506 </element>;
+#X text 519 442 <s> wow </s>;
+#X text 475 634 </PDContainer>;
+#X text 469 348 b) example2 \, XML:;
+#X text 503 415 <key>;
+#X text 504 456 </key>;
+#X text 503 468 <value>;
+#X text 504 494 </value>;
+#X text 487 519 <element>;
+#X text 489 621 </element>;
+#X text 504 532 <key>;
+#X text 505 559 </key>;
+#X text 504 571 <value>;
+#X text 505 609 </value>;
+#X text 520 545 <s> go </s>;
+#X text 521 584 <s> not </s>;
+#X text 521 597 <f> 34 </f>;
+#X text 476 668 b) example2 \, textfile:;
+#X restore 550 116 pd Fileformats;
+#X text 218 709 htttp://grh.mur.at/software/pdcontainer.html;
+#X text 178 693 =%)!(%= PDContainer \, by Georg Holzmann <grh@mur.at>
+\, 2004;
+#X connect 5 0 22 0;
+#X connect 6 0 22 0;
+#X connect 8 0 22 0;
+#X connect 9 0 22 0;
+#X connect 13 0 22 0;
+#X connect 22 0 10 0;
+#X connect 22 1 23 0;
+#X connect 22 2 7 0;
+#X connect 24 0 11 0;
+#X connect 24 1 25 0;
+#X connect 24 2 0 0;
+#X connect 26 0 22 0;
+#X connect 29 0 24 0;
+#X connect 30 0 29 0;
+#X connect 31 0 29 0;
+#X connect 34 0 24 0;
+#X connect 38 0 24 0;
diff --git a/PDContainer/help/help-h_vector.pd b/PDContainer/help/help-h_vector.pd
new file mode 100755
index 0000000..618af69
--- /dev/null
+++ b/PDContainer/help/help-h_vector.pd
@@ -0,0 +1,444 @@
+#N canvas 0 54 830 880 10;
+#X obj 157 404 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#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;
+#X text 295 36 help file of;
+#X text 40 98 init arg: namespace;
+#X msg 480 313 print;
+#X msg 480 357 clear;
+#X msg 480 671 help;
+#X obj 566 721 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X msg 480 254 getnamespace;
+#X msg 480 395 clearall;
+#X obj 480 770 print BBB;
+#X obj 71 443 print AAA;
+#X text 591 279 <- change namespace;
+#X msg 480 278 namespace grix;
+#X text 527 314 <- print all the data of the;
+#X text 546 329 current namespace;
+#X text 528 357 <- clear all the data of the;
+#X text 549 372 current namespace;
+#X text 548 397 <- clear all the data in all;
+#X text 569 412 same containers (maybe;
+#X text 571 427 you shouldn't use this);
+#X text 580 256 <- get current namespace;
+#X text 512 213 general operations:;
+#X msg 297 366 list damm 4345 it;
+#X floatatom 297 272 5 0 0 0 - - -;
+#X symbolatom 297 290 10 0 0 0 - - -;
+#X msg 297 342 hacka 45;
+#X msg 297 319 3 4 krschi;
+#X text 307 241 value:;
+#X text 279 54 ::: h_vector :::;
+#X text 31 143 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 msg 480 608 resize \$1;
+#X msg 480 642 getsize;
+#X floatatom 488 580 5 0 0 0 - - -;
+#X text 556 609 <- resizes the vector;
+#X obj 480 698 h_vector klax;
+#X floatatom 523 741 5 0 0 0 - - -;
+#X text 545 641 <- get the size (at 2nd;
+#X text 567 655 outlet);
+#X text 567 740 <- size of vector;
+#X obj 71 383 h_vector klax;
+#X floatatom 114 422 5 0 0 0 - - -;
+#X msg 71 290 get \$1;
+#X floatatom 77 269 5 0 0 0 - - -;
+#X floatatom 77 226 5 0 0 0 - - -;
+#X msg 71 247 set \$1;
+#X msg 71 698 insert \$1;
+#X floatatom 78 671 5 0 0 0 - - -;
+#X floatatom 79 721 5 0 0 0 - - -;
+#X msg 70 744 remove \$1;
+#X text 127 246 <- changes the value;
+#X text 148 260 at that index;
+#X text 145 304 at that index;
+#X text 124 290 <- get the value;
+#X text 177 404 <- bang if not found;
+#X msg 70 526 pushback gsdfg 34;
+#X msg 70 572 popback;
+#X obj 70 622 h_vector klax;
+#X floatatom 70 481 5 0 0 0 - - -;
+#X msg 70 503 pushback \$1;
+#X text 166 503 <- inserts the data at the;
+#X text 223 518 back of the vector;
+#X text 230 532 (so the size will;
+#X text 230 545 increase);
+#X text 131 571 <- removes the element from the;
+#X text 154 586 back (so the size will decrease);
+#X msg 178 768 some data;
+#X text 152 671 remove and insert at index:;
+#X text 188 708 If you need this very often you;
+#X text 188 722 should better use a list or a map;
+#X text 187 694 Thats not very fast with a vector!;
+#X text 188 735 (or something else) !;
+#X obj 70 768 h_vector klax;
+#X symbolatom 115 481 10 0 0 0 - - -;
+#X obj 500 24 cnv 15 204 120 empty empty empty 20 12 0 14 -66577 -66577
+0;
+#X obj 502 26 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 62 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 90 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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 37 353 <PDContainer type="h_list">;
+#X text 54 366 <element>;
+#X text 70 379 <f> 2 </f>;
+#X text 70 405 <f> 2 </f>;
+#X text 56 418 </element>;
+#X text 70 391 <s> wow </s>;
+#X text 56 431 <element>;
+#X text 57 455 </element>;
+#X text 72 443 <s> go </s>;
+#X text 56 468 <element>;
+#X text 57 492 </element>;
+#X text 72 480 <f> 23 </f>;
+#X text 41 506 </PDContainer>;
+#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 <?xml version="1.0" encoding="ISO-8859-1" ?>;
+#X text 469 389 <PDContainer type="h_list">;
+#X text 486 402 <element>;
+#X text 519 430 <f> 2 </f>;
+#X text 520 482 <f> 2 </f>;
+#X text 488 506 </element>;
+#X text 519 442 <s> wow </s>;
+#X text 475 634 </PDContainer>;
+#X text 469 348 b) example2 \, XML:;
+#X text 503 415 <key>;
+#X text 504 456 </key>;
+#X text 503 468 <value>;
+#X text 504 494 </value>;
+#X text 487 519 <element>;
+#X text 489 621 </element>;
+#X text 504 532 <key>;
+#X text 505 559 </key>;
+#X text 504 571 <value>;
+#X text 505 609 </value>;
+#X text 520 545 <s> go </s>;
+#X text 521 584 <s> not </s>;
+#X text 521 597 <f> 34 </f>;
+#X text 476 668 b) example2 \, textfile:;
+#X restore 550 116 pd Fileformats;
+#X text 238 841 htttp://grh.mur.at/software/pdcontainer.html;
+#X text 198 825 =%)!(%= PDContainer \, by Georg Holzmann <grh@mur.at>
+\, 2004;
+#N canvas 174 18 646 402 read_save_possibilities 0;
+#X obj 44 336 outlet;
+#X msg 44 208 save data.dat;
+#X msg 44 244 read data.dat;
+#X msg 44 288 readat data.dat 0;
+#X text 149 208 <- save all the data of the current namespace as textfile
+;
+#X text 143 244 <- read this textfile to the current namespace and
+insert it at the back (so the size will increase);
+#X text 177 287 <- read the textfile and insert it at the given index
+(so the size won't increase !);
+#X text 166 94 <- read this XML-file to the current namespace and insert
+it at the back (so the size will increase);
+#X text 169 61 <- save all the data of the current namespace as XML-file
+;
+#X text 196 139 <- read the XML-file and insert it at the given index
+(so the size won't increase !);
+#X msg 44 61 saveXML data.xml;
+#X msg 44 93 readXML data.xml;
+#X msg 44 139 readatXML data.xml 0;
+#X connect 1 0 0 0;
+#X connect 2 0 0 0;
+#X connect 3 0 0 0;
+#X connect 10 0 0 0;
+#X connect 11 0 0 0;
+#X connect 12 0 0 0;
+#X restore 480 476 pd read_save_possibilities;
+#X text 520 500 different possiblities to read;
+#X text 520 514 and write from and to files;
+#X text 519 529 (XML and textfiles);
+#X connect 5 0 36 0;
+#X connect 6 0 36 0;
+#X connect 7 0 36 0;
+#X connect 9 0 36 0;
+#X connect 10 0 36 0;
+#X connect 14 0 36 0;
+#X connect 24 0 41 1;
+#X connect 25 0 41 1;
+#X connect 26 0 41 1;
+#X connect 27 0 41 1;
+#X connect 28 0 41 1;
+#X connect 32 0 36 0;
+#X connect 33 0 36 0;
+#X connect 34 0 32 0;
+#X connect 36 0 11 0;
+#X connect 36 1 37 0;
+#X connect 36 2 8 0;
+#X connect 41 0 12 0;
+#X connect 41 1 42 0;
+#X connect 41 2 0 0;
+#X connect 43 0 41 0;
+#X connect 44 0 43 0;
+#X connect 45 0 46 0;
+#X connect 46 0 41 0;
+#X connect 47 0 73 0;
+#X connect 48 0 47 0;
+#X connect 49 0 50 0;
+#X connect 50 0 73 0;
+#X connect 56 0 58 0;
+#X connect 57 0 58 0;
+#X connect 59 0 60 0;
+#X connect 60 0 58 0;
+#X connect 67 0 73 1;
+#X connect 74 0 60 0;
+#X connect 82 0 36 0;
diff --git a/PDContainer/include/ContainerBase.h b/PDContainer/include/ContainerBase.h
new file mode 100755
index 0000000..c32a22a
--- /dev/null
+++ b/PDContainer/include/ContainerBase.h
@@ -0,0 +1,136 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// ContainerBase.h
+
+
+#ifndef _container_base_h___
+#define _container_base_h___
+
+
+#include "include/GlobalStuff.h"
+#include <map>
+
+using std::map;
+
+
+//---------------------------------------------------
+/* this is the base class of all the containers
+ */
+template <class ContainerType, class ContTypeIterator>
+class ContainerBase
+{
+ protected:
+
+ /* this is the static container with all the datas
+ * the string is the namespace of the Container
+ */
+ static map<string,ContainerType> data_;
+
+ /* holds the number of the current namespace
+ * (the string of the namespace is stored in the map above)
+ */
+ string h_namespace_;
+
+ /* this string is the name of the datatype
+ * (e.g. h_set, h_map, ...)
+ */
+ string dataname_;
+
+ private:
+
+ /* Copy Construction is not allowed
+ */
+ ContainerBase(const ContainerBase<ContainerType,ContTypeIterator> &src)
+ { }
+
+ /* assignement operator is not allowed
+ */
+ const ContainerBase<ContainerType,ContTypeIterator>& operator =
+ (const ContainerBase<ContainerType,ContTypeIterator>&)
+ { }
+
+ public:
+
+ /* Standard Constructor
+ * no namespace
+ */
+ ContainerBase()
+ { }
+
+ /* Destructor
+ */
+ virtual ~ContainerBase()
+ { }
+
+ /* sets the namespace variable
+ */
+ void setNamespace(string h_namespace)
+ {
+ h_namespace_ = h_namespace;
+ //ContainerType container;
+ //data_.insert(std::pair<string,ContainerType>(h_namespace_,container));
+ }
+
+ /* get the namespace string
+ */
+ string getNamespace() const
+ { return h_namespace_; }
+
+ /* prints out the help text
+ */
+ virtual void help();
+
+ /* clears all the data of the current namespaces
+ * in all objects from the same container
+ */
+ virtual void clearNamespace()
+ { data_.erase(h_namespace_); }
+
+ /* clears all the data of the current container
+ * ( in all namespaces !!!!! )
+ * so be carefull !!!
+ */
+ virtual void clearAll()
+ { data_.clear(); }
+
+ /* get the size of the container
+ */
+ virtual int getSize() const
+ { return data_[h_namespace_].size(); }
+};
+
+
+//---------------------------------------------------
+/* defines the static members
+ */
+template<class ContainerType, class ContTypeIterator>
+map<string,ContainerType> ContainerBase<ContainerType,ContTypeIterator>::data_;
+
+//---------------------------------------------------
+/* prints out the help text
+ */
+template<class ContainerType, class ContTypeIterator>
+void ContainerBase<ContainerType,ContTypeIterator>::help()
+{
+ post("\nPD-Container, Version: "PDC_VERSION"");
+ post("object: %s",dataname_.c_str());
+ post("------------------------------------------");
+ post("this is an implementation of the container");
+ post("objects from the Standard Template");
+ post("Library (STL) of C++");
+ post("for documentation see the help patches");
+ post("(by Georg Holzmann <grh@mur.at>, 2004-2005)");
+ post("------------------------------------------\n");
+}
+
+
+
+#endif //_container_base_h___
diff --git a/PDContainer/include/GlobalStuff.h b/PDContainer/include/GlobalStuff.h
new file mode 100755
index 0000000..6cb96cc
--- /dev/null
+++ b/PDContainer/include/GlobalStuff.h
@@ -0,0 +1,274 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// GlobalStuff.h
+
+
+#ifndef _global_stuff_h___
+#define _global_stuff_h___
+
+
+#include "m_pd.h"
+#include <string>
+#include <sstream>
+#include <fstream>
+#include <iterator>
+#include <list>
+//#include <iostream> //DEBUG
+
+using std::string;
+using std::ostringstream;
+using std::istringstream;
+using std::ofstream;
+using std::ifstream;
+using std::endl;
+
+
+// current version
+#define PDC_VERSION "0.2"
+
+
+// TinyXML
+//#define TIXML_USE_STL
+#include "tinyxml/tinyxml.h"
+
+
+//---------------------------------------------------
+/* This function compares two pd t_atoms
+ */
+static bool compareAtoms(t_atom &atom1, t_atom &atom2)
+{
+ if(atom1.a_type == A_FLOAT && atom2.a_type == A_FLOAT)
+ return (atom1.a_w.w_float == atom2.a_w.w_float);
+
+ if(atom1.a_type == A_SYMBOL && atom2.a_type == A_SYMBOL)
+ return (strcmp(atom1.a_w.w_symbol->s_name,
+ atom2.a_w.w_symbol->s_name) == 0);
+
+ if(atom1.a_type == A_POINTER && atom2.a_type == A_POINTER)
+ return (atom1.a_w.w_gpointer == atom2.a_w.w_gpointer);
+
+ return false;
+}
+
+
+//---------------------------------------------------
+/* one Element holds one data element, which can be
+ * a list, a float or a symbol
+ */
+class Element
+{
+ private:
+ t_atom *atom;
+ int length;
+
+ public:
+ Element() : atom(NULL), length(0)
+ { }
+
+ Element(int size_, t_atom *atom_) : atom(NULL), length(0)
+ {
+ if(atom_ && size_)
+ {
+ length = size_;
+
+ // !!!! FIXME !!!!
+ // hack to avoid lockating too much memory
+ // (somewhere I read an uninitialized value ...
+ // ... but where !?)
+ if(length>999)
+ {
+ post("Element, constr1: invalid construction !!! should be fixed !!!");
+ length=0;
+ atom=NULL;
+ return;
+ }
+
+ atom = (t_atom*)copybytes(atom_, length*sizeof(t_atom));
+ }
+ }
+
+ // Copy Constr.
+ Element(const Element &src) : atom(NULL), length(0)
+ {
+ if(src.atom)
+ {
+ length = src.length;
+
+ // !!!! FIXME !!!!
+ // hack to avoid lockating too much memory
+ // (somewhere I read an uninitialized value ...
+ // ... but where !?)
+ if(length>999)
+ {
+ post("Element, constr2: invalid construction !!! should be fixed !!!");
+ length=0;
+ atom=NULL;
+ return;
+ }
+
+ atom = (t_atom*)copybytes(src.atom, length*sizeof(t_atom));
+ }
+ }
+
+ // Destructor
+ ~Element()
+ {
+ if(atom)
+ freebytes(atom, length*sizeof(t_atom));
+ }
+
+ // set atoms and length
+ void setAtoms(int size_, t_atom *atom_)
+ {
+ if(atom)
+ {
+ freebytes(atom, length*sizeof(t_atom));
+ length=0;
+ atom=NULL;
+ }
+
+ if(atom_)
+ {
+ length = size_;
+
+ // !!!! FIXME !!!!
+ // hack to avoid lockating too much memory
+ // (somewhere I read an uninitialized value ...
+ // ... but where !?)
+ if(length>999)
+ {
+ post("Element, setAtoms: invalid construction !!! should be fixed !!!");
+ length=0;
+ atom=NULL;
+ return;
+ }
+
+ atom = (t_atom*)copybytes(atom_, length*sizeof(t_atom));
+ }
+ }
+
+ int getLength()
+ { return length; }
+
+ // shallow copy !!!
+ t_atom *getAtom()
+ { return atom; }
+
+ //Assignement Operator
+ const Element& operator = (const Element &src)
+ {
+ if(atom)
+ {
+ freebytes(atom, length*sizeof(t_atom));
+ length=0;
+ atom=NULL;
+ }
+
+ if(src.atom)
+ {
+ length = src.length;
+
+ // !!!! FIXME !!!!
+ // hack to avoid lockating too much memory
+ // (somewhere I read an uninitialized value ...
+ // ... but where !?)
+ if(length>999)
+ {
+ post("Element, assignment: invalid construction !!! should be fixed !!!");
+ length=0;
+ atom=NULL;
+ return (*this);
+ }
+
+ atom = (t_atom*)copybytes(src.atom, length*sizeof(t_atom));
+ }
+
+ return (*this);
+ }
+
+ // operator== to compare the objects
+ bool operator== (const Element &key) const
+ {
+ if (length != key.length)
+ return false;
+
+ for (int i=0; i < length; i++)
+ {
+ if(!compareAtoms(atom[i],key.atom[i]))
+ return false;
+ }
+
+ return true;
+ }
+
+ // operator< to compare the objects
+ // (needed by map, set, ...)
+ bool operator< (const Element &key) const
+ {
+ if (length == key.length)
+ {
+ bool difference = false;
+ int index;
+
+ for (index = 0; index<length; index++)
+ {
+ if(!compareAtoms(atom[index],key.atom[index]))
+ {
+ difference = true;
+ break;
+ }
+ }
+
+ // definition:
+ // A_FLOAT < A_SYMBOL < A_POINTER
+
+ if( atom[index].a_type == A_FLOAT
+ && key.atom[index].a_type != A_FLOAT )
+ return true;
+
+ if( atom[index].a_type == A_SYMBOL )
+ {
+ if( key.atom[index].a_type == A_FLOAT )
+ return false;
+ if( key.atom[index].a_type == A_POINTER )
+ return true;
+ }
+
+
+ // compare, when they are the same type:
+
+ if( atom[index].a_type == A_POINTER
+ && key.atom[index].a_type != A_POINTER )
+ return false;
+
+ if( atom[index].a_type == A_FLOAT
+ && key.atom[index].a_type == A_FLOAT )
+ return (atom[index].a_w.w_float < key.atom[index].a_w.w_float);
+
+ if( atom[index].a_type == A_SYMBOL
+ && key.atom[index].a_type == A_SYMBOL )
+ return (strcmp(atom[index].a_w.w_symbol->s_name,
+ key.atom[index].a_w.w_symbol->s_name) < 0);
+
+ if( atom[index].a_type == A_POINTER
+ && key.atom[index].a_type == A_POINTER )
+ return (atom[index].a_w.w_gpointer < key.atom[index].a_w.w_gpointer);
+
+ return false;
+ } // different length
+ else
+ return (length < key.length);
+
+ }
+};
+
+
+#endif //_global_stuff_h___
diff --git a/PDContainer/include/HDeque.h b/PDContainer/include/HDeque.h
new file mode 100755
index 0000000..02600cf
--- /dev/null
+++ b/PDContainer/include/HDeque.h
@@ -0,0 +1,80 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HDeque.h
+
+#ifndef _h_deque_h__
+#define _h_deque_h__
+
+
+#include "include/SequBase.h"
+#include <deque>
+
+using std::deque;
+
+
+//---------------------------------------------------
+/* this is the class of the deque
+ */
+class HDeque :
+public SequBase< deque<Element>, deque<Element>::iterator >
+{
+
+ private:
+
+ /* Copy Construction is not allowed
+ */
+ HDeque(const HDeque &src)
+ { }
+
+ /* assignement operator is not allowed
+ */
+ const HDeque& operator = (const HDeque&)
+ { return *this; }
+
+ public:
+
+ /* Standard Constructor
+ * no namespace
+ */
+ HDeque()
+ { dataname_ = "h_deque"; }
+
+ /* Constructor
+ * with a namespace
+ */
+ HDeque(string h_namespace)
+ {
+ dataname_ = "h_deque";
+ setNamespace(h_namespace);
+ }
+
+ /* Destructor
+ */
+ virtual ~HDeque() { }
+
+ /* inserts an element at the front of
+ * the container (so then the size
+ * increases by one !!!)
+ */
+ virtual void pushFront(Element value)
+ { data_[h_namespace_].push_front(value); }
+
+ /* removes the element from the front of
+ * the container (so then the size
+ * decreases by one !!!)
+ */
+ virtual void popFront()
+ { data_[h_namespace_].pop_front(); }
+};
+
+
+
+#endif //_h_deque_h__
diff --git a/PDContainer/include/HList.h b/PDContainer/include/HList.h
new file mode 100755
index 0000000..b8a5768
--- /dev/null
+++ b/PDContainer/include/HList.h
@@ -0,0 +1,250 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HList.h
+
+#ifndef _h_list_h__
+#define _h_list_h__
+
+
+#include "include/SimpleBase.h"
+#include <list>
+
+using std::list;
+
+
+//---------------------------------------------------
+/* this is the class of the list
+ */
+class HList :
+public SimpleBase< list<Element>, list<Element>::iterator >
+{
+ protected:
+ /* this integer holds the current position of the
+ * iterator, because accessing the iterator directly
+ * from PD is very buggy...
+ * (maybe I'll change this !)
+ */
+ int i_pos_;
+
+ /* the internal iterator, you can navigate
+ * through the container with it
+ */
+ list<Element>::iterator iter_;
+
+ private:
+
+ /* Copy Construction is not allowed
+ */
+ HList(const HList &src)
+ { }
+
+ /* assignement operator is not allowed
+ */
+ const HList& operator = (const HList&)
+ { return *this; }
+
+ public:
+
+ /* Standard Constructor
+ * no namespace
+ */
+ HList()
+ {
+ dataname_ = "h_list";
+ i_pos_=0;
+ }
+
+ /* Constructor
+ * with a namespace
+ */
+ HList(string h_namespace)
+ {
+ dataname_ = "h_list";
+ setNamespace(h_namespace);
+ i_pos_=0;
+ }
+
+ /* Destructor
+ */
+ virtual ~HList() { }
+
+ /* inserts an element at the end of
+ * the container
+ */
+ virtual void pushBack(Element value)
+ { data_[h_namespace_].push_back(value); }
+
+ /* removes the element from the end of
+ * the container
+ */
+ virtual void popBack()
+ { data_[h_namespace_].pop_back(); }
+
+ /* inserts an element at the end of
+ * the container
+ */
+ virtual void pushFront(Element value)
+ { data_[h_namespace_].push_front(value); }
+
+ /* removes the element from the end of
+ * the container
+ */
+ virtual void popFront()
+ { data_[h_namespace_].pop_front(); }
+
+ /* returns the last element
+ */
+ virtual Element &back() const
+ { return data_[h_namespace_].back(); }
+
+ /* returns the first element
+ */
+ virtual Element &front() const
+ { return data_[h_namespace_].front(); }
+
+ /* inserts an element at the current
+ * iterator position
+ */
+ virtual void insert(Element value)
+ {
+ makeIterator();
+ data_[h_namespace_].insert(iter_, value);
+ i_pos_++;
+ }
+
+ /* overrides the element at the current
+ * iterator position
+ */
+ virtual void modify(Element value)
+ {
+ makeIterator();
+ *iter_=value;
+ }
+
+
+ /* gives back the element at the current
+ * iterator position
+ */
+ virtual Element get()
+ {
+ makeIterator();
+
+ // key was not found if iterator is pointing to the end
+ if(iter_ == data_[h_namespace_].end())
+ throw "h_list, get: Element not found !";
+
+ return *iter_;
+ }
+
+ /* removes all elements with that value
+ */
+ virtual void remove(Element value)
+ { data_[h_namespace_].remove(value); }
+
+ /* removes an element at the current
+ * iterator position
+ */
+ virtual void del()
+ {
+ makeIterator();
+
+ if(data_[h_namespace_].size() == 0)
+ return;
+
+ if(iter_ == data_[h_namespace_].end())
+ {
+ post("h_list, delete: not possible, go back by 1 (iterator points to the element after the end) !!!");
+ return;
+ }
+
+ data_[h_namespace_].erase(iter_);
+ }
+
+ /* get the size of the sequence
+ */
+ virtual int getSize() const
+ { return data_[h_namespace_].size(); }
+
+ /* set current iterator position
+ */
+ virtual void setIterPos(int position)
+ { i_pos_ = position; }
+
+ /* get the current iterator position
+ */
+ virtual int getIterPos()
+ {
+ makeIterator();
+ return i_pos_;
+ }
+
+ /* sets the iterator position the the begin
+ * of the list
+ */
+ virtual void begin()
+ { i_pos_ = 0; }
+
+ /* sets the iterator position the the end
+ * of the list
+ */
+ virtual void end()
+ { i_pos_ = data_[h_namespace_].size(); }
+
+ /* increases the iterator position by one
+ */
+ virtual void next()
+ { i_pos_++; }
+
+ /* decreases the iterator position by one
+ */
+ virtual void last()
+ { i_pos_--; }
+
+ /* removes all but the first element in every
+ * consecutive group of equal elements
+ */
+ virtual void unique()
+ { data_[h_namespace_].unique(); }
+
+ /* reverses the order of elements in the list
+ */
+ virtual void reverse()
+ { data_[h_namespace_].reverse(); }
+
+ /* sorts the list according to operator<
+ */
+ virtual void sort()
+ { data_[h_namespace_].sort(); }
+
+ /* reads from file
+ */
+ virtual bool readFromFile(string filename);
+
+ private:
+ /* generates the current iterator position
+ */
+ void makeIterator()
+ {
+ if(i_pos_<0)
+ i_pos_=0;
+
+ if((unsigned)i_pos_ > data_[h_namespace_].size())
+ i_pos_=data_[h_namespace_].size();
+
+ // this is a hack to make the iterator, I'll change this !
+ iter_=data_[h_namespace_].begin();
+ for(int i = 0; i<i_pos_; i++) iter_++;
+ }
+};
+
+
+
+#endif //_h_list_h__
diff --git a/PDContainer/include/HMap.h b/PDContainer/include/HMap.h
new file mode 100755
index 0000000..0f68497
--- /dev/null
+++ b/PDContainer/include/HMap.h
@@ -0,0 +1,67 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HMap.h
+
+
+#ifndef _h_map_h__
+#define _h_map_h__
+
+#include "include/MapBase.h"
+
+using std::map;
+
+//---------------------------------------------------
+/* this is the class of the map
+ */
+class HMap :
+public MapBase< map<Element,Element>, map<Element,Element>::iterator >
+{
+ // gcc4.0 food:
+ //this->data_;
+ //this->h_namespace_;
+ //this->dataname_;
+
+ private:
+
+ /* Copy Construction is not allowed
+ */
+ HMap(const HMap &src)
+ { }
+
+ /* assignement operator is not allowed
+ */
+ const HMap& operator = (const HMap&)
+ { return *this; }
+
+ public:
+
+ /* Constructor
+ * no namespace
+ */
+ HMap()
+ { dataname_ = "h_map"; }
+
+ /* Constructor
+ * with a namespace
+ */
+ HMap(string h_namespace)
+ {
+ dataname_ = "h_map";
+ setNamespace(h_namespace);
+ }
+
+ /* Destructor
+ */
+ virtual ~HMap() { }
+};
+
+
+#endif // _h_map_h__
diff --git a/PDContainer/include/HMultiMap.h b/PDContainer/include/HMultiMap.h
new file mode 100755
index 0000000..0c7a9f7
--- /dev/null
+++ b/PDContainer/include/HMultiMap.h
@@ -0,0 +1,80 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HMultiMap.h
+
+
+#ifndef _h_multi_map_h__
+#define _h_multi_map_h__
+
+#include "include/MapBase.h"
+
+using std::multimap;
+
+//---------------------------------------------------
+/* this is the class of the map
+ */
+class HMultiMap :
+public MapBase< multimap<Element,Element>, multimap<Element,Element>::iterator >
+{
+
+ private:
+
+ /* Copy Construction is not allowed
+ */
+ HMultiMap(const HMultiMap &src)
+ { }
+
+ /* assignement operator is not allowed
+ */
+ const HMultiMap& operator = (const HMultiMap&)
+ { return *this; }
+
+ public:
+
+ /* Constructor
+ * no namespace
+ */
+ HMultiMap()
+ { dataname_ = "h_multimap"; }
+
+ /* Constructor
+ * with a namespace
+ */
+ HMultiMap(string h_namespace)
+ {
+ dataname_ = "h_multimap";
+ setNamespace(h_namespace);
+ }
+
+ /* Destructor
+ */
+ virtual ~HMultiMap() { }
+
+ /* Add a key-value pair
+ */
+ virtual void add(Element key, Element value)
+ {
+ this->data_[this->h_namespace_].insert(std::pair<Element,Element>(key,value));
+ }
+
+ /* Get the Nr. of values from the specific Key
+ */
+ virtual int getNr(Element &key) const
+ { return data_[h_namespace_].count(key); }
+
+ /* Get a value from the specific Key with the index number
+ * index starts with 0
+ */
+ virtual Element &get(Element &key, int index) const;
+};
+
+
+#endif // _h_multi_map_h__
diff --git a/PDContainer/include/HMultiSet.h b/PDContainer/include/HMultiSet.h
new file mode 100755
index 0000000..7bfc36f
--- /dev/null
+++ b/PDContainer/include/HMultiSet.h
@@ -0,0 +1,81 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HMultiSet.h
+
+
+#ifndef _h_multi_set_h__
+#define _h_multi_set_h__
+
+#include "include/SimpleBase.h"
+#include <set>
+
+using std::multiset;
+
+//---------------------------------------------------
+/* this is the class of the set
+ */
+class HMultiSet :
+public SimpleBase< multiset<Element>, multiset<Element>::iterator >
+{
+
+ private:
+
+ /* Copy Construction is not allowed
+ */
+ HMultiSet(const HMultiSet &src)
+ { }
+
+ /* assignement operator is not allowed
+ */
+ const HMultiSet& operator = (const HMultiSet&)
+ { return *this; }
+
+ public:
+
+ /* Constructor
+ * no namespace
+ */
+ HMultiSet()
+ { dataname_ = "h_multiset"; }
+
+ /* Constructor
+ * with a namespace
+ */
+ HMultiSet(string h_namespace)
+ {
+ dataname_ = "h_multiset";
+ setNamespace(h_namespace);
+ }
+
+ /* Destructor
+ */
+ virtual ~HMultiSet() { }
+
+ /* add an element
+ */
+ virtual void add(Element key)
+ { data_[h_namespace_].insert(key); }
+
+ /* look if the element is set
+ * returns how often this element was set
+ * 0 if it isn't set
+ */
+ virtual int get(const Element &key) const
+ { return data_[h_namespace_].count(key); }
+
+ /* removes an element from the container
+ */
+ virtual void remove(const Element &key) const
+ { data_[h_namespace_].erase(key); }
+};
+
+
+#endif // _h_multi_set_h__
diff --git a/PDContainer/include/HPrioQueue.h b/PDContainer/include/HPrioQueue.h
new file mode 100755
index 0000000..d1bddda
--- /dev/null
+++ b/PDContainer/include/HPrioQueue.h
@@ -0,0 +1,100 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HPriority_Queue.h
+
+#ifndef _h_priority_queue_h__
+#define _h_priority_queue_h__
+
+
+#include "include/QueueStack.h"
+#include <queue>
+
+using std::priority_queue;
+
+class ElementPrio
+{
+ public:
+ Element element;
+ float priority;
+
+ bool operator< (const ElementPrio &key) const
+ {
+ return (priority < key.priority);
+ }
+ const ElementPrio& operator = (const ElementPrio &src)
+ {
+ priority = src.priority;
+ element = src.element;
+ return (*this);
+ }
+};
+
+//---------------------------------------------------
+/* this is the class of the priority_queue
+ */
+class HPrioQueue :
+public QueueStack< priority_queue<ElementPrio>, int >
+{
+
+ private:
+
+ /* Copy Construction is not allowed
+ */
+ HPrioQueue(const HPrioQueue &src)
+ { }
+
+ /* assignement operator is not allowed
+ */
+ const HPrioQueue& operator = (const HPrioQueue&)
+ { return *this; }
+
+ public:
+
+ /* Standard Constructor
+ * no namespace
+ */
+ HPrioQueue()
+ { dataname_ = "h_priority_queue"; }
+
+ /* Constructor
+ * with a namespace
+ */
+ HPrioQueue(string h_namespace)
+ {
+ dataname_ = "h_priority_queue";
+ setNamespace(h_namespace);
+ }
+
+ /* Destructor
+ */
+ virtual ~HPrioQueue() { }
+
+ /* inserts an element in the container
+ */
+ virtual void push(float prio, Element value)
+ {
+ ElementPrio data;
+ data.priority = prio;
+ data.element = value;
+
+ data_[h_namespace_].push(data);
+ }
+
+ /* returns the element from the top of
+ * the stack
+ */
+ virtual Element top() const
+ { return data_[h_namespace_].top().element; }
+};
+
+
+
+#endif //_h_priority_queue_h__
diff --git a/PDContainer/include/HQueue.h b/PDContainer/include/HQueue.h
new file mode 100755
index 0000000..025fe52
--- /dev/null
+++ b/PDContainer/include/HQueue.h
@@ -0,0 +1,77 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HQueue.h
+
+#ifndef _h_queue_h__
+#define _h_queue_h__
+
+
+#include "include/QueueStack.h"
+#include <queue>
+
+using std::queue;
+
+
+//---------------------------------------------------
+/* this is the class of the queue
+ */
+class HQueue :
+public QueueStack< queue<Element>, int >
+{
+
+ private:
+
+ /* Copy Construction is not allowed
+ */
+ HQueue(const HQueue &src)
+ { }
+
+ /* assignement operator is not allowed
+ */
+ const HQueue& operator = (const HQueue&)
+ { return *this; }
+
+ public:
+
+ /* Standard Constructor
+ * no namespace
+ */
+ HQueue()
+ { dataname_ = "h_queue"; }
+
+ /* Constructor
+ * with a namespace
+ */
+ HQueue(string h_namespace)
+ {
+ dataname_ = "h_queue";
+ setNamespace(h_namespace);
+ }
+
+ /* Destructor
+ */
+ virtual ~HQueue() { }
+
+ /* inserts an element in the container
+ */
+ virtual void push(Element value)
+ { data_[h_namespace_].push(value); }
+
+ /* returns the element from the top of
+ * the stack
+ */
+ virtual Element &front() const
+ { return data_[h_namespace_].front(); }
+};
+
+
+
+#endif //_h_queue_h__
diff --git a/PDContainer/include/HSet.h b/PDContainer/include/HSet.h
new file mode 100755
index 0000000..231b909
--- /dev/null
+++ b/PDContainer/include/HSet.h
@@ -0,0 +1,82 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HSet.h
+
+
+#ifndef _h_set_h__
+#define _h_set_h__
+
+#include "include/SimpleBase.h"
+#include <set>
+
+using std::set;
+
+//---------------------------------------------------
+/* this is the class of the set
+ */
+class HSet :
+public SimpleBase< set<Element>, set<Element>::iterator >
+{
+
+ private:
+
+ /* Copy Construction is not allowed
+ */
+ HSet(const HSet &src)
+ { }
+
+ /* assignement operator is not allowed
+ */
+ const HSet& operator = (const HSet&)
+ { return *this; }
+
+ public:
+
+ /* Constructor
+ * no namespace
+ */
+ HSet()
+ { dataname_ = "h_set"; }
+
+ /* Constructor
+ * with a namespace
+ */
+ HSet(string h_namespace)
+ {
+ dataname_ = "h_set";
+ setNamespace(h_namespace);
+ }
+
+ /* Destructor
+ */
+ virtual ~HSet() { }
+
+ /* add an element
+ */
+ virtual void add(Element key)
+ { data_[h_namespace_].insert(key); }
+
+ /* look if the element is set
+ * returns 1 if it is set
+ * 0 if it isn't set
+ */
+ virtual int get(const Element &key) const
+ { return (data_[h_namespace_].find(key)
+ != data_[h_namespace_].end()); }
+
+ /* removes an element from the container
+ */
+ virtual void remove(const Element &key) const
+ { data_[h_namespace_].erase(key); }
+};
+
+
+#endif // _h_set_h__
diff --git a/PDContainer/include/HStack.h b/PDContainer/include/HStack.h
new file mode 100755
index 0000000..8050af9
--- /dev/null
+++ b/PDContainer/include/HStack.h
@@ -0,0 +1,77 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HStack.h
+
+#ifndef _h_stack_h__
+#define _h_stack_h__
+
+
+#include "include/QueueStack.h"
+#include <stack>
+
+using std::stack;
+
+
+//---------------------------------------------------
+/* this is the class of the stack
+ */
+class HStack :
+public QueueStack< stack<Element>, int >
+{
+
+ private:
+
+ /* Copy Construction is not allowed
+ */
+ HStack(const HStack &src)
+ { }
+
+ /* assignement operator is not allowed
+ */
+ const HStack& operator = (const HStack&)
+ { return *this; }
+
+ public:
+
+ /* Standard Constructor
+ * no namespace
+ */
+ HStack()
+ { dataname_ = "h_stack"; }
+
+ /* Constructor
+ * with a namespace
+ */
+ HStack(string h_namespace)
+ {
+ dataname_ = "h_stack";
+ setNamespace(h_namespace);
+ }
+
+ /* Destructor
+ */
+ virtual ~HStack() { }
+
+ /* inserts an element in the container
+ */
+ virtual void push(Element value)
+ { data_[h_namespace_].push(value); }
+
+ /* returns the element from the top of
+ * the stack
+ */
+ virtual Element &top() const
+ { return data_[h_namespace_].top(); }
+};
+
+
+
+#endif //_h_stack_h__
diff --git a/PDContainer/include/HVector.h b/PDContainer/include/HVector.h
new file mode 100755
index 0000000..933da80
--- /dev/null
+++ b/PDContainer/include/HVector.h
@@ -0,0 +1,66 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HVector.h
+
+#ifndef _h_vector_h__
+#define _h_vector_h__
+
+
+#include "include/SequBase.h"
+#include <vector>
+
+using std::vector;
+
+
+//---------------------------------------------------
+/* this is the class of the vector
+ */
+class HVector :
+public SequBase< vector<Element>, vector<Element>::iterator >
+{
+
+ private:
+
+ /* Copy Construction is not allowed
+ */
+ HVector(const HVector &src)
+ { }
+
+ /* assignement operator is not allowed
+ */
+ const HVector& operator = (const HVector&)
+ { return *this; }
+
+ public:
+
+ /* Standard Constructor
+ * no namespace
+ */
+ HVector()
+ { dataname_ = "h_vector"; }
+
+ /* Constructor
+ * with a namespace
+ */
+ HVector(string h_namespace)
+ {
+ dataname_ = "h_vector";
+ setNamespace(h_namespace);
+ }
+
+ /* Destructor
+ */
+ virtual ~HVector() { }
+};
+
+
+
+#endif //_h_vector_h__
diff --git a/PDContainer/include/MapBase.h b/PDContainer/include/MapBase.h
new file mode 100755
index 0000000..cf295de
--- /dev/null
+++ b/PDContainer/include/MapBase.h
@@ -0,0 +1,655 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// MapBase.h
+
+#ifndef _map_base_h__
+#define _map_base_h__
+
+#include "include/ContainerBase.h"
+
+
+//---------------------------------------------------
+/* this is the base class of map and multimap
+ */
+template <class ContainerType, class ContTypeIterator>
+class MapBase : public ContainerBase<ContainerType,ContTypeIterator>
+{
+
+ private:
+
+ /* Copy Construction is not allowed
+ */
+ MapBase(const MapBase<ContainerType,ContTypeIterator> &src)
+ { }
+
+ /* assignement operator is not allowed
+ */
+ const MapBase<ContainerType,ContTypeIterator>& operator =
+ (const MapBase<ContainerType,ContTypeIterator>&)
+ { }
+
+ public:
+
+ /* Standard Constructor
+ * no namespace
+ */
+ MapBase()
+ { }
+
+ /* Destructor
+ */
+ virtual ~MapBase() { };
+
+ /* Add a key-value pair
+ */
+ virtual void add(Element key, Element value)
+ {
+ // first remove old entry, then insert
+ this->data_[this->h_namespace_].erase(key);
+ this->data_[this->h_namespace_].insert(std::pair<Element,Element>(key,value));
+ }
+
+ /* Get a value from the specific Key
+ */
+ virtual Element &get(const Element &key) const
+ {
+ ContTypeIterator iter = this->data_[this->h_namespace_].find(key);
+
+ // key was not found if iterator is pointing to the end
+ if(iter == this->data_[this->h_namespace_].end())
+ throw "PDContainer, get: Element not found !";
+
+ return (*iter).second;
+ }
+
+ /* removes a pair with this key
+ */
+ virtual void remove(const Element &key)
+ {
+ if(!this->data_[this->h_namespace_].erase(key))
+ throw "PDContainer, remove: Element not found !";
+ }
+
+ /* prints all the data of the current namespace to the console
+ */
+ virtual void printAll();
+
+ /* saves all the data of the current namespace to a file
+ * Fileformat:
+ * <key_atom_type1> <key_atom1> ... - <data_atom_type1> <data_atom1> ...
+ * e.g.:
+ * f 1 f 2 - f 4
+ * s foo f 12.34234 - f 3 f 5 s gege
+ * types: s=symbol, f=float
+ * ATTENTION: if the file exists, all the old data of
+ * the file is lost
+ * returns true on success
+ */
+ virtual bool saveToFile(string filename);
+
+ /* saves all the data of the current namespace to a XML file
+ * ATTENTION: if the file exists, all the old data of
+ * the file is lost
+ * returns true on success
+ */
+ virtual bool saveToFileXML(string filename);
+
+ /* reads from an input file and adds the data to
+ * the current namespace
+ * Fileformat: see saveToFile
+ * returns true on success
+ */
+ virtual bool readFromFile(string filename);
+
+ /* reads from an XML input file and adds the data to
+ * the current namespace
+ * returns true on success
+ */
+ virtual bool readFromFileXML(string filename);
+};
+
+//----------------------------------------------------
+/* prints all the data of the current namespace to the console
+ */
+template<class ContainerType, class ContTypeIterator>
+void MapBase<ContainerType,ContTypeIterator>::printAll()
+{
+ ContTypeIterator iter = this->data_[this->h_namespace_].begin();
+
+ post("\n%s: printing namespace %s",this->dataname_.c_str(),this->h_namespace_.c_str());
+ post("--------------------------------------------------");
+
+ bool data_here = false;
+ while(iter != this->data_[this->h_namespace_].end())
+ {
+ ostringstream output("");
+
+ // Key:
+ Element key = (*iter).first;
+ if (key.getLength() > 1) // list
+ {
+ output << "list ";
+ for (int i=0; i < key.getLength(); i++)
+ {
+ if (key.getAtom()[i].a_type == A_FLOAT)
+ output << key.getAtom()[i].a_w.w_float << " ";
+ if (key.getAtom()[i].a_type == A_SYMBOL)
+ output << key.getAtom()[i].a_w.w_symbol->s_name << " ";
+ if (key.getAtom()[i].a_type == A_POINTER)
+ output << "(gpointer)" << key.getAtom()[i].a_w.w_gpointer << " ";
+ }
+ }
+ else // no list
+ {
+ if (key.getAtom()[0].a_type == A_FLOAT)
+ output << "float " << key.getAtom()[0].a_w.w_float << " ";
+ if (key.getAtom()[0].a_type == A_SYMBOL)
+ output << "symbol "
+ << key.getAtom()[0].a_w.w_symbol->s_name << " ";
+ if (key.getAtom()[0].a_type == A_POINTER)
+ output << "pointer " << key.getAtom()[0].a_w.w_gpointer << " ";
+ }
+
+ // Value:
+ output << " -- ";
+ Element el = (*iter).second;
+ if (el.getLength() > 1) // list
+ {
+ output << "list ";
+ for (int i=0; i < el.getLength(); i++)
+ {
+ if (el.getAtom()[i].a_type == A_FLOAT)
+ output << el.getAtom()[i].a_w.w_float << " ";
+ if (el.getAtom()[i].a_type == A_SYMBOL)
+ output << el.getAtom()[i].a_w.w_symbol->s_name << " ";
+ if (el.getAtom()[i].a_type == A_POINTER)
+ output << "(gpointer)" << el.getAtom()[i].a_w.w_gpointer << " ";
+ }
+ }
+ else // no list
+ {
+ if (el.getAtom()[0].a_type == A_FLOAT) // hier segfault nach get !!!
+ output << "float " << el.getAtom()[0].a_w.w_float << " ";
+ if (el.getAtom()[0].a_type == A_SYMBOL)
+ output << "symbol "
+ << el.getAtom()[0].a_w.w_symbol->s_name << " ";
+ if (el.getAtom()[0].a_type == A_POINTER)
+ output << "pointer " << el.getAtom()[0].a_w.w_gpointer << " ";
+ }
+
+ post("%s",output.str().c_str());
+ data_here = true;
+ iter++;
+ }
+ if(!data_here)
+ post("no data in current namespace!");
+ post("--------------------------------------------------");
+}
+
+//----------------------------------------------------
+/* saves all the data of the current namespace to a file
+ * Fileformat:
+ * <key_atom_type1> <key_atom1> ... - <data_atom_type1> <data_atom1> ...
+ * e.g.:
+ * f 1 f 2 - f 4
+ * s foo f 12.34234 - f 3 f 5 s gege
+ * types: s=symbol, f=float
+ * ATTENTION: if the file exists, all the old data of
+ * the file is lost
+ * returns true on success
+ */
+template<class ContainerType, class ContTypeIterator>
+bool MapBase<ContainerType,ContTypeIterator>::saveToFile(string filename)
+{
+ ofstream outfile;
+ ContTypeIterator iter = this->data_[this->h_namespace_].begin();
+
+ outfile.open(filename.c_str());
+
+ if(!outfile)
+ return false;
+
+ while(iter != this->data_[this->h_namespace_].end())
+ {
+ Element key = (*iter).first;
+ Element el = (*iter).second;
+ bool have_pointer = false;
+
+ // check if there is a pointer and then don't store it
+ for (int i=0; i < key.getLength(); i++)
+ if (key.getAtom()[i].a_type == A_POINTER)
+ have_pointer=true;
+ for (int i=0; i < el.getLength(); i++)
+ if (el.getAtom()[i].a_type == A_POINTER)
+ have_pointer=true;
+
+ if(have_pointer)
+ {
+ post("PDContainer: will not store pointers !!!");
+ iter++;
+ }
+ else
+ {
+ // add key:
+ for (int i=0; i < key.getLength(); i++)
+ {
+ if (key.getAtom()[i].a_type == A_FLOAT)
+ outfile << "f " << key.getAtom()[i].a_w.w_float << " ";
+ if (key.getAtom()[i].a_type == A_SYMBOL)
+ outfile << "s " << key.getAtom()[i].a_w.w_symbol->s_name << " ";
+ }
+
+ outfile << "- ";
+
+ // add Value:
+ for (int i=0; i < el.getLength(); i++)
+ {
+ if (el.getAtom()[i].a_type == A_FLOAT)
+ outfile << "f " << el.getAtom()[i].a_w.w_float << " ";
+ if (el.getAtom()[i].a_type == A_SYMBOL)
+ outfile << "s " << el.getAtom()[i].a_w.w_symbol->s_name << " ";
+ }
+
+ outfile << endl;
+ iter++;
+ }
+ }
+
+ outfile.close();
+
+ return true;
+}
+
+//----------------------------------------------------
+/* saves all the data of the current namespace to a XML file
+ * ATTENTION: if the file exists, all the old data of
+ * the file is lost
+ * returns true on success
+ */
+template<class ContainerType, class ContTypeIterator>
+ bool MapBase<ContainerType,ContTypeIterator>::saveToFileXML(string filename)
+{
+ ostringstream output("");
+ ContTypeIterator iter = this->data_[this->h_namespace_].begin();
+
+ // add XML Header:
+ output << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"
+ << "<!DOCTYPE PDContainer SYSTEM "
+ << "\"http://grh.mur.at/software/pdcontainer_multi.dtd\">\n"
+ << "<PDContainer type=\"" << this->dataname_ << "\">\n";
+
+ while(iter != this->data_[this->h_namespace_].end())
+ {
+ Element key((*iter).first);
+ Element el((*iter).second);
+ bool have_pointer = false;
+
+ // check if there is a pointer and then don't store it
+ for (int i=0; i < key.getLength(); i++)
+ if (key.getAtom()[i].a_type == A_POINTER)
+ have_pointer=true;
+ for (int i=0; i < el.getLength(); i++)
+ if (el.getAtom()[i].a_type == A_POINTER)
+ have_pointer=true;
+
+ if(have_pointer)
+ {
+ post("PDContainer: will not store pointers !!!");
+ iter++;
+ }
+ else
+ {
+
+ output << "<element>\n";
+
+ // add Key:
+ output << "<key>\n";
+
+ for (int i=0; i < key.getLength(); i++)
+ {
+ if (key.getAtom()[i].a_type == A_FLOAT)
+ output << "<f> " << key.getAtom()[i].a_w.w_float << " </f>\n";
+ if (key.getAtom()[i].a_type == A_SYMBOL)
+ output << "<s>" << key.getAtom()[i].a_w.w_symbol->s_name << " </s>\n";
+ }
+
+ output << "</key>\n";
+
+
+ // add Value:
+ output << "<value>\n";
+
+ for (int i=0; i < el.getLength(); i++)
+ {
+ if (el.getAtom()[i].a_type == A_FLOAT)
+ output << "<f> " << el.getAtom()[i].a_w.w_float << " </f>\n";
+ if (el.getAtom()[i].a_type == A_SYMBOL)
+ output << "<s>" << el.getAtom()[i].a_w.w_symbol->s_name << " </s>\n";
+ }
+
+ output << "</value>\n";
+
+ output << "</element>\n";
+
+ iter++;
+
+ }
+ }
+
+ output << "</PDContainer>\n";
+
+ // now write to file:
+ TiXmlDocument outfile( filename.c_str() );
+ outfile.Parse( output.str().c_str() );
+
+ if ( outfile.Error() ) return false;
+
+ outfile.SaveFile();
+
+ return true;
+}
+
+//----------------------------------------------------
+/* reads the data from the file into the current
+ * namespace
+ * Fileformat: see saveToFile
+ * returns true on success
+ */
+template<class ContainerType, class ContTypeIterator>
+bool MapBase<ContainerType,ContTypeIterator>::readFromFile(string filename)
+{
+ ifstream infile;
+ infile.open(filename.c_str());
+
+ if(!infile)
+ return false;
+
+ Element key;
+ Element el;
+
+ string line;
+ bool go_on = false;
+ char type;
+ string symbol;
+ t_float number;
+ int key_count, val_count;
+
+ while (getline(infile, line))
+ {
+ // first parse the instream, to get the number of atoms
+ // (= length of the elements)
+
+ istringstream instream(line);
+ ostringstream key_str("");
+ ostringstream value_str("");
+
+ // Key:
+ go_on = false; key_count = 0;
+ while(!go_on)
+ {
+ instream >> type;
+ if (type == 's')
+ {
+ key_count++;
+ instream >> symbol;
+ key_str << "s " << symbol;
+ }
+ if (type == 'f')
+ {
+ key_count++;
+ instream >> number;
+ key_str << "f " << number;
+ }
+ if (type == '-')
+ go_on = true;
+ key_str << " ";
+ }
+
+ // Value:
+ go_on = false; val_count = 0;
+ while(!go_on)
+ {
+ instream >> type;
+ if (instream.eof())
+ {
+ go_on = true;
+ break;
+ }
+ if (type == 's')
+ {
+ val_count++;
+ instream >> symbol;
+ value_str << "s " << symbol;
+ }
+ if (type == 'f')
+ {
+ val_count++;
+ instream >> number;
+ value_str << "f " << number;
+ }
+ if (instream.eof())
+ go_on = true;
+ value_str << " ";
+ }
+
+
+ // now make the key and value objects, parse again the data
+ // into the objects and add them to the container
+
+ // Key:
+
+ t_atom *key_atom = (t_atom*)getbytes(key_count*sizeof(t_atom));
+ t_atom *val_atom = (t_atom*)getbytes(val_count*sizeof(t_atom));
+ if(key_atom == NULL || val_atom == NULL)
+ post("Fatal Error Out Of Memory (%s-readFromFile)",this->dataname_.c_str());
+
+ istringstream key_istr(key_str.str());
+ istringstream value_istr(value_str.str());
+
+ for(int i = 0; i < key_count; i++)
+ {
+ key_istr >> type;
+ if (type == 's')
+ {
+ key_istr >> symbol;
+ SETSYMBOL(&key_atom[i],gensym(const_cast<char*>(symbol.c_str())));
+ }
+ if (type == 'f')
+ {
+ key_istr >> number;
+ SETFLOAT(&key_atom[i],number);
+ }
+ }
+
+ for(int i = 0; i < val_count; i++)
+ {
+ value_istr >> type;
+ if (type == 's')
+ {
+ value_istr >> symbol;
+ SETSYMBOL(&val_atom[i],gensym(const_cast<char*>(symbol.c_str())));
+ }
+ if (type == 'f')
+ {
+ value_istr >> number;
+ SETFLOAT(&val_atom[i],number);
+ }
+ }
+
+ key.setAtoms(key_count,key_atom);
+ el.setAtoms(val_count, val_atom);
+ // insert the data
+ this->data_[this->h_namespace_].insert(std::pair<Element,Element>(key,el));
+
+ freebytes(key_atom, key_count*sizeof(t_atom));
+ freebytes(val_atom, val_count*sizeof(t_atom));
+ }
+
+ infile.close();
+
+ return true;
+}
+
+//----------------------------------------------------
+/* reads the data from the XML file into the current
+ * namespace
+ * returns true on success
+ */
+template<class ContainerType, class ContTypeIterator>
+ bool MapBase<ContainerType,ContTypeIterator>::readFromFileXML(string filename)
+{
+ TiXmlDocument doc( filename.c_str() );
+
+ if( !doc.LoadFile() ) return false;
+
+ TiXmlNode *parent = 0;
+ TiXmlElement *child1 = 0;
+ TiXmlElement *child2 = 0;
+ TiXmlElement *child3 = 0;
+
+ t_atom *key_atom = 0;
+ t_atom *val_atom = 0;
+ Element key;
+ Element el;
+ t_float f;
+ bool parsed=false;
+
+
+ // Get the <PDContainer> tag and check type
+ parent = doc.FirstChild( "PDContainer" );
+ if(!parent) return false;
+
+ if(!parent->ToElement()) return false;
+ if(!parent->ToElement()->Attribute("type"))
+ {
+ post("readXML: you must specify an attribute type in <PDContainer> !");
+ return false;
+ }
+
+ string type(parent->ToElement()->Attribute("type"));
+ if( type != "h_map" && type != "h_multimap" )
+ {
+ post("readXML: wrong container type (attribute type in <PDContainer>) !");
+ return false;
+ }
+
+ if( type != this->dataname_ )
+ post("readXML: importing data from %s!", type.c_str() );
+
+ // iterate through all the <element> tags
+ for( child1 = parent->FirstChildElement("element"); child1;
+ child1 = child1->NextSiblingElement("element") )
+ {
+ // get the <key> tag
+ child2 = child1->FirstChildElement( "key" );
+ if(!child2) return false;
+
+ // get nr of keys and allocate mem for them
+ // (if its a pd list)
+ int key_count = 0;
+ for( child3 = child2->FirstChildElement(); child3;
+ child3 = child3->NextSiblingElement() )
+ key_count++;
+
+ key_atom = (t_atom*)getbytes(key_count*sizeof(t_atom));
+ if(key_atom == NULL)
+ {
+ post("Fatal Error Out Of Memory (%s-readFromFile)",this->dataname_.c_str());
+ return false;
+ }
+
+ // iterate through all the atoms of <key>
+ key_count = 0;
+ for( child3 = child2->FirstChildElement(); child3;
+ child3 = child3->NextSiblingElement() )
+ {
+ string tag(child3->Value());
+
+ if(!child3->FirstChild()) continue;
+ istringstream in(child3->FirstChild()->Value());
+
+ if(tag == "f" || tag == "float")
+ {
+ in >> f;
+ SETFLOAT(&key_atom[key_count], f);
+ }
+ if(tag == "s" || tag == "symbol")
+ {
+ SETSYMBOL(&key_atom[key_count],
+ gensym(const_cast<char*>(in.str().c_str())));
+ }
+
+ key_count++;
+ }
+
+ if(!key_count) continue;
+
+ //----------------------
+
+ // get the <value> tag
+ child2 = child1->FirstChildElement( "value" );
+ if(!child2) return false;
+
+ // get nr of values and allocate mem for them
+ // (if its a pd list)
+ int val_count = 0;
+ for( child3 = child2->FirstChildElement(); child3;
+ child3 = child3->NextSiblingElement() )
+ val_count++;
+
+ val_atom = (t_atom*)getbytes(val_count*sizeof(t_atom));
+ if(val_atom == NULL)
+ {
+ post("Fatal Error Out Of Memory (%s-readFromFile)",this->dataname_.c_str());
+ return false;
+ }
+
+ // iterate through all the atoms of <value>
+ val_count = 0;
+ for( child3 = child2->FirstChildElement(); child3;
+ child3 = child3->NextSiblingElement() )
+ {
+ string tag(child3->Value());
+
+ if(!child3->FirstChild()) continue;
+ istringstream in(child3->FirstChild()->Value());
+
+ if(tag == "f" || tag == "float")
+ {
+ in >> f;
+ SETFLOAT(&val_atom[val_count],f);
+ }
+ if(tag == "s" || tag == "symbol")
+ {
+ SETSYMBOL(&val_atom[val_count],
+ gensym(const_cast<char*>(in.str().c_str())));
+ }
+
+ val_count++;
+ }
+
+ if(!val_count) continue;
+
+ // add the element to the container
+ key.setAtoms(key_count,key_atom);
+ el.setAtoms(val_count,val_atom);
+ this->data_[this->h_namespace_].insert(std::pair<Element,Element>(key,el));
+
+ freebytes(key_atom, key_count*sizeof(t_atom));
+ freebytes(val_atom, val_count*sizeof(t_atom));
+
+ parsed = true;
+ }
+ return parsed;
+}
+
+
+#endif // _map_base_h__
diff --git a/PDContainer/include/QueueStack.h b/PDContainer/include/QueueStack.h
new file mode 100755
index 0000000..eb72408
--- /dev/null
+++ b/PDContainer/include/QueueStack.h
@@ -0,0 +1,61 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HQueueStack.h
+
+#ifndef _h_queue_stack_h__
+#define _h_queue_stack_h__
+
+
+#include "include/ContainerBase.h"
+
+
+//---------------------------------------------------
+/* this is the class of the queue, stack and priority queue
+ */
+template <class ContainerType, class ContTypeIterator>
+class QueueStack : public ContainerBase<ContainerType,ContTypeIterator>
+{
+
+ private:
+
+ /* Copy Construction is not allowed
+ */
+ QueueStack(const QueueStack<ContainerType,ContTypeIterator> &src)
+ { }
+
+ /* assignement operator is not allowed
+ */
+ const QueueStack<ContainerType,ContTypeIterator>& operator =
+ (const QueueStack<ContainerType,ContTypeIterator>&)
+ { }
+
+ public:
+
+ /* Standard Constructor
+ * no namespace
+ */
+ QueueStack()
+ { }
+
+ /* Destructor
+ */
+ virtual ~QueueStack() { }
+
+ /* removes the value from the top of
+ * the container
+ */
+ virtual void pop()
+ { this->data_[this->h_namespace_].pop(); }
+};
+
+
+
+#endif //_h_queue_stack_h__
diff --git a/PDContainer/include/SequBase.h b/PDContainer/include/SequBase.h
new file mode 100755
index 0000000..40bc4d7
--- /dev/null
+++ b/PDContainer/include/SequBase.h
@@ -0,0 +1,341 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// SequBase.h
+
+#ifndef _sequ_base_h__
+#define _sequ_base_h__
+
+
+#include "include/SimpleBase.h"
+
+
+//---------------------------------------------------
+/* this is the base class of vector and deque
+ */
+template <class ContainerType, class ContTypeIterator>
+class SequBase : public SimpleBase<ContainerType,ContTypeIterator>
+{
+
+ private:
+
+ /* Copy Construction is not allowed
+ */
+ SequBase(const SequBase<ContainerType,ContTypeIterator> &src)
+ { }
+
+ /* assignement operator is not allowed
+ */
+ const SequBase<ContainerType,ContTypeIterator>& operator =
+ (const SequBase<ContainerType,ContTypeIterator>&)
+ { }
+
+ public:
+
+ /* Standard Constructor
+ * no namespace
+ */
+ SequBase()
+ { }
+
+ /* Destructor
+ */
+ virtual ~SequBase() { };
+
+ /* change the element at the index
+ */
+ virtual void set(int index, Element value)
+ { this->data_[this->h_namespace_][index] = value; }
+
+ /* get the element from the index
+ */
+ virtual Element &get(int index) const
+ { return this->data_[this->h_namespace_][index]; }
+
+ /* resize the sequence
+ */
+ virtual void resize(int size)
+ { this->data_[this->h_namespace_].resize(size); }
+
+ /* inserts an element at the end of
+ * the container (so then the size
+ * increases by one !!!)
+ */
+ virtual void pushBack(Element value)
+ { this->data_[this->h_namespace_].push_back(value); }
+
+ /* removes the element from the end of
+ * the container (so then the size
+ * decreases by one !!!)
+ */
+ virtual void popBack()
+ { this->data_[this->h_namespace_].pop_back(); }
+
+ /* returns the last element
+ */
+ virtual Element &back() const
+ { return this->data_[this->h_namespace_].back(); }
+
+ /* returns the first element
+ */
+ virtual Element &front() const
+ { return this->data_[this->h_namespace_].front(); }
+
+ /* inserts an element before the element
+ * with the given index
+ */
+ virtual void insert(int index, Element value)
+ { this->data_[this->h_namespace_].insert(this->data_[this->h_namespace_].begin()+index, value); }
+
+ /* removes the element with that index from the
+ * container
+ */
+ virtual void remove(int index)
+ { this->data_[this->h_namespace_].erase(this->data_[this->h_namespace_].begin()+index); }
+
+ /* reads from an input file and adds the data to
+ * the current namespace
+ * Fileformat: see saveToFile
+ * index: inserts the data starting with this index
+ * returns true on success
+ */
+ virtual bool readFromFile2(string filename, int index);
+
+ /* reads from a XML input file and adds the data to
+ * the current namespace
+ * index: inserts the data starting with this index
+ * returns true on success
+ */
+ virtual bool readFromFile2XML(string filename, int index);
+};
+
+
+//----------------------------------------------------
+/* reads the data from the file into the current
+ * namespace
+ * Fileformat: see saveToFile
+ * index: inserts the data starting with this index
+ * returns true on success
+ */
+template<class ContainerType, class ContTypeIterator>
+bool SequBase<ContainerType,ContTypeIterator>::readFromFile2(string filename, int index)
+{
+ ifstream infile;
+ infile.open(filename.c_str());
+
+ if(!infile)
+ return false;
+
+ Element key;
+
+ string line;
+ bool go_on = false;
+ char type;
+ string symbol;
+ t_float number;
+ int key_count;
+ int max_index = this->data_[this->h_namespace_].size();
+
+ while (getline(infile, line))
+ {
+ // first parse the instream, to get the number of atoms
+ // (= size of the list)
+
+ if(index < 0 || index >= max_index)
+ {
+ post("%s, read: wrong index !!",this->dataname_.c_str());
+ return false;
+ }
+
+ istringstream instream(line);
+ ostringstream key_str("");
+
+ go_on = false; key_count = 0;
+ while(!go_on)
+ {
+ instream >> type;
+ if (instream.eof())
+ {
+ go_on = true;
+ break;
+ }
+ if (type == 's')
+ {
+ key_count++;
+ instream >> symbol;
+ key_str << "s " << symbol;
+ }
+ if (type == 'f')
+ {
+ key_count++;
+ instream >> number;
+ key_str << "f " << number;
+ }
+ if (instream.eof())
+ go_on = true;
+ key_str << " ";
+ }
+
+ // now objects, parse again the data
+ // into the objects and add them to the container
+
+ t_atom *key_atom = (t_atom*)getbytes(key_count*sizeof(t_atom));
+
+ if(key_atom == NULL)
+ post("Fatal Error Out Of Memory (%s-readFromFile)",this->dataname_.c_str());
+
+ istringstream key_istr(key_str.str());
+
+ for(int i = 0; i < key_count; i++)
+ {
+ key_istr >> type;
+ if (type == 's')
+ {
+ key_istr >> symbol;
+ SETSYMBOL(&key_atom[i],gensym(const_cast<char*>(symbol.c_str())));
+ }
+ if (type == 'f')
+ {
+ key_istr >> number;
+ SETFLOAT(&key_atom[i],number);
+ }
+ }
+
+ key.setAtoms(key_count,key_atom);
+ // insert the data
+ this->data_[this->h_namespace_][index] = key;
+ index++;
+
+ freebytes(key_atom, key_count*sizeof(t_atom));
+ }
+
+ infile.close();
+
+ return true;
+}
+
+//----------------------------------------------------
+/* reads the data from the XML file into the current
+ * namespace
+ * index: inserts the data starting with this index
+ * returns true on success
+ */
+template<class ContainerType, class ContTypeIterator>
+ bool SequBase<ContainerType,ContTypeIterator>::readFromFile2XML(string filename, int index)
+{
+ int max_index = this->data_[this->h_namespace_].size();
+ if(index < 0 || index >= max_index)
+ {
+ post("%s, read: wrong index !!",this->dataname_.c_str());
+ return false;
+ }
+
+
+ TiXmlDocument doc( filename.c_str() );
+
+ if( !doc.LoadFile() ) return false;
+
+ TiXmlNode *parent = 0;
+ TiXmlElement *child1 = 0;
+ TiXmlElement *child2 = 0;
+
+ t_atom *el_atom = 0;
+ Element el;
+ t_float f;
+ bool parsed=false;
+
+
+ // Get the <PDContainer> tag and check type
+ parent = doc.FirstChild( "PDContainer" );
+ if(!parent) return false;
+
+ if(!parent->ToElement()) return false;
+ if(!parent->ToElement()->Attribute("type"))
+ {
+ post("readXML: you must specify an attribute type in <PDContainer> !");
+ return false;
+ }
+
+ string type(parent->ToElement()->Attribute("type"));
+
+ if( type != "h_vector" && type != "h_list" && type != "h_deque" &&
+ type != "h_set" && type != "h_multiset")
+ {
+ post("readXML: wrong container type (attribute type in <PDContainer>) !");
+ return false;
+ }
+
+ if( type != this->dataname_ )
+ post("readXML: importing data from %s!", type.c_str() );
+
+ // iterate through all the <element> tags
+ for( child1 = parent->FirstChildElement("element"); child1;
+ child1 = child1->NextSiblingElement("element") )
+ {
+ // get nr of atoms and allocate mem for them
+ // (if its a pd list)
+ int atoms = 0;
+ for( child2 = child1->FirstChildElement(); child2;
+ child2 = child2->NextSiblingElement() )
+ atoms++;
+
+ el_atom = (t_atom*)getbytes(atoms*sizeof(t_atom));
+
+ if(el_atom == NULL)
+ {
+ post("Fatal Error Out Of Memory (%s-readFromFile)",this->dataname_.c_str());
+ return false;
+ }
+
+ // iterate through all the atoms of one <element>
+ atoms = 0;
+ for( child2 = child1->FirstChildElement(); child2;
+ child2 = child2->NextSiblingElement() )
+ {
+ string tag(child2->Value());
+
+ if(!child2->FirstChild()) continue;
+ istringstream in(child2->FirstChild()->Value());
+
+ if(tag == "f" || tag == "float")
+ {
+ in >> f;
+ SETFLOAT(&el_atom[atoms], f);
+ }
+ if(tag == "s" || tag == "symbol")
+ {
+ SETSYMBOL(&el_atom[atoms],
+ gensym(const_cast<char*>(in.str().c_str())));
+ }
+
+ atoms++;
+ }
+
+ if(!atoms) continue;
+
+
+ // add the element to the container
+ el.setAtoms(atoms,el_atom);
+
+ // insert the data
+ this->data_[this->h_namespace_][index] = el;
+ index++;
+
+ freebytes(el_atom, atoms*sizeof(t_atom));
+
+ parsed = true;
+ }
+ return parsed;
+
+}
+
+
+
+#endif //_sequ_base_h__
diff --git a/PDContainer/include/SimpleBase.h b/PDContainer/include/SimpleBase.h
new file mode 100755
index 0000000..75203ec
--- /dev/null
+++ b/PDContainer/include/SimpleBase.h
@@ -0,0 +1,539 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// SimpleBase.h
+
+#ifndef _simple_base_h__
+#define _simple_base_h__
+
+
+#include "include/ContainerBase.h"
+
+
+//---------------------------------------------------
+/* this is the base class of all simple containers
+ */
+template <class ContainerType, class ContTypeIterator>
+class SimpleBase : public ContainerBase<ContainerType,ContTypeIterator>
+{
+
+ private:
+
+ /* Copy Construction is not allowed
+ */
+ SimpleBase(const SimpleBase<ContainerType,ContTypeIterator> &src)
+ { }
+
+ /* assignement operator is not allowed
+ */
+ const SimpleBase<ContainerType,ContTypeIterator>& operator =
+ (const SimpleBase<ContainerType,ContTypeIterator>&)
+ { }
+
+ public:
+
+ /* Standard Constructor
+ * no namespace
+ */
+ SimpleBase()
+ { }
+
+ /* Destructor
+ */
+ virtual ~SimpleBase() { };
+
+ /* prints all the data of the current namespace to the console
+ */
+ virtual void printAll();
+
+ /* prints all the data of the current namespace to the console
+ * (with the index as prefix)
+ */
+ virtual void printAllIndex();
+
+ /* saves all the data of the current namespace to a file
+ * Fileformat:
+ * <data_atom_type1> <data_atom1> <data_atom_type2> <data_atom2> ...
+ * e.g.:
+ * f 1 f 2 f 4
+ * s foo f 12.34234
+ * types: s=symbol, f=float
+ * ATTENTION: if the file exists, all the old data of
+ * the file is lost
+ * returns true on success
+ */
+ virtual bool saveToFile(string filename);
+
+ /* saves all the data of the current namespace to a XML file
+ * ATTENTION: if the file exists, all the old data of
+ * the file is lost
+ * returns true on success
+ */
+ virtual bool saveToFileXML(string filename);
+
+ /* reads from an input file and adds the data to
+ * the current namespace
+ * Fileformat: see saveToFile
+ * returns true on success
+ */
+ virtual bool readFromFile(string filename);
+
+ /* reads from an input XML file and adds the data to
+ * the current namespace
+ * returns true on success
+ */
+ virtual bool readFromFileXML(string filename);
+};
+
+
+//----------------------------------------------------
+/* prints all the data of the current namespace to the console
+ */
+template<class ContainerType, class ContTypeIterator>
+void SimpleBase<ContainerType,ContTypeIterator>::printAll()
+{
+ ContTypeIterator iter = this->data_[this->h_namespace_].begin();
+
+ post("\n%s: printing namespace %s",this->dataname_.c_str(),this->h_namespace_.c_str());
+ post("--------------------------------------------------");
+
+ bool data_here = false;
+ while(iter != this->data_[this->h_namespace_].end())
+ {
+ ostringstream output("");
+
+ Element key((*iter));
+ if(key.getLength() == 0)
+ {
+ iter++;
+ continue;
+ }
+
+ if (key.getLength() > 1) // list
+ {
+ output << "list ";
+ for (int i=0; i < key.getLength(); i++)
+ {
+ if (key.getAtom()[i].a_type == A_FLOAT)
+ output << key.getAtom()[i].a_w.w_float << " ";
+ if (key.getAtom()[i].a_type == A_SYMBOL)
+ output << key.getAtom()[i].a_w.w_symbol->s_name << " ";
+ if (key.getAtom()[i].a_type == A_POINTER)
+ output << "(gpointer)" << key.getAtom()[i].a_w.w_gpointer << " ";
+ }
+ }
+ else // no list
+ {
+ if (key.getAtom()[0].a_type == A_FLOAT)
+ output << "float " << key.getAtom()[0].a_w.w_float << " ";
+ if (key.getAtom()[0].a_type == A_SYMBOL)
+ output << "symbol "
+ << key.getAtom()[0].a_w.w_symbol->s_name << " ";
+ if (key.getAtom()[0].a_type == A_POINTER)
+ output << "pointer " << key.getAtom()[0].a_w.w_gpointer << " ";
+ }
+
+ post("%s",output.str().c_str());
+ data_here = true;
+
+ iter++;
+ }
+ if(!data_here)
+ post("no data in current namespace!");
+ post("--------------------------------------------------");
+}
+
+//----------------------------------------------------
+/* prints all the data of the current namespace to the console
+ * (with the index as prefix)
+ */
+template<class ContainerType, class ContTypeIterator>
+void SimpleBase<ContainerType,ContTypeIterator>::printAllIndex()
+{
+ ContTypeIterator iter = this->data_[this->h_namespace_].begin();
+
+ post("\n%s: printing namespace %s",this->dataname_.c_str(),this->h_namespace_.c_str());
+ post("--------------------------------------------------");
+
+ bool data_here = false; int i=0;
+ while(iter != this->data_[this->h_namespace_].end())
+ {
+ ostringstream output("");
+
+ Element key((*iter));
+ if(key.getLength() == 0)
+ {
+ iter++; i++;
+ continue;
+ }
+
+ if (key.getLength() > 1) // list
+ {
+ output << "list ";
+ for (int i=0; i < key.getLength(); i++)
+ {
+ if (key.getAtom()[i].a_type == A_FLOAT)
+ output << key.getAtom()[i].a_w.w_float << " ";
+ if (key.getAtom()[i].a_type == A_SYMBOL)
+ output << key.getAtom()[i].a_w.w_symbol->s_name << " ";
+ if (key.getAtom()[i].a_type == A_POINTER)
+ output << "(gpointer)" << key.getAtom()[i].a_w.w_gpointer << " ";
+ }
+ }
+ else // no list
+ {
+ if (key.getAtom()[0].a_type == A_FLOAT)
+ output << "float " << key.getAtom()[0].a_w.w_float << " ";
+ if (key.getAtom()[0].a_type == A_SYMBOL)
+ output << "symbol "
+ << key.getAtom()[0].a_w.w_symbol->s_name << " ";
+ if (key.getAtom()[0].a_type == A_POINTER)
+ output << "pointer " << key.getAtom()[0].a_w.w_gpointer << " ";
+ }
+
+ post("%d: %s",i,output.str().c_str());
+ data_here = true;
+
+ iter++; i++;
+ }
+ if(!data_here)
+ post("no data in current namespace!");
+ post("--------------------------------------------------");
+}
+
+//----------------------------------------------------
+/* saves all the data of the current namespace to a file
+ * Fileformat:
+ * <key_atom_type1> <key_atom1> ... - <data_atom_type1> <data_atom1> ...
+ * e.g.:
+ * f 1 f 2 - f 4
+ * s foo f 12.34234 - f 3 f 5 s gege
+ * types: s=symbol, f=float
+ * ATTENTION: if the file exists, all the old data of
+ * the file is lost
+ * returns true on success
+ */
+template<class ContainerType, class ContTypeIterator>
+bool SimpleBase<ContainerType,ContTypeIterator>::saveToFile(string filename)
+{
+ ofstream outfile;
+ ContTypeIterator iter = this->data_[this->h_namespace_].begin();
+
+ outfile.open(filename.c_str());
+
+ if(!outfile)
+ return false;
+
+ while(iter != this->data_[this->h_namespace_].end())
+ {
+ Element key((*iter));
+ bool have_pointer = false;
+
+ // check for pointers first
+ for (int i=0; i < key.getLength(); i++)
+ if (key.getAtom()[i].a_type == A_POINTER)
+ have_pointer = true;
+
+ if(have_pointer)
+ {
+ post("PDContainer warning: pointers can't be saved and are ignored !!!");
+ iter++;
+ }
+ else
+ {
+
+ for (int i=0; i < key.getLength(); i++)
+ {
+ if (key.getAtom()[i].a_type == A_FLOAT)
+ outfile << "f " << key.getAtom()[i].a_w.w_float << " ";
+ if (key.getAtom()[i].a_type == A_SYMBOL)
+ outfile << "s " << key.getAtom()[i].a_w.w_symbol->s_name << " ";
+ }
+
+ outfile << endl;
+ iter++;
+
+ }
+ }
+
+ outfile.close();
+
+ return true;
+}
+
+//----------------------------------------------------
+/* saves all the data of the current namespace to a XML file
+ * ATTENTION: if the file exists, all the old data of
+ * the file is lost
+ * returns true on success
+ */
+template<class ContainerType, class ContTypeIterator>
+ bool SimpleBase<ContainerType,ContTypeIterator>::saveToFileXML(string filename)
+{
+ ostringstream output("");
+ ContTypeIterator iter = this->data_[this->h_namespace_].begin();
+
+ // add XML Header:
+ output << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"
+ << "<!DOCTYPE PDContainer SYSTEM "
+ << "\"http://grh.mur.at/software/pdcontainer_simple.dtd\">\n"
+ << "<PDContainer type=\"" << this->dataname_ << "\">\n";
+
+
+ while(iter != this->data_[this->h_namespace_].end())
+ {
+ // add Element:
+ Element el((*iter));
+ bool have_pointer = false;
+
+ // check for pointers first
+ for (int i=0; i < el.getLength(); i++)
+ if (el.getAtom()[i].a_type == A_POINTER)
+ have_pointer = true;
+
+ if(have_pointer)
+ {
+ post("PDContainer warning: pointers can't be saved and are ignored !!!");
+ iter++;
+ }
+ else
+ {
+
+ output << "<element>\n";
+
+ for (int i=0; i < el.getLength(); i++)
+ {
+ if (el.getAtom()[i].a_type == A_FLOAT)
+ output << "<f> " << el.getAtom()[i].a_w.w_float << " </f>\n";
+ if (el.getAtom()[i].a_type == A_SYMBOL)
+ output << "<s>" << el.getAtom()[i].a_w.w_symbol->s_name << " </s>\n";
+ }
+
+ output << "</element>\n";
+
+ iter++;
+
+ }
+ }
+
+ output << "</PDContainer>\n";
+
+ // now write to file:
+ TiXmlDocument outfile( filename.c_str() );
+ outfile.Parse( output.str().c_str() );
+
+ if ( outfile.Error() ) return false;
+
+ outfile.SaveFile();
+
+ return true;
+}
+
+//----------------------------------------------------
+/* reads the data from the file into the current
+ * namespace
+ * Fileformat: see saveToFile
+ * returns true on success
+ */
+template<class ContainerType, class ContTypeIterator>
+bool SimpleBase<ContainerType,ContTypeIterator>::readFromFile(string filename)
+{
+ ifstream infile;
+ infile.open(filename.c_str());
+
+ if(!infile)
+ return false;
+
+ Element key;
+
+ string line;
+ bool go_on = false;
+ char type;
+ string symbol;
+ t_float number;
+ int key_count;
+
+ while (getline(infile, line))
+ {
+ // first parse the instream, to get the number of atoms
+ // (= size of the list)
+
+ istringstream instream(line);
+ ostringstream key_str("");
+
+ go_on = false; key_count = 0;
+ while(!go_on)
+ {
+ instream >> type;
+ if (instream.eof())
+ {
+ go_on = true;
+ break;
+ }
+ if (type == 's')
+ {
+ key_count++;
+ instream >> symbol;
+ key_str << "s " << symbol;
+ }
+ if (type == 'f')
+ {
+ key_count++;
+ instream >> number;
+ key_str << "f " << number;
+ }
+ if (instream.eof())
+ go_on = true;
+ key_str << " ";
+ }
+
+ // now objects, parse again the data
+ // into the objects and add them to the container
+
+ t_atom *key_atom = (t_atom*)getbytes(key_count*sizeof(t_atom));
+ if(key_atom == NULL)
+ post("Fatal Error Out Of Memory (%s-readFromFile)",this->dataname_.c_str());
+
+ istringstream key_istr(key_str.str());
+
+ for(int i = 0; i < key_count; i++)
+ {
+ key_istr >> type;
+ if (type == 's')
+ {
+ key_istr >> symbol;
+ SETSYMBOL(&key_atom[i],gensym(const_cast<char*>(symbol.c_str())));
+ }
+ if (type == 'f')
+ {
+ key_istr >> number;
+ SETFLOAT(&key_atom[i],number);
+ }
+ }
+
+ key.setAtoms(key_count,key_atom);
+
+ // insert the data
+ this->data_[this->h_namespace_].insert(this->data_[this->h_namespace_].end(),key);
+
+ freebytes(key_atom, key_count*sizeof(t_atom));
+ }
+
+ infile.close();
+
+ return true;
+}
+
+//----------------------------------------------------
+/* reads the data from th XML file into the current
+ * namespace
+ * returns true on success
+ */
+template<class ContainerType, class ContTypeIterator>
+ bool SimpleBase<ContainerType,ContTypeIterator>::readFromFileXML(string filename)
+{
+ TiXmlDocument doc( filename.c_str() );
+
+ if( !doc.LoadFile() ) return false;
+
+ TiXmlNode *parent = 0;
+ TiXmlElement *child1 = 0;
+ TiXmlElement *child2 = 0;
+
+ t_atom *el_atom = 0;
+ Element el;
+ t_float f;
+ bool parsed=false;
+
+
+ // Get the <PDContainer> tag and check type
+ parent = doc.FirstChild( "PDContainer" );
+ if(!parent) return false;
+
+ if(!parent->ToElement()) return false;
+ if(!parent->ToElement()->Attribute("type"))
+ {
+ post("readXML: you must specify an attribute type in <PDContainer> !");
+ return false;
+ }
+
+ string type(parent->ToElement()->Attribute("type"));
+
+ if( type != "h_vector" && type != "h_list" && type != "h_deque" &&
+ type != "h_set" && type != "h_multiset")
+ {
+ post("readXML: wrong container type (attribute type in <PDContainer>) !");
+ return false;
+ }
+
+ if( type != this->dataname_ )
+ post("readXML: importing data from %s!", type.c_str() );
+
+ // iterate through all the <element> tags
+ for( child1 = parent->FirstChildElement("element"); child1;
+ child1 = child1->NextSiblingElement("element") )
+ {
+ // get nr of atoms and allocate mem for them
+ // (if its a pd list)
+ int atoms = 0;
+ for( child2 = child1->FirstChildElement(); child2;
+ child2 = child2->NextSiblingElement() )
+ atoms++;
+
+ el_atom = (t_atom*)getbytes(atoms*sizeof(t_atom));
+ if(el_atom == NULL)
+ {
+ post("Fatal Error Out Of Memory (%s-readFromFile)",this->dataname_.c_str());
+ return false;
+ }
+
+ // iterate through all the atoms of one <element>
+ atoms = 0;
+ for( child2 = child1->FirstChildElement(); child2;
+ child2 = child2->NextSiblingElement() )
+ {
+ string tag(child2->Value());
+
+ if(!child2->FirstChild()) continue;
+ istringstream in(child2->FirstChild()->Value());
+
+ if(tag == "f" || tag == "float")
+ {
+ in >> f;
+ SETFLOAT(&el_atom[atoms], f);
+ }
+ if(tag == "s" || tag == "symbol")
+ {
+ SETSYMBOL(&el_atom[atoms],
+ gensym(const_cast<char*>(in.str().c_str())));
+ }
+
+ atoms++;
+ }
+
+ if(!atoms) continue;
+
+
+ // add the element to the container
+ el.setAtoms(atoms,el_atom);
+
+ // insert it in the container
+ this->data_[this->h_namespace_].insert(this->data_[this->h_namespace_].end(),el);
+
+ freebytes(el_atom, atoms*sizeof(t_atom));
+
+ parsed = true;
+ }
+ return parsed;
+}
+
+
+
+#endif // _simple_base_h__
diff --git a/PDContainer/makefile b/PDContainer/makefile
new file mode 100755
index 0000000..67f84a2
--- /dev/null
+++ b/PDContainer/makefile
@@ -0,0 +1,120 @@
+PD-PATH=/usr/lib/pd
+PD-SCR=/home/holzi/pd-0.39-0test7
+
+
+CC = g++
+LD = g++
+INCLUDE=-I$(PD-SCR) -I.
+LIB=-lc -lm
+CC_FLAGS = -DPD -c -Wall -fPIC -O3
+LD_FLAGS = --export-dynamic -shared -o
+
+
+TARGET=PDContainer.pd_linux
+OBJ=tinystr.o tinyxml.o tinyxmlerror.o tinyxmlparser.o \
+ PDContainer.o HMap.o h_map.o HMultiMap.o h_multimap.o \
+ HList.o h_list.o HPrioQueue.o h_prioqueue.o \
+ HSet.o h_set.o HMultiSet.o h_multiset.o \
+ HVector.o h_vector.o HDeque.o h_deque.o \
+ HQueue.o h_queue.o HStack.o h_stack.o
+
+#--------------------------------------------------------
+
+all: pd_linux
+
+pd_linux: $(TARGET)
+
+
+$(TARGET): $(OBJ)
+ $(LD) $(LD_FLAGS) $(TARGET) $(OBJ) $(LIB)
+ strip --strip-unneeded $(TARGET)
+ chmod 755 $(TARGET)
+
+PDContainer.o: h_map.o src/PDContainer.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/PDContainer.cpp
+
+h_map.o: HMap.o src/h_map.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_map.cpp
+
+HMap.o: src/HMap.cpp include/HMap.h include/MapBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HMap.cpp
+
+h_multimap.o: HMultiMap.o src/h_multimap.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_multimap.cpp
+
+HMultiMap.o: src/HMultiMap.cpp include/HMultiMap.h include/MapBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HMultiMap.cpp
+
+h_set.o: HSet.o src/h_set.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_set.cpp
+
+HSet.o: src/HSet.cpp include/HSet.h include/SimpleBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HSet.cpp
+
+h_multiset.o: HMultiSet.o src/h_multiset.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_multiset.cpp
+
+HMultiSet.o: src/HMultiSet.cpp include/HMultiSet.h include/SimpleBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HMultiSet.cpp
+
+h_vector.o: HVector.o src/h_vector.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_vector.cpp
+
+HVector.o: src/HVector.cpp include/HVector.h include/SequBase.h include/SimpleBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HVector.cpp
+
+h_deque.o: HDeque.o src/h_deque.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_deque.cpp
+
+HDeque.o: src/HDeque.cpp include/HDeque.h include/SequBase.h include/SimpleBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HDeque.cpp
+
+h_queue.o: HQueue.o src/h_queue.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_queue.cpp
+
+HQueue.o: src/HQueue.cpp include/HQueue.h include/QueueStack.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HQueue.cpp
+
+h_stack.o: HStack.o src/h_stack.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_stack.cpp
+
+HStack.o: src/HStack.cpp include/HStack.h include/QueueStack.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HStack.cpp
+
+h_list.o: HList.o src/h_list.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_list.cpp
+
+HList.o: src/HList.cpp include/HList.h include/SimpleBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HList.cpp
+
+h_prioqueue.o: HPrioQueue.o src/h_prioqueue.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_prioqueue.cpp
+
+HPrioQueue.o: src/HPrioQueue.cpp include/HPrioQueue.h include/QueueStack.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HPrioQueue.cpp
+
+#TinyXML:
+
+tinyxml.o: tinyxml/tinyxml.h tinyxml/tinyxml.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) tinyxml/tinyxml.cpp
+
+tinystr.o: tinyxml/tinystr.h tinyxml/tinystr.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) tinyxml/tinystr.cpp
+
+tinyxmlerror.o: tinyxml/tinyxmlerror.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) tinyxml/tinyxmlerror.cpp
+
+tinyxmlparser.o: tinyxml/tinyxmlparser.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) tinyxml/tinyxmlparser.cpp
+
+
+#-----------------------------------------------------
+
+
+clean:
+ rm -f $(OBJ) $(TARGET)
+
+
+install:
+ cp -f $(TARGET) $(PD-PATH)/externs
+ cp -f help/*.pd $(PD-PATH)/doc/5.reference
diff --git a/PDContainer/makefile_darwin b/PDContainer/makefile_darwin
new file mode 100755
index 0000000..c18af2c
--- /dev/null
+++ b/PDContainer/makefile_darwin
@@ -0,0 +1,120 @@
+PD-PATH=/usr/lib/pd
+PD-SCR=/usr/include
+
+
+CC = g++
+LD = g++
+INCLUDE=-I$(PD-SCR) -I.
+LIB=-lc -lm
+CC_FLAGS = -DPD -c -Wall
+LD_FLAGS = --export-dynamic -o
+OSX_LD_FLAGS = -bundle -bundle_loader $(PD-PATH)/bin/pd
+
+
+TARGET=PDContainer.pd_darwin
+OBJ=PDContainer.o HMap.o h_map.o HMultiMap.o h_multimap.o \
+ HSet.o h_set.o HMultiSet.o h_multiset.o \
+ HVector.o h_vector.o HDeque.o h_deque.o \
+ HQueue.o h_queue.o HStack.o h_stack.o \
+ HList.o h_list.o HPrioQueue.o h_prioqueue.o \
+ tinystr.o tinyxml.o tinyxmlerror.o tinyxmlparser.o
+#--------------------------------------------------------
+
+all: pd_darwin
+
+pd_darwin: $(TARGET)
+
+
+$(TARGET): $(OBJ)
+ $(LD) $(OSX_LD_FLAGS) $(LD_FLAGS) $(TARGET) $(OBJ) $(LIB)
+ #strip --strip-unneeded $(TARGET)
+ chmod 755 $(TARGET)
+
+PDContainer.o: h_map.o src/PDContainer.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/PDContainer.cpp
+
+h_map.o: HMap.o src/h_map.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_map.cpp
+
+HMap.o: src/HMap.cpp include/HMap.h include/MapBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HMap.cpp
+
+h_multimap.o: HMultiMap.o src/h_multimap.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_multimap.cpp
+
+HMultiMap.o: src/HMultiMap.cpp include/HMultiMap.h include/MapBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HMultiMap.cpp
+
+h_set.o: HSet.o src/h_set.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_set.cpp
+
+HSet.o: src/HSet.cpp include/HSet.h include/SimpleBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HSet.cpp
+
+h_multiset.o: HMultiSet.o src/h_multiset.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_multiset.cpp
+
+HMultiSet.o: src/HMultiSet.cpp include/HMultiSet.h include/SimpleBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HMultiSet.cpp
+
+h_vector.o: HVector.o src/h_vector.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_vector.cpp
+
+HVector.o: src/HVector.cpp include/HVector.h include/SequBase.h include/SimpleBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HVector.cpp
+
+h_deque.o: HDeque.o src/h_deque.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_deque.cpp
+
+HDeque.o: src/HDeque.cpp include/HDeque.h include/SequBase.h include/SimpleBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HDeque.cpp
+
+h_queue.o: HQueue.o src/h_queue.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_queue.cpp
+
+HQueue.o: src/HQueue.cpp include/HQueue.h include/QueueStack.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HQueue.cpp
+
+h_stack.o: HStack.o src/h_stack.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_stack.cpp
+
+HStack.o: src/HStack.cpp include/HStack.h include/QueueStack.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HStack.cpp
+
+h_list.o: HList.o src/h_list.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_list.cpp
+
+HList.o: src/HList.cpp include/HList.h include/SequBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HList.cpp
+
+h_prioqueue.o: HPrioQueue.o src/h_prioqueue.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_prioqueue.cpp
+
+HPrioQueue.o: src/HPrioQueue.cpp include/HPrioQueue.h include/QueueStack.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HPrioQueue.cpp
+
+#TinyXML:
+
+tinyxml.o: tinyxml/tinyxml.h tinyxml/tinyxml.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) tinyxml/tinyxml.cpp
+
+tinystr.o: tinyxml/tinystr.h tinyxml/tinystr.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) tinyxml/tinystr.cpp
+
+tinyxmlerror.o: tinyxml/tinyxmlerror.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) tinyxml/tinyxmlerror.cpp
+
+tinyxmlparser.o: tinyxml/tinyxmlparser.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) tinyxml/tinyxmlparser.cpp
+
+
+#-----------------------------------------------------
+
+
+clean:
+ rm -f $(OBJ) $(TARGET)
+
+
+install:
+ cp -f $(TARGET) $(PD-PATH)/externs
+ cp -f help/*.pd $(PD-PATH)/doc/5.reference
diff --git a/PDContainer/makefile_mingw b/PDContainer/makefile_mingw
new file mode 100755
index 0000000..613c594
--- /dev/null
+++ b/PDContainer/makefile_mingw
@@ -0,0 +1,120 @@
+PD-PATH=c:/pd
+PD-SCR=c:/pd/src
+
+
+CC = g++
+LD = g++
+INCLUDE=-I$(PD-SCR) -I.
+LIB=$(PD-PATH)/bin/pd.dll
+CC_FLAGS = -DPD -DWINDOWS -c -mms-bitfields -Wall
+LD_FLAGS = --export-dynamic -shared -o
+
+
+TARGET=PDContainer.dll
+OBJ=PDContainer.o HMap.o h_map.o HMultiMap.o h_multimap.o \
+ HSet.o h_set.o HMultiSet.o h_multiset.o \
+ HVector.o h_vector.o HDeque.o h_deque.o \
+ HQueue.o h_queue.o HStack.o h_stack.o \
+ HList.o h_list.o HPrioQueue.o h_prioqueue.o \
+ tinystr.o tinyxml.o tinyxmlerror.o tinyxmlparser.o
+#--------------------------------------------------------
+
+all: pd_linux
+
+pd_linux: $(TARGET)
+
+
+$(TARGET): $(OBJ)
+ $(LD) $(LD_FLAGS) $(TARGET) $(OBJ) $(LIB)
+ strip --strip-unneeded $(TARGET)
+ chmod 755 $(TARGET)
+
+PDContainer.o: h_map.o src/PDContainer.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/PDContainer.cpp
+
+h_map.o: HMap.o src/h_map.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_map.cpp
+
+HMap.o: src/HMap.cpp include/HMap.h include/MapBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HMap.cpp
+
+h_multimap.o: HMultiMap.o src/h_multimap.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_multimap.cpp
+
+HMultiMap.o: src/HMultiMap.cpp include/HMultiMap.h include/MapBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HMultiMap.cpp
+
+h_set.o: HSet.o src/h_set.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_set.cpp
+
+HSet.o: src/HSet.cpp include/HSet.h include/SimpleBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HSet.cpp
+
+h_multiset.o: HMultiSet.o src/h_multiset.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_multiset.cpp
+
+HMultiSet.o: src/HMultiSet.cpp include/HMultiSet.h include/SimpleBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HMultiSet.cpp
+
+h_vector.o: HVector.o src/h_vector.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_vector.cpp
+
+HVector.o: src/HVector.cpp include/HVector.h include/SequBase.h include/SimpleBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HVector.cpp
+
+h_deque.o: HDeque.o src/h_deque.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_deque.cpp
+
+HDeque.o: src/HDeque.cpp include/HDeque.h include/SequBase.h include/SimpleBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HDeque.cpp
+
+h_queue.o: HQueue.o src/h_queue.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_queue.cpp
+
+HQueue.o: src/HQueue.cpp include/HQueue.h include/QueueStack.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HQueue.cpp
+
+h_stack.o: HStack.o src/h_stack.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_stack.cpp
+
+HStack.o: src/HStack.cpp include/HStack.h include/QueueStack.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HStack.cpp
+
+h_list.o: HList.o src/h_list.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_list.cpp
+
+HList.o: src/HList.cpp include/HList.h include/SequBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HList.cpp
+
+h_prioqueue.o: HPrioQueue.o src/h_prioqueue.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/h_prioqueue.cpp
+
+HPrioQueue.o: src/HPrioQueue.cpp include/HPrioQueue.h include/QueueStack.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) src/HPrioQueue.cpp
+
+#TinyXML:
+
+tinyxml.o: tinyxml/tinyxml.h tinyxml/tinyxml.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) tinyxml/tinyxml.cpp
+
+tinystr.o: tinyxml/tinystr.h tinyxml/tinystr.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) tinyxml/tinystr.cpp
+
+tinyxmlerror.o: tinyxml/tinyxmlerror.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) tinyxml/tinyxmlerror.cpp
+
+tinyxmlparser.o: tinyxml/tinyxmlparser.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) tinyxml/tinyxmlparser.cpp
+
+
+#-----------------------------------------------------
+
+
+clean:
+ rm -f $(OBJ) $(TARGET)
+
+
+install:
+ cp -f $(TARGET) $(PD-PATH)/extra
+ cp -f help/*.pd $(PD-PATH)/doc/5.reference
+
diff --git a/PDContainer/makefile_msvc b/PDContainer/makefile_msvc
new file mode 100755
index 0000000..5578411
--- /dev/null
+++ b/PDContainer/makefile_msvc
@@ -0,0 +1,121 @@
+PD_PATH = "C:\pd"
+VIS_CPP_PATH = "C:\Programme\Microsoft Visual Studio\Vc98"
+PD_SCR = $(PD_PATH)\src
+
+CC = cl.exe
+LD = link.exe
+INCLUDE = /I. /I$(PD_SCR) /I$(VIS_CPP_PATH)\include
+CC_FLAGS = /nologo /W3 /DNT /DPD /GX /GD /Ox /MT /LD
+LD_FLAGS = /nologo /dll /export:PDContainer_setup
+LIB = $(VIS_CPP_PATH)\lib\libc.lib \
+ $(VIS_CPP_PATH)\lib\oldnames.lib \
+ $(VIS_CPP_PATH)\lib\kernel32.lib \
+ $(PD_PATH)\bin\pd.lib
+
+
+TARGET=PDContainer.dll
+OBJ=PDContainer.obj HMap.obj h_map.obj HMultiMap.obj h_multimap.obj \
+ HSet.obj h_set.obj HMultiSet.obj h_multiset.obj \
+ HVector.obj h_vector.obj HDeque.obj h_deque.obj \
+ HQueue.obj h_queue.obj HStack.obj h_stack.obj \
+ HList.obj h_list.obj HPrioQueue.obj h_prioqueue.obj \
+ tinystr.obj tinyxml.obj tinyxmlerror.obj tinyxmlparser.obj
+#--------------------------------------------------------
+
+all: pd_dll
+
+pd_dll: $(TARGET)
+
+
+$(TARGET): $(OBJ)
+ $(LD) $(LD_FLAGS) /out:$(TARGET) $(OBJ) $(LIB)
+
+
+PDContainer.obj: h_map.obj src/PDContainer.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/PDContainer.cpp
+
+h_map.obj: HMap.obj src/h_map.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/h_map.cpp
+
+HMap.obj: src/HMap.cpp include/HMap.h include/MapBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/HMap.cpp
+
+h_multimap.obj: HMultiMap.obj src/h_multimap.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/h_multimap.cpp
+
+HMultiMap.obj: src/HMultiMap.cpp include/HMultiMap.h include/MapBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/HMultiMap.cpp
+
+h_set.obj: HSet.obj src/h_set.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/h_set.cpp
+
+HSet.obj: src/HSet.cpp include/HSet.h include/SimpleBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/HSet.cpp
+
+h_multiset.obj: HMultiSet.obj src/h_multiset.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/h_multiset.cpp
+
+HMultiSet.obj: src/HMultiSet.cpp include/HMultiSet.h include/SimpleBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/HMultiSet.cpp
+
+h_vector.obj: HVector.obj src/h_vector.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/h_vector.cpp
+
+HVector.obj: src/HVector.cpp include/HVector.h include/SequBase.h include/SimpleBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/HVector.cpp
+
+h_deque.obj: HDeque.obj src/h_deque.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/h_deque.cpp
+
+HDeque.obj: src/HDeque.cpp include/HDeque.h include/SequBase.h include/SimpleBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/HDeque.cpp
+
+h_queue.obj: HQueue.obj src/h_queue.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/h_queue.cpp
+
+HQueue.obj: src/HQueue.cpp include/HQueue.h include/QueueStack.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/HQueue.cpp
+
+h_stack.obj: HStack.obj src/h_stack.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/h_stack.cpp
+
+HStack.obj: src/HStack.cpp include/HStack.h include/QueueStack.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/HStack.cpp
+
+h_list.obj: HList.obj src/h_list.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/h_list.cpp
+
+HList.obj: src/HList.cpp include/HList.h include/SequBase.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/HList.cpp
+
+h_prioqueue.obj: HPrioQueue.obj src/h_prioqueue.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/h_prioqueue.cpp
+
+HPrioQueue.obj: src/HPrioQueue.cpp include/HPrioQueue.h include/QueueStack.h include/ContainerBase.h include/GlobalStuff.h
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c src/HPrioQueue.cpp
+
+#TinyXML:
+
+tinyxml.obj: tinyxml/tinyxml.h tinyxml/tinyxml.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c tinyxml/tinyxml.cpp
+
+tinystr.obj: tinyxml/tinystr.h tinyxml/tinystr.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c tinyxml/tinystr.cpp
+
+tinyxmlerror.obj: tinyxml/tinyxmlerror.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c tinyxml/tinyxmlerror.cpp
+
+tinyxmlparser.obj: tinyxml/tinyxmlparser.cpp
+ $(CC) $(CC_FLAGS) $(INCLUDE) /c tinyxml/tinyxmlparser.cpp
+
+
+#-----------------------------------------------------
+
+
+clean:
+ del *.obj *.dll *.lib *.exp
+
+
+install:
+ copy $(TARGET) $(PD_PATH)/extra
+ copy help/*.pd $(PD_PATH)/doc/5.reference
diff --git a/PDContainer/pdcontainer_multi.dtd b/PDContainer/pdcontainer_multi.dtd
new file mode 100755
index 0000000..7a04cf8
--- /dev/null
+++ b/PDContainer/pdcontainer_multi.dtd
@@ -0,0 +1,17 @@
+<!ELEMENT PDContainer (element)+>
+<!ATTLIST PDContainer
+ type (h_map | h_multimap) #REQUIRED
+>
+
+<!ELEMENT element (key, value)>
+
+<!ELEMENT key (s, symbol, f, float)+>
+<!ELEMENT value (s, symbol, f, float)+>
+
+<!-- s is equivalent to symbol -->
+<!ELEMENT s (#PCDATA)>
+<!ELEMENT symbol (#PCDATA)>
+
+<!-- f is equivalent to float -->
+<!ELEMENT f (#PCDATA)>
+<!ELEMENT float (#PCDATA)> \ No newline at end of file
diff --git a/PDContainer/pdcontainer_simple.dtd b/PDContainer/pdcontainer_simple.dtd
new file mode 100755
index 0000000..10a862e
--- /dev/null
+++ b/PDContainer/pdcontainer_simple.dtd
@@ -0,0 +1,14 @@
+<!ELEMENT PDContainer (element)+>
+<!ATTLIST PDContainer
+ type (h_vector | h_list | h_deque | h_set | h_multiset) #REQUIRED
+>
+
+<!ELEMENT element (s, symbol, f, float)+>
+
+<!-- s is equivalent to symbol -->
+<!ELEMENT s (#PCDATA)>
+<!ELEMENT symbol (#PCDATA)>
+
+<!-- f is equivalent to float -->
+<!ELEMENT f (#PCDATA)>
+<!ELEMENT float (#PCDATA)> \ No newline at end of file
diff --git a/PDContainer/readme.txt b/PDContainer/readme.txt
new file mode 100755
index 0000000..89bdaf4
--- /dev/null
+++ b/PDContainer/readme.txt
@@ -0,0 +1,47 @@
+PDContainer - by Georg Holzmann <grh@mur.at>, 2004-2005
+
+
+--------------------------------license---------------------------------------
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+In the official PDContainer distribution, the GNU General Public License is
+in the file gpl.txt
+
+
+------------------------------PDContainer-------------------------------------
+
+::: GOAL OF THE LIBRARY :::
+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.
+
+::: DATASTRUCTURES :::
+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.
+
+::: NAMESPACES :::
+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.
+
+::: DATATYPES :::
+In the containers you can save all of the build-in datatypes: lists, floats, symbols and pointers.
+
+::: SAVE/LOAD :::
+All the data of all containers can be saved to disk as XML or textfile. 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.
diff --git a/PDContainer/src/HDeque.cpp b/PDContainer/src/HDeque.cpp
new file mode 100755
index 0000000..3a1c317
--- /dev/null
+++ b/PDContainer/src/HDeque.cpp
@@ -0,0 +1,15 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HDeque.cpp
+
+
+#include "include/HDeque.h"
+
diff --git a/PDContainer/src/HList.cpp b/PDContainer/src/HList.cpp
new file mode 100755
index 0000000..9a5935f
--- /dev/null
+++ b/PDContainer/src/HList.cpp
@@ -0,0 +1,111 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HList.cpp
+
+
+#include "include/HList.h"
+
+
+//----------------------------------------------------
+/* reads from an input file and adds the data to
+ * the current namespace
+ * Fileformat: see saveToFile
+ * returns true on success
+ */
+bool HList::readFromFile(string filename)
+{
+ makeIterator();
+
+ ifstream infile;
+ infile.open(filename.c_str());
+
+ if(!infile)
+ return false;
+
+ Element key;
+
+ string line;
+ bool go_on = false;
+ char type;
+ string symbol;
+ t_float number;
+ int key_count;
+
+ while (getline(infile, line))
+ {
+ // first parse the instream, to get the number of atoms
+ // (= size of the list)
+
+ istringstream instream(line);
+ ostringstream key_str("");
+
+ go_on = false; key_count = 0;
+ while(!go_on)
+ {
+ instream >> type;
+ if (instream.eof())
+ {
+ go_on = true;
+ break;
+ }
+ if (type == 's')
+ {
+ key_count++;
+ instream >> symbol;
+ key_str << "s " << symbol;
+ }
+ if (type == 'f')
+ {
+ key_count++;
+ instream >> number;
+ key_str << "f " << number;
+ }
+ if (instream.eof())
+ go_on = true;
+ key_str << " ";
+ }
+
+ // now objects, parse again the data
+ // into the objects and add them to the container
+
+ t_atom *key_atom = (t_atom*)getbytes(key_count*sizeof(t_atom));
+ if(key_atom == NULL)
+ post("Fatal Error Out Of Memory (%s-readFromFile)",dataname_.c_str());
+
+ istringstream key_istr(key_str.str());
+
+ for(int i = 0; i < key_count; i++)
+ {
+ key_istr >> type;
+ if (type == 's')
+ {
+ key_istr >> symbol;
+ SETSYMBOL(&key_atom[i],gensym(const_cast<char*>(symbol.c_str())));
+ }
+ if (type == 'f')
+ {
+ key_istr >> number;
+ SETFLOAT(&key_atom[i],number);
+ }
+ }
+
+ key.setAtoms(key_count,key_atom);
+
+ // insert the data
+ data_[h_namespace_].insert(iter_,key);
+
+ freebytes(key_atom, key_count*sizeof(t_atom));
+ }
+
+ infile.close();
+
+ return true;
+}
diff --git a/PDContainer/src/HMap.cpp b/PDContainer/src/HMap.cpp
new file mode 100755
index 0000000..c7e8534
--- /dev/null
+++ b/PDContainer/src/HMap.cpp
@@ -0,0 +1,15 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HMap.cpp
+
+
+#include "include/HMap.h"
+
diff --git a/PDContainer/src/HMultiMap.cpp b/PDContainer/src/HMultiMap.cpp
new file mode 100755
index 0000000..ecc482e
--- /dev/null
+++ b/PDContainer/src/HMultiMap.cpp
@@ -0,0 +1,38 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HMultiMap.cpp
+
+
+#include "include/HMultiMap.h"
+
+
+//---------------------------------------------------
+/* Get a value from the specific Key with the index number
+ * index starts with 0
+ * returns an element wich points to 0 if nothing was found !!!
+ */
+Element &HMultiMap::get(Element &key, int index) const
+{
+ int count = 0;
+
+ for (multimap<Element,Element>::iterator it = data_[h_namespace_].begin();
+ it != data_[h_namespace_].end(); ++it)
+ {
+ if ((*it).first == key)
+ {
+ if(index == count++)
+ return ((*it).second);
+ }
+ }
+
+ // throw an exception if nothing was found
+ throw "h_multimap, get: Element not found !";
+}
diff --git a/PDContainer/src/HMultiSet.cpp b/PDContainer/src/HMultiSet.cpp
new file mode 100755
index 0000000..07dd564
--- /dev/null
+++ b/PDContainer/src/HMultiSet.cpp
@@ -0,0 +1,15 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HMultiSet.cpp
+
+
+#include "include/HMultiSet.h"
+
diff --git a/PDContainer/src/HPrioQueue.cpp b/PDContainer/src/HPrioQueue.cpp
new file mode 100755
index 0000000..f998530
--- /dev/null
+++ b/PDContainer/src/HPrioQueue.cpp
@@ -0,0 +1,15 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HPrioQueue.cpp
+
+
+#include "include/HPrioQueue.h"
+
diff --git a/PDContainer/src/HQueue.cpp b/PDContainer/src/HQueue.cpp
new file mode 100755
index 0000000..0fa012b
--- /dev/null
+++ b/PDContainer/src/HQueue.cpp
@@ -0,0 +1,15 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HQueue.cpp
+
+
+#include "include/HQueue.h"
+
diff --git a/PDContainer/src/HSet.cpp b/PDContainer/src/HSet.cpp
new file mode 100755
index 0000000..f6caf2b
--- /dev/null
+++ b/PDContainer/src/HSet.cpp
@@ -0,0 +1,15 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HSet.cpp
+
+
+#include "include/HSet.h"
+
diff --git a/PDContainer/src/HStack.cpp b/PDContainer/src/HStack.cpp
new file mode 100755
index 0000000..ea9fc35
--- /dev/null
+++ b/PDContainer/src/HStack.cpp
@@ -0,0 +1,15 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HStack.cpp
+
+
+#include "include/HStack.h"
+
diff --git a/PDContainer/src/HVector.cpp b/PDContainer/src/HVector.cpp
new file mode 100755
index 0000000..94616c4
--- /dev/null
+++ b/PDContainer/src/HVector.cpp
@@ -0,0 +1,15 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// HVector.cpp
+
+
+#include "include/HVector.h"
+
diff --git a/PDContainer/src/PDContainer.cpp b/PDContainer/src/PDContainer.cpp
new file mode 100755
index 0000000..fc27477
--- /dev/null
+++ b/PDContainer/src/PDContainer.cpp
@@ -0,0 +1,78 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// PDContainer.cpp
+
+
+#include "include/GlobalStuff.h"
+
+
+typedef struct PDContainer
+{
+ t_object x_obj;
+} t_PDContainer;
+
+t_class *PDContainer_class;
+
+static void PDContainer_help(void)
+{
+ post("\nPD-Container, Version: "PDC_VERSION"");
+ post("------------------------------------------");
+ post("this is an implementation of the container");
+ post("objects from the Standard Template");
+ post("Library (STL) of C++");
+ post("for documentation see the help patches");
+ post("(by Georg Holzmann <grh@mur.at>, 2004)");
+ post("------------------------------------------\n");
+}
+
+static void *PDContainer_new(void)
+{
+ t_PDContainer *x = (t_PDContainer *)pd_new(PDContainer_class);
+ return (void *)x;
+}
+
+//-----------------------------------------------------
+// declaration of the setup functions:
+void h_map_setup();
+void h_multimap_setup();
+void h_set_setup();
+void h_multiset_setup();
+void h_vector_setup();
+void h_deque_setup();
+void h_queue_setup();
+void h_priority_queue_setup();
+void h_stack_setup();
+void h_list_setup();
+//-end-of-declaration----------------------------------
+
+extern "C" void PDContainer_setup(void)
+{
+ //---------------------------------------------------
+ // call all the setup functions:
+ h_map_setup();
+ h_multimap_setup();
+ h_set_setup();
+ h_multiset_setup();
+ h_vector_setup();
+ h_deque_setup();
+ h_queue_setup();
+ h_priority_queue_setup();
+ h_stack_setup();
+ h_list_setup();
+ //-end-----------------------------------------------
+
+ post("\nPD-Container, Version: "PDC_VERSION", by Georg Holzmann <grh@mur.at>, 2004-2005");
+
+ // without an argument the following two methods wont work ??? why?? because of c++?
+ PDContainer_class = class_new(gensym("PDContainer"), (t_newmethod)PDContainer_new,
+ 0, sizeof(t_PDContainer), CLASS_DEFAULT, A_DEFFLOAT, 0);
+ class_addmethod(PDContainer_class, (t_method)PDContainer_help, gensym("help"), A_DEFFLOAT, 0);
+}
diff --git a/PDContainer/src/h_deque.cpp b/PDContainer/src/h_deque.cpp
new file mode 100755
index 0000000..6246a51
--- /dev/null
+++ b/PDContainer/src/h_deque.cpp
@@ -0,0 +1,578 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// h_deque.cpp
+
+
+#include "include/HDeque.h"
+
+
+static t_class *h_deque_class;
+static t_class *proxy_class;
+
+typedef struct _h_deque
+{
+ t_object x_obj;
+ t_canvas *x_canvas;
+ t_outlet *out0, *out1, *out2;
+ HDeque *hdeque;
+ Element value;
+ bool event_set;
+} t_h_deque;
+
+typedef struct proxy
+{
+ t_object obj;
+ t_int index; // number of proxy inlet(s)
+ t_h_deque *x; // we'll put the other struct in here
+} t_proxy;
+
+static void h_deque_set(t_h_deque *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int index;
+ if(argc && (argv[0].a_type == A_FLOAT))
+ index = static_cast<int>(argv[0].a_w.w_float);
+ else
+ {
+ post("h_deque, set: invalid index!");
+ return;
+ }
+
+ if ( index >= x->hdeque->getSize() || index < 0 )
+ {
+ post("h_deque, set: invalid index!");
+ return;
+ }
+
+ if(!x->event_set)
+ {
+ post("h_deque, set: you must first set a value at right inlet!");
+ return;
+ }
+
+ x->hdeque->set( index , x->value);
+ x->event_set = false;
+}
+
+static void h_deque_insert(t_h_deque *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int index;
+ if(argc && (argv[0].a_type == A_FLOAT))
+ index = static_cast<int>(argv[0].a_w.w_float);
+ else
+ {
+ post("h_deque, insert: invalid index!");
+ return;
+ }
+
+ if ( index >= x->hdeque->getSize() || index < 0 )
+ {
+ post("h_deque, insert: invalid index!");
+ return;
+ }
+
+ if(!x->event_set)
+ {
+ post("h_deque, insert: you must first set a value at right inlet!");
+ return;
+ }
+
+ x->hdeque->insert( index , x->value);
+ x->event_set = false;
+}
+
+static void h_deque_value(t_proxy *p, t_symbol *s, int argc, t_atom *argv)
+{
+ t_h_deque *x = (t_h_deque *)(p->x);
+
+ // symbol without selector "symbol":
+ if(argc == 0)
+ {
+ t_atom tmp;
+ SETSYMBOL(&tmp, s);
+ x->value.setAtoms(1, &tmp);
+ x->event_set = true;
+ return;
+ }
+
+ // input is a list without selector "list":
+ if ( argc && (strcmp(s->s_name,"list")!=0)
+ && (strcmp(s->s_name,"float")!=0)
+ && (strcmp(s->s_name,"symbol")!=0)
+ && (strcmp(s->s_name,"pointer")!=0) )
+ {
+ t_atom *atoms = (t_atom*)getbytes( (argc+1)*sizeof(t_atom) );
+
+ // add the selector symbol to the list:
+ SETSYMBOL(atoms, s);
+
+ for(int i=0; i<argc; i++)
+ {
+ if(argv[i].a_type == A_FLOAT)
+ SETFLOAT(&atoms[i+1],argv[i].a_w.w_float);
+ if(argv[i].a_type == A_SYMBOL)
+ SETSYMBOL(&atoms[i+1],argv[i].a_w.w_symbol);
+ if(argv[i].a_type == A_POINTER)
+ SETPOINTER(&atoms[i+1],argv[i].a_w.w_gpointer);
+ }
+
+ x->value.setAtoms(argc+1, atoms);
+
+ x->event_set = true;
+ freebytes(atoms, (argc+1)*sizeof(t_atom));
+ return;
+ }
+
+ // "normal" input (list, float or symbol):
+ if (argc)
+ {
+ x->value.setAtoms(argc, argv);
+ x->event_set = true;
+ return;
+ }
+}
+
+static void h_deque_get(t_h_deque *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int index;
+ if(argc && (argv[0].a_type == A_FLOAT))
+ index = static_cast<int>(argv[0].a_w.w_float);
+ else
+ {
+ post("h_deque, get: invalid index!");
+ return;
+ }
+
+ if ( index >= x->hdeque->getSize() || index < 0 )
+ {
+ post("h_deque, get: invalid index!");
+ return;
+ }
+
+ Element output = x->hdeque->get( index );
+
+ if(output.getLength() == 1) // symbol or float
+ {
+ if (output.getAtom()[0].a_type == A_FLOAT)
+ outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
+ if (output.getAtom()[0].a_type == A_SYMBOL)
+ outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
+ if (output.getAtom()[0].a_type == A_POINTER)
+ outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
+ return;
+ }
+ if(output.getLength() > 1) // list
+ {
+ outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
+ return;
+ }
+
+ // if there was no Element found, put out a bang at the right outlet
+ outlet_bang(x->out2);
+}
+
+static void h_deque_push_back(t_h_deque *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(argc)
+ {
+ Element key(argc,argv);
+ x->hdeque->pushBack(key);
+ }
+ else
+ post("h_deque, pushback: no arguments");
+}
+
+static void h_deque_pop_back(t_h_deque *x)
+{
+ if(x->hdeque->getSize()<=0)
+ {
+ post("h_deque, popback: size is already 0 !");
+ return;
+ }
+
+ x->hdeque->popBack();
+}
+
+static void h_deque_back(t_h_deque *x)
+{
+ if(x->hdeque->getSize() == 0)
+ {
+ post("h_deque, back: size is 0 !");
+ return;
+ }
+
+ Element output = x->hdeque->back();
+
+ if(output.getLength() == 1) // symbol or float
+ {
+ if (output.getAtom()[0].a_type == A_FLOAT)
+ outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
+ if (output.getAtom()[0].a_type == A_SYMBOL)
+ outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
+ if (output.getAtom()[0].a_type == A_POINTER)
+ outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
+ return;
+ }
+ if(output.getLength() > 1) // list
+ {
+ outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
+ return;
+ }
+
+ // if there was no Element found, put out a bang at the right outlet
+ outlet_bang(x->out2);
+}
+
+static void h_deque_push_front(t_h_deque *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(argc)
+ {
+ Element key(argc,argv);
+ x->hdeque->pushFront(key);
+ }
+ else
+ post("h_deque, pushfront: no arguments");
+}
+
+static void h_deque_pop_front(t_h_deque *x)
+{
+ if(x->hdeque->getSize()<=0)
+ {
+ post("h_deque, popfront: size is already 0 !");
+ return;
+ }
+
+ x->hdeque->popFront();
+}
+
+static void h_deque_front(t_h_deque *x)
+{
+ if(x->hdeque->getSize() == 0)
+ {
+ post("h_deque, front: size is 0 !");
+ return;
+ }
+
+ Element output = x->hdeque->front();
+
+ if(output.getLength() == 1) // symbol or float
+ {
+ if (output.getAtom()[0].a_type == A_FLOAT)
+ outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
+ if (output.getAtom()[0].a_type == A_SYMBOL)
+ outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
+ if (output.getAtom()[0].a_type == A_POINTER)
+ outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
+ return;
+ }
+ if(output.getLength() > 1) // list
+ {
+ outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
+ return;
+ }
+
+ // if there was no Element found, put out a bang at the right outlet
+ outlet_bang(x->out2);
+}
+
+static void h_deque_remove(t_h_deque *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int index;
+ if(argc && (argv[0].a_type == A_FLOAT))
+ index = static_cast<int>(argv[0].a_w.w_float);
+ else
+ {
+ post("h_deque, remove: invalid index!");
+ return;
+ }
+
+ if ( index >= x->hdeque->getSize() || index < 0 )
+ {
+ post("h_deque, remove: invalid index!");
+ return;
+ }
+
+ x->hdeque->remove(index);
+ x->event_set = false;
+}
+
+static void h_deque_resize(t_h_deque *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int size;
+ if(argc && (argv[0].a_type == A_FLOAT))
+ size = static_cast<int>(argv[0].a_w.w_float);
+ else
+ {
+ post("h_deque, resize: invalid index!");
+ return;
+ }
+
+ if ( size < 0 )
+ {
+ post("h_deque, size: invalid size!");
+ return;
+ }
+
+ x->hdeque->resize( size );
+}
+
+static void h_deque_getsize(t_h_deque *x)
+{
+ outlet_float(x->out1,x->hdeque->getSize());
+}
+
+static void h_deque_help(t_h_deque *x)
+{
+ x->hdeque->help();
+}
+
+static void h_deque_set_namespace(t_h_deque *x, t_symbol *s)
+{
+ x->hdeque->setNamespace(s->s_name);
+}
+
+static void h_deque_get_namespace(t_h_deque *x)
+{
+ post("h_deque current namespace: %s",x->hdeque->getNamespace().c_str());
+}
+
+static void h_deque_print(t_h_deque *x)
+{
+ x->hdeque->printAllIndex();
+}
+
+static void h_deque_clear(t_h_deque *x)
+{
+ x->hdeque->clearNamespace();
+}
+
+static void h_deque_clear_all(t_h_deque *x)
+{
+ x->hdeque->clearAll();
+}
+
+static void h_deque_save(t_h_deque *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(x->hdeque->saveToFile(filename))
+ post("h_deque: data of namespace %s written to file %s",
+ x->hdeque->getNamespace().c_str(),s->s_name);
+ else
+ post("h_deque: couldn't write to file %s",s->s_name);
+}
+
+static void h_deque_read(t_h_deque *x, t_symbol *s, int argc, t_atom *argv)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hdeque->readFromFile(filename))
+ post("h_deque: couldn't read from file %s",s->s_name);
+}
+
+static void h_deque_read_at(t_h_deque *x, t_symbol *s, int argc, t_atom *argv)
+{
+ string symbol;
+ int index=0;
+
+ switch(argc)
+ {
+ default:
+ post("h_deque read: only two argument are possible!");
+ break;
+ case 2:
+ symbol = argv[0].a_w.w_symbol->s_name;
+ index = (int)argv[1].a_w.w_float;
+ break;
+ case 1:
+ symbol = argv[0].a_w.w_symbol->s_name;
+ index = 0;
+ break;
+ case 0:
+ post("h_deque read: no filename!");
+ }
+
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, (char*)symbol.c_str(), filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hdeque->readFromFile2(filename,index))
+ post("h_deque: couldn't read from file %s",s->s_name);
+}
+
+static void h_deque_save_xml(t_h_deque *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(x->hdeque->saveToFileXML(filename))
+ post("h_deque: data of namespace %s written to file %s",
+ x->hdeque->getNamespace().c_str(),s->s_name);
+ else
+ post("h_deque: couldn't write to file %s",s->s_name);
+}
+
+static void h_deque_read_xml(t_h_deque *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hdeque->readFromFileXML(filename))
+ post("h_deque: couldn't read from file %s",s->s_name);
+}
+
+static void h_deque_read_at_xml(t_h_deque *x, t_symbol *s, int argc, t_atom *argv)
+{
+ string symbol;
+ int index=0;
+
+ switch(argc)
+ {
+ default:
+ post("h_deque read: only two argument are possible!");
+ break;
+ case 2:
+ symbol = argv[0].a_w.w_symbol->s_name;
+ index = (int)argv[1].a_w.w_float;
+ break;
+ case 1:
+ symbol = argv[0].a_w.w_symbol->s_name;
+ index = 0;
+ break;
+ case 0:
+ post("h_deque read: no filename!");
+ }
+
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, (char*)symbol.c_str(), filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hdeque->readFromFile2XML(filename,index))
+ post("h_deque: couldn't read from file %s",s->s_name);
+}
+
+static void *h_deque_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_h_deque *x = (t_h_deque *)pd_new(h_deque_class);
+ t_proxy *inlet = (t_proxy *)pd_new(proxy_class); // for the proxy inlet
+
+ inlet->x = x; // make x visible to the proxy inlets
+
+ switch(argc)
+ {
+ default:
+ post("h_deque warning: only one argument for namespace is possible!");
+ case 1:
+ x->hdeque = new HDeque(atom_getsymbol(argv)->s_name);
+ break;
+ case 0:
+ x->hdeque = new HDeque();
+ break;
+ }
+
+ // we are going to create a proxy inlet no. 0
+ // it belongs to the object x but the destination is t_proxy
+ inlet->index = 0;
+ inlet_new(&x->x_obj, &inlet->obj.ob_pd, 0,0);
+
+ x->out0 = outlet_new(&x->x_obj, 0);
+ x->out1 = outlet_new(&x->x_obj, &s_float);
+ x->out2 = outlet_new(&x->x_obj, &s_bang);
+ x->x_canvas = canvas_getcurrent();
+
+ return (void *)x;
+}
+
+static void *h_deque_free(t_h_deque *x)
+{
+ delete x->hdeque;
+ return (void *)x;
+}
+
+void h_deque_setup(void)
+{
+ // the object class
+ h_deque_class = class_new(gensym("h_deque"), (t_newmethod)h_deque_new,
+ (t_method)h_deque_free, sizeof(t_h_deque),
+ CLASS_DEFAULT, A_GIMME, 0);
+
+ // a class for the proxy-inlet
+ proxy_class = class_new(gensym("h_deque_proxy"), NULL, NULL, sizeof(t_proxy),
+ CLASS_PD|CLASS_NOINLET, A_NULL);
+
+ class_addmethod(h_deque_class, (t_method)h_deque_set,
+ gensym("set"), A_GIMME, 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_insert,
+ gensym("insert"), A_GIMME, 0);
+ class_addanything(proxy_class, (t_method)h_deque_value); // the right inlet
+ class_addmethod(h_deque_class, (t_method)h_deque_get,
+ gensym("get"), A_GIMME, 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_push_back,
+ gensym("pushback"), A_GIMME, 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_pop_back,
+ gensym("popback"), A_DEFFLOAT, 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_back,
+ gensym("back"), A_DEFFLOAT, 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_push_front,
+ gensym("pushfront"), A_GIMME, 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_pop_front,
+ gensym("popfront"), A_DEFFLOAT, 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_front,
+ gensym("front"), A_DEFFLOAT, 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_remove,
+ gensym("remove"), A_GIMME, 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_resize,
+ gensym("resize"), A_GIMME , 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_getsize,
+ gensym("getsize"), A_DEFFLOAT , 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_set_namespace,
+ gensym("namespace"), A_DEFSYMBOL , 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_get_namespace,
+ gensym("getnamespace"), A_DEFFLOAT, 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_print,
+ gensym("print"), A_DEFFLOAT, 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_clear,
+ gensym("clear"), A_DEFFLOAT, 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_clear_all,
+ gensym("clearall"), A_DEFFLOAT, 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_save,
+ gensym("save"), A_DEFSYMBOL, 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_read,
+ gensym("read"), A_DEFSYMBOL, 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_read_at,
+ gensym("readat"), A_GIMME, 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_save_xml,
+ gensym("saveXML"), A_DEFSYMBOL , 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_read_xml,
+ gensym("readXML"), A_DEFSYMBOL , 0);
+ class_addmethod(h_deque_class, (t_method)h_deque_read_at_xml,
+ gensym("readatXML"), A_GIMME, 0);
+
+ // without an argument the following two methods wont work ??? why?? because of c++?
+ class_addmethod(h_deque_class, (t_method)h_deque_help, gensym("help"),A_DEFFLOAT, 0);
+}
diff --git a/PDContainer/src/h_list.cpp b/PDContainer/src/h_list.cpp
new file mode 100755
index 0000000..bbe9b68
--- /dev/null
+++ b/PDContainer/src/h_list.cpp
@@ -0,0 +1,442 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// h_list.cpp
+
+
+#include "include/HList.h"
+
+
+static t_class *h_list_class;
+
+typedef struct _h_list
+{
+ t_object x_obj;
+ t_canvas *x_canvas;
+ t_outlet *out0, *out1, *out2, *out3;
+ HList *hlist;
+} t_h_list;
+
+static void h_list_push_back(t_h_list *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(argc)
+ {
+ Element key(argc,argv);
+ x->hlist->pushBack(key);
+ }
+ else
+ post("h_list, pushback: no arguments");
+}
+
+static void h_list_pop_back(t_h_list *x)
+{
+ if(x->hlist->getSize()<=0)
+ {
+ post("h_list, popback: size is 0 !");
+ return;
+ }
+
+ x->hlist->popBack();
+}
+
+static void h_list_push_front(t_h_list *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(argc)
+ {
+ Element key(argc,argv);
+ x->hlist->pushFront(key);
+ }
+ else
+ post("h_list, pushfront: no arguments");
+}
+
+static void h_list_pop_front(t_h_list *x)
+{
+ if(x->hlist->getSize()<=0)
+ {
+ post("h_list, popfront: size is 0 !");
+ return;
+ }
+
+ x->hlist->popFront();
+}
+
+static void h_list_back(t_h_list *x)
+{
+ if(x->hlist->getSize() == 0)
+ {
+ outlet_bang(x->out3);
+ return;
+ }
+
+ Element output = x->hlist->back();
+
+ if(output.getLength() == 1) // symbol, float or pointer
+ {
+ if (output.getAtom()[0].a_type == A_FLOAT)
+ outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
+ if (output.getAtom()[0].a_type == A_SYMBOL)
+ outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
+ if (output.getAtom()[0].a_type == A_POINTER)
+ outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
+ return;
+ }
+ if(output.getLength() > 1) // list
+ {
+ outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
+ return;
+ }
+
+ outlet_bang(x->out3);
+}
+
+static void h_list_front(t_h_list *x)
+{
+ if(x->hlist->getSize() == 0)
+ {
+ outlet_bang(x->out3);
+ return;
+ }
+
+ Element output = x->hlist->front();
+
+ if(output.getLength() == 1) // symbol or float
+ {
+ if (output.getAtom()[0].a_type == A_FLOAT)
+ outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
+ if (output.getAtom()[0].a_type == A_SYMBOL)
+ outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
+ if (output.getAtom()[0].a_type == A_POINTER)
+ outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
+ return;
+ }
+ if(output.getLength() > 1) // list
+ {
+ outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
+ return;
+ }
+
+ outlet_bang(x->out3);
+}
+
+static void h_list_get(t_h_list *x)
+{
+ if(x->hlist->getSize() == 0)
+ {
+ outlet_bang(x->out3);
+ return;
+ }
+
+ Element output;
+
+ try
+ { output = x->hlist->get(); }
+
+ catch(const char* s)
+ {
+ // if there was no Element found, put out a bang at the right outlet
+ post("%s", s);
+ outlet_bang(x->out3);
+ return;
+ }
+
+ if(output.getLength() == 1) // symbol or float
+ {
+ if (output.getAtom()[0].a_type == A_FLOAT)
+ outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
+ if (output.getAtom()[0].a_type == A_SYMBOL)
+ outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
+ if (output.getAtom()[0].a_type == A_POINTER)
+ outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
+ return;
+ }
+ if(output.getLength() > 1) // list
+ {
+ outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
+ return;
+ }
+
+ outlet_bang(x->out3);
+}
+
+static void h_list_insert(t_h_list *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(argc)
+ {
+ Element key(argc,argv);
+ x->hlist->insert(key);
+ }
+ else
+ post("h_list, insert: no arguments");
+}
+
+static void h_list_modify(t_h_list *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(argc)
+ {
+ Element key(argc,argv);
+ x->hlist->modify(key);
+ }
+ else
+ post("h_list, modify: no arguments");
+}
+
+static void h_list_remove(t_h_list *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(argc)
+ {
+ Element key(argc,argv);
+ x->hlist->remove(key);
+ }
+ else
+ post("h_list, remove: no arguments");
+}
+
+static void h_list_delete(t_h_list *x)
+{
+ x->hlist->del();
+}
+
+static void h_list_begin(t_h_list *x)
+{
+ x->hlist->begin();
+}
+
+static void h_list_end(t_h_list *x)
+{
+ x->hlist->end();
+}
+
+static void h_list_next(t_h_list *x)
+{
+ x->hlist->next();
+}
+
+static void h_list_last(t_h_list *x)
+{
+ x->hlist->last();
+}
+
+static void h_list_unique(t_h_list *x)
+{
+ x->hlist->unique();
+}
+
+static void h_list_reverse(t_h_list *x)
+{
+ x->hlist->reverse();
+}
+
+static void h_list_sort(t_h_list *x)
+{
+ x->hlist->sort();
+}
+
+static void h_list_getsize(t_h_list *x)
+{
+ outlet_float(x->out2,x->hlist->getSize());
+}
+
+static void h_list_get_iter_pos(t_h_list *x)
+{
+ outlet_float(x->out1,x->hlist->getIterPos());
+}
+
+static void h_list_set_iter_pos(t_h_list *x, t_floatarg f)
+{
+ x->hlist->setIterPos(static_cast<int>(f));
+}
+
+static void h_list_help(t_h_list *x)
+{
+ x->hlist->help();
+}
+
+static void h_list_set_namespace(t_h_list *x, t_symbol *s)
+{
+ x->hlist->setNamespace(s->s_name);
+}
+
+static void h_list_get_namespace(t_h_list *x)
+{
+ post("h_list current namespace: %s",x->hlist->getNamespace().c_str());
+}
+
+static void h_list_clear(t_h_list *x)
+{
+ x->hlist->clearNamespace();
+}
+
+static void h_list_clear_all(t_h_list *x)
+{
+ x->hlist->clearAll();
+}
+
+static void h_list_print(t_h_list *x)
+{
+ x->hlist->printAllIndex();
+}
+
+static void h_list_save(t_h_list *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(x->hlist->saveToFile(filename))
+ post("h_list: data of namespace %s written to file %s",
+ x->hlist->getNamespace().c_str(),s->s_name);
+ else
+ post("h_list: couldn't write to file %s",s->s_name);
+}
+
+static void h_list_read(t_h_list *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hlist->readFromFile(filename))
+ post("h_list: couldn't read from file %s",s->s_name);
+}
+
+static void h_list_save_xml(t_h_list *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(x->hlist->saveToFileXML(filename))
+ post("h_list: data of namespace %s written to file %s",
+ x->hlist->getNamespace().c_str(),s->s_name);
+ else
+ post("h_list: couldn't write to file %s",s->s_name);
+}
+
+static void h_list_read_xml(t_h_list *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hlist->readFromFileXML(filename))
+ post("h_list: couldn't read from file %s",s->s_name);
+}
+
+static void *h_list_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_h_list *x = (t_h_list *)pd_new(h_list_class);
+
+ switch(argc)
+ {
+ default:
+ post("h_list warning: only one argument for namespace is possible!");
+ case 1:
+ x->hlist = new HList(atom_getsymbol(argv)->s_name);
+ break;
+ case 0:
+ x->hlist = new HList();
+ break;
+ }
+
+ x->out0 = outlet_new(&x->x_obj, 0);
+ x->out1 = outlet_new(&x->x_obj, &s_float);
+ x->out2 = outlet_new(&x->x_obj, &s_float);
+ x->out3 = outlet_new(&x->x_obj, &s_bang);
+ x->x_canvas = canvas_getcurrent();
+
+ return (void *)x;
+}
+
+static void *h_list_free(t_h_list *x)
+{
+ delete x->hlist;
+ return (void *)x;
+}
+
+void h_list_setup(void)
+{
+ // the object class
+ h_list_class = class_new(gensym("h_list"), (t_newmethod)h_list_new,
+ (t_method)h_list_free, sizeof(t_h_list),
+ CLASS_DEFAULT, A_GIMME, 0);
+
+ class_addmethod(h_list_class, (t_method)h_list_push_back,
+ gensym("pushback"), A_GIMME, 0);
+ class_addmethod(h_list_class, (t_method)h_list_pop_back,
+ gensym("popback"), A_DEFFLOAT, 0);
+ class_addmethod(h_list_class, (t_method)h_list_push_front,
+ gensym("pushfront"), A_GIMME, 0);
+ class_addmethod(h_list_class, (t_method)h_list_pop_front,
+ gensym("popfront"), A_DEFFLOAT, 0);
+ class_addmethod(h_list_class, (t_method)h_list_back,
+ gensym("back"), A_DEFFLOAT, 0);
+ class_addmethod(h_list_class, (t_method)h_list_front,
+ gensym("front"), A_DEFFLOAT, 0);
+ class_addmethod(h_list_class, (t_method)h_list_get,
+ gensym("get"), A_DEFFLOAT, 0);
+ class_addmethod(h_list_class, (t_method)h_list_insert,
+ gensym("insert"), A_GIMME, 0);
+ class_addmethod(h_list_class, (t_method)h_list_modify,
+ gensym("modify"), A_GIMME, 0);
+ class_addmethod(h_list_class, (t_method)h_list_remove,
+ gensym("remove"), A_GIMME, 0);
+ class_addmethod(h_list_class, (t_method)h_list_delete,
+ gensym("delete"), A_DEFFLOAT, 0);
+ class_addmethod(h_list_class, (t_method)h_list_getsize,
+ gensym("getsize"), A_DEFFLOAT , 0);
+ class_addmethod(h_list_class, (t_method)h_list_get_iter_pos,
+ gensym("getiter"), A_DEFFLOAT , 0);
+ class_addmethod(h_list_class, (t_method)h_list_set_iter_pos,
+ gensym("setiter"), A_DEFFLOAT , 0);
+ class_addmethod(h_list_class, (t_method)h_list_begin,
+ gensym("begin"), A_DEFFLOAT, 0);
+ class_addmethod(h_list_class, (t_method)h_list_end,
+ gensym("end"), A_DEFFLOAT, 0);
+ class_addmethod(h_list_class, (t_method)h_list_next,
+ gensym("next"), A_DEFFLOAT, 0);
+ class_addmethod(h_list_class, (t_method)h_list_last,
+ gensym("last"), A_DEFFLOAT, 0);
+ class_addmethod(h_list_class, (t_method)h_list_unique,
+ gensym("unique"), A_DEFFLOAT, 0);
+ class_addmethod(h_list_class, (t_method)h_list_reverse,
+ gensym("reverse"), A_DEFFLOAT, 0);
+ class_addmethod(h_list_class, (t_method)h_list_sort,
+ gensym("sort"), A_DEFFLOAT, 0);
+ class_addmethod(h_list_class, (t_method)h_list_set_namespace,
+ gensym("namespace"), A_DEFSYMBOL , 0);
+ class_addmethod(h_list_class, (t_method)h_list_get_namespace,
+ gensym("getnamespace"), A_DEFFLOAT, 0);
+ class_addmethod(h_list_class, (t_method)h_list_clear,
+ gensym("clear"), A_DEFFLOAT, 0);
+ class_addmethod(h_list_class, (t_method)h_list_clear_all,
+ gensym("clearall"), A_DEFFLOAT, 0);
+ class_addmethod(h_list_class, (t_method)h_list_print,
+ gensym("print"), A_DEFFLOAT, 0);
+ class_addmethod(h_list_class, (t_method)h_list_save,
+ gensym("save"), A_DEFSYMBOL , 0);
+ class_addmethod(h_list_class, (t_method)h_list_read,
+ gensym("read"), A_DEFSYMBOL , 0);
+ class_addmethod(h_list_class, (t_method)h_list_save_xml,
+ gensym("saveXML"), A_DEFSYMBOL , 0);
+ class_addmethod(h_list_class, (t_method)h_list_read_xml,
+ gensym("readXML"), A_DEFSYMBOL , 0);
+
+ // without an argument the following two methods wont work ??? why?? because of c++?
+ class_addmethod(h_list_class, (t_method)h_list_help, gensym("help"),A_DEFFLOAT, 0);
+}
diff --git a/PDContainer/src/h_map.cpp b/PDContainer/src/h_map.cpp
new file mode 100755
index 0000000..11ce59e
--- /dev/null
+++ b/PDContainer/src/h_map.cpp
@@ -0,0 +1,334 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// h_map.cpp
+
+
+#include "include/HMap.h"
+
+
+static t_class *h_map_class;
+static t_class *proxy_class;
+
+typedef struct _h_map
+{
+ t_object x_obj;
+ t_canvas *x_canvas;
+ t_outlet *out0, *out1, *out2;
+ HMap *hmap;
+ Element value;
+ bool event_set;
+} t_h_map;
+
+typedef struct proxy
+{
+ t_object obj;
+ t_int index; // number of proxy inlet(s)
+ t_h_map *x; // we'll put the other struct in here
+} t_proxy;
+
+static void h_map_add(t_h_map *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(!x->event_set)
+ {
+ post("h_map, add: you must first set a value at right inlet!");
+ return;
+ }
+
+ if(argc)
+ {
+ Element key(argc,argv);
+ x->hmap->add(key, x->value);
+ x->event_set = false;
+ }
+ else
+ post("h_map, add: no arguments");
+}
+
+static void h_map_value(t_proxy *p, t_symbol *s, int argc, t_atom *argv)
+{
+ t_h_map *x = (t_h_map *)(p->x);
+
+ // symbol without selector "symbol":
+ if(argc == 0)
+ {
+ t_atom tmp;
+ SETSYMBOL(&tmp, s);
+ x->value.setAtoms(1, &tmp);
+ x->event_set = true;
+ return;
+ }
+
+ // input is a list without selector "list":
+ if ( argc && (strcmp(s->s_name,"list")!=0)
+ && (strcmp(s->s_name,"float")!=0)
+ && (strcmp(s->s_name,"symbol")!=0)
+ && (strcmp(s->s_name,"pointer")!=0) )
+ {
+ t_atom *atoms = (t_atom*)getbytes( (argc+1)*sizeof(t_atom) );
+
+ // add the selector symbol to the list:
+ SETSYMBOL(atoms, s);
+
+ for(int i=0; i<argc; i++)
+ {
+ if(argv[i].a_type == A_FLOAT)
+ SETFLOAT(&atoms[i+1],argv[i].a_w.w_float);
+ if(argv[i].a_type == A_SYMBOL)
+ SETSYMBOL(&atoms[i+1],argv[i].a_w.w_symbol);
+ if(argv[i].a_type == A_POINTER)
+ SETPOINTER(&atoms[i+1],argv[i].a_w.w_gpointer);
+ }
+
+ x->value.setAtoms(argc+1, atoms);
+
+ x->event_set = true;
+ freebytes(atoms, (argc+1)*sizeof(t_atom));
+ return;
+ }
+
+ // "normal" input (list, float, symbol or pointer):
+ if (argc)
+ {
+ x->value.setAtoms(argc, argv);
+ x->event_set = true;
+ return;
+ }
+}
+
+static void h_map_get(t_h_map *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(!argc)
+ {
+ post("h_map, get: no arguments");
+ return;
+ }
+
+ Element key(argc,argv);
+ Element output;
+
+ try
+ { output = x->hmap->get( key ); }
+
+ catch(const char* s)
+ {
+ // if there was no Element found, put out a bang at the right outlet
+ post("%s", s);
+ outlet_bang(x->out2);
+ return;
+ }
+
+ if(output.getLength() == 1) // symbol, float or pointer
+ {
+ if (output.getAtom()[0].a_type == A_FLOAT)
+ outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
+ if (output.getAtom()[0].a_type == A_SYMBOL)
+ outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
+ if (output.getAtom()[0].a_type == A_POINTER)
+ outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
+ return;
+ }
+ if(output.getLength() > 1) // list
+ {
+ outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
+ return;
+ }
+
+ // if there was no Element found, put out a bang at the right outlet
+ outlet_bang(x->out2);
+}
+
+static void h_map_remove(t_h_map *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(!argc)
+ {
+ post("h_map, remove: no arguments");
+ return;
+ }
+
+ Element key(argc,argv);
+
+ try
+ { x->hmap->remove( key ); }
+
+ catch(const char* s)
+ { post("%s", s); }
+}
+
+static void h_map_getsize(t_h_map *x)
+{
+ outlet_float(x->out1,x->hmap->getSize());
+}
+
+static void h_map_help(t_h_map *x)
+{
+ x->hmap->help();
+}
+
+static void h_map_set_namespace(t_h_map *x, t_symbol *s)
+{
+ x->hmap->setNamespace(s->s_name);
+}
+
+static void h_map_get_namespace(t_h_map *x)
+{
+ post("h_map current namespace: %s",x->hmap->getNamespace().c_str());
+}
+
+static void h_map_print(t_h_map *x)
+{
+ x->hmap->printAll();
+}
+
+static void h_map_clear(t_h_map *x)
+{
+ x->hmap->clearNamespace();
+}
+
+static void h_map_clear_all(t_h_map *x)
+{
+ x->hmap->clearAll();
+}
+
+static void h_map_save(t_h_map *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(x->hmap->saveToFile(filename))
+ post("h_map: data of namespace %s written to file %s",
+ x->hmap->getNamespace().c_str(),s->s_name);
+ else
+ post("h_map: couldn't write to file %s",s->s_name);
+}
+
+static void h_map_save_xml(t_h_map *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(x->hmap->saveToFileXML(filename))
+ post("h_map: data of namespace %s written to file %s",
+ x->hmap->getNamespace().c_str(),s->s_name);
+ else
+ post("h_map: couldn't write to file %s",s->s_name);
+}
+
+static void h_map_read(t_h_map *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hmap->readFromFile(filename))
+ post("h_map: couldn't read from file %s",s->s_name);
+}
+
+static void h_map_read_xml(t_h_map *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hmap->readFromFileXML(filename))
+ post("h_map: couldn't read from file %s",s->s_name);
+}
+
+static void *h_map_new(t_symbol *s, int argc, t_atom *argv)
+{
+
+ t_h_map *x = (t_h_map *)pd_new(h_map_class);
+ t_proxy *inlet = (t_proxy *)pd_new(proxy_class); // for the proxy inlet
+
+ inlet->x = x; // make x visible to the proxy inlets
+
+ switch(argc)
+ {
+ default:
+ post("h_map warning: only one argument for namespace is possible!");
+ case 1:
+ x->hmap = new HMap(atom_getsymbol(argv)->s_name);
+ break;
+ case 0:
+ x->hmap = new HMap();
+ break;
+ }
+
+ // we are going to create a proxy inlet no. 0
+ // it belongs to the object x but the destination is t_proxy
+ inlet->index = 0;
+ inlet_new(&x->x_obj, &inlet->obj.ob_pd, 0,0);
+
+ x->out0 = outlet_new(&x->x_obj, 0);
+ x->out1 = outlet_new(&x->x_obj, &s_float);
+ x->out2 = outlet_new(&x->x_obj, &s_bang);
+ x->x_canvas = canvas_getcurrent();
+
+ return (void *)x;
+}
+
+static void *h_map_free(t_h_map *x)
+{
+ delete x->hmap;
+ return (void *)x;
+}
+
+void h_map_setup(void)
+{
+ // the object class
+ h_map_class = class_new(gensym("h_map"), (t_newmethod)h_map_new,
+ (t_method)h_map_free, sizeof(t_h_map),
+ CLASS_DEFAULT, A_GIMME, 0);
+
+ // a class for the proxy-inlet
+ proxy_class = class_new(gensym("h_map_proxy"), NULL, NULL, sizeof(t_proxy),
+ CLASS_PD|CLASS_NOINLET, A_NULL);
+
+ class_addmethod(h_map_class, (t_method)h_map_add,
+ gensym("add"), A_GIMME , 0);
+ class_addanything(proxy_class, (t_method)h_map_value); // the right inlet
+ class_addmethod(h_map_class, (t_method)h_map_get,
+ gensym("get"), A_GIMME , 0);
+ class_addmethod(h_map_class, (t_method)h_map_remove,
+ gensym("remove"), A_GIMME , 0);
+ class_addmethod(h_map_class, (t_method)h_map_getsize,
+ gensym("getsize"), A_DEFFLOAT , 0);
+ class_addmethod(h_map_class, (t_method)h_map_set_namespace,
+ gensym("namespace"), A_DEFSYMBOL , 0);
+ class_addmethod(h_map_class, (t_method)h_map_get_namespace,
+ gensym("getnamespace"), A_DEFFLOAT, 0);
+ class_addmethod(h_map_class, (t_method)h_map_print,
+ gensym("print"), A_DEFFLOAT, 0);
+ class_addmethod(h_map_class, (t_method)h_map_clear,
+ gensym("clear"), A_DEFFLOAT, 0);
+ class_addmethod(h_map_class, (t_method)h_map_clear_all,
+ gensym("clearall"), A_DEFFLOAT, 0);
+ class_addmethod(h_map_class, (t_method)h_map_save,
+ gensym("save"), A_DEFSYMBOL , 0);
+ class_addmethod(h_map_class, (t_method)h_map_save_xml,
+ gensym("saveXML"), A_DEFSYMBOL , 0);
+ class_addmethod(h_map_class, (t_method)h_map_read,
+ gensym("read"), A_DEFSYMBOL , 0);
+ class_addmethod(h_map_class, (t_method)h_map_read_xml,
+ gensym("readXML"), A_DEFSYMBOL , 0);
+
+ // without an argument the following two methods wont work ??? why?? because of c++?
+ class_addmethod(h_map_class, (t_method)h_map_help, gensym("help"),A_DEFFLOAT, 0);
+}
diff --git a/PDContainer/src/h_multimap.cpp b/PDContainer/src/h_multimap.cpp
new file mode 100755
index 0000000..8449fd9
--- /dev/null
+++ b/PDContainer/src/h_multimap.cpp
@@ -0,0 +1,331 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// h_multimap.cpp
+
+
+#include "include/HMultiMap.h"
+
+
+static t_class *h_multimap_class;
+static t_class *proxy_class;
+
+typedef struct _h_multimap
+{
+ t_object x_obj;
+ t_canvas *x_canvas;
+ t_outlet *out0, *out1, *out2;
+ HMultiMap *hmultimap;
+ Element value;
+ bool event_set;
+} t_h_multimap;
+
+typedef struct proxy
+{
+ t_object obj;
+ t_int index; // number of proxy inlet(s)
+ t_h_multimap *x; // we'll put the other struct in here
+} t_proxy;
+
+static void h_multimap_add(t_h_multimap *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(!x->event_set)
+ {
+ post("h_multimap, add: you must first set a value at right inlet!");
+ return;
+ }
+
+ if(argc)
+ {
+ Element key(argc,argv);
+ x->hmultimap->add(key, x->value);
+ x->event_set = false;
+ }
+ else
+ post("h_multimap, add: no arguments");
+}
+
+static void h_multimap_value(t_proxy *p, t_symbol *s, int argc, t_atom *argv)
+{
+ t_h_multimap *x = (t_h_multimap *)(p->x);
+
+ // symbol without selector "symbol":
+ if(argc == 0)
+ {
+ t_atom tmp;
+ SETSYMBOL(&tmp, s);
+ x->value.setAtoms(1, &tmp);
+ x->event_set = true;
+ return;
+ }
+
+ // input is a list without selector "list":
+ // input is a list without selector "list":
+ if ( argc && (strcmp(s->s_name,"list")!=0)
+ && (strcmp(s->s_name,"float")!=0)
+ && (strcmp(s->s_name,"symbol")!=0)
+ && (strcmp(s->s_name,"pointer")!=0) )
+ {
+ t_atom *atoms = (t_atom*)getbytes( (argc+1)*sizeof(t_atom) );
+
+ // add the selector symbol to the list:
+ SETSYMBOL(atoms, s);
+
+ for(int i=0; i<argc; i++)
+ {
+ if(argv[i].a_type == A_FLOAT)
+ SETFLOAT(&atoms[i+1],argv[i].a_w.w_float);
+ if(argv[i].a_type == A_SYMBOL)
+ SETSYMBOL(&atoms[i+1],argv[i].a_w.w_symbol);
+ if(argv[i].a_type == A_POINTER)
+ SETPOINTER(&atoms[i+1],argv[i].a_w.w_gpointer);
+ }
+
+ x->value.setAtoms(argc+1, atoms);
+
+ x->event_set = true;
+ freebytes(atoms, (argc+1)*sizeof(t_atom));
+ return;
+ }
+
+ // "normal" input (list, float, symbol or pointer):
+ if (argc)
+ {
+ x->value.setAtoms(argc, argv);
+ x->event_set = true;
+ return;
+ }
+}
+
+static void h_multimap_get(t_h_multimap *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(!argc)
+ {
+ post("h_multimap, get: no arguments");
+ return;
+ }
+
+ // outputs all the values of one key one after an other
+
+ Element key(argc,argv);
+ int value_nr = x->hmultimap->getNr( key );
+
+ outlet_float(x->out1,value_nr);
+
+ for(int i=0; i < value_nr; i++)
+ {
+ Element output;
+ try
+ { output = x->hmultimap->get(key, i); }
+ catch(const char* s)
+ {
+ post("%s", s);
+ continue;
+ }
+
+ if(output.getLength() == 1) // symbol, float or pointer
+ {
+ if (output.getAtom()[0].a_type == A_FLOAT)
+ outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
+ if (output.getAtom()[0].a_type == A_SYMBOL)
+ outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
+ if (output.getAtom()[0].a_type == A_POINTER)
+ outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
+ }
+ if(output.getLength() > 1) // list
+ outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
+ }
+}
+
+static void h_multimap_remove(t_h_multimap *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(!argc)
+ {
+ post("h_multimap, remove: no arguments");
+ return;
+ }
+
+ Element key(argc,argv);
+ try
+ { x->hmultimap->remove( key ); }
+ catch(const char* s)
+ { post("%s", s); }
+}
+
+static void h_multimap_getsize(t_h_multimap *x)
+{
+ outlet_float(x->out2,x->hmultimap->getSize());
+}
+
+static void h_multimap_help(t_h_multimap *x)
+{
+ x->hmultimap->help();
+}
+
+static void h_multimap_set_namespace(t_h_multimap *x, t_symbol *s)
+{
+ x->hmultimap->setNamespace(s->s_name);
+}
+
+static void h_multimap_get_namespace(t_h_multimap *x)
+{
+ post("h_multimap current namespace: %s",x->hmultimap->getNamespace().c_str());
+}
+
+static void h_multimap_print(t_h_multimap *x)
+{
+ x->hmultimap->printAll();
+}
+
+static void h_multimap_clear(t_h_multimap *x)
+{
+ x->hmultimap->clearNamespace();
+}
+
+static void h_multimap_clear_all(t_h_multimap *x)
+{
+ x->hmultimap->clearAll();
+}
+
+static void h_multimap_save(t_h_multimap *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(x->hmultimap->saveToFile(filename))
+ post("h_multimap: data of namespace %s written to file %s",
+ x->hmultimap->getNamespace().c_str(),s->s_name);
+ else
+ post("h_multimap: couldn't write to file %s",s->s_name);
+}
+
+static void h_multimap_save_xml(t_h_multimap *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(x->hmultimap->saveToFileXML(filename))
+ post("h_multimap: data of namespace %s written to file %s",
+ x->hmultimap->getNamespace().c_str(),s->s_name);
+ else
+ post("h_multimap: couldn't write to file %s",s->s_name);
+}
+
+static void h_multimap_read(t_h_multimap *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hmultimap->readFromFile(filename))
+ post("h_multimap: couldn't read from file %s",s->s_name);
+}
+
+static void h_multimap_read_xml(t_h_multimap *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hmultimap->readFromFileXML(filename))
+ post("h_multimap: couldn't read from file %s",s->s_name);
+}
+
+static void *h_multimap_new(t_symbol *s, int argc, t_atom *argv)
+{
+
+ t_h_multimap *x = (t_h_multimap *)pd_new(h_multimap_class);
+ t_proxy *inlet = (t_proxy *)pd_new(proxy_class); // for the proxy inlet
+
+ inlet->x = x; // make x visible to the proxy inlets
+
+ switch(argc)
+ {
+ default:
+ post("h_multimap warning: only one argument for namespace is possible!");
+ case 1:
+ x->hmultimap = new HMultiMap(atom_getsymbol(argv)->s_name);
+ break;
+ case 0:
+ x->hmultimap = new HMultiMap();
+ break;
+ }
+
+ // we are going to create a proxy inlet no. 0
+ // it belongs to the object x but the destination is t_proxy
+ inlet->index = 0;
+ inlet_new(&x->x_obj, &inlet->obj.ob_pd, 0,0);
+
+ x->out0 = outlet_new(&x->x_obj, 0);
+ x->out1 = outlet_new(&x->x_obj, &s_float);
+ x->out2 = outlet_new(&x->x_obj, &s_float);
+ x->x_canvas = canvas_getcurrent();
+
+ return (void *)x;
+}
+
+static void *h_multimap_free(t_h_multimap *x)
+{
+ delete x->hmultimap;
+ return (void *)x;
+}
+
+void h_multimap_setup(void)
+{
+ h_multimap_class = class_new(gensym("h_multimap"), (t_newmethod)h_multimap_new,
+ (t_method)h_multimap_free, sizeof(t_h_multimap),
+ CLASS_DEFAULT, A_GIMME, 0);
+
+ // a class for the proxy-inlet
+ proxy_class = class_new(gensym("h_map_proxy"), NULL, NULL, sizeof(t_proxy),
+ CLASS_PD|CLASS_NOINLET, A_NULL);
+
+ class_addmethod(h_multimap_class, (t_method)h_multimap_add,
+ gensym("add"), A_GIMME , 0);
+ class_addanything(proxy_class, (t_method)h_multimap_value); // the right inlet
+ class_addmethod(h_multimap_class, (t_method)h_multimap_get,
+ gensym("get"), A_GIMME , 0);
+ class_addmethod(h_multimap_class, (t_method)h_multimap_remove,
+ gensym("remove"), A_GIMME , 0);
+ class_addmethod(h_multimap_class, (t_method)h_multimap_getsize,
+ gensym("getsize"), A_DEFFLOAT , 0);
+ class_addmethod(h_multimap_class, (t_method)h_multimap_set_namespace,
+ gensym("namespace"), A_DEFSYMBOL , 0);
+ class_addmethod(h_multimap_class, (t_method)h_multimap_get_namespace,
+ gensym("getnamespace"), A_DEFFLOAT, 0);
+ class_addmethod(h_multimap_class, (t_method)h_multimap_print,
+ gensym("print"), A_DEFFLOAT, 0);
+ class_addmethod(h_multimap_class, (t_method)h_multimap_clear,
+ gensym("clear"), A_DEFFLOAT, 0);
+ class_addmethod(h_multimap_class, (t_method)h_multimap_clear_all,
+ gensym("clearall"), A_DEFFLOAT, 0);
+ class_addmethod(h_multimap_class, (t_method)h_multimap_save,
+ gensym("save"), A_DEFSYMBOL , 0);
+ class_addmethod(h_multimap_class, (t_method)h_multimap_save_xml,
+ gensym("saveXML"), A_DEFSYMBOL , 0);
+ class_addmethod(h_multimap_class, (t_method)h_multimap_read,
+ gensym("read"), A_DEFSYMBOL , 0);
+ class_addmethod(h_multimap_class, (t_method)h_multimap_read_xml,
+ gensym("readXML"), A_DEFSYMBOL , 0);
+
+ // without an argument the following two methods wont work ??? why?? because of c++?
+ class_addmethod(h_multimap_class, (t_method)h_multimap_help,
+ gensym("help"),A_DEFFLOAT, 0);
+}
diff --git a/PDContainer/src/h_multiset.cpp b/PDContainer/src/h_multiset.cpp
new file mode 100755
index 0000000..0886a8b
--- /dev/null
+++ b/PDContainer/src/h_multiset.cpp
@@ -0,0 +1,220 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// h_multiset.cpp
+
+
+#include "include/HMultiSet.h"
+
+
+static t_class *h_multiset_class;
+
+typedef struct _h_multiset
+{
+ t_object x_obj;
+ t_canvas *x_canvas;
+ t_outlet *out0, *out1;
+ HMultiSet *hmultiset;
+} t_h_multiset;
+
+static void h_multiset_add(t_h_multiset *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(!argc)
+ {
+ post("h_multiset, add: no arguments");
+ return;
+ }
+
+ Element key(argc,argv);
+ x->hmultiset->add( key );
+}
+
+static void h_multiset_get(t_h_multiset *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(!argc)
+ {
+ post("h_multiset, get: no arguments");
+ return;
+ }
+
+ Element key(argc,argv);
+ int output = x->hmultiset->get( key );
+
+ outlet_float(x->out0, output);
+}
+
+static void h_multiset_remove(t_h_multiset *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(!argc)
+ {
+ post("h_multiset, remove: no arguments");
+ return;
+ }
+
+ Element key(argc,argv);
+ x->hmultiset->remove( key );
+}
+
+static void h_multiset_getsize(t_h_multiset *x)
+{
+ outlet_float(x->out1,x->hmultiset->getSize());
+}
+
+static void h_multiset_help(t_h_multiset *x)
+{
+ x->hmultiset->help();
+}
+
+static void h_multiset_set_namespace(t_h_multiset *x, t_symbol *s)
+{
+ x->hmultiset->setNamespace(s->s_name);
+}
+
+static void h_multiset_get_namespace(t_h_multiset *x)
+{
+ post("h_multiset current namespace: %s",x->hmultiset->getNamespace().c_str());
+}
+
+static void h_multiset_print(t_h_multiset *x)
+{
+ x->hmultiset->printAll();
+}
+
+static void h_multiset_clear(t_h_multiset *x)
+{
+ x->hmultiset->clearNamespace();
+}
+
+static void h_multiset_clear_all(t_h_multiset *x)
+{
+ x->hmultiset->clearAll();
+}
+
+static void h_multiset_save(t_h_multiset *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(x->hmultiset->saveToFile(filename))
+ post("h_multiset: data of namespace %s written to file %s",
+ x->hmultiset->getNamespace().c_str(),s->s_name);
+ else
+ post("h_multiset: couldn't write to file %s",s->s_name);
+}
+
+static void h_multiset_read(t_h_multiset *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hmultiset->readFromFile(filename))
+ post("h_multiset: couldn't read from file %s",s->s_name);
+}
+
+static void h_multiset_save_xml(t_h_multiset *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(x->hmultiset->saveToFileXML(filename))
+ post("h_multiset: data of namespace %s written to file %s",
+ x->hmultiset->getNamespace().c_str(),s->s_name);
+ else
+ post("h_multiset: couldn't write to file %s",s->s_name);
+}
+
+static void h_multiset_read_xml(t_h_multiset *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hmultiset->readFromFileXML(filename))
+ post("h_multiset: couldn't read from file %s",s->s_name);
+}
+
+static void *h_multiset_new(t_symbol *s, int argc, t_atom *argv)
+{
+
+ t_h_multiset *x = (t_h_multiset *)pd_new(h_multiset_class);
+
+ switch(argc)
+ {
+ default:
+ post("h_multiset warning: only one argument for namespace is possible!");
+ case 1:
+ x->hmultiset = new HMultiSet(atom_getsymbol(argv)->s_name);
+ break;
+ case 0:
+ x->hmultiset = new HMultiSet();
+ break;
+ }
+
+ x->out0 = outlet_new(&x->x_obj, &s_float);
+ x->out1 = outlet_new(&x->x_obj, &s_float);
+ x->x_canvas = canvas_getcurrent();
+
+ return (void *)x;
+}
+
+static void *h_multiset_free(t_h_multiset *x)
+{
+ delete x->hmultiset;
+ return (void *)x;
+}
+
+void h_multiset_setup(void)
+{
+ // the object class
+ h_multiset_class = class_new(gensym("h_multiset"), (t_newmethod)h_multiset_new,
+ (t_method)h_multiset_free, sizeof(t_h_multiset),
+ CLASS_DEFAULT, A_GIMME, 0);
+
+ class_addmethod(h_multiset_class, (t_method)h_multiset_add,
+ gensym("add"), A_GIMME , 0);
+ class_addmethod(h_multiset_class, (t_method)h_multiset_get,
+ gensym("get"), A_GIMME , 0);
+ class_addmethod(h_multiset_class, (t_method)h_multiset_remove,
+ gensym("remove"), A_GIMME , 0);
+ class_addmethod(h_multiset_class, (t_method)h_multiset_getsize,
+ gensym("getsize"), A_DEFFLOAT , 0);
+ class_addmethod(h_multiset_class, (t_method)h_multiset_set_namespace,
+ gensym("namespace"), A_DEFSYMBOL , 0);
+ class_addmethod(h_multiset_class, (t_method)h_multiset_get_namespace,
+ gensym("getnamespace"), A_DEFFLOAT, 0);
+ class_addmethod(h_multiset_class, (t_method)h_multiset_print,
+ gensym("print"), A_DEFFLOAT, 0);
+ class_addmethod(h_multiset_class, (t_method)h_multiset_clear,
+ gensym("clear"), A_DEFFLOAT, 0);
+ class_addmethod(h_multiset_class, (t_method)h_multiset_clear_all,
+ gensym("clearall"), A_DEFFLOAT, 0);
+ class_addmethod(h_multiset_class, (t_method)h_multiset_save,
+ gensym("save"), A_DEFSYMBOL , 0);
+ class_addmethod(h_multiset_class, (t_method)h_multiset_read,
+ gensym("read"), A_DEFSYMBOL , 0);
+ class_addmethod(h_multiset_class, (t_method)h_multiset_save_xml,
+ gensym("saveXML"), A_DEFSYMBOL , 0);
+ class_addmethod(h_multiset_class, (t_method)h_multiset_read_xml,
+ gensym("readXML"), A_DEFSYMBOL , 0);
+
+ // without an argument the following two methods wont work ??? why?? because of c++?
+ class_addmethod(h_multiset_class, (t_method)h_multiset_help, gensym("help"),A_DEFFLOAT, 0);
+}
diff --git a/PDContainer/src/h_prioqueue.cpp b/PDContainer/src/h_prioqueue.cpp
new file mode 100755
index 0000000..9f770ed
--- /dev/null
+++ b/PDContainer/src/h_prioqueue.cpp
@@ -0,0 +1,250 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// h_prioqueue.cpp
+
+
+#include "include/HPrioQueue.h"
+
+
+static t_class *h_priority_queue_class;
+static t_class *proxy_class;
+
+typedef struct _h_priority_queue
+{
+ t_object x_obj;
+ t_canvas *x_canvas;
+ t_outlet *out0, *out1, *out2;
+ HPrioQueue *hpriority_queue;
+ Element value;
+ bool event_set;
+} t_h_priority_queue;
+
+typedef struct proxy
+{
+ t_object obj;
+ t_int index; // number of proxy inlet(s)
+ t_h_priority_queue *x; // we'll put the other struct in here
+} t_proxy;
+
+static void h_priority_queue_push(t_h_priority_queue *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(!x->event_set)
+ {
+ post("h_priority_queue, insert: you must first set a value at right inlet!");
+ return;
+ }
+
+ float prio;
+ if(argc && (argv[0].a_type == A_FLOAT))
+ prio = static_cast<float>(argv[0].a_w.w_float);
+ else
+ {
+ post("h_priority_queue, push: invalid priority!");
+ return;
+ }
+
+ x->hpriority_queue->push(prio,x->value);
+ x->event_set = false;
+}
+
+static void h_priority_queue_value(t_proxy *p, t_symbol *s, int argc, t_atom *argv)
+{
+ t_h_priority_queue *x = (t_h_priority_queue *)(p->x);
+
+ // symbol without selector "symbol":
+ if(argc == 0)
+ {
+ t_atom tmp;
+ SETSYMBOL(&tmp, s);
+ x->value.setAtoms(1, &tmp);
+ x->event_set = true;
+ return;
+ }
+
+ // input is a list without selector "list":
+ if ( argc && (strcmp(s->s_name,"list")!=0)
+ && (strcmp(s->s_name,"float")!=0)
+ && (strcmp(s->s_name,"symbol")!=0)
+ && (strcmp(s->s_name,"pointer")!=0) )
+ {
+ t_atom *atoms = (t_atom*)getbytes( (argc+1)*sizeof(t_atom) );
+
+ // add the selector symbol to the list:
+ SETSYMBOL(atoms, s);
+
+ for(int i=0; i<argc; i++)
+ {
+ if(argv[i].a_type == A_FLOAT)
+ SETFLOAT(&atoms[i+1],argv[i].a_w.w_float);
+ if(argv[i].a_type == A_SYMBOL)
+ SETSYMBOL(&atoms[i+1],argv[i].a_w.w_symbol);
+ if(argv[i].a_type == A_POINTER)
+ SETPOINTER(&atoms[i+1],argv[i].a_w.w_gpointer);
+ }
+
+ x->value.setAtoms(argc+1, atoms);
+
+ x->event_set = true;
+ freebytes(atoms, (argc+1)*sizeof(t_atom));
+ return;
+ }
+
+ // "normal" input (list, float, pointer or symbol):
+ if (argc)
+ {
+ x->value.setAtoms(argc, argv);
+ x->event_set = true;
+ return;
+ }
+}
+
+static void h_priority_queue_top(t_h_priority_queue *x)
+{
+ if(x->hpriority_queue->getSize()==0)
+ {
+ // if there was no Element found, put out a bang at the right outlet
+ outlet_bang(x->out2);
+ return;
+ }
+
+ Element output = x->hpriority_queue->top();
+
+ if(output.getLength() == 1) // symbol or float
+ {
+ if (output.getAtom()[0].a_type == A_FLOAT)
+ outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
+ if (output.getAtom()[0].a_type == A_SYMBOL)
+ outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
+ if (output.getAtom()[0].a_type == A_POINTER)
+ outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
+ return;
+ }
+ if(output.getLength() > 1) // list
+ {
+ outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
+ return;
+ }
+
+ // if there was no Element found, put out a bang at the right outlet
+ outlet_bang(x->out2);
+}
+
+static void h_priority_queue_pop(t_h_priority_queue *x)
+{
+ if(x->hpriority_queue->getSize()<=0)
+ {
+ post("h_priority_queue, pop: size is already 0 !");
+ return;
+ }
+
+ x->hpriority_queue->pop();
+}
+
+static void h_priority_queue_getsize(t_h_priority_queue *x)
+{
+ outlet_float(x->out1,x->hpriority_queue->getSize());
+}
+
+static void h_priority_queue_help(t_h_priority_queue *x)
+{
+ x->hpriority_queue->help();
+}
+
+static void h_priority_queue_set_namespace(t_h_priority_queue *x, t_symbol *s)
+{
+ x->hpriority_queue->setNamespace(s->s_name);
+}
+
+static void h_priority_queue_get_namespace(t_h_priority_queue *x)
+{
+ post("h_priority_queue current namespace: %s",x->hpriority_queue->getNamespace().c_str());
+}
+
+static void h_priority_queue_clear(t_h_priority_queue *x)
+{
+ x->hpriority_queue->clearNamespace();
+}
+
+static void h_priority_queue_clear_all(t_h_priority_queue *x)
+{
+ x->hpriority_queue->clearAll();
+}
+
+static void *h_priority_queue_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_h_priority_queue *x = (t_h_priority_queue *)pd_new(h_priority_queue_class);
+ t_proxy *inlet = (t_proxy *)pd_new(proxy_class); // for the proxy inlet
+
+ inlet->x = x; // make x visible to the proxy inlets
+
+ switch(argc)
+ {
+ default:
+ post("h_priority_queue warning: only one argument for namespace is possible!");
+ case 1:
+ x->hpriority_queue = new HPrioQueue(atom_getsymbol(argv)->s_name);
+ break;
+ case 0:
+ x->hpriority_queue = new HPrioQueue();
+ break;
+ }
+
+ // we are going to create a proxy inlet no. 0
+ // it belongs to the object x but the destination is t_proxy
+ inlet->index = 0;
+ inlet_new(&x->x_obj, &inlet->obj.ob_pd, 0,0);
+
+ x->out0 = outlet_new(&x->x_obj, 0);
+ x->out1 = outlet_new(&x->x_obj, &s_float);
+ x->out2 = outlet_new(&x->x_obj, &s_bang);
+ x->x_canvas = canvas_getcurrent();
+
+ return (void *)x;
+}
+
+static void *h_priority_queue_free(t_h_priority_queue *x)
+{
+ delete x->hpriority_queue;
+ return (void *)x;
+}
+
+void h_priority_queue_setup(void)
+{
+ // the object class
+ h_priority_queue_class = class_new(gensym("h_priority_queue"), (t_newmethod)h_priority_queue_new,
+ (t_method)h_priority_queue_free, sizeof(t_h_priority_queue),
+ CLASS_DEFAULT, A_GIMME, 0);
+
+ // a class for the proxy-inlet
+ proxy_class = class_new(gensym("h_priority_queue_proxy"), NULL, NULL, sizeof(t_proxy),
+ CLASS_PD|CLASS_NOINLET, A_NULL);
+
+ class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_push,
+ gensym("push"), A_GIMME, 0);
+ class_addanything(proxy_class, (t_method)h_priority_queue_value); // the right inlet
+ class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_pop,
+ gensym("pop"), A_DEFFLOAT, 0);
+ class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_top,
+ gensym("top"), A_DEFFLOAT, 0);
+ class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_getsize,
+ gensym("getsize"), A_DEFFLOAT , 0);
+ class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_set_namespace,
+ gensym("namespace"), A_DEFSYMBOL , 0);
+ class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_get_namespace,
+ gensym("getnamespace"), A_DEFFLOAT, 0);
+ class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_clear,
+ gensym("clear"), A_DEFFLOAT, 0);
+ class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_clear_all,
+ gensym("clearall"), A_DEFFLOAT, 0);
+
+ // without an argument the following two methods wont work ??? why?? because of c++?
+ class_addmethod(h_priority_queue_class, (t_method)h_priority_queue_help, gensym("help"),A_DEFFLOAT, 0);
+}
diff --git a/PDContainer/src/h_queue.cpp b/PDContainer/src/h_queue.cpp
new file mode 100755
index 0000000..77d5ef7
--- /dev/null
+++ b/PDContainer/src/h_queue.cpp
@@ -0,0 +1,165 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// h_queue.cpp
+
+
+#include "include/HQueue.h"
+
+
+static t_class *h_queue_class;
+
+typedef struct _h_queue
+{
+ t_object x_obj;
+ t_canvas *x_canvas;
+ t_outlet *out0, *out1, *out2;
+ HQueue *hqueue;
+} t_h_queue;
+
+static void h_queue_push(t_h_queue *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(argc)
+ {
+ Element key(argc,argv);
+ x->hqueue->push(key);
+ }
+ else
+ post("h_queue, push: no arguments");
+}
+
+static void h_queue_pop(t_h_queue *x)
+{
+ if(x->hqueue->getSize()<=0)
+ {
+ post("h_queue, pop: size is 0 !");
+ return;
+ }
+
+ x->hqueue->pop();
+}
+
+static void h_queue_front(t_h_queue *x)
+{
+ if(x->hqueue->getSize() == 0)
+ {
+ outlet_bang(x->out2);
+ return;
+ }
+
+ Element output = x->hqueue->front();
+
+ if(output.getLength() == 1) // symbol or float
+ {
+ if (output.getAtom()[0].a_type == A_FLOAT)
+ outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
+ if (output.getAtom()[0].a_type == A_SYMBOL)
+ outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
+ if (output.getAtom()[0].a_type == A_POINTER)
+ outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
+ return;
+ }
+ if(output.getLength() > 1) // list
+ {
+ outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
+ return;
+ }
+
+ // outlet bang if no data here
+ outlet_bang(x->out2);
+}
+
+static void h_queue_getsize(t_h_queue *x)
+{
+ outlet_float(x->out1,x->hqueue->getSize());
+}
+
+static void h_queue_help(t_h_queue *x)
+{
+ x->hqueue->help();
+}
+
+static void h_queue_set_namespace(t_h_queue *x, t_symbol *s)
+{
+ x->hqueue->setNamespace(s->s_name);
+}
+
+static void h_queue_get_namespace(t_h_queue *x)
+{
+ post("h_queue current namespace: %s",x->hqueue->getNamespace().c_str());
+}
+
+static void h_queue_clear(t_h_queue *x)
+{
+ x->hqueue->clearNamespace();
+}
+
+static void h_queue_clear_all(t_h_queue *x)
+{
+ x->hqueue->clearAll();
+}
+
+static void *h_queue_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_h_queue *x = (t_h_queue *)pd_new(h_queue_class);
+
+ switch(argc)
+ {
+ default:
+ post("h_queue warning: only one argument for namespace is possible!");
+ case 1:
+ x->hqueue = new HQueue(atom_getsymbol(argv)->s_name);
+ break;
+ case 0:
+ x->hqueue = new HQueue();
+ break;
+ }
+
+ x->out0 = outlet_new(&x->x_obj, 0);
+ x->out1 = outlet_new(&x->x_obj, &s_float);
+ x->out2 = outlet_new(&x->x_obj, &s_bang);
+ x->x_canvas = canvas_getcurrent();
+
+ return (void *)x;
+}
+
+static void *h_queue_free(t_h_queue *x)
+{
+ delete x->hqueue;
+ return (void *)x;
+}
+
+void h_queue_setup(void)
+{
+ // the object class
+ h_queue_class = class_new(gensym("h_queue"), (t_newmethod)h_queue_new,
+ (t_method)h_queue_free, sizeof(t_h_queue),
+ CLASS_DEFAULT, A_GIMME, 0);
+
+ class_addmethod(h_queue_class, (t_method)h_queue_push,
+ gensym("push"), A_GIMME, 0);
+ class_addmethod(h_queue_class, (t_method)h_queue_pop,
+ gensym("pop"), A_DEFFLOAT, 0);
+ class_addmethod(h_queue_class, (t_method)h_queue_front,
+ gensym("front"), A_DEFFLOAT, 0);
+ class_addmethod(h_queue_class, (t_method)h_queue_getsize,
+ gensym("getsize"), A_DEFFLOAT , 0);
+ class_addmethod(h_queue_class, (t_method)h_queue_set_namespace,
+ gensym("namespace"), A_DEFSYMBOL , 0);
+ class_addmethod(h_queue_class, (t_method)h_queue_get_namespace,
+ gensym("getnamespace"), A_DEFFLOAT, 0);
+ class_addmethod(h_queue_class, (t_method)h_queue_clear,
+ gensym("clear"), A_DEFFLOAT, 0);
+ class_addmethod(h_queue_class, (t_method)h_queue_clear_all,
+ gensym("clearall"), A_DEFFLOAT, 0);
+
+ // without an argument the following two methods wont work ??? why?? because of c++?
+ class_addmethod(h_queue_class, (t_method)h_queue_help, gensym("help"),A_DEFFLOAT, 0);
+}
diff --git a/PDContainer/src/h_set.cpp b/PDContainer/src/h_set.cpp
new file mode 100755
index 0000000..2e97cef
--- /dev/null
+++ b/PDContainer/src/h_set.cpp
@@ -0,0 +1,220 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// h_set.cpp
+
+
+#include "include/HSet.h"
+
+
+static t_class *h_set_class;
+
+typedef struct _h_set
+{
+ t_object x_obj;
+ t_canvas *x_canvas;
+ t_outlet *out0, *out1;
+ HSet *hset;
+} t_h_set;
+
+static void h_set_add(t_h_set *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(!argc)
+ {
+ post("h_set, add: no arguments");
+ return;
+ }
+
+ Element key(argc,argv);
+ x->hset->add( key );
+}
+
+static void h_set_get(t_h_set *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(!argc)
+ {
+ post("h_set, get: no arguments");
+ return;
+ }
+
+ Element key(argc,argv);
+ int output = x->hset->get( key );
+
+ outlet_float(x->out0, output);
+}
+
+static void h_set_remove(t_h_set *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(!argc)
+ {
+ post("h_set, remove: no arguments");
+ return;
+ }
+
+ Element key(argc,argv);
+ x->hset->remove( key );
+}
+
+static void h_set_getsize(t_h_set *x)
+{
+ outlet_float(x->out1,x->hset->getSize());
+}
+
+static void h_set_help(t_h_set *x)
+{
+ x->hset->help();
+}
+
+static void h_set_set_namespace(t_h_set *x, t_symbol *s)
+{
+ x->hset->setNamespace(s->s_name);
+}
+
+static void h_set_get_namespace(t_h_set *x)
+{
+ post("h_set current namespace: %s",x->hset->getNamespace().c_str());
+}
+
+static void h_set_print(t_h_set *x)
+{
+ x->hset->printAll();
+}
+
+static void h_set_clear(t_h_set *x)
+{
+ x->hset->clearNamespace();
+}
+
+static void h_set_clear_all(t_h_set *x)
+{
+ x->hset->clearAll();
+}
+
+static void h_set_save(t_h_set *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(x->hset->saveToFile(filename))
+ post("h_set: data of namespace %s written to file %s",
+ x->hset->getNamespace().c_str(),s->s_name);
+ else
+ post("h_set: couldn't write to file %s",s->s_name);
+}
+
+static void h_set_read(t_h_set *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hset->readFromFile(filename))
+ post("h_set: couldn't read from file %s",s->s_name);
+}
+
+static void h_set_save_xml(t_h_set *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(x->hset->saveToFileXML(filename))
+ post("h_set: data of namespace %s written to file %s",
+ x->hset->getNamespace().c_str(),s->s_name);
+ else
+ post("h_set: couldn't write to file %s",s->s_name);
+}
+
+static void h_set_read_xml(t_h_set *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hset->readFromFileXML(filename))
+ post("h_set: couldn't read from file %s",s->s_name);
+}
+
+static void *h_set_new(t_symbol *s, int argc, t_atom *argv)
+{
+
+ t_h_set *x = (t_h_set *)pd_new(h_set_class);
+
+ switch(argc)
+ {
+ default:
+ post("h_set warning: only one argument for namespace is possible!");
+ case 1:
+ x->hset = new HSet(atom_getsymbol(argv)->s_name);
+ break;
+ case 0:
+ x->hset = new HSet();
+ break;
+ }
+
+ x->out0 = outlet_new(&x->x_obj, &s_float);
+ x->out1 = outlet_new(&x->x_obj, &s_float);
+ x->x_canvas = canvas_getcurrent();
+
+ return (void *)x;
+}
+
+static void *h_set_free(t_h_set *x)
+{
+ delete x->hset;
+ return (void *)x;
+}
+
+void h_set_setup(void)
+{
+ // the object class
+ h_set_class = class_new(gensym("h_set"), (t_newmethod)h_set_new,
+ (t_method)h_set_free, sizeof(t_h_set),
+ CLASS_DEFAULT, A_GIMME, 0);
+
+ class_addmethod(h_set_class, (t_method)h_set_add,
+ gensym("add"), A_GIMME , 0);
+ class_addmethod(h_set_class, (t_method)h_set_get,
+ gensym("get"), A_GIMME , 0);
+ class_addmethod(h_set_class, (t_method)h_set_remove,
+ gensym("remove"), A_GIMME , 0);
+ class_addmethod(h_set_class, (t_method)h_set_getsize,
+ gensym("getsize"), A_DEFFLOAT , 0);
+ class_addmethod(h_set_class, (t_method)h_set_set_namespace,
+ gensym("namespace"), A_DEFSYMBOL , 0);
+ class_addmethod(h_set_class, (t_method)h_set_get_namespace,
+ gensym("getnamespace"), A_DEFFLOAT, 0);
+ class_addmethod(h_set_class, (t_method)h_set_print,
+ gensym("print"), A_DEFFLOAT, 0);
+ class_addmethod(h_set_class, (t_method)h_set_clear,
+ gensym("clear"), A_DEFFLOAT, 0);
+ class_addmethod(h_set_class, (t_method)h_set_clear_all,
+ gensym("clearall"), A_DEFFLOAT, 0);
+ class_addmethod(h_set_class, (t_method)h_set_save,
+ gensym("save"), A_DEFSYMBOL , 0);
+ class_addmethod(h_set_class, (t_method)h_set_read,
+ gensym("read"), A_DEFSYMBOL , 0);
+ class_addmethod(h_set_class, (t_method)h_set_save_xml,
+ gensym("saveXML"), A_DEFSYMBOL , 0);
+ class_addmethod(h_set_class, (t_method)h_set_read_xml,
+ gensym("readXML"), A_DEFSYMBOL , 0);
+
+ // without an argument the following two methods wont work ??? why?? because of c++?
+ class_addmethod(h_set_class, (t_method)h_set_help, gensym("help"),A_DEFFLOAT, 0);
+}
diff --git a/PDContainer/src/h_stack.cpp b/PDContainer/src/h_stack.cpp
new file mode 100755
index 0000000..e82933e
--- /dev/null
+++ b/PDContainer/src/h_stack.cpp
@@ -0,0 +1,165 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// h_stack.cpp
+
+
+#include "include/HStack.h"
+
+
+static t_class *h_stack_class;
+
+typedef struct _h_stack
+{
+ t_object x_obj;
+ t_canvas *x_canvas;
+ t_outlet *out0, *out1, *out2;
+ HStack *hstack;
+} t_h_stack;
+
+static void h_stack_push(t_h_stack *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(argc)
+ {
+ Element key(argc,argv);
+ x->hstack->push(key);
+ }
+ else
+ post("h_stack, push: no arguments");
+}
+
+static void h_stack_pop(t_h_stack *x)
+{
+ if(x->hstack->getSize()<=0)
+ {
+ post("h_stack, pop: size is 0 !");
+ return;
+ }
+
+ x->hstack->pop();
+}
+
+static void h_stack_top(t_h_stack *x)
+{
+ if(x->hstack->getSize() == 0)
+ {
+ outlet_bang(x->out2);
+ return;
+ }
+
+ Element output = x->hstack->top();
+
+ if(output.getLength() == 1) // symbol or float
+ {
+ if (output.getAtom()[0].a_type == A_FLOAT)
+ outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
+ if (output.getAtom()[0].a_type == A_SYMBOL)
+ outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
+ if (output.getAtom()[0].a_type == A_POINTER)
+ outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
+ return;
+ }
+ if(output.getLength() > 1) // list
+ {
+ outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
+ return;
+ }
+
+ // no data
+ outlet_bang(x->out2);
+}
+
+static void h_stack_getsize(t_h_stack *x)
+{
+ outlet_float(x->out1,x->hstack->getSize());
+}
+
+static void h_stack_help(t_h_stack *x)
+{
+ x->hstack->help();
+}
+
+static void h_stack_set_namespace(t_h_stack *x, t_symbol *s)
+{
+ x->hstack->setNamespace(s->s_name);
+}
+
+static void h_stack_get_namespace(t_h_stack *x)
+{
+ post("h_stack current namespace: %s",x->hstack->getNamespace().c_str());
+}
+
+static void h_stack_clear(t_h_stack *x)
+{
+ x->hstack->clearNamespace();
+}
+
+static void h_stack_clear_all(t_h_stack *x)
+{
+ x->hstack->clearAll();
+}
+
+static void *h_stack_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_h_stack *x = (t_h_stack *)pd_new(h_stack_class);
+
+ switch(argc)
+ {
+ default:
+ post("h_stack warning: only one argument for namespace is possible!");
+ case 1:
+ x->hstack = new HStack(atom_getsymbol(argv)->s_name);
+ break;
+ case 0:
+ x->hstack = new HStack();
+ break;
+ }
+
+ x->out0 = outlet_new(&x->x_obj, 0);
+ x->out1 = outlet_new(&x->x_obj, &s_float);
+ x->out2 = outlet_new(&x->x_obj, &s_bang);
+ x->x_canvas = canvas_getcurrent();
+
+ return (void *)x;
+}
+
+static void *h_stack_free(t_h_stack *x)
+{
+ delete x->hstack;
+ return (void *)x;
+}
+
+void h_stack_setup(void)
+{
+ // the object class
+ h_stack_class = class_new(gensym("h_stack"), (t_newmethod)h_stack_new,
+ (t_method)h_stack_free, sizeof(t_h_stack),
+ CLASS_DEFAULT, A_GIMME, 0);
+
+ class_addmethod(h_stack_class, (t_method)h_stack_push,
+ gensym("push"), A_GIMME, 0);
+ class_addmethod(h_stack_class, (t_method)h_stack_pop,
+ gensym("pop"), A_DEFFLOAT, 0);
+ class_addmethod(h_stack_class, (t_method)h_stack_top,
+ gensym("top"), A_DEFFLOAT, 0);
+ class_addmethod(h_stack_class, (t_method)h_stack_getsize,
+ gensym("getsize"), A_DEFFLOAT , 0);
+ class_addmethod(h_stack_class, (t_method)h_stack_set_namespace,
+ gensym("namespace"), A_DEFSYMBOL , 0);
+ class_addmethod(h_stack_class, (t_method)h_stack_get_namespace,
+ gensym("getnamespace"), A_DEFFLOAT, 0);
+ class_addmethod(h_stack_class, (t_method)h_stack_clear,
+ gensym("clear"), A_DEFFLOAT, 0);
+ class_addmethod(h_stack_class, (t_method)h_stack_clear_all,
+ gensym("clearall"), A_DEFFLOAT, 0);
+
+ // without an argument the following two methods wont work ??? why?? because of c++?
+ class_addmethod(h_stack_class, (t_method)h_stack_help, gensym("help"),A_DEFFLOAT, 0);
+}
diff --git a/PDContainer/src/h_vector.cpp b/PDContainer/src/h_vector.cpp
new file mode 100755
index 0000000..d3f76a3
--- /dev/null
+++ b/PDContainer/src/h_vector.cpp
@@ -0,0 +1,488 @@
+// *********************(c)*2004*********************>
+// -holzilib--holzilib--holzilib--holzilib--holzilib->
+// ++++PD-External++by+Georg+Holzmann++grh@gmx.at++++>
+//
+// PDContainer:
+// this is a port of the containers from the C++ STL
+// (Standard Template Library)
+// for usage see the documentation and PD help files
+// for license see readme.txt
+//
+// h_vector.cpp
+
+
+#include "include/HVector.h"
+
+
+static t_class *h_vector_class;
+static t_class *proxy_class;
+
+typedef struct _h_vector
+{
+ t_object x_obj;
+ t_canvas *x_canvas;
+ t_outlet *out0, *out1, *out2;
+ HVector *hvector;
+ Element value;
+ bool event_set;
+} t_h_vector;
+
+typedef struct proxy
+{
+ t_object obj;
+ t_int index; // number of proxy inlet(s)
+ t_h_vector *x; // we'll put the other struct in here
+} t_proxy;
+
+static void h_vector_set(t_h_vector *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int index;
+ if(argc && (argv[0].a_type == A_FLOAT))
+ index = static_cast<int>(argv[0].a_w.w_float);
+ else
+ {
+ post("h_vector, set: invalid index!");
+ return;
+ }
+
+ if ( index >= x->hvector->getSize() || index < 0 )
+ {
+ post("h_vector, set: invalid index!");
+ return;
+ }
+
+ if(!x->event_set)
+ {
+ post("h_vector, set: you must first set a value at right inlet!");
+ return;
+ }
+
+ x->hvector->set( index , x->value);
+ x->event_set = false;
+}
+
+static void h_vector_push_back(t_h_vector *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(argc)
+ {
+ Element key(argc,argv);
+ x->hvector->pushBack(key);
+ }
+ else
+ post("h_vector, pushback: no arguments");
+}
+
+static void h_vector_insert(t_h_vector *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int index;
+ if(argc && (argv[0].a_type == A_FLOAT))
+ index = static_cast<int>(argv[0].a_w.w_float);
+ else
+ {
+ post("h_vector, insert: invalid index!");
+ return;
+ }
+
+ if ( index >= x->hvector->getSize() || index < 0 )
+ {
+ post("h_vector, insert: invalid index!");
+ return;
+ }
+
+ if(!x->event_set)
+ {
+ post("h_vector, insert: you must first set a value at right inlet!");
+ return;
+ }
+
+ x->hvector->insert( index , x->value);
+ x->event_set = false;
+}
+
+static void h_vector_value(t_proxy *p, t_symbol *s, int argc, t_atom *argv)
+{
+ t_h_vector *x = (t_h_vector *)(p->x);
+
+ // symbol without selector "symbol":
+ if(argc == 0)
+ {
+ t_atom tmp;
+ SETSYMBOL(&tmp, s);
+ x->value.setAtoms(1, &tmp);
+ x->event_set = true;
+ return;
+ }
+
+ // input is a list without selector "list":
+ if ( argc && (strcmp(s->s_name,"list")!=0)
+ && (strcmp(s->s_name,"float")!=0)
+ && (strcmp(s->s_name,"symbol")!=0)
+ && (strcmp(s->s_name,"pointer")!=0) )
+ {
+ t_atom *atoms = (t_atom*)getbytes( (argc+1)*sizeof(t_atom) );
+
+ // add the selector symbol to the list:
+ SETSYMBOL(atoms, s);
+
+ for(int i=0; i<argc; i++)
+ {
+ if(argv[i].a_type == A_FLOAT)
+ SETFLOAT(&atoms[i+1],argv[i].a_w.w_float);
+ if(argv[i].a_type == A_SYMBOL)
+ SETSYMBOL(&atoms[i+1],argv[i].a_w.w_symbol);
+ if(argv[i].a_type == A_POINTER)
+ SETPOINTER(&atoms[i+1],argv[i].a_w.w_gpointer);
+ }
+
+ x->value.setAtoms(argc+1, atoms);
+
+ x->event_set = true;
+ freebytes(atoms, (argc+1)*sizeof(t_atom));
+ return;
+ }
+
+ // "normal" input (list, float or symbol):
+ if (argc)
+ {
+ x->value.setAtoms(argc, argv);
+ x->event_set = true;
+ return;
+ }
+}
+
+static void h_vector_get(t_h_vector *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int index;
+ if(argc && (argv[0].a_type == A_FLOAT))
+ index = static_cast<int>(argv[0].a_w.w_float);
+ else
+ {
+ post("h_vector, get: invalid index!");
+ return;
+ }
+
+ if ( index >= x->hvector->getSize() || index < 0 )
+ {
+ post("h_vector, get: invalid index!");
+ return;
+ }
+
+ Element output = x->hvector->get( index );
+
+ if(output.getLength() == 1) // symbol or float
+ {
+ if (output.getAtom()[0].a_type == A_FLOAT)
+ outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
+ if (output.getAtom()[0].a_type == A_SYMBOL)
+ outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
+ if (output.getAtom()[0].a_type == A_POINTER)
+ outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
+ return;
+ }
+ if(output.getLength() > 1) // list
+ {
+ outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
+ return;
+ }
+
+ // if there was no Element found, put out a bang at the right outlet
+ outlet_bang(x->out2);
+}
+
+static void h_vector_pop_back(t_h_vector *x)
+{
+ if(x->hvector->getSize()<=0)
+ {
+ post("h_vector, popback: size is already 0 !");
+ return;
+ }
+
+ x->hvector->popBack();
+}
+
+static void h_vector_remove(t_h_vector *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int index;
+ if(argc && (argv[0].a_type == A_FLOAT))
+ index = static_cast<int>(argv[0].a_w.w_float);
+ else
+ {
+ post("h_vector, remove: invalid index!");
+ return;
+ }
+
+ if ( index >= x->hvector->getSize() || index < 0 )
+ {
+ post("h_vector, remove: invalid index!");
+ return;
+ }
+
+ x->hvector->remove(index);
+ x->event_set = false;
+}
+
+static void h_vector_resize(t_h_vector *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int size;
+ if(argc && (argv[0].a_type == A_FLOAT))
+ size = static_cast<int>(argv[0].a_w.w_float);
+ else
+ {
+ post("h_vector, resize: invalid index!");
+ return;
+ }
+
+ if ( size < 0 )
+ {
+ post("h_vector, size: invalid size!");
+ return;
+ }
+
+ x->hvector->resize( size );
+}
+
+static void h_vector_getsize(t_h_vector *x)
+{
+ outlet_float(x->out1,x->hvector->getSize());
+}
+
+static void h_vector_help(t_h_vector *x)
+{
+ x->hvector->help();
+}
+
+static void h_vector_set_namespace(t_h_vector *x, t_symbol *s)
+{
+ x->hvector->setNamespace(s->s_name);
+}
+
+static void h_vector_get_namespace(t_h_vector *x)
+{
+ post("h_vector current namespace: %s",x->hvector->getNamespace().c_str());
+}
+
+static void h_vector_print(t_h_vector *x)
+{
+ x->hvector->printAllIndex();
+}
+
+static void h_vector_clear(t_h_vector *x)
+{
+ x->hvector->clearNamespace();
+}
+
+static void h_vector_clear_all(t_h_vector *x)
+{
+ x->hvector->clearAll();
+}
+
+static void h_vector_save(t_h_vector *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(x->hvector->saveToFile(filename))
+ post("h_vector: data of namespace %s written to file %s",
+ x->hvector->getNamespace().c_str(),s->s_name);
+ else
+ post("h_vector: couldn't write to file %s",s->s_name);
+}
+
+static void h_vector_read(t_h_vector *x, t_symbol *s, int argc, t_atom *argv)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hvector->readFromFile(filename))
+ post("h_vector: couldn't read from file %s",s->s_name);
+}
+
+static void h_vector_read_at(t_h_vector *x, t_symbol *s, int argc, t_atom *argv)
+{
+ string symbol;
+ int index=0;
+
+ switch(argc)
+ {
+ default:
+ post("h_vector read: only two argument are possible!");
+ break;
+ case 2:
+ symbol = argv[0].a_w.w_symbol->s_name;
+ index = (int)argv[1].a_w.w_float;
+ break;
+ case 1:
+ symbol = argv[0].a_w.w_symbol->s_name;
+ index = 0;
+ break;
+ case 0:
+ post("h_vector read: no filename!");
+ }
+
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, (char*)symbol.c_str(), filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hvector->readFromFile2(filename,index))
+ post("h_vector: couldn't read from file %s",s->s_name);
+}
+
+static void h_vector_save_xml(t_h_vector *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(x->hvector->saveToFileXML(filename))
+ post("h_vector: data of namespace %s written to file %s",
+ x->hvector->getNamespace().c_str(),s->s_name);
+ else
+ post("h_vector: couldn't write to file %s",s->s_name);
+}
+
+static void h_vector_read_xml(t_h_vector *x, t_symbol *s)
+{
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hvector->readFromFileXML(filename))
+ post("h_vector: couldn't read from file %s",s->s_name);
+}
+
+static void h_vector_read_at_xml(t_h_vector *x, t_symbol *s, int argc, t_atom *argv)
+{
+ string symbol;
+ int index=0;
+
+ switch(argc)
+ {
+ default:
+ post("h_vector read: only two argument are possible!");
+ break;
+ case 2:
+ symbol = argv[0].a_w.w_symbol->s_name;
+ index = (int)argv[1].a_w.w_float;
+ break;
+ case 1:
+ symbol = argv[0].a_w.w_symbol->s_name;
+ index = 0;
+ break;
+ case 0:
+ post("h_vector read: no filename!");
+ }
+
+ // make correct path
+ char filnam[MAXPDSTRING];
+ char filename[MAXPDSTRING];
+ canvas_makefilename(x->x_canvas, (char*)symbol.c_str(), filnam, MAXPDSTRING);
+ sys_bashfilename(filnam, filename);
+
+ if(!x->hvector->readFromFile2XML(filename,index))
+ post("h_vector: couldn't read from file %s",s->s_name);
+}
+
+static void *h_vector_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_h_vector *x = (t_h_vector *)pd_new(h_vector_class);
+ t_proxy *inlet = (t_proxy *)pd_new(proxy_class); // for the proxy inlet
+
+ inlet->x = x; // make x visible to the proxy inlets
+
+ switch(argc)
+ {
+ default:
+ post("h_vector warning: only one argument for namespace is possible!");
+ case 1:
+ x->hvector = new HVector(atom_getsymbol(argv)->s_name);
+ break;
+ case 0:
+ x->hvector = new HVector();
+ break;
+ }
+
+ // we are going to create a proxy inlet no. 0
+ // it belongs to the object x but the destination is t_proxy
+ inlet->index = 0;
+ inlet_new(&x->x_obj, &inlet->obj.ob_pd, 0,0);
+
+ x->out0 = outlet_new(&x->x_obj, 0);
+ x->out1 = outlet_new(&x->x_obj, &s_float);
+ x->out2 = outlet_new(&x->x_obj, &s_bang);
+ x->x_canvas = canvas_getcurrent();
+
+ return (void *)x;
+}
+
+static void *h_vector_free(t_h_vector *x)
+{
+ delete x->hvector;
+ return (void *)x;
+}
+
+void h_vector_setup(void)
+{
+ // the object class
+ h_vector_class = class_new(gensym("h_vector"), (t_newmethod)h_vector_new,
+ (t_method)h_vector_free, sizeof(t_h_vector),
+ CLASS_DEFAULT, A_GIMME, 0);
+
+ // a class for the proxy-inlet
+ proxy_class = class_new(gensym("h_vector_proxy"), NULL, NULL, sizeof(t_proxy),
+ CLASS_PD|CLASS_NOINLET, A_NULL);
+
+ class_addmethod(h_vector_class, (t_method)h_vector_set,
+ gensym("set"), A_GIMME, 0);
+ class_addmethod(h_vector_class, (t_method)h_vector_push_back,
+ gensym("pushback"), A_GIMME, 0);
+ class_addmethod(h_vector_class, (t_method)h_vector_insert,
+ gensym("insert"), A_GIMME, 0);
+ class_addanything(proxy_class, (t_method)h_vector_value); // the right inlet
+ class_addmethod(h_vector_class, (t_method)h_vector_get,
+ gensym("get"), A_GIMME, 0);
+ class_addmethod(h_vector_class, (t_method)h_vector_pop_back,
+ gensym("popback"), A_DEFFLOAT, 0);
+ class_addmethod(h_vector_class, (t_method)h_vector_remove,
+ gensym("remove"), A_GIMME, 0);
+ class_addmethod(h_vector_class, (t_method)h_vector_resize,
+ gensym("resize"), A_GIMME , 0);
+ class_addmethod(h_vector_class, (t_method)h_vector_getsize,
+ gensym("getsize"), A_DEFFLOAT , 0);
+ class_addmethod(h_vector_class, (t_method)h_vector_set_namespace,
+ gensym("namespace"), A_DEFSYMBOL , 0);
+ class_addmethod(h_vector_class, (t_method)h_vector_get_namespace,
+ gensym("getnamespace"), A_DEFFLOAT, 0);
+ class_addmethod(h_vector_class, (t_method)h_vector_print,
+ gensym("print"), A_DEFFLOAT, 0);
+ class_addmethod(h_vector_class, (t_method)h_vector_clear,
+ gensym("clear"), A_DEFFLOAT, 0);
+ class_addmethod(h_vector_class, (t_method)h_vector_clear_all,
+ gensym("clearall"), A_DEFFLOAT, 0);
+ class_addmethod(h_vector_class, (t_method)h_vector_save,
+ gensym("save"), A_DEFSYMBOL, 0);
+ class_addmethod(h_vector_class, (t_method)h_vector_read,
+ gensym("read"), A_DEFSYMBOL, 0);
+ class_addmethod(h_vector_class, (t_method)h_vector_read_at,
+ gensym("readat"), A_GIMME, 0);
+ class_addmethod(h_vector_class, (t_method)h_vector_save_xml,
+ gensym("saveXML"), A_DEFSYMBOL , 0);
+ class_addmethod(h_vector_class, (t_method)h_vector_read_xml,
+ gensym("readXML"), A_DEFSYMBOL , 0);
+ class_addmethod(h_vector_class, (t_method)h_vector_read_at_xml,
+ gensym("readatXML"), A_GIMME, 0);
+
+ // without an argument the following two methods wont work ??? why?? because of c++?
+ class_addmethod(h_vector_class, (t_method)h_vector_help, gensym("help"),A_DEFFLOAT, 0);
+}
diff --git a/PDContainer/tinyxml/tinystr.cpp b/PDContainer/tinyxml/tinystr.cpp
new file mode 100755
index 0000000..413f5c3
--- /dev/null
+++ b/PDContainer/tinyxml/tinystr.cpp
@@ -0,0 +1,318 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original file by Yves Berquin.
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+#include "tinyxml.h"
+
+#ifndef TIXML_USE_STL
+
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "tinystr.h"
+
+// TiXmlString constructor, based on a C string
+TiXmlString::TiXmlString (const char* instring)
+{
+ size_t newlen;
+ char * newstring;
+
+ if (!instring)
+ {
+ allocated = 0;
+ cstring = NULL;
+ current_length = 0;
+ return;
+ }
+ newlen = strlen (instring) + 1;
+ newstring = new char [newlen];
+ memcpy (newstring, instring, newlen);
+ // strcpy (newstring, instring);
+ allocated = newlen;
+ cstring = newstring;
+ current_length = newlen - 1;
+}
+
+// TiXmlString copy constructor
+TiXmlString::TiXmlString (const TiXmlString& copy)
+{
+ size_t newlen;
+ char * newstring;
+
+ // Prevent copy to self!
+ if ( &copy == this )
+ return;
+
+ if (! copy . allocated)
+ {
+ allocated = 0;
+ cstring = NULL;
+ current_length = 0;
+ return;
+ }
+ newlen = copy . length () + 1;
+ newstring = new char [newlen];
+ // strcpy (newstring, copy . cstring);
+ memcpy (newstring, copy . cstring, newlen);
+ allocated = newlen;
+ cstring = newstring;
+ current_length = newlen - 1;
+}
+
+// TiXmlString = operator. Safe when assign own content
+void TiXmlString ::operator = (const char * content)
+{
+ size_t newlen;
+ char * newstring;
+
+ if (! content)
+ {
+ empty_it ();
+ return;
+ }
+ newlen = strlen (content) + 1;
+ newstring = new char [newlen];
+ // strcpy (newstring, content);
+ memcpy (newstring, content, newlen);
+ empty_it ();
+ allocated = newlen;
+ cstring = newstring;
+ current_length = newlen - 1;
+}
+
+// = operator. Safe when assign own content
+void TiXmlString ::operator = (const TiXmlString & copy)
+{
+ size_t newlen;
+ char * newstring;
+
+ if (! copy . length ())
+ {
+ empty_it ();
+ return;
+ }
+ newlen = copy . length () + 1;
+ newstring = new char [newlen];
+ // strcpy (newstring, copy . c_str ());
+ memcpy (newstring, copy . c_str (), newlen);
+ empty_it ();
+ allocated = newlen;
+ cstring = newstring;
+ current_length = newlen - 1;
+}
+
+
+// append a const char * to an existing TiXmlString
+void TiXmlString::append( const char* str, size_t len )
+{
+ char * new_string;
+ size_t new_alloc, new_size, size_suffix;
+
+ // don't use strlen - it can overrun the len passed in!
+ const char* p = str;
+ size_suffix = 0;
+
+ while ( *p && size_suffix < (unsigned)len )
+ {
+ ++p;
+ ++size_suffix;
+ }
+ if ( !size_suffix)
+ return;
+
+ new_size = length () + size_suffix + 1;
+ // check if we need to expand
+ if (new_size > allocated)
+ {
+ // compute new size
+ new_alloc = assign_new_size (new_size);
+
+ // allocate new buffer
+ new_string = new char [new_alloc];
+ new_string [0] = 0;
+
+ // copy the previous allocated buffer into this one
+ if (allocated && cstring)
+ // strcpy (new_string, cstring);
+ memcpy (new_string, cstring, length ());
+
+ // append the suffix. It does exist, otherwize we wouldn't be expanding
+ // strncat (new_string, str, len);
+ memcpy (new_string + length (),
+ str,
+ size_suffix);
+
+ // return previsously allocated buffer if any
+ if (allocated && cstring)
+ delete [] cstring;
+
+ // update member variables
+ cstring = new_string;
+ allocated = new_alloc;
+ }
+ else
+ {
+ // we know we can safely append the new string
+ // strncat (cstring, str, len);
+ memcpy (cstring + length (),
+ str,
+ size_suffix);
+ }
+ current_length = new_size - 1;
+ cstring [current_length] = 0;
+}
+
+
+// append a const char * to an existing TiXmlString
+void TiXmlString::append( const char * suffix )
+{
+ char * new_string;
+ size_t new_alloc, new_size;
+
+ new_size = length () + strlen (suffix) + 1;
+ // check if we need to expand
+ if (new_size > allocated)
+ {
+ // compute new size
+ new_alloc = assign_new_size (new_size);
+
+ // allocate new buffer
+ new_string = new char [new_alloc];
+ new_string [0] = 0;
+
+ // copy the previous allocated buffer into this one
+ if (allocated && cstring)
+ memcpy (new_string, cstring, 1 + length ());
+ // strcpy (new_string, cstring);
+
+ // append the suffix. It does exist, otherwize we wouldn't be expanding
+ // strcat (new_string, suffix);
+ memcpy (new_string + length (),
+ suffix,
+ strlen (suffix) + 1);
+
+ // return previsously allocated buffer if any
+ if (allocated && cstring)
+ delete [] cstring;
+
+ // update member variables
+ cstring = new_string;
+ allocated = new_alloc;
+ }
+ else
+ {
+ // we know we can safely append the new string
+ // strcat (cstring, suffix);
+ memcpy (cstring + length (),
+ suffix,
+ strlen (suffix) + 1);
+ }
+ current_length = new_size - 1;
+}
+
+// Check for TiXmlString equuivalence
+//bool TiXmlString::operator == (const TiXmlString & compare) const
+//{
+// return (! strcmp (c_str (), compare . c_str ()));
+//}
+
+//unsigned TiXmlString::length () const
+//{
+// if (allocated)
+// // return strlen (cstring);
+// return current_length;
+// return 0;
+//}
+
+
+unsigned TiXmlString::find (char tofind, unsigned offset) const
+{
+ char * lookup;
+
+ if (offset >= length ())
+ return (unsigned) notfound;
+ for (lookup = cstring + offset; * lookup; lookup++)
+ if (* lookup == tofind)
+ return (unsigned)(lookup - cstring);
+ return (unsigned) notfound;
+}
+
+
+bool TiXmlString::operator == (const TiXmlString & compare) const
+{
+ if ( allocated && compare.allocated )
+ {
+ assert( cstring );
+ assert( compare.cstring );
+ return ( strcmp( cstring, compare.cstring ) == 0 );
+ }
+ else if ( length() == 0 && compare.length() == 0 )
+ {
+ return true;
+ }
+ return false;
+}
+
+
+bool TiXmlString::operator == (const char* compare) const
+{
+ if ( allocated && compare && *compare )
+ {
+ assert( cstring );
+ return ( strcmp( cstring, compare ) == 0 );
+ }
+ else if ( length() == 0 && (!compare || !*compare ) ) // this is a little dubious, but try to duplicate behavior in other operator==
+ {
+ return true;
+ }
+ return false;
+}
+
+
+bool TiXmlString::operator < (const TiXmlString & compare) const
+{
+ if ( allocated && compare.allocated )
+ {
+ assert( cstring );
+ assert( compare.cstring );
+ return ( strcmp( cstring, compare.cstring ) > 0 );
+ }
+ return false;
+}
+
+
+bool TiXmlString::operator > (const TiXmlString & compare) const
+{
+ if ( allocated && compare.allocated )
+ {
+ assert( cstring );
+ assert( compare.cstring );
+ return ( strcmp( cstring, compare.cstring ) < 0 );
+ }
+ return false;
+}
+
+
+#endif // TIXML_USE_STL
diff --git a/PDContainer/tinyxml/tinystr.h b/PDContainer/tinyxml/tinystr.h
new file mode 100755
index 0000000..3960502
--- /dev/null
+++ b/PDContainer/tinyxml/tinystr.h
@@ -0,0 +1,250 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original file by Yves Berquin.
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+#include "tinyxml.h"
+
+
+#ifndef TIXML_USE_STL
+
+#ifndef TIXML_STRING_INCLUDED
+#define TIXML_STRING_INCLUDED
+
+#ifdef _MSC_VER
+#pragma warning( disable : 4530 )
+#pragma warning( disable : 4786 )
+#endif
+
+#include <assert.h>
+
+/*
+ TiXmlString is an emulation of the std::string template.
+ Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
+ Only the member functions relevant to the TinyXML project have been implemented.
+ The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
+ a string and there's no more room, we allocate a buffer twice as big as we need.
+*/
+class TiXmlString
+{
+ public :
+ // TiXmlString constructor, based on a string, mark explicit to force
+ // us to find unnecessary casting.
+ explicit TiXmlString (const char * instring);
+
+ // TiXmlString empty constructor
+ TiXmlString ()
+ {
+ allocated = 0;
+ cstring = NULL;
+ current_length = 0;
+ }
+
+ // TiXmlString copy constructor
+ explicit TiXmlString (const TiXmlString& copy);
+
+ // TiXmlString destructor
+ ~ TiXmlString ()
+ {
+ empty_it ();
+ }
+
+ // Convert a TiXmlString into a classical char *
+ const char * c_str () const
+ {
+ if (allocated)
+ return cstring;
+ return "";
+ }
+
+ // Return the length of a TiXmlString
+ size_t length () const
+ {
+ return ( allocated ) ? current_length : 0;
+ }
+
+ // TiXmlString = operator
+ void operator = (const char * content);
+
+ // = operator
+ void operator = (const TiXmlString & copy);
+
+ // += operator. Maps to append
+ TiXmlString& operator += (const char * suffix)
+ {
+ append (suffix);
+ return *this;
+ }
+
+ // += operator. Maps to append
+ TiXmlString& operator += (char single)
+ {
+ append (single);
+ return *this;
+ }
+
+ // += operator. Maps to append
+ TiXmlString& operator += (TiXmlString & suffix)
+ {
+ append (suffix);
+ return *this;
+ }
+ bool operator == (const TiXmlString & compare) const;
+ bool operator == (const char* compare) const;
+ bool operator < (const TiXmlString & compare) const;
+ bool operator > (const TiXmlString & compare) const;
+
+ // Checks if a TiXmlString is empty
+ bool empty () const
+ {
+ return length () ? false : true;
+ }
+
+ // single char extraction
+ const char& at (unsigned index) const
+ {
+ assert( index < length ());
+ return cstring [index];
+ }
+
+ // find a char in a string. Return TiXmlString::notfound if not found
+ unsigned find (char lookup) const
+ {
+ return find (lookup, 0);
+ }
+
+ // find a char in a string from an offset. Return TiXmlString::notfound if not found
+ unsigned find (char tofind, unsigned offset) const;
+
+ /* Function to reserve a big amount of data when we know we'll need it. Be aware that this
+ function clears the content of the TiXmlString if any exists.
+ */
+ void reserve (unsigned size)
+ {
+ empty_it ();
+ if (size)
+ {
+ allocated = size;
+ cstring = new char [size];
+ cstring [0] = 0;
+ current_length = 0;
+ }
+ }
+
+ // [] operator
+ char& operator [] (unsigned index) const
+ {
+ assert( index < length ());
+ return cstring [index];
+ }
+
+ // Error value for find primitive
+ enum { notfound = 0xffffffff,
+ npos = notfound };
+
+ void append (const char *str, size_t len );
+
+ protected :
+
+ // The base string
+ char * cstring;
+ // Number of chars allocated
+ size_t allocated;
+ // Current string size
+ size_t current_length;
+
+ // New size computation. It is simplistic right now : it returns twice the amount
+ // we need
+ size_t assign_new_size (size_t minimum_to_allocate)
+ {
+ return minimum_to_allocate * 2;
+ }
+
+ // Internal function that clears the content of a TiXmlString
+ void empty_it ()
+ {
+ if (cstring)
+ delete [] cstring;
+ cstring = NULL;
+ allocated = 0;
+ current_length = 0;
+ }
+
+ void append (const char *suffix );
+
+ // append function for another TiXmlString
+ void append (const TiXmlString & suffix)
+ {
+ append (suffix . c_str ());
+ }
+
+ // append for a single char.
+ void append (char single)
+ {
+ if ( cstring && current_length < (allocated-1) )
+ {
+ cstring[ current_length ] = single;
+ ++current_length;
+ cstring[ current_length ] = 0;
+ }
+ else
+ {
+ char smallstr [2];
+ smallstr [0] = single;
+ smallstr [1] = 0;
+ append (smallstr);
+ }
+ }
+
+} ;
+
+/*
+ TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
+ Only the operators that we need for TinyXML have been developped.
+*/
+class TiXmlOutStream : public TiXmlString
+{
+public :
+ TiXmlOutStream () : TiXmlString () {}
+
+ // TiXmlOutStream << operator. Maps to TiXmlString::append
+ TiXmlOutStream & operator << (const char * in)
+ {
+ append (in);
+ return (* this);
+ }
+
+ // TiXmlOutStream << operator. Maps to TiXmlString::append
+ TiXmlOutStream & operator << (const TiXmlString & in)
+ {
+ append (in . c_str ());
+ return (* this);
+ }
+} ;
+
+#ifdef _MSC_VER
+#pragma warning( default : 4530 )
+#pragma warning( default : 4786 )
+#endif
+
+#endif // TIXML_STRING_INCLUDED
+#endif // TIXML_USE_STL
diff --git a/PDContainer/tinyxml/tinyxml.cpp b/PDContainer/tinyxml/tinyxml.cpp
new file mode 100755
index 0000000..c652cc1
--- /dev/null
+++ b/PDContainer/tinyxml/tinyxml.cpp
@@ -0,0 +1,1592 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+#include <ctype.h>
+#include "tinyxml.h"
+
+#ifdef TIXML_USE_STL
+#include <sstream>
+#endif
+
+
+bool TiXmlBase::condenseWhiteSpace = true;
+
+void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_OSTREAM* stream )
+{
+ TIXML_STRING buffer;
+ PutString( str, &buffer );
+ (*stream) << buffer;
+}
+
+void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_STRING* outString )
+{
+ int i=0;
+
+ while( i<(int)str.length() )
+ {
+ unsigned char c = (unsigned char) str[i];
+
+ if ( c == '&'
+ && i < ( (int)str.length() - 2 )
+ && str[i+1] == '#'
+ && str[i+2] == 'x' )
+ {
+ // Hexadecimal character reference.
+ // Pass through unchanged.
+ // &#xA9; -- copyright symbol, for example.
+ //
+ // The -1 is a bug fix from Rob Laveaux. It keeps
+ // an overflow from happening if there is no ';'.
+ // There are actually 2 ways to exit this loop -
+ // while fails (error case) and break (semicolon found).
+ // However, there is no mechanism (currently) for
+ // this function to return an error.
+ while ( i<(int)str.length()-1 )
+ {
+ outString->append( str.c_str() + i, 1 );
+ ++i;
+ if ( str[i] == ';' )
+ break;
+ }
+ }
+ else if ( c == '&' )
+ {
+ outString->append( entity[0].str, entity[0].strLength );
+ ++i;
+ }
+ else if ( c == '<' )
+ {
+ outString->append( entity[1].str, entity[1].strLength );
+ ++i;
+ }
+ else if ( c == '>' )
+ {
+ outString->append( entity[2].str, entity[2].strLength );
+ ++i;
+ }
+ else if ( c == '\"' )
+ {
+ outString->append( entity[3].str, entity[3].strLength );
+ ++i;
+ }
+ else if ( c == '\'' )
+ {
+ outString->append( entity[4].str, entity[4].strLength );
+ ++i;
+ }
+ else if ( c < 32 )
+ {
+ // Easy pass at non-alpha/numeric/symbol
+ // Below 32 is symbolic.
+ char buf[ 32 ];
+ sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) );
+ //*ME: warning C4267: convert 'size_t' to 'int'
+ //*ME: Int-Cast to make compiler happy ...
+ outString->append( buf, (int)strlen( buf ) );
+ ++i;
+ }
+ else
+ {
+ //char realc = (char) c;
+ //outString->append( &realc, 1 );
+ *outString += (char) c; // somewhat more efficient function call.
+ ++i;
+ }
+ }
+}
+
+
+// <-- Strange class for a bug fix. Search for STL_STRING_BUG
+TiXmlBase::StringToBuffer::StringToBuffer( const TIXML_STRING& str )
+{
+ buffer = new char[ str.length()+1 ];
+ if ( buffer )
+ {
+ strcpy( buffer, str.c_str() );
+ }
+}
+
+
+TiXmlBase::StringToBuffer::~StringToBuffer()
+{
+ delete [] buffer;
+}
+// End strange bug fix. -->
+
+
+TiXmlNode::TiXmlNode( NodeType _type ) : TiXmlBase()
+{
+ parent = 0;
+ type = _type;
+ firstChild = 0;
+ lastChild = 0;
+ prev = 0;
+ next = 0;
+}
+
+
+TiXmlNode::~TiXmlNode()
+{
+ TiXmlNode* node = firstChild;
+ TiXmlNode* temp = 0;
+
+ while ( node )
+ {
+ temp = node;
+ node = node->next;
+ delete temp;
+ }
+}
+
+
+void TiXmlNode::CopyTo( TiXmlNode* target ) const
+{
+ target->SetValue (value.c_str() );
+ target->userData = userData;
+}
+
+
+void TiXmlNode::Clear()
+{
+ TiXmlNode* node = firstChild;
+ TiXmlNode* temp = 0;
+
+ while ( node )
+ {
+ temp = node;
+ node = node->next;
+ delete temp;
+ }
+
+ firstChild = 0;
+ lastChild = 0;
+}
+
+
+TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node )
+{
+ node->parent = this;
+
+ node->prev = lastChild;
+ node->next = 0;
+
+ if ( lastChild )
+ lastChild->next = node;
+ else
+ firstChild = node; // it was an empty list.
+
+ lastChild = node;
+ return node;
+}
+
+
+TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis )
+{
+ TiXmlNode* node = addThis.Clone();
+ if ( !node )
+ return 0;
+
+ return LinkEndChild( node );
+}
+
+
+TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis )
+{
+ if ( !beforeThis || beforeThis->parent != this )
+ return 0;
+
+ TiXmlNode* node = addThis.Clone();
+ if ( !node )
+ return 0;
+ node->parent = this;
+
+ node->next = beforeThis;
+ node->prev = beforeThis->prev;
+ if ( beforeThis->prev )
+ {
+ beforeThis->prev->next = node;
+ }
+ else
+ {
+ assert( firstChild == beforeThis );
+ firstChild = node;
+ }
+ beforeThis->prev = node;
+ return node;
+}
+
+
+TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis )
+{
+ if ( !afterThis || afterThis->parent != this )
+ return 0;
+
+ TiXmlNode* node = addThis.Clone();
+ if ( !node )
+ return 0;
+ node->parent = this;
+
+ node->prev = afterThis;
+ node->next = afterThis->next;
+ if ( afterThis->next )
+ {
+ afterThis->next->prev = node;
+ }
+ else
+ {
+ assert( lastChild == afterThis );
+ lastChild = node;
+ }
+ afterThis->next = node;
+ return node;
+}
+
+
+TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis )
+{
+ if ( replaceThis->parent != this )
+ return 0;
+
+ TiXmlNode* node = withThis.Clone();
+ if ( !node )
+ return 0;
+
+ node->next = replaceThis->next;
+ node->prev = replaceThis->prev;
+
+ if ( replaceThis->next )
+ replaceThis->next->prev = node;
+ else
+ lastChild = node;
+
+ if ( replaceThis->prev )
+ replaceThis->prev->next = node;
+ else
+ firstChild = node;
+
+ delete replaceThis;
+ node->parent = this;
+ return node;
+}
+
+
+bool TiXmlNode::RemoveChild( TiXmlNode* removeThis )
+{
+ if ( removeThis->parent != this )
+ {
+ assert( 0 );
+ return false;
+ }
+
+ if ( removeThis->next )
+ removeThis->next->prev = removeThis->prev;
+ else
+ lastChild = removeThis->prev;
+
+ if ( removeThis->prev )
+ removeThis->prev->next = removeThis->next;
+ else
+ firstChild = removeThis->next;
+
+ delete removeThis;
+ return true;
+}
+
+const TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const
+{
+ const TiXmlNode* node;
+ for ( node = firstChild; node; node = node->next )
+ {
+ if ( node->SValue() == _value )
+ return node;
+ }
+ return 0;
+}
+
+
+TiXmlNode* TiXmlNode::FirstChild( const char * _value )
+{
+ TiXmlNode* node;
+ for ( node = firstChild; node; node = node->next )
+ {
+ if ( node->SValue() == _value )
+ return node;
+ }
+ return 0;
+}
+
+
+const TiXmlNode* TiXmlNode::LastChild( const char * _value ) const
+{
+ const TiXmlNode* node;
+ for ( node = lastChild; node; node = node->prev )
+ {
+ if ( node->SValue() == _value )
+ return node;
+ }
+ return 0;
+}
+
+TiXmlNode* TiXmlNode::LastChild( const char * _value )
+{
+ TiXmlNode* node;
+ for ( node = lastChild; node; node = node->prev )
+ {
+ if ( node->SValue() == _value )
+ return node;
+ }
+ return 0;
+}
+
+const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const
+{
+ if ( !previous )
+ {
+ return FirstChild();
+ }
+ else
+ {
+ assert( previous->parent == this );
+ return previous->NextSibling();
+ }
+}
+
+TiXmlNode* TiXmlNode::IterateChildren( TiXmlNode* previous )
+{
+ if ( !previous )
+ {
+ return FirstChild();
+ }
+ else
+ {
+ assert( previous->parent == this );
+ return previous->NextSibling();
+ }
+}
+
+const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode* previous ) const
+{
+ if ( !previous )
+ {
+ return FirstChild( val );
+ }
+ else
+ {
+ assert( previous->parent == this );
+ return previous->NextSibling( val );
+ }
+}
+
+TiXmlNode* TiXmlNode::IterateChildren( const char * val, TiXmlNode* previous )
+{
+ if ( !previous )
+ {
+ return FirstChild( val );
+ }
+ else
+ {
+ assert( previous->parent == this );
+ return previous->NextSibling( val );
+ }
+}
+
+const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const
+{
+ const TiXmlNode* node;
+ for ( node = next; node; node = node->next )
+ {
+ if ( node->SValue() == _value )
+ return node;
+ }
+ return 0;
+}
+
+TiXmlNode* TiXmlNode::NextSibling( const char * _value )
+{
+ TiXmlNode* node;
+ for ( node = next; node; node = node->next )
+ {
+ if ( node->SValue() == _value )
+ return node;
+ }
+ return 0;
+}
+
+const TiXmlNode* TiXmlNode::PreviousSibling( const char * _value ) const
+{
+ const TiXmlNode* node;
+ for ( node = prev; node; node = node->prev )
+ {
+ if ( node->SValue() == _value )
+ return node;
+ }
+ return 0;
+}
+
+TiXmlNode* TiXmlNode::PreviousSibling( const char * _value )
+{
+ TiXmlNode* node;
+ for ( node = prev; node; node = node->prev )
+ {
+ if ( node->SValue() == _value )
+ return node;
+ }
+ return 0;
+}
+
+void TiXmlElement::RemoveAttribute( const char * name )
+{
+ TiXmlAttribute* node = attributeSet.Find( name );
+ if ( node )
+ {
+ attributeSet.Remove( node );
+ delete node;
+ }
+}
+
+const TiXmlElement* TiXmlNode::FirstChildElement() const
+{
+ const TiXmlNode* node;
+
+ for ( node = FirstChild();
+ node;
+ node = node->NextSibling() )
+ {
+ if ( node->ToElement() )
+ return node->ToElement();
+ }
+ return 0;
+}
+
+TiXmlElement* TiXmlNode::FirstChildElement()
+{
+ TiXmlNode* node;
+
+ for ( node = FirstChild();
+ node;
+ node = node->NextSibling() )
+ {
+ if ( node->ToElement() )
+ return node->ToElement();
+ }
+ return 0;
+}
+
+const TiXmlElement* TiXmlNode::FirstChildElement( const char * _value ) const
+{
+ const TiXmlNode* node;
+
+ for ( node = FirstChild( _value );
+ node;
+ node = node->NextSibling( _value ) )
+ {
+ if ( node->ToElement() )
+ return node->ToElement();
+ }
+ return 0;
+}
+
+TiXmlElement* TiXmlNode::FirstChildElement( const char * _value )
+{
+ TiXmlNode* node;
+
+ for ( node = FirstChild( _value );
+ node;
+ node = node->NextSibling( _value ) )
+ {
+ if ( node->ToElement() )
+ return node->ToElement();
+ }
+ return 0;
+}
+
+const TiXmlElement* TiXmlNode::NextSiblingElement() const
+{
+ const TiXmlNode* node;
+
+ for ( node = NextSibling();
+ node;
+ node = node->NextSibling() )
+ {
+ if ( node->ToElement() )
+ return node->ToElement();
+ }
+ return 0;
+}
+
+TiXmlElement* TiXmlNode::NextSiblingElement()
+{
+ TiXmlNode* node;
+
+ for ( node = NextSibling();
+ node;
+ node = node->NextSibling() )
+ {
+ if ( node->ToElement() )
+ return node->ToElement();
+ }
+ return 0;
+}
+
+const TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value ) const
+{
+ const TiXmlNode* node;
+
+ for ( node = NextSibling( _value );
+ node;
+ node = node->NextSibling( _value ) )
+ {
+ if ( node->ToElement() )
+ return node->ToElement();
+ }
+ return 0;
+}
+
+TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value )
+{
+ TiXmlNode* node;
+
+ for ( node = NextSibling( _value );
+ node;
+ node = node->NextSibling( _value ) )
+ {
+ if ( node->ToElement() )
+ return node->ToElement();
+ }
+ return 0;
+}
+
+
+const TiXmlDocument* TiXmlNode::GetDocument() const
+{
+ const TiXmlNode* node;
+
+ for( node = this; node; node = node->parent )
+ {
+ if ( node->ToDocument() )
+ return node->ToDocument();
+ }
+ return 0;
+}
+
+TiXmlDocument* TiXmlNode::GetDocument()
+{
+ TiXmlNode* node;
+
+ for( node = this; node; node = node->parent )
+ {
+ if ( node->ToDocument() )
+ return node->ToDocument();
+ }
+ return 0;
+}
+
+TiXmlElement::TiXmlElement (const char * _value)
+ : TiXmlNode( TiXmlNode::ELEMENT )
+{
+ firstChild = lastChild = 0;
+ value = _value;
+}
+
+
+#ifdef TIXML_USE_STL
+TiXmlElement::TiXmlElement( const std::string& _value )
+ : TiXmlNode( TiXmlNode::ELEMENT )
+{
+ firstChild = lastChild = 0;
+ value = _value;
+}
+#endif
+
+
+TiXmlElement::TiXmlElement( const TiXmlElement& copy)
+ : TiXmlNode( TiXmlNode::ELEMENT )
+{
+ firstChild = lastChild = 0;
+ copy.CopyTo( this );
+}
+
+
+void TiXmlElement::operator=( const TiXmlElement& base )
+{
+ ClearThis();
+ base.CopyTo( this );
+}
+
+
+TiXmlElement::~TiXmlElement()
+{
+ ClearThis();
+}
+
+
+void TiXmlElement::ClearThis()
+{
+ Clear();
+ while( attributeSet.First() )
+ {
+ TiXmlAttribute* node = attributeSet.First();
+ attributeSet.Remove( node );
+ delete node;
+ }
+}
+
+
+const char * TiXmlElement::Attribute( const char * name ) const
+{
+ const TiXmlAttribute* node = attributeSet.Find( name );
+
+ if ( node )
+ return node->Value();
+
+ return 0;
+}
+
+
+const char * TiXmlElement::Attribute( const char * name, int* i ) const
+{
+ const char * s = Attribute( name );
+ if ( i )
+ {
+ if ( s )
+ *i = atoi( s );
+ else
+ *i = 0;
+ }
+ return s;
+}
+
+
+const char * TiXmlElement::Attribute( const char * name, double* d ) const
+{
+ const char * s = Attribute( name );
+ if ( d )
+ {
+ if ( s )
+ *d = atof( s );
+ else
+ *d = 0;
+ }
+ return s;
+}
+
+
+int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const
+{
+ const TiXmlAttribute* node = attributeSet.Find( name );
+ if ( !node )
+ return TIXML_NO_ATTRIBUTE;
+
+ return node->QueryIntValue( ival );
+}
+
+
+int TiXmlElement::QueryDoubleAttribute( const char* name, double* dval ) const
+{
+ const TiXmlAttribute* node = attributeSet.Find( name );
+ if ( !node )
+ return TIXML_NO_ATTRIBUTE;
+
+ return node->QueryDoubleValue( dval );
+}
+
+
+void TiXmlElement::SetAttribute( const char * name, int val )
+{
+ char buf[64];
+ sprintf( buf, "%d", val );
+ SetAttribute( name, buf );
+}
+
+
+void TiXmlElement::SetDoubleAttribute( const char * name, double val )
+{
+ char buf[256];
+ sprintf( buf, "%f", val );
+ SetAttribute( name, buf );
+}
+
+
+void TiXmlElement::SetAttribute( const char * name, const char * _value )
+{
+ TiXmlAttribute* node = attributeSet.Find( name );
+ if ( node )
+ {
+ node->SetValue( _value );
+ return;
+ }
+
+ TiXmlAttribute* attrib = new TiXmlAttribute( name, _value );
+ if ( attrib )
+ {
+ attributeSet.Add( attrib );
+ }
+ else
+ {
+ TiXmlDocument* document = GetDocument();
+ if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
+ }
+}
+
+void TiXmlElement::Print( FILE* cfile, int depth ) const
+{
+ int i;
+ for ( i=0; i<depth; i++ )
+ {
+ fprintf( cfile, " " );
+ }
+
+ fprintf( cfile, "<%s", value.c_str() );
+
+ const TiXmlAttribute* attrib;
+ for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
+ {
+ fprintf( cfile, " " );
+ attrib->Print( cfile, depth );
+ }
+
+ // There are 3 different formatting approaches:
+ // 1) An element without children is printed as a <foo /> node
+ // 2) An element with only a text child is printed as <foo> text </foo>
+ // 3) An element with children is printed on multiple lines.
+ TiXmlNode* node;
+ if ( !firstChild )
+ {
+ fprintf( cfile, " />" );
+ }
+ else if ( firstChild == lastChild && firstChild->ToText() )
+ {
+ fprintf( cfile, ">" );
+ firstChild->Print( cfile, depth + 1 );
+ fprintf( cfile, "</%s>", value.c_str() );
+ }
+ else
+ {
+ fprintf( cfile, ">" );
+
+ for ( node = firstChild; node; node=node->NextSibling() )
+ {
+ if ( !node->ToText() )
+ {
+ fprintf( cfile, "\n" );
+ }
+ node->Print( cfile, depth+1 );
+ }
+ fprintf( cfile, "\n" );
+ for( i=0; i<depth; ++i )
+ fprintf( cfile, " " );
+ fprintf( cfile, "</%s>", value.c_str() );
+ }
+}
+
+void TiXmlElement::StreamOut( TIXML_OSTREAM * stream ) const
+{
+ (*stream) << "<" << value;
+
+ const TiXmlAttribute* attrib;
+ for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
+ {
+ (*stream) << " ";
+ attrib->StreamOut( stream );
+ }
+
+ // If this node has children, give it a closing tag. Else
+ // make it an empty tag.
+ TiXmlNode* node;
+ if ( firstChild )
+ {
+ (*stream) << ">";
+
+ for ( node = firstChild; node; node=node->NextSibling() )
+ {
+ node->StreamOut( stream );
+ }
+ (*stream) << "</" << value << ">";
+ }
+ else
+ {
+ (*stream) << " />";
+ }
+}
+
+
+void TiXmlElement::CopyTo( TiXmlElement* target ) const
+{
+ // superclass:
+ TiXmlNode::CopyTo( target );
+
+ // Element class:
+ // Clone the attributes, then clone the children.
+ const TiXmlAttribute* attribute = 0;
+ for( attribute = attributeSet.First();
+ attribute;
+ attribute = attribute->Next() )
+ {
+ target->SetAttribute( attribute->Name(), attribute->Value() );
+ }
+
+ TiXmlNode* node = 0;
+ for ( node = firstChild; node; node = node->NextSibling() )
+ {
+ target->LinkEndChild( node->Clone() );
+ }
+}
+
+
+TiXmlNode* TiXmlElement::Clone() const
+{
+ TiXmlElement* clone = new TiXmlElement( Value() );
+ if ( !clone )
+ return 0;
+
+ CopyTo( clone );
+ return clone;
+}
+
+
+TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+ tabsize = 4;
+ ClearError();
+}
+
+TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+ tabsize = 4;
+ value = documentName;
+ ClearError();
+}
+
+
+#ifdef TIXML_USE_STL
+TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+ tabsize = 4;
+ value = documentName;
+ ClearError();
+}
+#endif
+
+
+TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+ copy.CopyTo( this );
+}
+
+
+void TiXmlDocument::operator=( const TiXmlDocument& copy )
+{
+ Clear();
+ copy.CopyTo( this );
+}
+
+
+bool TiXmlDocument::LoadFile( TiXmlEncoding encoding )
+{
+ // See STL_STRING_BUG below.
+ StringToBuffer buf( value );
+
+ if ( buf.buffer && LoadFile( buf.buffer, encoding ) )
+ return true;
+
+ return false;
+}
+
+
+bool TiXmlDocument::SaveFile() const
+{
+ // See STL_STRING_BUG below.
+ StringToBuffer buf( value );
+
+ if ( buf.buffer && SaveFile( buf.buffer ) )
+ return true;
+
+ return false;
+}
+
+bool TiXmlDocument::LoadFile( const char* filename, TiXmlEncoding encoding )
+{
+ // Delete the existing data:
+ Clear();
+ location.Clear();
+
+ // There was a really terrifying little bug here. The code:
+ // value = filename
+ // in the STL case, cause the assignment method of the std::string to
+ // be called. What is strange, is that the std::string had the same
+ // address as it's c_str() method, and so bad things happen. Looks
+ // like a bug in the Microsoft STL implementation.
+ // See STL_STRING_BUG above.
+ // Fixed with the StringToBuffer class.
+ value = filename;
+
+ FILE* file = fopen( value.c_str (), "r" );
+
+ if ( file )
+ {
+ // Get the file size, so we can pre-allocate the string. HUGE speed impact.
+ long length = 0;
+ fseek( file, 0, SEEK_END );
+ length = ftell( file );
+ fseek( file, 0, SEEK_SET );
+
+ // Strange case, but good to handle up front.
+ if ( length == 0 )
+ {
+ fclose( file );
+ return false;
+ }
+
+ // If we have a file, assume it is all one big XML file, and read it in.
+ // The document parser may decide the document ends sooner than the entire file, however.
+ TIXML_STRING data;
+ data.reserve( length );
+
+ const int BUF_SIZE = 2048;
+ char buf[BUF_SIZE];
+
+ while( fgets( buf, BUF_SIZE, file ) )
+ {
+ data += buf;
+ }
+ fclose( file );
+
+ Parse( data.c_str(), 0, encoding );
+
+ if ( Error() )
+ return false;
+ else
+ return true;
+ }
+ SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return false;
+}
+
+bool TiXmlDocument::SaveFile( const char * filename ) const
+{
+ // The old c stuff lives on...
+ FILE* fp = fopen( filename, "w" );
+ if ( fp )
+ {
+ Print( fp, 0 );
+ fclose( fp );
+ return true;
+ }
+ return false;
+}
+
+
+void TiXmlDocument::CopyTo( TiXmlDocument* target ) const
+{
+ TiXmlNode::CopyTo( target );
+
+ target->error = error;
+ target->errorDesc = errorDesc.c_str ();
+
+ TiXmlNode* node = 0;
+ for ( node = firstChild; node; node = node->NextSibling() )
+ {
+ target->LinkEndChild( node->Clone() );
+ }
+}
+
+
+TiXmlNode* TiXmlDocument::Clone() const
+{
+ TiXmlDocument* clone = new TiXmlDocument();
+ if ( !clone )
+ return 0;
+
+ CopyTo( clone );
+ return clone;
+}
+
+
+void TiXmlDocument::Print( FILE* cfile, int depth ) const
+{
+ const TiXmlNode* node;
+ for ( node=FirstChild(); node; node=node->NextSibling() )
+ {
+ node->Print( cfile, depth );
+ fprintf( cfile, "\n" );
+ }
+}
+
+void TiXmlDocument::StreamOut( TIXML_OSTREAM * out ) const
+{
+ const TiXmlNode* node;
+ for ( node=FirstChild(); node; node=node->NextSibling() )
+ {
+ node->StreamOut( out );
+
+ // Special rule for streams: stop after the root element.
+ // The stream in code will only read one element, so don't
+ // write more than one.
+ if ( node->ToElement() )
+ break;
+ }
+}
+
+
+const TiXmlAttribute* TiXmlAttribute::Next() const
+{
+ // We are using knowledge of the sentinel. The sentinel
+ // have a value or name.
+ if ( next->value.empty() && next->name.empty() )
+ return 0;
+ return next;
+}
+
+TiXmlAttribute* TiXmlAttribute::Next()
+{
+ // We are using knowledge of the sentinel. The sentinel
+ // have a value or name.
+ if ( next->value.empty() && next->name.empty() )
+ return 0;
+ return next;
+}
+
+const TiXmlAttribute* TiXmlAttribute::Previous() const
+{
+ // We are using knowledge of the sentinel. The sentinel
+ // have a value or name.
+ if ( prev->value.empty() && prev->name.empty() )
+ return 0;
+ return prev;
+}
+
+TiXmlAttribute* TiXmlAttribute::Previous()
+{
+ // We are using knowledge of the sentinel. The sentinel
+ // have a value or name.
+ if ( prev->value.empty() && prev->name.empty() )
+ return 0;
+ return prev;
+}
+
+void TiXmlAttribute::Print( FILE* cfile, int /*depth*/ ) const
+{
+ TIXML_STRING n, v;
+
+ PutString( name, &n );
+ PutString( value, &v );
+
+ if (value.find ('\"') == TIXML_STRING::npos)
+ fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() );
+ else
+ fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() );
+}
+
+
+void TiXmlAttribute::StreamOut( TIXML_OSTREAM * stream ) const
+{
+ if (value.find( '\"' ) != TIXML_STRING::npos)
+ {
+ PutString( name, stream );
+ (*stream) << "=" << "'";
+ PutString( value, stream );
+ (*stream) << "'";
+ }
+ else
+ {
+ PutString( name, stream );
+ (*stream) << "=" << "\"";
+ PutString( value, stream );
+ (*stream) << "\"";
+ }
+}
+
+int TiXmlAttribute::QueryIntValue( int* ival ) const
+{
+ if ( sscanf( value.c_str(), "%d", ival ) == 1 )
+ return TIXML_SUCCESS;
+ return TIXML_WRONG_TYPE;
+}
+
+int TiXmlAttribute::QueryDoubleValue( double* dval ) const
+{
+ if ( sscanf( value.c_str(), "%lf", dval ) == 1 )
+ return TIXML_SUCCESS;
+ return TIXML_WRONG_TYPE;
+}
+
+void TiXmlAttribute::SetIntValue( int _value )
+{
+ char buf [64];
+ sprintf (buf, "%d", _value);
+ SetValue (buf);
+}
+
+void TiXmlAttribute::SetDoubleValue( double _value )
+{
+ char buf [256];
+ sprintf (buf, "%lf", _value);
+ SetValue (buf);
+}
+
+const int TiXmlAttribute::IntValue() const
+{
+ return atoi (value.c_str ());
+}
+
+const double TiXmlAttribute::DoubleValue() const
+{
+ return atof (value.c_str ());
+}
+
+
+TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::COMMENT )
+{
+ copy.CopyTo( this );
+}
+
+
+void TiXmlComment::operator=( const TiXmlComment& base )
+{
+ Clear();
+ base.CopyTo( this );
+}
+
+
+void TiXmlComment::Print( FILE* cfile, int depth ) const
+{
+ for ( int i=0; i<depth; i++ )
+ {
+ fputs( " ", cfile );
+ }
+ fprintf( cfile, "<!--%s-->", value.c_str() );
+}
+
+void TiXmlComment::StreamOut( TIXML_OSTREAM * stream ) const
+{
+ (*stream) << "<!--";
+ //PutString( value, stream );
+ (*stream) << value;
+ (*stream) << "-->";
+}
+
+
+void TiXmlComment::CopyTo( TiXmlComment* target ) const
+{
+ TiXmlNode::CopyTo( target );
+}
+
+
+TiXmlNode* TiXmlComment::Clone() const
+{
+ TiXmlComment* clone = new TiXmlComment();
+
+ if ( !clone )
+ return 0;
+
+ CopyTo( clone );
+ return clone;
+}
+
+
+void TiXmlText::Print( FILE* cfile, int /*depth*/ ) const
+{
+ TIXML_STRING buffer;
+ PutString( value, &buffer );
+ fprintf( cfile, "%s", buffer.c_str() );
+}
+
+
+void TiXmlText::StreamOut( TIXML_OSTREAM * stream ) const
+{
+ PutString( value, stream );
+}
+
+
+void TiXmlText::CopyTo( TiXmlText* target ) const
+{
+ TiXmlNode::CopyTo( target );
+}
+
+
+TiXmlNode* TiXmlText::Clone() const
+{
+ TiXmlText* clone = 0;
+ clone = new TiXmlText( "" );
+
+ if ( !clone )
+ return 0;
+
+ CopyTo( clone );
+ return clone;
+}
+
+
+TiXmlDeclaration::TiXmlDeclaration( const char * _version,
+ const char * _encoding,
+ const char * _standalone )
+ : TiXmlNode( TiXmlNode::DECLARATION )
+{
+ version = _version;
+ encoding = _encoding;
+ standalone = _standalone;
+}
+
+
+#ifdef TIXML_USE_STL
+TiXmlDeclaration::TiXmlDeclaration( const std::string& _version,
+ const std::string& _encoding,
+ const std::string& _standalone )
+ : TiXmlNode( TiXmlNode::DECLARATION )
+{
+ version = _version;
+ encoding = _encoding;
+ standalone = _standalone;
+}
+#endif
+
+
+TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy )
+ : TiXmlNode( TiXmlNode::DECLARATION )
+{
+ copy.CopyTo( this );
+}
+
+
+void TiXmlDeclaration::operator=( const TiXmlDeclaration& copy )
+{
+ Clear();
+ copy.CopyTo( this );
+}
+
+
+void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/ ) const
+{
+ fprintf (cfile, "<?xml ");
+
+ if ( !version.empty() )
+ fprintf (cfile, "version=\"%s\" ", version.c_str ());
+ if ( !encoding.empty() )
+ fprintf (cfile, "encoding=\"%s\" ", encoding.c_str ());
+ if ( !standalone.empty() )
+ fprintf (cfile, "standalone=\"%s\" ", standalone.c_str ());
+ fprintf (cfile, "?>");
+}
+
+void TiXmlDeclaration::StreamOut( TIXML_OSTREAM * stream ) const
+{
+ (*stream) << "<?xml ";
+
+ if ( !version.empty() )
+ {
+ (*stream) << "version=\"";
+ PutString( version, stream );
+ (*stream) << "\" ";
+ }
+ if ( !encoding.empty() )
+ {
+ (*stream) << "encoding=\"";
+ PutString( encoding, stream );
+ (*stream ) << "\" ";
+ }
+ if ( !standalone.empty() )
+ {
+ (*stream) << "standalone=\"";
+ PutString( standalone, stream );
+ (*stream) << "\" ";
+ }
+ (*stream) << "?>";
+}
+
+
+void TiXmlDeclaration::CopyTo( TiXmlDeclaration* target ) const
+{
+ TiXmlNode::CopyTo( target );
+
+ target->version = version;
+ target->encoding = encoding;
+ target->standalone = standalone;
+}
+
+
+TiXmlNode* TiXmlDeclaration::Clone() const
+{
+ TiXmlDeclaration* clone = new TiXmlDeclaration();
+
+ if ( !clone )
+ return 0;
+
+ CopyTo( clone );
+ return clone;
+}
+
+
+void TiXmlUnknown::Print( FILE* cfile, int depth ) const
+{
+ for ( int i=0; i<depth; i++ )
+ fprintf( cfile, " " );
+ fprintf( cfile, "<%s>", value.c_str() );
+}
+
+
+void TiXmlUnknown::StreamOut( TIXML_OSTREAM * stream ) const
+{
+ (*stream) << "<" << value << ">"; // Don't use entities here! It is unknown.
+}
+
+
+void TiXmlUnknown::CopyTo( TiXmlUnknown* target ) const
+{
+ TiXmlNode::CopyTo( target );
+}
+
+
+TiXmlNode* TiXmlUnknown::Clone() const
+{
+ TiXmlUnknown* clone = new TiXmlUnknown();
+
+ if ( !clone )
+ return 0;
+
+ CopyTo( clone );
+ return clone;
+}
+
+
+TiXmlAttributeSet::TiXmlAttributeSet()
+{
+ sentinel.next = &sentinel;
+ sentinel.prev = &sentinel;
+}
+
+
+TiXmlAttributeSet::~TiXmlAttributeSet()
+{
+ assert( sentinel.next == &sentinel );
+ assert( sentinel.prev == &sentinel );
+}
+
+
+void TiXmlAttributeSet::Add( TiXmlAttribute* addMe )
+{
+ assert( !Find( addMe->Name() ) ); // Shouldn't be multiply adding to the set.
+
+ addMe->next = &sentinel;
+ addMe->prev = sentinel.prev;
+
+ sentinel.prev->next = addMe;
+ sentinel.prev = addMe;
+}
+
+void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe )
+{
+ TiXmlAttribute* node;
+
+ for( node = sentinel.next; node != &sentinel; node = node->next )
+ {
+ if ( node == removeMe )
+ {
+ node->prev->next = node->next;
+ node->next->prev = node->prev;
+ node->next = 0;
+ node->prev = 0;
+ return;
+ }
+ }
+ assert( 0 ); // we tried to remove a non-linked attribute.
+}
+
+const TiXmlAttribute* TiXmlAttributeSet::Find( const char * name ) const
+{
+ const TiXmlAttribute* node;
+
+ for( node = sentinel.next; node != &sentinel; node = node->next )
+ {
+ if ( node->name == name )
+ return node;
+ }
+ return 0;
+}
+
+TiXmlAttribute* TiXmlAttributeSet::Find( const char * name )
+{
+ TiXmlAttribute* node;
+
+ for( node = sentinel.next; node != &sentinel; node = node->next )
+ {
+ if ( node->name == name )
+ return node;
+ }
+ return 0;
+}
+
+#ifdef TIXML_USE_STL
+TIXML_ISTREAM & operator >> (TIXML_ISTREAM & in, TiXmlNode & base)
+{
+ TIXML_STRING tag;
+ tag.reserve( 8 * 1000 );
+ base.StreamIn( &in, &tag );
+
+ base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING );
+ return in;
+}
+#endif
+
+
+TIXML_OSTREAM & operator<< (TIXML_OSTREAM & out, const TiXmlNode & base)
+{
+ base.StreamOut (& out);
+ return out;
+}
+
+
+#ifdef TIXML_USE_STL
+std::string & operator<< (std::string& out, const TiXmlNode& base )
+{
+ std::ostringstream os_stream( std::ostringstream::out );
+ base.StreamOut( &os_stream );
+
+ out.append( os_stream.str() );
+ return out;
+}
+#endif
+
+
+TiXmlHandle TiXmlHandle::FirstChild() const
+{
+ if ( node )
+ {
+ TiXmlNode* child = node->FirstChild();
+ if ( child )
+ return TiXmlHandle( child );
+ }
+ return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::FirstChild( const char * value ) const
+{
+ if ( node )
+ {
+ TiXmlNode* child = node->FirstChild( value );
+ if ( child )
+ return TiXmlHandle( child );
+ }
+ return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::FirstChildElement() const
+{
+ if ( node )
+ {
+ TiXmlElement* child = node->FirstChildElement();
+ if ( child )
+ return TiXmlHandle( child );
+ }
+ return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::FirstChildElement( const char * value ) const
+{
+ if ( node )
+ {
+ TiXmlElement* child = node->FirstChildElement( value );
+ if ( child )
+ return TiXmlHandle( child );
+ }
+ return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::Child( int count ) const
+{
+ if ( node )
+ {
+ int i;
+ TiXmlNode* child = node->FirstChild();
+ for ( i=0;
+ child && i<count;
+ child = child->NextSibling(), ++i )
+ {
+ // nothing
+ }
+ if ( child )
+ return TiXmlHandle( child );
+ }
+ return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const
+{
+ if ( node )
+ {
+ int i;
+ TiXmlNode* child = node->FirstChild( value );
+ for ( i=0;
+ child && i<count;
+ child = child->NextSibling( value ), ++i )
+ {
+ // nothing
+ }
+ if ( child )
+ return TiXmlHandle( child );
+ }
+ return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::ChildElement( int count ) const
+{
+ if ( node )
+ {
+ int i;
+ TiXmlElement* child = node->FirstChildElement();
+ for ( i=0;
+ child && i<count;
+ child = child->NextSiblingElement(), ++i )
+ {
+ // nothing
+ }
+ if ( child )
+ return TiXmlHandle( child );
+ }
+ return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const
+{
+ if ( node )
+ {
+ int i;
+ TiXmlElement* child = node->FirstChildElement( value );
+ for ( i=0;
+ child && i<count;
+ child = child->NextSiblingElement( value ), ++i )
+ {
+ // nothing
+ }
+ if ( child )
+ return TiXmlHandle( child );
+ }
+ return TiXmlHandle( 0 );
+}
diff --git a/PDContainer/tinyxml/tinyxml.h b/PDContainer/tinyxml/tinyxml.h
new file mode 100755
index 0000000..3b50268
--- /dev/null
+++ b/PDContainer/tinyxml/tinyxml.h
@@ -0,0 +1,1426 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+
+#ifndef TINYXML_INCLUDED
+#define TINYXML_INCLUDED
+
+#ifdef _MSC_VER
+#pragma warning( disable : 4530 )
+#pragma warning( disable : 4786 )
+#endif
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+// Help out windows:
+#if defined( _DEBUG ) && !defined( DEBUG )
+#define DEBUG
+#endif
+
+#if defined( DEBUG ) && defined( _MSC_VER )
+#include <windows.h>
+#define TIXML_LOG OutputDebugString
+#else
+#define TIXML_LOG printf
+#endif
+
+#ifdef TIXML_USE_STL
+ #include <string>
+ #include <iostream>
+ #define TIXML_STRING std::string
+ #define TIXML_ISTREAM std::istream
+ #define TIXML_OSTREAM std::ostream
+#else
+ #include "tinystr.h"
+ #define TIXML_STRING TiXmlString
+ #define TIXML_OSTREAM TiXmlOutStream
+#endif
+
+class TiXmlDocument;
+class TiXmlElement;
+class TiXmlComment;
+class TiXmlUnknown;
+class TiXmlAttribute;
+class TiXmlText;
+class TiXmlDeclaration;
+class TiXmlParsingData;
+
+const int TIXML_MAJOR_VERSION = 2;
+const int TIXML_MINOR_VERSION = 3;
+const int TIXML_PATCH_VERSION = 4;
+
+/* Internal structure for tracking location of items
+ in the XML file.
+*/
+struct TiXmlCursor
+{
+ TiXmlCursor() { Clear(); }
+ void Clear() { row = col = -1; }
+
+ int row; // 0 based.
+ int col; // 0 based.
+};
+
+
+// Only used by Attribute::Query functions
+enum
+{
+ TIXML_SUCCESS,
+ TIXML_NO_ATTRIBUTE,
+ TIXML_WRONG_TYPE
+};
+
+
+// Used by the parsing routines.
+enum TiXmlEncoding
+{
+ TIXML_ENCODING_UNKNOWN,
+ TIXML_ENCODING_UTF8,
+ TIXML_ENCODING_LEGACY
+};
+
+const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
+
+/** TiXmlBase is a base class for every class in TinyXml.
+ It does little except to establish that TinyXml classes
+ can be printed and provide some utility functions.
+
+ In XML, the document and elements can contain
+ other elements and other types of nodes.
+
+ @verbatim
+ A Document can contain: Element (container or leaf)
+ Comment (leaf)
+ Unknown (leaf)
+ Declaration( leaf )
+
+ An Element can contain: Element (container or leaf)
+ Text (leaf)
+ Attributes (not on tree)
+ Comment (leaf)
+ Unknown (leaf)
+
+ A Decleration contains: Attributes (not on tree)
+ @endverbatim
+*/
+class TiXmlBase
+{
+ friend class TiXmlNode;
+ friend class TiXmlElement;
+ friend class TiXmlDocument;
+
+public:
+ TiXmlBase() : userData(0) {}
+ virtual ~TiXmlBase() {}
+
+ /** All TinyXml classes can print themselves to a filestream.
+ This is a formatted print, and will insert tabs and newlines.
+
+ (For an unformatted stream, use the << operator.)
+ */
+ virtual void Print( FILE* cfile, int depth ) const = 0;
+
+ /** The world does not agree on whether white space should be kept or
+ not. In order to make everyone happy, these global, static functions
+ are provided to set whether or not TinyXml will condense all white space
+ into a single space or not. The default is to condense. Note changing this
+ values is not thread safe.
+ */
+ static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; }
+
+ /// Return the current white space setting.
+ static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; }
+
+ /** Return the position, in the original source file, of this node or attribute.
+ The row and column are 1-based. (That is the first row and first column is
+ 1,1). If the returns values are 0 or less, then the parser does not have
+ a row and column value.
+
+ Generally, the row and column value will be set when the TiXmlDocument::Load(),
+ TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set
+ when the DOM was created from operator>>.
+
+ The values reflect the initial load. Once the DOM is modified programmatically
+ (by adding or changing nodes and attributes) the new values will NOT update to
+ reflect changes in the document.
+
+ There is a minor performance cost to computing the row and column. Computation
+ can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value.
+
+ @sa TiXmlDocument::SetTabSize()
+ */
+ int Row() const { return location.row + 1; }
+ int Column() const { return location.col + 1; } ///< See Row()
+
+ void SetUserData( void* user ) { userData = user; }
+ void* GetUserData() { return userData; }
+
+ // Table that returs, for a given lead byte, the total number of bytes
+ // in the UTF-8 sequence.
+ static const int utf8ByteTable[256];
+
+ virtual const char* Parse( const char* p,
+ TiXmlParsingData* data,
+ TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
+
+ enum
+ {
+ TIXML_NO_ERROR = 0,
+ TIXML_ERROR,
+ TIXML_ERROR_OPENING_FILE,
+ TIXML_ERROR_OUT_OF_MEMORY,
+ TIXML_ERROR_PARSING_ELEMENT,
+ TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
+ TIXML_ERROR_READING_ELEMENT_VALUE,
+ TIXML_ERROR_READING_ATTRIBUTES,
+ TIXML_ERROR_PARSING_EMPTY,
+ TIXML_ERROR_READING_END_TAG,
+ TIXML_ERROR_PARSING_UNKNOWN,
+ TIXML_ERROR_PARSING_COMMENT,
+ TIXML_ERROR_PARSING_DECLARATION,
+ TIXML_ERROR_DOCUMENT_EMPTY,
+ TIXML_ERROR_EMBEDDED_NULL,
+
+ TIXML_ERROR_STRING_COUNT
+ };
+
+protected:
+
+ // See STL_STRING_BUG
+ // Utility class to overcome a bug.
+ class StringToBuffer
+ {
+ public:
+ StringToBuffer( const TIXML_STRING& str );
+ ~StringToBuffer();
+ char* buffer;
+ };
+
+ static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
+ inline static bool IsWhiteSpace( char c )
+ {
+ return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
+ }
+
+ virtual void StreamOut (TIXML_OSTREAM *) const = 0;
+
+ #ifdef TIXML_USE_STL
+ static bool StreamWhiteSpace( TIXML_ISTREAM * in, TIXML_STRING * tag );
+ static bool StreamTo( TIXML_ISTREAM * in, int character, TIXML_STRING * tag );
+ #endif
+
+ /* Reads an XML name into the string provided. Returns
+ a pointer just past the last character of the name,
+ or 0 if the function has an error.
+ */
+ static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding );
+
+ /* Reads text. Returns a pointer past the given end tag.
+ Wickedly complex options, but it keeps the (sensitive) code in one place.
+ */
+ static const char* ReadText( const char* in, // where to start
+ TIXML_STRING* text, // the string read
+ bool ignoreWhiteSpace, // whether to keep the white space
+ const char* endTag, // what ends this text
+ bool ignoreCase, // whether to ignore case in the end tag
+ TiXmlEncoding encoding ); // the current encoding
+
+ // If an entity has been found, transform it into a character.
+ static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding );
+
+ // Get a character, while interpreting entities.
+ // The length can be from 0 to 4 bytes.
+ inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding )
+ {
+ assert( p );
+ if ( encoding == TIXML_ENCODING_UTF8 )
+ {
+ *length = utf8ByteTable[ *((unsigned char*)p) ];
+ assert( *length >= 0 && *length < 5 );
+ }
+ else
+ {
+ *length = 1;
+ }
+
+ if ( *length == 1 )
+ {
+ if ( *p == '&' )
+ return GetEntity( p, _value, length, encoding );
+ *_value = *p;
+ return p+1;
+ }
+ else if ( *length )
+ {
+ strncpy( _value, p, *length );
+ return p + (*length);
+ }
+ else
+ {
+ // Not valid text.
+ return 0;
+ }
+ }
+
+ // Puts a string to a stream, expanding entities as it goes.
+ // Note this should not contian the '<', '>', etc, or they will be transformed into entities!
+ static void PutString( const TIXML_STRING& str, TIXML_OSTREAM* out );
+
+ static void PutString( const TIXML_STRING& str, TIXML_STRING* out );
+
+ // Return true if the next characters in the stream are any of the endTag sequences.
+ // Ignore case only works for english, and should only be relied on when comparing
+ // to Engilish words: StringEqual( p, "version", true ) is fine.
+ static bool StringEqual( const char* p,
+ const char* endTag,
+ bool ignoreCase,
+ TiXmlEncoding encoding );
+
+ static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
+
+ TiXmlCursor location;
+
+ /// Field containing a generic user pointer
+ void* userData;
+
+ // None of these methods are reliable for any language except English.
+ // Good for approximation, not great for accuracy.
+ static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
+ static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding );
+ inline static int ToLower( int v, TiXmlEncoding encoding )
+ {
+ if ( encoding == TIXML_ENCODING_UTF8 )
+ {
+ if ( v < 128 ) return tolower( v );
+ return v;
+ }
+ else
+ {
+ return tolower( v );
+ }
+ }
+ static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );
+
+private:
+ TiXmlBase( const TiXmlBase& ); // not implemented.
+ void operator=( const TiXmlBase& base ); // not allowed.
+
+ struct Entity
+ {
+ const char* str;
+ unsigned int strLength;
+ char chr;
+ };
+ enum
+ {
+ NUM_ENTITY = 5,
+ MAX_ENTITY_LENGTH = 6
+
+ };
+ static Entity entity[ NUM_ENTITY ];
+ static bool condenseWhiteSpace;
+};
+
+
+/** The parent class for everything in the Document Object Model.
+ (Except for attributes).
+ Nodes have siblings, a parent, and children. A node can be
+ in a document, or stand on its own. The type of a TiXmlNode
+ can be queried, and it can be cast to its more defined type.
+*/
+class TiXmlNode : public TiXmlBase
+{
+ friend class TiXmlDocument;
+ friend class TiXmlElement;
+
+public:
+ #ifdef TIXML_USE_STL
+
+ /** An input stream operator, for every class. Tolerant of newlines and
+ formatting, but doesn't expect them.
+ */
+ friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
+
+ /** An output stream operator, for every class. Note that this outputs
+ without any newlines or formatting, as opposed to Print(), which
+ includes tabs and new lines.
+
+ The operator<< and operator>> are not completely symmetric. Writing
+ a node to a stream is very well defined. You'll get a nice stream
+ of output, without any extra whitespace or newlines.
+
+ But reading is not as well defined. (As it always is.) If you create
+ a TiXmlElement (for example) and read that from an input stream,
+ the text needs to define an element or junk will result. This is
+ true of all input streams, but it's worth keeping in mind.
+
+ A TiXmlDocument will read nodes until it reads a root element, and
+ all the children of that root element.
+ */
+ friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
+
+ /// Appends the XML node or attribute to a std::string.
+ friend std::string& operator<< (std::string& out, const TiXmlNode& base );
+
+ #else
+ // Used internally, not part of the public API.
+ friend TIXML_OSTREAM& operator<< (TIXML_OSTREAM& out, const TiXmlNode& base);
+ #endif
+
+ /** The types of XML nodes supported by TinyXml. (All the
+ unsupported types are picked up by UNKNOWN.)
+ */
+ enum NodeType
+ {
+ DOCUMENT,
+ ELEMENT,
+ COMMENT,
+ UNKNOWN,
+ TEXT,
+ DECLARATION,
+ TYPECOUNT
+ };
+
+ virtual ~TiXmlNode();
+
+ /** The meaning of 'value' changes for the specific type of
+ TiXmlNode.
+ @verbatim
+ Document: filename of the xml file
+ Element: name of the element
+ Comment: the comment text
+ Unknown: the tag contents
+ Text: the text string
+ @endverbatim
+
+ The subclasses will wrap this function.
+ */
+ const char * Value() const { return value.c_str (); }
+
+ /** Changes the value of the node. Defined as:
+ @verbatim
+ Document: filename of the xml file
+ Element: name of the element
+ Comment: the comment text
+ Unknown: the tag contents
+ Text: the text string
+ @endverbatim
+ */
+ void SetValue(const char * _value) { value = _value;}
+
+ #ifdef TIXML_USE_STL
+ /// STL std::string form.
+ void SetValue( const std::string& _value )
+ {
+ StringToBuffer buf( _value );
+ SetValue( buf.buffer ? buf.buffer : "" );
+ }
+ #endif
+
+ /// Delete all the children of this node. Does not affect 'this'.
+ void Clear();
+
+ /// One step up the DOM.
+ TiXmlNode* Parent() { return parent; }
+ const TiXmlNode* Parent() const { return parent; }
+
+ const TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children.
+ TiXmlNode* FirstChild() { return firstChild; }
+ const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found.
+ TiXmlNode* FirstChild( const char * value ); ///< The first child of this node with the matching 'value'. Will be null if none found.
+
+ const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children.
+ TiXmlNode* LastChild() { return lastChild; }
+ const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children.
+ TiXmlNode* LastChild( const char * value );
+
+ #ifdef TIXML_USE_STL
+ const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form.
+ TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< STL std::string form.
+ const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form.
+ TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< STL std::string form.
+ #endif
+
+ /** An alternate way to walk the children of a node.
+ One way to iterate over nodes is:
+ @verbatim
+ for( child = parent->FirstChild(); child; child = child->NextSibling() )
+ @endverbatim
+
+ IterateChildren does the same thing with the syntax:
+ @verbatim
+ child = 0;
+ while( child = parent->IterateChildren( child ) )
+ @endverbatim
+
+ IterateChildren takes the previous child as input and finds
+ the next one. If the previous child is null, it returns the
+ first. IterateChildren will return null when done.
+ */
+ const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const;
+ TiXmlNode* IterateChildren( TiXmlNode* previous );
+
+ /// This flavor of IterateChildren searches for children with a particular 'value'
+ const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const;
+ TiXmlNode* IterateChildren( const char * value, TiXmlNode* previous );
+
+ #ifdef TIXML_USE_STL
+ const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form.
+ TiXmlNode* IterateChildren( const std::string& _value, TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form.
+ #endif
+
+ /** Add a new node related to this. Adds a child past the LastChild.
+ Returns a pointer to the new object or NULL if an error occured.
+ */
+ TiXmlNode* InsertEndChild( const TiXmlNode& addThis );
+
+
+ /** Add a new node related to this. Adds a child past the LastChild.
+
+ NOTE: the node to be added is passed by pointer, and will be
+ henceforth owned (and deleted) by tinyXml. This method is efficient
+ and avoids an extra copy, but should be used with care as it
+ uses a different memory model than the other insert functions.
+
+ @sa InsertEndChild
+ */
+ TiXmlNode* LinkEndChild( TiXmlNode* addThis );
+
+ /** Add a new node related to this. Adds a child before the specified child.
+ Returns a pointer to the new object or NULL if an error occured.
+ */
+ TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis );
+
+ /** Add a new node related to this. Adds a child after the specified child.
+ Returns a pointer to the new object or NULL if an error occured.
+ */
+ TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis );
+
+ /** Replace a child of this node.
+ Returns a pointer to the new object or NULL if an error occured.
+ */
+ TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis );
+
+ /// Delete a child of this node.
+ bool RemoveChild( TiXmlNode* removeThis );
+
+ /// Navigate to a sibling node.
+ const TiXmlNode* PreviousSibling() const { return prev; }
+ TiXmlNode* PreviousSibling() { return prev; }
+
+ /// Navigate to a sibling node.
+ const TiXmlNode* PreviousSibling( const char * ) const;
+ TiXmlNode* PreviousSibling( const char * );
+
+ #ifdef TIXML_USE_STL
+ const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form.
+ TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form.
+ const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form.
+ TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form.
+ #endif
+
+ /// Navigate to a sibling node.
+ const TiXmlNode* NextSibling() const { return next; }
+ TiXmlNode* NextSibling() { return next; }
+
+ /// Navigate to a sibling node with the given 'value'.
+ const TiXmlNode* NextSibling( const char * ) const;
+ TiXmlNode* NextSibling( const char * );
+
+ /** Convenience function to get through elements.
+ Calls NextSibling and ToElement. Will skip all non-Element
+ nodes. Returns 0 if there is not another element.
+ */
+ const TiXmlElement* NextSiblingElement() const;
+ TiXmlElement* NextSiblingElement();
+
+ /** Convenience function to get through elements.
+ Calls NextSibling and ToElement. Will skip all non-Element
+ nodes. Returns 0 if there is not another element.
+ */
+ const TiXmlElement* NextSiblingElement( const char * ) const;
+ TiXmlElement* NextSiblingElement( const char * );
+
+ #ifdef TIXML_USE_STL
+ const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form.
+ TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form.
+ #endif
+
+ /// Convenience function to get through elements.
+ const TiXmlElement* FirstChildElement() const;
+ TiXmlElement* FirstChildElement();
+
+ /// Convenience function to get through elements.
+ const TiXmlElement* FirstChildElement( const char * value ) const;
+ TiXmlElement* FirstChildElement( const char * value );
+
+ #ifdef TIXML_USE_STL
+ const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form.
+ TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form.
+ #endif
+
+ /** Query the type (as an enumerated value, above) of this node.
+ The possible types are: DOCUMENT, ELEMENT, COMMENT,
+ UNKNOWN, TEXT, and DECLARATION.
+ */
+ virtual int Type() const { return type; }
+
+ /** Return a pointer to the Document this node lives in.
+ Returns null if not in a document.
+ */
+ const TiXmlDocument* GetDocument() const;
+ TiXmlDocument* GetDocument();
+
+ /// Returns true if this node has no children.
+ bool NoChildren() const { return !firstChild; }
+
+ const TiXmlDocument* ToDocument() const { return ( this && type == DOCUMENT ) ? (const TiXmlDocument*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+ const TiXmlElement* ToElement() const { return ( this && type == ELEMENT ) ? (const TiXmlElement*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+ const TiXmlComment* ToComment() const { return ( this && type == COMMENT ) ? (const TiXmlComment*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+ const TiXmlUnknown* ToUnknown() const { return ( this && type == UNKNOWN ) ? (const TiXmlUnknown*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+ const TiXmlText* ToText() const { return ( this && type == TEXT ) ? (const TiXmlText*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+ const TiXmlDeclaration* ToDeclaration() const { return ( this && type == DECLARATION ) ? (const TiXmlDeclaration*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+
+ TiXmlDocument* ToDocument() { return ( this && type == DOCUMENT ) ? (TiXmlDocument*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+ TiXmlElement* ToElement() { return ( this && type == ELEMENT ) ? (TiXmlElement*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+ TiXmlComment* ToComment() { return ( this && type == COMMENT ) ? (TiXmlComment*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+ TiXmlUnknown* ToUnknown() { return ( this && type == UNKNOWN ) ? (TiXmlUnknown*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+ TiXmlText* ToText() { return ( this && type == TEXT ) ? (TiXmlText*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+ TiXmlDeclaration* ToDeclaration() { return ( this && type == DECLARATION ) ? (TiXmlDeclaration*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+
+ /** Create an exact duplicate of this node and return it. The memory must be deleted
+ by the caller.
+ */
+ virtual TiXmlNode* Clone() const = 0;
+
+protected:
+ TiXmlNode( NodeType _type );
+
+ // Copy to the allocated object. Shared functionality between Clone, Copy constructor,
+ // and the assignment operator.
+ void CopyTo( TiXmlNode* target ) const;
+
+ #ifdef TIXML_USE_STL
+ // The real work of the input operator.
+ virtual void StreamIn( TIXML_ISTREAM* in, TIXML_STRING* tag ) = 0;
+ #endif
+
+ // Figure out what is at *p, and parse it. Returns null if it is not an xml node.
+ TiXmlNode* Identify( const char* start, TiXmlEncoding encoding );
+
+ // Internal Value function returning a TIXML_STRING
+ const TIXML_STRING& SValue() const { return value ; }
+
+ TiXmlNode* parent;
+ NodeType type;
+
+ TiXmlNode* firstChild;
+ TiXmlNode* lastChild;
+
+ TIXML_STRING value;
+
+ TiXmlNode* prev;
+ TiXmlNode* next;
+
+private:
+ TiXmlNode( const TiXmlNode& ); // not implemented.
+ void operator=( const TiXmlNode& base ); // not allowed.
+};
+
+
+/** An attribute is a name-value pair. Elements have an arbitrary
+ number of attributes, each with a unique name.
+
+ @note The attributes are not TiXmlNodes, since they are not
+ part of the tinyXML document object model. There are other
+ suggested ways to look at this problem.
+*/
+class TiXmlAttribute : public TiXmlBase
+{
+ friend class TiXmlAttributeSet;
+
+public:
+ /// Construct an empty attribute.
+ TiXmlAttribute() : TiXmlBase()
+ {
+ document = 0;
+ prev = next = 0;
+ }
+
+ #ifdef TIXML_USE_STL
+ /// std::string constructor.
+ TiXmlAttribute( const std::string& _name, const std::string& _value )
+ {
+ name = _name;
+ value = _value;
+ document = 0;
+ prev = next = 0;
+ }
+ #endif
+
+ /// Construct an attribute with a name and value.
+ TiXmlAttribute( const char * _name, const char * _value )
+ {
+ name = _name;
+ value = _value;
+ document = 0;
+ prev = next = 0;
+ }
+
+ const char* Name() const { return name.c_str (); } ///< Return the name of this attribute.
+ const char* Value() const { return value.c_str (); } ///< Return the value of this attribute.
+ const int IntValue() const; ///< Return the value of this attribute, converted to an integer.
+ const double DoubleValue() const; ///< Return the value of this attribute, converted to a double.
+
+ /** QueryIntValue examines the value string. It is an alternative to the
+ IntValue() method with richer error checking.
+ If the value is an integer, it is stored in 'value' and
+ the call returns TIXML_SUCCESS. If it is not
+ an integer, it returns TIXML_WRONG_TYPE.
+
+ A specialized but useful call. Note that for success it returns 0,
+ which is the opposite of almost all other TinyXml calls.
+ */
+ int QueryIntValue( int* value ) const;
+ /// QueryDoubleValue examines the value string. See QueryIntValue().
+ int QueryDoubleValue( double* value ) const;
+
+ void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute.
+ void SetValue( const char* _value ) { value = _value; } ///< Set the value.
+
+ void SetIntValue( int value ); ///< Set the value from an integer.
+ void SetDoubleValue( double value ); ///< Set the value from a double.
+
+ #ifdef TIXML_USE_STL
+ /// STL std::string form.
+ void SetName( const std::string& _name )
+ {
+ StringToBuffer buf( _name );
+ SetName ( buf.buffer ? buf.buffer : "error" );
+ }
+ /// STL std::string form.
+ void SetValue( const std::string& _value )
+ {
+ StringToBuffer buf( _value );
+ SetValue( buf.buffer ? buf.buffer : "error" );
+ }
+ #endif
+
+ /// Get the next sibling attribute in the DOM. Returns null at end.
+ const TiXmlAttribute* Next() const;
+ TiXmlAttribute* Next();
+ /// Get the previous sibling attribute in the DOM. Returns null at beginning.
+ const TiXmlAttribute* Previous() const;
+ TiXmlAttribute* Previous();
+
+ bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
+ bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; }
+ bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; }
+
+ /* Attribute parsing starts: first letter of the name
+ returns: the next char after the value end quote
+ */
+ virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
+
+ // Prints this Attribute to a FILE stream.
+ virtual void Print( FILE* cfile, int depth ) const;
+
+ virtual void StreamOut( TIXML_OSTREAM * out ) const;
+ // [internal use]
+ // Set the document pointer so the attribute can report errors.
+ void SetDocument( TiXmlDocument* doc ) { document = doc; }
+
+private:
+ TiXmlAttribute( const TiXmlAttribute& ); // not implemented.
+ void operator=( const TiXmlAttribute& base ); // not allowed.
+
+ TiXmlDocument* document; // A pointer back to a document, for error reporting.
+ TIXML_STRING name;
+ TIXML_STRING value;
+ TiXmlAttribute* prev;
+ TiXmlAttribute* next;
+};
+
+
+/* A class used to manage a group of attributes.
+ It is only used internally, both by the ELEMENT and the DECLARATION.
+
+ The set can be changed transparent to the Element and Declaration
+ classes that use it, but NOT transparent to the Attribute
+ which has to implement a next() and previous() method. Which makes
+ it a bit problematic and prevents the use of STL.
+
+ This version is implemented with circular lists because:
+ - I like circular lists
+ - it demonstrates some independence from the (typical) doubly linked list.
+*/
+class TiXmlAttributeSet
+{
+public:
+ TiXmlAttributeSet();
+ ~TiXmlAttributeSet();
+
+ void Add( TiXmlAttribute* attribute );
+ void Remove( TiXmlAttribute* attribute );
+
+ const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
+ TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
+ const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
+ TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
+
+ const TiXmlAttribute* Find( const char * name ) const;
+ TiXmlAttribute* Find( const char * name );
+
+private:
+ //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element),
+ //*ME: this class must be also use a hidden/disabled copy-constructor !!!
+ TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed
+ void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute)
+
+ TiXmlAttribute sentinel;
+};
+
+
+/** The element is a container class. It has a value, the element name,
+ and can contain other elements, text, comments, and unknowns.
+ Elements also contain an arbitrary number of attributes.
+*/
+class TiXmlElement : public TiXmlNode
+{
+public:
+ /// Construct an element.
+ TiXmlElement (const char * in_value);
+
+ #ifdef TIXML_USE_STL
+ /// std::string constructor.
+ TiXmlElement( const std::string& _value );
+ #endif
+
+ TiXmlElement( const TiXmlElement& );
+
+ void operator=( const TiXmlElement& base );
+
+ virtual ~TiXmlElement();
+
+ /** Given an attribute name, Attribute() returns the value
+ for the attribute of that name, or null if none exists.
+ */
+ const char* Attribute( const char* name ) const;
+
+ /** Given an attribute name, Attribute() returns the value
+ for the attribute of that name, or null if none exists.
+ If the attribute exists and can be converted to an integer,
+ the integer value will be put in the return 'i', if 'i'
+ is non-null.
+ */
+ const char* Attribute( const char* name, int* i ) const;
+
+ /** Given an attribute name, Attribute() returns the value
+ for the attribute of that name, or null if none exists.
+ If the attribute exists and can be converted to an double,
+ the double value will be put in the return 'd', if 'd'
+ is non-null.
+ */
+ const char* Attribute( const char* name, double* d ) const;
+
+ /** QueryIntAttribute examines the attribute - it is an alternative to the
+ Attribute() method with richer error checking.
+ If the attribute is an integer, it is stored in 'value' and
+ the call returns TIXML_SUCCESS. If it is not
+ an integer, it returns TIXML_WRONG_TYPE. If the attribute
+ does not exist, then TIXML_NO_ATTRIBUTE is returned.
+ */
+ int QueryIntAttribute( const char* name, int* value ) const;
+ /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
+ int QueryDoubleAttribute( const char* name, double* value ) const;
+ /// QueryFloatAttribute examines the attribute - see QueryIntAttribute().
+ int QueryDoubleAttribute( const char* name, float* value ) const {
+ double d;
+ int result = QueryDoubleAttribute( name, &d );
+ *value = (float)d;
+ return result;
+ }
+
+ /** Sets an attribute of name to a given value. The attribute
+ will be created if it does not exist, or changed if it does.
+ */
+ void SetAttribute( const char* name, const char * value );
+
+ #ifdef TIXML_USE_STL
+ const char* Attribute( const std::string& name ) const { return Attribute( name.c_str() ); }
+ const char* Attribute( const std::string& name, int* i ) const { return Attribute( name.c_str(), i ); }
+ const char* Attribute( const std::string& name, double* d ) const { return Attribute( name.c_str(), d ); }
+ int QueryIntAttribute( const std::string& name, int* value ) const { return QueryIntAttribute( name.c_str(), value ); }
+ int QueryDoubleAttribute( const std::string& name, double* value ) const { return QueryDoubleAttribute( name.c_str(), value ); }
+
+ /// STL std::string form.
+ void SetAttribute( const std::string& name, const std::string& _value )
+ {
+ StringToBuffer n( name );
+ StringToBuffer v( _value );
+ if ( n.buffer && v.buffer )
+ SetAttribute (n.buffer, v.buffer );
+ }
+ ///< STL std::string form.
+ void SetAttribute( const std::string& name, int _value )
+ {
+ StringToBuffer n( name );
+ if ( n.buffer )
+ SetAttribute (n.buffer, _value);
+ }
+ #endif
+
+ /** Sets an attribute of name to a given value. The attribute
+ will be created if it does not exist, or changed if it does.
+ */
+ void SetAttribute( const char * name, int value );
+
+ /** Sets an attribute of name to a given value. The attribute
+ will be created if it does not exist, or changed if it does.
+ */
+ void SetDoubleAttribute( const char * name, double value );
+
+ /** Deletes an attribute with the given name.
+ */
+ void RemoveAttribute( const char * name );
+ #ifdef TIXML_USE_STL
+ void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::string form.
+ #endif
+
+ const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element.
+ TiXmlAttribute* FirstAttribute() { return attributeSet.First(); }
+ const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element.
+ TiXmlAttribute* LastAttribute() { return attributeSet.Last(); }
+
+ /// Creates a new Element and returns it - the returned element is a copy.
+ virtual TiXmlNode* Clone() const;
+ // Print the Element to a FILE stream.
+ virtual void Print( FILE* cfile, int depth ) const;
+
+ /* Attribtue parsing starts: next char past '<'
+ returns: next char past '>'
+ */
+ virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
+
+protected:
+
+ void CopyTo( TiXmlElement* target ) const;
+ void ClearThis(); // like clear, but initializes 'this' object as well
+
+ // Used to be public [internal use]
+ #ifdef TIXML_USE_STL
+ virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+ #endif
+ virtual void StreamOut( TIXML_OSTREAM * out ) const;
+
+ /* [internal use]
+ Reads the "value" of the element -- another element, or text.
+ This should terminate with the current end tag.
+ */
+ const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
+
+private:
+
+ TiXmlAttributeSet attributeSet;
+};
+
+
+/** An XML comment.
+*/
+class TiXmlComment : public TiXmlNode
+{
+public:
+ /// Constructs an empty comment.
+ TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {}
+ TiXmlComment( const TiXmlComment& );
+ void operator=( const TiXmlComment& base );
+
+ virtual ~TiXmlComment() {}
+
+ /// Returns a copy of this Comment.
+ virtual TiXmlNode* Clone() const;
+ /// Write this Comment to a FILE stream.
+ virtual void Print( FILE* cfile, int depth ) const;
+
+ /* Attribtue parsing starts: at the ! of the !--
+ returns: next char past '>'
+ */
+ virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
+
+protected:
+ void CopyTo( TiXmlComment* target ) const;
+
+ // used to be public
+ #ifdef TIXML_USE_STL
+ virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+ #endif
+ virtual void StreamOut( TIXML_OSTREAM * out ) const;
+
+private:
+
+};
+
+
+/** XML text. Contained in an element.
+*/
+class TiXmlText : public TiXmlNode
+{
+ friend class TiXmlElement;
+public:
+ /// Constructor.
+ TiXmlText (const char * initValue) : TiXmlNode (TiXmlNode::TEXT)
+ {
+ SetValue( initValue );
+ }
+ virtual ~TiXmlText() {}
+
+ #ifdef TIXML_USE_STL
+ /// Constructor.
+ TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
+ {
+ SetValue( initValue );
+ }
+ #endif
+
+ TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TEXT ) { copy.CopyTo( this ); }
+ void operator=( const TiXmlText& base ) { base.CopyTo( this ); }
+
+ /// Write this text object to a FILE stream.
+ virtual void Print( FILE* cfile, int depth ) const;
+
+ virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
+
+protected :
+ /// [internal use] Creates a new Element and returns it.
+ virtual TiXmlNode* Clone() const;
+ void CopyTo( TiXmlText* target ) const;
+
+ virtual void StreamOut ( TIXML_OSTREAM * out ) const;
+ bool Blank() const; // returns true if all white space and new lines
+ // [internal use]
+ #ifdef TIXML_USE_STL
+ virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+ #endif
+
+private:
+};
+
+
+/** In correct XML the declaration is the first entry in the file.
+ @verbatim
+ <?xml version="1.0" standalone="yes"?>
+ @endverbatim
+
+ TinyXml will happily read or write files without a declaration,
+ however. There are 3 possible attributes to the declaration:
+ version, encoding, and standalone.
+
+ Note: In this version of the code, the attributes are
+ handled as special cases, not generic attributes, simply
+ because there can only be at most 3 and they are always the same.
+*/
+class TiXmlDeclaration : public TiXmlNode
+{
+public:
+ /// Construct an empty declaration.
+ TiXmlDeclaration() : TiXmlNode( TiXmlNode::DECLARATION ) {}
+
+#ifdef TIXML_USE_STL
+ /// Constructor.
+ TiXmlDeclaration( const std::string& _version,
+ const std::string& _encoding,
+ const std::string& _standalone );
+#endif
+
+ /// Construct.
+ TiXmlDeclaration( const char* _version,
+ const char* _encoding,
+ const char* _standalone );
+
+ TiXmlDeclaration( const TiXmlDeclaration& copy );
+ void operator=( const TiXmlDeclaration& copy );
+
+ virtual ~TiXmlDeclaration() {}
+
+ /// Version. Will return an empty string if none was found.
+ const char *Version() const { return version.c_str (); }
+ /// Encoding. Will return an empty string if none was found.
+ const char *Encoding() const { return encoding.c_str (); }
+ /// Is this a standalone document?
+ const char *Standalone() const { return standalone.c_str (); }
+
+ /// Creates a copy of this Declaration and returns it.
+ virtual TiXmlNode* Clone() const;
+ /// Print this declaration to a FILE stream.
+ virtual void Print( FILE* cfile, int depth ) const;
+
+ virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
+
+protected:
+ void CopyTo( TiXmlDeclaration* target ) const;
+ // used to be public
+ #ifdef TIXML_USE_STL
+ virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+ #endif
+ virtual void StreamOut ( TIXML_OSTREAM * out) const;
+
+private:
+
+ TIXML_STRING version;
+ TIXML_STRING encoding;
+ TIXML_STRING standalone;
+};
+
+
+/** Any tag that tinyXml doesn't recognize is saved as an
+ unknown. It is a tag of text, but should not be modified.
+ It will be written back to the XML, unchanged, when the file
+ is saved.
+
+ DTD tags get thrown into TiXmlUnknowns.
+*/
+class TiXmlUnknown : public TiXmlNode
+{
+public:
+ TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN ) {}
+ virtual ~TiXmlUnknown() {}
+
+ TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::UNKNOWN ) { copy.CopyTo( this ); }
+ void operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); }
+
+ /// Creates a copy of this Unknown and returns it.
+ virtual TiXmlNode* Clone() const;
+ /// Print this Unknown to a FILE stream.
+ virtual void Print( FILE* cfile, int depth ) const;
+
+ virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
+
+protected:
+ void CopyTo( TiXmlUnknown* target ) const;
+
+ #ifdef TIXML_USE_STL
+ virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+ #endif
+ virtual void StreamOut ( TIXML_OSTREAM * out ) const;
+
+private:
+
+};
+
+
+/** Always the top level node. A document binds together all the
+ XML pieces. It can be saved, loaded, and printed to the screen.
+ The 'value' of a document node is the xml file name.
+*/
+class TiXmlDocument : public TiXmlNode
+{
+public:
+ /// Create an empty document, that has no name.
+ TiXmlDocument();
+ /// Create a document with a name. The name of the document is also the filename of the xml.
+ TiXmlDocument( const char * documentName );
+
+ #ifdef TIXML_USE_STL
+ /// Constructor.
+ TiXmlDocument( const std::string& documentName );
+ #endif
+
+ TiXmlDocument( const TiXmlDocument& copy );
+ void operator=( const TiXmlDocument& copy );
+
+ virtual ~TiXmlDocument() {}
+
+ /** Load a file using the current document value.
+ Returns true if successful. Will delete any existing
+ document data before loading.
+ */
+ bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
+ /// Save a file using the current document value. Returns true if successful.
+ bool SaveFile() const;
+ /// Load a file using the given filename. Returns true if successful.
+ bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
+ /// Save a file using the given filename. Returns true if successful.
+ bool SaveFile( const char * filename ) const;
+
+ #ifdef TIXML_USE_STL
+ bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version.
+ {
+ StringToBuffer f( filename );
+ return ( f.buffer && LoadFile( f.buffer, encoding ));
+ }
+ bool SaveFile( const std::string& filename ) const ///< STL std::string version.
+ {
+ StringToBuffer f( filename );
+ return ( f.buffer && SaveFile( f.buffer ));
+ }
+ #endif
+
+ /** Parse the given null terminated block of xml data. Passing in an encoding to this
+ method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml
+ to use that encoding, regardless of what TinyXml might otherwise try to detect.
+ */
+ virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
+
+ /** Get the root element -- the only top level element -- of the document.
+ In well formed XML, there should only be one. TinyXml is tolerant of
+ multiple elements at the document level.
+ */
+ const TiXmlElement* RootElement() const { return FirstChildElement(); }
+ TiXmlElement* RootElement() { return FirstChildElement(); }
+
+ /** If an error occurs, Error will be set to true. Also,
+ - The ErrorId() will contain the integer identifier of the error (not generally useful)
+ - The ErrorDesc() method will return the name of the error. (very useful)
+ - The ErrorRow() and ErrorCol() will return the location of the error (if known)
+ */
+ bool Error() const { return error; }
+
+ /// Contains a textual (english) description of the error if one occurs.
+ const char * ErrorDesc() const { return errorDesc.c_str (); }
+
+ /** Generally, you probably want the error string ( ErrorDesc() ). But if you
+ prefer the ErrorId, this function will fetch it.
+ */
+ const int ErrorId() const { return errorId; }
+
+ /** Returns the location (if known) of the error. The first column is column 1,
+ and the first row is row 1. A value of 0 means the row and column wasn't applicable
+ (memory errors, for example, have no row/column) or the parser lost the error. (An
+ error in the error reporting, in that case.)
+
+ @sa SetTabSize, Row, Column
+ */
+ int ErrorRow() { return errorLocation.row+1; }
+ int ErrorCol() { return errorLocation.col+1; } ///< The column where the error occured. See ErrorRow()
+
+ /** By calling this method, with a tab size
+ greater than 0, the row and column of each node and attribute is stored
+ when the file is loaded. Very useful for tracking the DOM back in to
+ the source file.
+
+ The tab size is required for calculating the location of nodes. If not
+ set, the default of 4 is used. The tabsize is set per document. Setting
+ the tabsize to 0 disables row/column tracking.
+
+ Note that row and column tracking is not supported when using operator>>.
+
+ The tab size needs to be enabled before the parse or load. Correct usage:
+ @verbatim
+ TiXmlDocument doc;
+ doc.SetTabSize( 8 );
+ doc.Load( "myfile.xml" );
+ @endverbatim
+
+ @sa Row, Column
+ */
+ void SetTabSize( int _tabsize ) { tabsize = _tabsize; }
+
+ int TabSize() const { return tabsize; }
+
+ /** If you have handled the error, it can be reset with this call. The error
+ state is automatically cleared if you Parse a new XML block.
+ */
+ void ClearError() { error = false;
+ errorId = 0;
+ errorDesc = "";
+ errorLocation.row = errorLocation.col = 0;
+ //errorLocation.last = 0;
+ }
+
+ /** Dump the document to standard out. */
+ void Print() const { Print( stdout, 0 ); }
+
+ /// Print this Document to a FILE stream.
+ virtual void Print( FILE* cfile, int depth = 0 ) const;
+ // [internal use]
+ void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding );
+
+protected :
+ virtual void StreamOut ( TIXML_OSTREAM * out) const;
+ // [internal use]
+ virtual TiXmlNode* Clone() const;
+ #ifdef TIXML_USE_STL
+ virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+ #endif
+
+private:
+ void CopyTo( TiXmlDocument* target ) const;
+
+ bool error;
+ int errorId;
+ TIXML_STRING errorDesc;
+ int tabsize;
+ TiXmlCursor errorLocation;
+};
+
+
+/**
+ A TiXmlHandle is a class that wraps a node pointer with null checks; this is
+ an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml
+ DOM structure. It is a separate utility class.
+
+ Take an example:
+ @verbatim
+ <Document>
+ <Element attributeA = "valueA">
+ <Child attributeB = "value1" />
+ <Child attributeB = "value2" />
+ </Element>
+ <Document>
+ @endverbatim
+
+ Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very
+ easy to write a *lot* of code that looks like:
+
+ @verbatim
+ TiXmlElement* root = document.FirstChildElement( "Document" );
+ if ( root )
+ {
+ TiXmlElement* element = root->FirstChildElement( "Element" );
+ if ( element )
+ {
+ TiXmlElement* child = element->FirstChildElement( "Child" );
+ if ( child )
+ {
+ TiXmlElement* child2 = child->NextSiblingElement( "Child" );
+ if ( child2 )
+ {
+ // Finally do something useful.
+ @endverbatim
+
+ And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity
+ of such code. A TiXmlHandle checks for null pointers so it is perfectly safe
+ and correct to use:
+
+ @verbatim
+ TiXmlHandle docHandle( &document );
+ TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).Element();
+ if ( child2 )
+ {
+ // do something useful
+ @endverbatim
+
+ Which is MUCH more concise and useful.
+
+ It is also safe to copy handles - internally they are nothing more than node pointers.
+ @verbatim
+ TiXmlHandle handleCopy = handle;
+ @endverbatim
+
+ What they should not be used for is iteration:
+
+ @verbatim
+ int i=0;
+ while ( true )
+ {
+ TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).Element();
+ if ( !child )
+ break;
+ // do something
+ ++i;
+ }
+ @endverbatim
+
+ It seems reasonable, but it is in fact two embedded while loops. The Child method is
+ a linear walk to find the element, so this code would iterate much more than it needs
+ to. Instead, prefer:
+
+ @verbatim
+ TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).Element();
+
+ for( child; child; child=child->NextSiblingElement() )
+ {
+ // do something
+ }
+ @endverbatim
+*/
+class TiXmlHandle
+{
+public:
+ /// Create a handle from any node (at any depth of the tree.) This can be a null pointer.
+ TiXmlHandle( TiXmlNode* node ) { this->node = node; }
+ /// Copy constructor
+ TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; }
+ TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; }
+
+ /// Return a handle to the first child node.
+ TiXmlHandle FirstChild() const;
+ /// Return a handle to the first child node with the given name.
+ TiXmlHandle FirstChild( const char * value ) const;
+ /// Return a handle to the first child element.
+ TiXmlHandle FirstChildElement() const;
+ /// Return a handle to the first child element with the given name.
+ TiXmlHandle FirstChildElement( const char * value ) const;
+
+ /** Return a handle to the "index" child with the given name.
+ The first child is 0, the second 1, etc.
+ */
+ TiXmlHandle Child( const char* value, int index ) const;
+ /** Return a handle to the "index" child.
+ The first child is 0, the second 1, etc.
+ */
+ TiXmlHandle Child( int index ) const;
+ /** Return a handle to the "index" child element with the given name.
+ The first child element is 0, the second 1, etc. Note that only TiXmlElements
+ are indexed: other types are not counted.
+ */
+ TiXmlHandle ChildElement( const char* value, int index ) const;
+ /** Return a handle to the "index" child element.
+ The first child element is 0, the second 1, etc. Note that only TiXmlElements
+ are indexed: other types are not counted.
+ */
+ TiXmlHandle ChildElement( int index ) const;
+
+ #ifdef TIXML_USE_STL
+ TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); }
+ TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); }
+
+ TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); }
+ TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); }
+ #endif
+
+ /// Return the handle as a TiXmlNode. This may return null.
+ TiXmlNode* Node() const { return node; }
+ /// Return the handle as a TiXmlElement. This may return null.
+ TiXmlElement* Element() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
+ /// Return the handle as a TiXmlText. This may return null.
+ TiXmlText* Text() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); }
+ /// Return the handle as a TiXmlUnknown. This may return null;
+ TiXmlUnknown* Unknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
+
+private:
+ TiXmlNode* node;
+};
+
+#ifdef _MSC_VER
+#pragma warning( default : 4530 )
+#pragma warning( default : 4786 )
+#endif
+
+#endif
+
diff --git a/PDContainer/tinyxml/tinyxmlerror.cpp b/PDContainer/tinyxml/tinyxmlerror.cpp
new file mode 100755
index 0000000..b04add7
--- /dev/null
+++ b/PDContainer/tinyxml/tinyxmlerror.cpp
@@ -0,0 +1,51 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+#include "tinyxml.h"
+
+// The goal of the seperate error file is to make the first
+// step towards localization. tinyxml (currently) only supports
+// latin-1, but at least the error messages could now be translated.
+//
+// It also cleans up the code a bit.
+//
+
+const char* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] =
+{
+ "No error",
+ "Error",
+ "Failed to open file",
+ "Memory allocation failed.",
+ "Error parsing Element.",
+ "Failed to read Element name",
+ "Error reading Element value.",
+ "Error reading Attributes.",
+ "Error: empty tag.",
+ "Error reading end tag.",
+ "Error parsing Unknown.",
+ "Error parsing Comment.",
+ "Error parsing Declaration.",
+ "Error document empty.",
+ "Error null (0) or unexpected EOF found in input stream.",
+};
diff --git a/PDContainer/tinyxml/tinyxmlparser.cpp b/PDContainer/tinyxml/tinyxmlparser.cpp
new file mode 100755
index 0000000..56917b6
--- /dev/null
+++ b/PDContainer/tinyxml/tinyxmlparser.cpp
@@ -0,0 +1,1508 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+#include "tinyxml.h"
+#include <ctype.h>
+#include <stddef.h>
+
+//#define DEBUG_PARSER
+
+// Note tha "PutString" hardcodes the same list. This
+// is less flexible than it appears. Changing the entries
+// or order will break putstring.
+TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] =
+{
+ { "&amp;", 5, '&' },
+ { "&lt;", 4, '<' },
+ { "&gt;", 4, '>' },
+ { "&quot;", 6, '\"' },
+ { "&apos;", 6, '\'' }
+};
+
+// Bunch of unicode info at:
+// http://www.unicode.org/faq/utf_bom.html
+// Including the basic of this table, which determines the #bytes in the
+// sequence from the lead byte. 1 placed for invalid sequences --
+// although the result will be junk, pass it through as much as possible.
+// Beware of the non-characters in UTF-8:
+// ef bb bf (Microsoft "lead bytes")
+// ef bf be
+// ef bf bf
+
+const unsigned char TIXML_UTF_LEAD_0 = 0xefU;
+const unsigned char TIXML_UTF_LEAD_1 = 0xbbU;
+const unsigned char TIXML_UTF_LEAD_2 = 0xbfU;
+
+const int TiXmlBase::utf8ByteTable[256] =
+{
+ // 0 1 2 3 4 5 6 7 8 9 a b c d e f
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 End of ASCII range
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 0x80 to 0xc1 invalid
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0
+ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 0xc2 to 0xdf 2 byte
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte
+ 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid
+};
+
+
+void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length )
+{
+ const unsigned long BYTE_MASK = 0xBF;
+ const unsigned long BYTE_MARK = 0x80;
+ const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
+
+ if (input < 0x80)
+ *length = 1;
+ else if ( input < 0x800 )
+ *length = 2;
+ else if ( input < 0x10000 )
+ *length = 3;
+ else if ( input < 0x200000 )
+ *length = 4;
+ else
+ { *length = 0; return; } // This code won't covert this correctly anyway.
+
+ output += *length;
+
+ // Scary scary fall throughs.
+ switch (*length)
+ {
+ case 4:
+ --output;
+ *output = (char)((input | BYTE_MARK) & BYTE_MASK);
+ input >>= 6;
+ case 3:
+ --output;
+ *output = (char)((input | BYTE_MARK) & BYTE_MASK);
+ input >>= 6;
+ case 2:
+ --output;
+ *output = (char)((input | BYTE_MARK) & BYTE_MASK);
+ input >>= 6;
+ case 1:
+ --output;
+ *output = (char)(input | FIRST_BYTE_MARK[*length]);
+ }
+}
+
+
+/*static*/ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding /*encoding*/ )
+{
+ // This will only work for low-ascii, everything else is assumed to be a valid
+ // letter. I'm not sure this is the best approach, but it is quite tricky trying
+ // to figure out alhabetical vs. not across encoding. So take a very
+ // conservative approach.
+
+// if ( encoding == TIXML_ENCODING_UTF8 )
+// {
+ if ( anyByte < 127 )
+ return isalpha( anyByte );
+ else
+ return 1; // What else to do? The unicode set is huge...get the english ones right.
+// }
+// else
+// {
+// return isalpha( anyByte );
+// }
+}
+
+
+/*static*/ int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding /*encoding*/ )
+{
+ // This will only work for low-ascii, everything else is assumed to be a valid
+ // letter. I'm not sure this is the best approach, but it is quite tricky trying
+ // to figure out alhabetical vs. not across encoding. So take a very
+ // conservative approach.
+
+// if ( encoding == TIXML_ENCODING_UTF8 )
+// {
+ if ( anyByte < 127 )
+ return isalnum( anyByte );
+ else
+ return 1; // What else to do? The unicode set is huge...get the english ones right.
+// }
+// else
+// {
+// return isalnum( anyByte );
+// }
+}
+
+
+class TiXmlParsingData
+{
+ friend class TiXmlDocument;
+ public:
+ void Stamp( const char* now, TiXmlEncoding encoding );
+
+ const TiXmlCursor& Cursor() { return cursor; }
+
+ private:
+ // Only used by the document!
+ TiXmlParsingData( const char* start, int _tabsize, int row, int col )
+ {
+ assert( start );
+ stamp = start;
+ tabsize = _tabsize;
+ cursor.row = row;
+ cursor.col = col;
+ }
+
+ TiXmlCursor cursor;
+ const char* stamp;
+ int tabsize;
+};
+
+
+void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding )
+{
+ assert( now );
+
+ // Do nothing if the tabsize is 0.
+ if ( tabsize < 1 )
+ {
+ return;
+ }
+
+ // Get the current row, column.
+ int row = cursor.row;
+ int col = cursor.col;
+ const char* p = stamp;
+ assert( p );
+
+ while ( p < now )
+ {
+ // Treat p as unsigned, so we have a happy compiler.
+ const unsigned char* pU = (const unsigned char*)p;
+
+ // Code contributed by Fletcher Dunn: (modified by lee)
+ switch (*pU) {
+ case 0:
+ // We *should* never get here, but in case we do, don't
+ // advance past the terminating null character, ever
+ return;
+
+ case '\r':
+ // bump down to the next line
+ ++row;
+ col = 0;
+ // Eat the character
+ ++p;
+
+ // Check for \r\n sequence, and treat this as a single character
+ if (*p == '\n') {
+ ++p;
+ }
+ break;
+
+ case '\n':
+ // bump down to the next line
+ ++row;
+ col = 0;
+
+ // Eat the character
+ ++p;
+
+ // Check for \n\r sequence, and treat this as a single
+ // character. (Yes, this bizarre thing does occur still
+ // on some arcane platforms...)
+ if (*p == '\r') {
+ ++p;
+ }
+ break;
+
+ case '\t':
+ // Eat the character
+ ++p;
+
+ // Skip to next tab stop
+ col = (col / tabsize + 1) * tabsize;
+ break;
+
+ case TIXML_UTF_LEAD_0:
+ if ( encoding == TIXML_ENCODING_UTF8 )
+ {
+ if ( *(p+1) && *(p+2) )
+ {
+ // In these cases, don't advance the column. These are
+ // 0-width spaces.
+ if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 )
+ p += 3;
+ else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU )
+ p += 3;
+ else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU )
+ p += 3;
+ else
+ { p +=3; ++col; } // A normal character.
+ }
+ }
+ else
+ {
+ ++p;
+ ++col;
+ }
+ break;
+
+ default:
+ if ( encoding == TIXML_ENCODING_UTF8 )
+ {
+ // Eat the 1 to 4 byte utf8 character.
+ int step = TiXmlBase::utf8ByteTable[*((unsigned char*)p)];
+ if ( step == 0 )
+ step = 1; // Error case from bad encoding, but handle gracefully.
+ p += step;
+
+ // Just advance one column, of course.
+ ++col;
+ }
+ else
+ {
+ ++p;
+ ++col;
+ }
+ break;
+ }
+ }
+ cursor.row = row;
+ cursor.col = col;
+ assert( cursor.row >= -1 );
+ assert( cursor.col >= -1 );
+ stamp = p;
+ assert( stamp );
+}
+
+
+const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding )
+{
+ if ( !p || !*p )
+ {
+ return 0;
+ }
+ if ( encoding == TIXML_ENCODING_UTF8 )
+ {
+ while ( *p )
+ {
+ const unsigned char* pU = (const unsigned char*)p;
+
+ // Skip the stupid Microsoft UTF-8 Byte order marks
+ if ( *(pU+0)==TIXML_UTF_LEAD_0
+ && *(pU+1)==TIXML_UTF_LEAD_1
+ && *(pU+2)==TIXML_UTF_LEAD_2 )
+ {
+ p += 3;
+ continue;
+ }
+ else if(*(pU+0)==TIXML_UTF_LEAD_0
+ && *(pU+1)==0xbfU
+ && *(pU+2)==0xbeU )
+ {
+ p += 3;
+ continue;
+ }
+ else if(*(pU+0)==TIXML_UTF_LEAD_0
+ && *(pU+1)==0xbfU
+ && *(pU+2)==0xbfU )
+ {
+ p += 3;
+ continue;
+ }
+
+ if ( IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' ) // Still using old rules for white space.
+ ++p;
+ else
+ break;
+ }
+ }
+ else
+ {
+ while ( *p && IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' )
+ ++p;
+ }
+
+ return p;
+}
+
+#ifdef TIXML_USE_STL
+/*static*/ bool TiXmlBase::StreamWhiteSpace( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+ for( ;; )
+ {
+ if ( !in->good() ) return false;
+
+ int c = in->peek();
+ // At this scope, we can't get to a document. So fail silently.
+ if ( !IsWhiteSpace( c ) || c <= 0 )
+ return true;
+
+ *tag += (char) in->get();
+ }
+}
+
+/*static*/ bool TiXmlBase::StreamTo( TIXML_ISTREAM * in, int character, TIXML_STRING * tag )
+{
+ //assert( character > 0 && character < 128 ); // else it won't work in utf-8
+ while ( in->good() )
+ {
+ int c = in->peek();
+ if ( c == character )
+ return true;
+ if ( c <= 0 ) // Silent failure: can't get document at this scope
+ return false;
+
+ in->get();
+ *tag += (char) c;
+ }
+ return false;
+}
+#endif
+
+const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncoding encoding )
+{
+ *name = "";
+ assert( p );
+
+ // Names start with letters or underscores.
+ // Of course, in unicode, tinyxml has no idea what a letter *is*. The
+ // algorithm is generous.
+ //
+ // After that, they can be letters, underscores, numbers,
+ // hyphens, or colons. (Colons are valid ony for namespaces,
+ // but tinyxml can't tell namespaces from names.)
+ if ( p && *p
+ && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) )
+ {
+ while( p && *p
+ && ( IsAlphaNum( (unsigned char ) *p, encoding )
+ || *p == '_'
+ || *p == '-'
+ || *p == '.'
+ || *p == ':' ) )
+ {
+ (*name) += *p;
+ ++p;
+ }
+ return p;
+ }
+ return 0;
+}
+
+const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXmlEncoding encoding )
+{
+ // Presume an entity, and pull it out.
+ TIXML_STRING ent;
+ int i;
+ *length = 0;
+
+ if ( *(p+1) && *(p+1) == '#' && *(p+2) )
+ {
+ unsigned long ucs = 0;
+ ptrdiff_t delta = 0;
+ unsigned mult = 1;
+
+ if ( *(p+2) == 'x' )
+ {
+ // Hexadecimal.
+ if ( !*(p+3) ) return 0;
+
+ const char* q = p+3;
+ q = strchr( q, ';' );
+
+ if ( !q || !*q ) return 0;
+
+ delta = q-p;
+ --q;
+
+ while ( *q != 'x' )
+ {
+ if ( *q >= '0' && *q <= '9' )
+ ucs += mult * (*q - '0');
+ else if ( *q >= 'a' && *q <= 'f' )
+ ucs += mult * (*q - 'a' + 10);
+ else if ( *q >= 'A' && *q <= 'F' )
+ ucs += mult * (*q - 'A' + 10 );
+ else
+ return 0;
+ mult *= 16;
+ --q;
+ }
+ }
+ else
+ {
+ // Decimal.
+ if ( !*(p+2) ) return 0;
+
+ const char* q = p+2;
+ q = strchr( q, ';' );
+
+ if ( !q || !*q ) return 0;
+
+ delta = q-p;
+ --q;
+
+ while ( *q != '#' )
+ {
+ if ( *q >= '0' && *q <= '9' )
+ ucs += mult * (*q - '0');
+ else
+ return 0;
+ mult *= 10;
+ --q;
+ }
+ }
+ if ( encoding == TIXML_ENCODING_UTF8 )
+ {
+ // convert the UCS to UTF-8
+ ConvertUTF32ToUTF8( ucs, value, length );
+ }
+ else
+ {
+ *value = (char)ucs;
+ *length = 1;
+ }
+ return p + delta + 1;
+ }
+
+ // Now try to match it.
+ for( i=0; i<NUM_ENTITY; ++i )
+ {
+ if ( strncmp( entity[i].str, p, entity[i].strLength ) == 0 )
+ {
+ assert( strlen( entity[i].str ) == entity[i].strLength );
+ *value = entity[i].chr;
+ *length = 1;
+ return ( p + entity[i].strLength );
+ }
+ }
+
+ // So it wasn't an entity, its unrecognized, or something like that.
+ *value = *p; // Don't put back the last one, since we return it!
+ return p+1;
+}
+
+
+bool TiXmlBase::StringEqual( const char* p,
+ const char* tag,
+ bool ignoreCase,
+ TiXmlEncoding encoding )
+{
+ assert( p );
+ assert( tag );
+ if ( !p || !*p )
+ {
+ assert( 0 );
+ return false;
+ }
+
+ const char* q = p;
+
+ if ( ignoreCase )
+ {
+ while ( *q && *tag && ToLower( *q, encoding ) == ToLower( *tag, encoding ) )
+ {
+ ++q;
+ ++tag;
+ }
+
+ if ( *tag == 0 )
+ return true;
+ }
+ else
+ {
+ while ( *q && *tag && *q == *tag )
+ {
+ ++q;
+ ++tag;
+ }
+
+ if ( *tag == 0 ) // Have we found the end of the tag, and everything equal?
+ return true;
+ }
+ return false;
+}
+
+const char* TiXmlBase::ReadText( const char* p,
+ TIXML_STRING * text,
+ bool trimWhiteSpace,
+ const char* endTag,
+ bool caseInsensitive,
+ TiXmlEncoding encoding )
+{
+ *text = "";
+ if ( !trimWhiteSpace // certain tags always keep whitespace
+ || !condenseWhiteSpace ) // if true, whitespace is always kept
+ {
+ // Keep all the white space.
+ while ( p && *p
+ && !StringEqual( p, endTag, caseInsensitive, encoding )
+ )
+ {
+ int len;
+ char cArr[4] = { 0, 0, 0, 0 };
+ p = GetChar( p, cArr, &len, encoding );
+ text->append( cArr, len );
+ }
+ }
+ else
+ {
+ bool whitespace = false;
+
+ // Remove leading white space:
+ p = SkipWhiteSpace( p, encoding );
+ while ( p && *p
+ && !StringEqual( p, endTag, caseInsensitive, encoding ) )
+ {
+ if ( *p == '\r' || *p == '\n' )
+ {
+ whitespace = true;
+ ++p;
+ }
+ else if ( IsWhiteSpace( *p ) )
+ {
+ whitespace = true;
+ ++p;
+ }
+ else
+ {
+ // If we've found whitespace, add it before the
+ // new character. Any whitespace just becomes a space.
+ if ( whitespace )
+ {
+ (*text) += ' ';
+ whitespace = false;
+ }
+ int len;
+ char cArr[4] = { 0, 0, 0, 0 };
+ p = GetChar( p, cArr, &len, encoding );
+ if ( len == 1 )
+ (*text) += cArr[0]; // more efficient
+ else
+ text->append( cArr, len );
+ }
+ }
+ }
+ return p + strlen( endTag );
+}
+
+#ifdef TIXML_USE_STL
+
+void TiXmlDocument::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+ // The basic issue with a document is that we don't know what we're
+ // streaming. Read something presumed to be a tag (and hope), then
+ // identify it, and call the appropriate stream method on the tag.
+ //
+ // This "pre-streaming" will never read the closing ">" so the
+ // sub-tag can orient itself.
+
+ if ( !StreamTo( in, '<', tag ) )
+ {
+ SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+
+ while ( in->good() )
+ {
+ int tagIndex = (int) tag->length();
+ while ( in->good() && in->peek() != '>' )
+ {
+ int c = in->get();
+ if ( c <= 0 )
+ {
+ SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+ break;
+ }
+ (*tag) += (char) c;
+ }
+
+ if ( in->good() )
+ {
+ // We now have something we presume to be a node of
+ // some sort. Identify it, and call the node to
+ // continue streaming.
+ TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING );
+
+ if ( node )
+ {
+ node->StreamIn( in, tag );
+ bool isElement = node->ToElement() != 0;
+ delete node;
+ node = 0;
+
+ // If this is the root element, we're done. Parsing will be
+ // done by the >> operator.
+ if ( isElement )
+ {
+ return;
+ }
+ }
+ else
+ {
+ SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+ }
+ }
+ // We should have returned sooner.
+ SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN );
+}
+
+#endif
+
+const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding )
+{
+ ClearError();
+
+ // Parse away, at the document level. Since a document
+ // contains nothing but other tags, most of what happens
+ // here is skipping white space.
+ if ( !p || !*p )
+ {
+ SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return 0;
+ }
+
+ // Note that, for a document, this needs to come
+ // before the while space skip, so that parsing
+ // starts from the pointer we are given.
+ location.Clear();
+ if ( prevData )
+ {
+ location.row = prevData->cursor.row;
+ location.col = prevData->cursor.col;
+ }
+ else
+ {
+ location.row = 0;
+ location.col = 0;
+ }
+ TiXmlParsingData data( p, TabSize(), location.row, location.col );
+ location = data.Cursor();
+
+ if ( encoding == TIXML_ENCODING_UNKNOWN )
+ {
+ // Check for the Microsoft UTF-8 lead bytes.
+ const unsigned char* pU = (const unsigned char*)p;
+ if ( *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0
+ && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1
+ && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 )
+ {
+ encoding = TIXML_ENCODING_UTF8;
+ }
+ }
+
+ p = SkipWhiteSpace( p, encoding );
+ if ( !p )
+ {
+ SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return 0;
+ }
+
+ while ( p && *p )
+ {
+ TiXmlNode* node = Identify( p, encoding );
+ if ( node )
+ {
+ p = node->Parse( p, &data, encoding );
+ LinkEndChild( node );
+ }
+ else
+ {
+ break;
+ }
+
+ // Did we get encoding info?
+ if ( encoding == TIXML_ENCODING_UNKNOWN
+ && node->ToDeclaration() )
+ {
+ TiXmlDeclaration* dec = node->ToDeclaration();
+ const char* enc = dec->Encoding();
+ assert( enc );
+
+ if ( *enc == 0 )
+ encoding = TIXML_ENCODING_UTF8;
+ else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) )
+ encoding = TIXML_ENCODING_UTF8;
+ else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) )
+ encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice
+ else
+ encoding = TIXML_ENCODING_LEGACY;
+ }
+
+ p = SkipWhiteSpace( p, encoding );
+ }
+
+ // Was this empty?
+ if ( !firstChild ) {
+ SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding );
+ return 0;
+ }
+
+ // All is well.
+ return p;
+}
+
+void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+ // The first error in a chain is more accurate - don't set again!
+ if ( error )
+ return;
+
+ assert( err > 0 && err < TIXML_ERROR_STRING_COUNT );
+ error = true;
+ errorId = err;
+ errorDesc = errorString[ errorId ];
+
+ errorLocation.Clear();
+ if ( pError && data )
+ {
+ //TiXmlParsingData data( pError, prevData );
+ data->Stamp( pError, encoding );
+ errorLocation = data->Cursor();
+ }
+}
+
+
+TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
+{
+ TiXmlNode* returnNode = 0;
+
+ p = SkipWhiteSpace( p, encoding );
+ if( !p || !*p || *p != '<' )
+ {
+ return 0;
+ }
+
+ TiXmlDocument* doc = GetDocument();
+ p = SkipWhiteSpace( p, encoding );
+
+ if ( !p || !*p )
+ {
+ return 0;
+ }
+
+ // What is this thing?
+ // - Elements start with a letter or underscore, but xml is reserved.
+ // - Comments: <!--
+ // - Decleration: <?xml
+ // - Everthing else is unknown to tinyxml.
+ //
+
+ const char* xmlHeader = { "<?xml" };
+ const char* commentHeader = { "<!--" };
+ const char* dtdHeader = { "<!" };
+
+ if ( StringEqual( p, xmlHeader, true, encoding ) )
+ {
+ #ifdef DEBUG_PARSER
+ TIXML_LOG( "XML parsing Declaration\n" );
+ #endif
+ returnNode = new TiXmlDeclaration();
+ }
+ else if ( StringEqual( p, commentHeader, false, encoding ) )
+ {
+ #ifdef DEBUG_PARSER
+ TIXML_LOG( "XML parsing Comment\n" );
+ #endif
+ returnNode = new TiXmlComment();
+ }
+ else if ( StringEqual( p, dtdHeader, false, encoding ) )
+ {
+ #ifdef DEBUG_PARSER
+ TIXML_LOG( "XML parsing Unknown(1)\n" );
+ #endif
+ returnNode = new TiXmlUnknown();
+ }
+ else if ( IsAlpha( *(p+1), encoding )
+ || *(p+1) == '_' )
+ {
+ #ifdef DEBUG_PARSER
+ TIXML_LOG( "XML parsing Element\n" );
+ #endif
+ returnNode = new TiXmlElement( "" );
+ }
+ else
+ {
+ #ifdef DEBUG_PARSER
+ TIXML_LOG( "XML parsing Unknown(2)\n" );
+ #endif
+ returnNode = new TiXmlUnknown();
+ }
+
+ if ( returnNode )
+ {
+ // Set the parent, so it can report errors
+ returnNode->parent = this;
+ }
+ else
+ {
+ if ( doc )
+ doc->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
+ }
+ return returnNode;
+}
+
+#ifdef TIXML_USE_STL
+
+void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
+{
+ // We're called with some amount of pre-parsing. That is, some of "this"
+ // element is in "tag". Go ahead and stream to the closing ">"
+ while( in->good() )
+ {
+ int c = in->get();
+ if ( c <= 0 )
+ {
+ TiXmlDocument* document = GetDocument();
+ if ( document )
+ document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+ (*tag) += (char) c ;
+
+ if ( c == '>' )
+ break;
+ }
+
+ if ( tag->length() < 3 ) return;
+
+ // Okay...if we are a "/>" tag, then we're done. We've read a complete tag.
+ // If not, identify and stream.
+
+ if ( tag->at( tag->length() - 1 ) == '>'
+ && tag->at( tag->length() - 2 ) == '/' )
+ {
+ // All good!
+ return;
+ }
+ else if ( tag->at( tag->length() - 1 ) == '>' )
+ {
+ // There is more. Could be:
+ // text
+ // closing tag
+ // another node.
+ for ( ;; )
+ {
+ StreamWhiteSpace( in, tag );
+
+ // Do we have text?
+ if ( in->good() && in->peek() != '<' )
+ {
+ // Yep, text.
+ TiXmlText text( "" );
+ text.StreamIn( in, tag );
+
+ // What follows text is a closing tag or another node.
+ // Go around again and figure it out.
+ continue;
+ }
+
+ // We now have either a closing tag...or another node.
+ // We should be at a "<", regardless.
+ if ( !in->good() ) return;
+ assert( in->peek() == '<' );
+ int tagIndex = tag->length();
+
+ bool closingTag = false;
+ bool firstCharFound = false;
+
+ for( ;; )
+ {
+ if ( !in->good() )
+ return;
+
+ int c = in->peek();
+ if ( c <= 0 )
+ {
+ TiXmlDocument* document = GetDocument();
+ if ( document )
+ document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+
+ if ( c == '>' )
+ break;
+
+ *tag += (char) c;
+ in->get();
+
+ if ( !firstCharFound && c != '<' && !IsWhiteSpace( c ) )
+ {
+ firstCharFound = true;
+ if ( c == '/' )
+ closingTag = true;
+ }
+ }
+ // If it was a closing tag, then read in the closing '>' to clean up the input stream.
+ // If it was not, the streaming will be done by the tag.
+ if ( closingTag )
+ {
+ if ( !in->good() )
+ return;
+
+ int c = in->get();
+ if ( c <= 0 )
+ {
+ TiXmlDocument* document = GetDocument();
+ if ( document )
+ document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+ assert( c == '>' );
+ *tag += (char) c;
+
+ // We are done, once we've found our closing tag.
+ return;
+ }
+ else
+ {
+ // If not a closing tag, id it, and stream.
+ const char* tagloc = tag->c_str() + tagIndex;
+ TiXmlNode* node = Identify( tagloc, TIXML_DEFAULT_ENCODING );
+ if ( !node )
+ return;
+ node->StreamIn( in, tag );
+ delete node;
+ node = 0;
+
+ // No return: go around from the beginning: text, closing tag, or node.
+ }
+ }
+ }
+}
+#endif
+
+const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+ p = SkipWhiteSpace( p, encoding );
+ TiXmlDocument* document = GetDocument();
+
+ if ( !p || !*p )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, 0, 0, encoding );
+ return 0;
+ }
+
+// TiXmlParsingData data( p, prevData );
+ if ( data )
+ {
+ data->Stamp( p, encoding );
+ location = data->Cursor();
+ }
+
+ if ( *p != '<' )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, p, data, encoding );
+ return 0;
+ }
+
+ p = SkipWhiteSpace( p+1, encoding );
+
+ // Read the name.
+ const char* pErr = p;
+
+ p = ReadName( p, &value, encoding );
+ if ( !p || !*p )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data, encoding );
+ return 0;
+ }
+
+ TIXML_STRING endTag ("</");
+ endTag += value;
+ endTag += ">";
+
+ // Check for and read attributes. Also look for an empty
+ // tag or an end tag.
+ while ( p && *p )
+ {
+ pErr = p;
+ p = SkipWhiteSpace( p, encoding );
+ if ( !p || !*p )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding );
+ return 0;
+ }
+ if ( *p == '/' )
+ {
+ ++p;
+ // Empty tag.
+ if ( *p != '>' )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY, p, data, encoding );
+ return 0;
+ }
+ return (p+1);
+ }
+ else if ( *p == '>' )
+ {
+ // Done with attributes (if there were any.)
+ // Read the value -- which can include other
+ // elements -- read the end tag, and return.
+ ++p;
+ p = ReadValue( p, data, encoding ); // Note this is an Element method, and will set the error if one happens.
+ if ( !p || !*p )
+ return 0;
+
+ // We should find the end tag now
+ if ( StringEqual( p, endTag.c_str(), false, encoding ) )
+ {
+ p += endTag.length();
+ return p;
+ }
+ else
+ {
+ if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
+ return 0;
+ }
+ }
+ else
+ {
+ // Try to read an attribute:
+ TiXmlAttribute* attrib = new TiXmlAttribute();
+ if ( !attrib )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, pErr, data, encoding );
+ return 0;
+ }
+
+ attrib->SetDocument( document );
+ const char* pErr = p;
+ p = attrib->Parse( p, data, encoding );
+
+ if ( !p || !*p )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding );
+ delete attrib;
+ return 0;
+ }
+
+ // Handle the strange case of double attributes:
+ TiXmlAttribute* node = attributeSet.Find( attrib->Name() );
+ if ( node )
+ {
+ node->SetValue( attrib->Value() );
+ delete attrib;
+ return 0;
+ }
+
+ attributeSet.Add( attrib );
+ }
+ }
+ return p;
+}
+
+
+const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+ TiXmlDocument* document = GetDocument();
+
+ const char* pWithWhiteSpace = p;
+ // Read in text and elements in any order.
+ p = SkipWhiteSpace( p, encoding );
+ while ( p && *p )
+ {
+ if ( *p != '<' )
+ {
+ // Take what we have, make a text element.
+ TiXmlText* textNode = new TiXmlText( "" );
+
+ if ( !textNode )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, encoding );
+ return 0;
+ }
+
+ if ( TiXmlBase::IsWhiteSpaceCondensed() )
+ {
+ p = textNode->Parse( p, data, encoding );
+ }
+ else
+ {
+ // Special case: we want to keep the white space
+ // so that leading spaces aren't removed.
+ p = textNode->Parse( pWithWhiteSpace, data, encoding );
+ }
+
+ if ( !textNode->Blank() )
+ LinkEndChild( textNode );
+ else
+ delete textNode;
+ }
+ else
+ {
+ // We hit a '<'
+ // Have we hit a new element or an end tag?
+ if ( StringEqual( p, "</", false, encoding ) )
+ {
+ return p;
+ }
+ else
+ {
+ TiXmlNode* node = Identify( p, encoding );
+ if ( node )
+ {
+ p = node->Parse( p, data, encoding );
+ LinkEndChild( node );
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ }
+ p = SkipWhiteSpace( p, encoding );
+ }
+
+ if ( !p )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0, encoding );
+ }
+ return p;
+}
+
+
+#ifdef TIXML_USE_STL
+void TiXmlUnknown::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+ while ( in->good() )
+ {
+ int c = in->get();
+ if ( c <= 0 )
+ {
+ TiXmlDocument* document = GetDocument();
+ if ( document )
+ document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+ (*tag) += (char) c;
+
+ if ( c == '>' )
+ {
+ // All is well.
+ return;
+ }
+ }
+}
+#endif
+
+
+const char* TiXmlUnknown::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+ TiXmlDocument* document = GetDocument();
+ p = SkipWhiteSpace( p, encoding );
+
+// TiXmlParsingData data( p, prevData );
+ if ( data )
+ {
+ data->Stamp( p, encoding );
+ location = data->Cursor();
+ }
+ if ( !p || !*p || *p != '<' )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, p, data, encoding );
+ return 0;
+ }
+ ++p;
+ value = "";
+
+ while ( p && *p && *p != '>' )
+ {
+ value += *p;
+ ++p;
+ }
+
+ if ( !p )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding );
+ }
+ if ( *p == '>' )
+ return p+1;
+ return p;
+}
+
+#ifdef TIXML_USE_STL
+void TiXmlComment::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+ while ( in->good() )
+ {
+ int c = in->get();
+ if ( c <= 0 )
+ {
+ TiXmlDocument* document = GetDocument();
+ if ( document )
+ document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+
+ (*tag) += (char) c;
+
+ if ( c == '>'
+ && tag->at( tag->length() - 2 ) == '-'
+ && tag->at( tag->length() - 3 ) == '-' )
+ {
+ // All is well.
+ return;
+ }
+ }
+}
+#endif
+
+
+const char* TiXmlComment::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+ TiXmlDocument* document = GetDocument();
+ value = "";
+
+ p = SkipWhiteSpace( p, encoding );
+
+// TiXmlParsingData data( p, prevData );
+ if ( data )
+ {
+ data->Stamp( p, encoding );
+ location = data->Cursor();
+ }
+ const char* startTag = "<!--";
+ const char* endTag = "-->";
+
+ if ( !StringEqual( p, startTag, false, encoding ) )
+ {
+ document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding );
+ return 0;
+ }
+ p += strlen( startTag );
+ p = ReadText( p, &value, false, endTag, false, encoding );
+ return p;
+}
+
+
+const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+ p = SkipWhiteSpace( p, encoding );
+ if ( !p || !*p ) return 0;
+
+ int tabsize = 4;
+ if ( document )
+ tabsize = document->TabSize();
+
+// TiXmlParsingData data( p, prevData );
+ if ( data )
+ {
+ data->Stamp( p, encoding );
+ location = data->Cursor();
+ }
+ // Read the name, the '=' and the value.
+ const char* pErr = p;
+ p = ReadName( p, &name, encoding );
+ if ( !p || !*p )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding );
+ return 0;
+ }
+ p = SkipWhiteSpace( p, encoding );
+ if ( !p || !*p || *p != '=' )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
+ return 0;
+ }
+
+ ++p; // skip '='
+ p = SkipWhiteSpace( p, encoding );
+ if ( !p || !*p )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
+ return 0;
+ }
+
+ const char* end;
+
+ if ( *p == '\'' )
+ {
+ ++p;
+ end = "\'";
+ p = ReadText( p, &value, false, end, false, encoding );
+ }
+ else if ( *p == '"' )
+ {
+ ++p;
+ end = "\"";
+ p = ReadText( p, &value, false, end, false, encoding );
+ }
+ else
+ {
+ // All attribute values should be in single or double quotes.
+ // But this is such a common error that the parser will try
+ // its best, even without them.
+ value = "";
+ while ( p && *p // existence
+ && !IsWhiteSpace( *p ) && *p != '\n' && *p != '\r' // whitespace
+ && *p != '/' && *p != '>' ) // tag end
+ {
+ value += *p;
+ ++p;
+ }
+ }
+ return p;
+}
+
+#ifdef TIXML_USE_STL
+void TiXmlText::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+ while ( in->good() )
+ {
+ int c = in->peek();
+ if ( c == '<' )
+ return;
+ if ( c <= 0 )
+ {
+ TiXmlDocument* document = GetDocument();
+ if ( document )
+ document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+
+ (*tag) += (char) c;
+ in->get();
+ }
+}
+#endif
+
+const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+ value = "";
+// TiXmlParsingData data( p, prevData );
+ if ( data )
+ {
+ data->Stamp( p, encoding );
+ location = data->Cursor();
+ }
+ bool ignoreWhite = true;
+
+ const char* end = "<";
+ p = ReadText( p, &value, ignoreWhite, end, false, encoding );
+ if ( p )
+ return p-1; // don't truncate the '<'
+ return 0;
+}
+
+#ifdef TIXML_USE_STL
+void TiXmlDeclaration::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+ while ( in->good() )
+ {
+ int c = in->get();
+ if ( c <= 0 )
+ {
+ TiXmlDocument* document = GetDocument();
+ if ( document )
+ document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return;
+ }
+ (*tag) += (char) c;
+
+ if ( c == '>' )
+ {
+ // All is well.
+ return;
+ }
+ }
+}
+#endif
+
+const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding )
+{
+ p = SkipWhiteSpace( p, _encoding );
+ // Find the beginning, find the end, and look for
+ // the stuff in-between.
+ TiXmlDocument* document = GetDocument();
+ if ( !p || !*p || !StringEqual( p, "<?xml", true, _encoding ) )
+ {
+ if ( document ) document->SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding );
+ return 0;
+ }
+// TiXmlParsingData data( p, prevData );
+ if ( data )
+ {
+ data->Stamp( p, _encoding );
+ location = data->Cursor();
+ }
+ p += 5;
+
+ version = "";
+ encoding = "";
+ standalone = "";
+
+ while ( p && *p )
+ {
+ if ( *p == '>' )
+ {
+ ++p;
+ return p;
+ }
+
+ p = SkipWhiteSpace( p, _encoding );
+ if ( StringEqual( p, "version", true, _encoding ) )
+ {
+ TiXmlAttribute attrib;
+ p = attrib.Parse( p, data, _encoding );
+ version = attrib.Value();
+ }
+ else if ( StringEqual( p, "encoding", true, _encoding ) )
+ {
+ TiXmlAttribute attrib;
+ p = attrib.Parse( p, data, _encoding );
+ encoding = attrib.Value();
+ }
+ else if ( StringEqual( p, "standalone", true, _encoding ) )
+ {
+ TiXmlAttribute attrib;
+ p = attrib.Parse( p, data, _encoding );
+ standalone = attrib.Value();
+ }
+ else
+ {
+ // Read over whatever it is.
+ while( p && *p && *p != '>' && !IsWhiteSpace( *p ) )
+ ++p;
+ }
+ }
+ return 0;
+}
+
+bool TiXmlText::Blank() const
+{
+ for ( unsigned i=0; i<value.length(); i++ )
+ if ( !IsWhiteSpace( value[i] ) )
+ return false;
+ return true;
+}
+