From 75473b7905e059480b48b84293253f0c85658b69 Mon Sep 17 00:00:00 2001 From: Mark Ryan Date: Wed, 14 Nov 2012 14:10:28 +0100 Subject: [PATCH 1/1] Initial Submission of libgee to Tizen IVI - Submitting version 0.6.6.1 ( 38af23e ) - Compiled with valac 0.16.1 --- AUTHORS | 1 + COPYING | 504 ++ ChangeLog | 744 ++ ChangeLog.pre-0-1-5 | 186 + INSTALL | 234 + MAINTAINERS | 11 + Makefile.am | 58 + Makefile.decl | 57 + Makefile.in | 955 +++ NEWS | 166 + README | 20 + aclocal.m4 | 1325 ++++ benchmark/Makefile.am | 37 + benchmark/Makefile.in | 634 ++ benchmark/benchmark.c | 1963 +++++ benchmark/benchmark.vala | 235 + benchmark/benchmarks.vala.stamp | 0 benchmark/benchmarksorts.c | 568 ++ benchmark/benchmarksorts.vala | 73 + benchmark/mergesort.c | 705 ++ benchmark/mergesort.vala | 110 + compile | 343 + config.guess | 1530 ++++ config.h.in | 65 + config.sub | 1782 +++++ configure | 14308 ++++++++++++++++++++++++++++++++++++ configure.ac | 66 + depcomp | 708 ++ doc/Makefile.am | 37 + doc/Makefile.in | 595 ++ doc/index.wiki | 9 + gee-1.0.pc.in | 13 + gee/Gee-1.0.gir | 5206 +++++++++++++ gee/Makefile.am | 127 + gee/Makefile.in | 921 +++ gee/abstractcollection.c | 1851 +++++ gee/abstractcollection.vala | 298 + gee/abstractlist.c | 665 ++ gee/abstractlist.vala | 119 + gee/abstractmap.c | 1020 +++ gee/abstractmap.vala | 205 + gee/abstractmultimap.c | 935 +++ gee/abstractmultimap.vala | 129 + gee/abstractmultiset.c | 872 +++ gee/abstractmultiset.vala | 147 + gee/abstractqueue.c | 391 + gee/abstractqueue.vala | 65 + gee/abstractset.c | 352 + gee/abstractset.vala | 50 + gee/arraylist.c | 1766 +++++ gee/arraylist.vala | 378 + gee/assemblyinfo.c | 34 + gee/assemblyinfo.vala | 25 + gee/bidiriterator.c | 128 + gee/bidiriterator.vala | 47 + gee/collection.c | 357 + gee/collection.vala | 139 + gee/comparable.c | 86 + gee/comparable.vala | 35 + gee/deque.c | 293 + gee/deque.vala | 122 + gee/functions.c | 182 + gee/functions.vala | 111 + gee/gee-1.0.vapi | 414 ++ gee/gee.h | 998 +++ gee/gee.vala.stamp | 0 gee/hashmap.c | 3646 +++++++++ gee/hashmap.vala | 597 ++ gee/hashmultimap.c | 662 ++ gee/hashmultimap.vala | 74 + gee/hashmultiset.c | 444 ++ gee/hashmultiset.vala | 47 + gee/hashset.c | 1344 ++++ gee/hashset.vala | 276 + gee/iterable.c | 116 + gee/iterable.vala | 43 + gee/iterator.c | 147 + gee/iterator.vala | 73 + gee/linkedlist.c | 2555 +++++++ gee/linkedlist.vala | 625 ++ gee/list.c | 390 + gee/list.vala | 130 + gee/listiterator.c | 153 + gee/listiterator.vala | 50 + gee/map.c | 683 ++ gee/map.vala | 219 + gee/mapiterator.c | 172 + gee/mapiterator.vala | 86 + gee/multimap.c | 295 + gee/multimap.vala | 103 + gee/multiset.c | 144 + gee/multiset.vala | 35 + gee/priorityqueue.c | 4078 ++++++++++ gee/priorityqueue.vala | 1186 +++ gee/queue.c | 247 + gee/queue.vala | 104 + gee/readonlycollection.c | 748 ++ gee/readonlycollection.vala | 172 + gee/readonlylist.c | 779 ++ gee/readonlylist.vala | 165 + gee/readonlymap.c | 1113 +++ gee/readonlymap.vala | 254 + gee/readonlyset.c | 300 + gee/readonlyset.vala | 50 + gee/set.c | 202 + gee/set.vala | 42 + gee/sortedset.c | 328 + gee/sortedset.vala | 129 + gee/timsort.c | 3873 ++++++++++ gee/timsort.vala | 736 ++ gee/treemap.c | 4493 +++++++++++ gee/treemap.vala | 770 ++ gee/treemultimap.c | 592 ++ gee/treemultimap.vala | 62 + gee/treemultiset.c | 421 ++ gee/treemultiset.vala | 43 + gee/treeset.c | 5153 +++++++++++++ gee/treeset.vala | 1078 +++ gitlog-to-changelog | 175 + install-sh | 527 ++ ltmain.sh | 9661 ++++++++++++++++++++++++ m4/libtool.m4 | 8001 ++++++++++++++++++++ m4/ltoptions.m4 | 384 + m4/ltsugar.m4 | 123 + m4/ltversion.m4 | 23 + m4/lt~obsolete.m4 | 98 + missing | 331 + packaging/libgee.changes | 2 + packaging/libgee.spec | 92 + tests/Makefile.am | 87 + tests/Makefile.in | 720 ++ tests/testarraylist.c | 766 ++ tests/testarraylist.vala | 161 + tests/testcase.c | 561 ++ tests/testcase.vala | 80 + tests/testcollection.c | 2455 +++++++ tests/testcollection.vala | 736 ++ tests/testcomparable.c | 258 + tests/testcomparable.vala | 54 + tests/testdeque.c | 873 +++ tests/testdeque.vala | 225 + tests/testhashmap.c | 285 + tests/testhashmap.vala | 76 + tests/testhashmultimap.c | 226 + tests/testhashmultimap.vala | 55 + tests/testhashmultiset.c | 233 + tests/testhashmultiset.vala | 53 + tests/testhashset.c | 285 + tests/testhashset.vala | 70 + tests/testlinkedlist.c | 371 + tests/testlinkedlist.vala | 101 + tests/testlinkedlistasdeque.c | 244 + tests/testlinkedlistasdeque.vala | 49 + tests/testlist.c | 2248 ++++++ tests/testlist.vala | 667 ++ tests/testmain.c | 554 ++ tests/testmain.vala | 46 + tests/testmap.c | 2060 ++++++ tests/testmap.vala | 549 ++ tests/testmultimap.c | 851 +++ tests/testmultimap.vala | 193 + tests/testmultiset.c | 260 + tests/testmultiset.vala | 75 + tests/testpriorityqueue.c | 520 ++ tests/testpriorityqueue.vala | 128 + tests/testqueue.c | 538 ++ tests/testqueue.vala | 137 + tests/testreadonlycollection.c | 780 ++ tests/testreadonlycollection.vala | 225 + tests/testreadonlylist.c | 904 +++ tests/testreadonlylist.vala | 243 + tests/testreadonlymap.c | 825 +++ tests/testreadonlymap.vala | 216 + tests/testreadonlyset.c | 198 + tests/testreadonlyset.vala | 46 + tests/tests.vala.stamp | 0 tests/testset.c | 225 + tests/testset.vala | 58 + tests/testsortedset.c | 4740 ++++++++++++ tests/testsortedset.vala | 979 +++ tests/testtreemap.c | 422 ++ tests/testtreemap.vala | 118 + tests/testtreemultimap.c | 212 + tests/testtreemultimap.vala | 53 + tests/testtreemultiset.c | 223 + tests/testtreemultiset.vala | 49 + tests/testtreeset.c | 720 ++ tests/testtreeset.vala | 111 + 188 files changed, 135351 insertions(+) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 ChangeLog.pre-0-1-5 create mode 100644 INSTALL create mode 100644 MAINTAINERS create mode 100644 Makefile.am create mode 100644 Makefile.decl create mode 100644 Makefile.in create mode 100644 NEWS create mode 100644 README create mode 100644 aclocal.m4 create mode 100644 benchmark/Makefile.am create mode 100644 benchmark/Makefile.in create mode 100644 benchmark/benchmark.c create mode 100644 benchmark/benchmark.vala create mode 100644 benchmark/benchmarks.vala.stamp create mode 100644 benchmark/benchmarksorts.c create mode 100644 benchmark/benchmarksorts.vala create mode 100644 benchmark/mergesort.c create mode 100644 benchmark/mergesort.vala create mode 100755 compile create mode 100755 config.guess create mode 100644 config.h.in create mode 100755 config.sub create mode 100755 configure create mode 100644 configure.ac create mode 100755 depcomp create mode 100644 doc/Makefile.am create mode 100644 doc/Makefile.in create mode 100644 doc/index.wiki create mode 100644 gee-1.0.pc.in create mode 100644 gee/Gee-1.0.gir create mode 100644 gee/Makefile.am create mode 100644 gee/Makefile.in create mode 100644 gee/abstractcollection.c create mode 100644 gee/abstractcollection.vala create mode 100644 gee/abstractlist.c create mode 100644 gee/abstractlist.vala create mode 100644 gee/abstractmap.c create mode 100644 gee/abstractmap.vala create mode 100644 gee/abstractmultimap.c create mode 100644 gee/abstractmultimap.vala create mode 100644 gee/abstractmultiset.c create mode 100644 gee/abstractmultiset.vala create mode 100644 gee/abstractqueue.c create mode 100644 gee/abstractqueue.vala create mode 100644 gee/abstractset.c create mode 100644 gee/abstractset.vala create mode 100644 gee/arraylist.c create mode 100644 gee/arraylist.vala create mode 100644 gee/assemblyinfo.c create mode 100644 gee/assemblyinfo.vala create mode 100644 gee/bidiriterator.c create mode 100644 gee/bidiriterator.vala create mode 100644 gee/collection.c create mode 100644 gee/collection.vala create mode 100644 gee/comparable.c create mode 100644 gee/comparable.vala create mode 100644 gee/deque.c create mode 100644 gee/deque.vala create mode 100644 gee/functions.c create mode 100644 gee/functions.vala create mode 100644 gee/gee-1.0.vapi create mode 100644 gee/gee.h create mode 100644 gee/gee.vala.stamp create mode 100644 gee/hashmap.c create mode 100644 gee/hashmap.vala create mode 100644 gee/hashmultimap.c create mode 100644 gee/hashmultimap.vala create mode 100644 gee/hashmultiset.c create mode 100644 gee/hashmultiset.vala create mode 100644 gee/hashset.c create mode 100644 gee/hashset.vala create mode 100644 gee/iterable.c create mode 100644 gee/iterable.vala create mode 100644 gee/iterator.c create mode 100644 gee/iterator.vala create mode 100644 gee/linkedlist.c create mode 100644 gee/linkedlist.vala create mode 100644 gee/list.c create mode 100644 gee/list.vala create mode 100644 gee/listiterator.c create mode 100644 gee/listiterator.vala create mode 100644 gee/map.c create mode 100644 gee/map.vala create mode 100644 gee/mapiterator.c create mode 100644 gee/mapiterator.vala create mode 100644 gee/multimap.c create mode 100644 gee/multimap.vala create mode 100644 gee/multiset.c create mode 100644 gee/multiset.vala create mode 100644 gee/priorityqueue.c create mode 100644 gee/priorityqueue.vala create mode 100644 gee/queue.c create mode 100644 gee/queue.vala create mode 100644 gee/readonlycollection.c create mode 100644 gee/readonlycollection.vala create mode 100644 gee/readonlylist.c create mode 100644 gee/readonlylist.vala create mode 100644 gee/readonlymap.c create mode 100644 gee/readonlymap.vala create mode 100644 gee/readonlyset.c create mode 100644 gee/readonlyset.vala create mode 100644 gee/set.c create mode 100644 gee/set.vala create mode 100644 gee/sortedset.c create mode 100644 gee/sortedset.vala create mode 100644 gee/timsort.c create mode 100644 gee/timsort.vala create mode 100644 gee/treemap.c create mode 100644 gee/treemap.vala create mode 100644 gee/treemultimap.c create mode 100644 gee/treemultimap.vala create mode 100644 gee/treemultiset.c create mode 100644 gee/treemultiset.vala create mode 100644 gee/treeset.c create mode 100644 gee/treeset.vala create mode 100755 gitlog-to-changelog create mode 100755 install-sh create mode 100644 ltmain.sh create mode 100644 m4/libtool.m4 create mode 100644 m4/ltoptions.m4 create mode 100644 m4/ltsugar.m4 create mode 100644 m4/ltversion.m4 create mode 100644 m4/lt~obsolete.m4 create mode 100755 missing create mode 100644 packaging/libgee.changes create mode 100644 packaging/libgee.spec create mode 100644 tests/Makefile.am create mode 100644 tests/Makefile.in create mode 100644 tests/testarraylist.c create mode 100644 tests/testarraylist.vala create mode 100644 tests/testcase.c create mode 100644 tests/testcase.vala create mode 100644 tests/testcollection.c create mode 100644 tests/testcollection.vala create mode 100644 tests/testcomparable.c create mode 100644 tests/testcomparable.vala create mode 100644 tests/testdeque.c create mode 100644 tests/testdeque.vala create mode 100644 tests/testhashmap.c create mode 100644 tests/testhashmap.vala create mode 100644 tests/testhashmultimap.c create mode 100644 tests/testhashmultimap.vala create mode 100644 tests/testhashmultiset.c create mode 100644 tests/testhashmultiset.vala create mode 100644 tests/testhashset.c create mode 100644 tests/testhashset.vala create mode 100644 tests/testlinkedlist.c create mode 100644 tests/testlinkedlist.vala create mode 100644 tests/testlinkedlistasdeque.c create mode 100644 tests/testlinkedlistasdeque.vala create mode 100644 tests/testlist.c create mode 100644 tests/testlist.vala create mode 100644 tests/testmain.c create mode 100644 tests/testmain.vala create mode 100644 tests/testmap.c create mode 100644 tests/testmap.vala create mode 100644 tests/testmultimap.c create mode 100644 tests/testmultimap.vala create mode 100644 tests/testmultiset.c create mode 100644 tests/testmultiset.vala create mode 100644 tests/testpriorityqueue.c create mode 100644 tests/testpriorityqueue.vala create mode 100644 tests/testqueue.c create mode 100644 tests/testqueue.vala create mode 100644 tests/testreadonlycollection.c create mode 100644 tests/testreadonlycollection.vala create mode 100644 tests/testreadonlylist.c create mode 100644 tests/testreadonlylist.vala create mode 100644 tests/testreadonlymap.c create mode 100644 tests/testreadonlymap.vala create mode 100644 tests/testreadonlyset.c create mode 100644 tests/testreadonlyset.vala create mode 100644 tests/tests.vala.stamp create mode 100644 tests/testset.c create mode 100644 tests/testset.vala create mode 100644 tests/testsortedset.c create mode 100644 tests/testsortedset.vala create mode 100644 tests/testtreemap.c create mode 100644 tests/testtreemap.vala create mode 100644 tests/testtreemultimap.c create mode 100644 tests/testtreemultimap.vala create mode 100644 tests/testtreemultiset.c create mode 100644 tests/testtreemultiset.vala create mode 100644 tests/testtreeset.c create mode 100644 tests/testtreeset.vala diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..7acb618 --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Jürg Billeter diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..5ab7695 --- /dev/null +++ b/COPYING @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +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 and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, 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 library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete 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 distribute a copy of this License along with the +Library. + + 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 Library or any portion +of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +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 Library, 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 Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you 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. + + If distribution of 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 satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be 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. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library 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. + + 9. 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 Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +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 with +this License. + + 11. 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 Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library 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 Library. + +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. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library 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. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser 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 Library +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 Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +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 + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. 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 LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. 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. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..7a9e415 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,744 @@ +2012-11-10 Maciej Piechotka + + Release 0.6.6.1 + +2012-10-14 Maciej Piechotka + + Release 0.6.6 + +2012-10-06 Maciej Piechotka + + Ommited change to fix build + + Fix Iterator.remove in PriorityQueue + +2012-08-06 Maciej Piechotka + + Release 0.6.5 + + Disable introspection during distcheck + +2012-03-07 Sebastian Pölsterl + + Fixed compiler error + 'NULL' was used instead of 'null' + +2012-03-06 Maciej Piechotka + + Don't resize after deletion from hashtable in iterator, fixes #671327 + Depending on sizes of array and hash function resize might alter + the iteration order. It meant that some elements might not be visited + and some might be visited twice. + +2012-01-24 Florian Brosch + + Fix valadoc documentation + +2012-01-22 Maciej Piechotka + + Release 0.6.4 + + Remove --shared-library from .typelib, see bug #667529 for details + + Remove unneeded duplication of NULL definition + +2012-01-20 Maciej Piechotka + + Fix gir_namespace and gir_version attributes, fixes bug #666208 + + Fix compilation with vala master + +2011-12-19 Maciej Piechotka + + Add gir_namespace and gir_version attributes, fixes bug #666208 + Currently they are specified in assemblyinfo.vala which needs to be + first file passed to vala. See bug # 666478 for details. + +2011-11-09 Maciej Piechotka + + Release 0.6.3 + +2011-10-08 Diego Escalante Urrelo + + PriorityQueue: build fix for wrong variable name + Bug #661153 + +2011-09-29 Hisao Suzuki + + PriorityQueue: Fix underflow while updating degree, fixes bug #647162 + +2011-09-14 Maciej Piechotka + + Post-release version bump + + Release 0.6.2.1 + + Add check-news to AM_INIT_AUTOMAKE + + Post-release version bump + + Release 0.6.2 + +2011-04-29 Maciej Piechotka + + Change Gee.TreeSet.Range to class + It fixes problem that may occured when key used as boundary is freed + +2011-04-08 Maciej Piechotka + + Fix adding second element to priority queue, fixes bug #647162 + +2011-02-16 Maciej Piechotka + + Read fix bold text valadoc markup + +2011-02-12 Maciej Piechotka + + Fix monospace text valadoc markup (replace ` by ``) + + Fix bold text valadoc markup (replace ++ by ") + +2011-01-28 Jürg Billeter + + Post-release version bump + + Release 0.6.1 + + Fix memory leak in LinkedList.clear + Based on patch by Travis Reitter, fixes bug 639254. + +2011-01-20 Maciej Piechotka + + Remove depending on order of iteration in read-only collections' test + +2010-11-20 Maciej Piechotka + + Fix memory leak on freeing LinkedList + If fixes issue described in bug #635224 + +2010-09-26 Jürg Billeter + + Post-release version bump + + Release 0.6.0 + +2010-09-18 Maciej Piechotka + + Change return_if_fail into assert in remove_at of LinkedList. + It fixes build issue described in bug #629933 and make the behavior + compatible with ArrayList. + +2010-09-16 Jürg Billeter + + Post-release version bump + + Release 0.5.3 + +2010-08-26 Maciej Piechotka + + Fix memory leak in TimSort + This patch converts using of pointers into proper use of weak and normal + references and adds the destructor to Gee.TimSort.Slice. + +2010-08-03 Maciej Piechotka + + Fix memory leak in Gee.LinkedList + + Fix typos in TreeMap and TreeSet fix and other embarrasing mistakes + + Fix the unfreeing on clear in TreeMap/TreeSet + +2010-08-02 Didier 'Ptitjes + + Post-release version bump + + Release 0.5.2 + + Implement typed variants for Collection.to_array + Fixes bug 597737. + + Make [Deprecated] all Map methods previously marked as such in documentation + + Fix doc comment and make sort_with_data deprecated in documentation + +2010-08-01 Maciej Piechotka + + Increase stamp on Map.set in Gee.TreeMap + +2010-07-30 Zeeshan Ali (Khattak) + + Add ArrayList.sort_with_data + Add a variant of List.sort that takes CompareDataFunc rather than + CompareFunc so compare func could be a method or closure. We are + adding this to ArrayList rather than List to not break the API/ABI. + In 0.7.x, this method will be removed as List.sort will then do + exactly the same. + +2010-07-27 Maciej Piechotka + + Fix lack of unsetting _first and _last in TreeSet on Set.clear() + +2010-07-15 Maciej Piechotka + + Clean configure.ac + + Various small fixes for build system. Fixes bug 624389 + * Add rules for Gee-1.0.gir and gee-internals-1.0.vapi + * Clean all vala-generated files in maintainer mode + * Clean typelib + +2010-07-13 Colin Walters + + [autogen.sh] Support parameters to configure + +2010-07-12 Maciej Piechotka + + [autogen.sh] Don't run configure twice + +2010-07-12 Rob Taylor + + Build typelib for gobject-introspection + +2010-07-11 Maciej Piechotka + + Change build system + Fixes bug 617356 + + Add myself to libgee.doap + +2010-06-29 Colin Walters + + [autogen.sh] Support NOCONFIGURE, like gnome-common + +2010-06-15 Jürg Billeter + + Post-release version bump + + Release 0.5.1 + +2010-04-02 Yaakov Selkowitz + + Fix shared library build on Windows + Fixes bug 601629. + +2010-04-02 Maciej Piechotka + + Fix count equal in *MultiSet + Fixes bug 596869. + + Fix remove in MapIterator + Fixes bug 596851. + + Tests are not terminated when they fail in trap + When code in trap succeeds subprocess should be terminated - not only + test case. + + Fixes bug 596703. + + Fixes checking for emptiness of subsets when master set is empty + Fixes bug 596671. + +2010-04-02 Florian Brosch + + Fix documentation comments + +2010-03-21 Jürg Billeter + + Fix build with vala master + +2009-10-24 Didier 'Ptitjes + + Post-release version bump + + TimSort: Fix sort of reference counted items + +2009-09-28 Didier 'Ptitjes + + Release 0.5.0 + + Update library's interface to 2:0:0 + + Fix the documentation of all implementations' constructor + Fixes bug 592817. + + Update .gitignore + + Some more documentation enhancements + + Make some style consistence enhancements + +2009-09-28 Maciej Piechotka + + Replace old-style asserts in tests + + Add tests for Map.entries + +2009-09-28 Didier 'Ptitjes + + Implement TreeMultiMap + + Enhance multimap's tests + + Extract AbstractMultiMap from HashMultiMap + + Various documentation enhancements + + Fix {@inheritDoc} tags + + Fix filenames in file headers + +2009-09-28 Maciej Piechotka + + Introduce the SortedSet interface and implement it in TreeSet + + Add missing DEBUG section + +2009-09-27 Didier 'Ptitjes + + Make the coverage analysis on Vala code insteead of C code + +2009-09-26 Didier 'Ptitjes + + Fix TestCase against Vala master + + Fix PriorityQueue implementation + The implementation was broken. The unused code, because we do not provide + a queue merge operation, was put inside #if false directives and left in case we + want to support that in the future. The debug code was enhanced too. + +2009-09-26 Maciej Piechotka + + Fix move_red_right and move_red_left in the Tree implementations + Fixes bug 595703. + + Also: + - For simplification move to 2-3 LLRB tree. + - Add CONSTSTENCY_CHECK and DEBUG options + + Add more add and remove tests + +2009-09-25 Didier 'Ptitjes + + Fix a bug in PriorityQueue's iterator + + Fix warnings due to comparison to strcmp + + Use silent rules for users of automake 1.11 + + Fix some missing pointer casts + +2009-09-24 Didier 'Ptitjes + + Fix item count decrementation on removal in AbstractMultiSet + + Introduce Map.key_type and Map.value_type + + Introduce immutable empty collection, list, set and map + +2009-09-23 Didier 'Ptitjes + + Make Map be an Iterable> + + Implement TreeMultiSet + Fixes bug 594940. + + Extract AbstractMultiSet from HashMultiSet + + Introduce MapIterator and implement it in HashMap and TreeMap + +2009-09-23 Maciej Piechotka + + Fix the iterators of the TreeMap and TreeSet implementations + +2009-09-21 Didier 'Ptitjes + + Enhance the tests for the ReadOnly* implementations + +2009-09-20 Didier 'Ptitjes + + Reuse the keys, values and entries view instances where possible + We use the same mechanism as for the read-only views. + + Introduce the Map.Entry class and the Map.entries property + We also use Map.entries to optimize the implementations of + set_all, has_all and HashMultiMap by avoiding the common pattern: + iterate on keys and for each key get the associated value. + + Introduce the Map.has (K key, V value) method + Also we use Map.has to fix the implementation of has_all. + + Modify the Map interface API + We do apply the following renaming: + - remove to unset + - contains to has_key + - remove_all to unset_all + - contains_all to has_all + + Old methods are documented as deprecated. + + Also get_keys() and get_values() are transformed into properties. + +2009-09-20 Maciej Piechotka + + Fix fix_up method in the TreeSet and TreeMap implementations + Fixes bug 595703. + +2009-09-20 Didier 'Ptitjes + + Add a dependency to gee's vapi in tests' Makefile + + Introduce the Comparable interface and provide a CompareFunc for it + +2009-09-19 Didier 'Ptitjes + + Remove unusefull private setter only and construct only properties + + Fix first() and last() signatures in AbstractList + +2009-09-16 Didier 'Ptitjes + + Refactor the Set implementations' tests + Fixes bug 594241. + + Fix some bugs in TreeSet implementation + Fixes part of bug 594868. + + The access to child nodes two level deeper does not check that the + child at the intermediate level is not null. + Also has_next was incorrectly handled in case of an empty set. + + Remove construct block in HashSet + Removing construct block enables the use of Vala's constructor chain up. + + Make Functions class a namespace and fix copyright and authorship + +2009-09-15 Didier 'Ptitjes + + Introduce the ListIterator interface and make lists implement it + +2009-09-15 Maciej Piechotka + + Introduce the BidirIterator interface + +2009-09-15 Didier 'Ptitjes + + Introduce remove method to the Iterator interface + + Add has_next and first methods to the Iterator interface + +2009-09-15 Maciej Piechotka + + Fix and improve the TreeMap and TreeSet implementations + +2009-09-14 Didier 'Ptitjes + + Fix read-only view unique instance test + + Fix benchmark's build with vala master + +2009-09-14 Jürg Billeter + + Fix build with vala master + +2009-09-14 Didier 'Ptitjes + + Add some tests for List.slice + + Fix List.get API contract and fix implementations accordingly + + Add tests for GObject properties + + Introduce PriorityQueue implementation of the Queue interface + + Use non-nullable capacities and a constant to specify unbounded + + Make Slice a private inner class of TimSort + Inline methods are now inlined correctly by gcc. + +2009-09-11 Julien Peeters + + Refactor the Map implementations' tests + Fixes part of bug 594241. + + Fix a bug in TreeMap implementation + Fixes part of bug 594868. + + The access to child nodes two level deeper does not check that the + child at the intermediate level is not null. + + Change the Iterator.get method signature and fix implementations + Fixes part of bug 594868. + + Change the return type of the Iterator.get method from G? to G and + apply those changes to implementations: ArrayList, HashMap, + HashMultiSet, HashSet, LinkedList, TreeMap, TreeSet. + + Improve the access to first and last elements in LinkedList + Fixes part of bug 594868. + + The signature of first and last properties in List did not take in account the + fact that lists permit null elements. Their type has been changed from G? to G + to reflect this. + + Also we optimized the access to first and last elements in LinkedList, which can + be made through head and tail pointers directly. + + Improve the read-only view property by using weak pointers + Fixes bug 594758. + + By using weak pointers the read-only view is destroyed when there is no + references to it anymore. + +2009-09-11 Didier 'Ptitjes + + Introduce Queue and Deque interfaces, and implement them in LinkedList + + Make List.remove_at return the removed element + + DÃefinitiely remove trailing whitespaces + +2009-09-10 Didier 'Ptitjes + + Make TimSort a GObject + + Setup test code coverage with lcov + Code coverage analysis is enabled with --enable-coverage. + + Add missing --library in addition to --vapi in gee/Makefile + The --gir option is not activated is --library is missing. + +2009-09-09 Julien Peeters + + Hide read-only views and make them accessible through a property + Fixes bug 594578. + + A new read_only_view property is introduced in the Collection, List, Set and Map + interfaces. The AbstractSet class is introduced to put the common code for the + read_only_view property. + +2009-09-09 Didier 'Ptitjes + + Introduce benchmarks + + Introduce TimSort and the public sorting API + +2009-09-07 Maciej Piechotka + + Remove possibility of passing null to constructors of ReadOnly* classes + Fixes bug 590305. + +2009-09-07 Tomaž Vajngerl + + Change ReadOnlySet to inherit from ReadOnlyCollection. + Fixes part of bug 590677. + + Change ReadOnlyList to inherit from ReadOnlyCollection. + Fixes part of bug 590677. + +2009-09-07 Didier 'Ptitjes + + Fix ReadOnlyCollection and ReadOnlyMap encapsulation failure + +2009-09-07 Tomaž Vajngerl + + Add tests for ReadOnlyCollection and ReadOnlyList + Fixes part of bug 590677. + + Contains missing tests for ReadOnlyCollection and ReadOnlyList following + the new tests implementation. + +2009-09-06 Ali Sabil + + Introduce the MultiMap interface and its hash based implementation + + Introduce the MultiSet interface and its hash based implementation + +2009-09-06 Julien Peeters + + Reuse generic Collection and List tests for LinkedList + LinkedList tests now follow the same way of testing than ArrayList ones. + LinkedList tests inherit from the ListTests. + + Fix misunderstanding about ArrayList.{retain,remove}_all semantics + These methods did not match the semantic of the Collection interface ones. + Then they are deleted in order to use the implementation in + AbstractCollection. + + By the way, few optimization could probably be found for these methods in + the case of ArrayList. + + Add generic tests for collections and lists and refactor ArrayListTests + Fixes part of bug 594241. + + Some more enhancements to the test infrastructure + TestCase is a more appropriate name, and so are set_up and tear_down. + + Adding a short descriptive introduction for each implementation class. + Generally this introduction consists of a implementation description and + few word about comparison with other structures. + + Adding a first very basic documentation to data types implementations. + When a data type method is already documented in a super class or + in an interface the '@inheritDoc' parameter is set. + +2009-09-04 Didier 'Ptitjes + + Initial documentation infrastructure import + + Fixing generics typo in HashMap's Value collection + +2009-09-03 Didier 'Ptitjes + + Change inner classes' properties from construct to private set + Removing construct properties enables the use of Vala's constructor chain up. + +2009-09-02 Didier 'Ptitjes + + Provide sane defaults for equal, hash and compare functions + + Change *_func properties from construct to private set + Removing construct properties enables to use Vala's constructor chain up. + +2009-08-05 Didier 'Ptitjes + + Post-release version bump + + Release 0.3.0 + + Enhanced Map removal to optionally retrieve removed value + Fixes bug 587134. + + Remove invalid to_array implementation and re-enable test + +2009-08-03 Didier 'Ptitjes + + Bump library's version info + +2009-07-31 Didier 'Ptitjes + + Temporarily disable to_array test + +2009-07-31 Tomaž Vajngerl + + Add Map.is_empty|set_all|remove_all|contains_all and AbstractMap implementations + Fixes bug 589902. + + Add List.first|last|insert_all methods and AbstractList implementations + Fixes bug 589894. + + Added Collection.is_empty|add_all|contains_all|remove_all|retain_all + Fixes bug 589690. + +2009-07-31 Maciej Piechotka + + Make Iterable.get_element_type a property + Fixes bug 589551. + +2009-07-31 Didier 'Ptitjes + + Remove unused inherited interface declarations + + Fix list of maintainers + +2009-07-27 Didier 'Ptitjes + + Fix invalid test commit + +2009-07-27 Julien Peeters + + Make TestFixture's setup and teardown methods virtual + +2009-07-27 Didier 'Ptitjes + + Initial rework for tests + + Fix AbstractCollection.to_array method + +2009-07-27 Julien Peeters + + Add test fixture helper + +2009-07-24 Didier 'Ptitjes + + Introduce Collection.to_array() method + A default naive implementation is provided in AbstractCollection. This + implementation is overriden in ArrayList in order to take benefit of its array + nature. + + Introduce AbstractCollection base class + All collection implementations now have a common AbstractCollection base class + and now share the implementation of the get_element_type() method. + +2009-07-23 Didier 'Ptitjes + + Remove unused variable in tests + + Fix generic parameter typo + +2009-07-23 Mark Lee + + Add doubly linked list implementation + Fixes bug 584032. + +2009-07-22 Maciej Piechotka + + Make func and wrappee properties non-updatable + Fixes bug 583723. + + Add left-leaning red-black tree based set and map + Fixes bug 583728. + +2009-07-22 Didier 'Ptitjes + + Post-release version bump + + Release 0.2.0 + + Hardcode gir repository path + Use of pkg-config make distcheck fail. + +2009-07-20 Didier 'Ptitjes + + Match vala-0.7.4's required GLib version + + Generate, install and distribute GIR file + + Post-release version bump + + Release 0.1.6 + +2009-07-19 Julien Fontanet + + Make ArrayList.Iterator._stamp private + + Split asserts in ArrayList + +2009-07-19 Didier 'Ptitjes + + Hide inherited get and set methods from GLib.Object + + Add missing method documentation comment + +2009-07-16 Didier 'Ptitjes + + Initialize 'next' variables + Fixes bug 588758. + +2009-06-26 Jaap A. Haitsma + + Add .gitignore + Fixes bug #583729 + + Add .doap file + +2009-06-01 Jürg Billeter + + gee: Fix memory leak in HashMap.remove and HashSet.remove + Fixes bug 584440. + +2009-04-30 Jürg Billeter + + Update code using deprecated # modifier or operator + + Fix build with Vala 0.7 + Based on patch by Thijs Vermeir, fixes bug 579182. diff --git a/ChangeLog.pre-0-1-5 b/ChangeLog.pre-0-1-5 new file mode 100644 index 0000000..08aac74 --- /dev/null +++ b/ChangeLog.pre-0-1-5 @@ -0,0 +1,186 @@ +2009-02-21 Jürg Billeter + + * configure.ac: Post-release version bump + +2009-02-21 Jürg Billeter + + * NEWS: update for 0.1.5 release + +2009-02-21 Jürg Billeter + + * tests/testarraylist.vala: + + Fix test cases to avoid testing for implementation details + +2009-01-27 Jürg Billeter + + * gee/arraylist.vala: + * gee/list.vala: + * gee/readonlylist.vala: + + Add List.slice method, patch by Zeeshan Ali Khattak, + fixes bug 569188 + +2008-11-01 Jürg Billeter + + * configure.ac: Post-release version bump + +2008-11-01 Jürg Billeter + + * NEWS: update for 0.1.4 release + +2008-05-30 Jürg Billeter + + * gee/hashmap.vala: + * gee/hashset.vala: + + Use [Compact] for the HashMap.Node and HashSet.Node classes + +2008-05-30 Jürg Billeter + + * tests/testarraylist.vala: remove invalid type tests as these + cause compile errors with recent Vala versions + +2008-05-07 Jürg Billeter + + * gee/Makefile.am: + * tests/Makefile.am: + + Update build system to use valac -C, + patch by Jaap A. Haitsma, fixes bug 531224 + +2008-05-01 Jürg Billeter + + * configure.ac: Post-release version bump + +2008-05-01 Jürg Billeter + + * NEWS: update for 0.1.3 release + +2008-05-01 Jürg Billeter + + * tests/testarraylist.vala: + * tests/testhashmap.vala: + * tests/testhashset.vala: + + Extend test suite, based on patch by Quikee + +2008-04-14 Jürg Billeter + + * gee/arraylist.vala, gee/hashmap.vala, gee/hashset.vala, + gee/iterator.vala, gee/list.vala, gee/map.vala, + gee/readonlycollection.vala, gee/readonlylist.vala, + gee/readonlymap.vala, gee/readonlyset.vala: mark types as + nullable where appropriate + +2008-04-13 Jürg Billeter + + * gee/arraylist.vala, gee/hashmap.vala, gee/hashset.vala, + gee/readonlycollection.vala, gee/readonlylist.vala, + gee/readonlymap.vala, gee/readonlyset.vala: remove deprecated + syntax for construct parameters + +2008-04-13 Jürg Billeter + + * gee/arraylist.vala, gee/hashmap.vala, gee/hashset.vala: remove + obsolete non-null type syntax + +2008-03-08 Jürg Billeter + + * configure.ac: Post-release version bump + +2008-03-08 Jürg Billeter + + * NEWS: update for 0.1.2 release + +2008-03-08 Jürg Billeter + + * tests/Makefile.am: dist all source files + +2008-02-26 Jürg Billeter + + * Makefile.am, Makefile.decl, configure.ac, gee/Makefile.am, + tests/Makefile.am, tests/testarraylist.vala, + tests/testhashmap.vala, tests/testhashset.vala: add unit tests + +2008-02-26 Jürg Billeter + + * gee/hashset.vala: fix iterator, patch by Ali Sabil + +2008-02-05 Jürg Billeter + + * gee/hashmap.vala, gee/readonlycollection.vala, gee/readonlylist.vala, + gee/readonlymap.vala, gee/readonlyset.vala: remove unreachable + return statements + +2008-01-22 Jürg Billeter + + * gee/hashmap.vala, gee/hashset.vala: fix invalid variable initializers + +2008-01-22 Jürg Billeter + + * configure.ac: Post-release version bump + +2008-01-22 Jürg Billeter + + * NEWS: update for 0.1.1 release + +2008-01-22 Jürg Billeter + + Update svn:ignore property. + +2008-01-22 Jürg Billeter + + * gee/arraylist.vala, gee/hashmap.vala, gee/hashset.vala, + gee/iterable.vala, gee/readonlycollection.vala, gee/readonlylist.vala, + gee/readonlyset.vala: add get_element_type method to Gee.Iterable + +2008-01-22 Jürg Billeter + + * gee/hashmap.vala, gee/hashset.vala: remove unneeded type casts + + * gee/Makefile.am: don't use filter function in makefiles as it's a + GNU make extension + +2007-12-15 Jürg Billeter + + * gee/hashmap.vala, gee/hashset.vala: update for vala trunk + +2007-11-03 Jürg Billeter + + * gee/Makefile.am: update for vala 0.1.4 + +2007-09-07 Jürg Billeter + + * update license headers to the GNU Lesser General Public License, + version 2.1 or later + +2007-08-30 Jürg Billeter + + * gee/hashmap.vala, gee/hashset.vala: replace reference-type structs + by classes + +2007-08-30 Jürg Billeter + + * gee/arraylist.vala, gee/hashmap.vala, gee/hashset.vala, + gee/iterable.vala, gee/iterator.vala, gee/list.vala, gee/map.vala, + gee/readonlycollection.vala, gee/readonlylist.vala, + gee/readonlymap.vala, gee/readonlyset.vala: explicitly subtype + GLib.Object to support future versions of Vala + +2007-07-27 Jürg Billeter + + * configure.ac: Post-release version bump + +2007-07-27 Jürg Billeter + + * NEWS: update for 0.1.0 release + +2007-07-27 Jürg Billeter + + * gee/Makefile.am: distribute gee.vala to fix build without valac + +2007-07-27 Jürg Billeter + + * configure.ac: fix package name + diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..5458714 --- /dev/null +++ b/INSTALL @@ -0,0 +1,234 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006 Free Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + +Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + +Installation Names +================== + +By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + +Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + +Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/MAINTAINERS b/MAINTAINERS new file mode 100644 index 0000000..338a52d --- /dev/null +++ b/MAINTAINERS @@ -0,0 +1,11 @@ +Jürg Billeter +E-mail: j@bitron.ch +Userid: juergbi + +Didier Villevalois +E-mail: ptitjes@free.fr +Userid: dvillevalois + +Maciej Piechotka +E-mail: uzytkownik2@gmail.com +Userid: mpiechotka diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..55dacaa --- /dev/null +++ b/Makefile.am @@ -0,0 +1,58 @@ +include $(top_srcdir)/Makefile.decl +ACLOCAL_AMFLAGS = -I m4 +AM_DISTCHECK_CONFIGURE_FLAGS = --enable-introspection=no + +if ENABLE_DOC +DOC_SUBDIR = \ + doc \ + $(NULL) +endif + +if ENABLE_BENCHMARK +BENCHMARK_SUBDIR = \ + benchmark \ + $(NULL) +endif + +SUBDIRS = \ + gee \ + tests \ + $(DOC_SUBDIR) \ + $(BENCHMARK_SUBDIR) \ + $(NULL) + +if ENABLE_COVERAGE +coverage: + $(MAKE) -C tests coverage-reset + $(MAKE) -C tests test + $(MAKE) -C tests coverage-report +else +coverage: + @echo "The project has not been configured for coverage, check that you have gcov, lcov." + @echo "Of course, do not use --disable-coverage" + @exit 1 +endif +.PHONY: coverage + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = gee-1.0.pc + +dist-hook: gen-ChangeLog + +gen_start_date = 2009-04-30 +.PHONY: gen-ChangeLog +gen-ChangeLog: + if test -d .git; then \ + $(top_srcdir)/gitlog-to-changelog \ + --since=$(gen_start_date) > $(distdir)/cl-t; \ + rm -f $(distdir)/ChangeLog; \ + mv $(distdir)/cl-t $(distdir)/ChangeLog; \ + fi + +EXTRA_DIST += \ + ChangeLog.pre-0-1-5 \ + gitlog-to-changelog \ + MAINTAINERS \ + gee-1.0.pc.in \ + $(NULL) + diff --git a/Makefile.decl b/Makefile.decl new file mode 100644 index 0000000..20ad96d --- /dev/null +++ b/Makefile.decl @@ -0,0 +1,57 @@ +# GLIB - Library of useful C routines + +GTESTER = gtester +GTESTER_REPORT = gtester-report + +# initialize variables for unconditional += appending +EXTRA_DIST = +TEST_PROGS = + +### testing rules + +# test: run all tests in cwd and subdirs +test: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} + @ for subdir in $(SUBDIRS) . ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done +# test-report: run tests in subdirs and generate report +# perf-report: run tests in subdirs with -m perf and generate report +# full-report: like test-report: with -m perf and -m slow +test-report perf-report full-report: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || { \ + case $@ in \ + test-report) test_options="-k";; \ + perf-report) test_options="-k -m=perf";; \ + full-report) test_options="-k -m=perf -m=slow";; \ + esac ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \ + elif test -n "${TEST_PROGS}" ; then \ + ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \ + fi ; \ + } + @ ignore_logdir=true ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \ + ignore_logdir=false ; \ + fi ; \ + for subdir in $(SUBDIRS) . ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done ; \ + $$ignore_logdir || { \ + echo '' > $@.xml ; \ + echo '' >> $@.xml ; \ + for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \ + sed '1,1s/^?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \ + done ; \ + echo >> $@.xml ; \ + echo '' >> $@.xml ; \ + rm -rf "$$GTESTER_LOGDIR"/ ; \ + ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \ + } +.PHONY: test test-report perf-report full-report +# run make test as part of make check +check-local: test diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..d5103dc --- /dev/null +++ b/Makefile.in @@ -0,0 +1,955 @@ +# Makefile.in generated by automake 1.11.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# GLIB - Library of useful C routines + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(srcdir)/gee-1.0.pc.in $(top_srcdir)/Makefile.decl \ + $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ + compile config.guess config.sub depcomp install-sh ltmain.sh \ + missing +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = gee-1.0.pc +CONFIG_CLEAN_VPATH_FILES = +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(pkgconfigdir)" +DATA = $(pkgconfig_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir dist dist-all distcheck +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = gee tests doc benchmark +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COVERAGE_CFLAGS = @COVERAGE_CFLAGS@ +COVERAGE_LIBS = @COVERAGE_LIBS@ +COVERAGE_VALAFLAGS = @COVERAGE_VALAFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LCOV = @LCOV@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGEE_LT_VERSION = @LIBGEE_LT_VERSION@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VALAC = @VALAC@ +VALADOC = @VALADOC@ +VALAFLAGS = @VALAFLAGS@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +GTESTER = gtester +GTESTER_REPORT = gtester-report + +# initialize variables for unconditional += appending +EXTRA_DIST = ChangeLog.pre-0-1-5 gitlog-to-changelog MAINTAINERS \ + gee-1.0.pc.in $(NULL) +TEST_PROGS = +ACLOCAL_AMFLAGS = -I m4 +AM_DISTCHECK_CONFIGURE_FLAGS = --enable-introspection=no +@ENABLE_DOC_TRUE@DOC_SUBDIR = \ +@ENABLE_DOC_TRUE@ doc \ +@ENABLE_DOC_TRUE@ $(NULL) + +@ENABLE_BENCHMARK_TRUE@BENCHMARK_SUBDIR = \ +@ENABLE_BENCHMARK_TRUE@ benchmark \ +@ENABLE_BENCHMARK_TRUE@ $(NULL) + +SUBDIRS = \ + gee \ + tests \ + $(DOC_SUBDIR) \ + $(BENCHMARK_SUBDIR) \ + $(NULL) + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = gee-1.0.pc +gen_start_date = 2009-04-30 +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.decl $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/Makefile.decl: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @if test ! -f $@; then rm -f stamp-h1; else :; fi + @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +gee-1.0.pc: $(top_builddir)/config.status $(srcdir)/gee-1.0.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @case `sed 15q $(srcdir)/NEWS` in \ + *"$(VERSION)"*) : ;; \ + *) \ + echo "NEWS not updated; not releasing" 1>&2; \ + exit 1;; \ + esac + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod u+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-local +check: check-recursive +all-am: Makefile $(DATA) config.h +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(pkgconfigdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-pkgconfigDATA + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-pkgconfigDATA + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check-am \ + ctags-recursive install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am check-local clean \ + clean-generic clean-libtool ctags ctags-recursive dist \ + dist-all dist-bzip2 dist-gzip dist-hook dist-lzip dist-lzma \ + dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-pkgconfigDATA + + +### testing rules + +# test: run all tests in cwd and subdirs +test: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} + @ for subdir in $(SUBDIRS) . ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done +# test-report: run tests in subdirs and generate report +# perf-report: run tests in subdirs with -m perf and generate report +# full-report: like test-report: with -m perf and -m slow +test-report perf-report full-report: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || { \ + case $@ in \ + test-report) test_options="-k";; \ + perf-report) test_options="-k -m=perf";; \ + full-report) test_options="-k -m=perf -m=slow";; \ + esac ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \ + elif test -n "${TEST_PROGS}" ; then \ + ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \ + fi ; \ + } + @ ignore_logdir=true ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \ + ignore_logdir=false ; \ + fi ; \ + for subdir in $(SUBDIRS) . ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done ; \ + $$ignore_logdir || { \ + echo '' > $@.xml ; \ + echo '' >> $@.xml ; \ + for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \ + sed '1,1s/^?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \ + done ; \ + echo >> $@.xml ; \ + echo '' >> $@.xml ; \ + rm -rf "$$GTESTER_LOGDIR"/ ; \ + ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \ + } +.PHONY: test test-report perf-report full-report +# run make test as part of make check +check-local: test + +@ENABLE_COVERAGE_TRUE@coverage: +@ENABLE_COVERAGE_TRUE@ $(MAKE) -C tests coverage-reset +@ENABLE_COVERAGE_TRUE@ $(MAKE) -C tests test +@ENABLE_COVERAGE_TRUE@ $(MAKE) -C tests coverage-report +@ENABLE_COVERAGE_FALSE@coverage: +@ENABLE_COVERAGE_FALSE@ @echo "The project has not been configured for coverage, check that you have gcov, lcov." +@ENABLE_COVERAGE_FALSE@ @echo "Of course, do not use --disable-coverage" +@ENABLE_COVERAGE_FALSE@ @exit 1 +.PHONY: coverage + +dist-hook: gen-ChangeLog +.PHONY: gen-ChangeLog +gen-ChangeLog: + if test -d .git; then \ + $(top_srcdir)/gitlog-to-changelog \ + --since=$(gen_start_date) > $(distdir)/cl-t; \ + rm -f $(distdir)/ChangeLog; \ + mv $(distdir)/cl-t $(distdir)/ChangeLog; \ + fi + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..f935a61 --- /dev/null +++ b/NEWS @@ -0,0 +1,166 @@ +libgee 0.6.6.1 +============== + + * Rebuild package with fixed Vala compiler + +libgee 0.6.6 +============ + + * Fix Iterator.remove in PriorityQueue + +libgee 0.6.5 +============ + + * Prevent hashtables from resizing during iteration + +libgee 0.6.4 +============ + + * Fix compilation with vala master + * Fix creation of GObject introspection files + +libgee 0.6.3 +============ + + * Fix buffer underflow. + +libgee 0.6.2.1 +============== + + * Add check-news to AM_INIT_AUTOMAKE + +libgee 0.6.2 +============ + + * Fix adding second element to priority queue. + * Fix problem with key used in range is freed. + +libgee 0.6.1 +============ + + * Fix memory leaks in LinkedList. + +libgee 0.6.0 +============ + + * Fix compiler warning. + +libgee 0.5.3 +============ + + * Fix memory leaks in TimSort and LinkedList. + * Bug fixes in TreeMap and TreeSet. + +libgee 0.5.2 +============ + + * Build system enhancements to conform Gnome's style. + * Bug fixes in TreeSet, TreeMap and Collection.to_array. + * Deprecated Map methods marked with [Deprecated]. + +libgee 0.5.1 +============ + + * Bug fixes in HashMultiSet, TimSort, TreeMap, TreeMultiSet, and TreeSet. + * Fix build with Vala 0.8.0 and later. + * Fix build on Windows. + * Fix subprocess handling in test infrastructure. + +libgee 0.5.0 +============ + + * API changes + * Introduce Functions hash, equal and compare function factory + * Introduce Comparable interface + * Implementations provides sane defaults when constructed without functions + * ReadOnly* made internal in favor of a `read_only_view` properties + * Iterator is now mutable and resettable + * Introduction of BidirIterator bidirectional iterators + * List.list_iterator () returns a specialized ListIterator + * Various API contracts clarifications and enhancements + * Introduce List.sort () with TimSort implementation + * Complete Map API rework + * Introduce Queue and Deque interfaces + * Introduce MultiSet and MultiMap interfaces (Ali Sabil) + * Introduce SortedSet interface (Maciej Pietchotka) + + * New implementations + * HashMultiSet and HashMultiMap (Ali Sabil) + * TreeMultiSet and TreeMultiMap. + * PriorityQueue + * LinkedList now implements Deque + * TreeSet now implements SortedSet (Maciej Pietchotka) + + * Infrastructure + * New test framework and complete tests refactoring (Julien Peters) + * New doc/ documentation directory (--enable-doc) + * Test coverage analysis using lcov (--enable-coverage) + * Basic benchmark framework and sort benchmark (--enable-benchmark) + * Use silent rules by default for users of automake 1.11 + + * Code Quality + * Many bug fixes + * Many optimizations + * Lots of additional documentation + * Better overall encapsulation, dangerous public setters have been removed + * Better test coverage (more than 90%) + +libgee 0.4.0 +============ + + * Bug fixes. + +libgee 0.3.0 +============ + + * Introduce AbstractCollection, AbstractList and AbstractMap base classes. + * Add new properties and methods to Collection, List and Map. (Tomaž Vajngerl) + * Add LinkedList implementation. (Mark Lee) + * Add TreeSet and TreeMap implementations. (Maciej Piechotka) + * Iterable.element_type is now a property. + * Map.remove now takes an optional parameter to retrieve the removed value. + * Bump library version info to reflect API/ABI breakage + +libgee 0.2.0 +============ + + * Generate GIR file. + +libgee 0.1.6 +============ + + * Fix build for Vala 0.7. + * Bug fixes. + +libgee 0.1.5 +============ + + * Add slice method to Gee.List. + +libgee 0.1.4 +============ + + * Update for Vala 0.3.3. + +libgee 0.1.3 +============ + + * More unit tests. + * Update for Vala 0.3.1. + +libgee 0.1.2 +============ + + * Add unit tests. + * Bug fixes. + +libgee 0.1.1 +============ + + * Add get_element_type method to Gee.Iterable. + * Update for Vala 0.1.6. + +libgee 0.1.0 +============ + + * Initial release. diff --git a/README b/README new file mode 100644 index 0000000..9236473 --- /dev/null +++ b/README @@ -0,0 +1,20 @@ +libgee is a collection library providing GObject-based interfaces and +classes for commonly used data structures. + +libgee provides the following interfaces: + + * Iterable + * Collection + * List + * Set + * Iterator + * Map + +The ArrayList, HashSet, and HashMap classes provide a reasonable sample +implementation of the List, Set, and Map interfaces. ReadOnlyCollection, +ReadOnlyList, ReadOnlySet, and ReadOnlyMap are read-only wrapper classes +that prevent modification of the underlying collection. + +libgee is written in Vala and can be used like any GObject-based C library. +It's planned to provide bindings for further languages. + diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..c0c1567 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,1325 @@ +# generated automatically by aclocal 1.11.6 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, +# Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +dnl -*- mode: autoconf -*- +dnl Copyright 2009 Johan Dahlin +dnl +dnl This file is free software; the author(s) gives unlimited +dnl permission to copy and/or distribute it, with or without +dnl modifications, as long as this notice is preserved. +dnl + +# serial 1 + +m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL], +[ + AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first + AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first + AC_BEFORE([LT_INIT],[$0])dnl setup libtool first + + dnl enable/disable introspection + m4_if([$2], [require], + [dnl + enable_introspection=yes + ],[dnl + AC_ARG_ENABLE(introspection, + AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]], + [Enable introspection for this build]),, + [enable_introspection=auto]) + ])dnl + + AC_MSG_CHECKING([for gobject-introspection]) + + dnl presence/version checking + AS_CASE([$enable_introspection], + [no], [dnl + found_introspection="no (disabled, use --enable-introspection to enable)" + ],dnl + [yes],[dnl + PKG_CHECK_EXISTS([gobject-introspection-1.0],, + AC_MSG_ERROR([gobject-introspection-1.0 is not installed])) + PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], + found_introspection=yes, + AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME])) + ],dnl + [auto],[dnl + PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no) + dnl Canonicalize enable_introspection + enable_introspection=$found_introspection + ],dnl + [dnl + AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@]) + ])dnl + + AC_MSG_RESULT([$found_introspection]) + + INTROSPECTION_SCANNER= + INTROSPECTION_COMPILER= + INTROSPECTION_GENERATE= + INTROSPECTION_GIRDIR= + INTROSPECTION_TYPELIBDIR= + if test "x$found_introspection" = "xyes"; then + INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` + INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` + INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0` + INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0` + INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" + INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0` + INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0` + INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection + fi + AC_SUBST(INTROSPECTION_SCANNER) + AC_SUBST(INTROSPECTION_COMPILER) + AC_SUBST(INTROSPECTION_GENERATE) + AC_SUBST(INTROSPECTION_GIRDIR) + AC_SUBST(INTROSPECTION_TYPELIBDIR) + AC_SUBST(INTROSPECTION_CFLAGS) + AC_SUBST(INTROSPECTION_LIBS) + AC_SUBST(INTROSPECTION_MAKEFILE) + + AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes") +]) + + +dnl Usage: +dnl GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version]) + +AC_DEFUN([GOBJECT_INTROSPECTION_CHECK], +[ + _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1]) +]) + +dnl Usage: +dnl GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version]) + + +AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE], +[ + _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require]) +]) + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant . +# +# 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES + +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software +# Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.11' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.11.6], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.11.6])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, +# 2010, 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 12 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 5 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 16 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.62])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl +dnl The `parallel-tests' driver may need to know about EXEEXT, so add the +dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl +]) + +dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, +# Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# AM_PROG_CC_C_O +# -------------- +# Like AC_PROG_CC_C_O, but changed for automake. +AC_DEFUN([AM_PROG_CC_C_O], +[AC_REQUIRE([AC_PROG_CC_C_O])dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` +eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o +if test "$am_t" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +dnl Make sure AC_PROG_CC is never called again, or it will override our +dnl setting of CC. +m4_define([AC_PROG_CC], + [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, +# Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software +# Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2009, 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# (`yes' being less verbose, `no' or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], +[ --enable-silent-rules less verbose build output (undo: `make V=1') + --disable-silent-rules verbose build output (undo: `make V=0')]) +case $enable_silent_rules in +yes) AM_DEFAULT_VERBOSITY=0;; +no) AM_DEFAULT_VERBOSITY=1;; +*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few `make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using `$V' instead of `$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([m4/libtool.m4]) +m4_include([m4/ltoptions.m4]) +m4_include([m4/ltsugar.m4]) +m4_include([m4/ltversion.m4]) +m4_include([m4/lt~obsolete.m4]) diff --git a/benchmark/Makefile.am b/benchmark/Makefile.am new file mode 100644 index 0000000..6043188 --- /dev/null +++ b/benchmark/Makefile.am @@ -0,0 +1,37 @@ +include $(top_srcdir)/Makefile.decl + +NULL = + +AM_CPPFLAGS = \ + -I$(top_srcdir)/gee \ + $(GLIB_CFLAGS) \ + $(NULL) + +AM_LDFLAGS = \ + -lm + $(NULL) + +noinst_PROGRAMS = benchmarks + +progs_ldadd = $(GLIB_LIBS) ../gee/libgee.la + +BUILT_SOURCES = benchmarks.vala.stamp + +benchmarks_VALASOURCES = \ + benchmark.vala \ + benchmarksorts.vala \ + mergesort.vala \ + $(NULL) + +benchmarks_SOURCES = benchmarks.vala.stamp $(benchmarks_VALASOURCES:.vala=.c) +benchmarks.vala.stamp: $(benchmarks_VALASOURCES) + $(VALAC) -C --basedir $(top_srcdir) --vapidir $(top_srcdir)/gee --pkg gee-internals-1.0 $^ + touch $@ +benchmarks_LDADD = $(progs_ldadd) +EXTRA_DIST += $(benchmarks_VALASOURCES) + +MAINTAINERCLEANFILES = \ + $(benchmarks_VALASOURCES:.vala=.c) \ + benchmarks.vala.stamp \ + $(NULL) + diff --git a/benchmark/Makefile.in b/benchmark/Makefile.in new file mode 100644 index 0000000..5749783 --- /dev/null +++ b/benchmark/Makefile.in @@ -0,0 +1,634 @@ +# Makefile.in generated by automake 1.11.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# GLIB - Library of useful C routines + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/Makefile.decl +noinst_PROGRAMS = benchmarks$(EXEEXT) +subdir = benchmark +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am__objects_1 = +am__objects_2 = benchmark.$(OBJEXT) benchmarksorts.$(OBJEXT) \ + mergesort.$(OBJEXT) $(am__objects_1) +am_benchmarks_OBJECTS = $(am__objects_2) +benchmarks_OBJECTS = $(am_benchmarks_OBJECTS) +am__DEPENDENCIES_1 = +am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) ../gee/libgee.la +benchmarks_DEPENDENCIES = $(am__DEPENDENCIES_2) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(benchmarks_SOURCES) +DIST_SOURCES = $(benchmarks_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COVERAGE_CFLAGS = @COVERAGE_CFLAGS@ +COVERAGE_LIBS = @COVERAGE_LIBS@ +COVERAGE_VALAFLAGS = @COVERAGE_VALAFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LCOV = @LCOV@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGEE_LT_VERSION = @LIBGEE_LT_VERSION@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VALAC = @VALAC@ +VALADOC = @VALADOC@ +VALAFLAGS = @VALAFLAGS@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +GTESTER = gtester +GTESTER_REPORT = gtester-report + +# initialize variables for unconditional += appending +EXTRA_DIST = $(benchmarks_VALASOURCES) +TEST_PROGS = +NULL = +AM_CPPFLAGS = \ + -I$(top_srcdir)/gee \ + $(GLIB_CFLAGS) \ + $(NULL) + +AM_LDFLAGS = \ + -lm + +progs_ldadd = $(GLIB_LIBS) ../gee/libgee.la +BUILT_SOURCES = benchmarks.vala.stamp +benchmarks_VALASOURCES = \ + benchmark.vala \ + benchmarksorts.vala \ + mergesort.vala \ + $(NULL) + +benchmarks_SOURCES = benchmarks.vala.stamp $(benchmarks_VALASOURCES:.vala=.c) +benchmarks_LDADD = $(progs_ldadd) +MAINTAINERCLEANFILES = \ + $(benchmarks_VALASOURCES:.vala=.c) \ + benchmarks.vala.stamp \ + $(NULL) + +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.decl $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu benchmark/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu benchmark/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/Makefile.decl: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +benchmarks$(EXEEXT): $(benchmarks_OBJECTS) $(benchmarks_DEPENDENCIES) $(EXTRA_benchmarks_DEPENDENCIES) + @rm -f benchmarks$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(benchmarks_OBJECTS) $(benchmarks_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/benchmark.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/benchmarksorts.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mergesort.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-local +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: all check check-am install install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \ + clean-generic clean-libtool clean-noinstPROGRAMS ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +### testing rules + +# test: run all tests in cwd and subdirs +test: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} + @ for subdir in $(SUBDIRS) . ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done +# test-report: run tests in subdirs and generate report +# perf-report: run tests in subdirs with -m perf and generate report +# full-report: like test-report: with -m perf and -m slow +test-report perf-report full-report: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || { \ + case $@ in \ + test-report) test_options="-k";; \ + perf-report) test_options="-k -m=perf";; \ + full-report) test_options="-k -m=perf -m=slow";; \ + esac ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \ + elif test -n "${TEST_PROGS}" ; then \ + ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \ + fi ; \ + } + @ ignore_logdir=true ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \ + ignore_logdir=false ; \ + fi ; \ + for subdir in $(SUBDIRS) . ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done ; \ + $$ignore_logdir || { \ + echo '' > $@.xml ; \ + echo '' >> $@.xml ; \ + for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \ + sed '1,1s/^?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \ + done ; \ + echo >> $@.xml ; \ + echo '' >> $@.xml ; \ + rm -rf "$$GTESTER_LOGDIR"/ ; \ + ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \ + } +.PHONY: test test-report perf-report full-report +# run make test as part of make check +check-local: test + $(NULL) +benchmarks.vala.stamp: $(benchmarks_VALASOURCES) + $(VALAC) -C --basedir $(top_srcdir) --vapidir $(top_srcdir)/gee --pkg gee-internals-1.0 $^ + touch $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/benchmark/benchmark.c b/benchmark/benchmark.c new file mode 100644 index 0000000..ea6c65e --- /dev/null +++ b/benchmark/benchmark.c @@ -0,0 +1,1963 @@ +/* benchmark.c generated by valac 0.16.1, the Vala compiler + * generated from benchmark.vala, do not modify */ + +/* benchmark.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +#include +#include +#include +#include +#include +#include +#include +#include + + +#define GEE_BENCHMARK_TYPE_FACTORY (gee_benchmark_factory_get_type ()) +#define GEE_BENCHMARK_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_FACTORY, GeeBenchmarkFactory)) +#define GEE_BENCHMARK_IS_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_FACTORY)) +#define GEE_BENCHMARK_FACTORY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_BENCHMARK_TYPE_FACTORY, GeeBenchmarkFactoryIface)) + +typedef struct _GeeBenchmarkFactory GeeBenchmarkFactory; +typedef struct _GeeBenchmarkFactoryIface GeeBenchmarkFactoryIface; + +#define GEE_BENCHMARK_TYPE_GENERATOR (gee_benchmark_generator_get_type ()) +#define GEE_BENCHMARK_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_GENERATOR, GeeBenchmarkGenerator)) +#define GEE_BENCHMARK_IS_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_GENERATOR)) +#define GEE_BENCHMARK_GENERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_BENCHMARK_TYPE_GENERATOR, GeeBenchmarkGeneratorIface)) + +typedef struct _GeeBenchmarkGenerator GeeBenchmarkGenerator; +typedef struct _GeeBenchmarkGeneratorIface GeeBenchmarkGeneratorIface; + +#define GEE_BENCHMARK_TYPE_ALGORITHM (gee_benchmark_algorithm_get_type ()) +#define GEE_BENCHMARK_ALGORITHM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_ALGORITHM, GeeBenchmarkAlgorithm)) +#define GEE_BENCHMARK_IS_ALGORITHM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_ALGORITHM)) +#define GEE_BENCHMARK_ALGORITHM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_BENCHMARK_TYPE_ALGORITHM, GeeBenchmarkAlgorithmIface)) + +typedef struct _GeeBenchmarkAlgorithm GeeBenchmarkAlgorithm; +typedef struct _GeeBenchmarkAlgorithmIface GeeBenchmarkAlgorithmIface; + +#define GEE_BENCHMARK_TYPE_RANDOM_INT32 (gee_benchmark_random_int32_get_type ()) +#define GEE_BENCHMARK_RANDOM_INT32(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_RANDOM_INT32, GeeBenchmarkRandomInt32)) +#define GEE_BENCHMARK_RANDOM_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_RANDOM_INT32, GeeBenchmarkRandomInt32Class)) +#define GEE_BENCHMARK_IS_RANDOM_INT32(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_RANDOM_INT32)) +#define GEE_BENCHMARK_IS_RANDOM_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_RANDOM_INT32)) +#define GEE_BENCHMARK_RANDOM_INT32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_RANDOM_INT32, GeeBenchmarkRandomInt32Class)) + +typedef struct _GeeBenchmarkRandomInt32 GeeBenchmarkRandomInt32; +typedef struct _GeeBenchmarkRandomInt32Class GeeBenchmarkRandomInt32Class; +typedef struct _GeeBenchmarkRandomInt32Private GeeBenchmarkRandomInt32Private; + +#define GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32 (gee_benchmark_fixed_variance_int32_get_type ()) +#define GEE_BENCHMARK_FIXED_VARIANCE_INT32(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32, GeeBenchmarkFixedVarianceInt32)) +#define GEE_BENCHMARK_FIXED_VARIANCE_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32, GeeBenchmarkFixedVarianceInt32Class)) +#define GEE_BENCHMARK_IS_FIXED_VARIANCE_INT32(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32)) +#define GEE_BENCHMARK_IS_FIXED_VARIANCE_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32)) +#define GEE_BENCHMARK_FIXED_VARIANCE_INT32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32, GeeBenchmarkFixedVarianceInt32Class)) + +typedef struct _GeeBenchmarkFixedVarianceInt32 GeeBenchmarkFixedVarianceInt32; +typedef struct _GeeBenchmarkFixedVarianceInt32Class GeeBenchmarkFixedVarianceInt32Class; +typedef struct _GeeBenchmarkFixedVarianceInt32Private GeeBenchmarkFixedVarianceInt32Private; + +#define GEE_BENCHMARK_TYPE_MOUNTS_INT32 (gee_benchmark_mounts_int32_get_type ()) +#define GEE_BENCHMARK_MOUNTS_INT32(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_MOUNTS_INT32, GeeBenchmarkMountsInt32)) +#define GEE_BENCHMARK_MOUNTS_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_MOUNTS_INT32, GeeBenchmarkMountsInt32Class)) +#define GEE_BENCHMARK_IS_MOUNTS_INT32(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_MOUNTS_INT32)) +#define GEE_BENCHMARK_IS_MOUNTS_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_MOUNTS_INT32)) +#define GEE_BENCHMARK_MOUNTS_INT32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_MOUNTS_INT32, GeeBenchmarkMountsInt32Class)) + +typedef struct _GeeBenchmarkMountsInt32 GeeBenchmarkMountsInt32; +typedef struct _GeeBenchmarkMountsInt32Class GeeBenchmarkMountsInt32Class; +typedef struct _GeeBenchmarkMountsInt32Private GeeBenchmarkMountsInt32Private; + +#define GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32 (gee_benchmark_reverse_sorted_int32_get_type ()) +#define GEE_BENCHMARK_REVERSE_SORTED_INT32(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32, GeeBenchmarkReverseSortedInt32)) +#define GEE_BENCHMARK_REVERSE_SORTED_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32, GeeBenchmarkReverseSortedInt32Class)) +#define GEE_BENCHMARK_IS_REVERSE_SORTED_INT32(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32)) +#define GEE_BENCHMARK_IS_REVERSE_SORTED_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32)) +#define GEE_BENCHMARK_REVERSE_SORTED_INT32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32, GeeBenchmarkReverseSortedInt32Class)) + +typedef struct _GeeBenchmarkReverseSortedInt32 GeeBenchmarkReverseSortedInt32; +typedef struct _GeeBenchmarkReverseSortedInt32Class GeeBenchmarkReverseSortedInt32Class; +typedef struct _GeeBenchmarkReverseSortedInt32Private GeeBenchmarkReverseSortedInt32Private; + +#define GEE_BENCHMARK_TYPE_SORTED_INT32 (gee_benchmark_sorted_int32_get_type ()) +#define GEE_BENCHMARK_SORTED_INT32(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_SORTED_INT32, GeeBenchmarkSortedInt32)) +#define GEE_BENCHMARK_SORTED_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_SORTED_INT32, GeeBenchmarkSortedInt32Class)) +#define GEE_BENCHMARK_IS_SORTED_INT32(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_SORTED_INT32)) +#define GEE_BENCHMARK_IS_SORTED_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_SORTED_INT32)) +#define GEE_BENCHMARK_SORTED_INT32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_SORTED_INT32, GeeBenchmarkSortedInt32Class)) + +typedef struct _GeeBenchmarkSortedInt32 GeeBenchmarkSortedInt32; +typedef struct _GeeBenchmarkSortedInt32Class GeeBenchmarkSortedInt32Class; +typedef struct _GeeBenchmarkSortedInt32Private GeeBenchmarkSortedInt32Private; + +#define GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY (gee_benchmark_array_list_factory_get_type ()) +#define GEE_BENCHMARK_ARRAY_LIST_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY, GeeBenchmarkArrayListFactory)) +#define GEE_BENCHMARK_ARRAY_LIST_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY, GeeBenchmarkArrayListFactoryClass)) +#define GEE_BENCHMARK_IS_ARRAY_LIST_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY)) +#define GEE_BENCHMARK_IS_ARRAY_LIST_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY)) +#define GEE_BENCHMARK_ARRAY_LIST_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY, GeeBenchmarkArrayListFactoryClass)) + +typedef struct _GeeBenchmarkArrayListFactory GeeBenchmarkArrayListFactory; +typedef struct _GeeBenchmarkArrayListFactoryClass GeeBenchmarkArrayListFactoryClass; +typedef struct _GeeBenchmarkArrayListFactoryPrivate GeeBenchmarkArrayListFactoryPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define GEE_BENCHMARK_TYPE_BENCHMARK (gee_benchmark_benchmark_get_type ()) +#define GEE_BENCHMARK_BENCHMARK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_BENCHMARK, GeeBenchmarkBenchmark)) +#define GEE_BENCHMARK_BENCHMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_BENCHMARK, GeeBenchmarkBenchmarkClass)) +#define GEE_BENCHMARK_IS_BENCHMARK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_BENCHMARK)) +#define GEE_BENCHMARK_IS_BENCHMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_BENCHMARK)) +#define GEE_BENCHMARK_BENCHMARK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_BENCHMARK, GeeBenchmarkBenchmarkClass)) + +typedef struct _GeeBenchmarkBenchmark GeeBenchmarkBenchmark; +typedef struct _GeeBenchmarkBenchmarkClass GeeBenchmarkBenchmarkClass; +typedef struct _GeeBenchmarkBenchmarkPrivate GeeBenchmarkBenchmarkPrivate; +#define _g_timer_destroy0(var) ((var == NULL) ? NULL : (var = (g_timer_destroy (var), NULL))) + +struct _GeeBenchmarkFactoryIface { + GTypeInterface parent_iface; + GeeCollection* (*create) (GeeBenchmarkFactory* self); + GeeCollection* (*copy) (GeeBenchmarkFactory* self, GeeCollection* collection); +}; + +struct _GeeBenchmarkGeneratorIface { + GTypeInterface parent_iface; + void (*generate_collection) (GeeBenchmarkGenerator* self, gint size, GeeCollection* collection); + const gchar* (*get_name) (GeeBenchmarkGenerator* self); +}; + +struct _GeeBenchmarkAlgorithmIface { + GTypeInterface parent_iface; + void (*process_collection) (GeeBenchmarkAlgorithm* self, GeeCollection* collection); + const gchar* (*get_name) (GeeBenchmarkAlgorithm* self); +}; + +struct _GeeBenchmarkRandomInt32 { + GObject parent_instance; + GeeBenchmarkRandomInt32Private * priv; +}; + +struct _GeeBenchmarkRandomInt32Class { + GObjectClass parent_class; +}; + +struct _GeeBenchmarkFixedVarianceInt32 { + GObject parent_instance; + GeeBenchmarkFixedVarianceInt32Private * priv; +}; + +struct _GeeBenchmarkFixedVarianceInt32Class { + GObjectClass parent_class; +}; + +struct _GeeBenchmarkMountsInt32 { + GObject parent_instance; + GeeBenchmarkMountsInt32Private * priv; +}; + +struct _GeeBenchmarkMountsInt32Class { + GObjectClass parent_class; +}; + +struct _GeeBenchmarkReverseSortedInt32 { + GObject parent_instance; + GeeBenchmarkReverseSortedInt32Private * priv; +}; + +struct _GeeBenchmarkReverseSortedInt32Class { + GObjectClass parent_class; +}; + +struct _GeeBenchmarkSortedInt32 { + GObject parent_instance; + GeeBenchmarkSortedInt32Private * priv; +}; + +struct _GeeBenchmarkSortedInt32Class { + GObjectClass parent_class; +}; + +struct _GeeBenchmarkArrayListFactory { + GObject parent_instance; + GeeBenchmarkArrayListFactoryPrivate * priv; +}; + +struct _GeeBenchmarkArrayListFactoryClass { + GObjectClass parent_class; +}; + +struct _GeeBenchmarkArrayListFactoryPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; +}; + +struct _GeeBenchmarkBenchmark { + GObject parent_instance; + GeeBenchmarkBenchmarkPrivate * priv; +}; + +struct _GeeBenchmarkBenchmarkClass { + GObjectClass parent_class; +}; + +struct _GeeBenchmarkBenchmarkPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GeeBenchmarkFactory* factory; + gint* sizes; + gint sizes_length1; + gint _sizes_size_; + GeeList* generators; + GeeList* algorithms; + gint iteration_count; + gdouble* results_sum; + gint results_sum_length1; + gint results_sum_length2; + gint results_sum_length3; + gdouble* results_squared_sum; + gint results_squared_sum_length1; + gint results_squared_sum_length2; + gint results_squared_sum_length3; +}; + + +static gpointer gee_benchmark_random_int32_parent_class = NULL; +static GeeBenchmarkGeneratorIface* gee_benchmark_random_int32_gee_benchmark_generator_parent_iface = NULL; +static gpointer gee_benchmark_fixed_variance_int32_parent_class = NULL; +static GeeBenchmarkGeneratorIface* gee_benchmark_fixed_variance_int32_gee_benchmark_generator_parent_iface = NULL; +static gpointer gee_benchmark_mounts_int32_parent_class = NULL; +static GeeBenchmarkGeneratorIface* gee_benchmark_mounts_int32_gee_benchmark_generator_parent_iface = NULL; +static gpointer gee_benchmark_reverse_sorted_int32_parent_class = NULL; +static GeeBenchmarkGeneratorIface* gee_benchmark_reverse_sorted_int32_gee_benchmark_generator_parent_iface = NULL; +static gpointer gee_benchmark_sorted_int32_parent_class = NULL; +static GeeBenchmarkGeneratorIface* gee_benchmark_sorted_int32_gee_benchmark_generator_parent_iface = NULL; +static gpointer gee_benchmark_array_list_factory_parent_class = NULL; +static GeeBenchmarkFactoryIface* gee_benchmark_array_list_factory_gee_benchmark_factory_parent_iface = NULL; +static gpointer gee_benchmark_benchmark_parent_class = NULL; + +GType gee_benchmark_factory_get_type (void) G_GNUC_CONST; +GeeCollection* gee_benchmark_factory_create (GeeBenchmarkFactory* self); +GeeCollection* gee_benchmark_factory_copy (GeeBenchmarkFactory* self, GeeCollection* collection); +GType gee_benchmark_generator_get_type (void) G_GNUC_CONST; +void gee_benchmark_generator_generate_collection (GeeBenchmarkGenerator* self, gint size, GeeCollection* collection); +const gchar* gee_benchmark_generator_get_name (GeeBenchmarkGenerator* self); +GType gee_benchmark_algorithm_get_type (void) G_GNUC_CONST; +void gee_benchmark_algorithm_process_collection (GeeBenchmarkAlgorithm* self, GeeCollection* collection); +const gchar* gee_benchmark_algorithm_get_name (GeeBenchmarkAlgorithm* self); +GType gee_benchmark_random_int32_get_type (void) G_GNUC_CONST; +enum { + GEE_BENCHMARK_RANDOM_INT32_DUMMY_PROPERTY, + GEE_BENCHMARK_RANDOM_INT32_NAME +}; +static void gee_benchmark_random_int32_real_generate_collection (GeeBenchmarkGenerator* base, gint size, GeeCollection* collection); +GeeBenchmarkRandomInt32* gee_benchmark_random_int32_new (void); +GeeBenchmarkRandomInt32* gee_benchmark_random_int32_construct (GType object_type); +static void _vala_gee_benchmark_random_int32_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +GType gee_benchmark_fixed_variance_int32_get_type (void) G_GNUC_CONST; +enum { + GEE_BENCHMARK_FIXED_VARIANCE_INT32_DUMMY_PROPERTY, + GEE_BENCHMARK_FIXED_VARIANCE_INT32_NAME +}; +static void gee_benchmark_fixed_variance_int32_real_generate_collection (GeeBenchmarkGenerator* base, gint size, GeeCollection* collection); +GeeBenchmarkFixedVarianceInt32* gee_benchmark_fixed_variance_int32_new (void); +GeeBenchmarkFixedVarianceInt32* gee_benchmark_fixed_variance_int32_construct (GType object_type); +static void _vala_gee_benchmark_fixed_variance_int32_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +GType gee_benchmark_mounts_int32_get_type (void) G_GNUC_CONST; +enum { + GEE_BENCHMARK_MOUNTS_INT32_DUMMY_PROPERTY, + GEE_BENCHMARK_MOUNTS_INT32_NAME +}; +static void gee_benchmark_mounts_int32_real_generate_collection (GeeBenchmarkGenerator* base, gint size, GeeCollection* collection); +GeeBenchmarkMountsInt32* gee_benchmark_mounts_int32_new (void); +GeeBenchmarkMountsInt32* gee_benchmark_mounts_int32_construct (GType object_type); +static void _vala_gee_benchmark_mounts_int32_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +GType gee_benchmark_reverse_sorted_int32_get_type (void) G_GNUC_CONST; +enum { + GEE_BENCHMARK_REVERSE_SORTED_INT32_DUMMY_PROPERTY, + GEE_BENCHMARK_REVERSE_SORTED_INT32_NAME +}; +static void gee_benchmark_reverse_sorted_int32_real_generate_collection (GeeBenchmarkGenerator* base, gint size, GeeCollection* collection); +GeeBenchmarkReverseSortedInt32* gee_benchmark_reverse_sorted_int32_new (void); +GeeBenchmarkReverseSortedInt32* gee_benchmark_reverse_sorted_int32_construct (GType object_type); +static void _vala_gee_benchmark_reverse_sorted_int32_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +GType gee_benchmark_sorted_int32_get_type (void) G_GNUC_CONST; +enum { + GEE_BENCHMARK_SORTED_INT32_DUMMY_PROPERTY, + GEE_BENCHMARK_SORTED_INT32_NAME +}; +static void gee_benchmark_sorted_int32_real_generate_collection (GeeBenchmarkGenerator* base, gint size, GeeCollection* collection); +GeeBenchmarkSortedInt32* gee_benchmark_sorted_int32_new (void); +GeeBenchmarkSortedInt32* gee_benchmark_sorted_int32_construct (GType object_type); +static void _vala_gee_benchmark_sorted_int32_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +GType gee_benchmark_array_list_factory_get_type (void) G_GNUC_CONST; +#define GEE_BENCHMARK_ARRAY_LIST_FACTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY, GeeBenchmarkArrayListFactoryPrivate)) +enum { + GEE_BENCHMARK_ARRAY_LIST_FACTORY_DUMMY_PROPERTY, + GEE_BENCHMARK_ARRAY_LIST_FACTORY_G_TYPE, + GEE_BENCHMARK_ARRAY_LIST_FACTORY_G_DUP_FUNC, + GEE_BENCHMARK_ARRAY_LIST_FACTORY_G_DESTROY_FUNC +}; +static GeeCollection* gee_benchmark_array_list_factory_real_create (GeeBenchmarkFactory* base); +static GeeCollection* gee_benchmark_array_list_factory_real_copy (GeeBenchmarkFactory* base, GeeCollection* collection); +GeeBenchmarkArrayListFactory* gee_benchmark_array_list_factory_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeBenchmarkArrayListFactory* gee_benchmark_array_list_factory_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +static void _vala_gee_benchmark_array_list_factory_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_benchmark_array_list_factory_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +GType gee_benchmark_benchmark_get_type (void) G_GNUC_CONST; +#define GEE_BENCHMARK_BENCHMARK_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_BENCHMARK_TYPE_BENCHMARK, GeeBenchmarkBenchmarkPrivate)) +enum { + GEE_BENCHMARK_BENCHMARK_DUMMY_PROPERTY, + GEE_BENCHMARK_BENCHMARK_G_TYPE, + GEE_BENCHMARK_BENCHMARK_G_DUP_FUNC, + GEE_BENCHMARK_BENCHMARK_G_DESTROY_FUNC +}; +GeeBenchmarkBenchmark* gee_benchmark_benchmark_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeBenchmarkFactory* factory, GeeList* algorithms, GeeList* generators, gint* sizes, int sizes_length1, gint iteration_count); +GeeBenchmarkBenchmark* gee_benchmark_benchmark_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeBenchmarkFactory* factory, GeeList* algorithms, GeeList* generators, gint* sizes, int sizes_length1, gint iteration_count); +static gint* _vala_array_dup1 (gint* self, int length); +void gee_benchmark_benchmark_run (GeeBenchmarkBenchmark* self); +void gee_benchmark_benchmark_display_results (GeeBenchmarkBenchmark* self, gint iteration); +static void gee_benchmark_benchmark_finalize (GObject* obj); +static void _vala_gee_benchmark_benchmark_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_benchmark_benchmark_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +GeeCollection* gee_benchmark_factory_create (GeeBenchmarkFactory* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_BENCHMARK_FACTORY_GET_INTERFACE (self)->create (self); +} + + +GeeCollection* gee_benchmark_factory_copy (GeeBenchmarkFactory* self, GeeCollection* collection) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_BENCHMARK_FACTORY_GET_INTERFACE (self)->copy (self, collection); +} + + +static void gee_benchmark_factory_base_init (GeeBenchmarkFactoryIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + } +} + + +GType gee_benchmark_factory_get_type (void) { + static volatile gsize gee_benchmark_factory_type_id__volatile = 0; + if (g_once_init_enter (&gee_benchmark_factory_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeBenchmarkFactoryIface), (GBaseInitFunc) gee_benchmark_factory_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_benchmark_factory_type_id; + gee_benchmark_factory_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeBenchmarkFactory", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_benchmark_factory_type_id, G_TYPE_OBJECT); + g_once_init_leave (&gee_benchmark_factory_type_id__volatile, gee_benchmark_factory_type_id); + } + return gee_benchmark_factory_type_id__volatile; +} + + +void gee_benchmark_generator_generate_collection (GeeBenchmarkGenerator* self, gint size, GeeCollection* collection) { + g_return_if_fail (self != NULL); + GEE_BENCHMARK_GENERATOR_GET_INTERFACE (self)->generate_collection (self, size, collection); +} + + +const gchar* gee_benchmark_generator_get_name (GeeBenchmarkGenerator* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_BENCHMARK_GENERATOR_GET_INTERFACE (self)->get_name (self); +} + + +static void gee_benchmark_generator_base_init (GeeBenchmarkGeneratorIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + g_object_interface_install_property (iface, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + } +} + + +GType gee_benchmark_generator_get_type (void) { + static volatile gsize gee_benchmark_generator_type_id__volatile = 0; + if (g_once_init_enter (&gee_benchmark_generator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeBenchmarkGeneratorIface), (GBaseInitFunc) gee_benchmark_generator_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_benchmark_generator_type_id; + gee_benchmark_generator_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeBenchmarkGenerator", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_benchmark_generator_type_id, G_TYPE_OBJECT); + g_once_init_leave (&gee_benchmark_generator_type_id__volatile, gee_benchmark_generator_type_id); + } + return gee_benchmark_generator_type_id__volatile; +} + + +void gee_benchmark_algorithm_process_collection (GeeBenchmarkAlgorithm* self, GeeCollection* collection) { + g_return_if_fail (self != NULL); + GEE_BENCHMARK_ALGORITHM_GET_INTERFACE (self)->process_collection (self, collection); +} + + +const gchar* gee_benchmark_algorithm_get_name (GeeBenchmarkAlgorithm* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_BENCHMARK_ALGORITHM_GET_INTERFACE (self)->get_name (self); +} + + +static void gee_benchmark_algorithm_base_init (GeeBenchmarkAlgorithmIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + g_object_interface_install_property (iface, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + } +} + + +GType gee_benchmark_algorithm_get_type (void) { + static volatile gsize gee_benchmark_algorithm_type_id__volatile = 0; + if (g_once_init_enter (&gee_benchmark_algorithm_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeBenchmarkAlgorithmIface), (GBaseInitFunc) gee_benchmark_algorithm_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_benchmark_algorithm_type_id; + gee_benchmark_algorithm_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeBenchmarkAlgorithm", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_benchmark_algorithm_type_id, G_TYPE_OBJECT); + g_once_init_leave (&gee_benchmark_algorithm_type_id__volatile, gee_benchmark_algorithm_type_id); + } + return gee_benchmark_algorithm_type_id__volatile; +} + + +static void gee_benchmark_random_int32_real_generate_collection (GeeBenchmarkGenerator* base, gint size, GeeCollection* collection) { + GeeBenchmarkRandomInt32 * self; + self = (GeeBenchmarkRandomInt32*) base; + g_return_if_fail (collection != NULL); + { + gint i; + i = 0; + { + gboolean _tmp0_; + _tmp0_ = TRUE; + while (TRUE) { + gboolean _tmp1_; + gint _tmp3_; + gint _tmp4_; + GeeCollection* _tmp5_; + gint _tmp6_; + gint32 _tmp7_ = 0; + _tmp1_ = _tmp0_; + if (!_tmp1_) { + gint _tmp2_; + _tmp2_ = i; + i = _tmp2_ + 1; + } + _tmp0_ = FALSE; + _tmp3_ = i; + _tmp4_ = size; + if (!(_tmp3_ < _tmp4_)) { + break; + } + _tmp5_ = collection; + _tmp6_ = size; + _tmp7_ = g_random_int_range ((gint32) 0, (gint32) (_tmp6_ - 1)); + gee_collection_add (_tmp5_, GINT_TO_POINTER (_tmp7_)); + } + } + } +} + + +GeeBenchmarkRandomInt32* gee_benchmark_random_int32_construct (GType object_type) { + GeeBenchmarkRandomInt32 * self = NULL; + self = (GeeBenchmarkRandomInt32*) g_object_new (object_type, NULL); + return self; +} + + +GeeBenchmarkRandomInt32* gee_benchmark_random_int32_new (void) { + return gee_benchmark_random_int32_construct (GEE_BENCHMARK_TYPE_RANDOM_INT32); +} + + +static const gchar* gee_benchmark_random_int32_real_get_name (GeeBenchmarkGenerator* base) { + const gchar* result; + GeeBenchmarkRandomInt32* self; + self = (GeeBenchmarkRandomInt32*) base; + result = "FullRandom"; + return result; +} + + +static void gee_benchmark_random_int32_class_init (GeeBenchmarkRandomInt32Class * klass) { + gee_benchmark_random_int32_parent_class = g_type_class_peek_parent (klass); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_benchmark_random_int32_get_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_RANDOM_INT32_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_benchmark_random_int32_gee_benchmark_generator_interface_init (GeeBenchmarkGeneratorIface * iface) { + gee_benchmark_random_int32_gee_benchmark_generator_parent_iface = g_type_interface_peek_parent (iface); + iface->generate_collection = (void (*)(GeeBenchmarkGenerator*, gint, GeeCollection*)) gee_benchmark_random_int32_real_generate_collection; + iface->get_name = gee_benchmark_random_int32_real_get_name; +} + + +static void gee_benchmark_random_int32_instance_init (GeeBenchmarkRandomInt32 * self) { +} + + +GType gee_benchmark_random_int32_get_type (void) { + static volatile gsize gee_benchmark_random_int32_type_id__volatile = 0; + if (g_once_init_enter (&gee_benchmark_random_int32_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeBenchmarkRandomInt32Class), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_benchmark_random_int32_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeBenchmarkRandomInt32), 0, (GInstanceInitFunc) gee_benchmark_random_int32_instance_init, NULL }; + static const GInterfaceInfo gee_benchmark_generator_info = { (GInterfaceInitFunc) gee_benchmark_random_int32_gee_benchmark_generator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_benchmark_random_int32_type_id; + gee_benchmark_random_int32_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeBenchmarkRandomInt32", &g_define_type_info, 0); + g_type_add_interface_static (gee_benchmark_random_int32_type_id, GEE_BENCHMARK_TYPE_GENERATOR, &gee_benchmark_generator_info); + g_once_init_leave (&gee_benchmark_random_int32_type_id__volatile, gee_benchmark_random_int32_type_id); + } + return gee_benchmark_random_int32_type_id__volatile; +} + + +static void _vala_gee_benchmark_random_int32_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeBenchmarkRandomInt32 * self; + self = GEE_BENCHMARK_RANDOM_INT32 (object); + switch (property_id) { + case GEE_BENCHMARK_RANDOM_INT32_NAME: + g_value_set_string (value, gee_benchmark_generator_get_name ((GeeBenchmarkGenerator*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void gee_benchmark_fixed_variance_int32_real_generate_collection (GeeBenchmarkGenerator* base, gint size, GeeCollection* collection) { + GeeBenchmarkFixedVarianceInt32 * self; + gint _tmp0_; + gdouble _tmp1_ = 0.0; + gint variance; + self = (GeeBenchmarkFixedVarianceInt32*) base; + g_return_if_fail (collection != NULL); + _tmp0_ = size; + _tmp1_ = sqrt ((gdouble) _tmp0_); + variance = (gint) _tmp1_; + { + gint i; + i = 0; + { + gboolean _tmp2_; + _tmp2_ = TRUE; + while (TRUE) { + gboolean _tmp3_; + gint _tmp5_; + gint _tmp6_; + GeeCollection* _tmp7_; + gint _tmp8_; + gint _tmp9_; + gint32 _tmp10_ = 0; + gint _tmp11_; + _tmp3_ = _tmp2_; + if (!_tmp3_) { + gint _tmp4_; + _tmp4_ = i; + i = _tmp4_ + 1; + } + _tmp2_ = FALSE; + _tmp5_ = i; + _tmp6_ = size; + if (!(_tmp5_ < _tmp6_)) { + break; + } + _tmp7_ = collection; + _tmp8_ = i; + _tmp9_ = variance; + _tmp10_ = g_random_int_range ((gint32) 0, (gint32) _tmp9_); + _tmp11_ = variance; + gee_collection_add (_tmp7_, GINT_TO_POINTER ((gint32) ((_tmp8_ + _tmp10_) - (_tmp11_ / 2)))); + } + } + } +} + + +GeeBenchmarkFixedVarianceInt32* gee_benchmark_fixed_variance_int32_construct (GType object_type) { + GeeBenchmarkFixedVarianceInt32 * self = NULL; + self = (GeeBenchmarkFixedVarianceInt32*) g_object_new (object_type, NULL); + return self; +} + + +GeeBenchmarkFixedVarianceInt32* gee_benchmark_fixed_variance_int32_new (void) { + return gee_benchmark_fixed_variance_int32_construct (GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32); +} + + +static const gchar* gee_benchmark_fixed_variance_int32_real_get_name (GeeBenchmarkGenerator* base) { + const gchar* result; + GeeBenchmarkFixedVarianceInt32* self; + self = (GeeBenchmarkFixedVarianceInt32*) base; + result = "FixedVariance"; + return result; +} + + +static void gee_benchmark_fixed_variance_int32_class_init (GeeBenchmarkFixedVarianceInt32Class * klass) { + gee_benchmark_fixed_variance_int32_parent_class = g_type_class_peek_parent (klass); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_benchmark_fixed_variance_int32_get_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_FIXED_VARIANCE_INT32_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_benchmark_fixed_variance_int32_gee_benchmark_generator_interface_init (GeeBenchmarkGeneratorIface * iface) { + gee_benchmark_fixed_variance_int32_gee_benchmark_generator_parent_iface = g_type_interface_peek_parent (iface); + iface->generate_collection = (void (*)(GeeBenchmarkGenerator*, gint, GeeCollection*)) gee_benchmark_fixed_variance_int32_real_generate_collection; + iface->get_name = gee_benchmark_fixed_variance_int32_real_get_name; +} + + +static void gee_benchmark_fixed_variance_int32_instance_init (GeeBenchmarkFixedVarianceInt32 * self) { +} + + +GType gee_benchmark_fixed_variance_int32_get_type (void) { + static volatile gsize gee_benchmark_fixed_variance_int32_type_id__volatile = 0; + if (g_once_init_enter (&gee_benchmark_fixed_variance_int32_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeBenchmarkFixedVarianceInt32Class), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_benchmark_fixed_variance_int32_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeBenchmarkFixedVarianceInt32), 0, (GInstanceInitFunc) gee_benchmark_fixed_variance_int32_instance_init, NULL }; + static const GInterfaceInfo gee_benchmark_generator_info = { (GInterfaceInitFunc) gee_benchmark_fixed_variance_int32_gee_benchmark_generator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_benchmark_fixed_variance_int32_type_id; + gee_benchmark_fixed_variance_int32_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeBenchmarkFixedVarianceInt32", &g_define_type_info, 0); + g_type_add_interface_static (gee_benchmark_fixed_variance_int32_type_id, GEE_BENCHMARK_TYPE_GENERATOR, &gee_benchmark_generator_info); + g_once_init_leave (&gee_benchmark_fixed_variance_int32_type_id__volatile, gee_benchmark_fixed_variance_int32_type_id); + } + return gee_benchmark_fixed_variance_int32_type_id__volatile; +} + + +static void _vala_gee_benchmark_fixed_variance_int32_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeBenchmarkFixedVarianceInt32 * self; + self = GEE_BENCHMARK_FIXED_VARIANCE_INT32 (object); + switch (property_id) { + case GEE_BENCHMARK_FIXED_VARIANCE_INT32_NAME: + g_value_set_string (value, gee_benchmark_generator_get_name ((GeeBenchmarkGenerator*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void gee_benchmark_mounts_int32_real_generate_collection (GeeBenchmarkGenerator* base, gint size, GeeCollection* collection) { + GeeBenchmarkMountsInt32 * self; + gint index; + gint last; + gint _tmp0_; + gdouble _tmp1_ = 0.0; + gint variance; + self = (GeeBenchmarkMountsInt32*) base; + g_return_if_fail (collection != NULL); + index = 0; + last = 0; + _tmp0_ = size; + _tmp1_ = sqrt ((gdouble) _tmp0_); + variance = (gint) _tmp1_; + while (TRUE) { + gint _tmp2_; + gint _tmp3_; + gint _tmp4_; + gint32 _tmp5_ = 0; + gint width; + gint _tmp6_; + gint _tmp7_; + gint32 _tmp8_ = 0; + gint height; + gint _tmp18_; + gint _tmp19_; + gint _tmp20_; + gint _tmp21_; + _tmp2_ = index; + _tmp3_ = size; + if (!(_tmp2_ < _tmp3_)) { + break; + } + _tmp4_ = variance; + _tmp5_ = g_random_int_range ((gint32) 0, (gint32) _tmp4_); + width = (gint) _tmp5_; + _tmp6_ = variance; + _tmp7_ = variance; + _tmp8_ = g_random_int_range ((gint32) ((-_tmp6_) / 2), (gint32) (_tmp7_ / 2)); + height = (gint) _tmp8_; + { + gint i; + i = 0; + { + gboolean _tmp9_; + _tmp9_ = TRUE; + while (TRUE) { + gboolean _tmp10_; + gint _tmp12_; + gint _tmp13_; + GeeCollection* _tmp14_; + gint _tmp15_; + gint _tmp16_; + gint _tmp17_; + _tmp10_ = _tmp9_; + if (!_tmp10_) { + gint _tmp11_; + _tmp11_ = i; + i = _tmp11_ + 1; + } + _tmp9_ = FALSE; + _tmp12_ = i; + _tmp13_ = width; + if (!(_tmp12_ < _tmp13_)) { + break; + } + _tmp14_ = collection; + _tmp15_ = last; + _tmp16_ = height; + _tmp17_ = width; + gee_collection_add (_tmp14_, GINT_TO_POINTER ((gint32) (_tmp15_ + (_tmp16_ / _tmp17_)))); + } + } + } + _tmp18_ = index; + _tmp19_ = width; + index = _tmp18_ + _tmp19_; + _tmp20_ = last; + _tmp21_ = height; + last = _tmp20_ + _tmp21_; + } +} + + +GeeBenchmarkMountsInt32* gee_benchmark_mounts_int32_construct (GType object_type) { + GeeBenchmarkMountsInt32 * self = NULL; + self = (GeeBenchmarkMountsInt32*) g_object_new (object_type, NULL); + return self; +} + + +GeeBenchmarkMountsInt32* gee_benchmark_mounts_int32_new (void) { + return gee_benchmark_mounts_int32_construct (GEE_BENCHMARK_TYPE_MOUNTS_INT32); +} + + +static const gchar* gee_benchmark_mounts_int32_real_get_name (GeeBenchmarkGenerator* base) { + const gchar* result; + GeeBenchmarkMountsInt32* self; + self = (GeeBenchmarkMountsInt32*) base; + result = "Mounts"; + return result; +} + + +static void gee_benchmark_mounts_int32_class_init (GeeBenchmarkMountsInt32Class * klass) { + gee_benchmark_mounts_int32_parent_class = g_type_class_peek_parent (klass); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_benchmark_mounts_int32_get_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_MOUNTS_INT32_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_benchmark_mounts_int32_gee_benchmark_generator_interface_init (GeeBenchmarkGeneratorIface * iface) { + gee_benchmark_mounts_int32_gee_benchmark_generator_parent_iface = g_type_interface_peek_parent (iface); + iface->generate_collection = (void (*)(GeeBenchmarkGenerator*, gint, GeeCollection*)) gee_benchmark_mounts_int32_real_generate_collection; + iface->get_name = gee_benchmark_mounts_int32_real_get_name; +} + + +static void gee_benchmark_mounts_int32_instance_init (GeeBenchmarkMountsInt32 * self) { +} + + +GType gee_benchmark_mounts_int32_get_type (void) { + static volatile gsize gee_benchmark_mounts_int32_type_id__volatile = 0; + if (g_once_init_enter (&gee_benchmark_mounts_int32_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeBenchmarkMountsInt32Class), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_benchmark_mounts_int32_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeBenchmarkMountsInt32), 0, (GInstanceInitFunc) gee_benchmark_mounts_int32_instance_init, NULL }; + static const GInterfaceInfo gee_benchmark_generator_info = { (GInterfaceInitFunc) gee_benchmark_mounts_int32_gee_benchmark_generator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_benchmark_mounts_int32_type_id; + gee_benchmark_mounts_int32_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeBenchmarkMountsInt32", &g_define_type_info, 0); + g_type_add_interface_static (gee_benchmark_mounts_int32_type_id, GEE_BENCHMARK_TYPE_GENERATOR, &gee_benchmark_generator_info); + g_once_init_leave (&gee_benchmark_mounts_int32_type_id__volatile, gee_benchmark_mounts_int32_type_id); + } + return gee_benchmark_mounts_int32_type_id__volatile; +} + + +static void _vala_gee_benchmark_mounts_int32_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeBenchmarkMountsInt32 * self; + self = GEE_BENCHMARK_MOUNTS_INT32 (object); + switch (property_id) { + case GEE_BENCHMARK_MOUNTS_INT32_NAME: + g_value_set_string (value, gee_benchmark_generator_get_name ((GeeBenchmarkGenerator*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void gee_benchmark_reverse_sorted_int32_real_generate_collection (GeeBenchmarkGenerator* base, gint size, GeeCollection* collection) { + GeeBenchmarkReverseSortedInt32 * self; + self = (GeeBenchmarkReverseSortedInt32*) base; + g_return_if_fail (collection != NULL); + { + gint i; + i = 0; + { + gboolean _tmp0_; + _tmp0_ = TRUE; + while (TRUE) { + gboolean _tmp1_; + gint _tmp3_; + gint _tmp4_; + GeeCollection* _tmp5_; + gint _tmp6_; + gint _tmp7_; + _tmp1_ = _tmp0_; + if (!_tmp1_) { + gint _tmp2_; + _tmp2_ = i; + i = _tmp2_ + 1; + } + _tmp0_ = FALSE; + _tmp3_ = i; + _tmp4_ = size; + if (!(_tmp3_ < _tmp4_)) { + break; + } + _tmp5_ = collection; + _tmp6_ = size; + _tmp7_ = i; + gee_collection_add (_tmp5_, GINT_TO_POINTER ((gint32) ((_tmp6_ - _tmp7_) - 1))); + } + } + } +} + + +GeeBenchmarkReverseSortedInt32* gee_benchmark_reverse_sorted_int32_construct (GType object_type) { + GeeBenchmarkReverseSortedInt32 * self = NULL; + self = (GeeBenchmarkReverseSortedInt32*) g_object_new (object_type, NULL); + return self; +} + + +GeeBenchmarkReverseSortedInt32* gee_benchmark_reverse_sorted_int32_new (void) { + return gee_benchmark_reverse_sorted_int32_construct (GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32); +} + + +static const gchar* gee_benchmark_reverse_sorted_int32_real_get_name (GeeBenchmarkGenerator* base) { + const gchar* result; + GeeBenchmarkReverseSortedInt32* self; + self = (GeeBenchmarkReverseSortedInt32*) base; + result = "ReverseSorted"; + return result; +} + + +static void gee_benchmark_reverse_sorted_int32_class_init (GeeBenchmarkReverseSortedInt32Class * klass) { + gee_benchmark_reverse_sorted_int32_parent_class = g_type_class_peek_parent (klass); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_benchmark_reverse_sorted_int32_get_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_REVERSE_SORTED_INT32_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_benchmark_reverse_sorted_int32_gee_benchmark_generator_interface_init (GeeBenchmarkGeneratorIface * iface) { + gee_benchmark_reverse_sorted_int32_gee_benchmark_generator_parent_iface = g_type_interface_peek_parent (iface); + iface->generate_collection = (void (*)(GeeBenchmarkGenerator*, gint, GeeCollection*)) gee_benchmark_reverse_sorted_int32_real_generate_collection; + iface->get_name = gee_benchmark_reverse_sorted_int32_real_get_name; +} + + +static void gee_benchmark_reverse_sorted_int32_instance_init (GeeBenchmarkReverseSortedInt32 * self) { +} + + +GType gee_benchmark_reverse_sorted_int32_get_type (void) { + static volatile gsize gee_benchmark_reverse_sorted_int32_type_id__volatile = 0; + if (g_once_init_enter (&gee_benchmark_reverse_sorted_int32_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeBenchmarkReverseSortedInt32Class), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_benchmark_reverse_sorted_int32_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeBenchmarkReverseSortedInt32), 0, (GInstanceInitFunc) gee_benchmark_reverse_sorted_int32_instance_init, NULL }; + static const GInterfaceInfo gee_benchmark_generator_info = { (GInterfaceInitFunc) gee_benchmark_reverse_sorted_int32_gee_benchmark_generator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_benchmark_reverse_sorted_int32_type_id; + gee_benchmark_reverse_sorted_int32_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeBenchmarkReverseSortedInt32", &g_define_type_info, 0); + g_type_add_interface_static (gee_benchmark_reverse_sorted_int32_type_id, GEE_BENCHMARK_TYPE_GENERATOR, &gee_benchmark_generator_info); + g_once_init_leave (&gee_benchmark_reverse_sorted_int32_type_id__volatile, gee_benchmark_reverse_sorted_int32_type_id); + } + return gee_benchmark_reverse_sorted_int32_type_id__volatile; +} + + +static void _vala_gee_benchmark_reverse_sorted_int32_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeBenchmarkReverseSortedInt32 * self; + self = GEE_BENCHMARK_REVERSE_SORTED_INT32 (object); + switch (property_id) { + case GEE_BENCHMARK_REVERSE_SORTED_INT32_NAME: + g_value_set_string (value, gee_benchmark_generator_get_name ((GeeBenchmarkGenerator*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void gee_benchmark_sorted_int32_real_generate_collection (GeeBenchmarkGenerator* base, gint size, GeeCollection* collection) { + GeeBenchmarkSortedInt32 * self; + self = (GeeBenchmarkSortedInt32*) base; + g_return_if_fail (collection != NULL); + { + gint i; + i = 0; + { + gboolean _tmp0_; + _tmp0_ = TRUE; + while (TRUE) { + gboolean _tmp1_; + gint _tmp3_; + gint _tmp4_; + GeeCollection* _tmp5_; + gint _tmp6_; + _tmp1_ = _tmp0_; + if (!_tmp1_) { + gint _tmp2_; + _tmp2_ = i; + i = _tmp2_ + 1; + } + _tmp0_ = FALSE; + _tmp3_ = i; + _tmp4_ = size; + if (!(_tmp3_ < _tmp4_)) { + break; + } + _tmp5_ = collection; + _tmp6_ = i; + gee_collection_add (_tmp5_, GINT_TO_POINTER ((gint32) _tmp6_)); + } + } + } +} + + +GeeBenchmarkSortedInt32* gee_benchmark_sorted_int32_construct (GType object_type) { + GeeBenchmarkSortedInt32 * self = NULL; + self = (GeeBenchmarkSortedInt32*) g_object_new (object_type, NULL); + return self; +} + + +GeeBenchmarkSortedInt32* gee_benchmark_sorted_int32_new (void) { + return gee_benchmark_sorted_int32_construct (GEE_BENCHMARK_TYPE_SORTED_INT32); +} + + +static const gchar* gee_benchmark_sorted_int32_real_get_name (GeeBenchmarkGenerator* base) { + const gchar* result; + GeeBenchmarkSortedInt32* self; + self = (GeeBenchmarkSortedInt32*) base; + result = "Sorted"; + return result; +} + + +static void gee_benchmark_sorted_int32_class_init (GeeBenchmarkSortedInt32Class * klass) { + gee_benchmark_sorted_int32_parent_class = g_type_class_peek_parent (klass); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_benchmark_sorted_int32_get_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_SORTED_INT32_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_benchmark_sorted_int32_gee_benchmark_generator_interface_init (GeeBenchmarkGeneratorIface * iface) { + gee_benchmark_sorted_int32_gee_benchmark_generator_parent_iface = g_type_interface_peek_parent (iface); + iface->generate_collection = (void (*)(GeeBenchmarkGenerator*, gint, GeeCollection*)) gee_benchmark_sorted_int32_real_generate_collection; + iface->get_name = gee_benchmark_sorted_int32_real_get_name; +} + + +static void gee_benchmark_sorted_int32_instance_init (GeeBenchmarkSortedInt32 * self) { +} + + +GType gee_benchmark_sorted_int32_get_type (void) { + static volatile gsize gee_benchmark_sorted_int32_type_id__volatile = 0; + if (g_once_init_enter (&gee_benchmark_sorted_int32_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeBenchmarkSortedInt32Class), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_benchmark_sorted_int32_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeBenchmarkSortedInt32), 0, (GInstanceInitFunc) gee_benchmark_sorted_int32_instance_init, NULL }; + static const GInterfaceInfo gee_benchmark_generator_info = { (GInterfaceInitFunc) gee_benchmark_sorted_int32_gee_benchmark_generator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_benchmark_sorted_int32_type_id; + gee_benchmark_sorted_int32_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeBenchmarkSortedInt32", &g_define_type_info, 0); + g_type_add_interface_static (gee_benchmark_sorted_int32_type_id, GEE_BENCHMARK_TYPE_GENERATOR, &gee_benchmark_generator_info); + g_once_init_leave (&gee_benchmark_sorted_int32_type_id__volatile, gee_benchmark_sorted_int32_type_id); + } + return gee_benchmark_sorted_int32_type_id__volatile; +} + + +static void _vala_gee_benchmark_sorted_int32_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeBenchmarkSortedInt32 * self; + self = GEE_BENCHMARK_SORTED_INT32 (object); + switch (property_id) { + case GEE_BENCHMARK_SORTED_INT32_NAME: + g_value_set_string (value, gee_benchmark_generator_get_name ((GeeBenchmarkGenerator*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeCollection* gee_benchmark_array_list_factory_real_create (GeeBenchmarkFactory* base) { + GeeBenchmarkArrayListFactory * self; + GeeCollection* result = NULL; + GeeArrayList* _tmp0_; + self = (GeeBenchmarkArrayListFactory*) base; + _tmp0_ = gee_array_list_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, NULL); + result = (GeeCollection*) _tmp0_; + return result; +} + + +static GeeCollection* gee_benchmark_array_list_factory_real_copy (GeeBenchmarkFactory* base, GeeCollection* collection) { + GeeBenchmarkArrayListFactory * self; + GeeCollection* result = NULL; + GeeArrayList* _tmp0_; + GeeArrayList* copy; + self = (GeeBenchmarkArrayListFactory*) base; + g_return_val_if_fail (collection != NULL, NULL); + _tmp0_ = gee_array_list_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, NULL); + copy = _tmp0_; + { + GeeCollection* _tmp1_; + GeeIterator* _tmp2_ = NULL; + GeeIterator* _item_it; + _tmp1_ = collection; + _tmp2_ = gee_iterable_iterator ((GeeIterable*) _tmp1_); + _item_it = _tmp2_; + while (TRUE) { + GeeIterator* _tmp3_; + gboolean _tmp4_ = FALSE; + GeeIterator* _tmp5_; + gpointer _tmp6_ = NULL; + gpointer item; + GeeArrayList* _tmp7_; + gconstpointer _tmp8_; + _tmp3_ = _item_it; + _tmp4_ = gee_iterator_next (_tmp3_); + if (!_tmp4_) { + break; + } + _tmp5_ = _item_it; + _tmp6_ = gee_iterator_get (_tmp5_); + item = _tmp6_; + _tmp7_ = copy; + _tmp8_ = item; + gee_abstract_collection_add ((GeeAbstractCollection*) _tmp7_, _tmp8_); + ((item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (item = (self->priv->g_destroy_func (item), NULL)); + } + _g_object_unref0 (_item_it); + } + result = (GeeCollection*) copy; + return result; +} + + +GeeBenchmarkArrayListFactory* gee_benchmark_array_list_factory_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) { + GeeBenchmarkArrayListFactory * self = NULL; + self = (GeeBenchmarkArrayListFactory*) g_object_new (object_type, NULL); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + return self; +} + + +GeeBenchmarkArrayListFactory* gee_benchmark_array_list_factory_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) { + return gee_benchmark_array_list_factory_construct (GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY, g_type, g_dup_func, g_destroy_func); +} + + +static void gee_benchmark_array_list_factory_class_init (GeeBenchmarkArrayListFactoryClass * klass) { + gee_benchmark_array_list_factory_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeBenchmarkArrayListFactoryPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_benchmark_array_list_factory_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_benchmark_array_list_factory_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_ARRAY_LIST_FACTORY_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_ARRAY_LIST_FACTORY_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_ARRAY_LIST_FACTORY_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_benchmark_array_list_factory_gee_benchmark_factory_interface_init (GeeBenchmarkFactoryIface * iface) { + gee_benchmark_array_list_factory_gee_benchmark_factory_parent_iface = g_type_interface_peek_parent (iface); + iface->create = (GeeCollection* (*)(GeeBenchmarkFactory*)) gee_benchmark_array_list_factory_real_create; + iface->copy = (GeeCollection* (*)(GeeBenchmarkFactory*, GeeCollection*)) gee_benchmark_array_list_factory_real_copy; +} + + +static void gee_benchmark_array_list_factory_instance_init (GeeBenchmarkArrayListFactory * self) { + self->priv = GEE_BENCHMARK_ARRAY_LIST_FACTORY_GET_PRIVATE (self); +} + + +GType gee_benchmark_array_list_factory_get_type (void) { + static volatile gsize gee_benchmark_array_list_factory_type_id__volatile = 0; + if (g_once_init_enter (&gee_benchmark_array_list_factory_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeBenchmarkArrayListFactoryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_benchmark_array_list_factory_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeBenchmarkArrayListFactory), 0, (GInstanceInitFunc) gee_benchmark_array_list_factory_instance_init, NULL }; + static const GInterfaceInfo gee_benchmark_factory_info = { (GInterfaceInitFunc) gee_benchmark_array_list_factory_gee_benchmark_factory_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_benchmark_array_list_factory_type_id; + gee_benchmark_array_list_factory_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeBenchmarkArrayListFactory", &g_define_type_info, 0); + g_type_add_interface_static (gee_benchmark_array_list_factory_type_id, GEE_BENCHMARK_TYPE_FACTORY, &gee_benchmark_factory_info); + g_once_init_leave (&gee_benchmark_array_list_factory_type_id__volatile, gee_benchmark_array_list_factory_type_id); + } + return gee_benchmark_array_list_factory_type_id__volatile; +} + + +static void _vala_gee_benchmark_array_list_factory_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeBenchmarkArrayListFactory * self; + self = GEE_BENCHMARK_ARRAY_LIST_FACTORY (object); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_benchmark_array_list_factory_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeBenchmarkArrayListFactory * self; + self = GEE_BENCHMARK_ARRAY_LIST_FACTORY (object); + switch (property_id) { + case GEE_BENCHMARK_ARRAY_LIST_FACTORY_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_BENCHMARK_ARRAY_LIST_FACTORY_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_BENCHMARK_ARRAY_LIST_FACTORY_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static gint* _vala_array_dup1 (gint* self, int length) { + return g_memdup (self, length * sizeof (gint)); +} + + +GeeBenchmarkBenchmark* gee_benchmark_benchmark_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeBenchmarkFactory* factory, GeeList* algorithms, GeeList* generators, gint* sizes, int sizes_length1, gint iteration_count) { + GeeBenchmarkBenchmark * self = NULL; + GeeBenchmarkFactory* _tmp0_; + GeeBenchmarkFactory* _tmp1_; + GeeList* _tmp2_; + GeeList* _tmp3_; + gint* _tmp4_; + gint _tmp4__length1; + gint* _tmp5_; + gint _tmp5__length1; + GeeList* _tmp6_; + GeeList* _tmp7_; + gint _tmp8_; + g_return_val_if_fail (factory != NULL, NULL); + g_return_val_if_fail (algorithms != NULL, NULL); + g_return_val_if_fail (generators != NULL, NULL); + self = (GeeBenchmarkBenchmark*) g_object_new (object_type, NULL); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = factory; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->factory); + self->priv->factory = _tmp1_; + _tmp2_ = algorithms; + _tmp3_ = _g_object_ref0 (_tmp2_); + _g_object_unref0 (self->priv->algorithms); + self->priv->algorithms = _tmp3_; + _tmp4_ = sizes; + _tmp4__length1 = sizes_length1; + _tmp5_ = (_tmp4_ != NULL) ? _vala_array_dup1 (_tmp4_, _tmp4__length1) : ((gpointer) _tmp4_); + _tmp5__length1 = _tmp4__length1; + self->priv->sizes = (g_free (self->priv->sizes), NULL); + self->priv->sizes = _tmp5_; + self->priv->sizes_length1 = _tmp5__length1; + self->priv->_sizes_size_ = self->priv->sizes_length1; + _tmp6_ = generators; + _tmp7_ = _g_object_ref0 (_tmp6_); + _g_object_unref0 (self->priv->generators); + self->priv->generators = _tmp7_; + _tmp8_ = iteration_count; + self->priv->iteration_count = _tmp8_; + return self; +} + + +GeeBenchmarkBenchmark* gee_benchmark_benchmark_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeBenchmarkFactory* factory, GeeList* algorithms, GeeList* generators, gint* sizes, int sizes_length1, gint iteration_count) { + return gee_benchmark_benchmark_construct (GEE_BENCHMARK_TYPE_BENCHMARK, g_type, g_dup_func, g_destroy_func, factory, algorithms, generators, sizes, sizes_length1, iteration_count); +} + + +void gee_benchmark_benchmark_run (GeeBenchmarkBenchmark* self) { + gint* _tmp0_; + gint _tmp0__length1; + GeeList* _tmp1_; + gint _tmp2_; + gint _tmp3_; + GeeList* _tmp4_; + gint _tmp5_; + gint _tmp6_; + gdouble* _tmp7_ = NULL; + gint* _tmp8_; + gint _tmp8__length1; + GeeList* _tmp9_; + gint _tmp10_; + gint _tmp11_; + GeeList* _tmp12_; + gint _tmp13_; + gint _tmp14_; + gdouble* _tmp15_ = NULL; + GTimer* _tmp45_; + GTimer* timer; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->sizes; + _tmp0__length1 = self->priv->sizes_length1; + _tmp1_ = self->priv->generators; + _tmp2_ = gee_collection_get_size ((GeeCollection*) _tmp1_); + _tmp3_ = _tmp2_; + _tmp4_ = self->priv->algorithms; + _tmp5_ = gee_collection_get_size ((GeeCollection*) _tmp4_); + _tmp6_ = _tmp5_; + _tmp7_ = g_new0 (gdouble, (_tmp0__length1 * _tmp3_) * _tmp6_); + self->priv->results_sum = (g_free (self->priv->results_sum), NULL); + self->priv->results_sum = _tmp7_; + self->priv->results_sum_length1 = _tmp0__length1; + self->priv->results_sum_length2 = _tmp3_; + self->priv->results_sum_length3 = _tmp6_; + _tmp8_ = self->priv->sizes; + _tmp8__length1 = self->priv->sizes_length1; + _tmp9_ = self->priv->generators; + _tmp10_ = gee_collection_get_size ((GeeCollection*) _tmp9_); + _tmp11_ = _tmp10_; + _tmp12_ = self->priv->algorithms; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _tmp15_ = g_new0 (gdouble, (_tmp8__length1 * _tmp11_) * _tmp14_); + self->priv->results_squared_sum = (g_free (self->priv->results_squared_sum), NULL); + self->priv->results_squared_sum = _tmp15_; + self->priv->results_squared_sum_length1 = _tmp8__length1; + self->priv->results_squared_sum_length2 = _tmp11_; + self->priv->results_squared_sum_length3 = _tmp14_; + { + gint i; + i = 0; + { + gboolean _tmp16_; + _tmp16_ = TRUE; + while (TRUE) { + gboolean _tmp17_; + gint _tmp19_; + gint* _tmp20_; + gint _tmp20__length1; + _tmp17_ = _tmp16_; + if (!_tmp17_) { + gint _tmp18_; + _tmp18_ = i; + i = _tmp18_ + 1; + } + _tmp16_ = FALSE; + _tmp19_ = i; + _tmp20_ = self->priv->sizes; + _tmp20__length1 = self->priv->sizes_length1; + if (!(_tmp19_ < _tmp20__length1)) { + break; + } + { + gint j; + j = 0; + { + gboolean _tmp21_; + _tmp21_ = TRUE; + while (TRUE) { + gboolean _tmp22_; + gint _tmp24_; + GeeList* _tmp25_; + gint _tmp26_; + gint _tmp27_; + _tmp22_ = _tmp21_; + if (!_tmp22_) { + gint _tmp23_; + _tmp23_ = j; + j = _tmp23_ + 1; + } + _tmp21_ = FALSE; + _tmp24_ = j; + _tmp25_ = self->priv->generators; + _tmp26_ = gee_collection_get_size ((GeeCollection*) _tmp25_); + _tmp27_ = _tmp26_; + if (!(_tmp24_ < _tmp27_)) { + break; + } + { + gint k; + k = 0; + { + gboolean _tmp28_; + _tmp28_ = TRUE; + while (TRUE) { + gboolean _tmp29_; + gint _tmp31_; + GeeList* _tmp32_; + gint _tmp33_; + gint _tmp34_; + gdouble* _tmp35_; + gint _tmp35__length1; + gint _tmp35__length2; + gint _tmp35__length3; + gint _tmp36_; + gint _tmp37_; + gint _tmp38_; + gdouble _tmp39_; + gdouble* _tmp40_; + gint _tmp40__length1; + gint _tmp40__length2; + gint _tmp40__length3; + gint _tmp41_; + gint _tmp42_; + gint _tmp43_; + gdouble _tmp44_; + _tmp29_ = _tmp28_; + if (!_tmp29_) { + gint _tmp30_; + _tmp30_ = k; + k = _tmp30_ + 1; + } + _tmp28_ = FALSE; + _tmp31_ = k; + _tmp32_ = self->priv->algorithms; + _tmp33_ = gee_collection_get_size ((GeeCollection*) _tmp32_); + _tmp34_ = _tmp33_; + if (!(_tmp31_ < _tmp34_)) { + break; + } + _tmp35_ = self->priv->results_sum; + _tmp35__length1 = self->priv->results_sum_length1; + _tmp35__length2 = self->priv->results_sum_length2; + _tmp35__length3 = self->priv->results_sum_length3; + _tmp36_ = i; + _tmp37_ = j; + _tmp38_ = k; + _tmp35_[(((_tmp36_ * _tmp35__length2) + _tmp37_) * _tmp35__length3) + _tmp38_] = (gdouble) 0; + _tmp39_ = _tmp35_[(((_tmp36_ * _tmp35__length2) + _tmp37_) * _tmp35__length3) + _tmp38_]; + _tmp40_ = self->priv->results_squared_sum; + _tmp40__length1 = self->priv->results_squared_sum_length1; + _tmp40__length2 = self->priv->results_squared_sum_length2; + _tmp40__length3 = self->priv->results_squared_sum_length3; + _tmp41_ = i; + _tmp42_ = j; + _tmp43_ = k; + _tmp40_[(((_tmp41_ * _tmp40__length2) + _tmp42_) * _tmp40__length3) + _tmp43_] = (gdouble) 0; + _tmp44_ = _tmp40_[(((_tmp41_ * _tmp40__length2) + _tmp42_) * _tmp40__length3) + _tmp43_]; + } + } + } + } + } + } + } + } + } + _tmp45_ = g_timer_new (); + timer = _tmp45_; + { + gint iteration; + iteration = 1; + { + gboolean _tmp46_; + _tmp46_ = TRUE; + while (TRUE) { + gboolean _tmp47_; + gint _tmp49_; + gint _tmp50_; + gint _tmp107_; + FILE* _tmp110_; + gint _tmp111_; + _tmp47_ = _tmp46_; + if (!_tmp47_) { + gint _tmp48_; + _tmp48_ = iteration; + iteration = _tmp48_ + 1; + } + _tmp46_ = FALSE; + _tmp49_ = iteration; + _tmp50_ = self->priv->iteration_count; + if (!(_tmp49_ <= _tmp50_)) { + break; + } + { + gint i; + i = 0; + { + gboolean _tmp51_; + _tmp51_ = TRUE; + while (TRUE) { + gboolean _tmp52_; + gint _tmp54_; + gint* _tmp55_; + gint _tmp55__length1; + gint* _tmp56_; + gint _tmp56__length1; + gint _tmp57_; + gint _tmp58_; + gint size; + _tmp52_ = _tmp51_; + if (!_tmp52_) { + gint _tmp53_; + _tmp53_ = i; + i = _tmp53_ + 1; + } + _tmp51_ = FALSE; + _tmp54_ = i; + _tmp55_ = self->priv->sizes; + _tmp55__length1 = self->priv->sizes_length1; + if (!(_tmp54_ < _tmp55__length1)) { + break; + } + _tmp56_ = self->priv->sizes; + _tmp56__length1 = self->priv->sizes_length1; + _tmp57_ = i; + _tmp58_ = _tmp56_[_tmp57_]; + size = _tmp58_; + { + gint j; + j = 0; + { + gboolean _tmp59_; + _tmp59_ = TRUE; + while (TRUE) { + gboolean _tmp60_; + gint _tmp62_; + GeeList* _tmp63_; + gint _tmp64_; + gint _tmp65_; + GeeBenchmarkFactory* _tmp66_; + GeeCollection* _tmp67_ = NULL; + GeeCollection* collection; + GeeList* _tmp68_; + gint _tmp69_; + gpointer _tmp70_ = NULL; + GeeBenchmarkGenerator* _tmp71_; + gint _tmp72_; + GeeCollection* _tmp73_; + _tmp60_ = _tmp59_; + if (!_tmp60_) { + gint _tmp61_; + _tmp61_ = j; + j = _tmp61_ + 1; + } + _tmp59_ = FALSE; + _tmp62_ = j; + _tmp63_ = self->priv->generators; + _tmp64_ = gee_collection_get_size ((GeeCollection*) _tmp63_); + _tmp65_ = _tmp64_; + if (!(_tmp62_ < _tmp65_)) { + break; + } + _tmp66_ = self->priv->factory; + _tmp67_ = gee_benchmark_factory_create (_tmp66_); + collection = _tmp67_; + _tmp68_ = self->priv->generators; + _tmp69_ = j; + _tmp70_ = gee_list_get (_tmp68_, _tmp69_); + _tmp71_ = (GeeBenchmarkGenerator*) _tmp70_; + _tmp72_ = size; + _tmp73_ = collection; + gee_benchmark_generator_generate_collection (_tmp71_, _tmp72_, _tmp73_); + _g_object_unref0 (_tmp71_); + { + gint k; + k = 0; + { + gboolean _tmp74_; + _tmp74_ = TRUE; + while (TRUE) { + gboolean _tmp75_; + gint _tmp77_; + GeeList* _tmp78_; + gint _tmp79_; + gint _tmp80_; + GeeBenchmarkFactory* _tmp81_; + GeeCollection* _tmp82_; + GeeCollection* _tmp83_ = NULL; + GeeCollection* copy; + GTimer* _tmp84_; + GTimer* _tmp85_; + GeeList* _tmp86_; + gint _tmp87_; + gpointer _tmp88_ = NULL; + GeeBenchmarkAlgorithm* _tmp89_; + GeeCollection* _tmp90_; + GTimer* _tmp91_; + GTimer* _tmp92_; + gdouble _tmp93_ = 0.0; + gdouble elapsed; + gdouble* _tmp94_; + gint _tmp94__length1; + gint _tmp94__length2; + gint _tmp94__length3; + gint _tmp95_; + gint _tmp96_; + gint _tmp97_; + gdouble _tmp98_; + gdouble _tmp99_; + gdouble* _tmp100_; + gint _tmp100__length1; + gint _tmp100__length2; + gint _tmp100__length3; + gint _tmp101_; + gint _tmp102_; + gint _tmp103_; + gdouble _tmp104_; + gdouble _tmp105_ = 0.0; + gdouble _tmp106_; + _tmp75_ = _tmp74_; + if (!_tmp75_) { + gint _tmp76_; + _tmp76_ = k; + k = _tmp76_ + 1; + } + _tmp74_ = FALSE; + _tmp77_ = k; + _tmp78_ = self->priv->algorithms; + _tmp79_ = gee_collection_get_size ((GeeCollection*) _tmp78_); + _tmp80_ = _tmp79_; + if (!(_tmp77_ < _tmp80_)) { + break; + } + _tmp81_ = self->priv->factory; + _tmp82_ = collection; + _tmp83_ = gee_benchmark_factory_copy (_tmp81_, _tmp82_); + copy = _tmp83_; + _tmp84_ = timer; + g_timer_reset (_tmp84_); + _tmp85_ = timer; + g_timer_start (_tmp85_); + _tmp86_ = self->priv->algorithms; + _tmp87_ = k; + _tmp88_ = gee_list_get (_tmp86_, _tmp87_); + _tmp89_ = (GeeBenchmarkAlgorithm*) _tmp88_; + _tmp90_ = copy; + gee_benchmark_algorithm_process_collection (_tmp89_, _tmp90_); + _g_object_unref0 (_tmp89_); + _tmp91_ = timer; + g_timer_stop (_tmp91_); + _tmp92_ = timer; + _tmp93_ = g_timer_elapsed (_tmp92_, NULL); + elapsed = _tmp93_; + _tmp94_ = self->priv->results_sum; + _tmp94__length1 = self->priv->results_sum_length1; + _tmp94__length2 = self->priv->results_sum_length2; + _tmp94__length3 = self->priv->results_sum_length3; + _tmp95_ = i; + _tmp96_ = j; + _tmp97_ = k; + _tmp98_ = elapsed; + _tmp94_[(((_tmp95_ * _tmp94__length2) + _tmp96_) * _tmp94__length3) + _tmp97_] += _tmp98_; + _tmp99_ = _tmp94_[(((_tmp95_ * _tmp94__length2) + _tmp96_) * _tmp94__length3) + _tmp97_]; + _tmp100_ = self->priv->results_squared_sum; + _tmp100__length1 = self->priv->results_squared_sum_length1; + _tmp100__length2 = self->priv->results_squared_sum_length2; + _tmp100__length3 = self->priv->results_squared_sum_length3; + _tmp101_ = i; + _tmp102_ = j; + _tmp103_ = k; + _tmp104_ = elapsed; + _tmp105_ = pow (_tmp104_, (gdouble) 2); + _tmp100_[(((_tmp101_ * _tmp100__length2) + _tmp102_) * _tmp100__length3) + _tmp103_] += _tmp105_; + _tmp106_ = _tmp100_[(((_tmp101_ * _tmp100__length2) + _tmp102_) * _tmp100__length3) + _tmp103_]; + _g_object_unref0 (copy); + } + } + } + _g_object_unref0 (collection); + } + } + } + } + } + } + _tmp107_ = iteration; + if ((_tmp107_ % 10) == 0) { + FILE* _tmp108_; + _tmp108_ = stdout; + fprintf (_tmp108_, "|"); + } else { + FILE* _tmp109_; + _tmp109_ = stdout; + fprintf (_tmp109_, "*"); + } + _tmp110_ = stdout; + fflush (_tmp110_); + _tmp111_ = iteration; + if ((_tmp111_ % 100) == 0) { + FILE* _tmp112_; + gint _tmp113_; + _tmp112_ = stdout; + fprintf (_tmp112_, "\n\n"); + _tmp113_ = iteration; + gee_benchmark_benchmark_display_results (self, _tmp113_); + } + } + } + } + _g_timer_destroy0 (timer); +} + + +void gee_benchmark_benchmark_display_results (GeeBenchmarkBenchmark* self, gint iteration) { + FILE* _tmp0_; + gint _tmp1_; + FILE* _tmp70_; + g_return_if_fail (self != NULL); + _tmp0_ = stdout; + _tmp1_ = iteration; + fprintf (_tmp0_, "After %d iterations: (average [sample standard deviation] in seconds)\n" \ +"\n", _tmp1_); + { + gint i; + i = 0; + { + gboolean _tmp2_; + _tmp2_ = TRUE; + while (TRUE) { + gboolean _tmp3_; + gint _tmp5_; + gint* _tmp6_; + gint _tmp6__length1; + FILE* _tmp7_; + gint* _tmp8_; + gint _tmp8__length1; + gint _tmp9_; + gint _tmp10_; + FILE* _tmp11_; + FILE* _tmp26_; + FILE* _tmp69_; + _tmp3_ = _tmp2_; + if (!_tmp3_) { + gint _tmp4_; + _tmp4_ = i; + i = _tmp4_ + 1; + } + _tmp2_ = FALSE; + _tmp5_ = i; + _tmp6_ = self->priv->sizes; + _tmp6__length1 = self->priv->sizes_length1; + if (!(_tmp5_ < _tmp6__length1)) { + break; + } + _tmp7_ = stdout; + _tmp8_ = self->priv->sizes; + _tmp8__length1 = self->priv->sizes_length1; + _tmp9_ = i; + _tmp10_ = _tmp8_[_tmp9_]; + fprintf (_tmp7_, "%d elements:\n", _tmp10_); + _tmp11_ = stdout; + fprintf (_tmp11_, "%20s\t", ""); + { + gint k; + k = 0; + { + gboolean _tmp12_; + _tmp12_ = TRUE; + while (TRUE) { + gboolean _tmp13_; + gint _tmp15_; + GeeList* _tmp16_; + gint _tmp17_; + gint _tmp18_; + FILE* _tmp19_; + GeeList* _tmp20_; + gint _tmp21_; + gpointer _tmp22_ = NULL; + GeeBenchmarkAlgorithm* _tmp23_; + const gchar* _tmp24_; + const gchar* _tmp25_; + _tmp13_ = _tmp12_; + if (!_tmp13_) { + gint _tmp14_; + _tmp14_ = k; + k = _tmp14_ + 1; + } + _tmp12_ = FALSE; + _tmp15_ = k; + _tmp16_ = self->priv->algorithms; + _tmp17_ = gee_collection_get_size ((GeeCollection*) _tmp16_); + _tmp18_ = _tmp17_; + if (!(_tmp15_ < _tmp18_)) { + break; + } + _tmp19_ = stdout; + _tmp20_ = self->priv->algorithms; + _tmp21_ = k; + _tmp22_ = gee_list_get (_tmp20_, _tmp21_); + _tmp23_ = (GeeBenchmarkAlgorithm*) _tmp22_; + _tmp24_ = gee_benchmark_algorithm_get_name (_tmp23_); + _tmp25_ = _tmp24_; + fprintf (_tmp19_, "%-20s\t", _tmp25_); + _g_object_unref0 (_tmp23_); + } + } + } + _tmp26_ = stdout; + fprintf (_tmp26_, "\n"); + { + gint j; + j = 0; + { + gboolean _tmp27_; + _tmp27_ = TRUE; + while (TRUE) { + gboolean _tmp28_; + gint _tmp30_; + GeeList* _tmp31_; + gint _tmp32_; + gint _tmp33_; + FILE* _tmp34_; + GeeList* _tmp35_; + gint _tmp36_; + gpointer _tmp37_ = NULL; + GeeBenchmarkGenerator* _tmp38_; + const gchar* _tmp39_; + const gchar* _tmp40_; + FILE* _tmp68_; + _tmp28_ = _tmp27_; + if (!_tmp28_) { + gint _tmp29_; + _tmp29_ = j; + j = _tmp29_ + 1; + } + _tmp27_ = FALSE; + _tmp30_ = j; + _tmp31_ = self->priv->generators; + _tmp32_ = gee_collection_get_size ((GeeCollection*) _tmp31_); + _tmp33_ = _tmp32_; + if (!(_tmp30_ < _tmp33_)) { + break; + } + _tmp34_ = stdout; + _tmp35_ = self->priv->generators; + _tmp36_ = j; + _tmp37_ = gee_list_get (_tmp35_, _tmp36_); + _tmp38_ = (GeeBenchmarkGenerator*) _tmp37_; + _tmp39_ = gee_benchmark_generator_get_name (_tmp38_); + _tmp40_ = _tmp39_; + fprintf (_tmp34_, "%20s\t", _tmp40_); + _g_object_unref0 (_tmp38_); + { + gint k; + k = 0; + { + gboolean _tmp41_; + _tmp41_ = TRUE; + while (TRUE) { + gboolean _tmp42_; + gint _tmp44_; + GeeList* _tmp45_; + gint _tmp46_; + gint _tmp47_; + gdouble* _tmp48_; + gint _tmp48__length1; + gint _tmp48__length2; + gint _tmp48__length3; + gint _tmp49_; + gint _tmp50_; + gint _tmp51_; + gdouble _tmp52_; + gint _tmp53_; + gdouble average; + gdouble* _tmp54_; + gint _tmp54__length1; + gint _tmp54__length2; + gint _tmp54__length3; + gint _tmp55_; + gint _tmp56_; + gint _tmp57_; + gdouble _tmp58_; + gint _tmp59_; + gdouble _tmp60_; + gdouble _tmp61_ = 0.0; + gint _tmp62_; + gdouble squared_deviation; + gdouble _tmp63_; + gdouble _tmp64_ = 0.0; + gdouble deviation; + FILE* _tmp65_; + gdouble _tmp66_; + gdouble _tmp67_; + _tmp42_ = _tmp41_; + if (!_tmp42_) { + gint _tmp43_; + _tmp43_ = k; + k = _tmp43_ + 1; + } + _tmp41_ = FALSE; + _tmp44_ = k; + _tmp45_ = self->priv->algorithms; + _tmp46_ = gee_collection_get_size ((GeeCollection*) _tmp45_); + _tmp47_ = _tmp46_; + if (!(_tmp44_ < _tmp47_)) { + break; + } + _tmp48_ = self->priv->results_sum; + _tmp48__length1 = self->priv->results_sum_length1; + _tmp48__length2 = self->priv->results_sum_length2; + _tmp48__length3 = self->priv->results_sum_length3; + _tmp49_ = i; + _tmp50_ = j; + _tmp51_ = k; + _tmp52_ = _tmp48_[(((_tmp49_ * _tmp48__length2) + _tmp50_) * _tmp48__length3) + _tmp51_]; + _tmp53_ = iteration; + average = _tmp52_ / _tmp53_; + _tmp54_ = self->priv->results_squared_sum; + _tmp54__length1 = self->priv->results_squared_sum_length1; + _tmp54__length2 = self->priv->results_squared_sum_length2; + _tmp54__length3 = self->priv->results_squared_sum_length3; + _tmp55_ = i; + _tmp56_ = j; + _tmp57_ = k; + _tmp58_ = _tmp54_[(((_tmp55_ * _tmp54__length2) + _tmp56_) * _tmp54__length3) + _tmp57_]; + _tmp59_ = iteration; + _tmp60_ = average; + _tmp61_ = pow (_tmp60_, (gdouble) 2); + _tmp62_ = iteration; + squared_deviation = (_tmp58_ - (((gdouble) _tmp59_) * _tmp61_)) / (_tmp62_ - 1); + _tmp63_ = squared_deviation; + _tmp64_ = sqrt (_tmp63_); + deviation = _tmp64_; + _tmp65_ = stdout; + _tmp66_ = average; + _tmp67_ = deviation; + fprintf (_tmp65_, "%8f [%8f] \t", _tmp66_, _tmp67_); + } + } + } + _tmp68_ = stdout; + fprintf (_tmp68_, "\n"); + } + } + } + _tmp69_ = stdout; + fprintf (_tmp69_, "\n"); + } + } + } + _tmp70_ = stdout; + fprintf (_tmp70_, "\n\n"); +} + + +static void gee_benchmark_benchmark_class_init (GeeBenchmarkBenchmarkClass * klass) { + gee_benchmark_benchmark_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeBenchmarkBenchmarkPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_benchmark_benchmark_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_benchmark_benchmark_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_benchmark_benchmark_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_BENCHMARK_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_BENCHMARK_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_BENCHMARK_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_benchmark_benchmark_instance_init (GeeBenchmarkBenchmark * self) { + self->priv = GEE_BENCHMARK_BENCHMARK_GET_PRIVATE (self); +} + + +static void gee_benchmark_benchmark_finalize (GObject* obj) { + GeeBenchmarkBenchmark * self; + self = GEE_BENCHMARK_BENCHMARK (obj); + _g_object_unref0 (self->priv->factory); + self->priv->sizes = (g_free (self->priv->sizes), NULL); + _g_object_unref0 (self->priv->generators); + _g_object_unref0 (self->priv->algorithms); + self->priv->results_sum = (g_free (self->priv->results_sum), NULL); + self->priv->results_squared_sum = (g_free (self->priv->results_squared_sum), NULL); + G_OBJECT_CLASS (gee_benchmark_benchmark_parent_class)->finalize (obj); +} + + +GType gee_benchmark_benchmark_get_type (void) { + static volatile gsize gee_benchmark_benchmark_type_id__volatile = 0; + if (g_once_init_enter (&gee_benchmark_benchmark_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeBenchmarkBenchmarkClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_benchmark_benchmark_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeBenchmarkBenchmark), 0, (GInstanceInitFunc) gee_benchmark_benchmark_instance_init, NULL }; + GType gee_benchmark_benchmark_type_id; + gee_benchmark_benchmark_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeBenchmarkBenchmark", &g_define_type_info, 0); + g_once_init_leave (&gee_benchmark_benchmark_type_id__volatile, gee_benchmark_benchmark_type_id); + } + return gee_benchmark_benchmark_type_id__volatile; +} + + +static void _vala_gee_benchmark_benchmark_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeBenchmarkBenchmark * self; + self = GEE_BENCHMARK_BENCHMARK (object); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_benchmark_benchmark_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeBenchmarkBenchmark * self; + self = GEE_BENCHMARK_BENCHMARK (object); + switch (property_id) { + case GEE_BENCHMARK_BENCHMARK_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_BENCHMARK_BENCHMARK_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_BENCHMARK_BENCHMARK_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/benchmark/benchmark.vala b/benchmark/benchmark.vala new file mode 100644 index 0000000..0aae1a5 --- /dev/null +++ b/benchmark/benchmark.vala @@ -0,0 +1,235 @@ +/* benchmark.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +using Gee; + +namespace Gee.Benchmark { + + public interface Factory : Object { + + public abstract Collection create (); + + public abstract Collection copy (Collection collection); + } + + public interface Generator : Object { + + public abstract string name { get; } + + public abstract void generate_collection (int size, Collection collection); + } + + public interface Algorithm : Object { + + public abstract string name { get; } + + public abstract void process_collection (Collection collection); + } + + public class RandomInt32 : Object, Generator { + + public string name { get { return "FullRandom"; } } + + public void generate_collection (int size, Collection collection) { + for (int i = 0; i < size; i++) { + collection.add (GLib.Random.int_range (0, size - 1)); + } + } + } + + public class FixedVarianceInt32 : Object, Generator { + + public string name { get { return "FixedVariance"; } } + + public void generate_collection (int size, Collection collection) { + int variance = (int) Math.sqrt (size); + for (int i = 0; i < size; i++) { + collection.add (i + GLib.Random.int_range (0, variance) - variance / 2); + } + } + } + + public class MountsInt32 : Object, Generator { + + public string name { get { return "Mounts"; } } + + public void generate_collection (int size, Collection collection) { + int index = 0; + int last = 0; + int variance = (int) Math.sqrt (size); + while (index < size) { + int width = GLib.Random.int_range (0, variance); + int height = GLib.Random.int_range (- variance / 2, variance / 2); + for (int i = 0; i < width; i++) { + collection.add (last + height / width); + } + index += width; + last += height; + } + } + } + + public class ReverseSortedInt32 : Object, Generator { + + public string name { get { return "ReverseSorted"; } } + + public void generate_collection (int size, Collection collection) { + for (int i = 0; i < size; i++) { + collection.add (size - i - 1); + } + } + } + + public class SortedInt32 : Object, Generator { + + public string name { get { return "Sorted"; } } + + public void generate_collection (int size, Collection collection) { + for (int i = 0; i < size; i++) { + collection.add (i); + } + } + } + + public class ArrayListFactory : Object, Factory { + + public Collection create () { + return new ArrayList (); + } + + public Collection copy (Collection collection) { + ArrayList copy = new ArrayList (); + foreach (G item in collection) { + copy.add (item); + } + return copy; + } + } + + public class Benchmark : Object { + + public Benchmark (Factory factory, + Gee.List> algorithms, + Gee.List> generators, + int[] sizes, + int iteration_count) { + this.factory = factory; + this.algorithms = algorithms; + this.sizes = sizes; + this.generators = generators; + this.iteration_count = iteration_count; + } + + private Factory factory; + private int[] sizes; + private Gee.List> generators; + private Gee.List> algorithms; + private int iteration_count; + private double[,,] results_sum; + private double[,,] results_squared_sum; + + public void run () { + results_sum = new double[sizes.length, + generators.size, + algorithms.size]; + results_squared_sum = new double[sizes.length, + generators.size, + algorithms.size]; + + for (int i = 0; i < sizes.length; i++) { + for (int j = 0; j < generators.size; j++) { + for (int k = 0; k < algorithms.size; k++) { + results_sum[i,j,k] = 0; + results_squared_sum[i,j,k] = 0; + } + } + } + + Timer timer = new Timer (); + + for (int iteration = 1; iteration <= iteration_count; iteration++) { + for (int i = 0; i < sizes.length; i++) { + int size = sizes[i]; + for (int j = 0; j < generators.size; j++) { + Collection collection = factory.create (); + generators[j].generate_collection (size, collection); + + for (int k = 0; k < algorithms.size; k++) { + Collection copy = factory.copy (collection); + + timer.reset (); + timer.start (); + algorithms[k].process_collection (copy); + timer.stop (); + + double elapsed = timer.elapsed (); + results_sum[i,j,k] += elapsed; + results_squared_sum[i,j,k] += Math.pow (elapsed, 2); + } + } + } + + if (iteration % 10 == 0) { + stdout.printf ("|"); + } else { + stdout.printf ("*"); + } + stdout.flush (); + if (iteration % 100 == 0) { + stdout.printf ("\n\n"); + display_results (iteration); + } + } + } + + public void display_results (int iteration) { + stdout.printf ("After %d iterations: (average [sample standard deviation] in seconds)\n\n", iteration); + + for (int i = 0; i < sizes.length; i++) { + stdout.printf ("%d elements:\n", sizes[i]); + + stdout.printf ("%20s\t", ""); + for (int k = 0; k < algorithms.size; k++) { + stdout.printf ("%-20s\t", algorithms[k].name); + } + stdout.printf ("\n"); + + for (int j = 0; j < generators.size; j++) { + stdout.printf ("%20s\t", generators[j].name); + for (int k = 0; k < algorithms.size; k++) { + double average = results_sum[i,j,k] / iteration; + double squared_deviation = + (results_squared_sum[i,j,k] + - ((double) iteration) * Math.pow (average, 2)) + / (iteration - 1); + double deviation = Math.sqrt (squared_deviation); + stdout.printf ("%8f [%8f] \t", average, deviation); + } + stdout.printf ("\n"); + } + stdout.printf ("\n"); + } + stdout.printf ("\n\n"); + } + } +} diff --git a/benchmark/benchmarks.vala.stamp b/benchmark/benchmarks.vala.stamp new file mode 100644 index 0000000..e69de29 diff --git a/benchmark/benchmarksorts.c b/benchmark/benchmarksorts.c new file mode 100644 index 0000000..97c2f5a --- /dev/null +++ b/benchmark/benchmarksorts.c @@ -0,0 +1,568 @@ +/* benchmarksorts.c generated by valac 0.16.1, the Vala compiler + * generated from benchmarksorts.vala, do not modify */ + +/* benchmarksorts.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +#include +#include +#include +#include +#include + + +#define GEE_BENCHMARK_TYPE_ALGORITHM (gee_benchmark_algorithm_get_type ()) +#define GEE_BENCHMARK_ALGORITHM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_ALGORITHM, GeeBenchmarkAlgorithm)) +#define GEE_BENCHMARK_IS_ALGORITHM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_ALGORITHM)) +#define GEE_BENCHMARK_ALGORITHM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_BENCHMARK_TYPE_ALGORITHM, GeeBenchmarkAlgorithmIface)) + +typedef struct _GeeBenchmarkAlgorithm GeeBenchmarkAlgorithm; +typedef struct _GeeBenchmarkAlgorithmIface GeeBenchmarkAlgorithmIface; + +#define GEE_BENCHMARK_TYPE_TIM_SORT (gee_benchmark_tim_sort_get_type ()) +#define GEE_BENCHMARK_TIM_SORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_TIM_SORT, GeeBenchmarkTimSort)) +#define GEE_BENCHMARK_TIM_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_TIM_SORT, GeeBenchmarkTimSortClass)) +#define GEE_BENCHMARK_IS_TIM_SORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_TIM_SORT)) +#define GEE_BENCHMARK_IS_TIM_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_TIM_SORT)) +#define GEE_BENCHMARK_TIM_SORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_TIM_SORT, GeeBenchmarkTimSortClass)) + +typedef struct _GeeBenchmarkTimSort GeeBenchmarkTimSort; +typedef struct _GeeBenchmarkTimSortClass GeeBenchmarkTimSortClass; +typedef struct _GeeBenchmarkTimSortPrivate GeeBenchmarkTimSortPrivate; + +#define GEE_BENCHMARK_TYPE_MERGE_SORT (gee_benchmark_merge_sort_get_type ()) +#define GEE_BENCHMARK_MERGE_SORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_MERGE_SORT, GeeBenchmarkMergeSort)) +#define GEE_BENCHMARK_MERGE_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_MERGE_SORT, GeeBenchmarkMergeSortClass)) +#define GEE_BENCHMARK_IS_MERGE_SORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_MERGE_SORT)) +#define GEE_BENCHMARK_IS_MERGE_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_MERGE_SORT)) +#define GEE_BENCHMARK_MERGE_SORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_MERGE_SORT, GeeBenchmarkMergeSortClass)) + +typedef struct _GeeBenchmarkMergeSort GeeBenchmarkMergeSort; +typedef struct _GeeBenchmarkMergeSortClass GeeBenchmarkMergeSortClass; +typedef struct _GeeBenchmarkMergeSortPrivate GeeBenchmarkMergeSortPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define GEE_BENCHMARK_TYPE_GENERATOR (gee_benchmark_generator_get_type ()) +#define GEE_BENCHMARK_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_GENERATOR, GeeBenchmarkGenerator)) +#define GEE_BENCHMARK_IS_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_GENERATOR)) +#define GEE_BENCHMARK_GENERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_BENCHMARK_TYPE_GENERATOR, GeeBenchmarkGeneratorIface)) + +typedef struct _GeeBenchmarkGenerator GeeBenchmarkGenerator; +typedef struct _GeeBenchmarkGeneratorIface GeeBenchmarkGeneratorIface; + +#define GEE_BENCHMARK_TYPE_RANDOM_INT32 (gee_benchmark_random_int32_get_type ()) +#define GEE_BENCHMARK_RANDOM_INT32(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_RANDOM_INT32, GeeBenchmarkRandomInt32)) +#define GEE_BENCHMARK_RANDOM_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_RANDOM_INT32, GeeBenchmarkRandomInt32Class)) +#define GEE_BENCHMARK_IS_RANDOM_INT32(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_RANDOM_INT32)) +#define GEE_BENCHMARK_IS_RANDOM_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_RANDOM_INT32)) +#define GEE_BENCHMARK_RANDOM_INT32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_RANDOM_INT32, GeeBenchmarkRandomInt32Class)) + +typedef struct _GeeBenchmarkRandomInt32 GeeBenchmarkRandomInt32; +typedef struct _GeeBenchmarkRandomInt32Class GeeBenchmarkRandomInt32Class; + +#define GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32 (gee_benchmark_fixed_variance_int32_get_type ()) +#define GEE_BENCHMARK_FIXED_VARIANCE_INT32(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32, GeeBenchmarkFixedVarianceInt32)) +#define GEE_BENCHMARK_FIXED_VARIANCE_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32, GeeBenchmarkFixedVarianceInt32Class)) +#define GEE_BENCHMARK_IS_FIXED_VARIANCE_INT32(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32)) +#define GEE_BENCHMARK_IS_FIXED_VARIANCE_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32)) +#define GEE_BENCHMARK_FIXED_VARIANCE_INT32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32, GeeBenchmarkFixedVarianceInt32Class)) + +typedef struct _GeeBenchmarkFixedVarianceInt32 GeeBenchmarkFixedVarianceInt32; +typedef struct _GeeBenchmarkFixedVarianceInt32Class GeeBenchmarkFixedVarianceInt32Class; + +#define GEE_BENCHMARK_TYPE_MOUNTS_INT32 (gee_benchmark_mounts_int32_get_type ()) +#define GEE_BENCHMARK_MOUNTS_INT32(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_MOUNTS_INT32, GeeBenchmarkMountsInt32)) +#define GEE_BENCHMARK_MOUNTS_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_MOUNTS_INT32, GeeBenchmarkMountsInt32Class)) +#define GEE_BENCHMARK_IS_MOUNTS_INT32(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_MOUNTS_INT32)) +#define GEE_BENCHMARK_IS_MOUNTS_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_MOUNTS_INT32)) +#define GEE_BENCHMARK_MOUNTS_INT32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_MOUNTS_INT32, GeeBenchmarkMountsInt32Class)) + +typedef struct _GeeBenchmarkMountsInt32 GeeBenchmarkMountsInt32; +typedef struct _GeeBenchmarkMountsInt32Class GeeBenchmarkMountsInt32Class; + +#define GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32 (gee_benchmark_reverse_sorted_int32_get_type ()) +#define GEE_BENCHMARK_REVERSE_SORTED_INT32(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32, GeeBenchmarkReverseSortedInt32)) +#define GEE_BENCHMARK_REVERSE_SORTED_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32, GeeBenchmarkReverseSortedInt32Class)) +#define GEE_BENCHMARK_IS_REVERSE_SORTED_INT32(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32)) +#define GEE_BENCHMARK_IS_REVERSE_SORTED_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32)) +#define GEE_BENCHMARK_REVERSE_SORTED_INT32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32, GeeBenchmarkReverseSortedInt32Class)) + +typedef struct _GeeBenchmarkReverseSortedInt32 GeeBenchmarkReverseSortedInt32; +typedef struct _GeeBenchmarkReverseSortedInt32Class GeeBenchmarkReverseSortedInt32Class; + +#define GEE_BENCHMARK_TYPE_SORTED_INT32 (gee_benchmark_sorted_int32_get_type ()) +#define GEE_BENCHMARK_SORTED_INT32(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_SORTED_INT32, GeeBenchmarkSortedInt32)) +#define GEE_BENCHMARK_SORTED_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_SORTED_INT32, GeeBenchmarkSortedInt32Class)) +#define GEE_BENCHMARK_IS_SORTED_INT32(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_SORTED_INT32)) +#define GEE_BENCHMARK_IS_SORTED_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_SORTED_INT32)) +#define GEE_BENCHMARK_SORTED_INT32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_SORTED_INT32, GeeBenchmarkSortedInt32Class)) + +typedef struct _GeeBenchmarkSortedInt32 GeeBenchmarkSortedInt32; +typedef struct _GeeBenchmarkSortedInt32Class GeeBenchmarkSortedInt32Class; + +#define GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY (gee_benchmark_array_list_factory_get_type ()) +#define GEE_BENCHMARK_ARRAY_LIST_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY, GeeBenchmarkArrayListFactory)) +#define GEE_BENCHMARK_ARRAY_LIST_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY, GeeBenchmarkArrayListFactoryClass)) +#define GEE_BENCHMARK_IS_ARRAY_LIST_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY)) +#define GEE_BENCHMARK_IS_ARRAY_LIST_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY)) +#define GEE_BENCHMARK_ARRAY_LIST_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY, GeeBenchmarkArrayListFactoryClass)) + +typedef struct _GeeBenchmarkArrayListFactory GeeBenchmarkArrayListFactory; +typedef struct _GeeBenchmarkArrayListFactoryClass GeeBenchmarkArrayListFactoryClass; + +#define GEE_BENCHMARK_TYPE_FACTORY (gee_benchmark_factory_get_type ()) +#define GEE_BENCHMARK_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_FACTORY, GeeBenchmarkFactory)) +#define GEE_BENCHMARK_IS_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_FACTORY)) +#define GEE_BENCHMARK_FACTORY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_BENCHMARK_TYPE_FACTORY, GeeBenchmarkFactoryIface)) + +typedef struct _GeeBenchmarkFactory GeeBenchmarkFactory; +typedef struct _GeeBenchmarkFactoryIface GeeBenchmarkFactoryIface; + +#define GEE_BENCHMARK_TYPE_BENCHMARK (gee_benchmark_benchmark_get_type ()) +#define GEE_BENCHMARK_BENCHMARK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_BENCHMARK, GeeBenchmarkBenchmark)) +#define GEE_BENCHMARK_BENCHMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_BENCHMARK, GeeBenchmarkBenchmarkClass)) +#define GEE_BENCHMARK_IS_BENCHMARK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_BENCHMARK)) +#define GEE_BENCHMARK_IS_BENCHMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_BENCHMARK)) +#define GEE_BENCHMARK_BENCHMARK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_BENCHMARK, GeeBenchmarkBenchmarkClass)) + +typedef struct _GeeBenchmarkBenchmark GeeBenchmarkBenchmark; +typedef struct _GeeBenchmarkBenchmarkClass GeeBenchmarkBenchmarkClass; + +struct _GeeBenchmarkAlgorithmIface { + GTypeInterface parent_iface; + void (*process_collection) (GeeBenchmarkAlgorithm* self, GeeCollection* collection); + const gchar* (*get_name) (GeeBenchmarkAlgorithm* self); +}; + +struct _GeeBenchmarkTimSort { + GObject parent_instance; + GeeBenchmarkTimSortPrivate * priv; +}; + +struct _GeeBenchmarkTimSortClass { + GObjectClass parent_class; +}; + +struct _GeeBenchmarkTimSortPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; +}; + +struct _GeeBenchmarkMergeSort { + GObject parent_instance; + GeeBenchmarkMergeSortPrivate * priv; +}; + +struct _GeeBenchmarkMergeSortClass { + GObjectClass parent_class; +}; + +struct _GeeBenchmarkMergeSortPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; +}; + +struct _GeeBenchmarkGeneratorIface { + GTypeInterface parent_iface; + void (*generate_collection) (GeeBenchmarkGenerator* self, gint size, GeeCollection* collection); + const gchar* (*get_name) (GeeBenchmarkGenerator* self); +}; + +struct _GeeBenchmarkFactoryIface { + GTypeInterface parent_iface; + GeeCollection* (*create) (GeeBenchmarkFactory* self); + GeeCollection* (*copy) (GeeBenchmarkFactory* self, GeeCollection* collection); +}; + + +static gpointer gee_benchmark_tim_sort_parent_class = NULL; +static GeeBenchmarkAlgorithmIface* gee_benchmark_tim_sort_gee_benchmark_algorithm_parent_iface = NULL; +static gpointer gee_benchmark_merge_sort_parent_class = NULL; +static GeeBenchmarkAlgorithmIface* gee_benchmark_merge_sort_gee_benchmark_algorithm_parent_iface = NULL; + +GType gee_benchmark_algorithm_get_type (void) G_GNUC_CONST; +GType gee_benchmark_tim_sort_get_type (void) G_GNUC_CONST; +#define GEE_BENCHMARK_TIM_SORT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_BENCHMARK_TYPE_TIM_SORT, GeeBenchmarkTimSortPrivate)) +enum { + GEE_BENCHMARK_TIM_SORT_DUMMY_PROPERTY, + GEE_BENCHMARK_TIM_SORT_G_TYPE, + GEE_BENCHMARK_TIM_SORT_G_DUP_FUNC, + GEE_BENCHMARK_TIM_SORT_G_DESTROY_FUNC, + GEE_BENCHMARK_TIM_SORT_NAME +}; +static void gee_benchmark_tim_sort_real_process_collection (GeeBenchmarkAlgorithm* base, GeeCollection* collection); +GeeBenchmarkTimSort* gee_benchmark_tim_sort_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeBenchmarkTimSort* gee_benchmark_tim_sort_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +const gchar* gee_benchmark_algorithm_get_name (GeeBenchmarkAlgorithm* self); +static void _vala_gee_benchmark_tim_sort_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_benchmark_tim_sort_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +GType gee_benchmark_merge_sort_get_type (void) G_GNUC_CONST; +#define GEE_BENCHMARK_MERGE_SORT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_BENCHMARK_TYPE_MERGE_SORT, GeeBenchmarkMergeSortPrivate)) +enum { + GEE_BENCHMARK_MERGE_SORT_DUMMY_PROPERTY, + GEE_BENCHMARK_MERGE_SORT_G_TYPE, + GEE_BENCHMARK_MERGE_SORT_G_DUP_FUNC, + GEE_BENCHMARK_MERGE_SORT_G_DESTROY_FUNC, + GEE_BENCHMARK_MERGE_SORT_NAME +}; +static void gee_benchmark_merge_sort_real_process_collection (GeeBenchmarkAlgorithm* base, GeeCollection* collection); +void gee_merge_sort_sort (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareFunc compare); +GeeBenchmarkMergeSort* gee_benchmark_merge_sort_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeBenchmarkMergeSort* gee_benchmark_merge_sort_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +static void _vala_gee_benchmark_merge_sort_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_benchmark_merge_sort_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +void gee_benchmark_main (gchar** args, int args_length1); +GType gee_benchmark_generator_get_type (void) G_GNUC_CONST; +GeeBenchmarkRandomInt32* gee_benchmark_random_int32_new (void); +GeeBenchmarkRandomInt32* gee_benchmark_random_int32_construct (GType object_type); +GType gee_benchmark_random_int32_get_type (void) G_GNUC_CONST; +GeeBenchmarkFixedVarianceInt32* gee_benchmark_fixed_variance_int32_new (void); +GeeBenchmarkFixedVarianceInt32* gee_benchmark_fixed_variance_int32_construct (GType object_type); +GType gee_benchmark_fixed_variance_int32_get_type (void) G_GNUC_CONST; +GeeBenchmarkMountsInt32* gee_benchmark_mounts_int32_new (void); +GeeBenchmarkMountsInt32* gee_benchmark_mounts_int32_construct (GType object_type); +GType gee_benchmark_mounts_int32_get_type (void) G_GNUC_CONST; +GeeBenchmarkReverseSortedInt32* gee_benchmark_reverse_sorted_int32_new (void); +GeeBenchmarkReverseSortedInt32* gee_benchmark_reverse_sorted_int32_construct (GType object_type); +GType gee_benchmark_reverse_sorted_int32_get_type (void) G_GNUC_CONST; +GeeBenchmarkSortedInt32* gee_benchmark_sorted_int32_new (void); +GeeBenchmarkSortedInt32* gee_benchmark_sorted_int32_construct (GType object_type); +GType gee_benchmark_sorted_int32_get_type (void) G_GNUC_CONST; +GeeBenchmarkArrayListFactory* gee_benchmark_array_list_factory_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeBenchmarkArrayListFactory* gee_benchmark_array_list_factory_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GType gee_benchmark_array_list_factory_get_type (void) G_GNUC_CONST; +GType gee_benchmark_factory_get_type (void) G_GNUC_CONST; +GeeBenchmarkBenchmark* gee_benchmark_benchmark_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeBenchmarkFactory* factory, GeeList* algorithms, GeeList* generators, gint* sizes, int sizes_length1, gint iteration_count); +GeeBenchmarkBenchmark* gee_benchmark_benchmark_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeBenchmarkFactory* factory, GeeList* algorithms, GeeList* generators, gint* sizes, int sizes_length1, gint iteration_count); +GType gee_benchmark_benchmark_get_type (void) G_GNUC_CONST; +void gee_benchmark_benchmark_run (GeeBenchmarkBenchmark* self); + + +static void gee_benchmark_tim_sort_real_process_collection (GeeBenchmarkAlgorithm* base, GeeCollection* collection) { + GeeBenchmarkTimSort * self; + GeeCollection* _tmp0_; + self = (GeeBenchmarkTimSort*) base; + g_return_if_fail (collection != NULL); + _tmp0_ = collection; + gee_list_sort (GEE_LIST (_tmp0_), NULL); +} + + +GeeBenchmarkTimSort* gee_benchmark_tim_sort_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) { + GeeBenchmarkTimSort * self = NULL; + self = (GeeBenchmarkTimSort*) g_object_new (object_type, NULL); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + return self; +} + + +GeeBenchmarkTimSort* gee_benchmark_tim_sort_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) { + return gee_benchmark_tim_sort_construct (GEE_BENCHMARK_TYPE_TIM_SORT, g_type, g_dup_func, g_destroy_func); +} + + +static const gchar* gee_benchmark_tim_sort_real_get_name (GeeBenchmarkAlgorithm* base) { + const gchar* result; + GeeBenchmarkTimSort* self; + self = (GeeBenchmarkTimSort*) base; + result = "TimSort"; + return result; +} + + +static void gee_benchmark_tim_sort_class_init (GeeBenchmarkTimSortClass * klass) { + gee_benchmark_tim_sort_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeBenchmarkTimSortPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_benchmark_tim_sort_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_benchmark_tim_sort_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_TIM_SORT_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_TIM_SORT_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_TIM_SORT_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_TIM_SORT_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_benchmark_tim_sort_gee_benchmark_algorithm_interface_init (GeeBenchmarkAlgorithmIface * iface) { + gee_benchmark_tim_sort_gee_benchmark_algorithm_parent_iface = g_type_interface_peek_parent (iface); + iface->process_collection = (void (*)(GeeBenchmarkAlgorithm*, GeeCollection*)) gee_benchmark_tim_sort_real_process_collection; + iface->get_name = gee_benchmark_tim_sort_real_get_name; +} + + +static void gee_benchmark_tim_sort_instance_init (GeeBenchmarkTimSort * self) { + self->priv = GEE_BENCHMARK_TIM_SORT_GET_PRIVATE (self); +} + + +GType gee_benchmark_tim_sort_get_type (void) { + static volatile gsize gee_benchmark_tim_sort_type_id__volatile = 0; + if (g_once_init_enter (&gee_benchmark_tim_sort_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeBenchmarkTimSortClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_benchmark_tim_sort_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeBenchmarkTimSort), 0, (GInstanceInitFunc) gee_benchmark_tim_sort_instance_init, NULL }; + static const GInterfaceInfo gee_benchmark_algorithm_info = { (GInterfaceInitFunc) gee_benchmark_tim_sort_gee_benchmark_algorithm_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_benchmark_tim_sort_type_id; + gee_benchmark_tim_sort_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeBenchmarkTimSort", &g_define_type_info, 0); + g_type_add_interface_static (gee_benchmark_tim_sort_type_id, GEE_BENCHMARK_TYPE_ALGORITHM, &gee_benchmark_algorithm_info); + g_once_init_leave (&gee_benchmark_tim_sort_type_id__volatile, gee_benchmark_tim_sort_type_id); + } + return gee_benchmark_tim_sort_type_id__volatile; +} + + +static void _vala_gee_benchmark_tim_sort_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeBenchmarkTimSort * self; + self = GEE_BENCHMARK_TIM_SORT (object); + switch (property_id) { + case GEE_BENCHMARK_TIM_SORT_NAME: + g_value_set_string (value, gee_benchmark_algorithm_get_name ((GeeBenchmarkAlgorithm*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_benchmark_tim_sort_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeBenchmarkTimSort * self; + self = GEE_BENCHMARK_TIM_SORT (object); + switch (property_id) { + case GEE_BENCHMARK_TIM_SORT_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_BENCHMARK_TIM_SORT_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_BENCHMARK_TIM_SORT_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void gee_benchmark_merge_sort_real_process_collection (GeeBenchmarkAlgorithm* base, GeeCollection* collection) { + GeeBenchmarkMergeSort * self; + GCompareFunc _tmp0_ = NULL; + GCompareFunc compare; + GeeCollection* _tmp1_; + self = (GeeBenchmarkMergeSort*) base; + g_return_if_fail (collection != NULL); + _tmp0_ = gee_functions_get_compare_func_for (self->priv->g_type); + compare = _tmp0_; + _tmp1_ = collection; + gee_merge_sort_sort (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, GEE_LIST (_tmp1_), compare); +} + + +GeeBenchmarkMergeSort* gee_benchmark_merge_sort_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) { + GeeBenchmarkMergeSort * self = NULL; + self = (GeeBenchmarkMergeSort*) g_object_new (object_type, NULL); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + return self; +} + + +GeeBenchmarkMergeSort* gee_benchmark_merge_sort_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) { + return gee_benchmark_merge_sort_construct (GEE_BENCHMARK_TYPE_MERGE_SORT, g_type, g_dup_func, g_destroy_func); +} + + +static const gchar* gee_benchmark_merge_sort_real_get_name (GeeBenchmarkAlgorithm* base) { + const gchar* result; + GeeBenchmarkMergeSort* self; + self = (GeeBenchmarkMergeSort*) base; + result = "MergeSort"; + return result; +} + + +static void gee_benchmark_merge_sort_class_init (GeeBenchmarkMergeSortClass * klass) { + gee_benchmark_merge_sort_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeBenchmarkMergeSortPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_benchmark_merge_sort_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_benchmark_merge_sort_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_MERGE_SORT_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_MERGE_SORT_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_MERGE_SORT_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_MERGE_SORT_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_benchmark_merge_sort_gee_benchmark_algorithm_interface_init (GeeBenchmarkAlgorithmIface * iface) { + gee_benchmark_merge_sort_gee_benchmark_algorithm_parent_iface = g_type_interface_peek_parent (iface); + iface->process_collection = (void (*)(GeeBenchmarkAlgorithm*, GeeCollection*)) gee_benchmark_merge_sort_real_process_collection; + iface->get_name = gee_benchmark_merge_sort_real_get_name; +} + + +static void gee_benchmark_merge_sort_instance_init (GeeBenchmarkMergeSort * self) { + self->priv = GEE_BENCHMARK_MERGE_SORT_GET_PRIVATE (self); +} + + +GType gee_benchmark_merge_sort_get_type (void) { + static volatile gsize gee_benchmark_merge_sort_type_id__volatile = 0; + if (g_once_init_enter (&gee_benchmark_merge_sort_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeBenchmarkMergeSortClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_benchmark_merge_sort_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeBenchmarkMergeSort), 0, (GInstanceInitFunc) gee_benchmark_merge_sort_instance_init, NULL }; + static const GInterfaceInfo gee_benchmark_algorithm_info = { (GInterfaceInitFunc) gee_benchmark_merge_sort_gee_benchmark_algorithm_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_benchmark_merge_sort_type_id; + gee_benchmark_merge_sort_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeBenchmarkMergeSort", &g_define_type_info, 0); + g_type_add_interface_static (gee_benchmark_merge_sort_type_id, GEE_BENCHMARK_TYPE_ALGORITHM, &gee_benchmark_algorithm_info); + g_once_init_leave (&gee_benchmark_merge_sort_type_id__volatile, gee_benchmark_merge_sort_type_id); + } + return gee_benchmark_merge_sort_type_id__volatile; +} + + +static void _vala_gee_benchmark_merge_sort_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeBenchmarkMergeSort * self; + self = GEE_BENCHMARK_MERGE_SORT (object); + switch (property_id) { + case GEE_BENCHMARK_MERGE_SORT_NAME: + g_value_set_string (value, gee_benchmark_algorithm_get_name ((GeeBenchmarkAlgorithm*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_benchmark_merge_sort_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeBenchmarkMergeSort * self; + self = GEE_BENCHMARK_MERGE_SORT (object); + switch (property_id) { + case GEE_BENCHMARK_MERGE_SORT_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_BENCHMARK_MERGE_SORT_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_BENCHMARK_MERGE_SORT_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +void gee_benchmark_main (gchar** args, int args_length1) { + GeeArrayList* _tmp0_; + GeeArrayList* algorithms; + GeeBenchmarkTimSort* _tmp1_; + GeeBenchmarkTimSort* _tmp2_; + GeeBenchmarkMergeSort* _tmp3_; + GeeBenchmarkMergeSort* _tmp4_; + GeeArrayList* _tmp5_; + GeeArrayList* generators; + GeeBenchmarkRandomInt32* _tmp6_; + GeeBenchmarkRandomInt32* _tmp7_; + GeeBenchmarkFixedVarianceInt32* _tmp8_; + GeeBenchmarkFixedVarianceInt32* _tmp9_; + GeeBenchmarkMountsInt32* _tmp10_; + GeeBenchmarkMountsInt32* _tmp11_; + GeeBenchmarkReverseSortedInt32* _tmp12_; + GeeBenchmarkReverseSortedInt32* _tmp13_; + GeeBenchmarkSortedInt32* _tmp14_; + GeeBenchmarkSortedInt32* _tmp15_; + GeeBenchmarkArrayListFactory* _tmp16_; + GeeBenchmarkArrayListFactory* _tmp17_; + gint* _tmp18_ = NULL; + gint* _tmp19_; + gint _tmp19__length1; + GeeBenchmarkBenchmark* _tmp20_; + GeeBenchmarkBenchmark* _tmp21_; + GeeBenchmarkBenchmark* benchmark; + _tmp0_ = gee_array_list_new (GEE_BENCHMARK_TYPE_ALGORITHM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL); + algorithms = _tmp0_; + _tmp1_ = gee_benchmark_tim_sort_new (G_TYPE_INT, NULL, NULL); + _tmp2_ = _tmp1_; + gee_abstract_collection_add ((GeeAbstractCollection*) algorithms, (GeeBenchmarkAlgorithm*) _tmp2_); + _g_object_unref0 (_tmp2_); + _tmp3_ = gee_benchmark_merge_sort_new (G_TYPE_INT, NULL, NULL); + _tmp4_ = _tmp3_; + gee_abstract_collection_add ((GeeAbstractCollection*) algorithms, (GeeBenchmarkAlgorithm*) _tmp4_); + _g_object_unref0 (_tmp4_); + _tmp5_ = gee_array_list_new (GEE_BENCHMARK_TYPE_GENERATOR, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL); + generators = _tmp5_; + _tmp6_ = gee_benchmark_random_int32_new (); + _tmp7_ = _tmp6_; + gee_abstract_collection_add ((GeeAbstractCollection*) generators, (GeeBenchmarkGenerator*) _tmp7_); + _g_object_unref0 (_tmp7_); + _tmp8_ = gee_benchmark_fixed_variance_int32_new (); + _tmp9_ = _tmp8_; + gee_abstract_collection_add ((GeeAbstractCollection*) generators, (GeeBenchmarkGenerator*) _tmp9_); + _g_object_unref0 (_tmp9_); + _tmp10_ = gee_benchmark_mounts_int32_new (); + _tmp11_ = _tmp10_; + gee_abstract_collection_add ((GeeAbstractCollection*) generators, (GeeBenchmarkGenerator*) _tmp11_); + _g_object_unref0 (_tmp11_); + _tmp12_ = gee_benchmark_reverse_sorted_int32_new (); + _tmp13_ = _tmp12_; + gee_abstract_collection_add ((GeeAbstractCollection*) generators, (GeeBenchmarkGenerator*) _tmp13_); + _g_object_unref0 (_tmp13_); + _tmp14_ = gee_benchmark_sorted_int32_new (); + _tmp15_ = _tmp14_; + gee_abstract_collection_add ((GeeAbstractCollection*) generators, (GeeBenchmarkGenerator*) _tmp15_); + _g_object_unref0 (_tmp15_); + _tmp16_ = gee_benchmark_array_list_factory_new (G_TYPE_INT, NULL, NULL); + _tmp17_ = _tmp16_; + _tmp18_ = g_new0 (gint, 6); + _tmp18_[0] = 10; + _tmp18_[1] = 100; + _tmp18_[2] = 1000; + _tmp18_[3] = 10000; + _tmp18_[4] = 100000; + _tmp18_[5] = 1000000; + _tmp19_ = _tmp18_; + _tmp19__length1 = 6; + _tmp20_ = gee_benchmark_benchmark_new (G_TYPE_INT, NULL, NULL, (GeeBenchmarkFactory*) _tmp17_, (GeeList*) algorithms, (GeeList*) generators, _tmp19_, 6, 1000); + _tmp21_ = _tmp20_; + _tmp19_ = (g_free (_tmp19_), NULL); + _g_object_unref0 (_tmp17_); + benchmark = _tmp21_; + gee_benchmark_benchmark_run (benchmark); + _g_object_unref0 (benchmark); + _g_object_unref0 (generators); + _g_object_unref0 (algorithms); +} + + +int main (int argc, char ** argv) { + g_type_init (); + gee_benchmark_main (argv, argc); + return 0; +} + + + diff --git a/benchmark/benchmarksorts.vala b/benchmark/benchmarksorts.vala new file mode 100644 index 0000000..6e384cf --- /dev/null +++ b/benchmark/benchmarksorts.vala @@ -0,0 +1,73 @@ +/* benchmarksorts.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +using Gee; + +namespace Gee.Benchmark { + + public class TimSort : Object, Algorithm { + + public string name { get { return "TimSort"; } } + + public void process_collection (Collection collection) { + ((Gee.List) collection).sort (); + } + } + + public class MergeSort : Object, Algorithm { + + public string name { get { return "MergeSort"; } } + + public void process_collection (Collection collection) { + CompareFunc compare = Functions.get_compare_func_for (typeof (G)); + Gee.MergeSort.sort ((Gee.List) collection, compare); + } + } + + void main (string[] args) { + var algorithms = new ArrayList> (); + algorithms.add (new TimSort ()); + algorithms.add (new MergeSort ()); + + var generators = new ArrayList> (); + generators.add (new RandomInt32 ()); + generators.add (new FixedVarianceInt32 ()); + generators.add (new MountsInt32 ()); + generators.add (new ReverseSortedInt32 ()); + generators.add (new SortedInt32 ()); + + Benchmark benchmark = + new Benchmark (new ArrayListFactory (), + algorithms, + generators, + new int[] { 10, + 100, + 1000, + 10000, + 100000, + 1000000 + }, + 1000); + benchmark.run (); + } +} diff --git a/benchmark/mergesort.c b/benchmark/mergesort.c new file mode 100644 index 0000000..1a2a841 --- /dev/null +++ b/benchmark/mergesort.c @@ -0,0 +1,705 @@ +/* mergesort.c generated by valac 0.16.1, the Vala compiler + * generated from mergesort.vala, do not modify */ + +/* mergesort.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Will + */ + +#include +#include +#include +#include + + +#define GEE_TYPE_MERGE_SORT (gee_merge_sort_get_type ()) +#define GEE_MERGE_SORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MERGE_SORT, GeeMergeSort)) +#define GEE_MERGE_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_MERGE_SORT, GeeMergeSortClass)) +#define GEE_IS_MERGE_SORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MERGE_SORT)) +#define GEE_IS_MERGE_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_MERGE_SORT)) +#define GEE_MERGE_SORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_MERGE_SORT, GeeMergeSortClass)) + +typedef struct _GeeMergeSort GeeMergeSort; +typedef struct _GeeMergeSortClass GeeMergeSortClass; +typedef struct _GeeMergeSortPrivate GeeMergeSortPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_destroy_func0(var) (((var == NULL) || (g_destroy_func == NULL)) ? NULL : (var = (g_destroy_func (var), NULL))) +#define _gee_merge_sort_unref0(var) ((var == NULL) ? NULL : (var = (gee_merge_sort_unref (var), NULL))) +typedef struct _GeeParamSpecMergeSort GeeParamSpecMergeSort; + +struct _GeeMergeSort { + GTypeInstance parent_instance; + volatile int ref_count; + GeeMergeSortPrivate * priv; +}; + +struct _GeeMergeSortClass { + GTypeClass parent_class; + void (*finalize) (GeeMergeSort *self); +}; + +struct _GeeMergeSortPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GeeList* list_collection; + gpointer* array; + gint array_length1; + gint _array_size_; + gpointer* list; + gint list_length1; + gint _list_size_; + gint index; + gint size; + GCompareFunc compare; +}; + +struct _GeeParamSpecMergeSort { + GParamSpec parent_instance; +}; + + +static gpointer gee_merge_sort_parent_class = NULL; + +gpointer gee_merge_sort_ref (gpointer instance); +void gee_merge_sort_unref (gpointer instance); +GParamSpec* gee_param_spec_merge_sort (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void gee_value_set_merge_sort (GValue* value, gpointer v_object); +void gee_value_take_merge_sort (GValue* value, gpointer v_object); +gpointer gee_value_get_merge_sort (const GValue* value); +GType gee_merge_sort_get_type (void) G_GNUC_CONST; +#define GEE_MERGE_SORT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_MERGE_SORT, GeeMergeSortPrivate)) +enum { + GEE_MERGE_SORT_DUMMY_PROPERTY +}; +void gee_merge_sort_sort (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareFunc compare); +void gee_merge_sort_sort_arraylist (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeArrayList* list, GCompareFunc compare); +void gee_merge_sort_sort_list (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareFunc compare); +GeeMergeSort* gee_merge_sort_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeMergeSort* gee_merge_sort_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +static void gee_merge_sort_do_sort (GeeMergeSort* self); +static void gee_merge_sort_merge_sort_aux (GeeMergeSort* self, gint left, gint right, gpointer* work_area, int work_area_length1); +static void gee_merge_sort_finalize (GeeMergeSort* obj); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); + + +void gee_merge_sort_sort (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareFunc compare) { + GeeList* _tmp0_; + g_return_if_fail (list != NULL); + _tmp0_ = list; + if (GEE_IS_ARRAY_LIST (_tmp0_)) { + GeeList* _tmp1_; + GCompareFunc _tmp2_; + _tmp1_ = list; + _tmp2_ = compare; + gee_merge_sort_sort_arraylist (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, GEE_ARRAY_LIST (_tmp1_), _tmp2_); + } else { + GeeList* _tmp3_; + GCompareFunc _tmp4_; + _tmp3_ = list; + _tmp4_ = compare; + gee_merge_sort_sort_list (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, _tmp3_, _tmp4_); + } +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void gee_merge_sort_sort_list (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareFunc compare) { + GeeMergeSort* _tmp0_; + GeeMergeSort* helper; + GeeMergeSort* _tmp1_; + GeeList* _tmp2_; + GeeList* _tmp3_; + GeeMergeSort* _tmp4_; + GeeList* _tmp5_; + gint _tmp6_ = 0; + gpointer* _tmp7_ = NULL; + GeeMergeSort* _tmp8_; + GeeMergeSort* _tmp9_; + gpointer* _tmp10_; + gint _tmp10__length1; + GeeMergeSort* _tmp11_; + GeeMergeSort* _tmp12_; + GeeList* _tmp13_; + gint _tmp14_; + gint _tmp15_; + GeeMergeSort* _tmp16_; + GCompareFunc _tmp17_; + GeeMergeSort* _tmp18_; + GeeList* _tmp19_; + GeeMergeSort* _tmp20_; + gpointer* _tmp21_; + gint _tmp21__length1; + g_return_if_fail (list != NULL); + _tmp0_ = gee_merge_sort_new (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func); + helper = _tmp0_; + _tmp1_ = helper; + _tmp2_ = list; + _tmp3_ = _g_object_ref0 (_tmp2_); + _g_object_unref0 (_tmp1_->priv->list_collection); + _tmp1_->priv->list_collection = _tmp3_; + _tmp4_ = helper; + _tmp5_ = list; + _tmp7_ = gee_collection_to_array ((GeeCollection*) _tmp5_, &_tmp6_); + _tmp4_->priv->array = (_vala_array_free (_tmp4_->priv->array, _tmp4_->priv->array_length1, (GDestroyNotify) g_destroy_func), NULL); + _tmp4_->priv->array = _tmp7_; + _tmp4_->priv->array_length1 = _tmp6_; + _tmp4_->priv->_array_size_ = _tmp4_->priv->array_length1; + _tmp8_ = helper; + _tmp9_ = helper; + _tmp10_ = _tmp9_->priv->array; + _tmp10__length1 = _tmp9_->priv->array_length1; + _tmp8_->priv->list = _tmp10_; + _tmp8_->priv->list_length1 = _tmp10__length1; + _tmp8_->priv->_list_size_ = _tmp8_->priv->list_length1; + _tmp11_ = helper; + _tmp11_->priv->index = 0; + _tmp12_ = helper; + _tmp13_ = list; + _tmp14_ = gee_collection_get_size ((GeeCollection*) _tmp13_); + _tmp15_ = _tmp14_; + _tmp12_->priv->size = _tmp15_; + _tmp16_ = helper; + _tmp17_ = compare; + _tmp16_->priv->compare = _tmp17_; + _tmp18_ = helper; + gee_merge_sort_do_sort (_tmp18_); + _tmp19_ = list; + gee_collection_clear ((GeeCollection*) _tmp19_); + _tmp20_ = helper; + _tmp21_ = _tmp20_->priv->array; + _tmp21__length1 = _tmp20_->priv->array_length1; + { + gpointer* item_collection = NULL; + gint item_collection_length1 = 0; + gint _item_collection_size_ = 0; + gint item_it = 0; + item_collection = _tmp21_; + item_collection_length1 = _tmp21__length1; + for (item_it = 0; item_it < _tmp21__length1; item_it = item_it + 1) { + gpointer _tmp22_; + gpointer item = NULL; + _tmp22_ = ((item_collection[item_it] != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) item_collection[item_it]) : ((gpointer) item_collection[item_it]); + item = _tmp22_; + { + GeeList* _tmp23_; + gconstpointer _tmp24_; + _tmp23_ = list; + _tmp24_ = item; + gee_collection_add ((GeeCollection*) _tmp23_, _tmp24_); + _g_destroy_func0 (item); + } + } + } + _gee_merge_sort_unref0 (helper); +} + + +void gee_merge_sort_sort_arraylist (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeArrayList* list, GCompareFunc compare) { + GeeMergeSort* _tmp0_; + GeeMergeSort* helper; + GeeArrayList* _tmp1_; + GeeList* _tmp2_; + GeeArrayList* _tmp3_; + gpointer* _tmp4_; + gint _tmp4__length1; + GeeArrayList* _tmp5_; + gint _tmp6_; + GCompareFunc _tmp7_; + g_return_if_fail (list != NULL); + _tmp0_ = gee_merge_sort_new (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func); + helper = _tmp0_; + _tmp1_ = list; + _tmp2_ = _g_object_ref0 ((GeeList*) _tmp1_); + _g_object_unref0 (helper->priv->list_collection); + helper->priv->list_collection = _tmp2_; + _tmp3_ = list; + _tmp4_ = _tmp3_->_items; + _tmp4__length1 = _tmp3_->_items_length1; + helper->priv->list = _tmp4_; + helper->priv->list_length1 = _tmp4__length1; + helper->priv->_list_size_ = helper->priv->list_length1; + helper->priv->index = 0; + _tmp5_ = list; + _tmp6_ = _tmp5_->_size; + helper->priv->size = _tmp6_; + _tmp7_ = compare; + helper->priv->compare = _tmp7_; + gee_merge_sort_do_sort (helper); + _gee_merge_sort_unref0 (helper); +} + + +static void gee_merge_sort_do_sort (GeeMergeSort* self) { + gint _tmp0_; + gint _tmp1_; + gpointer* _tmp2_ = NULL; + gpointer* work_area; + gint work_area_length1; + gint _work_area_size_; + gint _tmp3_; + gint _tmp4_; + gpointer* _tmp5_; + gint _tmp5__length1; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->size; + if (_tmp0_ <= 1) { + return; + } + _tmp1_ = self->priv->size; + _tmp2_ = g_new0 (gpointer, _tmp1_); + work_area = _tmp2_; + work_area_length1 = _tmp1_; + _work_area_size_ = work_area_length1; + _tmp3_ = self->priv->index; + _tmp4_ = self->priv->size; + _tmp5_ = work_area; + _tmp5__length1 = work_area_length1; + gee_merge_sort_merge_sort_aux (self, _tmp3_, _tmp4_, _tmp5_, _tmp5__length1); + work_area = (_vala_array_free (work_area, work_area_length1, (GDestroyNotify) self->priv->g_destroy_func), NULL); +} + + +static void gee_merge_sort_merge_sort_aux (GeeMergeSort* self, gint left, gint right, gpointer* work_area, int work_area_length1) { + gint _tmp0_; + gint _tmp1_; + g_return_if_fail (self != NULL); + _tmp0_ = right; + _tmp1_ = left; + if (_tmp0_ == (_tmp1_ + 1)) { + return; + } else { + gint _tmp2_; + gint _tmp3_; + gint size; + gint _tmp4_; + gint middle; + gint _tmp5_; + gint lbegin; + gint _tmp6_; + gint _tmp7_; + gint rbegin; + gint _tmp8_; + gint _tmp9_; + gint _tmp10_; + gpointer* _tmp11_; + gint _tmp11__length1; + gint _tmp12_; + gint _tmp13_; + gint _tmp14_; + gpointer* _tmp15_; + gint _tmp15__length1; + _tmp2_ = right; + _tmp3_ = left; + size = _tmp2_ - _tmp3_; + _tmp4_ = size; + middle = _tmp4_ / 2; + _tmp5_ = left; + lbegin = _tmp5_; + _tmp6_ = left; + _tmp7_ = middle; + rbegin = _tmp6_ + _tmp7_; + _tmp8_ = left; + _tmp9_ = left; + _tmp10_ = middle; + _tmp11_ = work_area; + _tmp11__length1 = work_area_length1; + gee_merge_sort_merge_sort_aux (self, _tmp8_, _tmp9_ + _tmp10_, _tmp11_, _tmp11__length1); + _tmp12_ = left; + _tmp13_ = middle; + _tmp14_ = right; + _tmp15_ = work_area; + _tmp15__length1 = work_area_length1; + gee_merge_sort_merge_sort_aux (self, _tmp12_ + _tmp13_, _tmp14_, _tmp15_, _tmp15__length1); + { + gint i; + i = 0; + { + gboolean _tmp16_; + _tmp16_ = TRUE; + while (TRUE) { + gboolean _tmp17_; + gint _tmp19_; + gint _tmp20_; + gboolean _tmp21_ = FALSE; + gint _tmp22_; + gint _tmp23_; + gint _tmp24_; + gboolean _tmp37_; + _tmp17_ = _tmp16_; + if (!_tmp17_) { + gint _tmp18_; + _tmp18_ = i; + i = _tmp18_ + 1; + } + _tmp16_ = FALSE; + _tmp19_ = i; + _tmp20_ = size; + if (!(_tmp19_ < _tmp20_)) { + break; + } + _tmp22_ = lbegin; + _tmp23_ = left; + _tmp24_ = middle; + if (_tmp22_ < (_tmp23_ + _tmp24_)) { + gboolean _tmp25_ = FALSE; + gint _tmp26_; + gint _tmp27_; + gboolean _tmp36_; + _tmp26_ = rbegin; + _tmp27_ = right; + if (_tmp26_ == _tmp27_) { + _tmp25_ = TRUE; + } else { + GCompareFunc _tmp28_; + gpointer* _tmp29_; + gint _tmp29__length1; + gint _tmp30_; + gconstpointer _tmp31_; + gpointer* _tmp32_; + gint _tmp32__length1; + gint _tmp33_; + gconstpointer _tmp34_; + gint _tmp35_ = 0; + _tmp28_ = self->priv->compare; + _tmp29_ = self->priv->list; + _tmp29__length1 = self->priv->list_length1; + _tmp30_ = lbegin; + _tmp31_ = _tmp29_[_tmp30_]; + _tmp32_ = self->priv->list; + _tmp32__length1 = self->priv->list_length1; + _tmp33_ = rbegin; + _tmp34_ = _tmp32_[_tmp33_]; + _tmp35_ = _tmp28_ (_tmp31_, _tmp34_); + _tmp25_ = _tmp35_ <= 0; + } + _tmp36_ = _tmp25_; + _tmp21_ = _tmp36_; + } else { + _tmp21_ = FALSE; + } + _tmp37_ = _tmp21_; + if (_tmp37_) { + gpointer* _tmp38_; + gint _tmp38__length1; + gint _tmp39_; + gpointer* _tmp40_; + gint _tmp40__length1; + gint _tmp41_; + gconstpointer _tmp42_; + gpointer _tmp43_; + gpointer _tmp44_; + gint _tmp45_; + _tmp38_ = work_area; + _tmp38__length1 = work_area_length1; + _tmp39_ = i; + _tmp40_ = self->priv->list; + _tmp40__length1 = self->priv->list_length1; + _tmp41_ = lbegin; + _tmp42_ = _tmp40_[_tmp41_]; + _tmp43_ = ((_tmp42_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp42_) : ((gpointer) _tmp42_); + ((_tmp38_[_tmp39_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp38_[_tmp39_] = (self->priv->g_destroy_func (_tmp38_[_tmp39_]), NULL)); + _tmp38_[_tmp39_] = _tmp43_; + _tmp44_ = _tmp38_[_tmp39_]; + _tmp45_ = lbegin; + lbegin = _tmp45_ + 1; + } else { + gpointer* _tmp46_; + gint _tmp46__length1; + gint _tmp47_; + gpointer* _tmp48_; + gint _tmp48__length1; + gint _tmp49_; + gconstpointer _tmp50_; + gpointer _tmp51_; + gpointer _tmp52_; + gint _tmp53_; + _tmp46_ = work_area; + _tmp46__length1 = work_area_length1; + _tmp47_ = i; + _tmp48_ = self->priv->list; + _tmp48__length1 = self->priv->list_length1; + _tmp49_ = rbegin; + _tmp50_ = _tmp48_[_tmp49_]; + _tmp51_ = ((_tmp50_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp50_) : ((gpointer) _tmp50_); + ((_tmp46_[_tmp47_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp46_[_tmp47_] = (self->priv->g_destroy_func (_tmp46_[_tmp47_]), NULL)); + _tmp46_[_tmp47_] = _tmp51_; + _tmp52_ = _tmp46_[_tmp47_]; + _tmp53_ = rbegin; + rbegin = _tmp53_ + 1; + } + } + } + } + { + gint _tmp54_; + gint i; + _tmp54_ = left; + i = _tmp54_; + { + gboolean _tmp55_; + _tmp55_ = TRUE; + while (TRUE) { + gboolean _tmp56_; + gint _tmp58_; + gint _tmp59_; + gpointer* _tmp60_; + gint _tmp60__length1; + gint _tmp61_; + gpointer* _tmp62_; + gint _tmp62__length1; + gint _tmp63_; + gint _tmp64_; + gconstpointer _tmp65_; + gpointer _tmp66_; + gpointer _tmp67_; + _tmp56_ = _tmp55_; + if (!_tmp56_) { + gint _tmp57_; + _tmp57_ = i; + i = _tmp57_ + 1; + } + _tmp55_ = FALSE; + _tmp58_ = i; + _tmp59_ = right; + if (!(_tmp58_ < _tmp59_)) { + break; + } + _tmp60_ = self->priv->list; + _tmp60__length1 = self->priv->list_length1; + _tmp61_ = i; + _tmp62_ = work_area; + _tmp62__length1 = work_area_length1; + _tmp63_ = i; + _tmp64_ = left; + _tmp65_ = _tmp62_[_tmp63_ - _tmp64_]; + _tmp66_ = ((_tmp65_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp65_) : ((gpointer) _tmp65_); + ((_tmp60_[_tmp61_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp60_[_tmp61_] = (self->priv->g_destroy_func (_tmp60_[_tmp61_]), NULL)); + _tmp60_[_tmp61_] = _tmp66_; + _tmp67_ = _tmp60_[_tmp61_]; + } + } + } + } +} + + +GeeMergeSort* gee_merge_sort_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) { + GeeMergeSort* self = NULL; + self = (GeeMergeSort*) g_type_create_instance (object_type); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + return self; +} + + +GeeMergeSort* gee_merge_sort_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) { + return gee_merge_sort_construct (GEE_TYPE_MERGE_SORT, g_type, g_dup_func, g_destroy_func); +} + + +static void gee_value_merge_sort_init (GValue* value) { + value->data[0].v_pointer = NULL; +} + + +static void gee_value_merge_sort_free_value (GValue* value) { + if (value->data[0].v_pointer) { + gee_merge_sort_unref (value->data[0].v_pointer); + } +} + + +static void gee_value_merge_sort_copy_value (const GValue* src_value, GValue* dest_value) { + if (src_value->data[0].v_pointer) { + dest_value->data[0].v_pointer = gee_merge_sort_ref (src_value->data[0].v_pointer); + } else { + dest_value->data[0].v_pointer = NULL; + } +} + + +static gpointer gee_value_merge_sort_peek_pointer (const GValue* value) { + return value->data[0].v_pointer; +} + + +static gchar* gee_value_merge_sort_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + if (collect_values[0].v_pointer) { + GeeMergeSort* object; + object = collect_values[0].v_pointer; + if (object->parent_instance.g_class == NULL) { + return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); + } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { + return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); + } + value->data[0].v_pointer = gee_merge_sort_ref (object); + } else { + value->data[0].v_pointer = NULL; + } + return NULL; +} + + +static gchar* gee_value_merge_sort_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + GeeMergeSort** object_p; + object_p = collect_values[0].v_pointer; + if (!object_p) { + return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); + } + if (!value->data[0].v_pointer) { + *object_p = NULL; + } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { + *object_p = value->data[0].v_pointer; + } else { + *object_p = gee_merge_sort_ref (value->data[0].v_pointer); + } + return NULL; +} + + +GParamSpec* gee_param_spec_merge_sort (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { + GeeParamSpecMergeSort* spec; + g_return_val_if_fail (g_type_is_a (object_type, GEE_TYPE_MERGE_SORT), NULL); + spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); + G_PARAM_SPEC (spec)->value_type = object_type; + return G_PARAM_SPEC (spec); +} + + +gpointer gee_value_get_merge_sort (const GValue* value) { + g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TYPE_MERGE_SORT), NULL); + return value->data[0].v_pointer; +} + + +void gee_value_set_merge_sort (GValue* value, gpointer v_object) { + GeeMergeSort* old; + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TYPE_MERGE_SORT)); + old = value->data[0].v_pointer; + if (v_object) { + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_TYPE_MERGE_SORT)); + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); + value->data[0].v_pointer = v_object; + gee_merge_sort_ref (value->data[0].v_pointer); + } else { + value->data[0].v_pointer = NULL; + } + if (old) { + gee_merge_sort_unref (old); + } +} + + +void gee_value_take_merge_sort (GValue* value, gpointer v_object) { + GeeMergeSort* old; + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TYPE_MERGE_SORT)); + old = value->data[0].v_pointer; + if (v_object) { + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_TYPE_MERGE_SORT)); + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); + value->data[0].v_pointer = v_object; + } else { + value->data[0].v_pointer = NULL; + } + if (old) { + gee_merge_sort_unref (old); + } +} + + +static void gee_merge_sort_class_init (GeeMergeSortClass * klass) { + gee_merge_sort_parent_class = g_type_class_peek_parent (klass); + GEE_MERGE_SORT_CLASS (klass)->finalize = gee_merge_sort_finalize; + g_type_class_add_private (klass, sizeof (GeeMergeSortPrivate)); +} + + +static void gee_merge_sort_instance_init (GeeMergeSort * self) { + self->priv = GEE_MERGE_SORT_GET_PRIVATE (self); + self->ref_count = 1; +} + + +static void gee_merge_sort_finalize (GeeMergeSort* obj) { + GeeMergeSort * self; + self = GEE_MERGE_SORT (obj); + _g_object_unref0 (self->priv->list_collection); + self->priv->array = (_vala_array_free (self->priv->array, self->priv->array_length1, (GDestroyNotify) self->priv->g_destroy_func), NULL); +} + + +GType gee_merge_sort_get_type (void) { + static volatile gsize gee_merge_sort_type_id__volatile = 0; + if (g_once_init_enter (&gee_merge_sort_type_id__volatile)) { + static const GTypeValueTable g_define_type_value_table = { gee_value_merge_sort_init, gee_value_merge_sort_free_value, gee_value_merge_sort_copy_value, gee_value_merge_sort_peek_pointer, "p", gee_value_merge_sort_collect_value, "p", gee_value_merge_sort_lcopy_value }; + static const GTypeInfo g_define_type_info = { sizeof (GeeMergeSortClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_merge_sort_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeMergeSort), 0, (GInstanceInitFunc) gee_merge_sort_instance_init, &g_define_type_value_table }; + static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; + GType gee_merge_sort_type_id; + gee_merge_sort_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GeeMergeSort", &g_define_type_info, &g_define_type_fundamental_info, 0); + g_once_init_leave (&gee_merge_sort_type_id__volatile, gee_merge_sort_type_id); + } + return gee_merge_sort_type_id__volatile; +} + + +gpointer gee_merge_sort_ref (gpointer instance) { + GeeMergeSort* self; + self = instance; + g_atomic_int_inc (&self->ref_count); + return instance; +} + + +void gee_merge_sort_unref (gpointer instance) { + GeeMergeSort* self; + self = instance; + if (g_atomic_int_dec_and_test (&self->ref_count)) { + GEE_MERGE_SORT_GET_CLASS (self)->finalize (self); + g_type_free_instance ((GTypeInstance *) self); + } +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + + diff --git a/benchmark/mergesort.vala b/benchmark/mergesort.vala new file mode 100644 index 0000000..f20cc92 --- /dev/null +++ b/benchmark/mergesort.vala @@ -0,0 +1,110 @@ +/* mergesort.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Will + */ + +internal class Gee.MergeSort { + + public static void sort (List list, CompareFunc compare) { + if (list is ArrayList) { + MergeSort.sort_arraylist ((ArrayList) list, compare); + } else { + MergeSort.sort_list (list, compare); + } + } + + public static void sort_list (List list, CompareFunc compare) { + MergeSort helper = new MergeSort (); + + helper.list_collection = list; + helper.array = list.to_array (); + helper.list = helper.array; + helper.index = 0; + helper.size = list.size; + helper.compare = compare; + + helper.do_sort (); + + // TODO Use a list iterator and use iter.set(item) + list.clear (); + foreach (G item in helper.array) { + list.add (item); + } + } + + public static void sort_arraylist (ArrayList list, CompareFunc compare) { + MergeSort helper = new MergeSort (); + + helper.list_collection = list; + helper.list = list._items; + helper.index = 0; + helper.size = list._size; + helper.compare = compare; + + helper.do_sort (); + } + + private List list_collection; + private G[] array; + private unowned G[] list; + private int index; + private int size; + private CompareFunc compare; + + private void do_sort () { + if (this.size <= 1) { + return; + } + + var work_area = new G[this.size]; + + merge_sort_aux (index, this.size, work_area); + } + + private void merge_sort_aux (int left, int right, G[] work_area) { + if (right == left + 1) { + return; + } else { + int size = right - left; + int middle = size / 2; + int lbegin = left; + int rbegin = left + middle; + + merge_sort_aux (left, left + middle, work_area); + merge_sort_aux (left + middle, right, work_area); + + for (int i = 0; i < size; i++) { + if (lbegin < left + middle && (rbegin == right || + compare (list[lbegin], list[rbegin]) <= 0)) { + + work_area[i] = list[lbegin]; + lbegin++; + } else { + work_area[i] = list[rbegin]; + rbegin++; + } + } + + for (int i = left; i < right; i++) { + list[i] = work_area[i - left]; + } + } + } +} diff --git a/compile b/compile new file mode 100755 index 0000000..862a14e --- /dev/null +++ b/compile @@ -0,0 +1,343 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2012-03-05.13; # UTC + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free +# Software Foundation, Inc. +# Written by Tom Tromey . +# +# 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, 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, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..d622a44 --- /dev/null +++ b/config.guess @@ -0,0 +1,1530 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012 Free Software Foundation, Inc. + +timestamp='2012-02-10' + +# This file 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, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner. Please send patches (context +# diff format) to and include a ChangeLog +# entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..4b8c91a --- /dev/null +++ b/config.h.in @@ -0,0 +1,65 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION diff --git a/config.sub b/config.sub new file mode 100755 index 0000000..6205f84 --- /dev/null +++ b/config.sub @@ -0,0 +1,1782 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012 Free Software Foundation, Inc. + +timestamp='2012-04-18' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted GNU ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | be32 | be64 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | epiphany \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 \ + | ns16k | ns32k \ + | open8 \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pyramid \ + | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | we32k \ + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pyramid-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16 | cr16-*) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze) + basic_machine=microblaze-xilinx + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + msys) + basic_machine=i386-pc + os=-msys + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc | ppcbe) basic_machine=powerpc-unknown + ;; + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure b/configure new file mode 100755 index 0000000..acbebdb --- /dev/null +++ b/configure @@ -0,0 +1,14308 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.69 for libgee 0.6.6.1. +# +# Report bugs to . +# +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and ptitjes@free.fr +$0: about your system, including any error possibly output +$0: before this message. Then install a modern shell, or +$0: manually run the script under such a shell if you do +$0: have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + +SHELL=${CONFIG_SHELL-/bin/sh} + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='libgee' +PACKAGE_TARNAME='libgee' +PACKAGE_VERSION='0.6.6.1' +PACKAGE_STRING='libgee 0.6.6.1' +PACKAGE_BUGREPORT='ptitjes@free.fr' +PACKAGE_URL='' + +ac_unique_file="Makefile.am" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +HAVE_INTROSPECTION_FALSE +HAVE_INTROSPECTION_TRUE +INTROSPECTION_MAKEFILE +INTROSPECTION_LIBS +INTROSPECTION_CFLAGS +INTROSPECTION_TYPELIBDIR +INTROSPECTION_GIRDIR +INTROSPECTION_GENERATE +INTROSPECTION_COMPILER +INTROSPECTION_SCANNER +GLIB_LIBS +GLIB_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +ENABLE_BENCHMARK_FALSE +ENABLE_BENCHMARK_TRUE +LCOV +COVERAGE_LIBS +COVERAGE_VALAFLAGS +COVERAGE_CFLAGS +ENABLE_COVERAGE_FALSE +ENABLE_COVERAGE_TRUE +VALADOC +ENABLE_DOC_FALSE +ENABLE_DOC_TRUE +VALAFLAGS +VALAC +LIBGEE_LT_VERSION +CPP +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +MANIFEST_TOOL +RANLIB +ac_ct_AR +AR +DLLTOOL +OBJDUMP +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +EGREP +GREP +SED +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +LIBTOOL +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_silent_rules +enable_dependency_tracking +enable_static +enable_shared +with_pic +enable_fast_install +with_gnu_ld +with_sysroot +enable_libtool_lock +enable_doc +enable_coverage +enable_benchmark +enable_introspection +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +GLIB_CFLAGS +GLIB_LIBS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures libgee 0.6.6.1 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/libgee] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of libgee 0.6.6.1:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-silent-rules less verbose build output (undo: `make V=1') + --disable-silent-rules verbose build output (undo: `make V=0') + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-static[=PKGS] build static libraries [default=no] + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-doc Enable documentation generation + --enable-coverage compile with coverage profiling and debug (gcc only) + --enable-benchmark Enable benchmark + --enable-introspection=[no/auto/yes] + Enable introspection for this build + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot=DIR Search for dependent libraries within DIR + (or the compiler's sysroot if not specified). + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + GLIB_CFLAGS C compiler flags for GLIB, overriding pkg-config + GLIB_LIBS linker flags for GLIB, overriding pkg-config + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +libgee configure 0.6.6.1 +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by libgee $as_me 0.6.6.1, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +ac_config_headers="$ac_config_headers config.h" + + +am__api_version='1.11' + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +alias in your environment" "$LINENO" 5 + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='libgee' + VERSION='0.6.6.1' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in +yes) AM_DEFAULT_VERBOSITY=0;; +no) AM_DEFAULT_VERBOSITY=1;; +*) AM_DEFAULT_VERBOSITY=0;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + + +# Checks for programs. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +if test "x$CC" != xcc; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 +$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 +$as_echo_n "checking whether cc understands -c and -o together... " >&6; } +fi +set dummy $CC; ac_cc=`$as_echo "$2" | + sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +# Make sure it works both with $CC and with simple cc. +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' +rm -f conftest2.* +if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; +then + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + if test "x$CC" != xcc; then + # Test first that cc exists at all. + if { ac_try='cc -c conftest.$ac_ext >&5' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' + rm -f conftest2.* + if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; + then + # cc works too. + : + else + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no + fi + fi + fi +else + eval ac_cv_prog_cc_${ac_cc}_c_o=no +fi +rm -f core conftest* + +fi +if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h + +fi + +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o +if test "$am_t" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi + + +# Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=no +fi + + + + + + + + + +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.4.2' +macro_revision='1.3337' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case "$ECHO" in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if ${ac_cv_path_FGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_FGREP" || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if ${lt_cv_path_NM+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if ${lt_cv_nm_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if ${lt_cv_sys_max_cmd_len+:} false; then : + $as_echo_n "(cached) " >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 +$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 +$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 +$as_echo "$lt_shell_append" >&6; } + + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if ${lt_cv_ld_reload_flag+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if ${lt_cv_deplibs_check_method+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} +: ${AR_FLAGS=cru} + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if ${lt_cv_sys_global_symbol_pipe+:} false; then : + $as_echo_n "(cached) " >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; +else + with_sysroot=no +fi + + +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 +$as_echo "${with_sysroot}" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } + + + + + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if ${lt_cv_cc_needs_belf+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes +else + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi + + + + + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if ${lt_cv_apple_cc_single_mod+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&5 + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if ${lt_cv_ld_exported_symbols_list+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes +else + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&5 + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + + + +# Set options + + + + enable_dlopen=no + + + enable_win32_dll=no + + + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + pic_mode=default +fi + + +test -z "$pic_mode" && pic_mode=default + + + + + + + + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if ${lt_cv_objdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if ${lt_cv_prog_compiler_pic_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + linux* | k*bsd*-gnu | gnu*) + link_all_deplibs=no + ;; + esac + + ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='${wl}--export-all-symbols' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + link_all_deplibs=no + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler__b=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } + +if test x"$lt_cv_prog_compiler__b" = xyes; then + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test "$lt_cv_irix_exported_symbol" = yes; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='${wl}-Blargedynsym' + ;; + esac + fi + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([A-Za-z]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } + +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if ${ac_cv_lib_dld_shl_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if ${ac_cv_lib_svld_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_svld_dlopen=yes +else + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if ${ac_cv_lib_dld_dld_link+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int +main () +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_dld_link=yes +else + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self_static+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report which library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + +LIBGEE_LT_VERSION="2:0:0" + + +# Extract the first word of "valac", so it can be a program name with args. +set dummy valac; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_VALAC+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $VALAC in + [\\/]* | ?:[\\/]*) + ac_cv_path_VALAC="$VALAC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_VALAC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_VALAC" && ac_cv_path_VALAC="valac" + ;; +esac +fi +VALAC=$ac_cv_path_VALAC +if test -n "$VALAC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $VALAC" >&5 +$as_echo "$VALAC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + + +# Check whether --enable-doc was given. +if test "${enable_doc+set}" = set; then : + enableval=$enable_doc; enable_doc=$enableval +else + enable_doc=no +fi + + if test x$enable_doc = xyes; then + ENABLE_DOC_TRUE= + ENABLE_DOC_FALSE='#' +else + ENABLE_DOC_TRUE='#' + ENABLE_DOC_FALSE= +fi + + +if test "x$enable_doc" != xno; then : + # Extract the first word of "valadoc", so it can be a program name with args. +set dummy valadoc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_VALADOC+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $VALADOC in + [\\/]* | ?:[\\/]*) + ac_cv_path_VALADOC="$VALADOC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_VALADOC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_VALADOC" && ac_cv_path_VALADOC=":" + ;; +esac +fi +VALADOC=$ac_cv_path_VALADOC +if test -n "$VALADOC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $VALADOC" >&5 +$as_echo "$VALADOC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + if test "$VALADOC" = :; then : + as_fn_error $? "valadoc not found" "$LINENO" 5 +fi +fi + +# Check whether --enable-coverage was given. +if test "${enable_coverage+set}" = set; then : + enableval=$enable_coverage; enable_coverage=$enableval +else + enable_coverage=no +fi + + if test x$enable_coverage != xno; then + ENABLE_COVERAGE_TRUE= + ENABLE_COVERAGE_FALSE='#' +else + ENABLE_COVERAGE_TRUE='#' + ENABLE_COVERAGE_FALSE= +fi + + +if test "x$enable_coverage" != xno; then : + COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage" + COVERAGE_VALAFLAGS="-g" + COVERAGE_LIBS="-lgcov" + + + + + # Extract the first word of "lcov", so it can be a program name with args. +set dummy lcov; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_LCOV+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $LCOV in + [\\/]* | ?:[\\/]*) + ac_cv_path_LCOV="$LCOV" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_LCOV="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_LCOV" && ac_cv_path_LCOV=":" + ;; +esac +fi +LCOV=$ac_cv_path_LCOV +if test -n "$LCOV"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LCOV" >&5 +$as_echo "$LCOV" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + if test "$LCOV" = :; then : + as_fn_error $? "lcov is necessary for testing code coverage (http://ltp.sourceforge.net/coverage/lcov.php)" "$LINENO" 5 +fi +fi + +# Check whether --enable-benchmark was given. +if test "${enable_benchmark+set}" = set; then : + enableval=$enable_benchmark; enable_benchmark=$enableval +else + enable_benchmark=no +fi + + if test x$enable_benchmark = xyes; then + ENABLE_BENCHMARK_TRUE= + ENABLE_BENCHMARK_FALSE='#' +else + ENABLE_BENCHMARK_TRUE='#' + ENABLE_BENCHMARK_FALSE= +fi + + +GLIB_REQUIRED=2.12.0 + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB" >&5 +$as_echo_n "checking for GLIB... " >&6; } + +if test -n "$GLIB_CFLAGS"; then + pkg_cv_GLIB_CFLAGS="$GLIB_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= \$GLIB_REQUIRED gobject-2.0 >= \$GLIB_REQUIRED\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GLIB_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GLIB_LIBS"; then + pkg_cv_GLIB_LIBS="$GLIB_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= \$GLIB_REQUIRED gobject-2.0 >= \$GLIB_REQUIRED\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GLIB_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED" 2>&1` + else + GLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GLIB_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED) were not met: + +$GLIB_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables GLIB_CFLAGS +and GLIB_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables GLIB_CFLAGS +and GLIB_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + GLIB_CFLAGS=$pkg_cv_GLIB_CFLAGS + GLIB_LIBS=$pkg_cv_GLIB_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + + + + + + # Check whether --enable-introspection was given. +if test "${enable_introspection+set}" = set; then : + enableval=$enable_introspection; +else + enable_introspection=auto +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gobject-introspection" >&5 +$as_echo_n "checking for gobject-introspection... " >&6; } + + case $enable_introspection in #( + no) : + found_introspection="no (disabled, use --enable-introspection to enable)" + ;; #( + yes) : + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + : +else + as_fn_error $? "gobject-introspection-1.0 is not installed" "$LINENO" 5 +fi + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= 0.9.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= 0.9.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + found_introspection=yes +else + as_fn_error $? "You need to have gobject-introspection >= 0.9.0 installed to build libgee" "$LINENO" 5 +fi + ;; #( + auto) : + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= 0.9.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= 0.9.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + found_introspection=yes +else + found_introspection=no +fi + enable_introspection=$found_introspection + ;; #( + *) : + as_fn_error $? "invalid argument passed to --enable-introspection, should be one of [no/auto/yes]" "$LINENO" 5 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $found_introspection" >&5 +$as_echo "$found_introspection" >&6; } + + INTROSPECTION_SCANNER= + INTROSPECTION_COMPILER= + INTROSPECTION_GENERATE= + INTROSPECTION_GIRDIR= + INTROSPECTION_TYPELIBDIR= + if test "x$found_introspection" = "xyes"; then + INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` + INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` + INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0` + INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0` + INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" + INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0` + INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0` + INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection + fi + + + + + + + + + + if test "x$found_introspection" = "xyes"; then + HAVE_INTROSPECTION_TRUE= + HAVE_INTROSPECTION_FALSE='#' +else + HAVE_INTROSPECTION_TRUE='#' + HAVE_INTROSPECTION_FALSE= +fi + + + + +ac_config_files="$ac_config_files Makefile gee-1.0.pc benchmark/Makefile doc/Makefile gee/Makefile tests/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_DOC_TRUE}" && test -z "${ENABLE_DOC_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DOC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_COVERAGE_TRUE}" && test -z "${ENABLE_COVERAGE_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_COVERAGE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_BENCHMARK_TRUE}" && test -z "${ENABLE_BENCHMARK_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_BENCHMARK\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_INTROSPECTION_TRUE}" && test -z "${HAVE_INTROSPECTION_FALSE}"; then + as_fn_error $? "conditional \"HAVE_INTROSPECTION\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by libgee $as_me 0.6.6.1, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +libgee config.status 0.6.6.1 +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in SHELL \ +ECHO \ +PATH_SEPARATOR \ +SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +OBJDUMP \ +deplibs_check_method \ +file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +DLLTOOL \ +sharedlib_from_linklib_cmd \ +AR \ +AR_FLAGS \ +archiver_list_spec \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +nm_file_list_spec \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postlink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile' + + + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "gee-1.0.pc") CONFIG_FILES="$CONFIG_FILES gee-1.0.pc" ;; + "benchmark/Makefile") CONFIG_FILES="$CONFIG_FILES benchmark/Makefile" ;; + "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "gee/Makefile") CONFIG_FILES="$CONFIG_FILES gee/Makefile" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool 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. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="" + +# ### BEGIN LIBTOOL CONFIG + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The PATH separator for the build system. +PATH_SEPARATOR=$lt_PATH_SEPARATOR + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive. +AR_FLAGS=$lt_AR_FLAGS + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and in which our libraries should be installed. +lt_sysroot=$lt_sysroot + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + if test x"$xsi_shell" = xyes; then + sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ +func_dirname ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_basename ()$/,/^} # func_basename /c\ +func_basename ()\ +{\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ +func_dirname_and_basename ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ +func_stripname ()\ +{\ +\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ +\ # positional parameters, so assign one to ordinary parameter first.\ +\ func_stripname_result=${3}\ +\ func_stripname_result=${func_stripname_result#"${1}"}\ +\ func_stripname_result=${func_stripname_result%"${2}"}\ +} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ +func_split_long_opt ()\ +{\ +\ func_split_long_opt_name=${1%%=*}\ +\ func_split_long_opt_arg=${1#*=}\ +} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ +func_split_short_opt ()\ +{\ +\ func_split_short_opt_arg=${1#??}\ +\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ +} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ +func_lo2o ()\ +{\ +\ case ${1} in\ +\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ +\ *) func_lo2o_result=${1} ;;\ +\ esac\ +} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_xform ()$/,/^} # func_xform /c\ +func_xform ()\ +{\ + func_xform_result=${1%.*}.lo\ +} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_arith ()$/,/^} # func_arith /c\ +func_arith ()\ +{\ + func_arith_result=$(( $* ))\ +} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_len ()$/,/^} # func_len /c\ +func_len ()\ +{\ + func_len_result=${#1}\ +} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + +fi + +if test x"$lt_shell_append" = xyes; then + sed -e '/^func_append ()$/,/^} # func_append /c\ +func_append ()\ +{\ + eval "${1}+=\\${2}"\ +} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ +func_append_quoted ()\ +{\ +\ func_quote_for_eval "${2}"\ +\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ +} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 +$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} +fi + + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..7a9cbf1 --- /dev/null +++ b/configure.ac @@ -0,0 +1,66 @@ +AC_INIT([libgee], [0.6.6.1], [ptitjes@free.fr], [libgee]) +AC_CONFIG_SRCDIR([Makefile.am]) +AC_CONFIG_HEADERS(config.h) +AC_CONFIG_MACRO_DIR([m4]) +AM_INIT_AUTOMAKE([check-news dist-bzip2]) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +# Checks for programs. +AC_PROG_CC +AM_PROG_CC_C_O +AC_DISABLE_STATIC +AC_PROG_LIBTOOL + +LIBGEE_LT_VERSION="2:0:0" +AC_SUBST(LIBGEE_LT_VERSION) + +AC_PATH_PROG(VALAC, valac, valac) +AC_SUBST(VALAC) + +AC_SUBST(VALAFLAGS) + +AC_ARG_ENABLE(doc, AS_HELP_STRING([--enable-doc], [Enable documentation generation]), enable_doc=$enableval, enable_doc=no) +AM_CONDITIONAL(ENABLE_DOC, test x$enable_doc = xyes) + +AS_IF([test "x$enable_doc" != xno], + [AC_PATH_PROG(VALADOC, valadoc, :) + AC_SUBST(VALADOC) + AS_IF([test "$VALADOC" = :], + [AC_MSG_ERROR([valadoc not found])])]) + +AC_ARG_ENABLE(coverage, + AS_HELP_STRING([--enable-coverage], + [compile with coverage profiling and debug (gcc only)]), + enable_coverage=$enableval,enable_coverage=no) +AM_CONDITIONAL(ENABLE_COVERAGE, test x$enable_coverage != xno) + +AS_IF([test "x$enable_coverage" != xno], + [COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage" + COVERAGE_VALAFLAGS="-g" + COVERAGE_LIBS="-lgcov" + AC_SUBST(COVERAGE_CFLAGS) + AC_SUBST(COVERAGE_VALAFLAGS) + AC_SUBST(COVERAGE_LIBS) + + AC_PATH_PROG(LCOV, lcov, :) + AC_SUBST(LCOV) + AS_IF([test "$LCOV" = :], + [AC_MSG_ERROR([lcov is necessary for testing code coverage (http://ltp.sourceforge.net/coverage/lcov.php)])])]) + +AC_ARG_ENABLE(benchmark, AS_HELP_STRING([--enable-benchmark], [Enable benchmark]), enable_benchmark=$enableval, enable_benchmark=no) +AM_CONDITIONAL(ENABLE_BENCHMARK, test x$enable_benchmark = xyes) + +GLIB_REQUIRED=2.12.0 + +PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED) +AC_SUBST(GLIB_CFLAGS) +AC_SUBST(GLIB_LIBS) + +GOBJECT_INTROSPECTION_CHECK([0.9.0]) + +AC_OUTPUT([Makefile + gee-1.0.pc + benchmark/Makefile + doc/Makefile + gee/Makefile + tests/Makefile]) diff --git a/depcomp b/depcomp new file mode 100755 index 0000000..25a39e6 --- /dev/null +++ b/depcomp @@ -0,0 +1,708 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2012-03-27.16; # UTC + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, +# 2011, 2012 Free Software Foundation, Inc. + +# 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, 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, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by 'PROGRAMS ARGS'. + object Object file output by 'PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputting dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +# A tabulation character. +tab=' ' +# A newline character. +nl=' +' + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvisualcpp +fi + +if test "$depmode" = msvc7msys; then + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 +fi + +if test "$depmode" = xlc; then + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. + gccflag=-qmakedep=gcc,-MF + depmode=gcc +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the "deleted header file" problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' "$nl" < "$tmpdepfile" | +## Some versions of gcc put a space before the ':'. On the theory +## that the space means something, we add a space to the output as +## well. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like '#:fec' to the end of the + # dependency line. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr "$nl" ' ' >> "$depfile" + echo >> "$depfile" + + # The second pass generates a dummy entry for each header file. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +xlc) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts '$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + # Each line is of the form 'foo.o: dependent.h'. + # Do two passes, one to just change these to + # '$object: dependent.h' and one to simply 'dependent.h:'. + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. + # However on + # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using '\': + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + # tcc 0.9.26 (FIXME still under development at the moment of writing) + # will emit a similar output, but also prepend the continuation lines + # with horizontal tabulation characters. + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form 'foo.o: dependent.h', + # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. + # Do two passes, one to just change these to + # '$object: dependent.h' and one to simply 'dependent.h:'. + sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ + < "$tmpdepfile" > "$depfile" + sed ' + s/[ '"$tab"'][ '"$tab"']*/ /g + s/^ *// + s/ *\\*$// + s/^[^:]*: *// + /^$/d + /:$/d + s/$/ :/ + ' < "$tmpdepfile" >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add 'dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in 'foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +msvc7) + if test "$libtool" = yes; then + showIncludes=-Wc,-showIncludes + else + showIncludes=-showIncludes + fi + "$@" $showIncludes > "$tmpdepfile" + stat=$? + grep -v '^Note: including file: ' "$tmpdepfile" + if test "$stat" = 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The first sed program below extracts the file names and escapes + # backslashes for cygpath. The second sed program outputs the file + # name when reading, but also accumulates all include files in the + # hold buffer in order to output them again at the end. This only + # works with sed implementations that can handle large buffers. + sed < "$tmpdepfile" -n ' +/^Note: including file: *\(.*\)/ { + s//\1/ + s/\\/\\\\/g + p +}' | $cygpath_u | sort -u | sed -n ' +s/ /\\ /g +s/\(.*\)/'"$tab"'\1 \\/p +s/.\(.*\) \\/\1:/ +H +$ { + s/.*/'"$tab"'/ + G + p +}' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvc7msys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for ':' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. + "$@" $dashmflag | + sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' "$nl" < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + # makedepend may prepend the VPATH from the source file name to the object. + # No need to regex-escape $object, excess matching of '.' is harmless. + sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" + echo "$tab" >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..bce1117 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,37 @@ +include $(top_srcdir)/Makefile.decl + +NULL = + +SRC_DIR = $(top_srcdir)/gee + +docdir=$(datadir)/devhelp/references/gee-1.0 +innerdocdir=$(datadir)/devhelp/references/gee-1.0/gee-1.0 +imgdir=$(datadir)/devhelp/references/gee-1.0/gee-1.0/img + +doc_data = \ + gee-1.0/*.css \ + gee-1.0/*.png \ + $(NULL) + +doc_DATA = \ + gee-1.0/index.html \ + $(doc_data) \ + $(NULL) + +innerdoc_DATA = \ + gee-1.0/gee-1.0/index.htm \ + gee-1.0/gee-1.0/*.html \ + $(NULL) + +img_DATA = \ + gee-1.0/gee-1.0/img/*.png \ + $(NULL) + +$(doc_data) $(innerdoc_DATA) $(img_DATA): gee-1.0/index.html + +gee-1.0/index.html: + $(VALADOC) -o gee-1.0/ --wiki ./ --force -b $(top_srcdir) $(SRC_DIR)/*.vala + +EXTRA_DIST += \ + index.wiki \ + $(NULL) \ No newline at end of file diff --git a/doc/Makefile.in b/doc/Makefile.in new file mode 100644 index 0000000..41fafc1 --- /dev/null +++ b/doc/Makefile.in @@ -0,0 +1,595 @@ +# Makefile.in generated by automake 1.11.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# GLIB - Library of useful C routines + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/Makefile.decl +subdir = doc +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(docdir)" "$(DESTDIR)$(imgdir)" \ + "$(DESTDIR)$(innerdocdir)" +DATA = $(doc_DATA) $(img_DATA) $(innerdoc_DATA) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COVERAGE_CFLAGS = @COVERAGE_CFLAGS@ +COVERAGE_LIBS = @COVERAGE_LIBS@ +COVERAGE_VALAFLAGS = @COVERAGE_VALAFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LCOV = @LCOV@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGEE_LT_VERSION = @LIBGEE_LT_VERSION@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VALAC = @VALAC@ +VALADOC = @VALADOC@ +VALAFLAGS = @VALAFLAGS@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = $(datadir)/devhelp/references/gee-1.0 +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +GTESTER = gtester +GTESTER_REPORT = gtester-report + +# initialize variables for unconditional += appending +EXTRA_DIST = index.wiki $(NULL) +TEST_PROGS = +NULL = +SRC_DIR = $(top_srcdir)/gee +innerdocdir = $(datadir)/devhelp/references/gee-1.0/gee-1.0 +imgdir = $(datadir)/devhelp/references/gee-1.0/gee-1.0/img +doc_data = \ + gee-1.0/*.css \ + gee-1.0/*.png \ + $(NULL) + +doc_DATA = \ + gee-1.0/index.html \ + $(doc_data) \ + $(NULL) + +innerdoc_DATA = \ + gee-1.0/gee-1.0/index.htm \ + gee-1.0/gee-1.0/*.html \ + $(NULL) + +img_DATA = \ + gee-1.0/gee-1.0/img/*.png \ + $(NULL) + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.decl $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu doc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/Makefile.decl: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-docDATA: $(doc_DATA) + @$(NORMAL_INSTALL) + @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ + done + +uninstall-docDATA: + @$(NORMAL_UNINSTALL) + @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir) +install-imgDATA: $(img_DATA) + @$(NORMAL_INSTALL) + @list='$(img_DATA)'; test -n "$(imgdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(imgdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(imgdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(imgdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(imgdir)" || exit $$?; \ + done + +uninstall-imgDATA: + @$(NORMAL_UNINSTALL) + @list='$(img_DATA)'; test -n "$(imgdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(imgdir)'; $(am__uninstall_files_from_dir) +install-innerdocDATA: $(innerdoc_DATA) + @$(NORMAL_INSTALL) + @list='$(innerdoc_DATA)'; test -n "$(innerdocdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(innerdocdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(innerdocdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(innerdocdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(innerdocdir)" || exit $$?; \ + done + +uninstall-innerdocDATA: + @$(NORMAL_UNINSTALL) + @list='$(innerdoc_DATA)'; test -n "$(innerdocdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(innerdocdir)'; $(am__uninstall_files_from_dir) +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-local +check: check-am +all-am: Makefile $(DATA) +installdirs: + for dir in "$(DESTDIR)$(docdir)" "$(DESTDIR)$(imgdir)" "$(DESTDIR)$(innerdocdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-docDATA install-imgDATA install-innerdocDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-docDATA uninstall-imgDATA \ + uninstall-innerdocDATA + +.MAKE: check-am install-am install-strip + +.PHONY: all all-am check check-am check-local clean clean-generic \ + clean-libtool distclean distclean-generic distclean-libtool \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-docDATA \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-imgDATA install-info \ + install-info-am install-innerdocDATA install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-docDATA uninstall-imgDATA uninstall-innerdocDATA + + +### testing rules + +# test: run all tests in cwd and subdirs +test: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} + @ for subdir in $(SUBDIRS) . ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done +# test-report: run tests in subdirs and generate report +# perf-report: run tests in subdirs with -m perf and generate report +# full-report: like test-report: with -m perf and -m slow +test-report perf-report full-report: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || { \ + case $@ in \ + test-report) test_options="-k";; \ + perf-report) test_options="-k -m=perf";; \ + full-report) test_options="-k -m=perf -m=slow";; \ + esac ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \ + elif test -n "${TEST_PROGS}" ; then \ + ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \ + fi ; \ + } + @ ignore_logdir=true ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \ + ignore_logdir=false ; \ + fi ; \ + for subdir in $(SUBDIRS) . ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done ; \ + $$ignore_logdir || { \ + echo '' > $@.xml ; \ + echo '' >> $@.xml ; \ + for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \ + sed '1,1s/^?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \ + done ; \ + echo >> $@.xml ; \ + echo '' >> $@.xml ; \ + rm -rf "$$GTESTER_LOGDIR"/ ; \ + ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \ + } +.PHONY: test test-report perf-report full-report +# run make test as part of make check +check-local: test + +$(doc_data) $(innerdoc_DATA) $(img_DATA): gee-1.0/index.html + +gee-1.0/index.html: + $(VALADOC) -o gee-1.0/ --wiki ./ --force -b $(top_srcdir) $(SRC_DIR)/*.vala + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/doc/index.wiki b/doc/index.wiki new file mode 100644 index 0000000..8f67685 --- /dev/null +++ b/doc/index.wiki @@ -0,0 +1,9 @@ +libgee is a collection library providing GObject-based interfaces and classes for commonly used data structures. + +libgee provides the following interfaces: + * Iterable + - Collection + - List + - Set + - Iterator + - Map diff --git a/gee-1.0.pc.in b/gee-1.0.pc.in new file mode 100644 index 0000000..a5840c8 --- /dev/null +++ b/gee-1.0.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +datarootdir=@datarootdir@ +datadir=@datadir@ + +Name: libgee +Description: The GObject collection library +Version: @VERSION@ +Requires: glib-2.0 gobject-2.0 +Libs: -L${libdir} -lgee +Cflags: -I${includedir}/gee-1.0 diff --git a/gee/Gee-1.0.gir b/gee/Gee-1.0.gir new file mode 100644 index 0000000..ddb9aa2 --- /dev/null +++ b/gee/Gee-1.0.gir @@ -0,0 +1,5206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gee/Makefile.am b/gee/Makefile.am new file mode 100644 index 0000000..efcc86b --- /dev/null +++ b/gee/Makefile.am @@ -0,0 +1,127 @@ +include $(top_srcdir)/Makefile.decl + +NULL = + +AM_CPPFLAGS = \ + $(GLIB_CFLAGS) \ + $(COVERAGE_CFLAGS) \ + $(NULL) + +BUILT_SOURCES = gee.vala.stamp + +lib_LTLIBRARIES = \ + libgee.la + $(NULL) + +libgee_la_VALASOURCES = \ + assemblyinfo.vala \ + abstractcollection.vala \ + abstractlist.vala \ + abstractmap.vala \ + abstractmultimap.vala \ + abstractmultiset.vala \ + abstractqueue.vala \ + abstractset.vala \ + arraylist.vala \ + bidiriterator.vala \ + collection.vala \ + comparable.vala \ + deque.vala \ + functions.vala \ + hashmap.vala \ + hashmultimap.vala \ + hashmultiset.vala \ + hashset.vala \ + iterable.vala \ + iterator.vala \ + linkedlist.vala \ + list.vala \ + listiterator.vala \ + map.vala \ + mapiterator.vala \ + multimap.vala \ + multiset.vala \ + priorityqueue.vala \ + queue.vala \ + readonlycollection.vala \ + readonlylist.vala \ + readonlymap.vala \ + readonlyset.vala \ + set.vala \ + sortedset.vala \ + timsort.vala \ + treemap.vala \ + treemultimap.vala \ + treemultiset.vala \ + treeset.vala \ + $(NULL) + +libgee_la_SOURCES = \ + gee.vala.stamp \ + $(libgee_la_VALASOURCES:.vala=.c) \ + $(NULL) + +geeincludedir = $(includedir)/gee-1.0 + +geeinclude_HEADERS = \ + gee.h \ + $(NULL) + +AM_VALAFLAGS = \ + -H gee.h --vapi gee-1.0.vapi \ + -h gee-internals.h \ + --internal-vapi gee-internals-1.0.vapi \ + --library gee-1.0 --gir Gee-1.0.gir \ + $(COVERAGE_VALAFLAGS) \ + $(VALAFLAGS) \ + $(NULL) + +Gee-1.0.gir gee-internals-1.0.vapi gee-1.0.vapi gee.vala.stamp: $(libgee_la_VALASOURCES) + $(VALAC) -C $(AM_VALAFLAGS) $^ + touch $@ + +libgee_la_LIBADD = \ + $(GLIB_LIBS) \ + $(COVERAGE_LIBS) \ + $(NULL) + +libgee_la_LDFLAGS = -version-info $(LIBGEE_LT_VERSION) -no-undefined + +vapidir = $(datadir)/vala/vapi + +dist_vapi_DATA = \ + gee-1.0.vapi \ + $(NULL) + +if HAVE_INTROSPECTION +girdir = @INTROSPECTION_GIRDIR@ + +gir_DATA = \ + Gee-1.0.gir \ + $(NULL) + +typelibdir = @INTROSPECTION_TYPELIBDIR@ +typelib_DATA = \ + Gee-1.0.typelib \ + $(NULL) + +Gee-1.0.typelib: Gee-1.0.gir + @INTROSPECTION_COMPILER@ -o $@ $^ +endif + +EXTRA_DIST += $(libgee_la_VALASOURCES) gee-1.0.vapi Gee-1.0.gir gee.vala.stamp + +MAINTAINERCLEANFILES = \ + $(libgee_la_VALASOURCES:.vala=.c) \ + gee.vala.stamp \ + gee-internals-1.0.vapi \ + gee-1.0.vapi \ + Gee-1.0.gir \ + gee.h \ + gee-internals.h \ + $(NULL) + +CLEANFILES = \ + Gee-1.0.typelib \ + $(NULL) + diff --git a/gee/Makefile.in b/gee/Makefile.in new file mode 100644 index 0000000..710f841 --- /dev/null +++ b/gee/Makefile.in @@ -0,0 +1,921 @@ +# Makefile.in generated by automake 1.11.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# GLIB - Library of useful C routines + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(dist_vapi_DATA) $(geeinclude_HEADERS) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/Makefile.decl +subdir = gee +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(vapidir)" \ + "$(DESTDIR)$(girdir)" "$(DESTDIR)$(typelibdir)" \ + "$(DESTDIR)$(geeincludedir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libgee_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am__objects_1 = +am__objects_2 = assemblyinfo.lo abstractcollection.lo abstractlist.lo \ + abstractmap.lo abstractmultimap.lo abstractmultiset.lo \ + abstractqueue.lo abstractset.lo arraylist.lo bidiriterator.lo \ + collection.lo comparable.lo deque.lo functions.lo hashmap.lo \ + hashmultimap.lo hashmultiset.lo hashset.lo iterable.lo \ + iterator.lo linkedlist.lo list.lo listiterator.lo map.lo \ + mapiterator.lo multimap.lo multiset.lo priorityqueue.lo \ + queue.lo readonlycollection.lo readonlylist.lo readonlymap.lo \ + readonlyset.lo set.lo sortedset.lo timsort.lo treemap.lo \ + treemultimap.lo treemultiset.lo treeset.lo $(am__objects_1) +am_libgee_la_OBJECTS = $(am__objects_2) $(am__objects_1) +libgee_la_OBJECTS = $(am_libgee_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +libgee_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libgee_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libgee_la_SOURCES) +DIST_SOURCES = $(libgee_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(dist_vapi_DATA) $(gir_DATA) $(typelib_DATA) +HEADERS = $(geeinclude_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COVERAGE_CFLAGS = @COVERAGE_CFLAGS@ +COVERAGE_LIBS = @COVERAGE_LIBS@ +COVERAGE_VALAFLAGS = @COVERAGE_VALAFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LCOV = @LCOV@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGEE_LT_VERSION = @LIBGEE_LT_VERSION@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VALAC = @VALAC@ +VALADOC = @VALADOC@ +VALAFLAGS = @VALAFLAGS@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +GTESTER = gtester +GTESTER_REPORT = gtester-report + +# initialize variables for unconditional += appending +EXTRA_DIST = $(libgee_la_VALASOURCES) gee-1.0.vapi Gee-1.0.gir \ + gee.vala.stamp +TEST_PROGS = +NULL = +AM_CPPFLAGS = \ + $(GLIB_CFLAGS) \ + $(COVERAGE_CFLAGS) \ + $(NULL) + +BUILT_SOURCES = gee.vala.stamp +lib_LTLIBRARIES = \ + libgee.la + +libgee_la_VALASOURCES = \ + assemblyinfo.vala \ + abstractcollection.vala \ + abstractlist.vala \ + abstractmap.vala \ + abstractmultimap.vala \ + abstractmultiset.vala \ + abstractqueue.vala \ + abstractset.vala \ + arraylist.vala \ + bidiriterator.vala \ + collection.vala \ + comparable.vala \ + deque.vala \ + functions.vala \ + hashmap.vala \ + hashmultimap.vala \ + hashmultiset.vala \ + hashset.vala \ + iterable.vala \ + iterator.vala \ + linkedlist.vala \ + list.vala \ + listiterator.vala \ + map.vala \ + mapiterator.vala \ + multimap.vala \ + multiset.vala \ + priorityqueue.vala \ + queue.vala \ + readonlycollection.vala \ + readonlylist.vala \ + readonlymap.vala \ + readonlyset.vala \ + set.vala \ + sortedset.vala \ + timsort.vala \ + treemap.vala \ + treemultimap.vala \ + treemultiset.vala \ + treeset.vala \ + $(NULL) + +libgee_la_SOURCES = \ + gee.vala.stamp \ + $(libgee_la_VALASOURCES:.vala=.c) \ + $(NULL) + +geeincludedir = $(includedir)/gee-1.0 +geeinclude_HEADERS = \ + gee.h \ + $(NULL) + +AM_VALAFLAGS = \ + -H gee.h --vapi gee-1.0.vapi \ + -h gee-internals.h \ + --internal-vapi gee-internals-1.0.vapi \ + --library gee-1.0 --gir Gee-1.0.gir \ + $(COVERAGE_VALAFLAGS) \ + $(VALAFLAGS) \ + $(NULL) + +libgee_la_LIBADD = \ + $(GLIB_LIBS) \ + $(COVERAGE_LIBS) \ + $(NULL) + +libgee_la_LDFLAGS = -version-info $(LIBGEE_LT_VERSION) -no-undefined +vapidir = $(datadir)/vala/vapi +dist_vapi_DATA = \ + gee-1.0.vapi \ + $(NULL) + +@HAVE_INTROSPECTION_TRUE@girdir = @INTROSPECTION_GIRDIR@ +@HAVE_INTROSPECTION_TRUE@gir_DATA = \ +@HAVE_INTROSPECTION_TRUE@ Gee-1.0.gir \ +@HAVE_INTROSPECTION_TRUE@ $(NULL) + +@HAVE_INTROSPECTION_TRUE@typelibdir = @INTROSPECTION_TYPELIBDIR@ +@HAVE_INTROSPECTION_TRUE@typelib_DATA = \ +@HAVE_INTROSPECTION_TRUE@ Gee-1.0.typelib \ +@HAVE_INTROSPECTION_TRUE@ $(NULL) + +MAINTAINERCLEANFILES = \ + $(libgee_la_VALASOURCES:.vala=.c) \ + gee.vala.stamp \ + gee-internals-1.0.vapi \ + gee-1.0.vapi \ + Gee-1.0.gir \ + gee.h \ + gee-internals.h \ + $(NULL) + +CLEANFILES = \ + Gee-1.0.typelib \ + $(NULL) + +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.decl $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu gee/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu gee/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/Makefile.decl: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libgee.la: $(libgee_la_OBJECTS) $(libgee_la_DEPENDENCIES) $(EXTRA_libgee_la_DEPENDENCIES) + $(AM_V_CCLD)$(libgee_la_LINK) -rpath $(libdir) $(libgee_la_OBJECTS) $(libgee_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/abstractcollection.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/abstractlist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/abstractmap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/abstractmultimap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/abstractmultiset.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/abstractqueue.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/abstractset.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arraylist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assemblyinfo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bidiriterator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collection.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/comparable.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deque.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/functions.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hashmap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hashmultimap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hashmultiset.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hashset.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iterable.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iterator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linkedlist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listiterator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/map.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapiterator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multimap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multiset.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/priorityqueue.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queue.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readonlycollection.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readonlylist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readonlymap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readonlyset.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sortedset.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timsort.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/treemap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/treemultimap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/treemultiset.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/treeset.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-dist_vapiDATA: $(dist_vapi_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_vapi_DATA)'; test -n "$(vapidir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(vapidir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(vapidir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(vapidir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(vapidir)" || exit $$?; \ + done + +uninstall-dist_vapiDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_vapi_DATA)'; test -n "$(vapidir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(vapidir)'; $(am__uninstall_files_from_dir) +install-girDATA: $(gir_DATA) + @$(NORMAL_INSTALL) + @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(girdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(girdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(girdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(girdir)" || exit $$?; \ + done + +uninstall-girDATA: + @$(NORMAL_UNINSTALL) + @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(girdir)'; $(am__uninstall_files_from_dir) +install-typelibDATA: $(typelib_DATA) + @$(NORMAL_INSTALL) + @list='$(typelib_DATA)'; test -n "$(typelibdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(typelibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(typelibdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(typelibdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(typelibdir)" || exit $$?; \ + done + +uninstall-typelibDATA: + @$(NORMAL_UNINSTALL) + @list='$(typelib_DATA)'; test -n "$(typelibdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(typelibdir)'; $(am__uninstall_files_from_dir) +install-geeincludeHEADERS: $(geeinclude_HEADERS) + @$(NORMAL_INSTALL) + @list='$(geeinclude_HEADERS)'; test -n "$(geeincludedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(geeincludedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(geeincludedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(geeincludedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(geeincludedir)" || exit $$?; \ + done + +uninstall-geeincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(geeinclude_HEADERS)'; test -n "$(geeincludedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(geeincludedir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-local +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(vapidir)" "$(DESTDIR)$(girdir)" "$(DESTDIR)$(typelibdir)" "$(DESTDIR)$(geeincludedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-dist_vapiDATA install-geeincludeHEADERS \ + install-girDATA install-typelibDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-dist_vapiDATA uninstall-geeincludeHEADERS \ + uninstall-girDATA uninstall-libLTLIBRARIES \ + uninstall-typelibDATA + +.MAKE: all check check-am install install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \ + clean-generic clean-libLTLIBRARIES clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dist_vapiDATA install-dvi \ + install-dvi-am install-exec install-exec-am \ + install-geeincludeHEADERS install-girDATA install-html \ + install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip install-typelibDATA \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-dist_vapiDATA \ + uninstall-geeincludeHEADERS uninstall-girDATA \ + uninstall-libLTLIBRARIES uninstall-typelibDATA + + +### testing rules + +# test: run all tests in cwd and subdirs +test: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} + @ for subdir in $(SUBDIRS) . ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done +# test-report: run tests in subdirs and generate report +# perf-report: run tests in subdirs with -m perf and generate report +# full-report: like test-report: with -m perf and -m slow +test-report perf-report full-report: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || { \ + case $@ in \ + test-report) test_options="-k";; \ + perf-report) test_options="-k -m=perf";; \ + full-report) test_options="-k -m=perf -m=slow";; \ + esac ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \ + elif test -n "${TEST_PROGS}" ; then \ + ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \ + fi ; \ + } + @ ignore_logdir=true ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \ + ignore_logdir=false ; \ + fi ; \ + for subdir in $(SUBDIRS) . ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done ; \ + $$ignore_logdir || { \ + echo '' > $@.xml ; \ + echo '' >> $@.xml ; \ + for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \ + sed '1,1s/^?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \ + done ; \ + echo >> $@.xml ; \ + echo '' >> $@.xml ; \ + rm -rf "$$GTESTER_LOGDIR"/ ; \ + ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \ + } +.PHONY: test test-report perf-report full-report +# run make test as part of make check +check-local: test + $(NULL) + +Gee-1.0.gir gee-internals-1.0.vapi gee-1.0.vapi gee.vala.stamp: $(libgee_la_VALASOURCES) + $(VALAC) -C $(AM_VALAFLAGS) $^ + touch $@ + +@HAVE_INTROSPECTION_TRUE@Gee-1.0.typelib: Gee-1.0.gir +@HAVE_INTROSPECTION_TRUE@ @INTROSPECTION_COMPILER@ -o $@ $^ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/gee/abstractcollection.c b/gee/abstractcollection.c new file mode 100644 index 0000000..a23fbb2 --- /dev/null +++ b/gee/abstractcollection.c @@ -0,0 +1,1851 @@ +/* abstractcollection.c generated by valac 0.18.0, the Vala compiler + * generated from abstractcollection.vala, do not modify */ + +/* abstractcollection.vala + * + * Copyright (C) 2007 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; +typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL))) + +#define GEE_TYPE_READ_ONLY_COLLECTION (gee_read_only_collection_get_type ()) +#define GEE_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollection)) +#define GEE_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass)) +#define GEE_IS_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_READ_ONLY_COLLECTION)) +#define GEE_IS_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_READ_ONLY_COLLECTION)) +#define GEE_READ_ONLY_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass)) + +typedef struct _GeeReadOnlyCollection GeeReadOnlyCollection; +typedef struct _GeeReadOnlyCollectionClass GeeReadOnlyCollectionClass; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeAbstractCollection { + GObject parent_instance; + GeeAbstractCollectionPrivate * priv; +}; + +struct _GeeAbstractCollectionClass { + GObjectClass parent_class; + gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*add) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item); + void (*clear) (GeeAbstractCollection* self); + gpointer* (*to_array) (GeeAbstractCollection* self, int* result_length1); + gboolean (*add_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeAbstractCollection* self, GeeCollection* collection); + GeeIterator* (*iterator) (GeeAbstractCollection* self); + gint (*get_size) (GeeAbstractCollection* self); + gboolean (*get_is_empty) (GeeAbstractCollection* self); + GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self); +}; + +struct _GeeAbstractCollectionPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GeeCollection* _read_only_view; +}; + + +static gpointer gee_abstract_collection_parent_class = NULL; +static GeeIterableIface* gee_abstract_collection_gee_iterable_parent_iface = NULL; +static GeeCollectionIface* gee_abstract_collection_gee_collection_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +#define GEE_ABSTRACT_COLLECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionPrivate)) +enum { + GEE_ABSTRACT_COLLECTION_DUMMY_PROPERTY, + GEE_ABSTRACT_COLLECTION_G_TYPE, + GEE_ABSTRACT_COLLECTION_G_DUP_FUNC, + GEE_ABSTRACT_COLLECTION_G_DESTROY_FUNC, + GEE_ABSTRACT_COLLECTION_SIZE, + GEE_ABSTRACT_COLLECTION_IS_EMPTY, + GEE_ABSTRACT_COLLECTION_ELEMENT_TYPE, + GEE_ABSTRACT_COLLECTION_READ_ONLY_VIEW +}; +gboolean gee_abstract_collection_contains (GeeAbstractCollection* self, gconstpointer item); +static gboolean gee_abstract_collection_real_contains (GeeAbstractCollection* self, gconstpointer item); +gboolean gee_abstract_collection_add (GeeAbstractCollection* self, gconstpointer item); +static gboolean gee_abstract_collection_real_add (GeeAbstractCollection* self, gconstpointer item); +gboolean gee_abstract_collection_remove (GeeAbstractCollection* self, gconstpointer item); +static gboolean gee_abstract_collection_real_remove (GeeAbstractCollection* self, gconstpointer item); +void gee_abstract_collection_clear (GeeAbstractCollection* self); +static void gee_abstract_collection_real_clear (GeeAbstractCollection* self); +gpointer* gee_abstract_collection_to_array (GeeAbstractCollection* self, int* result_length1); +static gpointer* gee_abstract_collection_real_to_array (GeeAbstractCollection* self, int* result_length1); +static gboolean* gee_abstract_collection_to_bool_array (GeeCollection* coll, int* result_length1); +static gchar* gee_abstract_collection_to_char_array (GeeCollection* coll, int* result_length1); +static guchar* gee_abstract_collection_to_uchar_array (GeeCollection* coll, int* result_length1); +static gint* gee_abstract_collection_to_int_array (GeeCollection* coll, int* result_length1); +static guint* gee_abstract_collection_to_uint_array (GeeCollection* coll, int* result_length1); +static gint64* gee_abstract_collection_to_int64_array (GeeCollection* coll, int* result_length1); +static guint64* gee_abstract_collection_to_uint64_array (GeeCollection* coll, int* result_length1); +static glong* gee_abstract_collection_to_long_array (GeeCollection* coll, int* result_length1); +static gulong* gee_abstract_collection_to_ulong_array (GeeCollection* coll, int* result_length1); +static gfloat** gee_abstract_collection_to_float_array (GeeCollection* coll, int* result_length1); +static gdouble** gee_abstract_collection_to_double_array (GeeCollection* coll, int* result_length1); +gint gee_collection_get_size (GeeCollection* self); +GeeIterator* gee_abstract_collection_iterator (GeeAbstractCollection* self); +gboolean gee_iterator_next (GeeIterator* self); +gpointer gee_iterator_get (GeeIterator* self); +GeeIterator* gee_iterable_iterator (GeeIterable* self); +static gfloat* _float_dup (gfloat* self); +static gdouble* _double_dup (gdouble* self); +gboolean gee_abstract_collection_add_all (GeeAbstractCollection* self, GeeCollection* collection); +static gboolean gee_abstract_collection_real_add_all (GeeAbstractCollection* self, GeeCollection* collection); +gboolean gee_collection_get_is_empty (GeeCollection* self); +gboolean gee_abstract_collection_contains_all (GeeAbstractCollection* self, GeeCollection* collection); +static gboolean gee_abstract_collection_real_contains_all (GeeAbstractCollection* self, GeeCollection* collection); +gboolean gee_abstract_collection_remove_all (GeeAbstractCollection* self, GeeCollection* collection); +static gboolean gee_abstract_collection_real_remove_all (GeeAbstractCollection* self, GeeCollection* collection); +gboolean gee_abstract_collection_retain_all (GeeAbstractCollection* self, GeeCollection* collection); +static gboolean gee_abstract_collection_real_retain_all (GeeAbstractCollection* self, GeeCollection* collection); +gboolean gee_collection_contains (GeeCollection* self, gconstpointer item); +static GeeIterator* gee_abstract_collection_real_iterator (GeeAbstractCollection* self); +GeeAbstractCollection* gee_abstract_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +gint gee_abstract_collection_get_size (GeeAbstractCollection* self); +gboolean gee_abstract_collection_get_is_empty (GeeAbstractCollection* self); +GeeCollection* gee_abstract_collection_get_read_only_view (GeeAbstractCollection* self); +GeeReadOnlyCollection* gee_read_only_collection_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection); +GeeReadOnlyCollection* gee_read_only_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection); +GType gee_read_only_collection_get_type (void) G_GNUC_CONST; +static void gee_abstract_collection_finalize (GObject* obj); +GType gee_iterable_get_element_type (GeeIterable* self); +static void _vala_gee_abstract_collection_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_abstract_collection_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); + + +/** + * {@inheritDoc} + */ +static gboolean gee_abstract_collection_real_contains (GeeAbstractCollection* self, gconstpointer item) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_collection_contains'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return FALSE; +} + + +gboolean gee_abstract_collection_contains (GeeAbstractCollection* self, gconstpointer item) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->contains (self, item); +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_abstract_collection_real_add (GeeAbstractCollection* self, gconstpointer item) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_collection_add'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return FALSE; +} + + +gboolean gee_abstract_collection_add (GeeAbstractCollection* self, gconstpointer item) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->add (self, item); +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_abstract_collection_real_remove (GeeAbstractCollection* self, gconstpointer item) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_collection_remove'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return FALSE; +} + + +gboolean gee_abstract_collection_remove (GeeAbstractCollection* self, gconstpointer item) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->remove (self, item); +} + + +/** + * {@inheritDoc} + */ +static void gee_abstract_collection_real_clear (GeeAbstractCollection* self) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_collection_clear'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return; +} + + +void gee_abstract_collection_clear (GeeAbstractCollection* self) { + g_return_if_fail (self != NULL); + GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->clear (self); +} + + +/** + * {@inheritDoc} + */ +static gpointer* gee_abstract_collection_real_to_array (GeeAbstractCollection* self, int* result_length1) { + gpointer* result = NULL; + GType t; + GType _tmp0_; + t = self->priv->g_type; + _tmp0_ = t; + if (_tmp0_ == G_TYPE_BOOLEAN) { + gint _tmp1_ = 0; + gboolean* _tmp2_ = NULL; + gpointer* _tmp3_; + gint _tmp3__length1; + _tmp2_ = gee_abstract_collection_to_bool_array (G_TYPE_CHECK_INSTANCE_CAST (self, GEE_TYPE_COLLECTION, GeeCollection), &_tmp1_); + _tmp3_ = (gpointer*) _tmp2_; + _tmp3__length1 = (_tmp1_ * sizeof (gboolean)) / sizeof (gpointer); + if (result_length1) { + *result_length1 = _tmp3__length1; + } + result = _tmp3_; + return result; + } else { + GType _tmp4_; + _tmp4_ = t; + if (_tmp4_ == G_TYPE_CHAR) { + gint _tmp5_ = 0; + gchar* _tmp6_ = NULL; + gpointer* _tmp7_; + gint _tmp7__length1; + _tmp6_ = gee_abstract_collection_to_char_array (G_TYPE_CHECK_INSTANCE_CAST (self, GEE_TYPE_COLLECTION, GeeCollection), &_tmp5_); + _tmp7_ = (gpointer*) _tmp6_; + _tmp7__length1 = (_tmp5_ * sizeof (gchar)) / sizeof (gpointer); + if (result_length1) { + *result_length1 = _tmp7__length1; + } + result = _tmp7_; + return result; + } else { + GType _tmp8_; + _tmp8_ = t; + if (_tmp8_ == G_TYPE_UCHAR) { + gint _tmp9_ = 0; + guchar* _tmp10_ = NULL; + gpointer* _tmp11_; + gint _tmp11__length1; + _tmp10_ = gee_abstract_collection_to_uchar_array (G_TYPE_CHECK_INSTANCE_CAST (self, GEE_TYPE_COLLECTION, GeeCollection), &_tmp9_); + _tmp11_ = (gpointer*) _tmp10_; + _tmp11__length1 = (_tmp9_ * sizeof (guchar)) / sizeof (gpointer); + if (result_length1) { + *result_length1 = _tmp11__length1; + } + result = _tmp11_; + return result; + } else { + GType _tmp12_; + _tmp12_ = t; + if (_tmp12_ == G_TYPE_INT) { + gint _tmp13_ = 0; + gint* _tmp14_ = NULL; + gpointer* _tmp15_; + gint _tmp15__length1; + _tmp14_ = gee_abstract_collection_to_int_array (G_TYPE_CHECK_INSTANCE_CAST (self, GEE_TYPE_COLLECTION, GeeCollection), &_tmp13_); + _tmp15_ = (gpointer*) _tmp14_; + _tmp15__length1 = (_tmp13_ * sizeof (gint)) / sizeof (gpointer); + if (result_length1) { + *result_length1 = _tmp15__length1; + } + result = _tmp15_; + return result; + } else { + GType _tmp16_; + _tmp16_ = t; + if (_tmp16_ == G_TYPE_UINT) { + gint _tmp17_ = 0; + guint* _tmp18_ = NULL; + gpointer* _tmp19_; + gint _tmp19__length1; + _tmp18_ = gee_abstract_collection_to_uint_array (G_TYPE_CHECK_INSTANCE_CAST (self, GEE_TYPE_COLLECTION, GeeCollection), &_tmp17_); + _tmp19_ = (gpointer*) _tmp18_; + _tmp19__length1 = (_tmp17_ * sizeof (guint)) / sizeof (gpointer); + if (result_length1) { + *result_length1 = _tmp19__length1; + } + result = _tmp19_; + return result; + } else { + GType _tmp20_; + _tmp20_ = t; + if (_tmp20_ == G_TYPE_INT64) { + gint _tmp21_ = 0; + gint64* _tmp22_ = NULL; + gpointer* _tmp23_; + gint _tmp23__length1; + _tmp22_ = gee_abstract_collection_to_int64_array (G_TYPE_CHECK_INSTANCE_CAST (self, GEE_TYPE_COLLECTION, GeeCollection), &_tmp21_); + _tmp23_ = (gpointer*) _tmp22_; + _tmp23__length1 = (_tmp21_ * sizeof (gint64)) / sizeof (gpointer); + if (result_length1) { + *result_length1 = _tmp23__length1; + } + result = _tmp23_; + return result; + } else { + GType _tmp24_; + _tmp24_ = t; + if (_tmp24_ == G_TYPE_UINT64) { + gint _tmp25_ = 0; + guint64* _tmp26_ = NULL; + gpointer* _tmp27_; + gint _tmp27__length1; + _tmp26_ = gee_abstract_collection_to_uint64_array (G_TYPE_CHECK_INSTANCE_CAST (self, GEE_TYPE_COLLECTION, GeeCollection), &_tmp25_); + _tmp27_ = (gpointer*) _tmp26_; + _tmp27__length1 = (_tmp25_ * sizeof (guint64)) / sizeof (gpointer); + if (result_length1) { + *result_length1 = _tmp27__length1; + } + result = _tmp27_; + return result; + } else { + GType _tmp28_; + _tmp28_ = t; + if (_tmp28_ == G_TYPE_LONG) { + gint _tmp29_ = 0; + glong* _tmp30_ = NULL; + gpointer* _tmp31_; + gint _tmp31__length1; + _tmp30_ = gee_abstract_collection_to_long_array (G_TYPE_CHECK_INSTANCE_CAST (self, GEE_TYPE_COLLECTION, GeeCollection), &_tmp29_); + _tmp31_ = (gpointer*) _tmp30_; + _tmp31__length1 = (_tmp29_ * sizeof (glong)) / sizeof (gpointer); + if (result_length1) { + *result_length1 = _tmp31__length1; + } + result = _tmp31_; + return result; + } else { + GType _tmp32_; + _tmp32_ = t; + if (_tmp32_ == G_TYPE_ULONG) { + gint _tmp33_ = 0; + gulong* _tmp34_ = NULL; + gpointer* _tmp35_; + gint _tmp35__length1; + _tmp34_ = gee_abstract_collection_to_ulong_array (G_TYPE_CHECK_INSTANCE_CAST (self, GEE_TYPE_COLLECTION, GeeCollection), &_tmp33_); + _tmp35_ = (gpointer*) _tmp34_; + _tmp35__length1 = (_tmp33_ * sizeof (gulong)) / sizeof (gpointer); + if (result_length1) { + *result_length1 = _tmp35__length1; + } + result = _tmp35_; + return result; + } else { + GType _tmp36_; + _tmp36_ = t; + if (_tmp36_ == G_TYPE_FLOAT) { + gint _tmp37_ = 0; + gfloat** _tmp38_ = NULL; + gpointer* _tmp39_; + gint _tmp39__length1; + _tmp38_ = gee_abstract_collection_to_float_array (G_TYPE_CHECK_INSTANCE_CAST (self, GEE_TYPE_COLLECTION, GeeCollection), &_tmp37_); + _tmp39_ = (gpointer*) _tmp38_; + _tmp39__length1 = (_tmp37_ * sizeof (gfloat*)) / sizeof (gpointer); + if (result_length1) { + *result_length1 = _tmp39__length1; + } + result = _tmp39_; + return result; + } else { + GType _tmp40_; + _tmp40_ = t; + if (_tmp40_ == G_TYPE_DOUBLE) { + gint _tmp41_ = 0; + gdouble** _tmp42_ = NULL; + gpointer* _tmp43_; + gint _tmp43__length1; + _tmp42_ = gee_abstract_collection_to_double_array (G_TYPE_CHECK_INSTANCE_CAST (self, GEE_TYPE_COLLECTION, GeeCollection), &_tmp41_); + _tmp43_ = (gpointer*) _tmp42_; + _tmp43__length1 = (_tmp41_ * sizeof (gdouble*)) / sizeof (gpointer); + if (result_length1) { + *result_length1 = _tmp43__length1; + } + result = _tmp43_; + return result; + } else { + gint _tmp44_; + gint _tmp45_; + gpointer* _tmp46_ = NULL; + gpointer* array; + gint array_length1; + gint _array_size_; + gint index; + gpointer* _tmp57_; + gint _tmp57__length1; + _tmp44_ = gee_collection_get_size ((GeeCollection*) self); + _tmp45_ = _tmp44_; + _tmp46_ = g_new0 (gpointer, _tmp45_); + array = _tmp46_; + array_length1 = _tmp45_; + _array_size_ = array_length1; + index = 0; + { + GeeIterator* _tmp47_ = NULL; + GeeIterator* _element_it; + _tmp47_ = gee_abstract_collection_iterator (self); + _element_it = _tmp47_; + while (TRUE) { + GeeIterator* _tmp48_; + gboolean _tmp49_ = FALSE; + GeeIterator* _tmp50_; + gpointer _tmp51_ = NULL; + gpointer element; + gpointer* _tmp52_; + gint _tmp52__length1; + gint _tmp53_; + gconstpointer _tmp54_; + gpointer _tmp55_; + gpointer _tmp56_; + _tmp48_ = _element_it; + _tmp49_ = gee_iterator_next (_tmp48_); + if (!_tmp49_) { + break; + } + _tmp50_ = _element_it; + _tmp51_ = gee_iterator_get (_tmp50_); + element = _tmp51_; + _tmp52_ = array; + _tmp52__length1 = array_length1; + _tmp53_ = index; + index = _tmp53_ + 1; + _tmp54_ = element; + _tmp55_ = ((_tmp54_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp54_) : ((gpointer) _tmp54_); + ((_tmp52_[_tmp53_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp52_[_tmp53_] = (self->priv->g_destroy_func (_tmp52_[_tmp53_]), NULL)); + _tmp52_[_tmp53_] = _tmp55_; + _tmp56_ = _tmp52_[_tmp53_]; + ((element == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (element = (self->priv->g_destroy_func (element), NULL)); + } + _g_object_unref0 (_element_it); + } + _tmp57_ = array; + _tmp57__length1 = array_length1; + if (result_length1) { + *result_length1 = _tmp57__length1; + } + result = _tmp57_; + return result; + } + } + } + } + } + } + } + } + } + } + } +} + + +gpointer* gee_abstract_collection_to_array (GeeAbstractCollection* self, int* result_length1) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->to_array (self, result_length1); +} + + +static gboolean* gee_abstract_collection_to_bool_array (GeeCollection* coll, int* result_length1) { + gboolean* result = NULL; + GeeCollection* _tmp0_; + gint _tmp1_; + gint _tmp2_; + gboolean* _tmp3_ = NULL; + gboolean* array; + gint array_length1; + gint _array_size_; + gint index; + gboolean* _tmp14_; + gint _tmp14__length1; + g_return_val_if_fail (coll != NULL, NULL); + _tmp0_ = coll; + _tmp1_ = gee_collection_get_size (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = g_new0 (gboolean, _tmp2_); + array = _tmp3_; + array_length1 = _tmp2_; + _array_size_ = array_length1; + index = 0; + { + GeeCollection* _tmp4_; + GeeIterator* _tmp5_ = NULL; + GeeIterator* _element_it; + _tmp4_ = coll; + _tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_); + _element_it = _tmp5_; + while (TRUE) { + GeeIterator* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeIterator* _tmp8_; + gpointer _tmp9_ = NULL; + gboolean element; + gboolean* _tmp10_; + gint _tmp10__length1; + gint _tmp11_; + gboolean _tmp12_; + gboolean _tmp13_; + _tmp6_ = _element_it; + _tmp7_ = gee_iterator_next (_tmp6_); + if (!_tmp7_) { + break; + } + _tmp8_ = _element_it; + _tmp9_ = gee_iterator_get (_tmp8_); + element = (gboolean) ((gintptr) _tmp9_); + _tmp10_ = array; + _tmp10__length1 = array_length1; + _tmp11_ = index; + index = _tmp11_ + 1; + _tmp12_ = element; + _tmp10_[_tmp11_] = _tmp12_; + _tmp13_ = _tmp10_[_tmp11_]; + } + _g_object_unref0 (_element_it); + } + _tmp14_ = array; + _tmp14__length1 = array_length1; + if (result_length1) { + *result_length1 = _tmp14__length1; + } + result = _tmp14_; + return result; +} + + +static gchar* gee_abstract_collection_to_char_array (GeeCollection* coll, int* result_length1) { + gchar* result = NULL; + GeeCollection* _tmp0_; + gint _tmp1_; + gint _tmp2_; + gchar* _tmp3_ = NULL; + gchar* array; + gint array_length1; + gint _array_size_; + gint index; + gchar* _tmp14_; + gint _tmp14__length1; + g_return_val_if_fail (coll != NULL, NULL); + _tmp0_ = coll; + _tmp1_ = gee_collection_get_size (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = g_new0 (gchar, _tmp2_); + array = _tmp3_; + array_length1 = _tmp2_; + _array_size_ = array_length1; + index = 0; + { + GeeCollection* _tmp4_; + GeeIterator* _tmp5_ = NULL; + GeeIterator* _element_it; + _tmp4_ = coll; + _tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_); + _element_it = _tmp5_; + while (TRUE) { + GeeIterator* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeIterator* _tmp8_; + gpointer _tmp9_ = NULL; + gchar element; + gchar* _tmp10_; + gint _tmp10__length1; + gint _tmp11_; + gchar _tmp12_; + gchar _tmp13_; + _tmp6_ = _element_it; + _tmp7_ = gee_iterator_next (_tmp6_); + if (!_tmp7_) { + break; + } + _tmp8_ = _element_it; + _tmp9_ = gee_iterator_get (_tmp8_); + element = (gchar) ((gintptr) _tmp9_); + _tmp10_ = array; + _tmp10__length1 = array_length1; + _tmp11_ = index; + index = _tmp11_ + 1; + _tmp12_ = element; + _tmp10_[_tmp11_] = _tmp12_; + _tmp13_ = _tmp10_[_tmp11_]; + } + _g_object_unref0 (_element_it); + } + _tmp14_ = array; + _tmp14__length1 = array_length1; + if (result_length1) { + *result_length1 = _tmp14__length1; + } + result = _tmp14_; + return result; +} + + +static guchar* gee_abstract_collection_to_uchar_array (GeeCollection* coll, int* result_length1) { + guchar* result = NULL; + GeeCollection* _tmp0_; + gint _tmp1_; + gint _tmp2_; + guchar* _tmp3_ = NULL; + guchar* array; + gint array_length1; + gint _array_size_; + gint index; + guchar* _tmp14_; + gint _tmp14__length1; + g_return_val_if_fail (coll != NULL, NULL); + _tmp0_ = coll; + _tmp1_ = gee_collection_get_size (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = g_new0 (guchar, _tmp2_); + array = _tmp3_; + array_length1 = _tmp2_; + _array_size_ = array_length1; + index = 0; + { + GeeCollection* _tmp4_; + GeeIterator* _tmp5_ = NULL; + GeeIterator* _element_it; + _tmp4_ = coll; + _tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_); + _element_it = _tmp5_; + while (TRUE) { + GeeIterator* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeIterator* _tmp8_; + gpointer _tmp9_ = NULL; + guchar element; + guchar* _tmp10_; + gint _tmp10__length1; + gint _tmp11_; + guchar _tmp12_; + guchar _tmp13_; + _tmp6_ = _element_it; + _tmp7_ = gee_iterator_next (_tmp6_); + if (!_tmp7_) { + break; + } + _tmp8_ = _element_it; + _tmp9_ = gee_iterator_get (_tmp8_); + element = (guchar) ((guintptr) _tmp9_); + _tmp10_ = array; + _tmp10__length1 = array_length1; + _tmp11_ = index; + index = _tmp11_ + 1; + _tmp12_ = element; + _tmp10_[_tmp11_] = _tmp12_; + _tmp13_ = _tmp10_[_tmp11_]; + } + _g_object_unref0 (_element_it); + } + _tmp14_ = array; + _tmp14__length1 = array_length1; + if (result_length1) { + *result_length1 = _tmp14__length1; + } + result = _tmp14_; + return result; +} + + +static gint* gee_abstract_collection_to_int_array (GeeCollection* coll, int* result_length1) { + gint* result = NULL; + GeeCollection* _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint* _tmp3_ = NULL; + gint* array; + gint array_length1; + gint _array_size_; + gint index; + gint* _tmp14_; + gint _tmp14__length1; + g_return_val_if_fail (coll != NULL, NULL); + _tmp0_ = coll; + _tmp1_ = gee_collection_get_size (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = g_new0 (gint, _tmp2_); + array = _tmp3_; + array_length1 = _tmp2_; + _array_size_ = array_length1; + index = 0; + { + GeeCollection* _tmp4_; + GeeIterator* _tmp5_ = NULL; + GeeIterator* _element_it; + _tmp4_ = coll; + _tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_); + _element_it = _tmp5_; + while (TRUE) { + GeeIterator* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeIterator* _tmp8_; + gpointer _tmp9_ = NULL; + gint element; + gint* _tmp10_; + gint _tmp10__length1; + gint _tmp11_; + gint _tmp12_; + gint _tmp13_; + _tmp6_ = _element_it; + _tmp7_ = gee_iterator_next (_tmp6_); + if (!_tmp7_) { + break; + } + _tmp8_ = _element_it; + _tmp9_ = gee_iterator_get (_tmp8_); + element = (gint) ((gintptr) _tmp9_); + _tmp10_ = array; + _tmp10__length1 = array_length1; + _tmp11_ = index; + index = _tmp11_ + 1; + _tmp12_ = element; + _tmp10_[_tmp11_] = _tmp12_; + _tmp13_ = _tmp10_[_tmp11_]; + } + _g_object_unref0 (_element_it); + } + _tmp14_ = array; + _tmp14__length1 = array_length1; + if (result_length1) { + *result_length1 = _tmp14__length1; + } + result = _tmp14_; + return result; +} + + +static guint* gee_abstract_collection_to_uint_array (GeeCollection* coll, int* result_length1) { + guint* result = NULL; + GeeCollection* _tmp0_; + gint _tmp1_; + gint _tmp2_; + guint* _tmp3_ = NULL; + guint* array; + gint array_length1; + gint _array_size_; + gint index; + guint* _tmp14_; + gint _tmp14__length1; + g_return_val_if_fail (coll != NULL, NULL); + _tmp0_ = coll; + _tmp1_ = gee_collection_get_size (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = g_new0 (guint, _tmp2_); + array = _tmp3_; + array_length1 = _tmp2_; + _array_size_ = array_length1; + index = 0; + { + GeeCollection* _tmp4_; + GeeIterator* _tmp5_ = NULL; + GeeIterator* _element_it; + _tmp4_ = coll; + _tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_); + _element_it = _tmp5_; + while (TRUE) { + GeeIterator* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeIterator* _tmp8_; + gpointer _tmp9_ = NULL; + guint element; + guint* _tmp10_; + gint _tmp10__length1; + gint _tmp11_; + guint _tmp12_; + guint _tmp13_; + _tmp6_ = _element_it; + _tmp7_ = gee_iterator_next (_tmp6_); + if (!_tmp7_) { + break; + } + _tmp8_ = _element_it; + _tmp9_ = gee_iterator_get (_tmp8_); + element = (guint) ((guintptr) _tmp9_); + _tmp10_ = array; + _tmp10__length1 = array_length1; + _tmp11_ = index; + index = _tmp11_ + 1; + _tmp12_ = element; + _tmp10_[_tmp11_] = _tmp12_; + _tmp13_ = _tmp10_[_tmp11_]; + } + _g_object_unref0 (_element_it); + } + _tmp14_ = array; + _tmp14__length1 = array_length1; + if (result_length1) { + *result_length1 = _tmp14__length1; + } + result = _tmp14_; + return result; +} + + +static gint64* gee_abstract_collection_to_int64_array (GeeCollection* coll, int* result_length1) { + gint64* result = NULL; + GeeCollection* _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint64* _tmp3_ = NULL; + gint64* array; + gint array_length1; + gint _array_size_; + gint index; + gint64* _tmp16_; + gint _tmp16__length1; + g_return_val_if_fail (coll != NULL, NULL); + _tmp0_ = coll; + _tmp1_ = gee_collection_get_size (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = g_new0 (gint64, _tmp2_); + array = _tmp3_; + array_length1 = _tmp2_; + _array_size_ = array_length1; + index = 0; + { + GeeCollection* _tmp4_; + GeeIterator* _tmp5_ = NULL; + GeeIterator* _element_it; + _tmp4_ = coll; + _tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_); + _element_it = _tmp5_; + while (TRUE) { + GeeIterator* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeIterator* _tmp8_; + gpointer _tmp9_ = NULL; + gint64* _tmp10_; + gint64 _tmp11_; + gint64 element; + gint64* _tmp12_; + gint _tmp12__length1; + gint _tmp13_; + gint64 _tmp14_; + gint64 _tmp15_; + _tmp6_ = _element_it; + _tmp7_ = gee_iterator_next (_tmp6_); + if (!_tmp7_) { + break; + } + _tmp8_ = _element_it; + _tmp9_ = gee_iterator_get (_tmp8_); + _tmp10_ = (gint64*) _tmp9_; + _tmp11_ = *_tmp10_; + _g_free0 (_tmp10_); + element = _tmp11_; + _tmp12_ = array; + _tmp12__length1 = array_length1; + _tmp13_ = index; + index = _tmp13_ + 1; + _tmp14_ = element; + _tmp12_[_tmp13_] = _tmp14_; + _tmp15_ = _tmp12_[_tmp13_]; + } + _g_object_unref0 (_element_it); + } + _tmp16_ = array; + _tmp16__length1 = array_length1; + if (result_length1) { + *result_length1 = _tmp16__length1; + } + result = _tmp16_; + return result; +} + + +static guint64* gee_abstract_collection_to_uint64_array (GeeCollection* coll, int* result_length1) { + guint64* result = NULL; + GeeCollection* _tmp0_; + gint _tmp1_; + gint _tmp2_; + guint64* _tmp3_ = NULL; + guint64* array; + gint array_length1; + gint _array_size_; + gint index; + guint64* _tmp16_; + gint _tmp16__length1; + g_return_val_if_fail (coll != NULL, NULL); + _tmp0_ = coll; + _tmp1_ = gee_collection_get_size (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = g_new0 (guint64, _tmp2_); + array = _tmp3_; + array_length1 = _tmp2_; + _array_size_ = array_length1; + index = 0; + { + GeeCollection* _tmp4_; + GeeIterator* _tmp5_ = NULL; + GeeIterator* _element_it; + _tmp4_ = coll; + _tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_); + _element_it = _tmp5_; + while (TRUE) { + GeeIterator* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeIterator* _tmp8_; + gpointer _tmp9_ = NULL; + guint64* _tmp10_; + guint64 _tmp11_; + guint64 element; + guint64* _tmp12_; + gint _tmp12__length1; + gint _tmp13_; + guint64 _tmp14_; + guint64 _tmp15_; + _tmp6_ = _element_it; + _tmp7_ = gee_iterator_next (_tmp6_); + if (!_tmp7_) { + break; + } + _tmp8_ = _element_it; + _tmp9_ = gee_iterator_get (_tmp8_); + _tmp10_ = (guint64*) _tmp9_; + _tmp11_ = *_tmp10_; + _g_free0 (_tmp10_); + element = _tmp11_; + _tmp12_ = array; + _tmp12__length1 = array_length1; + _tmp13_ = index; + index = _tmp13_ + 1; + _tmp14_ = element; + _tmp12_[_tmp13_] = _tmp14_; + _tmp15_ = _tmp12_[_tmp13_]; + } + _g_object_unref0 (_element_it); + } + _tmp16_ = array; + _tmp16__length1 = array_length1; + if (result_length1) { + *result_length1 = _tmp16__length1; + } + result = _tmp16_; + return result; +} + + +static glong* gee_abstract_collection_to_long_array (GeeCollection* coll, int* result_length1) { + glong* result = NULL; + GeeCollection* _tmp0_; + gint _tmp1_; + gint _tmp2_; + glong* _tmp3_ = NULL; + glong* array; + gint array_length1; + gint _array_size_; + gint index; + glong* _tmp14_; + gint _tmp14__length1; + g_return_val_if_fail (coll != NULL, NULL); + _tmp0_ = coll; + _tmp1_ = gee_collection_get_size (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = g_new0 (glong, _tmp2_); + array = _tmp3_; + array_length1 = _tmp2_; + _array_size_ = array_length1; + index = 0; + { + GeeCollection* _tmp4_; + GeeIterator* _tmp5_ = NULL; + GeeIterator* _element_it; + _tmp4_ = coll; + _tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_); + _element_it = _tmp5_; + while (TRUE) { + GeeIterator* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeIterator* _tmp8_; + gpointer _tmp9_ = NULL; + glong element; + glong* _tmp10_; + gint _tmp10__length1; + gint _tmp11_; + glong _tmp12_; + glong _tmp13_; + _tmp6_ = _element_it; + _tmp7_ = gee_iterator_next (_tmp6_); + if (!_tmp7_) { + break; + } + _tmp8_ = _element_it; + _tmp9_ = gee_iterator_get (_tmp8_); + element = (glong) ((gintptr) _tmp9_); + _tmp10_ = array; + _tmp10__length1 = array_length1; + _tmp11_ = index; + index = _tmp11_ + 1; + _tmp12_ = element; + _tmp10_[_tmp11_] = _tmp12_; + _tmp13_ = _tmp10_[_tmp11_]; + } + _g_object_unref0 (_element_it); + } + _tmp14_ = array; + _tmp14__length1 = array_length1; + if (result_length1) { + *result_length1 = _tmp14__length1; + } + result = _tmp14_; + return result; +} + + +static gulong* gee_abstract_collection_to_ulong_array (GeeCollection* coll, int* result_length1) { + gulong* result = NULL; + GeeCollection* _tmp0_; + gint _tmp1_; + gint _tmp2_; + gulong* _tmp3_ = NULL; + gulong* array; + gint array_length1; + gint _array_size_; + gint index; + gulong* _tmp14_; + gint _tmp14__length1; + g_return_val_if_fail (coll != NULL, NULL); + _tmp0_ = coll; + _tmp1_ = gee_collection_get_size (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = g_new0 (gulong, _tmp2_); + array = _tmp3_; + array_length1 = _tmp2_; + _array_size_ = array_length1; + index = 0; + { + GeeCollection* _tmp4_; + GeeIterator* _tmp5_ = NULL; + GeeIterator* _element_it; + _tmp4_ = coll; + _tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_); + _element_it = _tmp5_; + while (TRUE) { + GeeIterator* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeIterator* _tmp8_; + gpointer _tmp9_ = NULL; + gulong element; + gulong* _tmp10_; + gint _tmp10__length1; + gint _tmp11_; + gulong _tmp12_; + gulong _tmp13_; + _tmp6_ = _element_it; + _tmp7_ = gee_iterator_next (_tmp6_); + if (!_tmp7_) { + break; + } + _tmp8_ = _element_it; + _tmp9_ = gee_iterator_get (_tmp8_); + element = (gulong) ((guintptr) _tmp9_); + _tmp10_ = array; + _tmp10__length1 = array_length1; + _tmp11_ = index; + index = _tmp11_ + 1; + _tmp12_ = element; + _tmp10_[_tmp11_] = _tmp12_; + _tmp13_ = _tmp10_[_tmp11_]; + } + _g_object_unref0 (_element_it); + } + _tmp14_ = array; + _tmp14__length1 = array_length1; + if (result_length1) { + *result_length1 = _tmp14__length1; + } + result = _tmp14_; + return result; +} + + +static gfloat* _float_dup (gfloat* self) { + gfloat* dup; + dup = g_new0 (gfloat, 1); + memcpy (dup, self, sizeof (gfloat)); + return dup; +} + + +static gpointer __float_dup0 (gpointer self) { + return self ? _float_dup (self) : NULL; +} + + +static gfloat** gee_abstract_collection_to_float_array (GeeCollection* coll, int* result_length1) { + gfloat** result = NULL; + GeeCollection* _tmp0_; + gint _tmp1_; + gint _tmp2_; + gfloat** _tmp3_ = NULL; + gfloat** array; + gint array_length1; + gint _array_size_; + gint index; + gfloat** _tmp17_; + gint _tmp17__length1; + g_return_val_if_fail (coll != NULL, NULL); + _tmp0_ = coll; + _tmp1_ = gee_collection_get_size (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = g_new0 (gfloat*, _tmp2_); + array = _tmp3_; + array_length1 = _tmp2_; + _array_size_ = array_length1; + index = 0; + { + GeeCollection* _tmp4_; + GeeIterator* _tmp5_ = NULL; + GeeIterator* _element_it; + _tmp4_ = coll; + _tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_); + _element_it = _tmp5_; + while (TRUE) { + GeeIterator* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeIterator* _tmp8_; + gpointer _tmp9_ = NULL; + gfloat* _tmp10_; + gfloat _tmp11_; + gfloat element; + gfloat** _tmp12_; + gint _tmp12__length1; + gint _tmp13_; + gfloat _tmp14_; + gfloat* _tmp15_; + gfloat* _tmp16_; + _tmp6_ = _element_it; + _tmp7_ = gee_iterator_next (_tmp6_); + if (!_tmp7_) { + break; + } + _tmp8_ = _element_it; + _tmp9_ = gee_iterator_get (_tmp8_); + _tmp10_ = (gfloat*) _tmp9_; + _tmp11_ = *_tmp10_; + _g_free0 (_tmp10_); + element = _tmp11_; + _tmp12_ = array; + _tmp12__length1 = array_length1; + _tmp13_ = index; + index = _tmp13_ + 1; + _tmp14_ = element; + _tmp15_ = __float_dup0 (&_tmp14_); + _g_free0 (_tmp12_[_tmp13_]); + _tmp12_[_tmp13_] = _tmp15_; + _tmp16_ = _tmp12_[_tmp13_]; + } + _g_object_unref0 (_element_it); + } + _tmp17_ = array; + _tmp17__length1 = array_length1; + if (result_length1) { + *result_length1 = _tmp17__length1; + } + result = _tmp17_; + return result; +} + + +static gdouble* _double_dup (gdouble* self) { + gdouble* dup; + dup = g_new0 (gdouble, 1); + memcpy (dup, self, sizeof (gdouble)); + return dup; +} + + +static gpointer __double_dup0 (gpointer self) { + return self ? _double_dup (self) : NULL; +} + + +static gdouble** gee_abstract_collection_to_double_array (GeeCollection* coll, int* result_length1) { + gdouble** result = NULL; + GeeCollection* _tmp0_; + gint _tmp1_; + gint _tmp2_; + gdouble** _tmp3_ = NULL; + gdouble** array; + gint array_length1; + gint _array_size_; + gint index; + gdouble** _tmp17_; + gint _tmp17__length1; + g_return_val_if_fail (coll != NULL, NULL); + _tmp0_ = coll; + _tmp1_ = gee_collection_get_size (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = g_new0 (gdouble*, _tmp2_); + array = _tmp3_; + array_length1 = _tmp2_; + _array_size_ = array_length1; + index = 0; + { + GeeCollection* _tmp4_; + GeeIterator* _tmp5_ = NULL; + GeeIterator* _element_it; + _tmp4_ = coll; + _tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_); + _element_it = _tmp5_; + while (TRUE) { + GeeIterator* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeIterator* _tmp8_; + gpointer _tmp9_ = NULL; + gdouble* _tmp10_; + gdouble _tmp11_; + gdouble element; + gdouble** _tmp12_; + gint _tmp12__length1; + gint _tmp13_; + gdouble _tmp14_; + gdouble* _tmp15_; + gdouble* _tmp16_; + _tmp6_ = _element_it; + _tmp7_ = gee_iterator_next (_tmp6_); + if (!_tmp7_) { + break; + } + _tmp8_ = _element_it; + _tmp9_ = gee_iterator_get (_tmp8_); + _tmp10_ = (gdouble*) _tmp9_; + _tmp11_ = *_tmp10_; + _g_free0 (_tmp10_); + element = _tmp11_; + _tmp12_ = array; + _tmp12__length1 = array_length1; + _tmp13_ = index; + index = _tmp13_ + 1; + _tmp14_ = element; + _tmp15_ = __double_dup0 (&_tmp14_); + _g_free0 (_tmp12_[_tmp13_]); + _tmp12_[_tmp13_] = _tmp15_; + _tmp16_ = _tmp12_[_tmp13_]; + } + _g_object_unref0 (_element_it); + } + _tmp17_ = array; + _tmp17__length1 = array_length1; + if (result_length1) { + *result_length1 = _tmp17__length1; + } + result = _tmp17_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_abstract_collection_real_add_all (GeeAbstractCollection* self, GeeCollection* collection) { + gboolean result = FALSE; + GeeCollection* _tmp0_; + gboolean _tmp1_; + gboolean _tmp2_; + gboolean changed; + g_return_val_if_fail (collection != NULL, FALSE); + _tmp0_ = collection; + _tmp1_ = gee_collection_get_is_empty (_tmp0_); + _tmp2_ = _tmp1_; + if (_tmp2_) { + result = FALSE; + return result; + } + changed = FALSE; + { + GeeCollection* _tmp3_; + GeeIterator* _tmp4_ = NULL; + GeeIterator* _item_it; + _tmp3_ = collection; + _tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_); + _item_it = _tmp4_; + while (TRUE) { + GeeIterator* _tmp5_; + gboolean _tmp6_ = FALSE; + GeeIterator* _tmp7_; + gpointer _tmp8_ = NULL; + gpointer item; + gboolean _tmp9_; + gconstpointer _tmp10_; + gboolean _tmp11_ = FALSE; + _tmp5_ = _item_it; + _tmp6_ = gee_iterator_next (_tmp5_); + if (!_tmp6_) { + break; + } + _tmp7_ = _item_it; + _tmp8_ = gee_iterator_get (_tmp7_); + item = _tmp8_; + _tmp9_ = changed; + _tmp10_ = item; + _tmp11_ = gee_abstract_collection_add (self, _tmp10_); + changed = _tmp9_ | _tmp11_; + ((item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (item = (self->priv->g_destroy_func (item), NULL)); + } + _g_object_unref0 (_item_it); + } + result = changed; + return result; +} + + +gboolean gee_abstract_collection_add_all (GeeAbstractCollection* self, GeeCollection* collection) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->add_all (self, collection); +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_abstract_collection_real_contains_all (GeeAbstractCollection* self, GeeCollection* collection) { + gboolean result = FALSE; + GeeCollection* _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint _tmp3_; + gint _tmp4_; + g_return_val_if_fail (collection != NULL, FALSE); + _tmp0_ = collection; + _tmp1_ = gee_collection_get_size (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = gee_collection_get_size ((GeeCollection*) self); + _tmp4_ = _tmp3_; + if (_tmp2_ > _tmp4_) { + result = FALSE; + return result; + } + { + GeeCollection* _tmp5_; + GeeIterator* _tmp6_ = NULL; + GeeIterator* _item_it; + _tmp5_ = collection; + _tmp6_ = gee_iterable_iterator ((GeeIterable*) _tmp5_); + _item_it = _tmp6_; + while (TRUE) { + GeeIterator* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeIterator* _tmp9_; + gpointer _tmp10_ = NULL; + gpointer item; + gconstpointer _tmp11_; + gboolean _tmp12_ = FALSE; + _tmp7_ = _item_it; + _tmp8_ = gee_iterator_next (_tmp7_); + if (!_tmp8_) { + break; + } + _tmp9_ = _item_it; + _tmp10_ = gee_iterator_get (_tmp9_); + item = _tmp10_; + _tmp11_ = item; + _tmp12_ = gee_abstract_collection_contains (self, _tmp11_); + if (!_tmp12_) { + result = FALSE; + ((item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (item = (self->priv->g_destroy_func (item), NULL)); + _g_object_unref0 (_item_it); + return result; + } + ((item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (item = (self->priv->g_destroy_func (item), NULL)); + } + _g_object_unref0 (_item_it); + } + result = TRUE; + return result; +} + + +gboolean gee_abstract_collection_contains_all (GeeAbstractCollection* self, GeeCollection* collection) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->contains_all (self, collection); +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_abstract_collection_real_remove_all (GeeAbstractCollection* self, GeeCollection* collection) { + gboolean result = FALSE; + gboolean changed; + g_return_val_if_fail (collection != NULL, FALSE); + changed = FALSE; + { + GeeCollection* _tmp0_; + GeeIterator* _tmp1_ = NULL; + GeeIterator* _item_it; + _tmp0_ = collection; + _tmp1_ = gee_iterable_iterator ((GeeIterable*) _tmp0_); + _item_it = _tmp1_; + while (TRUE) { + GeeIterator* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeIterator* _tmp4_; + gpointer _tmp5_ = NULL; + gpointer item; + gboolean _tmp6_; + gconstpointer _tmp7_; + gboolean _tmp8_ = FALSE; + _tmp2_ = _item_it; + _tmp3_ = gee_iterator_next (_tmp2_); + if (!_tmp3_) { + break; + } + _tmp4_ = _item_it; + _tmp5_ = gee_iterator_get (_tmp4_); + item = _tmp5_; + _tmp6_ = changed; + _tmp7_ = item; + _tmp8_ = gee_abstract_collection_remove (self, _tmp7_); + changed = _tmp6_ | _tmp8_; + ((item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (item = (self->priv->g_destroy_func (item), NULL)); + } + _g_object_unref0 (_item_it); + } + result = changed; + return result; +} + + +gboolean gee_abstract_collection_remove_all (GeeAbstractCollection* self, GeeCollection* collection) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->remove_all (self, collection); +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_abstract_collection_real_retain_all (GeeAbstractCollection* self, GeeCollection* collection) { + gboolean result = FALSE; + gboolean changed; + gint _tmp0_ = 0; + gpointer* _tmp1_ = NULL; + gpointer* items; + gint items_length1; + gint _items_size_; + gint _tmp2_; + gint _tmp3_; + gint size_of_items; + g_return_val_if_fail (collection != NULL, FALSE); + changed = FALSE; + _tmp1_ = gee_abstract_collection_to_array (self, &_tmp0_); + items = _tmp1_; + items_length1 = _tmp0_; + _items_size_ = items_length1; + _tmp2_ = gee_collection_get_size ((GeeCollection*) self); + _tmp3_ = _tmp2_; + size_of_items = _tmp3_; + { + gint index; + index = 0; + { + gboolean _tmp4_; + _tmp4_ = TRUE; + while (TRUE) { + gboolean _tmp5_; + gint _tmp7_; + gint _tmp8_; + GeeCollection* _tmp9_; + gpointer* _tmp10_; + gint _tmp10__length1; + gint _tmp11_; + gconstpointer _tmp12_; + gboolean _tmp13_ = FALSE; + _tmp5_ = _tmp4_; + if (!_tmp5_) { + gint _tmp6_; + _tmp6_ = index; + index = _tmp6_ + 1; + } + _tmp4_ = FALSE; + _tmp7_ = index; + _tmp8_ = size_of_items; + if (!(_tmp7_ < _tmp8_)) { + break; + } + _tmp9_ = collection; + _tmp10_ = items; + _tmp10__length1 = items_length1; + _tmp11_ = index; + _tmp12_ = _tmp10_[_tmp11_]; + _tmp13_ = gee_collection_contains (_tmp9_, _tmp12_); + if (!_tmp13_) { + gboolean _tmp14_; + gpointer* _tmp15_; + gint _tmp15__length1; + gint _tmp16_; + gconstpointer _tmp17_; + gboolean _tmp18_ = FALSE; + _tmp14_ = changed; + _tmp15_ = items; + _tmp15__length1 = items_length1; + _tmp16_ = index; + _tmp17_ = _tmp15_[_tmp16_]; + _tmp18_ = gee_abstract_collection_remove (self, _tmp17_); + changed = _tmp14_ | _tmp18_; + } + } + } + } + result = changed; + items = (_vala_array_free (items, items_length1, (GDestroyNotify) self->priv->g_destroy_func), NULL); + return result; +} + + +gboolean gee_abstract_collection_retain_all (GeeAbstractCollection* self, GeeCollection* collection) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->retain_all (self, collection); +} + + +/** + * {@inheritDoc} + */ +static GeeIterator* gee_abstract_collection_real_iterator (GeeAbstractCollection* self) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_collection_iterator'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return NULL; +} + + +GeeIterator* gee_abstract_collection_iterator (GeeAbstractCollection* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->iterator (self); +} + + +GeeAbstractCollection* gee_abstract_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) { + GeeAbstractCollection * self = NULL; + self = (GeeAbstractCollection*) g_object_new (object_type, NULL); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + return self; +} + + +gint gee_abstract_collection_get_size (GeeAbstractCollection* self) { + g_return_val_if_fail (self != NULL, 0); + return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->get_size (self); +} + + +gboolean gee_abstract_collection_get_is_empty (GeeAbstractCollection* self) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->get_is_empty (self); +} + + +static gboolean gee_abstract_collection_real_get_is_empty (GeeAbstractCollection* base) { + gboolean result; + GeeAbstractCollection* self; + gint _tmp0_; + gint _tmp1_; + self = base; + _tmp0_ = gee_collection_get_size ((GeeCollection*) self); + _tmp1_ = _tmp0_; + result = _tmp1_ == 0; + return result; +} + + +static GType gee_abstract_collection_real_get_element_type (GeeIterable* base) { + GType result; + GeeAbstractCollection* self; + self = (GeeAbstractCollection*) base; + result = self->priv->g_type; + return result; +} + + +GeeCollection* gee_abstract_collection_get_read_only_view (GeeAbstractCollection* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->get_read_only_view (self); +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static GeeCollection* gee_abstract_collection_real_get_read_only_view (GeeAbstractCollection* base) { + GeeCollection* result; + GeeAbstractCollection* self; + GeeCollection* _tmp0_; + GeeCollection* _tmp1_; + GeeCollection* instance; + GeeCollection* _tmp2_; + self = base; + _tmp0_ = self->priv->_read_only_view; + _tmp1_ = _g_object_ref0 (_tmp0_); + instance = _tmp1_; + _tmp2_ = self->priv->_read_only_view; + if (_tmp2_ == NULL) { + GeeReadOnlyCollection* _tmp3_; + GeeCollection* _tmp4_; + GeeCollection* _tmp5_; + _tmp3_ = gee_read_only_collection_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, (GeeCollection*) self); + _g_object_unref0 (instance); + instance = (GeeCollection*) _tmp3_; + _tmp4_ = instance; + self->priv->_read_only_view = _tmp4_; + _tmp5_ = instance; + g_object_add_weak_pointer ((GObject*) _tmp5_, (void**) (&self->priv->_read_only_view)); + } + result = instance; + return result; +} + + +static void gee_abstract_collection_class_init (GeeAbstractCollectionClass * klass) { + gee_abstract_collection_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeAbstractCollectionPrivate)); + GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains = gee_abstract_collection_real_contains; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add = gee_abstract_collection_real_add; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove = gee_abstract_collection_real_remove; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->clear = gee_abstract_collection_real_clear; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->to_array = gee_abstract_collection_real_to_array; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add_all = gee_abstract_collection_real_add_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains_all = gee_abstract_collection_real_contains_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove_all = gee_abstract_collection_real_remove_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->retain_all = gee_abstract_collection_real_retain_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->iterator = gee_abstract_collection_real_iterator; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_is_empty = gee_abstract_collection_real_get_is_empty; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_read_only_view = gee_abstract_collection_real_get_read_only_view; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_abstract_collection_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_abstract_collection_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_abstract_collection_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_COLLECTION_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_COLLECTION_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_COLLECTION_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_COLLECTION_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_COLLECTION_IS_EMPTY, g_param_spec_boolean ("is-empty", "is-empty", "is-empty", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_COLLECTION_ELEMENT_TYPE, g_param_spec_gtype ("element-type", "element-type", "element-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_COLLECTION_READ_ONLY_VIEW, g_param_spec_object ("read-only-view", "read-only-view", "read-only-view", GEE_TYPE_COLLECTION, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_abstract_collection_gee_iterable_interface_init (GeeIterableIface * iface) { + gee_abstract_collection_gee_iterable_parent_iface = g_type_interface_peek_parent (iface); + iface->iterator = (GeeIterator* (*)(GeeIterable*)) gee_abstract_collection_iterator; + iface->get_element_type = gee_abstract_collection_real_get_element_type; +} + + +static void gee_abstract_collection_gee_collection_interface_init (GeeCollectionIface * iface) { + gee_abstract_collection_gee_collection_parent_iface = g_type_interface_peek_parent (iface); + iface->contains = (gboolean (*)(GeeCollection*, gconstpointer)) gee_abstract_collection_contains; + iface->add = (gboolean (*)(GeeCollection*, gconstpointer)) gee_abstract_collection_add; + iface->remove = (gboolean (*)(GeeCollection*, gconstpointer)) gee_abstract_collection_remove; + iface->clear = (void (*)(GeeCollection*)) gee_abstract_collection_clear; + iface->to_array = (gpointer* (*)(GeeCollection*, int*)) gee_abstract_collection_to_array; + iface->add_all = (gboolean (*)(GeeCollection*, GeeCollection*)) gee_abstract_collection_add_all; + iface->contains_all = (gboolean (*)(GeeCollection*, GeeCollection*)) gee_abstract_collection_contains_all; + iface->remove_all = (gboolean (*)(GeeCollection*, GeeCollection*)) gee_abstract_collection_remove_all; + iface->retain_all = (gboolean (*)(GeeCollection*, GeeCollection*)) gee_abstract_collection_retain_all; + iface->get_size = (gint (*) (GeeCollection *)) gee_abstract_collection_get_size; + iface->get_is_empty = (gboolean (*) (GeeCollection *)) gee_abstract_collection_get_is_empty; + iface->get_read_only_view = (GeeCollection* (*) (GeeCollection *)) gee_abstract_collection_get_read_only_view; +} + + +static void gee_abstract_collection_instance_init (GeeAbstractCollection * self) { + self->priv = GEE_ABSTRACT_COLLECTION_GET_PRIVATE (self); +} + + +static void gee_abstract_collection_finalize (GObject* obj) { + GeeAbstractCollection * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection); + G_OBJECT_CLASS (gee_abstract_collection_parent_class)->finalize (obj); +} + + +/** + * Skeletal implementation of the {@link Collection} interface. + * + * Contains common code shared by all collection implementations. + * + * @see AbstractList + * @see AbstractSet + * @see AbstractMultiSet + */ +GType gee_abstract_collection_get_type (void) { + static volatile gsize gee_abstract_collection_type_id__volatile = 0; + if (g_once_init_enter (&gee_abstract_collection_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeAbstractCollectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_abstract_collection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeAbstractCollection), 0, (GInstanceInitFunc) gee_abstract_collection_instance_init, NULL }; + static const GInterfaceInfo gee_iterable_info = { (GInterfaceInitFunc) gee_abstract_collection_gee_iterable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + static const GInterfaceInfo gee_collection_info = { (GInterfaceInitFunc) gee_abstract_collection_gee_collection_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_abstract_collection_type_id; + gee_abstract_collection_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeAbstractCollection", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_type_add_interface_static (gee_abstract_collection_type_id, GEE_TYPE_ITERABLE, &gee_iterable_info); + g_type_add_interface_static (gee_abstract_collection_type_id, GEE_TYPE_COLLECTION, &gee_collection_info); + g_once_init_leave (&gee_abstract_collection_type_id__volatile, gee_abstract_collection_type_id); + } + return gee_abstract_collection_type_id__volatile; +} + + +static void _vala_gee_abstract_collection_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeAbstractCollection * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection); + switch (property_id) { + case GEE_ABSTRACT_COLLECTION_IS_EMPTY: + g_value_set_boolean (value, gee_abstract_collection_get_is_empty (self)); + break; + case GEE_ABSTRACT_COLLECTION_ELEMENT_TYPE: + g_value_set_gtype (value, gee_iterable_get_element_type ((GeeIterable*) self)); + break; + case GEE_ABSTRACT_COLLECTION_READ_ONLY_VIEW: + g_value_take_object (value, gee_abstract_collection_get_read_only_view (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_abstract_collection_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeAbstractCollection * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection); + switch (property_id) { + case GEE_ABSTRACT_COLLECTION_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_ABSTRACT_COLLECTION_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_ABSTRACT_COLLECTION_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + + diff --git a/gee/abstractcollection.vala b/gee/abstractcollection.vala new file mode 100644 index 0000000..9ba4a25 --- /dev/null +++ b/gee/abstractcollection.vala @@ -0,0 +1,298 @@ +/* abstractcollection.vala + * + * Copyright (C) 2007 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + */ + +/** + * Skeletal implementation of the {@link Collection} interface. + * + * Contains common code shared by all collection implementations. + * + * @see AbstractList + * @see AbstractSet + * @see AbstractMultiSet + */ +public abstract class Gee.AbstractCollection : Object, Iterable, Collection { + + /** + * {@inheritDoc} + */ + public abstract int size { get; } + + /** + * {@inheritDoc} + */ + public virtual bool is_empty { + get { return size == 0; } + } + + /** + * {@inheritDoc} + */ + public abstract bool contains (G item); + + /** + * {@inheritDoc} + */ + public abstract bool add (G item); + + /** + * {@inheritDoc} + */ + public abstract bool remove (G item); + + /** + * {@inheritDoc} + */ + public abstract void clear (); + + /** + * {@inheritDoc} + */ + public virtual G[] to_array () { + var t = typeof (G); + if (t == typeof (bool)) { + return (G[]) to_bool_array((Collection) this); + } else if (t == typeof (char)) { + return (G[]) to_char_array((Collection) this); + } else if (t == typeof (uchar)) { + return (G[]) to_uchar_array((Collection) this); + } else if (t == typeof (int)) { + return (G[]) to_int_array((Collection) this); + } else if (t == typeof (uint)) { + return (G[]) to_uint_array((Collection) this); + } else if (t == typeof (int64)) { + return (G[]) to_int64_array((Collection) this); + } else if (t == typeof (uint64)) { + return (G[]) to_uint64_array((Collection) this); + } else if (t == typeof (long)) { + return (G[]) to_long_array((Collection) this); + } else if (t == typeof (ulong)) { + return (G[]) to_ulong_array((Collection) this); + } else if (t == typeof (float)) { + return (G[]) to_float_array((Collection) this); + } else if (t == typeof (double)) { + return (G[]) to_double_array((Collection) this); + } else { + G[] array = new G[size]; + int index = 0; + foreach (G element in this) { + array[index++] = element; + } + return array; + } + } + + private static bool[] to_bool_array(Collection coll) { + bool[] array = new bool[coll.size]; + int index = 0; + foreach (bool element in coll) { + array[index++] = element; + } + return array; + } + + private static char[] to_char_array(Collection coll) { + char[] array = new char[coll.size]; + int index = 0; + foreach (char element in coll) { + array[index++] = element; + } + return array; + } + + private static uchar[] to_uchar_array(Collection coll) { + uchar[] array = new uchar[coll.size]; + int index = 0; + foreach (uchar element in coll) { + array[index++] = element; + } + return array; + } + + private static int[] to_int_array(Collection coll) { + int[] array = new int[coll.size]; + int index = 0; + foreach (int element in coll) { + array[index++] = element; + } + return array; + } + + private static uint[] to_uint_array(Collection coll) { + uint[] array = new uint[coll.size]; + int index = 0; + foreach (uint element in coll) { + array[index++] = element; + } + return array; + } + + private static int64[] to_int64_array(Collection coll) { + int64[] array = new int64[coll.size]; + int index = 0; + foreach (int64 element in coll) { + array[index++] = element; + } + return array; + } + + private static uint64[] to_uint64_array(Collection coll) { + uint64[] array = new uint64[coll.size]; + int index = 0; + foreach (uint64 element in coll) { + array[index++] = element; + } + return array; + } + + private static long[] to_long_array(Collection coll) { + long[] array = new long[coll.size]; + int index = 0; + foreach (long element in coll) { + array[index++] = element; + } + return array; + } + + private static ulong[] to_ulong_array(Collection coll) { + ulong[] array = new ulong[coll.size]; + int index = 0; + foreach (ulong element in coll) { + array[index++] = element; + } + return array; + } + +#if VALA_0_16 + private static float?[] to_float_array(Collection coll) { + float?[] array = new float?[coll.size]; +#else + private static float[] to_float_array(Collection coll) { + float[] array = new float[coll.size]; +#endif + int index = 0; + foreach (float element in coll) { + array[index++] = element; + } + return array; + } + +#if VALA_0_16 + private static double?[] to_double_array(Collection coll) { + double?[] array = new double?[coll.size]; +#else + private static double[] to_double_array(Collection coll) { + double[] array = new double[coll.size]; +#endif + int index = 0; + foreach (double element in coll) { + array[index++] = element; + } + return array; + } + + /** + * {@inheritDoc} + */ + public virtual bool add_all (Collection collection) { + if (collection.is_empty) { + return false; + } + + bool changed = false; + foreach (G item in collection) { + changed = changed | add (item); + } + return changed; + } + + /** + * {@inheritDoc} + */ + public virtual bool contains_all (Collection collection) { + if (collection.size > size) { + return false; + } + + foreach (G item in collection) { + if (!contains (item)) { + return false; + } + } + return true; + } + + /** + * {@inheritDoc} + */ + public virtual bool remove_all (Collection collection) { + bool changed = false; + foreach (G item in collection) { + changed = changed | remove (item); + } + return changed; + } + + /** + * {@inheritDoc} + */ + public virtual bool retain_all (Collection collection) { + bool changed = false; + G[] items = to_array (); + int size_of_items = size; + for (int index = 0; index < size_of_items; index++) { + if (!collection.contains (items[index])) { + changed = changed | remove (items[index]); + } + } + return changed; + } + + /** + * {@inheritDoc} + */ + public Type element_type { + get { return typeof (G); } + } + + /** + * {@inheritDoc} + */ + public abstract Iterator iterator (); + + private weak Collection _read_only_view; + + /** + * {@inheritDoc} + */ + public virtual Collection read_only_view { + owned get { + Collection instance = _read_only_view; + if (_read_only_view == null) { + instance = new ReadOnlyCollection (this); + _read_only_view = instance; + instance.add_weak_pointer ((void**) (&_read_only_view)); + } + return instance; + } + } +} diff --git a/gee/abstractlist.c b/gee/abstractlist.c new file mode 100644 index 0000000..304082e --- /dev/null +++ b/gee/abstractlist.c @@ -0,0 +1,665 @@ +/* abstractlist.c generated by valac 0.18.0, the Vala compiler + * generated from abstractlist.vala, do not modify */ + +/* abstractlist.vala + * + * Copyright (C) 2007 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; +typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate; + +#define GEE_TYPE_LIST (gee_list_get_type ()) +#define GEE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST, GeeList)) +#define GEE_IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST)) +#define GEE_LIST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST, GeeListIface)) + +typedef struct _GeeList GeeList; +typedef struct _GeeListIface GeeListIface; + +#define GEE_TYPE_BIDIR_ITERATOR (gee_bidir_iterator_get_type ()) +#define GEE_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIterator)) +#define GEE_IS_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_ITERATOR)) +#define GEE_BIDIR_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIteratorIface)) + +typedef struct _GeeBidirIterator GeeBidirIterator; +typedef struct _GeeBidirIteratorIface GeeBidirIteratorIface; + +#define GEE_TYPE_LIST_ITERATOR (gee_list_iterator_get_type ()) +#define GEE_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIterator)) +#define GEE_IS_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST_ITERATOR)) +#define GEE_LIST_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIteratorIface)) + +typedef struct _GeeListIterator GeeListIterator; +typedef struct _GeeListIteratorIface GeeListIteratorIface; + +#define GEE_TYPE_ABSTRACT_LIST (gee_abstract_list_get_type ()) +#define GEE_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractList)) +#define GEE_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass)) +#define GEE_IS_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_LIST)) +#define GEE_IS_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_LIST)) +#define GEE_ABSTRACT_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass)) + +typedef struct _GeeAbstractList GeeAbstractList; +typedef struct _GeeAbstractListClass GeeAbstractListClass; +typedef struct _GeeAbstractListPrivate GeeAbstractListPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define GEE_TYPE_READ_ONLY_COLLECTION (gee_read_only_collection_get_type ()) +#define GEE_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollection)) +#define GEE_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass)) +#define GEE_IS_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_READ_ONLY_COLLECTION)) +#define GEE_IS_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_READ_ONLY_COLLECTION)) +#define GEE_READ_ONLY_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass)) + +typedef struct _GeeReadOnlyCollection GeeReadOnlyCollection; +typedef struct _GeeReadOnlyCollectionClass GeeReadOnlyCollectionClass; + +#define GEE_TYPE_READ_ONLY_LIST (gee_read_only_list_get_type ()) +#define GEE_READ_ONLY_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_READ_ONLY_LIST, GeeReadOnlyList)) +#define GEE_READ_ONLY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_READ_ONLY_LIST, GeeReadOnlyListClass)) +#define GEE_IS_READ_ONLY_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_READ_ONLY_LIST)) +#define GEE_IS_READ_ONLY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_READ_ONLY_LIST)) +#define GEE_READ_ONLY_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_READ_ONLY_LIST, GeeReadOnlyListClass)) + +typedef struct _GeeReadOnlyList GeeReadOnlyList; +typedef struct _GeeReadOnlyListClass GeeReadOnlyListClass; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeAbstractCollection { + GObject parent_instance; + GeeAbstractCollectionPrivate * priv; +}; + +struct _GeeAbstractCollectionClass { + GObjectClass parent_class; + gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*add) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item); + void (*clear) (GeeAbstractCollection* self); + gpointer* (*to_array) (GeeAbstractCollection* self, int* result_length1); + gboolean (*add_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeAbstractCollection* self, GeeCollection* collection); + GeeIterator* (*iterator) (GeeAbstractCollection* self); + gint (*get_size) (GeeAbstractCollection* self); + gboolean (*get_is_empty) (GeeAbstractCollection* self); + GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self); +}; + +struct _GeeBidirIteratorIface { + GTypeInterface parent_iface; + gboolean (*previous) (GeeBidirIterator* self); + gboolean (*has_previous) (GeeBidirIterator* self); + gboolean (*last) (GeeBidirIterator* self); +}; + +struct _GeeListIteratorIface { + GTypeInterface parent_iface; + void (*set) (GeeListIterator* self, gconstpointer item); + void (*insert) (GeeListIterator* self, gconstpointer item); + void (*add) (GeeListIterator* self, gconstpointer item); + gint (*index) (GeeListIterator* self); +}; + +struct _GeeListIface { + GTypeInterface parent_iface; + GeeListIterator* (*list_iterator) (GeeList* self); + gpointer (*get) (GeeList* self, gint index); + void (*set) (GeeList* self, gint index, gconstpointer item); + gint (*index_of) (GeeList* self, gconstpointer item); + void (*insert) (GeeList* self, gint index, gconstpointer item); + gpointer (*remove_at) (GeeList* self, gint index); + GeeList* (*slice) (GeeList* self, gint start, gint stop); + gpointer (*first) (GeeList* self); + gpointer (*last) (GeeList* self); + void (*insert_all) (GeeList* self, gint index, GeeCollection* collection); + void (*sort) (GeeList* self, GCompareFunc compare_func); + GeeList* (*get_read_only_view) (GeeList* self); +}; + +struct _GeeAbstractList { + GeeAbstractCollection parent_instance; + GeeAbstractListPrivate * priv; +}; + +struct _GeeAbstractListClass { + GeeAbstractCollectionClass parent_class; + GeeListIterator* (*list_iterator) (GeeAbstractList* self); + gpointer (*get) (GeeAbstractList* self, gint index); + void (*set) (GeeAbstractList* self, gint index, gconstpointer item); + gint (*index_of) (GeeAbstractList* self, gconstpointer item); + void (*insert) (GeeAbstractList* self, gint index, gconstpointer item); + gpointer (*remove_at) (GeeAbstractList* self, gint index); + GeeList* (*slice) (GeeAbstractList* self, gint start, gint stop); + gpointer (*first) (GeeAbstractList* self); + gpointer (*last) (GeeAbstractList* self); + void (*insert_all) (GeeAbstractList* self, gint index, GeeCollection* collection); + GeeList* (*get_read_only_view) (GeeAbstractList* self); +}; + +struct _GeeAbstractListPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GeeList* _read_only_view; +}; + + +static gpointer gee_abstract_list_parent_class = NULL; +static GeeListIface* gee_abstract_list_gee_list_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_bidir_iterator_get_type (void) G_GNUC_CONST; +GType gee_list_iterator_get_type (void) G_GNUC_CONST; +GType gee_list_get_type (void) G_GNUC_CONST; +GType gee_abstract_list_get_type (void) G_GNUC_CONST; +#define GEE_ABSTRACT_LIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListPrivate)) +enum { + GEE_ABSTRACT_LIST_DUMMY_PROPERTY, + GEE_ABSTRACT_LIST_G_TYPE, + GEE_ABSTRACT_LIST_G_DUP_FUNC, + GEE_ABSTRACT_LIST_G_DESTROY_FUNC, + GEE_ABSTRACT_LIST_READ_ONLY_VIEW +}; +GeeListIterator* gee_abstract_list_list_iterator (GeeAbstractList* self); +static GeeListIterator* gee_abstract_list_real_list_iterator (GeeAbstractList* self); +gpointer gee_abstract_list_get (GeeAbstractList* self, gint index); +static gpointer gee_abstract_list_real_get (GeeAbstractList* self, gint index); +void gee_abstract_list_set (GeeAbstractList* self, gint index, gconstpointer item); +static void gee_abstract_list_real_set (GeeAbstractList* self, gint index, gconstpointer item); +gint gee_abstract_list_index_of (GeeAbstractList* self, gconstpointer item); +static gint gee_abstract_list_real_index_of (GeeAbstractList* self, gconstpointer item); +void gee_abstract_list_insert (GeeAbstractList* self, gint index, gconstpointer item); +static void gee_abstract_list_real_insert (GeeAbstractList* self, gint index, gconstpointer item); +gpointer gee_abstract_list_remove_at (GeeAbstractList* self, gint index); +static gpointer gee_abstract_list_real_remove_at (GeeAbstractList* self, gint index); +GeeList* gee_abstract_list_slice (GeeAbstractList* self, gint start, gint stop); +static GeeList* gee_abstract_list_real_slice (GeeAbstractList* self, gint start, gint stop); +gpointer gee_abstract_list_first (GeeAbstractList* self); +static gpointer gee_abstract_list_real_first (GeeAbstractList* self); +gpointer gee_abstract_list_last (GeeAbstractList* self); +static gpointer gee_abstract_list_real_last (GeeAbstractList* self); +gint gee_collection_get_size (GeeCollection* self); +void gee_abstract_list_insert_all (GeeAbstractList* self, gint index, GeeCollection* collection); +static void gee_abstract_list_real_insert_all (GeeAbstractList* self, gint index, GeeCollection* collection); +GeeIterator* gee_iterable_iterator (GeeIterable* self); +gboolean gee_iterator_next (GeeIterator* self); +gpointer gee_iterator_get (GeeIterator* self); +static void gee_abstract_list_real_sort (GeeList* base, GCompareFunc compare); +GCompareFunc gee_functions_get_compare_func_for (GType t); +void gee_tim_sort_sort (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareFunc compare); +GeeAbstractList* gee_abstract_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeAbstractCollection* gee_abstract_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeList* gee_abstract_list_get_read_only_view (GeeAbstractList* self); +GeeReadOnlyList* gee_read_only_list_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list); +GeeReadOnlyList* gee_read_only_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list); +GType gee_read_only_collection_get_type (void) G_GNUC_CONST; +GType gee_read_only_list_get_type (void) G_GNUC_CONST; +static void gee_abstract_list_finalize (GObject* obj); +static void _vala_gee_abstract_list_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_abstract_list_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +/** + * {@inheritDoc} + */ +static GeeListIterator* gee_abstract_list_real_list_iterator (GeeAbstractList* self) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_list_list_iterator'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return NULL; +} + + +GeeListIterator* gee_abstract_list_list_iterator (GeeAbstractList* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_LIST_GET_CLASS (self)->list_iterator (self); +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_abstract_list_real_get (GeeAbstractList* self, gint index) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_list_get'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return NULL; +} + + +gpointer gee_abstract_list_get (GeeAbstractList* self, gint index) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_LIST_GET_CLASS (self)->get (self, index); +} + + +/** + * {@inheritDoc} + */ +static void gee_abstract_list_real_set (GeeAbstractList* self, gint index, gconstpointer item) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_list_set'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return; +} + + +void gee_abstract_list_set (GeeAbstractList* self, gint index, gconstpointer item) { + g_return_if_fail (self != NULL); + GEE_ABSTRACT_LIST_GET_CLASS (self)->set (self, index, item); +} + + +/** + * {@inheritDoc} + */ +static gint gee_abstract_list_real_index_of (GeeAbstractList* self, gconstpointer item) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_list_index_of'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return 0; +} + + +gint gee_abstract_list_index_of (GeeAbstractList* self, gconstpointer item) { + g_return_val_if_fail (self != NULL, 0); + return GEE_ABSTRACT_LIST_GET_CLASS (self)->index_of (self, item); +} + + +/** + * {@inheritDoc} + */ +static void gee_abstract_list_real_insert (GeeAbstractList* self, gint index, gconstpointer item) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_list_insert'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return; +} + + +void gee_abstract_list_insert (GeeAbstractList* self, gint index, gconstpointer item) { + g_return_if_fail (self != NULL); + GEE_ABSTRACT_LIST_GET_CLASS (self)->insert (self, index, item); +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_abstract_list_real_remove_at (GeeAbstractList* self, gint index) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_list_remove_at'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return NULL; +} + + +gpointer gee_abstract_list_remove_at (GeeAbstractList* self, gint index) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_LIST_GET_CLASS (self)->remove_at (self, index); +} + + +/** + * {@inheritDoc} + */ +static GeeList* gee_abstract_list_real_slice (GeeAbstractList* self, gint start, gint stop) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_list_slice'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return NULL; +} + + +GeeList* gee_abstract_list_slice (GeeAbstractList* self, gint start, gint stop) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_LIST_GET_CLASS (self)->slice (self, start, stop); +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_abstract_list_real_first (GeeAbstractList* self) { + gpointer result = NULL; + gpointer _tmp0_ = NULL; + _tmp0_ = gee_abstract_list_get (self, 0); + result = _tmp0_; + return result; +} + + +gpointer gee_abstract_list_first (GeeAbstractList* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_LIST_GET_CLASS (self)->first (self); +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_abstract_list_real_last (GeeAbstractList* self) { + gpointer result = NULL; + gint _tmp0_; + gint _tmp1_; + gpointer _tmp2_ = NULL; + _tmp0_ = gee_collection_get_size ((GeeCollection*) self); + _tmp1_ = _tmp0_; + _tmp2_ = gee_abstract_list_get (self, _tmp1_ - 1); + result = _tmp2_; + return result; +} + + +gpointer gee_abstract_list_last (GeeAbstractList* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_LIST_GET_CLASS (self)->last (self); +} + + +/** + * {@inheritDoc} + */ +static void gee_abstract_list_real_insert_all (GeeAbstractList* self, gint index, GeeCollection* collection) { + g_return_if_fail (collection != NULL); + { + GeeCollection* _tmp0_; + GeeIterator* _tmp1_ = NULL; + GeeIterator* _item_it; + _tmp0_ = collection; + _tmp1_ = gee_iterable_iterator ((GeeIterable*) _tmp0_); + _item_it = _tmp1_; + while (TRUE) { + GeeIterator* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeIterator* _tmp4_; + gpointer _tmp5_ = NULL; + gpointer item; + gint _tmp6_; + gconstpointer _tmp7_; + gint _tmp8_; + _tmp2_ = _item_it; + _tmp3_ = gee_iterator_next (_tmp2_); + if (!_tmp3_) { + break; + } + _tmp4_ = _item_it; + _tmp5_ = gee_iterator_get (_tmp4_); + item = _tmp5_; + _tmp6_ = index; + _tmp7_ = item; + gee_abstract_list_insert (self, _tmp6_, _tmp7_); + _tmp8_ = index; + index = _tmp8_ + 1; + ((item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (item = (self->priv->g_destroy_func (item), NULL)); + } + _g_object_unref0 (_item_it); + } +} + + +void gee_abstract_list_insert_all (GeeAbstractList* self, gint index, GeeCollection* collection) { + g_return_if_fail (self != NULL); + GEE_ABSTRACT_LIST_GET_CLASS (self)->insert_all (self, index, collection); +} + + +/** + * {@inheritDoc} + */ +static void gee_abstract_list_real_sort (GeeList* base, GCompareFunc compare) { + GeeAbstractList * self; + GCompareFunc _tmp0_; + GCompareFunc _tmp2_; + self = (GeeAbstractList*) base; + _tmp0_ = compare; + if (_tmp0_ == NULL) { + GCompareFunc _tmp1_ = NULL; + _tmp1_ = gee_functions_get_compare_func_for (self->priv->g_type); + compare = _tmp1_; + } + _tmp2_ = compare; + gee_tim_sort_sort (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, (GeeList*) self, _tmp2_); +} + + +GeeAbstractList* gee_abstract_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) { + GeeAbstractList * self = NULL; + self = (GeeAbstractList*) gee_abstract_collection_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + return self; +} + + +GeeList* gee_abstract_list_get_read_only_view (GeeAbstractList* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_LIST_GET_CLASS (self)->get_read_only_view (self); +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static GeeList* gee_abstract_list_real_get_read_only_view (GeeAbstractList* base) { + GeeList* result; + GeeAbstractList* self; + GeeList* _tmp0_; + GeeList* _tmp1_; + GeeList* instance; + GeeList* _tmp2_; + self = base; + _tmp0_ = self->priv->_read_only_view; + _tmp1_ = _g_object_ref0 (_tmp0_); + instance = _tmp1_; + _tmp2_ = self->priv->_read_only_view; + if (_tmp2_ == NULL) { + GeeReadOnlyList* _tmp3_; + GeeList* _tmp4_; + GeeList* _tmp5_; + _tmp3_ = gee_read_only_list_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, (GeeList*) self); + _g_object_unref0 (instance); + instance = (GeeList*) _tmp3_; + _tmp4_ = instance; + self->priv->_read_only_view = _tmp4_; + _tmp5_ = instance; + g_object_add_weak_pointer ((GObject*) _tmp5_, (void**) (&self->priv->_read_only_view)); + } + result = instance; + return result; +} + + +static void gee_abstract_list_class_init (GeeAbstractListClass * klass) { + gee_abstract_list_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeAbstractListPrivate)); + GEE_ABSTRACT_LIST_CLASS (klass)->list_iterator = gee_abstract_list_real_list_iterator; + GEE_ABSTRACT_LIST_CLASS (klass)->get = gee_abstract_list_real_get; + GEE_ABSTRACT_LIST_CLASS (klass)->set = gee_abstract_list_real_set; + GEE_ABSTRACT_LIST_CLASS (klass)->index_of = gee_abstract_list_real_index_of; + GEE_ABSTRACT_LIST_CLASS (klass)->insert = gee_abstract_list_real_insert; + GEE_ABSTRACT_LIST_CLASS (klass)->remove_at = gee_abstract_list_real_remove_at; + GEE_ABSTRACT_LIST_CLASS (klass)->slice = gee_abstract_list_real_slice; + GEE_ABSTRACT_LIST_CLASS (klass)->first = gee_abstract_list_real_first; + GEE_ABSTRACT_LIST_CLASS (klass)->last = gee_abstract_list_real_last; + GEE_ABSTRACT_LIST_CLASS (klass)->insert_all = gee_abstract_list_real_insert_all; + GEE_ABSTRACT_LIST_CLASS (klass)->get_read_only_view = gee_abstract_list_real_get_read_only_view; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_abstract_list_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_abstract_list_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_abstract_list_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_LIST_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_LIST_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_LIST_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_LIST_READ_ONLY_VIEW, g_param_spec_object ("read-only-view", "read-only-view", "read-only-view", GEE_TYPE_LIST, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_abstract_list_gee_list_interface_init (GeeListIface * iface) { + gee_abstract_list_gee_list_parent_iface = g_type_interface_peek_parent (iface); + iface->list_iterator = (GeeListIterator* (*)(GeeList*)) gee_abstract_list_list_iterator; + iface->get = (gpointer (*)(GeeList*, gint)) gee_abstract_list_get; + iface->set = (void (*)(GeeList*, gint, gconstpointer)) gee_abstract_list_set; + iface->index_of = (gint (*)(GeeList*, gconstpointer)) gee_abstract_list_index_of; + iface->insert = (void (*)(GeeList*, gint, gconstpointer)) gee_abstract_list_insert; + iface->remove_at = (gpointer (*)(GeeList*, gint)) gee_abstract_list_remove_at; + iface->slice = (GeeList* (*)(GeeList*, gint, gint)) gee_abstract_list_slice; + iface->first = (gpointer (*)(GeeList*)) gee_abstract_list_first; + iface->last = (gpointer (*)(GeeList*)) gee_abstract_list_last; + iface->insert_all = (void (*)(GeeList*, gint, GeeCollection*)) gee_abstract_list_insert_all; + iface->sort = (void (*)(GeeList*, GCompareFunc)) gee_abstract_list_real_sort; + iface->get_read_only_view = (GeeList* (*) (GeeList *)) gee_abstract_list_get_read_only_view; +} + + +static void gee_abstract_list_instance_init (GeeAbstractList * self) { + self->priv = GEE_ABSTRACT_LIST_GET_PRIVATE (self); +} + + +static void gee_abstract_list_finalize (GObject* obj) { + GeeAbstractList * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_ABSTRACT_LIST, GeeAbstractList); + G_OBJECT_CLASS (gee_abstract_list_parent_class)->finalize (obj); +} + + +/** + * Skeletal implementation of the {@link List} interface. + * + * Contains common code shared by all list implementations. + * + * @see ArrayList + * @see LinkedList + */ +GType gee_abstract_list_get_type (void) { + static volatile gsize gee_abstract_list_type_id__volatile = 0; + if (g_once_init_enter (&gee_abstract_list_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeAbstractListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_abstract_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeAbstractList), 0, (GInstanceInitFunc) gee_abstract_list_instance_init, NULL }; + static const GInterfaceInfo gee_list_info = { (GInterfaceInitFunc) gee_abstract_list_gee_list_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_abstract_list_type_id; + gee_abstract_list_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_COLLECTION, "GeeAbstractList", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_type_add_interface_static (gee_abstract_list_type_id, GEE_TYPE_LIST, &gee_list_info); + g_once_init_leave (&gee_abstract_list_type_id__volatile, gee_abstract_list_type_id); + } + return gee_abstract_list_type_id__volatile; +} + + +static void _vala_gee_abstract_list_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeAbstractList * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ABSTRACT_LIST, GeeAbstractList); + switch (property_id) { + case GEE_ABSTRACT_LIST_READ_ONLY_VIEW: + g_value_take_object (value, gee_abstract_list_get_read_only_view (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_abstract_list_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeAbstractList * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ABSTRACT_LIST, GeeAbstractList); + switch (property_id) { + case GEE_ABSTRACT_LIST_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_ABSTRACT_LIST_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_ABSTRACT_LIST_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/gee/abstractlist.vala b/gee/abstractlist.vala new file mode 100644 index 0000000..65c82b7 --- /dev/null +++ b/gee/abstractlist.vala @@ -0,0 +1,119 @@ +/* abstractlist.vala + * + * Copyright (C) 2007 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + */ + +/** + * Skeletal implementation of the {@link List} interface. + * + * Contains common code shared by all list implementations. + * + * @see ArrayList + * @see LinkedList + */ +public abstract class Gee.AbstractList : Gee.AbstractCollection, List { + + /** + * {@inheritDoc} + */ + public abstract ListIterator list_iterator (); + + /** + * {@inheritDoc} + */ + public abstract new G? get (int index); + + /** + * {@inheritDoc} + */ + public abstract new void set (int index, G item); + + /** + * {@inheritDoc} + */ + public abstract int index_of (G item); + + /** + * {@inheritDoc} + */ + public abstract void insert (int index, G item); + + /** + * {@inheritDoc} + */ + public abstract G remove_at (int index); + + /** + * {@inheritDoc} + */ + public abstract List? slice (int start, int stop); + + /** + * {@inheritDoc} + */ + public virtual G first () { + return get (0); + } + + /** + * {@inheritDoc} + */ + public virtual G last () { + return get (size - 1); + } + + /** + * {@inheritDoc} + */ + public virtual void insert_all (int index, Collection collection) { + foreach (G item in collection) { + insert(index, item); + index++; + } + } + + /** + * {@inheritDoc} + */ + public void sort (CompareFunc? compare = null) { + if (compare == null) { + compare = Functions.get_compare_func_for (typeof (G)); + } + TimSort.sort (this, compare); + } + + private weak List _read_only_view; + + /** + * {@inheritDoc} + */ + public virtual new List read_only_view { + owned get { + List instance = _read_only_view; + if (_read_only_view == null) { + instance = new ReadOnlyList (this); + _read_only_view = instance; + instance.add_weak_pointer ((void**) (&_read_only_view)); + } + return instance; + } + } +} diff --git a/gee/abstractmap.c b/gee/abstractmap.c new file mode 100644 index 0000000..98b45fc --- /dev/null +++ b/gee/abstractmap.c @@ -0,0 +1,1020 @@ +/* abstractmap.c generated by valac 0.18.0, the Vala compiler + * generated from abstractmap.vala, do not modify */ + +/* abstractmap.vala + * + * Copyright (C) 2007 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Tomaž Vajngerl + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_MAP (gee_map_get_type ()) +#define GEE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP, GeeMap)) +#define GEE_IS_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP)) +#define GEE_MAP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP, GeeMapIface)) + +typedef struct _GeeMap GeeMap; +typedef struct _GeeMapIface GeeMapIface; + +#define GEE_TYPE_MAP_ITERATOR (gee_map_iterator_get_type ()) +#define GEE_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIterator)) +#define GEE_IS_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP_ITERATOR)) +#define GEE_MAP_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIteratorIface)) + +typedef struct _GeeMapIterator GeeMapIterator; +typedef struct _GeeMapIteratorIface GeeMapIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_MAP_TYPE_ENTRY (gee_map_entry_get_type ()) +#define GEE_MAP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntry)) +#define GEE_MAP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) +#define GEE_MAP_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) + +typedef struct _GeeMapEntry GeeMapEntry; +typedef struct _GeeMapEntryClass GeeMapEntryClass; + +#define GEE_TYPE_ABSTRACT_MAP (gee_abstract_map_get_type ()) +#define GEE_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap)) +#define GEE_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) +#define GEE_IS_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_IS_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_ABSTRACT_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) + +typedef struct _GeeAbstractMap GeeAbstractMap; +typedef struct _GeeAbstractMapClass GeeAbstractMapClass; +typedef struct _GeeAbstractMapPrivate GeeAbstractMapPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define GEE_TYPE_READ_ONLY_MAP (gee_read_only_map_get_type ()) +#define GEE_READ_ONLY_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_READ_ONLY_MAP, GeeReadOnlyMap)) +#define GEE_READ_ONLY_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_READ_ONLY_MAP, GeeReadOnlyMapClass)) +#define GEE_IS_READ_ONLY_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_READ_ONLY_MAP)) +#define GEE_IS_READ_ONLY_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_READ_ONLY_MAP)) +#define GEE_READ_ONLY_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_READ_ONLY_MAP, GeeReadOnlyMapClass)) + +typedef struct _GeeReadOnlyMap GeeReadOnlyMap; +typedef struct _GeeReadOnlyMapClass GeeReadOnlyMapClass; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeMapIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeMapIterator* self); + gboolean (*has_next) (GeeMapIterator* self); + gboolean (*first) (GeeMapIterator* self); + gpointer (*get_key) (GeeMapIterator* self); + gpointer (*get_value) (GeeMapIterator* self); + void (*set_value) (GeeMapIterator* self, gconstpointer value); + void (*unset) (GeeMapIterator* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeMapIface { + GTypeInterface parent_iface; + gboolean (*has_key) (GeeMap* self, gconstpointer key); + gboolean (*contains) (GeeMap* self, gconstpointer key); + gboolean (*has) (GeeMap* self, gconstpointer key, gconstpointer value); + gpointer (*get) (GeeMap* self, gconstpointer key); + void (*set) (GeeMap* self, gconstpointer key, gconstpointer value); + gboolean (*unset) (GeeMap* self, gconstpointer key, gpointer* value); + gboolean (*remove) (GeeMap* self, gconstpointer key, gpointer* value); + void (*clear) (GeeMap* self); + GeeMapIterator* (*map_iterator) (GeeMap* self); + void (*set_all) (GeeMap* self, GeeMap* map); + gboolean (*unset_all) (GeeMap* self, GeeMap* map); + gboolean (*remove_all) (GeeMap* self, GeeMap* map); + gboolean (*has_all) (GeeMap* self, GeeMap* map); + gboolean (*contains_all) (GeeMap* self, GeeMap* map); + gint (*get_size) (GeeMap* self); + gboolean (*get_is_empty) (GeeMap* self); + GeeSet* (*get_keys) (GeeMap* self); + GeeCollection* (*get_values) (GeeMap* self); + GeeSet* (*get_entries) (GeeMap* self); + GeeMap* (*get_read_only_view) (GeeMap* self); + GType (*get_key_type) (GeeMap* self); + GType (*get_value_type) (GeeMap* self); +}; + +struct _GeeAbstractMap { + GObject parent_instance; + GeeAbstractMapPrivate * priv; +}; + +struct _GeeAbstractMapClass { + GObjectClass parent_class; + gboolean (*has_key) (GeeAbstractMap* self, gconstpointer key); + gboolean (*has) (GeeAbstractMap* self, gconstpointer key, gconstpointer value); + gpointer (*get) (GeeAbstractMap* self, gconstpointer key); + void (*set) (GeeAbstractMap* self, gconstpointer key, gconstpointer value); + gboolean (*unset) (GeeAbstractMap* self, gconstpointer key, gpointer* value); + GeeMapIterator* (*map_iterator) (GeeAbstractMap* self); + void (*clear) (GeeAbstractMap* self); + void (*set_all) (GeeAbstractMap* self, GeeMap* map); + gboolean (*unset_all) (GeeAbstractMap* self, GeeMap* map); + gboolean (*has_all) (GeeAbstractMap* self, GeeMap* map); + gint (*get_size) (GeeAbstractMap* self); + gboolean (*get_is_empty) (GeeAbstractMap* self); + GeeSet* (*get_keys) (GeeAbstractMap* self); + GeeCollection* (*get_values) (GeeAbstractMap* self); + GeeSet* (*get_entries) (GeeAbstractMap* self); + GeeMap* (*get_read_only_view) (GeeAbstractMap* self); +}; + +struct _GeeAbstractMapPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + GeeMap* _read_only_view; +}; + + +static gpointer gee_abstract_map_parent_class = NULL; +static GeeIterableIface* gee_abstract_map_gee_iterable_parent_iface = NULL; +static GeeMapIface* gee_abstract_map_gee_map_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_map_iterator_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_map_entry_get_type (void) G_GNUC_CONST; +GType gee_map_get_type (void) G_GNUC_CONST; +GType gee_abstract_map_get_type (void) G_GNUC_CONST; +#define GEE_ABSTRACT_MAP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapPrivate)) +enum { + GEE_ABSTRACT_MAP_DUMMY_PROPERTY, + GEE_ABSTRACT_MAP_K_TYPE, + GEE_ABSTRACT_MAP_K_DUP_FUNC, + GEE_ABSTRACT_MAP_K_DESTROY_FUNC, + GEE_ABSTRACT_MAP_V_TYPE, + GEE_ABSTRACT_MAP_V_DUP_FUNC, + GEE_ABSTRACT_MAP_V_DESTROY_FUNC, + GEE_ABSTRACT_MAP_SIZE, + GEE_ABSTRACT_MAP_IS_EMPTY, + GEE_ABSTRACT_MAP_KEYS, + GEE_ABSTRACT_MAP_VALUES, + GEE_ABSTRACT_MAP_ENTRIES, + GEE_ABSTRACT_MAP_READ_ONLY_VIEW, + GEE_ABSTRACT_MAP_KEY_TYPE, + GEE_ABSTRACT_MAP_VALUE_TYPE, + GEE_ABSTRACT_MAP_ELEMENT_TYPE +}; +gboolean gee_abstract_map_has_key (GeeAbstractMap* self, gconstpointer key); +static gboolean gee_abstract_map_real_has_key (GeeAbstractMap* self, gconstpointer key); +static gboolean gee_abstract_map_real_contains (GeeMap* base, gconstpointer key); +gboolean gee_abstract_map_has (GeeAbstractMap* self, gconstpointer key, gconstpointer value); +static gboolean gee_abstract_map_real_has (GeeAbstractMap* self, gconstpointer key, gconstpointer value); +gpointer gee_abstract_map_get (GeeAbstractMap* self, gconstpointer key); +static gpointer gee_abstract_map_real_get (GeeAbstractMap* self, gconstpointer key); +void gee_abstract_map_set (GeeAbstractMap* self, gconstpointer key, gconstpointer value); +static void gee_abstract_map_real_set (GeeAbstractMap* self, gconstpointer key, gconstpointer value); +gboolean gee_abstract_map_unset (GeeAbstractMap* self, gconstpointer key, gpointer* value); +static gboolean gee_abstract_map_real_unset (GeeAbstractMap* self, gconstpointer key, gpointer* value); +GeeMapIterator* gee_abstract_map_map_iterator (GeeAbstractMap* self); +static GeeMapIterator* gee_abstract_map_real_map_iterator (GeeAbstractMap* self); +static gboolean gee_abstract_map_real_remove (GeeMap* base, gconstpointer key, gpointer* value); +void gee_abstract_map_clear (GeeAbstractMap* self); +static void gee_abstract_map_real_clear (GeeAbstractMap* self); +void gee_abstract_map_set_all (GeeAbstractMap* self, GeeMap* map); +static void gee_abstract_map_real_set_all (GeeAbstractMap* self, GeeMap* map); +GeeSet* gee_map_get_entries (GeeMap* self); +GeeIterator* gee_iterable_iterator (GeeIterable* self); +gboolean gee_iterator_next (GeeIterator* self); +gpointer gee_iterator_get (GeeIterator* self); +gconstpointer gee_map_entry_get_key (GeeMapEntry* self); +gconstpointer gee_map_entry_get_value (GeeMapEntry* self); +gboolean gee_abstract_map_unset_all (GeeAbstractMap* self, GeeMap* map); +static gboolean gee_abstract_map_real_unset_all (GeeAbstractMap* self, GeeMap* map); +GeeSet* gee_map_get_keys (GeeMap* self); +static gboolean gee_abstract_map_real_remove_all (GeeMap* base, GeeMap* map); +gboolean gee_abstract_map_has_all (GeeAbstractMap* self, GeeMap* map); +static gboolean gee_abstract_map_real_has_all (GeeAbstractMap* self, GeeMap* map); +static gboolean gee_abstract_map_real_contains_all (GeeMap* base, GeeMap* map); +static GeeIterator* gee_abstract_map_real_iterator (GeeIterable* base); +GeeAbstractMap* gee_abstract_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func); +gint gee_abstract_map_get_size (GeeAbstractMap* self); +gboolean gee_abstract_map_get_is_empty (GeeAbstractMap* self); +gint gee_map_get_size (GeeMap* self); +GeeSet* gee_abstract_map_get_keys (GeeAbstractMap* self); +GeeCollection* gee_abstract_map_get_values (GeeAbstractMap* self); +GeeSet* gee_abstract_map_get_entries (GeeAbstractMap* self); +GeeMap* gee_abstract_map_get_read_only_view (GeeAbstractMap* self); +GeeReadOnlyMap* gee_read_only_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeMap* map); +GeeReadOnlyMap* gee_read_only_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeMap* map); +GType gee_read_only_map_get_type (void) G_GNUC_CONST; +static void gee_abstract_map_finalize (GObject* obj); +GType gee_map_get_key_type (GeeMap* self); +GType gee_map_get_value_type (GeeMap* self); +GType gee_iterable_get_element_type (GeeIterable* self); +static void _vala_gee_abstract_map_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_abstract_map_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +/** + * {@inheritDoc} + */ +static gboolean gee_abstract_map_real_has_key (GeeAbstractMap* self, gconstpointer key) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_map_has_key'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return FALSE; +} + + +gboolean gee_abstract_map_has_key (GeeAbstractMap* self, gconstpointer key) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ABSTRACT_MAP_GET_CLASS (self)->has_key (self, key); +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_abstract_map_real_contains (GeeMap* base, gconstpointer key) { + GeeAbstractMap * self; + gboolean result = FALSE; + gconstpointer _tmp0_; + gboolean _tmp1_ = FALSE; + self = (GeeAbstractMap*) base; + _tmp0_ = key; + _tmp1_ = gee_abstract_map_has_key (self, _tmp0_); + result = _tmp1_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_abstract_map_real_has (GeeAbstractMap* self, gconstpointer key, gconstpointer value) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_map_has'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return FALSE; +} + + +gboolean gee_abstract_map_has (GeeAbstractMap* self, gconstpointer key, gconstpointer value) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ABSTRACT_MAP_GET_CLASS (self)->has (self, key, value); +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_abstract_map_real_get (GeeAbstractMap* self, gconstpointer key) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_map_get'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return NULL; +} + + +gpointer gee_abstract_map_get (GeeAbstractMap* self, gconstpointer key) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_MAP_GET_CLASS (self)->get (self, key); +} + + +/** + * {@inheritDoc} + */ +static void gee_abstract_map_real_set (GeeAbstractMap* self, gconstpointer key, gconstpointer value) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_map_set'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return; +} + + +void gee_abstract_map_set (GeeAbstractMap* self, gconstpointer key, gconstpointer value) { + g_return_if_fail (self != NULL); + GEE_ABSTRACT_MAP_GET_CLASS (self)->set (self, key, value); +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_abstract_map_real_unset (GeeAbstractMap* self, gconstpointer key, gpointer* value) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_map_unset'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return FALSE; +} + + +gboolean gee_abstract_map_unset (GeeAbstractMap* self, gconstpointer key, gpointer* value) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ABSTRACT_MAP_GET_CLASS (self)->unset (self, key, value); +} + + +/** + * {@inheritDoc} + */ +static GeeMapIterator* gee_abstract_map_real_map_iterator (GeeAbstractMap* self) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_map_map_iterator'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return NULL; +} + + +GeeMapIterator* gee_abstract_map_map_iterator (GeeAbstractMap* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_MAP_GET_CLASS (self)->map_iterator (self); +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_abstract_map_real_remove (GeeMap* base, gconstpointer key, gpointer* value) { + GeeAbstractMap * self; + gpointer _vala_value = NULL; + gboolean result = FALSE; + gpointer removed_value = NULL; + gconstpointer _tmp0_; + gpointer _tmp1_ = NULL; + gboolean _tmp2_ = FALSE; + gboolean _result_; + self = (GeeAbstractMap*) base; + _tmp0_ = key; + _tmp2_ = gee_abstract_map_unset (self, _tmp0_, &_tmp1_); + ((removed_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (removed_value = (self->priv->v_destroy_func (removed_value), NULL)); + removed_value = _tmp1_; + _result_ = _tmp2_; + if ((&_vala_value) != NULL) { + gconstpointer _tmp3_; + gpointer _tmp4_; + _tmp3_ = removed_value; + _tmp4_ = ((_tmp3_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp3_) : ((gpointer) _tmp3_); + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + _vala_value = _tmp4_; + } + result = _result_; + ((removed_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (removed_value = (self->priv->v_destroy_func (removed_value), NULL)); + if (value) { + *value = _vala_value; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + } + return result; +} + + +/** + * {@inheritDoc} + */ +static void gee_abstract_map_real_clear (GeeAbstractMap* self) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_map_clear'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return; +} + + +void gee_abstract_map_clear (GeeAbstractMap* self) { + g_return_if_fail (self != NULL); + GEE_ABSTRACT_MAP_GET_CLASS (self)->clear (self); +} + + +/** + * {@inheritDoc} + */ +static void gee_abstract_map_real_set_all (GeeAbstractMap* self, GeeMap* map) { + g_return_if_fail (map != NULL); + { + GeeMap* _tmp0_; + GeeSet* _tmp1_; + GeeSet* _tmp2_; + GeeSet* _tmp3_; + GeeIterator* _tmp4_ = NULL; + GeeIterator* _tmp5_; + GeeIterator* _entry_it; + _tmp0_ = map; + _tmp1_ = gee_map_get_entries (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = _tmp2_; + _tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_); + _tmp5_ = _tmp4_; + _g_object_unref0 (_tmp3_); + _entry_it = _tmp5_; + while (TRUE) { + GeeIterator* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeIterator* _tmp8_; + gpointer _tmp9_ = NULL; + GeeMapEntry* entry; + GeeMapEntry* _tmp10_; + gconstpointer _tmp11_; + gconstpointer _tmp12_; + GeeMapEntry* _tmp13_; + gconstpointer _tmp14_; + gconstpointer _tmp15_; + _tmp6_ = _entry_it; + _tmp7_ = gee_iterator_next (_tmp6_); + if (!_tmp7_) { + break; + } + _tmp8_ = _entry_it; + _tmp9_ = gee_iterator_get (_tmp8_); + entry = (GeeMapEntry*) _tmp9_; + _tmp10_ = entry; + _tmp11_ = gee_map_entry_get_key (_tmp10_); + _tmp12_ = _tmp11_; + _tmp13_ = entry; + _tmp14_ = gee_map_entry_get_value (_tmp13_); + _tmp15_ = _tmp14_; + gee_abstract_map_set (self, _tmp12_, _tmp15_); + _g_object_unref0 (entry); + } + _g_object_unref0 (_entry_it); + } +} + + +void gee_abstract_map_set_all (GeeAbstractMap* self, GeeMap* map) { + g_return_if_fail (self != NULL); + GEE_ABSTRACT_MAP_GET_CLASS (self)->set_all (self, map); +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_abstract_map_real_unset_all (GeeAbstractMap* self, GeeMap* map) { + gboolean result = FALSE; + gboolean changed; + g_return_val_if_fail (map != NULL, FALSE); + changed = FALSE; + { + GeeMap* _tmp0_; + GeeSet* _tmp1_; + GeeSet* _tmp2_; + GeeSet* _tmp3_; + GeeIterator* _tmp4_ = NULL; + GeeIterator* _tmp5_; + GeeIterator* _key_it; + _tmp0_ = map; + _tmp1_ = gee_map_get_keys (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = _tmp2_; + _tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_); + _tmp5_ = _tmp4_; + _g_object_unref0 (_tmp3_); + _key_it = _tmp5_; + while (TRUE) { + GeeIterator* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeIterator* _tmp8_; + gpointer _tmp9_ = NULL; + gpointer key; + gboolean _tmp10_; + gconstpointer _tmp11_; + gboolean _tmp12_ = FALSE; + _tmp6_ = _key_it; + _tmp7_ = gee_iterator_next (_tmp6_); + if (!_tmp7_) { + break; + } + _tmp8_ = _key_it; + _tmp9_ = gee_iterator_get (_tmp8_); + key = _tmp9_; + _tmp10_ = changed; + _tmp11_ = key; + _tmp12_ = gee_abstract_map_unset (self, _tmp11_, NULL); + changed = _tmp10_ | _tmp12_; + ((key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (key = (self->priv->k_destroy_func (key), NULL)); + } + _g_object_unref0 (_key_it); + } + result = changed; + return result; +} + + +gboolean gee_abstract_map_unset_all (GeeAbstractMap* self, GeeMap* map) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ABSTRACT_MAP_GET_CLASS (self)->unset_all (self, map); +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_abstract_map_real_remove_all (GeeMap* base, GeeMap* map) { + GeeAbstractMap * self; + gboolean result = FALSE; + GeeMap* _tmp0_; + gboolean _tmp1_ = FALSE; + self = (GeeAbstractMap*) base; + g_return_val_if_fail (map != NULL, FALSE); + _tmp0_ = map; + _tmp1_ = gee_abstract_map_unset_all (self, _tmp0_); + result = _tmp1_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_abstract_map_real_has_all (GeeAbstractMap* self, GeeMap* map) { + gboolean result = FALSE; + g_return_val_if_fail (map != NULL, FALSE); + { + GeeMap* _tmp0_; + GeeSet* _tmp1_; + GeeSet* _tmp2_; + GeeSet* _tmp3_; + GeeIterator* _tmp4_ = NULL; + GeeIterator* _tmp5_; + GeeIterator* _entry_it; + _tmp0_ = map; + _tmp1_ = gee_map_get_entries (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = _tmp2_; + _tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_); + _tmp5_ = _tmp4_; + _g_object_unref0 (_tmp3_); + _entry_it = _tmp5_; + while (TRUE) { + GeeIterator* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeIterator* _tmp8_; + gpointer _tmp9_ = NULL; + GeeMapEntry* entry; + GeeMapEntry* _tmp10_; + gconstpointer _tmp11_; + gconstpointer _tmp12_; + GeeMapEntry* _tmp13_; + gconstpointer _tmp14_; + gconstpointer _tmp15_; + gboolean _tmp16_ = FALSE; + _tmp6_ = _entry_it; + _tmp7_ = gee_iterator_next (_tmp6_); + if (!_tmp7_) { + break; + } + _tmp8_ = _entry_it; + _tmp9_ = gee_iterator_get (_tmp8_); + entry = (GeeMapEntry*) _tmp9_; + _tmp10_ = entry; + _tmp11_ = gee_map_entry_get_key (_tmp10_); + _tmp12_ = _tmp11_; + _tmp13_ = entry; + _tmp14_ = gee_map_entry_get_value (_tmp13_); + _tmp15_ = _tmp14_; + _tmp16_ = gee_abstract_map_has (self, _tmp12_, _tmp15_); + if (!_tmp16_) { + result = FALSE; + _g_object_unref0 (entry); + _g_object_unref0 (_entry_it); + return result; + } + _g_object_unref0 (entry); + } + _g_object_unref0 (_entry_it); + } + result = TRUE; + return result; +} + + +gboolean gee_abstract_map_has_all (GeeAbstractMap* self, GeeMap* map) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ABSTRACT_MAP_GET_CLASS (self)->has_all (self, map); +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_abstract_map_real_contains_all (GeeMap* base, GeeMap* map) { + GeeAbstractMap * self; + gboolean result = FALSE; + GeeMap* _tmp0_; + gboolean _tmp1_ = FALSE; + self = (GeeAbstractMap*) base; + g_return_val_if_fail (map != NULL, FALSE); + _tmp0_ = map; + _tmp1_ = gee_abstract_map_has_all (self, _tmp0_); + result = _tmp1_; + return result; +} + + +/** + * {@inheritDoc} + */ +static GeeIterator* gee_abstract_map_real_iterator (GeeIterable* base) { + GeeAbstractMap * self; + GeeIterator* result = NULL; + GeeSet* _tmp0_; + GeeSet* _tmp1_; + GeeSet* _tmp2_; + GeeIterator* _tmp3_ = NULL; + GeeIterator* _tmp4_; + self = (GeeAbstractMap*) base; + _tmp0_ = gee_map_get_entries ((GeeMap*) self); + _tmp1_ = _tmp0_; + _tmp2_ = _tmp1_; + _tmp3_ = gee_iterable_iterator ((GeeIterable*) _tmp2_); + _tmp4_ = _tmp3_; + _g_object_unref0 (_tmp2_); + result = _tmp4_; + return result; +} + + +GeeAbstractMap* gee_abstract_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func) { + GeeAbstractMap * self = NULL; + self = (GeeAbstractMap*) g_object_new (object_type, NULL); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + return self; +} + + +gint gee_abstract_map_get_size (GeeAbstractMap* self) { + g_return_val_if_fail (self != NULL, 0); + return GEE_ABSTRACT_MAP_GET_CLASS (self)->get_size (self); +} + + +gboolean gee_abstract_map_get_is_empty (GeeAbstractMap* self) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ABSTRACT_MAP_GET_CLASS (self)->get_is_empty (self); +} + + +static gboolean gee_abstract_map_real_get_is_empty (GeeAbstractMap* base) { + gboolean result; + GeeAbstractMap* self; + gint _tmp0_; + gint _tmp1_; + self = base; + _tmp0_ = gee_map_get_size ((GeeMap*) self); + _tmp1_ = _tmp0_; + result = _tmp1_ == 0; + return result; +} + + +GeeSet* gee_abstract_map_get_keys (GeeAbstractMap* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_MAP_GET_CLASS (self)->get_keys (self); +} + + +GeeCollection* gee_abstract_map_get_values (GeeAbstractMap* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_MAP_GET_CLASS (self)->get_values (self); +} + + +GeeSet* gee_abstract_map_get_entries (GeeAbstractMap* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_MAP_GET_CLASS (self)->get_entries (self); +} + + +GeeMap* gee_abstract_map_get_read_only_view (GeeAbstractMap* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_MAP_GET_CLASS (self)->get_read_only_view (self); +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static GeeMap* gee_abstract_map_real_get_read_only_view (GeeAbstractMap* base) { + GeeMap* result; + GeeAbstractMap* self; + GeeMap* _tmp0_; + GeeMap* _tmp1_; + GeeMap* instance; + GeeMap* _tmp2_; + self = base; + _tmp0_ = self->priv->_read_only_view; + _tmp1_ = _g_object_ref0 (_tmp0_); + instance = _tmp1_; + _tmp2_ = self->priv->_read_only_view; + if (_tmp2_ == NULL) { + GeeReadOnlyMap* _tmp3_; + GeeMap* _tmp4_; + GeeMap* _tmp5_; + _tmp3_ = gee_read_only_map_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, (GeeMap*) self); + _g_object_unref0 (instance); + instance = (GeeMap*) _tmp3_; + _tmp4_ = instance; + self->priv->_read_only_view = _tmp4_; + _tmp5_ = instance; + g_object_add_weak_pointer ((GObject*) _tmp5_, (void**) (&self->priv->_read_only_view)); + } + result = instance; + return result; +} + + +static GType gee_abstract_map_real_get_key_type (GeeMap* base) { + GType result; + GeeAbstractMap* self; + self = (GeeAbstractMap*) base; + result = self->priv->k_type; + return result; +} + + +static GType gee_abstract_map_real_get_value_type (GeeMap* base) { + GType result; + GeeAbstractMap* self; + self = (GeeAbstractMap*) base; + result = self->priv->v_type; + return result; +} + + +static GType gee_abstract_map_real_get_element_type (GeeIterable* base) { + GType result; + GeeAbstractMap* self; + self = (GeeAbstractMap*) base; + result = GEE_MAP_TYPE_ENTRY; + return result; +} + + +static void gee_abstract_map_class_init (GeeAbstractMapClass * klass) { + gee_abstract_map_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeAbstractMapPrivate)); + GEE_ABSTRACT_MAP_CLASS (klass)->has_key = gee_abstract_map_real_has_key; + GEE_ABSTRACT_MAP_CLASS (klass)->has = gee_abstract_map_real_has; + GEE_ABSTRACT_MAP_CLASS (klass)->get = gee_abstract_map_real_get; + GEE_ABSTRACT_MAP_CLASS (klass)->set = gee_abstract_map_real_set; + GEE_ABSTRACT_MAP_CLASS (klass)->unset = gee_abstract_map_real_unset; + GEE_ABSTRACT_MAP_CLASS (klass)->map_iterator = gee_abstract_map_real_map_iterator; + GEE_ABSTRACT_MAP_CLASS (klass)->clear = gee_abstract_map_real_clear; + GEE_ABSTRACT_MAP_CLASS (klass)->set_all = gee_abstract_map_real_set_all; + GEE_ABSTRACT_MAP_CLASS (klass)->unset_all = gee_abstract_map_real_unset_all; + GEE_ABSTRACT_MAP_CLASS (klass)->has_all = gee_abstract_map_real_has_all; + GEE_ABSTRACT_MAP_CLASS (klass)->get_is_empty = gee_abstract_map_real_get_is_empty; + GEE_ABSTRACT_MAP_CLASS (klass)->get_read_only_view = gee_abstract_map_real_get_read_only_view; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_abstract_map_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_abstract_map_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_abstract_map_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MAP_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MAP_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MAP_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MAP_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MAP_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MAP_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MAP_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MAP_IS_EMPTY, g_param_spec_boolean ("is-empty", "is-empty", "is-empty", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MAP_KEYS, g_param_spec_object ("keys", "keys", "keys", GEE_TYPE_SET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MAP_VALUES, g_param_spec_object ("values", "values", "values", GEE_TYPE_COLLECTION, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MAP_ENTRIES, g_param_spec_object ("entries", "entries", "entries", GEE_TYPE_SET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MAP_READ_ONLY_VIEW, g_param_spec_object ("read-only-view", "read-only-view", "read-only-view", GEE_TYPE_MAP, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MAP_KEY_TYPE, g_param_spec_gtype ("key-type", "key-type", "key-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MAP_VALUE_TYPE, g_param_spec_gtype ("value-type", "value-type", "value-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MAP_ELEMENT_TYPE, g_param_spec_gtype ("element-type", "element-type", "element-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_abstract_map_gee_iterable_interface_init (GeeIterableIface * iface) { + gee_abstract_map_gee_iterable_parent_iface = g_type_interface_peek_parent (iface); + iface->iterator = (GeeIterator* (*)(GeeIterable*)) gee_abstract_map_real_iterator; + iface->get_element_type = gee_abstract_map_real_get_element_type; +} + + +static void gee_abstract_map_gee_map_interface_init (GeeMapIface * iface) { + gee_abstract_map_gee_map_parent_iface = g_type_interface_peek_parent (iface); + iface->has_key = (gboolean (*)(GeeMap*, gconstpointer)) gee_abstract_map_has_key; + iface->contains = (gboolean (*)(GeeMap*, gconstpointer)) gee_abstract_map_real_contains; + iface->has = (gboolean (*)(GeeMap*, gconstpointer, gconstpointer)) gee_abstract_map_has; + iface->get = (gpointer (*)(GeeMap*, gconstpointer)) gee_abstract_map_get; + iface->set = (void (*)(GeeMap*, gconstpointer, gconstpointer)) gee_abstract_map_set; + iface->unset = (gboolean (*)(GeeMap*, gconstpointer, gpointer*)) gee_abstract_map_unset; + iface->map_iterator = (GeeMapIterator* (*)(GeeMap*)) gee_abstract_map_map_iterator; + iface->remove = (gboolean (*)(GeeMap*, gconstpointer, gpointer*)) gee_abstract_map_real_remove; + iface->clear = (void (*)(GeeMap*)) gee_abstract_map_clear; + iface->set_all = (void (*)(GeeMap*, GeeMap*)) gee_abstract_map_set_all; + iface->unset_all = (gboolean (*)(GeeMap*, GeeMap*)) gee_abstract_map_unset_all; + iface->remove_all = (gboolean (*)(GeeMap*, GeeMap*)) gee_abstract_map_real_remove_all; + iface->has_all = (gboolean (*)(GeeMap*, GeeMap*)) gee_abstract_map_has_all; + iface->contains_all = (gboolean (*)(GeeMap*, GeeMap*)) gee_abstract_map_real_contains_all; + iface->get_size = (gint (*) (GeeMap *)) gee_abstract_map_get_size; + iface->get_is_empty = (gboolean (*) (GeeMap *)) gee_abstract_map_get_is_empty; + iface->get_keys = (GeeSet* (*) (GeeMap *)) gee_abstract_map_get_keys; + iface->get_values = (GeeCollection* (*) (GeeMap *)) gee_abstract_map_get_values; + iface->get_entries = (GeeSet* (*) (GeeMap *)) gee_abstract_map_get_entries; + iface->get_read_only_view = (GeeMap* (*) (GeeMap *)) gee_abstract_map_get_read_only_view; + iface->get_key_type = gee_abstract_map_real_get_key_type; + iface->get_value_type = gee_abstract_map_real_get_value_type; +} + + +static void gee_abstract_map_instance_init (GeeAbstractMap * self) { + self->priv = GEE_ABSTRACT_MAP_GET_PRIVATE (self); +} + + +static void gee_abstract_map_finalize (GObject* obj) { + GeeAbstractMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap); + G_OBJECT_CLASS (gee_abstract_map_parent_class)->finalize (obj); +} + + +/** + * Skeletal implementation of the {@link Map} interface. + * + * Contains common code shared by all map implementations. + * + * @see HashMap + * @see TreeMap + */ +GType gee_abstract_map_get_type (void) { + static volatile gsize gee_abstract_map_type_id__volatile = 0; + if (g_once_init_enter (&gee_abstract_map_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeAbstractMapClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_abstract_map_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeAbstractMap), 0, (GInstanceInitFunc) gee_abstract_map_instance_init, NULL }; + static const GInterfaceInfo gee_iterable_info = { (GInterfaceInitFunc) gee_abstract_map_gee_iterable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + static const GInterfaceInfo gee_map_info = { (GInterfaceInitFunc) gee_abstract_map_gee_map_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_abstract_map_type_id; + gee_abstract_map_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeAbstractMap", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_type_add_interface_static (gee_abstract_map_type_id, GEE_TYPE_ITERABLE, &gee_iterable_info); + g_type_add_interface_static (gee_abstract_map_type_id, GEE_TYPE_MAP, &gee_map_info); + g_once_init_leave (&gee_abstract_map_type_id__volatile, gee_abstract_map_type_id); + } + return gee_abstract_map_type_id__volatile; +} + + +static void _vala_gee_abstract_map_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeAbstractMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap); + switch (property_id) { + case GEE_ABSTRACT_MAP_IS_EMPTY: + g_value_set_boolean (value, gee_abstract_map_get_is_empty (self)); + break; + case GEE_ABSTRACT_MAP_READ_ONLY_VIEW: + g_value_take_object (value, gee_abstract_map_get_read_only_view (self)); + break; + case GEE_ABSTRACT_MAP_KEY_TYPE: + g_value_set_gtype (value, gee_map_get_key_type ((GeeMap*) self)); + break; + case GEE_ABSTRACT_MAP_VALUE_TYPE: + g_value_set_gtype (value, gee_map_get_value_type ((GeeMap*) self)); + break; + case GEE_ABSTRACT_MAP_ELEMENT_TYPE: + g_value_set_gtype (value, gee_iterable_get_element_type ((GeeIterable*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_abstract_map_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeAbstractMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap); + switch (property_id) { + case GEE_ABSTRACT_MAP_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_ABSTRACT_MAP_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_ABSTRACT_MAP_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_ABSTRACT_MAP_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_ABSTRACT_MAP_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_ABSTRACT_MAP_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/gee/abstractmap.vala b/gee/abstractmap.vala new file mode 100644 index 0000000..191a823 --- /dev/null +++ b/gee/abstractmap.vala @@ -0,0 +1,205 @@ +/* abstractmap.vala + * + * Copyright (C) 2007 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Tomaž Vajngerl + */ + +/** + * Skeletal implementation of the {@link Map} interface. + * + * Contains common code shared by all map implementations. + * + * @see HashMap + * @see TreeMap + */ +public abstract class Gee.AbstractMap : Object, Iterable>, Map { + + /** + * {@inheritDoc} + */ + public abstract int size { get; } + + /** + * {@inheritDoc} + */ + public virtual bool is_empty { + get { return size == 0; } + } + + /** + * {@inheritDoc} + */ + public abstract Set keys { owned get; } + + /** + * {@inheritDoc} + */ + public abstract Collection values { owned get; } + + /** + * {@inheritDoc} + */ + public abstract Set> entries { owned get; } + + /** + * {@inheritDoc} + */ + public abstract bool has_key (K key); + + /** + * {@inheritDoc} + */ + public bool contains (K key) { + return has_key (key); + } + + /** + * {@inheritDoc} + */ + public abstract bool has (K key, V value); + + /** + * {@inheritDoc} + */ + public abstract new V? get (K key); + + /** + * {@inheritDoc} + */ + public abstract new void set (K key, V value); + + /** + * {@inheritDoc} + */ + public abstract bool unset (K key, out V? value = null); + + /** + * {@inheritDoc} + */ + public abstract MapIterator map_iterator (); + + /** + * {@inheritDoc} + */ + public bool remove (K key, out V? value = null) { + V removed_value; + bool result = unset (key, out removed_value); + if (&value != null) { + value = removed_value; + } + return result; + } + + /** + * {@inheritDoc} + */ + public abstract void clear (); + + /** + * {@inheritDoc} + */ + public virtual void set_all (Map map) { + foreach (Map.Entry entry in map.entries) { + set (entry.key, entry.value); + } + } + + /** + * {@inheritDoc} + */ + public virtual bool unset_all (Map map) { + bool changed = false; + foreach (K key in map.keys) { + changed = changed | unset (key); + } + return changed; + } + + /** + * {@inheritDoc} + */ + public bool remove_all (Map map) { + return unset_all (map); + } + + /** + * {@inheritDoc} + */ + public virtual bool has_all (Map map) { + foreach (Map.Entry entry in map.entries) { + if (!has (entry.key, entry.value)) { + return false; + } + } + return true; + } + + /** + * {@inheritDoc} + */ + public bool contains_all (Map map) { + return has_all (map); + } + + private weak Map _read_only_view; + + /** + * {@inheritDoc} + */ + public virtual Map read_only_view { + owned get { + Map instance = _read_only_view; + if (_read_only_view == null) { + instance = new ReadOnlyMap (this); + _read_only_view = instance; + instance.add_weak_pointer ((void**) (&_read_only_view)); + } + return instance; + } + } + + /** + * {@inheritDoc} + */ + public Type key_type { + get { return typeof (K); } + } + + /** + * {@inheritDoc} + */ + public Type value_type { + get { return typeof (V); } + } + + /** + * {@inheritDoc} + */ + public Type element_type { + get { return typeof (Map.Entry); } + } + + /** + * {@inheritDoc} + */ + public Iterator> iterator () { + return entries.iterator (); + } +} diff --git a/gee/abstractmultimap.c b/gee/abstractmultimap.c new file mode 100644 index 0000000..f417508 --- /dev/null +++ b/gee/abstractmultimap.c @@ -0,0 +1,935 @@ +/* abstractmultimap.c generated by valac 0.18.0, the Vala compiler + * generated from abstractmultimap.vala, do not modify */ + +/* abstractmultimap.vala + * + * Copyright (C) 2009 Ali Sabil + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Ali Sabil + * Didier 'Ptitjes Villevalois + */ + +#include +#include + + +#define GEE_TYPE_MULTI_MAP (gee_multi_map_get_type ()) +#define GEE_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MULTI_MAP, GeeMultiMap)) +#define GEE_IS_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MULTI_MAP)) +#define GEE_MULTI_MAP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MULTI_MAP, GeeMultiMapIface)) + +typedef struct _GeeMultiMap GeeMultiMap; +typedef struct _GeeMultiMapIface GeeMultiMapIface; + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_TYPE_MULTI_SET (gee_multi_set_get_type ()) +#define GEE_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MULTI_SET, GeeMultiSet)) +#define GEE_IS_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MULTI_SET)) +#define GEE_MULTI_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MULTI_SET, GeeMultiSetIface)) + +typedef struct _GeeMultiSet GeeMultiSet; +typedef struct _GeeMultiSetIface GeeMultiSetIface; + +#define GEE_TYPE_ABSTRACT_MULTI_MAP (gee_abstract_multi_map_get_type ()) +#define GEE_ABSTRACT_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MULTI_MAP, GeeAbstractMultiMap)) +#define GEE_ABSTRACT_MULTI_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MULTI_MAP, GeeAbstractMultiMapClass)) +#define GEE_IS_ABSTRACT_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MULTI_MAP)) +#define GEE_IS_ABSTRACT_MULTI_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MULTI_MAP)) +#define GEE_ABSTRACT_MULTI_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MULTI_MAP, GeeAbstractMultiMapClass)) + +typedef struct _GeeAbstractMultiMap GeeAbstractMultiMap; +typedef struct _GeeAbstractMultiMapClass GeeAbstractMultiMapClass; +typedef struct _GeeAbstractMultiMapPrivate GeeAbstractMultiMapPrivate; + +#define GEE_TYPE_MAP (gee_map_get_type ()) +#define GEE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP, GeeMap)) +#define GEE_IS_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP)) +#define GEE_MAP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP, GeeMapIface)) + +typedef struct _GeeMap GeeMap; +typedef struct _GeeMapIface GeeMapIface; + +#define GEE_TYPE_MAP_ITERATOR (gee_map_iterator_get_type ()) +#define GEE_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIterator)) +#define GEE_IS_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP_ITERATOR)) +#define GEE_MAP_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIteratorIface)) + +typedef struct _GeeMapIterator GeeMapIterator; +typedef struct _GeeMapIteratorIface GeeMapIteratorIface; + +#define GEE_MAP_TYPE_ENTRY (gee_map_entry_get_type ()) +#define GEE_MAP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntry)) +#define GEE_MAP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) +#define GEE_MAP_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) + +typedef struct _GeeMapEntry GeeMapEntry; +typedef struct _GeeMapEntryClass GeeMapEntryClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; + +#define GEE_TYPE_ABSTRACT_LIST (gee_abstract_list_get_type ()) +#define GEE_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractList)) +#define GEE_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass)) +#define GEE_IS_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_LIST)) +#define GEE_IS_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_LIST)) +#define GEE_ABSTRACT_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass)) + +typedef struct _GeeAbstractList GeeAbstractList; +typedef struct _GeeAbstractListClass GeeAbstractListClass; + +#define GEE_TYPE_ARRAY_LIST (gee_array_list_get_type ()) +#define GEE_ARRAY_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ARRAY_LIST, GeeArrayList)) +#define GEE_ARRAY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ARRAY_LIST, GeeArrayListClass)) +#define GEE_IS_ARRAY_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ARRAY_LIST)) +#define GEE_IS_ARRAY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ARRAY_LIST)) +#define GEE_ARRAY_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ARRAY_LIST, GeeArrayListClass)) + +typedef struct _GeeArrayList GeeArrayList; +typedef struct _GeeArrayListClass GeeArrayListClass; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeMultiSetIface { + GTypeInterface parent_iface; + gint (*count) (GeeMultiSet* self, gconstpointer item); +}; + +struct _GeeMultiMapIface { + GTypeInterface parent_iface; + GeeSet* (*get_keys) (GeeMultiMap* self); + GeeMultiSet* (*get_all_keys) (GeeMultiMap* self); + GeeCollection* (*get_values) (GeeMultiMap* self); + gboolean (*contains) (GeeMultiMap* self, gconstpointer key); + GeeCollection* (*get) (GeeMultiMap* self, gconstpointer key); + void (*set) (GeeMultiMap* self, gconstpointer key, gconstpointer value); + gboolean (*remove) (GeeMultiMap* self, gconstpointer key, gconstpointer value); + gboolean (*remove_all) (GeeMultiMap* self, gconstpointer key); + void (*clear) (GeeMultiMap* self); + gint (*get_size) (GeeMultiMap* self); +}; + +struct _GeeMapIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeMapIterator* self); + gboolean (*has_next) (GeeMapIterator* self); + gboolean (*first) (GeeMapIterator* self); + gpointer (*get_key) (GeeMapIterator* self); + gpointer (*get_value) (GeeMapIterator* self); + void (*set_value) (GeeMapIterator* self, gconstpointer value); + void (*unset) (GeeMapIterator* self); +}; + +struct _GeeMapIface { + GTypeInterface parent_iface; + gboolean (*has_key) (GeeMap* self, gconstpointer key); + gboolean (*contains) (GeeMap* self, gconstpointer key); + gboolean (*has) (GeeMap* self, gconstpointer key, gconstpointer value); + gpointer (*get) (GeeMap* self, gconstpointer key); + void (*set) (GeeMap* self, gconstpointer key, gconstpointer value); + gboolean (*unset) (GeeMap* self, gconstpointer key, gpointer* value); + gboolean (*remove) (GeeMap* self, gconstpointer key, gpointer* value); + void (*clear) (GeeMap* self); + GeeMapIterator* (*map_iterator) (GeeMap* self); + void (*set_all) (GeeMap* self, GeeMap* map); + gboolean (*unset_all) (GeeMap* self, GeeMap* map); + gboolean (*remove_all) (GeeMap* self, GeeMap* map); + gboolean (*has_all) (GeeMap* self, GeeMap* map); + gboolean (*contains_all) (GeeMap* self, GeeMap* map); + gint (*get_size) (GeeMap* self); + gboolean (*get_is_empty) (GeeMap* self); + GeeSet* (*get_keys) (GeeMap* self); + GeeCollection* (*get_values) (GeeMap* self); + GeeSet* (*get_entries) (GeeMap* self); + GeeMap* (*get_read_only_view) (GeeMap* self); + GType (*get_key_type) (GeeMap* self); + GType (*get_value_type) (GeeMap* self); +}; + +struct _GeeAbstractMultiMap { + GObject parent_instance; + GeeAbstractMultiMapPrivate * priv; + GeeMap* _storage_map; +}; + +struct _GeeAbstractMultiMapClass { + GObjectClass parent_class; + GeeCollection* (*create_value_storage) (GeeAbstractMultiMap* self); + GeeMultiSet* (*create_multi_key_set) (GeeAbstractMultiMap* self); + GEqualFunc (*get_value_equal_func) (GeeAbstractMultiMap* self); +}; + +struct _GeeAbstractMultiMapPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + gint _nitems; + GeeSet* _empty_value_set; +}; + + +static gpointer gee_abstract_multi_map_parent_class = NULL; +static GeeMultiMapIface* gee_abstract_multi_map_gee_multi_map_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_multi_set_get_type (void) G_GNUC_CONST; +GType gee_multi_map_get_type (void) G_GNUC_CONST; +GType gee_abstract_multi_map_get_type (void) G_GNUC_CONST; +GType gee_map_iterator_get_type (void) G_GNUC_CONST; +GType gee_map_entry_get_type (void) G_GNUC_CONST; +GType gee_map_get_type (void) G_GNUC_CONST; +#define GEE_ABSTRACT_MULTI_MAP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_ABSTRACT_MULTI_MAP, GeeAbstractMultiMapPrivate)) +enum { + GEE_ABSTRACT_MULTI_MAP_DUMMY_PROPERTY, + GEE_ABSTRACT_MULTI_MAP_K_TYPE, + GEE_ABSTRACT_MULTI_MAP_K_DUP_FUNC, + GEE_ABSTRACT_MULTI_MAP_K_DESTROY_FUNC, + GEE_ABSTRACT_MULTI_MAP_V_TYPE, + GEE_ABSTRACT_MULTI_MAP_V_DUP_FUNC, + GEE_ABSTRACT_MULTI_MAP_V_DESTROY_FUNC, + GEE_ABSTRACT_MULTI_MAP_SIZE +}; +GeeAbstractMultiMap* gee_abstract_multi_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeMap* storage_map); +GeeSet* gee_set_empty (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeCollection* gee_abstract_multi_map_create_value_storage (GeeAbstractMultiMap* self); +static GeeCollection* gee_abstract_multi_map_real_create_value_storage (GeeAbstractMultiMap* self); +GeeMultiSet* gee_abstract_multi_map_create_multi_key_set (GeeAbstractMultiMap* self); +static GeeMultiSet* gee_abstract_multi_map_real_create_multi_key_set (GeeAbstractMultiMap* self); +GEqualFunc gee_abstract_multi_map_get_value_equal_func (GeeAbstractMultiMap* self); +static GEqualFunc gee_abstract_multi_map_real_get_value_equal_func (GeeAbstractMultiMap* self); +static GeeSet* gee_abstract_multi_map_real_get_keys (GeeMultiMap* base); +GeeSet* gee_map_get_keys (GeeMap* self); +static GeeMultiSet* gee_abstract_multi_map_real_get_all_keys (GeeMultiMap* base); +GeeSet* gee_map_get_entries (GeeMap* self); +GeeIterator* gee_iterable_iterator (GeeIterable* self); +gboolean gee_iterator_next (GeeIterator* self); +gpointer gee_iterator_get (GeeIterator* self); +gconstpointer gee_map_entry_get_value (GeeMapEntry* self); +gint gee_collection_get_size (GeeCollection* self); +gboolean gee_collection_add (GeeCollection* self, gconstpointer item); +gconstpointer gee_map_entry_get_key (GeeMapEntry* self); +static GeeCollection* gee_abstract_multi_map_real_get_values (GeeMultiMap* base); +GeeArrayList* gee_array_list_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func); +GeeArrayList* gee_array_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func); +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_list_get_type (void) G_GNUC_CONST; +GType gee_array_list_get_type (void) G_GNUC_CONST; +gboolean gee_abstract_collection_add (GeeAbstractCollection* self, gconstpointer item); +static gboolean gee_abstract_multi_map_real_contains (GeeMultiMap* base, gconstpointer key); +gboolean gee_map_has_key (GeeMap* self, gconstpointer key); +static GeeCollection* gee_abstract_multi_map_real_get (GeeMultiMap* base, gconstpointer key); +gpointer gee_map_get (GeeMap* self, gconstpointer key); +GeeCollection* gee_collection_get_read_only_view (GeeCollection* self); +static void gee_abstract_multi_map_real_set (GeeMultiMap* base, gconstpointer key, gconstpointer value); +void gee_map_set (GeeMap* self, gconstpointer key, gconstpointer value); +static gboolean gee_abstract_multi_map_real_remove (GeeMultiMap* base, gconstpointer key, gconstpointer value); +gboolean gee_collection_contains (GeeCollection* self, gconstpointer item); +gboolean gee_collection_remove (GeeCollection* self, gconstpointer item); +gboolean gee_map_unset (GeeMap* self, gconstpointer key, gpointer* value); +static gboolean gee_abstract_multi_map_real_remove_all (GeeMultiMap* base, gconstpointer key); +static void gee_abstract_multi_map_real_clear (GeeMultiMap* base); +void gee_map_clear (GeeMap* self); +static void gee_abstract_multi_map_finalize (GObject* obj); +gint gee_multi_map_get_size (GeeMultiMap* self); +static void _vala_gee_abstract_multi_map_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_abstract_multi_map_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +GeeAbstractMultiMap* gee_abstract_multi_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeMap* storage_map) { + GeeAbstractMultiMap * self = NULL; + GeeMap* _tmp0_; + GeeMap* _tmp1_; + GeeSet* _tmp2_ = NULL; + g_return_val_if_fail (storage_map != NULL, NULL); + self = (GeeAbstractMultiMap*) g_object_new (object_type, NULL); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _tmp0_ = storage_map; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->_storage_map); + self->_storage_map = _tmp1_; + _tmp2_ = gee_set_empty (v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func); + _g_object_unref0 (self->priv->_empty_value_set); + self->priv->_empty_value_set = _tmp2_; + return self; +} + + +static GeeCollection* gee_abstract_multi_map_real_create_value_storage (GeeAbstractMultiMap* self) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_multi_map_create_value_storage'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return NULL; +} + + +GeeCollection* gee_abstract_multi_map_create_value_storage (GeeAbstractMultiMap* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_MULTI_MAP_GET_CLASS (self)->create_value_storage (self); +} + + +static GeeMultiSet* gee_abstract_multi_map_real_create_multi_key_set (GeeAbstractMultiMap* self) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_multi_map_create_multi_key_set'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return NULL; +} + + +GeeMultiSet* gee_abstract_multi_map_create_multi_key_set (GeeAbstractMultiMap* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_MULTI_MAP_GET_CLASS (self)->create_multi_key_set (self); +} + + +static GEqualFunc gee_abstract_multi_map_real_get_value_equal_func (GeeAbstractMultiMap* self) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_multi_map_get_value_equal_func'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return NULL; +} + + +GEqualFunc gee_abstract_multi_map_get_value_equal_func (GeeAbstractMultiMap* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_MULTI_MAP_GET_CLASS (self)->get_value_equal_func (self); +} + + +static GeeSet* gee_abstract_multi_map_real_get_keys (GeeMultiMap* base) { + GeeAbstractMultiMap * self; + GeeSet* result = NULL; + GeeMap* _tmp0_; + GeeSet* _tmp1_; + GeeSet* _tmp2_; + self = (GeeAbstractMultiMap*) base; + _tmp0_ = self->_storage_map; + _tmp1_ = gee_map_get_keys (_tmp0_); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +static GeeMultiSet* gee_abstract_multi_map_real_get_all_keys (GeeMultiMap* base) { + GeeAbstractMultiMap * self; + GeeMultiSet* result = NULL; + GeeMultiSet* _tmp0_ = NULL; + GeeMultiSet* _result_; + self = (GeeAbstractMultiMap*) base; + _tmp0_ = gee_abstract_multi_map_create_multi_key_set (self); + _result_ = _tmp0_; + { + GeeMap* _tmp1_; + GeeSet* _tmp2_; + GeeSet* _tmp3_; + GeeSet* _tmp4_; + GeeIterator* _tmp5_ = NULL; + GeeIterator* _tmp6_; + GeeIterator* _entry_it; + _tmp1_ = self->_storage_map; + _tmp2_ = gee_map_get_entries (_tmp1_); + _tmp3_ = _tmp2_; + _tmp4_ = _tmp3_; + _tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_); + _tmp6_ = _tmp5_; + _g_object_unref0 (_tmp4_); + _entry_it = _tmp6_; + while (TRUE) { + GeeIterator* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeIterator* _tmp9_; + gpointer _tmp10_ = NULL; + GeeMapEntry* entry; + _tmp7_ = _entry_it; + _tmp8_ = gee_iterator_next (_tmp7_); + if (!_tmp8_) { + break; + } + _tmp9_ = _entry_it; + _tmp10_ = gee_iterator_get (_tmp9_); + entry = (GeeMapEntry*) _tmp10_; + { + gint i; + i = 0; + { + gboolean _tmp11_; + _tmp11_ = TRUE; + while (TRUE) { + gboolean _tmp12_; + gint _tmp14_; + GeeMapEntry* _tmp15_; + gconstpointer _tmp16_; + GeeCollection* _tmp17_; + gint _tmp18_; + gint _tmp19_; + GeeMultiSet* _tmp20_; + GeeMapEntry* _tmp21_; + gconstpointer _tmp22_; + gconstpointer _tmp23_; + _tmp12_ = _tmp11_; + if (!_tmp12_) { + gint _tmp13_; + _tmp13_ = i; + i = _tmp13_ + 1; + } + _tmp11_ = FALSE; + _tmp14_ = i; + _tmp15_ = entry; + _tmp16_ = gee_map_entry_get_value (_tmp15_); + _tmp17_ = _tmp16_; + _tmp18_ = gee_collection_get_size ((GeeCollection*) _tmp17_); + _tmp19_ = _tmp18_; + if (!(_tmp14_ < _tmp19_)) { + break; + } + _tmp20_ = _result_; + _tmp21_ = entry; + _tmp22_ = gee_map_entry_get_key (_tmp21_); + _tmp23_ = _tmp22_; + gee_collection_add ((GeeCollection*) _tmp20_, _tmp23_); + } + } + } + _g_object_unref0 (entry); + } + _g_object_unref0 (_entry_it); + } + result = _result_; + return result; +} + + +static GeeCollection* gee_abstract_multi_map_real_get_values (GeeMultiMap* base) { + GeeAbstractMultiMap * self; + GeeCollection* result = NULL; + GEqualFunc _tmp0_ = NULL; + GeeArrayList* _tmp1_; + GeeArrayList* _result_; + self = (GeeAbstractMultiMap*) base; + _tmp0_ = gee_abstract_multi_map_get_value_equal_func (self); + _tmp1_ = gee_array_list_new (self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, _tmp0_); + _result_ = _tmp1_; + { + GeeMap* _tmp2_; + GeeSet* _tmp3_; + GeeSet* _tmp4_; + GeeSet* _tmp5_; + GeeIterator* _tmp6_ = NULL; + GeeIterator* _tmp7_; + GeeIterator* _entry_it; + _tmp2_ = self->_storage_map; + _tmp3_ = gee_map_get_entries (_tmp2_); + _tmp4_ = _tmp3_; + _tmp5_ = _tmp4_; + _tmp6_ = gee_iterable_iterator ((GeeIterable*) _tmp5_); + _tmp7_ = _tmp6_; + _g_object_unref0 (_tmp5_); + _entry_it = _tmp7_; + while (TRUE) { + GeeIterator* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeIterator* _tmp10_; + gpointer _tmp11_ = NULL; + GeeMapEntry* entry; + _tmp8_ = _entry_it; + _tmp9_ = gee_iterator_next (_tmp8_); + if (!_tmp9_) { + break; + } + _tmp10_ = _entry_it; + _tmp11_ = gee_iterator_get (_tmp10_); + entry = (GeeMapEntry*) _tmp11_; + { + GeeMapEntry* _tmp12_; + gconstpointer _tmp13_; + GeeCollection* _tmp14_; + GeeIterator* _tmp15_ = NULL; + GeeIterator* _value_it; + _tmp12_ = entry; + _tmp13_ = gee_map_entry_get_value (_tmp12_); + _tmp14_ = _tmp13_; + _tmp15_ = gee_iterable_iterator ((GeeIterable*) ((GeeCollection*) _tmp14_)); + _value_it = _tmp15_; + while (TRUE) { + GeeIterator* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeIterator* _tmp18_; + gpointer _tmp19_ = NULL; + gpointer value; + GeeArrayList* _tmp20_; + gconstpointer _tmp21_; + _tmp16_ = _value_it; + _tmp17_ = gee_iterator_next (_tmp16_); + if (!_tmp17_) { + break; + } + _tmp18_ = _value_it; + _tmp19_ = gee_iterator_get (_tmp18_); + value = _tmp19_; + _tmp20_ = _result_; + _tmp21_ = value; + gee_abstract_collection_add ((GeeAbstractCollection*) _tmp20_, _tmp21_); + ((value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (value = (self->priv->v_destroy_func (value), NULL)); + } + _g_object_unref0 (_value_it); + } + _g_object_unref0 (entry); + } + _g_object_unref0 (_entry_it); + } + result = (GeeCollection*) _result_; + return result; +} + + +static gboolean gee_abstract_multi_map_real_contains (GeeMultiMap* base, gconstpointer key) { + GeeAbstractMultiMap * self; + gboolean result = FALSE; + GeeMap* _tmp0_; + gconstpointer _tmp1_; + gboolean _tmp2_ = FALSE; + self = (GeeAbstractMultiMap*) base; + _tmp0_ = self->_storage_map; + _tmp1_ = key; + _tmp2_ = gee_map_has_key (_tmp0_, _tmp1_); + result = _tmp2_; + return result; +} + + +static GeeCollection* gee_abstract_multi_map_real_get (GeeMultiMap* base, gconstpointer key) { + GeeAbstractMultiMap * self; + GeeCollection* result = NULL; + GeeMap* _tmp0_; + gconstpointer _tmp1_; + gboolean _tmp2_ = FALSE; + self = (GeeAbstractMultiMap*) base; + _tmp0_ = self->_storage_map; + _tmp1_ = key; + _tmp2_ = gee_map_has_key (_tmp0_, _tmp1_); + if (_tmp2_) { + GeeMap* _tmp3_; + gconstpointer _tmp4_; + gpointer _tmp5_ = NULL; + GeeCollection* _tmp6_; + GeeCollection* _tmp7_; + GeeCollection* _tmp8_; + GeeCollection* _tmp9_; + _tmp3_ = self->_storage_map; + _tmp4_ = key; + _tmp5_ = gee_map_get (_tmp3_, _tmp4_); + _tmp6_ = (GeeCollection*) _tmp5_; + _tmp7_ = gee_collection_get_read_only_view (_tmp6_); + _tmp8_ = _tmp7_; + _tmp9_ = _tmp8_; + _g_object_unref0 (_tmp6_); + result = _tmp9_; + return result; + } else { + GeeSet* _tmp10_; + GeeCollection* _tmp11_; + _tmp10_ = self->priv->_empty_value_set; + _tmp11_ = _g_object_ref0 ((GeeCollection*) _tmp10_); + result = _tmp11_; + return result; + } +} + + +static void gee_abstract_multi_map_real_set (GeeMultiMap* base, gconstpointer key, gconstpointer value) { + GeeAbstractMultiMap * self; + GeeMap* _tmp0_; + gconstpointer _tmp1_; + gboolean _tmp2_ = FALSE; + self = (GeeAbstractMultiMap*) base; + _tmp0_ = self->_storage_map; + _tmp1_ = key; + _tmp2_ = gee_map_has_key (_tmp0_, _tmp1_); + if (_tmp2_) { + GeeMap* _tmp3_; + gconstpointer _tmp4_; + gpointer _tmp5_ = NULL; + GeeCollection* _tmp6_; + gconstpointer _tmp7_; + gboolean _tmp8_ = FALSE; + gboolean _tmp9_; + _tmp3_ = self->_storage_map; + _tmp4_ = key; + _tmp5_ = gee_map_get (_tmp3_, _tmp4_); + _tmp6_ = (GeeCollection*) _tmp5_; + _tmp7_ = value; + _tmp8_ = gee_collection_add (_tmp6_, _tmp7_); + _tmp9_ = _tmp8_; + _g_object_unref0 (_tmp6_); + if (_tmp9_) { + gint _tmp10_; + _tmp10_ = self->priv->_nitems; + self->priv->_nitems = _tmp10_ + 1; + } + } else { + GeeCollection* _tmp11_ = NULL; + GeeCollection* s; + GeeCollection* _tmp12_; + gconstpointer _tmp13_; + GeeMap* _tmp14_; + gconstpointer _tmp15_; + GeeCollection* _tmp16_; + gint _tmp17_; + _tmp11_ = gee_abstract_multi_map_create_value_storage (self); + s = _tmp11_; + _tmp12_ = s; + _tmp13_ = value; + gee_collection_add (_tmp12_, _tmp13_); + _tmp14_ = self->_storage_map; + _tmp15_ = key; + _tmp16_ = s; + gee_map_set (_tmp14_, _tmp15_, _tmp16_); + _tmp17_ = self->priv->_nitems; + self->priv->_nitems = _tmp17_ + 1; + _g_object_unref0 (s); + } +} + + +static gboolean gee_abstract_multi_map_real_remove (GeeMultiMap* base, gconstpointer key, gconstpointer value) { + GeeAbstractMultiMap * self; + gboolean result = FALSE; + GeeMap* _tmp0_; + gconstpointer _tmp1_; + gboolean _tmp2_ = FALSE; + self = (GeeAbstractMultiMap*) base; + _tmp0_ = self->_storage_map; + _tmp1_ = key; + _tmp2_ = gee_map_has_key (_tmp0_, _tmp1_); + if (_tmp2_) { + GeeMap* _tmp3_; + gconstpointer _tmp4_; + gpointer _tmp5_ = NULL; + GeeCollection* values; + GeeCollection* _tmp6_; + gconstpointer _tmp7_; + gboolean _tmp8_ = FALSE; + _tmp3_ = self->_storage_map; + _tmp4_ = key; + _tmp5_ = gee_map_get (_tmp3_, _tmp4_); + values = (GeeCollection*) _tmp5_; + _tmp6_ = values; + _tmp7_ = value; + _tmp8_ = gee_collection_contains (_tmp6_, _tmp7_); + if (_tmp8_) { + GeeCollection* _tmp9_; + gconstpointer _tmp10_; + gint _tmp11_; + GeeCollection* _tmp12_; + gint _tmp13_; + gint _tmp14_; + _tmp9_ = values; + _tmp10_ = value; + gee_collection_remove (_tmp9_, _tmp10_); + _tmp11_ = self->priv->_nitems; + self->priv->_nitems = _tmp11_ - 1; + _tmp12_ = values; + _tmp13_ = gee_collection_get_size (_tmp12_); + _tmp14_ = _tmp13_; + if (_tmp14_ == 0) { + GeeMap* _tmp15_; + gconstpointer _tmp16_; + _tmp15_ = self->_storage_map; + _tmp16_ = key; + gee_map_unset (_tmp15_, _tmp16_, NULL); + } + result = TRUE; + _g_object_unref0 (values); + return result; + } + _g_object_unref0 (values); + } + result = FALSE; + return result; +} + + +static gboolean gee_abstract_multi_map_real_remove_all (GeeMultiMap* base, gconstpointer key) { + GeeAbstractMultiMap * self; + gboolean result = FALSE; + GeeMap* _tmp0_; + gconstpointer _tmp1_; + gboolean _tmp2_ = FALSE; + self = (GeeAbstractMultiMap*) base; + _tmp0_ = self->_storage_map; + _tmp1_ = key; + _tmp2_ = gee_map_has_key (_tmp0_, _tmp1_); + if (_tmp2_) { + GeeMap* _tmp3_; + gconstpointer _tmp4_; + gpointer _tmp5_ = NULL; + GeeCollection* _tmp6_; + gint _tmp7_; + gint _tmp8_; + gint _tmp9_; + gint size; + GeeMap* _tmp10_; + gconstpointer _tmp11_; + gboolean _tmp12_ = FALSE; + _tmp3_ = self->_storage_map; + _tmp4_ = key; + _tmp5_ = gee_map_get (_tmp3_, _tmp4_); + _tmp6_ = (GeeCollection*) _tmp5_; + _tmp7_ = gee_collection_get_size (_tmp6_); + _tmp8_ = _tmp7_; + _tmp9_ = _tmp8_; + _g_object_unref0 (_tmp6_); + size = _tmp9_; + _tmp10_ = self->_storage_map; + _tmp11_ = key; + _tmp12_ = gee_map_unset (_tmp10_, _tmp11_, NULL); + if (_tmp12_) { + gint _tmp13_; + gint _tmp14_; + _tmp13_ = self->priv->_nitems; + _tmp14_ = size; + self->priv->_nitems = _tmp13_ - _tmp14_; + result = TRUE; + return result; + } + } + result = FALSE; + return result; +} + + +static void gee_abstract_multi_map_real_clear (GeeMultiMap* base) { + GeeAbstractMultiMap * self; + GeeMap* _tmp0_; + self = (GeeAbstractMultiMap*) base; + _tmp0_ = self->_storage_map; + gee_map_clear (_tmp0_); + self->priv->_nitems = 0; +} + + +static gint gee_abstract_multi_map_real_get_size (GeeMultiMap* base) { + gint result; + GeeAbstractMultiMap* self; + gint _tmp0_; + self = (GeeAbstractMultiMap*) base; + _tmp0_ = self->priv->_nitems; + result = _tmp0_; + return result; +} + + +static void gee_abstract_multi_map_class_init (GeeAbstractMultiMapClass * klass) { + gee_abstract_multi_map_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeAbstractMultiMapPrivate)); + GEE_ABSTRACT_MULTI_MAP_CLASS (klass)->create_value_storage = gee_abstract_multi_map_real_create_value_storage; + GEE_ABSTRACT_MULTI_MAP_CLASS (klass)->create_multi_key_set = gee_abstract_multi_map_real_create_multi_key_set; + GEE_ABSTRACT_MULTI_MAP_CLASS (klass)->get_value_equal_func = gee_abstract_multi_map_real_get_value_equal_func; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_abstract_multi_map_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_abstract_multi_map_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_abstract_multi_map_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MULTI_MAP_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MULTI_MAP_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MULTI_MAP_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MULTI_MAP_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MULTI_MAP_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MULTI_MAP_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MULTI_MAP_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_abstract_multi_map_gee_multi_map_interface_init (GeeMultiMapIface * iface) { + gee_abstract_multi_map_gee_multi_map_parent_iface = g_type_interface_peek_parent (iface); + iface->get_keys = (GeeSet* (*)(GeeMultiMap*)) gee_abstract_multi_map_real_get_keys; + iface->get_all_keys = (GeeMultiSet* (*)(GeeMultiMap*)) gee_abstract_multi_map_real_get_all_keys; + iface->get_values = (GeeCollection* (*)(GeeMultiMap*)) gee_abstract_multi_map_real_get_values; + iface->contains = (gboolean (*)(GeeMultiMap*, gconstpointer)) gee_abstract_multi_map_real_contains; + iface->get = (GeeCollection* (*)(GeeMultiMap*, gconstpointer)) gee_abstract_multi_map_real_get; + iface->set = (void (*)(GeeMultiMap*, gconstpointer, gconstpointer)) gee_abstract_multi_map_real_set; + iface->remove = (gboolean (*)(GeeMultiMap*, gconstpointer, gconstpointer)) gee_abstract_multi_map_real_remove; + iface->remove_all = (gboolean (*)(GeeMultiMap*, gconstpointer)) gee_abstract_multi_map_real_remove_all; + iface->clear = (void (*)(GeeMultiMap*)) gee_abstract_multi_map_real_clear; + iface->get_size = gee_abstract_multi_map_real_get_size; +} + + +static void gee_abstract_multi_map_instance_init (GeeAbstractMultiMap * self) { + self->priv = GEE_ABSTRACT_MULTI_MAP_GET_PRIVATE (self); + self->priv->_nitems = 0; +} + + +static void gee_abstract_multi_map_finalize (GObject* obj) { + GeeAbstractMultiMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_ABSTRACT_MULTI_MAP, GeeAbstractMultiMap); + _g_object_unref0 (self->_storage_map); + _g_object_unref0 (self->priv->_empty_value_set); + G_OBJECT_CLASS (gee_abstract_multi_map_parent_class)->finalize (obj); +} + + +/** + * Skeletal implementation of the {@link MultiMap} interface. + * + * @see HashMultiMap + * @see TreeMultiMap + */ +GType gee_abstract_multi_map_get_type (void) { + static volatile gsize gee_abstract_multi_map_type_id__volatile = 0; + if (g_once_init_enter (&gee_abstract_multi_map_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeAbstractMultiMapClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_abstract_multi_map_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeAbstractMultiMap), 0, (GInstanceInitFunc) gee_abstract_multi_map_instance_init, NULL }; + static const GInterfaceInfo gee_multi_map_info = { (GInterfaceInitFunc) gee_abstract_multi_map_gee_multi_map_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_abstract_multi_map_type_id; + gee_abstract_multi_map_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeAbstractMultiMap", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_type_add_interface_static (gee_abstract_multi_map_type_id, GEE_TYPE_MULTI_MAP, &gee_multi_map_info); + g_once_init_leave (&gee_abstract_multi_map_type_id__volatile, gee_abstract_multi_map_type_id); + } + return gee_abstract_multi_map_type_id__volatile; +} + + +static void _vala_gee_abstract_multi_map_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeAbstractMultiMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ABSTRACT_MULTI_MAP, GeeAbstractMultiMap); + switch (property_id) { + case GEE_ABSTRACT_MULTI_MAP_SIZE: + g_value_set_int (value, gee_multi_map_get_size ((GeeMultiMap*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_abstract_multi_map_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeAbstractMultiMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ABSTRACT_MULTI_MAP, GeeAbstractMultiMap); + switch (property_id) { + case GEE_ABSTRACT_MULTI_MAP_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_ABSTRACT_MULTI_MAP_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_ABSTRACT_MULTI_MAP_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_ABSTRACT_MULTI_MAP_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_ABSTRACT_MULTI_MAP_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_ABSTRACT_MULTI_MAP_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/gee/abstractmultimap.vala b/gee/abstractmultimap.vala new file mode 100644 index 0000000..5d0d230 --- /dev/null +++ b/gee/abstractmultimap.vala @@ -0,0 +1,129 @@ +/* abstractmultimap.vala + * + * Copyright (C) 2009 Ali Sabil + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Ali Sabil + * Didier 'Ptitjes Villevalois + */ + +/** + * Skeletal implementation of the {@link MultiMap} interface. + * + * @see HashMultiMap + * @see TreeMultiMap + */ +public abstract class Gee.AbstractMultiMap : Object, MultiMap { + public int size { + get { return _nitems; } + } + + protected Map> _storage_map; + private int _nitems = 0; + private Set _empty_value_set; + + public AbstractMultiMap (Map> storage_map) { + this._storage_map = storage_map; + this._empty_value_set = Set.empty (); + } + + protected abstract Collection create_value_storage (); + + protected abstract MultiSet create_multi_key_set (); + + protected abstract EqualFunc get_value_equal_func (); + + public Set get_keys () { + return _storage_map.keys; + } + + public MultiSet get_all_keys () { + MultiSet result = create_multi_key_set (); + foreach (var entry in _storage_map.entries) { + for (int i = 0; i < entry.value.size; i++) { + result.add (entry.key); + } + } + return result; + } + + public Collection get_values () { + var result = new ArrayList (get_value_equal_func ()); + foreach (var entry in _storage_map.entries) { + foreach (var value in entry.value) { + result.add (value); + } + } + return result; + } + + public bool contains (K key) { + return _storage_map.has_key (key); + } + + public new Collection get (K key) { + if (_storage_map.has_key (key)) { + return _storage_map.get (key).read_only_view; + } else { + return _empty_value_set; + } + } + + public new void set (K key, V value) { + if (_storage_map.has_key (key)) { + if (_storage_map.get (key).add (value)) { + _nitems++; + } + } else { + var s = create_value_storage (); + s.add (value); + _storage_map.set (key, s); + _nitems++; + } + } + + public bool remove (K key, V value) { + if (_storage_map.has_key (key)) { + var values = _storage_map.get (key); + if (values.contains (value)) { + values.remove (value); + _nitems--; + if (values.size == 0) { + _storage_map.unset (key); + } + return true; + } + } + return false; + } + + public bool remove_all (K key) { + if (_storage_map.has_key (key)) { + int size = _storage_map.get (key).size; + if (_storage_map.unset (key)) { + _nitems -= size; + return true; + } + } + return false; + } + + public void clear () { + _storage_map.clear (); + _nitems = 0; + } +} diff --git a/gee/abstractmultiset.c b/gee/abstractmultiset.c new file mode 100644 index 0000000..59c29ff --- /dev/null +++ b/gee/abstractmultiset.c @@ -0,0 +1,872 @@ +/* abstractmultiset.c generated by valac 0.18.0, the Vala compiler + * generated from abstractmultiset.vala, do not modify */ + +/* abstractmultiset.vala + * + * Copyright (C) 2009 Ali Sabil + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Ali Sabil + * Didier 'Ptitjes Villevalois + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; +typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate; + +#define GEE_TYPE_MULTI_SET (gee_multi_set_get_type ()) +#define GEE_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MULTI_SET, GeeMultiSet)) +#define GEE_IS_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MULTI_SET)) +#define GEE_MULTI_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MULTI_SET, GeeMultiSetIface)) + +typedef struct _GeeMultiSet GeeMultiSet; +typedef struct _GeeMultiSetIface GeeMultiSetIface; + +#define GEE_TYPE_ABSTRACT_MULTI_SET (gee_abstract_multi_set_get_type ()) +#define GEE_ABSTRACT_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSet)) +#define GEE_ABSTRACT_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSetClass)) +#define GEE_IS_ABSTRACT_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MULTI_SET)) +#define GEE_IS_ABSTRACT_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MULTI_SET)) +#define GEE_ABSTRACT_MULTI_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSetClass)) + +typedef struct _GeeAbstractMultiSet GeeAbstractMultiSet; +typedef struct _GeeAbstractMultiSetClass GeeAbstractMultiSetClass; +typedef struct _GeeAbstractMultiSetPrivate GeeAbstractMultiSetPrivate; + +#define GEE_TYPE_MAP (gee_map_get_type ()) +#define GEE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP, GeeMap)) +#define GEE_IS_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP)) +#define GEE_MAP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP, GeeMapIface)) + +typedef struct _GeeMap GeeMap; +typedef struct _GeeMapIface GeeMapIface; + +#define GEE_TYPE_MAP_ITERATOR (gee_map_iterator_get_type ()) +#define GEE_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIterator)) +#define GEE_IS_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP_ITERATOR)) +#define GEE_MAP_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIteratorIface)) + +typedef struct _GeeMapIterator GeeMapIterator; +typedef struct _GeeMapIteratorIface GeeMapIteratorIface; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_MAP_TYPE_ENTRY (gee_map_entry_get_type ()) +#define GEE_MAP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntry)) +#define GEE_MAP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) +#define GEE_MAP_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) + +typedef struct _GeeMapEntry GeeMapEntry; +typedef struct _GeeMapEntryClass GeeMapEntryClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define GEE_ABSTRACT_MULTI_SET_TYPE_ITERATOR (gee_abstract_multi_set_iterator_get_type ()) +#define GEE_ABSTRACT_MULTI_SET_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_ABSTRACT_MULTI_SET_TYPE_ITERATOR, GeeAbstractMultiSetIterator)) +#define GEE_ABSTRACT_MULTI_SET_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_ABSTRACT_MULTI_SET_TYPE_ITERATOR, GeeAbstractMultiSetIteratorClass)) +#define GEE_ABSTRACT_MULTI_SET_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_ABSTRACT_MULTI_SET_TYPE_ITERATOR)) +#define GEE_ABSTRACT_MULTI_SET_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_ABSTRACT_MULTI_SET_TYPE_ITERATOR)) +#define GEE_ABSTRACT_MULTI_SET_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_ABSTRACT_MULTI_SET_TYPE_ITERATOR, GeeAbstractMultiSetIteratorClass)) + +typedef struct _GeeAbstractMultiSetIterator GeeAbstractMultiSetIterator; +typedef struct _GeeAbstractMultiSetIteratorClass GeeAbstractMultiSetIteratorClass; +typedef struct _GeeAbstractMultiSetIteratorPrivate GeeAbstractMultiSetIteratorPrivate; +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeAbstractCollection { + GObject parent_instance; + GeeAbstractCollectionPrivate * priv; +}; + +struct _GeeAbstractCollectionClass { + GObjectClass parent_class; + gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*add) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item); + void (*clear) (GeeAbstractCollection* self); + gpointer* (*to_array) (GeeAbstractCollection* self, int* result_length1); + gboolean (*add_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeAbstractCollection* self, GeeCollection* collection); + GeeIterator* (*iterator) (GeeAbstractCollection* self); + gint (*get_size) (GeeAbstractCollection* self); + gboolean (*get_is_empty) (GeeAbstractCollection* self); + GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self); +}; + +struct _GeeMultiSetIface { + GTypeInterface parent_iface; + gint (*count) (GeeMultiSet* self, gconstpointer item); +}; + +struct _GeeMapIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeMapIterator* self); + gboolean (*has_next) (GeeMapIterator* self); + gboolean (*first) (GeeMapIterator* self); + gpointer (*get_key) (GeeMapIterator* self); + gpointer (*get_value) (GeeMapIterator* self); + void (*set_value) (GeeMapIterator* self, gconstpointer value); + void (*unset) (GeeMapIterator* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeMapIface { + GTypeInterface parent_iface; + gboolean (*has_key) (GeeMap* self, gconstpointer key); + gboolean (*contains) (GeeMap* self, gconstpointer key); + gboolean (*has) (GeeMap* self, gconstpointer key, gconstpointer value); + gpointer (*get) (GeeMap* self, gconstpointer key); + void (*set) (GeeMap* self, gconstpointer key, gconstpointer value); + gboolean (*unset) (GeeMap* self, gconstpointer key, gpointer* value); + gboolean (*remove) (GeeMap* self, gconstpointer key, gpointer* value); + void (*clear) (GeeMap* self); + GeeMapIterator* (*map_iterator) (GeeMap* self); + void (*set_all) (GeeMap* self, GeeMap* map); + gboolean (*unset_all) (GeeMap* self, GeeMap* map); + gboolean (*remove_all) (GeeMap* self, GeeMap* map); + gboolean (*has_all) (GeeMap* self, GeeMap* map); + gboolean (*contains_all) (GeeMap* self, GeeMap* map); + gint (*get_size) (GeeMap* self); + gboolean (*get_is_empty) (GeeMap* self); + GeeSet* (*get_keys) (GeeMap* self); + GeeCollection* (*get_values) (GeeMap* self); + GeeSet* (*get_entries) (GeeMap* self); + GeeMap* (*get_read_only_view) (GeeMap* self); + GType (*get_key_type) (GeeMap* self); + GType (*get_value_type) (GeeMap* self); +}; + +struct _GeeAbstractMultiSet { + GeeAbstractCollection parent_instance; + GeeAbstractMultiSetPrivate * priv; + GeeMap* _storage_map; +}; + +struct _GeeAbstractMultiSetClass { + GeeAbstractCollectionClass parent_class; +}; + +struct _GeeAbstractMultiSetPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + gint _nitems; +}; + +struct _GeeAbstractMultiSetIterator { + GObject parent_instance; + GeeAbstractMultiSetIteratorPrivate * priv; +}; + +struct _GeeAbstractMultiSetIteratorClass { + GObjectClass parent_class; +}; + +struct _GeeAbstractMultiSetIteratorPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GeeAbstractMultiSet* _set; + GeeMapIterator* _iter; + gint _pending; + gboolean _removed; +}; + + +static gpointer gee_abstract_multi_set_parent_class = NULL; +static gpointer gee_abstract_multi_set_iterator_parent_class = NULL; +static GeeIteratorIface* gee_abstract_multi_set_iterator_gee_iterator_parent_iface = NULL; +static GeeMultiSetIface* gee_abstract_multi_set_gee_multi_set_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_multi_set_get_type (void) G_GNUC_CONST; +GType gee_abstract_multi_set_get_type (void) G_GNUC_CONST; +GType gee_map_iterator_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_map_entry_get_type (void) G_GNUC_CONST; +GType gee_map_get_type (void) G_GNUC_CONST; +#define GEE_ABSTRACT_MULTI_SET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSetPrivate)) +enum { + GEE_ABSTRACT_MULTI_SET_DUMMY_PROPERTY, + GEE_ABSTRACT_MULTI_SET_G_TYPE, + GEE_ABSTRACT_MULTI_SET_G_DUP_FUNC, + GEE_ABSTRACT_MULTI_SET_G_DESTROY_FUNC, + GEE_ABSTRACT_MULTI_SET_SIZE +}; +GeeAbstractMultiSet* gee_abstract_multi_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeMap* storage_map); +GeeAbstractCollection* gee_abstract_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +static gint gee_abstract_multi_set_real_count (GeeMultiSet* base, gconstpointer item); +gboolean gee_map_has_key (GeeMap* self, gconstpointer key); +gpointer gee_map_get (GeeMap* self, gconstpointer key); +static gboolean gee_abstract_multi_set_real_contains (GeeAbstractCollection* base, gconstpointer item); +static GeeIterator* gee_abstract_multi_set_real_iterator (GeeAbstractCollection* base); +static GeeAbstractMultiSetIterator* gee_abstract_multi_set_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeAbstractMultiSet* set); +static GeeAbstractMultiSetIterator* gee_abstract_multi_set_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeAbstractMultiSet* set); +static GType gee_abstract_multi_set_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static gboolean gee_abstract_multi_set_real_add (GeeAbstractCollection* base, gconstpointer item); +void gee_map_set (GeeMap* self, gconstpointer key, gconstpointer value); +static gboolean gee_abstract_multi_set_real_remove (GeeAbstractCollection* base, gconstpointer item); +gboolean gee_map_unset (GeeMap* self, gconstpointer key, gpointer* value); +static void gee_abstract_multi_set_real_clear (GeeAbstractCollection* base); +void gee_map_clear (GeeMap* self); +#define GEE_ABSTRACT_MULTI_SET_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_ABSTRACT_MULTI_SET_TYPE_ITERATOR, GeeAbstractMultiSetIteratorPrivate)) +enum { + GEE_ABSTRACT_MULTI_SET_ITERATOR_DUMMY_PROPERTY, + GEE_ABSTRACT_MULTI_SET_ITERATOR_G_TYPE, + GEE_ABSTRACT_MULTI_SET_ITERATOR_G_DUP_FUNC, + GEE_ABSTRACT_MULTI_SET_ITERATOR_G_DESTROY_FUNC +}; +GeeMapIterator* gee_map_map_iterator (GeeMap* self); +static gboolean gee_abstract_multi_set_iterator_real_next (GeeIterator* base); +gboolean gee_map_iterator_next (GeeMapIterator* self); +gpointer gee_map_iterator_get_value (GeeMapIterator* self); +static gboolean gee_abstract_multi_set_iterator_real_has_next (GeeIterator* base); +gboolean gee_map_iterator_has_next (GeeMapIterator* self); +static gboolean gee_abstract_multi_set_iterator_real_first (GeeIterator* base); +gboolean gee_map_iterator_first (GeeMapIterator* self); +static gpointer gee_abstract_multi_set_iterator_real_get (GeeIterator* base); +gpointer gee_map_iterator_get_key (GeeMapIterator* self); +static void gee_abstract_multi_set_iterator_real_remove (GeeIterator* base); +void gee_map_iterator_set_value (GeeMapIterator* self, gconstpointer value); +void gee_map_iterator_unset (GeeMapIterator* self); +static void gee_abstract_multi_set_iterator_finalize (GObject* obj); +static void _vala_gee_abstract_multi_set_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_abstract_multi_set_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void gee_abstract_multi_set_finalize (GObject* obj); +gint gee_abstract_collection_get_size (GeeAbstractCollection* self); +static void _vala_gee_abstract_multi_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_abstract_multi_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +/** + * Constructs a new, empty abstract multi set. + */ +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +GeeAbstractMultiSet* gee_abstract_multi_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeMap* storage_map) { + GeeAbstractMultiSet * self = NULL; + GeeMap* _tmp0_; + GeeMap* _tmp1_; + g_return_val_if_fail (storage_map != NULL, NULL); + self = (GeeAbstractMultiSet*) gee_abstract_collection_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = storage_map; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->_storage_map); + self->_storage_map = _tmp1_; + return self; +} + + +static gint gee_abstract_multi_set_real_count (GeeMultiSet* base, gconstpointer item) { + GeeAbstractMultiSet * self; + gint result = 0; + gint _result_; + GeeMap* _tmp0_; + gconstpointer _tmp1_; + gboolean _tmp2_ = FALSE; + self = (GeeAbstractMultiSet*) base; + _result_ = 0; + _tmp0_ = self->_storage_map; + _tmp1_ = item; + _tmp2_ = gee_map_has_key (_tmp0_, _tmp1_); + if (_tmp2_) { + GeeMap* _tmp3_; + gconstpointer _tmp4_; + gpointer _tmp5_ = NULL; + _tmp3_ = self->_storage_map; + _tmp4_ = item; + _tmp5_ = gee_map_get (_tmp3_, _tmp4_); + _result_ = (gint) ((gintptr) _tmp5_); + } + result = _result_; + return result; +} + + +static gboolean gee_abstract_multi_set_real_contains (GeeAbstractCollection* base, gconstpointer item) { + GeeAbstractMultiSet * self; + gboolean result = FALSE; + GeeMap* _tmp0_; + gconstpointer _tmp1_; + gboolean _tmp2_ = FALSE; + self = (GeeAbstractMultiSet*) base; + _tmp0_ = self->_storage_map; + _tmp1_ = item; + _tmp2_ = gee_map_has_key (_tmp0_, _tmp1_); + result = _tmp2_; + return result; +} + + +static GeeIterator* gee_abstract_multi_set_real_iterator (GeeAbstractCollection* base) { + GeeAbstractMultiSet * self; + GeeIterator* result = NULL; + GeeAbstractMultiSetIterator* _tmp0_; + self = (GeeAbstractMultiSet*) base; + _tmp0_ = gee_abstract_multi_set_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, self); + result = (GeeIterator*) _tmp0_; + return result; +} + + +static gboolean gee_abstract_multi_set_real_add (GeeAbstractCollection* base, gconstpointer item) { + GeeAbstractMultiSet * self; + gboolean result = FALSE; + GeeMap* _tmp0_; + gconstpointer _tmp1_; + gboolean _tmp2_ = FALSE; + gint _tmp11_; + self = (GeeAbstractMultiSet*) base; + _tmp0_ = self->_storage_map; + _tmp1_ = item; + _tmp2_ = gee_map_has_key (_tmp0_, _tmp1_); + if (_tmp2_) { + GeeMap* _tmp3_; + gconstpointer _tmp4_; + gpointer _tmp5_ = NULL; + gint current_count; + GeeMap* _tmp6_; + gconstpointer _tmp7_; + gint _tmp8_; + _tmp3_ = self->_storage_map; + _tmp4_ = item; + _tmp5_ = gee_map_get (_tmp3_, _tmp4_); + current_count = (gint) ((gintptr) _tmp5_); + _tmp6_ = self->_storage_map; + _tmp7_ = item; + _tmp8_ = current_count; + gee_map_set (_tmp6_, _tmp7_, (gpointer) ((gintptr) (_tmp8_ + 1))); + } else { + GeeMap* _tmp9_; + gconstpointer _tmp10_; + _tmp9_ = self->_storage_map; + _tmp10_ = item; + gee_map_set (_tmp9_, _tmp10_, (gpointer) ((gintptr) 1)); + } + _tmp11_ = self->priv->_nitems; + self->priv->_nitems = _tmp11_ + 1; + result = TRUE; + return result; +} + + +static gboolean gee_abstract_multi_set_real_remove (GeeAbstractCollection* base, gconstpointer item) { + GeeAbstractMultiSet * self; + gboolean result = FALSE; + gboolean _tmp0_ = FALSE; + gint _tmp1_; + gboolean _tmp5_; + self = (GeeAbstractMultiSet*) base; + _tmp1_ = self->priv->_nitems; + if (_tmp1_ > 0) { + GeeMap* _tmp2_; + gconstpointer _tmp3_; + gboolean _tmp4_ = FALSE; + _tmp2_ = self->_storage_map; + _tmp3_ = item; + _tmp4_ = gee_map_has_key (_tmp2_, _tmp3_); + _tmp0_ = _tmp4_; + } else { + _tmp0_ = FALSE; + } + _tmp5_ = _tmp0_; + if (_tmp5_) { + GeeMap* _tmp6_; + gconstpointer _tmp7_; + gpointer _tmp8_ = NULL; + gint current_count; + gint _tmp9_; + gint _tmp15_; + _tmp6_ = self->_storage_map; + _tmp7_ = item; + _tmp8_ = gee_map_get (_tmp6_, _tmp7_); + current_count = (gint) ((gintptr) _tmp8_); + _tmp9_ = current_count; + if (_tmp9_ <= 1) { + GeeMap* _tmp10_; + gconstpointer _tmp11_; + _tmp10_ = self->_storage_map; + _tmp11_ = item; + gee_map_unset (_tmp10_, _tmp11_, NULL); + } else { + GeeMap* _tmp12_; + gconstpointer _tmp13_; + gint _tmp14_; + _tmp12_ = self->_storage_map; + _tmp13_ = item; + _tmp14_ = current_count; + gee_map_set (_tmp12_, _tmp13_, (gpointer) ((gintptr) (_tmp14_ - 1))); + } + _tmp15_ = self->priv->_nitems; + self->priv->_nitems = _tmp15_ - 1; + result = TRUE; + return result; + } + result = FALSE; + return result; +} + + +static void gee_abstract_multi_set_real_clear (GeeAbstractCollection* base) { + GeeAbstractMultiSet * self; + GeeMap* _tmp0_; + self = (GeeAbstractMultiSet*) base; + _tmp0_ = self->_storage_map; + gee_map_clear (_tmp0_); + self->priv->_nitems = 0; +} + + +static gint gee_abstract_multi_set_real_get_size (GeeAbstractCollection* base) { + gint result; + GeeAbstractMultiSet* self; + gint _tmp0_; + self = (GeeAbstractMultiSet*) base; + _tmp0_ = self->priv->_nitems; + result = _tmp0_; + return result; +} + + +static GeeAbstractMultiSetIterator* gee_abstract_multi_set_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeAbstractMultiSet* set) { + GeeAbstractMultiSetIterator * self = NULL; + GeeAbstractMultiSet* _tmp0_; + GeeAbstractMultiSet* _tmp1_; + GeeAbstractMultiSet* _tmp2_; + GeeMap* _tmp3_; + GeeMapIterator* _tmp4_ = NULL; + g_return_val_if_fail (set != NULL, NULL); + self = (GeeAbstractMultiSetIterator*) g_object_new (object_type, NULL); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = set; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->_set); + self->priv->_set = _tmp1_; + _tmp2_ = self->priv->_set; + _tmp3_ = _tmp2_->_storage_map; + _tmp4_ = gee_map_map_iterator (_tmp3_); + _g_object_unref0 (self->priv->_iter); + self->priv->_iter = _tmp4_; + return self; +} + + +static GeeAbstractMultiSetIterator* gee_abstract_multi_set_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeAbstractMultiSet* set) { + return gee_abstract_multi_set_iterator_construct (GEE_ABSTRACT_MULTI_SET_TYPE_ITERATOR, g_type, g_dup_func, g_destroy_func, set); +} + + +static gboolean gee_abstract_multi_set_iterator_real_next (GeeIterator* base) { + GeeAbstractMultiSetIterator * self; + gboolean result = FALSE; + gint _tmp0_; + self = (GeeAbstractMultiSetIterator*) base; + self->priv->_removed = FALSE; + _tmp0_ = self->priv->_pending; + if (_tmp0_ == 0) { + GeeMapIterator* _tmp1_; + gboolean _tmp2_ = FALSE; + _tmp1_ = self->priv->_iter; + _tmp2_ = gee_map_iterator_next (_tmp1_); + if (_tmp2_) { + GeeMapIterator* _tmp3_; + gpointer _tmp4_ = NULL; + _tmp3_ = self->priv->_iter; + _tmp4_ = gee_map_iterator_get_value (_tmp3_); + self->priv->_pending = ((gint) ((gintptr) _tmp4_)) - 1; + result = TRUE; + return result; + } + } else { + gint _tmp5_; + _tmp5_ = self->priv->_pending; + self->priv->_pending = _tmp5_ - 1; + result = TRUE; + return result; + } + result = FALSE; + return result; +} + + +static gboolean gee_abstract_multi_set_iterator_real_has_next (GeeIterator* base) { + GeeAbstractMultiSetIterator * self; + gboolean result = FALSE; + gboolean _tmp0_ = FALSE; + gint _tmp1_; + gboolean _tmp4_; + self = (GeeAbstractMultiSetIterator*) base; + _tmp1_ = self->priv->_pending; + if (_tmp1_ > 0) { + _tmp0_ = TRUE; + } else { + GeeMapIterator* _tmp2_; + gboolean _tmp3_ = FALSE; + _tmp2_ = self->priv->_iter; + _tmp3_ = gee_map_iterator_has_next (_tmp2_); + _tmp0_ = _tmp3_; + } + _tmp4_ = _tmp0_; + result = _tmp4_; + return result; +} + + +static gboolean gee_abstract_multi_set_iterator_real_first (GeeIterator* base) { + GeeAbstractMultiSetIterator * self; + gboolean result = FALSE; + GeeAbstractMultiSet* _tmp0_; + gint _tmp1_; + GeeMapIterator* _tmp2_; + gboolean _tmp3_ = FALSE; + self = (GeeAbstractMultiSetIterator*) base; + _tmp0_ = self->priv->_set; + _tmp1_ = _tmp0_->priv->_nitems; + if (_tmp1_ == 0) { + result = FALSE; + return result; + } + self->priv->_pending = 0; + _tmp2_ = self->priv->_iter; + _tmp3_ = gee_map_iterator_first (_tmp2_); + if (_tmp3_) { + GeeMapIterator* _tmp4_; + gpointer _tmp5_ = NULL; + _tmp4_ = self->priv->_iter; + _tmp5_ = gee_map_iterator_get_value (_tmp4_); + self->priv->_pending = ((gint) ((gintptr) _tmp5_)) - 1; + } + result = TRUE; + return result; +} + + +static gpointer gee_abstract_multi_set_iterator_real_get (GeeIterator* base) { + GeeAbstractMultiSetIterator * self; + gpointer result = NULL; + gboolean _tmp0_; + GeeMapIterator* _tmp1_; + gpointer _tmp2_ = NULL; + self = (GeeAbstractMultiSetIterator*) base; + _tmp0_ = self->priv->_removed; + _vala_assert (!_tmp0_, "! _removed"); + _tmp1_ = self->priv->_iter; + _tmp2_ = gee_map_iterator_get_key (_tmp1_); + result = _tmp2_; + return result; +} + + +static void gee_abstract_multi_set_iterator_real_remove (GeeIterator* base) { + GeeAbstractMultiSetIterator * self; + gboolean _tmp0_; + GeeMapIterator* _tmp1_; + GeeMapIterator* _tmp2_; + gpointer _tmp3_ = NULL; + gint _tmp4_; + gint _tmp5_; + GeeAbstractMultiSet* _tmp7_; + gint _tmp8_; + self = (GeeAbstractMultiSetIterator*) base; + _tmp0_ = self->priv->_removed; + _vala_assert (!_tmp0_, "! _removed"); + _tmp1_ = self->priv->_iter; + _tmp2_ = self->priv->_iter; + _tmp3_ = gee_map_iterator_get_value (_tmp2_); + self->priv->_pending = ((gint) ((gintptr) _tmp3_)) - 1; + _tmp4_ = self->priv->_pending; + gee_map_iterator_set_value (_tmp1_, (gpointer) ((gintptr) _tmp4_)); + _tmp5_ = self->priv->_pending; + if (_tmp5_ == 0) { + GeeMapIterator* _tmp6_; + _tmp6_ = self->priv->_iter; + gee_map_iterator_unset (_tmp6_); + } + _tmp7_ = self->priv->_set; + _tmp8_ = _tmp7_->priv->_nitems; + _tmp7_->priv->_nitems = _tmp8_ - 1; + self->priv->_removed = TRUE; +} + + +static void gee_abstract_multi_set_iterator_class_init (GeeAbstractMultiSetIteratorClass * klass) { + gee_abstract_multi_set_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeAbstractMultiSetIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_abstract_multi_set_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_abstract_multi_set_iterator_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_abstract_multi_set_iterator_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MULTI_SET_ITERATOR_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MULTI_SET_ITERATOR_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MULTI_SET_ITERATOR_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_abstract_multi_set_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) { + gee_abstract_multi_set_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->next = (gboolean (*)(GeeIterator*)) gee_abstract_multi_set_iterator_real_next; + iface->has_next = (gboolean (*)(GeeIterator*)) gee_abstract_multi_set_iterator_real_has_next; + iface->first = (gboolean (*)(GeeIterator*)) gee_abstract_multi_set_iterator_real_first; + iface->get = (gpointer (*)(GeeIterator*)) gee_abstract_multi_set_iterator_real_get; + iface->remove = (void (*)(GeeIterator*)) gee_abstract_multi_set_iterator_real_remove; +} + + +static void gee_abstract_multi_set_iterator_instance_init (GeeAbstractMultiSetIterator * self) { + self->priv = GEE_ABSTRACT_MULTI_SET_ITERATOR_GET_PRIVATE (self); + self->priv->_pending = 0; + self->priv->_removed = FALSE; +} + + +static void gee_abstract_multi_set_iterator_finalize (GObject* obj) { + GeeAbstractMultiSetIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_ABSTRACT_MULTI_SET_TYPE_ITERATOR, GeeAbstractMultiSetIterator); + _g_object_unref0 (self->priv->_set); + _g_object_unref0 (self->priv->_iter); + G_OBJECT_CLASS (gee_abstract_multi_set_iterator_parent_class)->finalize (obj); +} + + +static GType gee_abstract_multi_set_iterator_get_type (void) { + static volatile gsize gee_abstract_multi_set_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_abstract_multi_set_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeAbstractMultiSetIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_abstract_multi_set_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeAbstractMultiSetIterator), 0, (GInstanceInitFunc) gee_abstract_multi_set_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_abstract_multi_set_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_abstract_multi_set_iterator_type_id; + gee_abstract_multi_set_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeAbstractMultiSetIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_abstract_multi_set_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info); + g_once_init_leave (&gee_abstract_multi_set_iterator_type_id__volatile, gee_abstract_multi_set_iterator_type_id); + } + return gee_abstract_multi_set_iterator_type_id__volatile; +} + + +static void _vala_gee_abstract_multi_set_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeAbstractMultiSetIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_ABSTRACT_MULTI_SET_TYPE_ITERATOR, GeeAbstractMultiSetIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_abstract_multi_set_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeAbstractMultiSetIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_ABSTRACT_MULTI_SET_TYPE_ITERATOR, GeeAbstractMultiSetIterator); + switch (property_id) { + case GEE_ABSTRACT_MULTI_SET_ITERATOR_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_ABSTRACT_MULTI_SET_ITERATOR_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_ABSTRACT_MULTI_SET_ITERATOR_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void gee_abstract_multi_set_class_init (GeeAbstractMultiSetClass * klass) { + gee_abstract_multi_set_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeAbstractMultiSetPrivate)); + GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains = gee_abstract_multi_set_real_contains; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->iterator = gee_abstract_multi_set_real_iterator; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add = gee_abstract_multi_set_real_add; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove = gee_abstract_multi_set_real_remove; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->clear = gee_abstract_multi_set_real_clear; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_size = gee_abstract_multi_set_real_get_size; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_abstract_multi_set_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_abstract_multi_set_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_abstract_multi_set_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MULTI_SET_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MULTI_SET_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MULTI_SET_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_MULTI_SET_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_abstract_multi_set_gee_multi_set_interface_init (GeeMultiSetIface * iface) { + gee_abstract_multi_set_gee_multi_set_parent_iface = g_type_interface_peek_parent (iface); + iface->count = (gint (*)(GeeMultiSet*, gconstpointer)) gee_abstract_multi_set_real_count; +} + + +static void gee_abstract_multi_set_instance_init (GeeAbstractMultiSet * self) { + self->priv = GEE_ABSTRACT_MULTI_SET_GET_PRIVATE (self); + self->priv->_nitems = 0; +} + + +static void gee_abstract_multi_set_finalize (GObject* obj) { + GeeAbstractMultiSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSet); + _g_object_unref0 (self->_storage_map); + G_OBJECT_CLASS (gee_abstract_multi_set_parent_class)->finalize (obj); +} + + +/** + * Skeletal implementation of the {@link MultiSet} interface. + * + * @see HashMultiSet + * @see TreeMultiSet + */ +GType gee_abstract_multi_set_get_type (void) { + static volatile gsize gee_abstract_multi_set_type_id__volatile = 0; + if (g_once_init_enter (&gee_abstract_multi_set_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeAbstractMultiSetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_abstract_multi_set_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeAbstractMultiSet), 0, (GInstanceInitFunc) gee_abstract_multi_set_instance_init, NULL }; + static const GInterfaceInfo gee_multi_set_info = { (GInterfaceInitFunc) gee_abstract_multi_set_gee_multi_set_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_abstract_multi_set_type_id; + gee_abstract_multi_set_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_COLLECTION, "GeeAbstractMultiSet", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_type_add_interface_static (gee_abstract_multi_set_type_id, GEE_TYPE_MULTI_SET, &gee_multi_set_info); + g_once_init_leave (&gee_abstract_multi_set_type_id__volatile, gee_abstract_multi_set_type_id); + } + return gee_abstract_multi_set_type_id__volatile; +} + + +static void _vala_gee_abstract_multi_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeAbstractMultiSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSet); + switch (property_id) { + case GEE_ABSTRACT_MULTI_SET_SIZE: + g_value_set_int (value, gee_abstract_collection_get_size ((GeeAbstractCollection*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_abstract_multi_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeAbstractMultiSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSet); + switch (property_id) { + case GEE_ABSTRACT_MULTI_SET_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_ABSTRACT_MULTI_SET_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_ABSTRACT_MULTI_SET_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/gee/abstractmultiset.vala b/gee/abstractmultiset.vala new file mode 100644 index 0000000..6d2a5e5 --- /dev/null +++ b/gee/abstractmultiset.vala @@ -0,0 +1,147 @@ +/* abstractmultiset.vala + * + * Copyright (C) 2009 Ali Sabil + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Ali Sabil + * Didier 'Ptitjes Villevalois + */ + +/** + * Skeletal implementation of the {@link MultiSet} interface. + * + * @see HashMultiSet + * @see TreeMultiSet + */ +public abstract class Gee.AbstractMultiSet : AbstractCollection, MultiSet { + public override int size { + get { return _nitems; } + } + + protected Map _storage_map; + private int _nitems = 0; + + /** + * Constructs a new, empty abstract multi set. + */ + public AbstractMultiSet (Map storage_map) { + this._storage_map = storage_map; + } + + public int count (G item) { + int result = 0; + if (_storage_map.has_key (item)) { + result = _storage_map.get (item); + } + return result; + } + + public override bool contains (G item) { + return _storage_map.has_key (item); + } + + public override Gee.Iterator iterator () { + return new Iterator (this); + } + + public override bool add (G item) { + if (_storage_map.has_key (item)) { + int current_count = _storage_map.get (item); + _storage_map.set (item, current_count + 1); + } else { + _storage_map.set (item, 1); + } + _nitems++; + return true; + } + + public override bool remove (G item) { + if (_nitems > 0 && _storage_map.has_key (item)) { + int current_count = _storage_map.get (item); + if (current_count <= 1) { + _storage_map.unset (item); + } else { + _storage_map.set (item, current_count - 1); + } + _nitems--; + return true; + } + return false; + } + + public override void clear () { + _storage_map.clear (); + _nitems = 0; + } + + private class Iterator : Object, Gee.Iterator { + private AbstractMultiSet _set; + + private MapIterator _iter; + private int _pending = 0; + private bool _removed = false; + + public Iterator (AbstractMultiSet set) { + _set = set; + _iter = _set._storage_map.map_iterator (); + } + + public bool next () { + _removed = false; + if (_pending == 0) { + if (_iter.next ()) { + _pending = _iter.get_value () - 1; + return true; + } + } else { + _pending--; + return true; + } + return false; + } + + public bool has_next () { + return _pending > 0 || _iter.has_next (); + } + + public bool first () { + if (_set._nitems == 0) { + return false; + } + _pending = 0; + if (_iter.first ()) { + _pending = _iter.get_value () - 1; + } + return true; + } + + public new G get () { + assert (! _removed); + return _iter.get_key (); + } + + public void remove () { + assert (! _removed); + _iter.set_value (_pending = _iter.get_value () - 1); + if (_pending == 0) { + _iter.unset (); + } + _set._nitems--; + _removed = true; + } + } +} diff --git a/gee/abstractqueue.c b/gee/abstractqueue.c new file mode 100644 index 0000000..b43bec5 --- /dev/null +++ b/gee/abstractqueue.c @@ -0,0 +1,391 @@ +/* abstractqueue.c generated by valac 0.18.0, the Vala compiler + * generated from abstractqueue.vala, do not modify */ + +/* abstractqueue.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; +typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate; + +#define GEE_TYPE_QUEUE (gee_queue_get_type ()) +#define GEE_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_QUEUE, GeeQueue)) +#define GEE_IS_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_QUEUE)) +#define GEE_QUEUE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_QUEUE, GeeQueueIface)) + +typedef struct _GeeQueue GeeQueue; +typedef struct _GeeQueueIface GeeQueueIface; + +#define GEE_TYPE_ABSTRACT_QUEUE (gee_abstract_queue_get_type ()) +#define GEE_ABSTRACT_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_QUEUE, GeeAbstractQueue)) +#define GEE_ABSTRACT_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_QUEUE, GeeAbstractQueueClass)) +#define GEE_IS_ABSTRACT_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_QUEUE)) +#define GEE_IS_ABSTRACT_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_QUEUE)) +#define GEE_ABSTRACT_QUEUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_QUEUE, GeeAbstractQueueClass)) + +typedef struct _GeeAbstractQueue GeeAbstractQueue; +typedef struct _GeeAbstractQueueClass GeeAbstractQueueClass; +typedef struct _GeeAbstractQueuePrivate GeeAbstractQueuePrivate; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeAbstractCollection { + GObject parent_instance; + GeeAbstractCollectionPrivate * priv; +}; + +struct _GeeAbstractCollectionClass { + GObjectClass parent_class; + gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*add) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item); + void (*clear) (GeeAbstractCollection* self); + gpointer* (*to_array) (GeeAbstractCollection* self, int* result_length1); + gboolean (*add_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeAbstractCollection* self, GeeCollection* collection); + GeeIterator* (*iterator) (GeeAbstractCollection* self); + gint (*get_size) (GeeAbstractCollection* self); + gboolean (*get_is_empty) (GeeAbstractCollection* self); + GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self); +}; + +struct _GeeQueueIface { + GTypeInterface parent_iface; + gboolean (*offer) (GeeQueue* self, gconstpointer element); + gpointer (*peek) (GeeQueue* self); + gpointer (*poll) (GeeQueue* self); + gint (*drain) (GeeQueue* self, GeeCollection* recipient, gint amount); + gint (*get_capacity) (GeeQueue* self); + gint (*get_remaining_capacity) (GeeQueue* self); + gboolean (*get_is_full) (GeeQueue* self); +}; + +struct _GeeAbstractQueue { + GeeAbstractCollection parent_instance; + GeeAbstractQueuePrivate * priv; +}; + +struct _GeeAbstractQueueClass { + GeeAbstractCollectionClass parent_class; + gboolean (*offer) (GeeAbstractQueue* self, gconstpointer element); + gpointer (*peek) (GeeAbstractQueue* self); + gpointer (*poll) (GeeAbstractQueue* self); + gint (*drain) (GeeAbstractQueue* self, GeeCollection* recipient, gint amount); + gint (*get_capacity) (GeeAbstractQueue* self); + gint (*get_remaining_capacity) (GeeAbstractQueue* self); + gboolean (*get_is_full) (GeeAbstractQueue* self); +}; + +struct _GeeAbstractQueuePrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; +}; + + +static gpointer gee_abstract_queue_parent_class = NULL; +static GeeQueueIface* gee_abstract_queue_gee_queue_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_queue_get_type (void) G_GNUC_CONST; +GType gee_abstract_queue_get_type (void) G_GNUC_CONST; +#define GEE_ABSTRACT_QUEUE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_ABSTRACT_QUEUE, GeeAbstractQueuePrivate)) +enum { + GEE_ABSTRACT_QUEUE_DUMMY_PROPERTY, + GEE_ABSTRACT_QUEUE_G_TYPE, + GEE_ABSTRACT_QUEUE_G_DUP_FUNC, + GEE_ABSTRACT_QUEUE_G_DESTROY_FUNC, + GEE_ABSTRACT_QUEUE_CAPACITY, + GEE_ABSTRACT_QUEUE_REMAINING_CAPACITY, + GEE_ABSTRACT_QUEUE_IS_FULL +}; +gboolean gee_abstract_queue_offer (GeeAbstractQueue* self, gconstpointer element); +static gboolean gee_abstract_queue_real_offer (GeeAbstractQueue* self, gconstpointer element); +gpointer gee_abstract_queue_peek (GeeAbstractQueue* self); +static gpointer gee_abstract_queue_real_peek (GeeAbstractQueue* self); +gpointer gee_abstract_queue_poll (GeeAbstractQueue* self); +static gpointer gee_abstract_queue_real_poll (GeeAbstractQueue* self); +gint gee_abstract_queue_drain (GeeAbstractQueue* self, GeeCollection* recipient, gint amount); +static gint gee_abstract_queue_real_drain (GeeAbstractQueue* self, GeeCollection* recipient, gint amount); +GeeAbstractQueue* gee_abstract_queue_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeAbstractCollection* gee_abstract_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +gint gee_abstract_queue_get_capacity (GeeAbstractQueue* self); +gint gee_abstract_queue_get_remaining_capacity (GeeAbstractQueue* self); +gboolean gee_abstract_queue_get_is_full (GeeAbstractQueue* self); +static void _vala_gee_abstract_queue_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_abstract_queue_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +/** + * {@inheritDoc} + */ +static gboolean gee_abstract_queue_real_offer (GeeAbstractQueue* self, gconstpointer element) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_queue_offer'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return FALSE; +} + + +gboolean gee_abstract_queue_offer (GeeAbstractQueue* self, gconstpointer element) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ABSTRACT_QUEUE_GET_CLASS (self)->offer (self, element); +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_abstract_queue_real_peek (GeeAbstractQueue* self) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_queue_peek'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return NULL; +} + + +gpointer gee_abstract_queue_peek (GeeAbstractQueue* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_QUEUE_GET_CLASS (self)->peek (self); +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_abstract_queue_real_poll (GeeAbstractQueue* self) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_queue_poll'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return NULL; +} + + +gpointer gee_abstract_queue_poll (GeeAbstractQueue* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_QUEUE_GET_CLASS (self)->poll (self); +} + + +/** + * {@inheritDoc} + */ +static gint gee_abstract_queue_real_drain (GeeAbstractQueue* self, GeeCollection* recipient, gint amount) { + g_critical ("Type `%s' does not implement abstract method `gee_abstract_queue_drain'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return 0; +} + + +gint gee_abstract_queue_drain (GeeAbstractQueue* self, GeeCollection* recipient, gint amount) { + g_return_val_if_fail (self != NULL, 0); + return GEE_ABSTRACT_QUEUE_GET_CLASS (self)->drain (self, recipient, amount); +} + + +GeeAbstractQueue* gee_abstract_queue_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) { + GeeAbstractQueue * self = NULL; + self = (GeeAbstractQueue*) gee_abstract_collection_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + return self; +} + + +gint gee_abstract_queue_get_capacity (GeeAbstractQueue* self) { + g_return_val_if_fail (self != NULL, 0); + return GEE_ABSTRACT_QUEUE_GET_CLASS (self)->get_capacity (self); +} + + +gint gee_abstract_queue_get_remaining_capacity (GeeAbstractQueue* self) { + g_return_val_if_fail (self != NULL, 0); + return GEE_ABSTRACT_QUEUE_GET_CLASS (self)->get_remaining_capacity (self); +} + + +gboolean gee_abstract_queue_get_is_full (GeeAbstractQueue* self) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ABSTRACT_QUEUE_GET_CLASS (self)->get_is_full (self); +} + + +static void gee_abstract_queue_class_init (GeeAbstractQueueClass * klass) { + gee_abstract_queue_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeAbstractQueuePrivate)); + GEE_ABSTRACT_QUEUE_CLASS (klass)->offer = gee_abstract_queue_real_offer; + GEE_ABSTRACT_QUEUE_CLASS (klass)->peek = gee_abstract_queue_real_peek; + GEE_ABSTRACT_QUEUE_CLASS (klass)->poll = gee_abstract_queue_real_poll; + GEE_ABSTRACT_QUEUE_CLASS (klass)->drain = gee_abstract_queue_real_drain; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_abstract_queue_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_abstract_queue_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_QUEUE_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_QUEUE_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_QUEUE_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_QUEUE_CAPACITY, g_param_spec_int ("capacity", "capacity", "capacity", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_QUEUE_REMAINING_CAPACITY, g_param_spec_int ("remaining-capacity", "remaining-capacity", "remaining-capacity", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_QUEUE_IS_FULL, g_param_spec_boolean ("is-full", "is-full", "is-full", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_abstract_queue_gee_queue_interface_init (GeeQueueIface * iface) { + gee_abstract_queue_gee_queue_parent_iface = g_type_interface_peek_parent (iface); + iface->offer = (gboolean (*)(GeeQueue*, gconstpointer)) gee_abstract_queue_offer; + iface->peek = (gpointer (*)(GeeQueue*)) gee_abstract_queue_peek; + iface->poll = (gpointer (*)(GeeQueue*)) gee_abstract_queue_poll; + iface->drain = (gint (*)(GeeQueue*, GeeCollection*, gint)) gee_abstract_queue_drain; + iface->get_capacity = (gint (*) (GeeQueue *)) gee_abstract_queue_get_capacity; + iface->get_remaining_capacity = (gint (*) (GeeQueue *)) gee_abstract_queue_get_remaining_capacity; + iface->get_is_full = (gboolean (*) (GeeQueue *)) gee_abstract_queue_get_is_full; +} + + +static void gee_abstract_queue_instance_init (GeeAbstractQueue * self) { + self->priv = GEE_ABSTRACT_QUEUE_GET_PRIVATE (self); +} + + +/** + * Skeletal implementation of the {@link Queue} interface. + * + * Contains common code shared by all queue implementations. + * + * @see PriorityQueue + */ +GType gee_abstract_queue_get_type (void) { + static volatile gsize gee_abstract_queue_type_id__volatile = 0; + if (g_once_init_enter (&gee_abstract_queue_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeAbstractQueueClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_abstract_queue_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeAbstractQueue), 0, (GInstanceInitFunc) gee_abstract_queue_instance_init, NULL }; + static const GInterfaceInfo gee_queue_info = { (GInterfaceInitFunc) gee_abstract_queue_gee_queue_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_abstract_queue_type_id; + gee_abstract_queue_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_COLLECTION, "GeeAbstractQueue", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_type_add_interface_static (gee_abstract_queue_type_id, GEE_TYPE_QUEUE, &gee_queue_info); + g_once_init_leave (&gee_abstract_queue_type_id__volatile, gee_abstract_queue_type_id); + } + return gee_abstract_queue_type_id__volatile; +} + + +static void _vala_gee_abstract_queue_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeAbstractQueue * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ABSTRACT_QUEUE, GeeAbstractQueue); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_abstract_queue_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeAbstractQueue * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ABSTRACT_QUEUE, GeeAbstractQueue); + switch (property_id) { + case GEE_ABSTRACT_QUEUE_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_ABSTRACT_QUEUE_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_ABSTRACT_QUEUE_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/gee/abstractqueue.vala b/gee/abstractqueue.vala new file mode 100644 index 0000000..ce3fc3d --- /dev/null +++ b/gee/abstractqueue.vala @@ -0,0 +1,65 @@ +/* abstractqueue.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +/** + * Skeletal implementation of the {@link Queue} interface. + * + * Contains common code shared by all queue implementations. + * + * @see PriorityQueue + */ +public abstract class Gee.AbstractQueue : Gee.AbstractCollection, Queue { + /** + * {@inheritDoc} + */ + public abstract int capacity { get; } + + /** + * {@inheritDoc} + */ + public abstract int remaining_capacity { get; } + + /** + * {@inheritDoc} + */ + public abstract bool is_full { get; } + + /** + * {@inheritDoc} + */ + public abstract bool offer (G element); + + /** + * {@inheritDoc} + */ + public abstract G? peek (); + + /** + * {@inheritDoc} + */ + public abstract G? poll (); + + /** + * {@inheritDoc} + */ + public abstract int drain (Collection recipient, int amount = -1); +} diff --git a/gee/abstractset.c b/gee/abstractset.c new file mode 100644 index 0000000..5e75f24 --- /dev/null +++ b/gee/abstractset.c @@ -0,0 +1,352 @@ +/* abstractset.c generated by valac 0.18.0, the Vala compiler + * generated from abstractset.vala, do not modify */ + +/* abstractset.vala + * + * Copyright (C) 2007 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Julien Peeters + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; +typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_TYPE_ABSTRACT_SET (gee_abstract_set_get_type ()) +#define GEE_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSet)) +#define GEE_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) +#define GEE_IS_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_SET)) +#define GEE_IS_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_SET)) +#define GEE_ABSTRACT_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) + +typedef struct _GeeAbstractSet GeeAbstractSet; +typedef struct _GeeAbstractSetClass GeeAbstractSetClass; +typedef struct _GeeAbstractSetPrivate GeeAbstractSetPrivate; + +#define GEE_TYPE_READ_ONLY_COLLECTION (gee_read_only_collection_get_type ()) +#define GEE_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollection)) +#define GEE_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass)) +#define GEE_IS_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_READ_ONLY_COLLECTION)) +#define GEE_IS_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_READ_ONLY_COLLECTION)) +#define GEE_READ_ONLY_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass)) + +typedef struct _GeeReadOnlyCollection GeeReadOnlyCollection; +typedef struct _GeeReadOnlyCollectionClass GeeReadOnlyCollectionClass; + +#define GEE_TYPE_READ_ONLY_SET (gee_read_only_set_get_type ()) +#define GEE_READ_ONLY_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_READ_ONLY_SET, GeeReadOnlySet)) +#define GEE_READ_ONLY_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_READ_ONLY_SET, GeeReadOnlySetClass)) +#define GEE_IS_READ_ONLY_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_READ_ONLY_SET)) +#define GEE_IS_READ_ONLY_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_READ_ONLY_SET)) +#define GEE_READ_ONLY_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_READ_ONLY_SET, GeeReadOnlySetClass)) + +typedef struct _GeeReadOnlySet GeeReadOnlySet; +typedef struct _GeeReadOnlySetClass GeeReadOnlySetClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeAbstractCollection { + GObject parent_instance; + GeeAbstractCollectionPrivate * priv; +}; + +struct _GeeAbstractCollectionClass { + GObjectClass parent_class; + gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*add) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item); + void (*clear) (GeeAbstractCollection* self); + gpointer* (*to_array) (GeeAbstractCollection* self, int* result_length1); + gboolean (*add_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeAbstractCollection* self, GeeCollection* collection); + GeeIterator* (*iterator) (GeeAbstractCollection* self); + gint (*get_size) (GeeAbstractCollection* self); + gboolean (*get_is_empty) (GeeAbstractCollection* self); + GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeAbstractSet { + GeeAbstractCollection parent_instance; + GeeAbstractSetPrivate * priv; +}; + +struct _GeeAbstractSetClass { + GeeAbstractCollectionClass parent_class; + GeeSet* (*get_read_only_view) (GeeAbstractSet* self); +}; + +struct _GeeAbstractSetPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GeeSet* _read_only_view; +}; + + +static gpointer gee_abstract_set_parent_class = NULL; +static GeeSetIface* gee_abstract_set_gee_set_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_abstract_set_get_type (void) G_GNUC_CONST; +#define GEE_ABSTRACT_SET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetPrivate)) +enum { + GEE_ABSTRACT_SET_DUMMY_PROPERTY, + GEE_ABSTRACT_SET_G_TYPE, + GEE_ABSTRACT_SET_G_DUP_FUNC, + GEE_ABSTRACT_SET_G_DESTROY_FUNC, + GEE_ABSTRACT_SET_READ_ONLY_VIEW +}; +GeeAbstractSet* gee_abstract_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeAbstractCollection* gee_abstract_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeSet* gee_abstract_set_get_read_only_view (GeeAbstractSet* self); +GeeReadOnlySet* gee_read_only_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeSet* set); +GeeReadOnlySet* gee_read_only_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeSet* set); +GType gee_read_only_collection_get_type (void) G_GNUC_CONST; +GType gee_read_only_set_get_type (void) G_GNUC_CONST; +static void gee_abstract_set_finalize (GObject* obj); +static void _vala_gee_abstract_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_abstract_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +GeeAbstractSet* gee_abstract_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) { + GeeAbstractSet * self = NULL; + self = (GeeAbstractSet*) gee_abstract_collection_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + return self; +} + + +GeeSet* gee_abstract_set_get_read_only_view (GeeAbstractSet* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ABSTRACT_SET_GET_CLASS (self)->get_read_only_view (self); +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static GeeSet* gee_abstract_set_real_get_read_only_view (GeeAbstractSet* base) { + GeeSet* result; + GeeAbstractSet* self; + GeeSet* _tmp0_; + GeeSet* _tmp1_; + GeeSet* instance; + GeeSet* _tmp2_; + self = base; + _tmp0_ = self->priv->_read_only_view; + _tmp1_ = _g_object_ref0 (_tmp0_); + instance = _tmp1_; + _tmp2_ = self->priv->_read_only_view; + if (_tmp2_ == NULL) { + GeeReadOnlySet* _tmp3_; + GeeSet* _tmp4_; + GeeSet* _tmp5_; + _tmp3_ = gee_read_only_set_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, (GeeSet*) self); + _g_object_unref0 (instance); + instance = (GeeSet*) _tmp3_; + _tmp4_ = instance; + self->priv->_read_only_view = _tmp4_; + _tmp5_ = instance; + g_object_add_weak_pointer ((GObject*) _tmp5_, (void**) (&self->priv->_read_only_view)); + } + result = instance; + return result; +} + + +static void gee_abstract_set_class_init (GeeAbstractSetClass * klass) { + gee_abstract_set_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeAbstractSetPrivate)); + GEE_ABSTRACT_SET_CLASS (klass)->get_read_only_view = gee_abstract_set_real_get_read_only_view; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_abstract_set_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_abstract_set_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_abstract_set_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_SET_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_SET_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_SET_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_SET_READ_ONLY_VIEW, g_param_spec_object ("read-only-view", "read-only-view", "read-only-view", GEE_TYPE_SET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_abstract_set_gee_set_interface_init (GeeSetIface * iface) { + gee_abstract_set_gee_set_parent_iface = g_type_interface_peek_parent (iface); + iface->get_read_only_view = (GeeSet* (*) (GeeSet *)) gee_abstract_set_get_read_only_view; +} + + +static void gee_abstract_set_instance_init (GeeAbstractSet * self) { + self->priv = GEE_ABSTRACT_SET_GET_PRIVATE (self); +} + + +static void gee_abstract_set_finalize (GObject* obj) { + GeeAbstractSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_ABSTRACT_SET, GeeAbstractSet); + G_OBJECT_CLASS (gee_abstract_set_parent_class)->finalize (obj); +} + + +/** + * Skeletal implementation of the {@link Set} interface. + * + * Contains common code shared by all set implementations. + * + * @see HashSet + * @see TreeSet + */ +GType gee_abstract_set_get_type (void) { + static volatile gsize gee_abstract_set_type_id__volatile = 0; + if (g_once_init_enter (&gee_abstract_set_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeAbstractSetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_abstract_set_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeAbstractSet), 0, (GInstanceInitFunc) gee_abstract_set_instance_init, NULL }; + static const GInterfaceInfo gee_set_info = { (GInterfaceInitFunc) gee_abstract_set_gee_set_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_abstract_set_type_id; + gee_abstract_set_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_COLLECTION, "GeeAbstractSet", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_type_add_interface_static (gee_abstract_set_type_id, GEE_TYPE_SET, &gee_set_info); + g_once_init_leave (&gee_abstract_set_type_id__volatile, gee_abstract_set_type_id); + } + return gee_abstract_set_type_id__volatile; +} + + +static void _vala_gee_abstract_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeAbstractSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ABSTRACT_SET, GeeAbstractSet); + switch (property_id) { + case GEE_ABSTRACT_SET_READ_ONLY_VIEW: + g_value_take_object (value, gee_abstract_set_get_read_only_view (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_abstract_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeAbstractSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ABSTRACT_SET, GeeAbstractSet); + switch (property_id) { + case GEE_ABSTRACT_SET_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_ABSTRACT_SET_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_ABSTRACT_SET_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/gee/abstractset.vala b/gee/abstractset.vala new file mode 100644 index 0000000..783d978 --- /dev/null +++ b/gee/abstractset.vala @@ -0,0 +1,50 @@ +/* abstractset.vala + * + * Copyright (C) 2007 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Julien Peeters + */ + +/** + * Skeletal implementation of the {@link Set} interface. + * + * Contains common code shared by all set implementations. + * + * @see HashSet + * @see TreeSet + */ +public abstract class Gee.AbstractSet : Gee.AbstractCollection, Set { + + private weak Set _read_only_view; + + /** + * {@inheritDoc} + */ + public virtual new Set read_only_view { + owned get { + Set instance = _read_only_view; + if (_read_only_view == null) { + instance = new ReadOnlySet (this); + _read_only_view = instance; + instance.add_weak_pointer ((void**) (&_read_only_view)); + } + return instance; + } + } +} diff --git a/gee/arraylist.c b/gee/arraylist.c new file mode 100644 index 0000000..6b5e6c6 --- /dev/null +++ b/gee/arraylist.c @@ -0,0 +1,1766 @@ +/* arraylist.c generated by valac 0.18.0, the Vala compiler + * generated from arraylist.vala, do not modify */ + +/* arraylist.vala + * + * Copyright (C) 2004-2005 Novell, Inc + * Copyright (C) 2005 David Waite + * Copyright (C) 2007-2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes Villevalois + */ + +#include +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; +typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate; + +#define GEE_TYPE_LIST (gee_list_get_type ()) +#define GEE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST, GeeList)) +#define GEE_IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST)) +#define GEE_LIST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST, GeeListIface)) + +typedef struct _GeeList GeeList; +typedef struct _GeeListIface GeeListIface; + +#define GEE_TYPE_BIDIR_ITERATOR (gee_bidir_iterator_get_type ()) +#define GEE_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIterator)) +#define GEE_IS_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_ITERATOR)) +#define GEE_BIDIR_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIteratorIface)) + +typedef struct _GeeBidirIterator GeeBidirIterator; +typedef struct _GeeBidirIteratorIface GeeBidirIteratorIface; + +#define GEE_TYPE_LIST_ITERATOR (gee_list_iterator_get_type ()) +#define GEE_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIterator)) +#define GEE_IS_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST_ITERATOR)) +#define GEE_LIST_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIteratorIface)) + +typedef struct _GeeListIterator GeeListIterator; +typedef struct _GeeListIteratorIface GeeListIteratorIface; + +#define GEE_TYPE_ABSTRACT_LIST (gee_abstract_list_get_type ()) +#define GEE_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractList)) +#define GEE_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass)) +#define GEE_IS_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_LIST)) +#define GEE_IS_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_LIST)) +#define GEE_ABSTRACT_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass)) + +typedef struct _GeeAbstractList GeeAbstractList; +typedef struct _GeeAbstractListClass GeeAbstractListClass; +typedef struct _GeeAbstractListPrivate GeeAbstractListPrivate; + +#define GEE_TYPE_ARRAY_LIST (gee_array_list_get_type ()) +#define GEE_ARRAY_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ARRAY_LIST, GeeArrayList)) +#define GEE_ARRAY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ARRAY_LIST, GeeArrayListClass)) +#define GEE_IS_ARRAY_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ARRAY_LIST)) +#define GEE_IS_ARRAY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ARRAY_LIST)) +#define GEE_ARRAY_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ARRAY_LIST, GeeArrayListClass)) + +typedef struct _GeeArrayList GeeArrayList; +typedef struct _GeeArrayListClass GeeArrayListClass; +typedef struct _GeeArrayListPrivate GeeArrayListPrivate; + +#define GEE_ARRAY_LIST_TYPE_ITERATOR (gee_array_list_iterator_get_type ()) +#define GEE_ARRAY_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_ARRAY_LIST_TYPE_ITERATOR, GeeArrayListIterator)) +#define GEE_ARRAY_LIST_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_ARRAY_LIST_TYPE_ITERATOR, GeeArrayListIteratorClass)) +#define GEE_ARRAY_LIST_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_ARRAY_LIST_TYPE_ITERATOR)) +#define GEE_ARRAY_LIST_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_ARRAY_LIST_TYPE_ITERATOR)) +#define GEE_ARRAY_LIST_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_ARRAY_LIST_TYPE_ITERATOR, GeeArrayListIteratorClass)) + +typedef struct _GeeArrayListIterator GeeArrayListIterator; +typedef struct _GeeArrayListIteratorClass GeeArrayListIteratorClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +typedef struct _GeeArrayListIteratorPrivate GeeArrayListIteratorPrivate; +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeAbstractCollection { + GObject parent_instance; + GeeAbstractCollectionPrivate * priv; +}; + +struct _GeeAbstractCollectionClass { + GObjectClass parent_class; + gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*add) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item); + void (*clear) (GeeAbstractCollection* self); + gpointer* (*to_array) (GeeAbstractCollection* self, int* result_length1); + gboolean (*add_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeAbstractCollection* self, GeeCollection* collection); + GeeIterator* (*iterator) (GeeAbstractCollection* self); + gint (*get_size) (GeeAbstractCollection* self); + gboolean (*get_is_empty) (GeeAbstractCollection* self); + GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self); +}; + +struct _GeeBidirIteratorIface { + GTypeInterface parent_iface; + gboolean (*previous) (GeeBidirIterator* self); + gboolean (*has_previous) (GeeBidirIterator* self); + gboolean (*last) (GeeBidirIterator* self); +}; + +struct _GeeListIteratorIface { + GTypeInterface parent_iface; + void (*set) (GeeListIterator* self, gconstpointer item); + void (*insert) (GeeListIterator* self, gconstpointer item); + void (*add) (GeeListIterator* self, gconstpointer item); + gint (*index) (GeeListIterator* self); +}; + +struct _GeeListIface { + GTypeInterface parent_iface; + GeeListIterator* (*list_iterator) (GeeList* self); + gpointer (*get) (GeeList* self, gint index); + void (*set) (GeeList* self, gint index, gconstpointer item); + gint (*index_of) (GeeList* self, gconstpointer item); + void (*insert) (GeeList* self, gint index, gconstpointer item); + gpointer (*remove_at) (GeeList* self, gint index); + GeeList* (*slice) (GeeList* self, gint start, gint stop); + gpointer (*first) (GeeList* self); + gpointer (*last) (GeeList* self); + void (*insert_all) (GeeList* self, gint index, GeeCollection* collection); + void (*sort) (GeeList* self, GCompareFunc compare_func); + GeeList* (*get_read_only_view) (GeeList* self); +}; + +struct _GeeAbstractList { + GeeAbstractCollection parent_instance; + GeeAbstractListPrivate * priv; +}; + +struct _GeeAbstractListClass { + GeeAbstractCollectionClass parent_class; + GeeListIterator* (*list_iterator) (GeeAbstractList* self); + gpointer (*get) (GeeAbstractList* self, gint index); + void (*set) (GeeAbstractList* self, gint index, gconstpointer item); + gint (*index_of) (GeeAbstractList* self, gconstpointer item); + void (*insert) (GeeAbstractList* self, gint index, gconstpointer item); + gpointer (*remove_at) (GeeAbstractList* self, gint index); + GeeList* (*slice) (GeeAbstractList* self, gint start, gint stop); + gpointer (*first) (GeeAbstractList* self); + gpointer (*last) (GeeAbstractList* self); + void (*insert_all) (GeeAbstractList* self, gint index, GeeCollection* collection); + GeeList* (*get_read_only_view) (GeeAbstractList* self); +}; + +struct _GeeArrayList { + GeeAbstractList parent_instance; + GeeArrayListPrivate * priv; + gpointer* _items; + gint _items_length1; + gint __items_size_; + gint _size; +}; + +struct _GeeArrayListClass { + GeeAbstractListClass parent_class; +}; + +struct _GeeArrayListPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GEqualFunc _equal_func; + gint _stamp; +}; + +struct _GeeArrayListIterator { + GObject parent_instance; + GeeArrayListIteratorPrivate * priv; +}; + +struct _GeeArrayListIteratorClass { + GObjectClass parent_class; +}; + +struct _GeeArrayListIteratorPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GeeArrayList* _list; + gint _index; + gboolean _removed; + gint _stamp; +}; + + +static gpointer gee_array_list_parent_class = NULL; +static gpointer gee_array_list_iterator_parent_class = NULL; +static GeeIteratorIface* gee_array_list_iterator_gee_iterator_parent_iface = NULL; +static GeeBidirIteratorIface* gee_array_list_iterator_gee_bidir_iterator_parent_iface = NULL; +static GeeListIteratorIface* gee_array_list_iterator_gee_list_iterator_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_bidir_iterator_get_type (void) G_GNUC_CONST; +GType gee_list_iterator_get_type (void) G_GNUC_CONST; +GType gee_list_get_type (void) G_GNUC_CONST; +GType gee_abstract_list_get_type (void) G_GNUC_CONST; +GType gee_array_list_get_type (void) G_GNUC_CONST; +#define GEE_ARRAY_LIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_ARRAY_LIST, GeeArrayListPrivate)) +enum { + GEE_ARRAY_LIST_DUMMY_PROPERTY, + GEE_ARRAY_LIST_G_TYPE, + GEE_ARRAY_LIST_G_DUP_FUNC, + GEE_ARRAY_LIST_G_DESTROY_FUNC, + GEE_ARRAY_LIST_SIZE, + GEE_ARRAY_LIST_EQUAL_FUNC +}; +GeeArrayList* gee_array_list_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func); +GeeArrayList* gee_array_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func); +GeeAbstractList* gee_abstract_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GEqualFunc gee_functions_get_equal_func_for (GType t); +static void gee_array_list_set_equal_func (GeeArrayList* self, GEqualFunc value); +static GeeIterator* gee_array_list_real_iterator (GeeAbstractCollection* base); +static GeeArrayListIterator* gee_array_list_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeArrayList* list); +static GeeArrayListIterator* gee_array_list_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeArrayList* list); +static GType gee_array_list_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static GeeListIterator* gee_array_list_real_list_iterator (GeeAbstractList* base); +static gboolean gee_array_list_real_contains (GeeAbstractCollection* base, gconstpointer item); +gint gee_abstract_list_index_of (GeeAbstractList* self, gconstpointer item); +static gint gee_array_list_real_index_of (GeeAbstractList* base, gconstpointer item); +GEqualFunc gee_array_list_get_equal_func (GeeArrayList* self); +static gpointer gee_array_list_real_get (GeeAbstractList* base, gint index); +static void gee_array_list_real_set (GeeAbstractList* base, gint index, gconstpointer item); +static gboolean gee_array_list_real_add (GeeAbstractCollection* base, gconstpointer item); +static void gee_array_list_grow_if_needed (GeeArrayList* self, gint new_count); +static void gee_array_list_real_insert (GeeAbstractList* base, gint index, gconstpointer item); +static void gee_array_list_shift (GeeArrayList* self, gint start, gint delta); +static gboolean gee_array_list_real_remove (GeeAbstractCollection* base, gconstpointer item); +gpointer gee_abstract_list_remove_at (GeeAbstractList* self, gint index); +static gpointer gee_array_list_real_remove_at (GeeAbstractList* base, gint index); +static void gee_array_list_real_clear (GeeAbstractCollection* base); +static GeeList* gee_array_list_real_slice (GeeAbstractList* base, gint start, gint stop); +gboolean gee_abstract_collection_add (GeeAbstractCollection* self, gconstpointer item); +gpointer gee_abstract_list_get (GeeAbstractList* self, gint index); +static gboolean gee_array_list_real_add_all (GeeAbstractCollection* base, GeeCollection* collection); +gboolean gee_collection_get_is_empty (GeeCollection* self); +gint gee_collection_get_size (GeeCollection* self); +GeeIterator* gee_iterable_iterator (GeeIterable* self); +gboolean gee_iterator_next (GeeIterator* self); +gpointer gee_iterator_get (GeeIterator* self); +void gee_array_list_sort_with_data (GeeArrayList* self, GCompareDataFunc compare, void* compare_target); +void gee_tim_sort_sort_with_data (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareDataFunc compare_data, void* compare_data_target); +static void gee_array_list_set_capacity (GeeArrayList* self, gint value); +#define GEE_ARRAY_LIST_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_ARRAY_LIST_TYPE_ITERATOR, GeeArrayListIteratorPrivate)) +enum { + GEE_ARRAY_LIST_ITERATOR_DUMMY_PROPERTY, + GEE_ARRAY_LIST_ITERATOR_G_TYPE, + GEE_ARRAY_LIST_ITERATOR_G_DUP_FUNC, + GEE_ARRAY_LIST_ITERATOR_G_DESTROY_FUNC +}; +static gboolean gee_array_list_iterator_real_next (GeeIterator* base); +static gboolean gee_array_list_iterator_real_has_next (GeeIterator* base); +static gboolean gee_array_list_iterator_real_first (GeeIterator* base); +gint gee_abstract_collection_get_size (GeeAbstractCollection* self); +static gpointer gee_array_list_iterator_real_get (GeeIterator* base); +static void gee_array_list_iterator_real_remove (GeeIterator* base); +static gboolean gee_array_list_iterator_real_previous (GeeBidirIterator* base); +static gboolean gee_array_list_iterator_real_has_previous (GeeBidirIterator* base); +static gboolean gee_array_list_iterator_real_last (GeeBidirIterator* base); +static void gee_array_list_iterator_real_set (GeeListIterator* base, gconstpointer item); +static void gee_array_list_iterator_real_insert (GeeListIterator* base, gconstpointer item); +void gee_abstract_list_insert (GeeAbstractList* self, gint index, gconstpointer item); +static void gee_array_list_iterator_real_add (GeeListIterator* base, gconstpointer item); +static gint gee_array_list_iterator_real_index (GeeListIterator* base); +static void gee_array_list_iterator_finalize (GObject* obj); +static void _vala_gee_array_list_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_array_list_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void gee_array_list_finalize (GObject* obj); +static void _vala_gee_array_list_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_array_list_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_move (gpointer array, gsize element_size, gint src, gint dest, gint length); + + +/** + * Constructs a new, empty array list. + * + * If not provided, the function parameter is requested to the + * {@link Functions} function factory methods. + * + * @param equal_func an optional element equality testing function + */ +GeeArrayList* gee_array_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func) { + GeeArrayList * self = NULL; + GEqualFunc _tmp0_; + GEqualFunc _tmp2_; + self = (GeeArrayList*) gee_abstract_list_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = equal_func; + if (_tmp0_ == NULL) { + GEqualFunc _tmp1_ = NULL; + _tmp1_ = gee_functions_get_equal_func_for (g_type); + equal_func = _tmp1_; + } + _tmp2_ = equal_func; + gee_array_list_set_equal_func (self, _tmp2_); + return self; +} + + +GeeArrayList* gee_array_list_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func) { + return gee_array_list_construct (GEE_TYPE_ARRAY_LIST, g_type, g_dup_func, g_destroy_func, equal_func); +} + + +/** + * {@inheritDoc} + */ +static GeeIterator* gee_array_list_real_iterator (GeeAbstractCollection* base) { + GeeArrayList * self; + GeeIterator* result = NULL; + GeeArrayListIterator* _tmp0_; + self = (GeeArrayList*) base; + _tmp0_ = gee_array_list_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, self); + result = (GeeIterator*) _tmp0_; + return result; +} + + +/** + * {@inheritDoc} + */ +static GeeListIterator* gee_array_list_real_list_iterator (GeeAbstractList* base) { + GeeArrayList * self; + GeeListIterator* result = NULL; + GeeArrayListIterator* _tmp0_; + self = (GeeArrayList*) base; + _tmp0_ = gee_array_list_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, self); + result = (GeeListIterator*) _tmp0_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_array_list_real_contains (GeeAbstractCollection* base, gconstpointer item) { + GeeArrayList * self; + gboolean result = FALSE; + gconstpointer _tmp0_; + gint _tmp1_ = 0; + self = (GeeArrayList*) base; + _tmp0_ = item; + _tmp1_ = gee_abstract_list_index_of ((GeeAbstractList*) self, _tmp0_); + result = _tmp1_ != (-1); + return result; +} + + +/** + * {@inheritDoc} + */ +static gint gee_array_list_real_index_of (GeeAbstractList* base, gconstpointer item) { + GeeArrayList * self; + gint result = 0; + self = (GeeArrayList*) base; + { + gint index; + index = 0; + { + gboolean _tmp0_; + _tmp0_ = TRUE; + while (TRUE) { + gboolean _tmp1_; + gint _tmp3_; + gint _tmp4_; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + gpointer* _tmp7_; + gint _tmp7__length1; + gint _tmp8_; + gconstpointer _tmp9_; + gconstpointer _tmp10_; + gboolean _tmp11_ = FALSE; + _tmp1_ = _tmp0_; + if (!_tmp1_) { + gint _tmp2_; + _tmp2_ = index; + index = _tmp2_ + 1; + } + _tmp0_ = FALSE; + _tmp3_ = index; + _tmp4_ = self->_size; + if (!(_tmp3_ < _tmp4_)) { + break; + } + _tmp5_ = gee_array_list_get_equal_func (self); + _tmp6_ = _tmp5_; + _tmp7_ = self->_items; + _tmp7__length1 = self->_items_length1; + _tmp8_ = index; + _tmp9_ = _tmp7_[_tmp8_]; + _tmp10_ = item; + _tmp11_ = _tmp6_ (_tmp9_, _tmp10_); + if (_tmp11_) { + result = index; + return result; + } + } + } + } + result = -1; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_array_list_real_get (GeeAbstractList* base, gint index) { + GeeArrayList * self; + gpointer result = NULL; + gint _tmp0_; + gint _tmp1_; + gint _tmp2_; + gpointer* _tmp3_; + gint _tmp3__length1; + gint _tmp4_; + gconstpointer _tmp5_; + gpointer _tmp6_; + self = (GeeArrayList*) base; + _tmp0_ = index; + _vala_assert (_tmp0_ >= 0, "index >= 0"); + _tmp1_ = index; + _tmp2_ = self->_size; + _vala_assert (_tmp1_ < _tmp2_, "index < _size"); + _tmp3_ = self->_items; + _tmp3__length1 = self->_items_length1; + _tmp4_ = index; + _tmp5_ = _tmp3_[_tmp4_]; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + result = _tmp6_; + return result; +} + + +/** + * {@inheritDoc} + */ +static void gee_array_list_real_set (GeeAbstractList* base, gint index, gconstpointer item) { + GeeArrayList * self; + gint _tmp0_; + gint _tmp1_; + gint _tmp2_; + gpointer* _tmp3_; + gint _tmp3__length1; + gint _tmp4_; + gconstpointer _tmp5_; + gpointer _tmp6_; + gpointer _tmp7_; + self = (GeeArrayList*) base; + _tmp0_ = index; + _vala_assert (_tmp0_ >= 0, "index >= 0"); + _tmp1_ = index; + _tmp2_ = self->_size; + _vala_assert (_tmp1_ < _tmp2_, "index < _size"); + _tmp3_ = self->_items; + _tmp3__length1 = self->_items_length1; + _tmp4_ = index; + _tmp5_ = item; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + ((_tmp3_[_tmp4_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp3_[_tmp4_] = (self->priv->g_destroy_func (_tmp3_[_tmp4_]), NULL)); + _tmp3_[_tmp4_] = _tmp6_; + _tmp7_ = _tmp3_[_tmp4_]; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_array_list_real_add (GeeAbstractCollection* base, gconstpointer item) { + GeeArrayList * self; + gboolean result = FALSE; + gint _tmp0_; + gpointer* _tmp1_; + gint _tmp1__length1; + gpointer* _tmp2_; + gint _tmp2__length1; + gint _tmp3_; + gconstpointer _tmp4_; + gpointer _tmp5_; + gpointer _tmp6_; + gint _tmp7_; + self = (GeeArrayList*) base; + _tmp0_ = self->_size; + _tmp1_ = self->_items; + _tmp1__length1 = self->_items_length1; + if (_tmp0_ == _tmp1__length1) { + gee_array_list_grow_if_needed (self, 1); + } + _tmp2_ = self->_items; + _tmp2__length1 = self->_items_length1; + _tmp3_ = self->_size; + self->_size = _tmp3_ + 1; + _tmp4_ = item; + _tmp5_ = ((_tmp4_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp4_) : ((gpointer) _tmp4_); + ((_tmp2_[_tmp3_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp2_[_tmp3_] = (self->priv->g_destroy_func (_tmp2_[_tmp3_]), NULL)); + _tmp2_[_tmp3_] = _tmp5_; + _tmp6_ = _tmp2_[_tmp3_]; + _tmp7_ = self->priv->_stamp; + self->priv->_stamp = _tmp7_ + 1; + result = TRUE; + return result; +} + + +/** + * {@inheritDoc} + */ +static void gee_array_list_real_insert (GeeAbstractList* base, gint index, gconstpointer item) { + GeeArrayList * self; + gint _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint _tmp3_; + gpointer* _tmp4_; + gint _tmp4__length1; + gint _tmp5_; + gpointer* _tmp6_; + gint _tmp6__length1; + gint _tmp7_; + gconstpointer _tmp8_; + gpointer _tmp9_; + gpointer _tmp10_; + gint _tmp11_; + self = (GeeArrayList*) base; + _tmp0_ = index; + _vala_assert (_tmp0_ >= 0, "index >= 0"); + _tmp1_ = index; + _tmp2_ = self->_size; + _vala_assert (_tmp1_ <= _tmp2_, "index <= _size"); + _tmp3_ = self->_size; + _tmp4_ = self->_items; + _tmp4__length1 = self->_items_length1; + if (_tmp3_ == _tmp4__length1) { + gee_array_list_grow_if_needed (self, 1); + } + _tmp5_ = index; + gee_array_list_shift (self, _tmp5_, 1); + _tmp6_ = self->_items; + _tmp6__length1 = self->_items_length1; + _tmp7_ = index; + _tmp8_ = item; + _tmp9_ = ((_tmp8_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp8_) : ((gpointer) _tmp8_); + ((_tmp6_[_tmp7_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp6_[_tmp7_] = (self->priv->g_destroy_func (_tmp6_[_tmp7_]), NULL)); + _tmp6_[_tmp7_] = _tmp9_; + _tmp10_ = _tmp6_[_tmp7_]; + _tmp11_ = self->priv->_stamp; + self->priv->_stamp = _tmp11_ + 1; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_array_list_real_remove (GeeAbstractCollection* base, gconstpointer item) { + GeeArrayList * self; + gboolean result = FALSE; + self = (GeeArrayList*) base; + { + gint index; + index = 0; + { + gboolean _tmp0_; + _tmp0_ = TRUE; + while (TRUE) { + gboolean _tmp1_; + gint _tmp3_; + gint _tmp4_; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + gpointer* _tmp7_; + gint _tmp7__length1; + gint _tmp8_; + gconstpointer _tmp9_; + gconstpointer _tmp10_; + gboolean _tmp11_ = FALSE; + _tmp1_ = _tmp0_; + if (!_tmp1_) { + gint _tmp2_; + _tmp2_ = index; + index = _tmp2_ + 1; + } + _tmp0_ = FALSE; + _tmp3_ = index; + _tmp4_ = self->_size; + if (!(_tmp3_ < _tmp4_)) { + break; + } + _tmp5_ = gee_array_list_get_equal_func (self); + _tmp6_ = _tmp5_; + _tmp7_ = self->_items; + _tmp7__length1 = self->_items_length1; + _tmp8_ = index; + _tmp9_ = _tmp7_[_tmp8_]; + _tmp10_ = item; + _tmp11_ = _tmp6_ (_tmp9_, _tmp10_); + if (_tmp11_) { + gint _tmp12_; + gpointer _tmp13_ = NULL; + gpointer _tmp14_; + _tmp12_ = index; + _tmp13_ = gee_abstract_list_remove_at ((GeeAbstractList*) self, _tmp12_); + _tmp14_ = _tmp13_; + ((_tmp14_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp14_ = (self->priv->g_destroy_func (_tmp14_), NULL)); + result = TRUE; + return result; + } + } + } + } + result = FALSE; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_array_list_real_remove_at (GeeAbstractList* base, gint index) { + GeeArrayList * self; + gpointer result = NULL; + gint _tmp0_; + gint _tmp1_; + gint _tmp2_; + gpointer* _tmp3_; + gint _tmp3__length1; + gint _tmp4_; + gconstpointer _tmp5_; + gpointer _tmp6_; + gpointer item; + gpointer* _tmp7_; + gint _tmp7__length1; + gint _tmp8_; + gpointer _tmp9_; + gint _tmp10_; + gint _tmp11_; + self = (GeeArrayList*) base; + _tmp0_ = index; + _vala_assert (_tmp0_ >= 0, "index >= 0"); + _tmp1_ = index; + _tmp2_ = self->_size; + _vala_assert (_tmp1_ < _tmp2_, "index < _size"); + _tmp3_ = self->_items; + _tmp3__length1 = self->_items_length1; + _tmp4_ = index; + _tmp5_ = _tmp3_[_tmp4_]; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + item = _tmp6_; + _tmp7_ = self->_items; + _tmp7__length1 = self->_items_length1; + _tmp8_ = index; + ((_tmp7_[_tmp8_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp7_[_tmp8_] = (self->priv->g_destroy_func (_tmp7_[_tmp8_]), NULL)); + _tmp7_[_tmp8_] = NULL; + _tmp9_ = _tmp7_[_tmp8_]; + _tmp10_ = index; + gee_array_list_shift (self, _tmp10_ + 1, -1); + _tmp11_ = self->priv->_stamp; + self->priv->_stamp = _tmp11_ + 1; + result = item; + return result; +} + + +/** + * {@inheritDoc} + */ +static void gee_array_list_real_clear (GeeAbstractCollection* base) { + GeeArrayList * self; + gint _tmp8_; + self = (GeeArrayList*) base; + { + gint index; + index = 0; + { + gboolean _tmp0_; + _tmp0_ = TRUE; + while (TRUE) { + gboolean _tmp1_; + gint _tmp3_; + gint _tmp4_; + gpointer* _tmp5_; + gint _tmp5__length1; + gint _tmp6_; + gpointer _tmp7_; + _tmp1_ = _tmp0_; + if (!_tmp1_) { + gint _tmp2_; + _tmp2_ = index; + index = _tmp2_ + 1; + } + _tmp0_ = FALSE; + _tmp3_ = index; + _tmp4_ = self->_size; + if (!(_tmp3_ < _tmp4_)) { + break; + } + _tmp5_ = self->_items; + _tmp5__length1 = self->_items_length1; + _tmp6_ = index; + ((_tmp5_[_tmp6_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp5_[_tmp6_] = (self->priv->g_destroy_func (_tmp5_[_tmp6_]), NULL)); + _tmp5_[_tmp6_] = NULL; + _tmp7_ = _tmp5_[_tmp6_]; + } + } + } + self->_size = 0; + _tmp8_ = self->priv->_stamp; + self->priv->_stamp = _tmp8_ + 1; +} + + +/** + * {@inheritDoc} + */ +static GeeList* gee_array_list_real_slice (GeeAbstractList* base, gint start, gint stop) { + GeeArrayList * self; + GeeList* result = NULL; + gint _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint _tmp3_; + gint _tmp4_; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + GeeArrayList* _tmp7_; + GeeArrayList* slice; + self = (GeeArrayList*) base; + _tmp0_ = start; + _tmp1_ = stop; + g_return_val_if_fail (_tmp0_ <= _tmp1_, NULL); + _tmp2_ = start; + g_return_val_if_fail (_tmp2_ >= 0, NULL); + _tmp3_ = stop; + _tmp4_ = self->_size; + g_return_val_if_fail (_tmp3_ <= _tmp4_, NULL); + _tmp5_ = gee_array_list_get_equal_func (self); + _tmp6_ = _tmp5_; + _tmp7_ = gee_array_list_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp6_); + slice = _tmp7_; + { + gint _tmp8_; + gint i; + _tmp8_ = start; + i = _tmp8_; + { + gboolean _tmp9_; + _tmp9_ = TRUE; + while (TRUE) { + gboolean _tmp10_; + gint _tmp12_; + gint _tmp13_; + GeeArrayList* _tmp14_; + gint _tmp15_; + gpointer _tmp16_ = NULL; + gpointer _tmp17_; + _tmp10_ = _tmp9_; + if (!_tmp10_) { + gint _tmp11_; + _tmp11_ = i; + i = _tmp11_ + 1; + } + _tmp9_ = FALSE; + _tmp12_ = i; + _tmp13_ = stop; + if (!(_tmp12_ < _tmp13_)) { + break; + } + _tmp14_ = slice; + _tmp15_ = i; + _tmp16_ = gee_abstract_list_get ((GeeAbstractList*) self, _tmp15_); + _tmp17_ = _tmp16_; + gee_abstract_collection_add ((GeeAbstractCollection*) _tmp14_, _tmp17_); + ((_tmp17_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp17_ = (self->priv->g_destroy_func (_tmp17_), NULL)); + } + } + } + result = (GeeList*) slice; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_array_list_real_add_all (GeeAbstractCollection* base, GeeCollection* collection) { + GeeArrayList * self; + gboolean result = FALSE; + GeeCollection* _tmp0_; + gboolean _tmp1_; + gboolean _tmp2_; + GeeCollection* _tmp3_; + gint _tmp4_; + gint _tmp5_; + gint _tmp17_; + self = (GeeArrayList*) base; + g_return_val_if_fail (collection != NULL, FALSE); + _tmp0_ = collection; + _tmp1_ = gee_collection_get_is_empty (_tmp0_); + _tmp2_ = _tmp1_; + if (_tmp2_) { + result = FALSE; + return result; + } + _tmp3_ = collection; + _tmp4_ = gee_collection_get_size (_tmp3_); + _tmp5_ = _tmp4_; + gee_array_list_grow_if_needed (self, _tmp5_); + { + GeeCollection* _tmp6_; + GeeIterator* _tmp7_ = NULL; + GeeIterator* _item_it; + _tmp6_ = collection; + _tmp7_ = gee_iterable_iterator ((GeeIterable*) _tmp6_); + _item_it = _tmp7_; + while (TRUE) { + GeeIterator* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeIterator* _tmp10_; + gpointer _tmp11_ = NULL; + gpointer item; + gpointer* _tmp12_; + gint _tmp12__length1; + gint _tmp13_; + gconstpointer _tmp14_; + gpointer _tmp15_; + gpointer _tmp16_; + _tmp8_ = _item_it; + _tmp9_ = gee_iterator_next (_tmp8_); + if (!_tmp9_) { + break; + } + _tmp10_ = _item_it; + _tmp11_ = gee_iterator_get (_tmp10_); + item = _tmp11_; + _tmp12_ = self->_items; + _tmp12__length1 = self->_items_length1; + _tmp13_ = self->_size; + self->_size = _tmp13_ + 1; + _tmp14_ = item; + _tmp15_ = ((_tmp14_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp14_) : ((gpointer) _tmp14_); + ((_tmp12_[_tmp13_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp12_[_tmp13_] = (self->priv->g_destroy_func (_tmp12_[_tmp13_]), NULL)); + _tmp12_[_tmp13_] = _tmp15_; + _tmp16_ = _tmp12_[_tmp13_]; + ((item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (item = (self->priv->g_destroy_func (item), NULL)); + } + _g_object_unref0 (_item_it); + } + _tmp17_ = self->priv->_stamp; + self->priv->_stamp = _tmp17_ + 1; + result = TRUE; + return result; +} + + +/** + * Sorts items by comparing with the specified compare function. + * + * @deprecated This method has only been added as hack and will be + * deprecated after the next odd minor version bump (>= 0.7.x). + * + * @param compare_func compare function to use to compare items + */ +void gee_array_list_sort_with_data (GeeArrayList* self, GCompareDataFunc compare, void* compare_target) { + GCompareDataFunc _tmp0_; + void* _tmp0__target; + g_return_if_fail (self != NULL); + _tmp0_ = compare; + _tmp0__target = compare_target; + gee_tim_sort_sort_with_data (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, (GeeList*) self, _tmp0_, _tmp0__target); +} + + +static void gee_array_list_shift (GeeArrayList* self, gint start, gint delta) { + gint _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint _tmp3_; + gint _tmp4_; + gint _tmp5_; + gint _tmp6_; + gint _tmp7_; + gint _tmp8_; + gint _tmp9_; + gint _tmp10_; + gint _tmp11_; + g_return_if_fail (self != NULL); + _tmp0_ = start; + _vala_assert (_tmp0_ >= 0, "start >= 0"); + _tmp1_ = start; + _tmp2_ = self->_size; + _vala_assert (_tmp1_ <= _tmp2_, "start <= _size"); + _tmp3_ = start; + _tmp4_ = delta; + _vala_assert (_tmp3_ >= (-_tmp4_), "start >= -delta"); + _tmp5_ = start; + _tmp6_ = start; + _tmp7_ = delta; + _tmp8_ = self->_size; + _tmp9_ = start; + _vala_array_move (self->_items, sizeof (gpointer), _tmp5_, _tmp6_ + _tmp7_, _tmp8_ - _tmp9_); + _tmp10_ = self->_size; + _tmp11_ = delta; + self->_size = _tmp10_ + _tmp11_; +} + + +static void gee_array_list_grow_if_needed (GeeArrayList* self, gint new_count) { + gint _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint minimum_size; + gint _tmp3_; + gpointer* _tmp4_; + gint _tmp4__length1; + g_return_if_fail (self != NULL); + _tmp0_ = new_count; + _vala_assert (_tmp0_ >= 0, "new_count >= 0"); + _tmp1_ = self->_size; + _tmp2_ = new_count; + minimum_size = _tmp1_ + _tmp2_; + _tmp3_ = minimum_size; + _tmp4_ = self->_items; + _tmp4__length1 = self->_items_length1; + if (_tmp3_ > _tmp4__length1) { + gint _tmp5_ = 0; + gint _tmp6_; + gpointer* _tmp7_; + gint _tmp7__length1; + gint _tmp10_; + _tmp6_ = new_count; + _tmp7_ = self->_items; + _tmp7__length1 = self->_items_length1; + if (_tmp6_ > _tmp7__length1) { + gint _tmp8_; + _tmp8_ = minimum_size; + _tmp5_ = _tmp8_; + } else { + gpointer* _tmp9_; + gint _tmp9__length1; + _tmp9_ = self->_items; + _tmp9__length1 = self->_items_length1; + _tmp5_ = 2 * _tmp9__length1; + } + _tmp10_ = _tmp5_; + gee_array_list_set_capacity (self, _tmp10_); + } +} + + +static void gee_array_list_set_capacity (GeeArrayList* self, gint value) { + gint _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint _tmp3_ = 0; + g_return_if_fail (self != NULL); + _tmp0_ = value; + _tmp1_ = self->_size; + _vala_assert (_tmp0_ >= _tmp1_, "value >= _size"); + _tmp2_ = value; + _tmp3_ = _tmp2_; + self->_items = g_renew (gpointer, self->_items, _tmp2_); + (_tmp3_ > self->_items_length1) ? memset (self->_items + self->_items_length1, 0, sizeof (gpointer) * (_tmp3_ - self->_items_length1)) : NULL; + self->_items_length1 = _tmp3_; + self->__items_size_ = _tmp3_; +} + + +static gint gee_array_list_real_get_size (GeeAbstractCollection* base) { + gint result; + GeeArrayList* self; + gint _tmp0_; + self = (GeeArrayList*) base; + _tmp0_ = self->_size; + result = _tmp0_; + return result; +} + + +GEqualFunc gee_array_list_get_equal_func (GeeArrayList* self) { + GEqualFunc result; + GEqualFunc _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->_equal_func; + result = _tmp0_; + return result; +} + + +static void gee_array_list_set_equal_func (GeeArrayList* self, GEqualFunc value) { + GEqualFunc _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = value; + self->priv->_equal_func = _tmp0_; + g_object_notify ((GObject *) self, "equal-func"); +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static GeeArrayListIterator* gee_array_list_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeArrayList* list) { + GeeArrayListIterator * self = NULL; + GeeArrayList* _tmp0_; + GeeArrayList* _tmp1_; + GeeArrayList* _tmp2_; + gint _tmp3_; + g_return_val_if_fail (list != NULL, NULL); + self = (GeeArrayListIterator*) g_object_new (object_type, NULL); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = list; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->_list); + self->priv->_list = _tmp1_; + _tmp2_ = self->priv->_list; + _tmp3_ = _tmp2_->priv->_stamp; + self->priv->_stamp = _tmp3_; + return self; +} + + +static GeeArrayListIterator* gee_array_list_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeArrayList* list) { + return gee_array_list_iterator_construct (GEE_ARRAY_LIST_TYPE_ITERATOR, g_type, g_dup_func, g_destroy_func, list); +} + + +static gboolean gee_array_list_iterator_real_next (GeeIterator* base) { + GeeArrayListIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeArrayList* _tmp1_; + gint _tmp2_; + gint _tmp3_; + GeeArrayList* _tmp4_; + gint _tmp5_; + self = (GeeArrayListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp"); + _tmp3_ = self->priv->_index; + _tmp4_ = self->priv->_list; + _tmp5_ = _tmp4_->_size; + if ((_tmp3_ + 1) < _tmp5_) { + gint _tmp6_; + _tmp6_ = self->priv->_index; + self->priv->_index = _tmp6_ + 1; + self->priv->_removed = FALSE; + result = TRUE; + return result; + } + result = FALSE; + return result; +} + + +static gboolean gee_array_list_iterator_real_has_next (GeeIterator* base) { + GeeArrayListIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeArrayList* _tmp1_; + gint _tmp2_; + gint _tmp3_; + GeeArrayList* _tmp4_; + gint _tmp5_; + self = (GeeArrayListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp"); + _tmp3_ = self->priv->_index; + _tmp4_ = self->priv->_list; + _tmp5_ = _tmp4_->_size; + result = (_tmp3_ + 1) < _tmp5_; + return result; +} + + +static gboolean gee_array_list_iterator_real_first (GeeIterator* base) { + GeeArrayListIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeArrayList* _tmp1_; + gint _tmp2_; + GeeArrayList* _tmp3_; + gint _tmp4_; + gint _tmp5_; + self = (GeeArrayListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp"); + _tmp3_ = self->priv->_list; + _tmp4_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp3_); + _tmp5_ = _tmp4_; + if (_tmp5_ == 0) { + result = FALSE; + return result; + } + self->priv->_index = 0; + self->priv->_removed = FALSE; + result = TRUE; + return result; +} + + +static gpointer gee_array_list_iterator_real_get (GeeIterator* base) { + GeeArrayListIterator * self; + gpointer result = NULL; + gint _tmp0_; + GeeArrayList* _tmp1_; + gint _tmp2_; + gint _tmp3_; + gint _tmp4_; + GeeArrayList* _tmp5_; + gint _tmp6_; + gboolean _tmp7_; + GeeArrayList* _tmp8_; + gpointer* _tmp9_; + gint _tmp9__length1; + gint _tmp10_; + gconstpointer _tmp11_; + gpointer _tmp12_; + self = (GeeArrayListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp"); + _tmp3_ = self->priv->_index; + _vala_assert (_tmp3_ >= 0, "_index >= 0"); + _tmp4_ = self->priv->_index; + _tmp5_ = self->priv->_list; + _tmp6_ = _tmp5_->_size; + _vala_assert (_tmp4_ < _tmp6_, "_index < _list._size"); + _tmp7_ = self->priv->_removed; + _vala_assert (!_tmp7_, "! _removed"); + _tmp8_ = self->priv->_list; + _tmp9_ = _tmp8_->_items; + _tmp9__length1 = _tmp8_->_items_length1; + _tmp10_ = self->priv->_index; + _tmp11_ = _tmp9_[_tmp10_]; + _tmp12_ = ((_tmp11_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp11_) : ((gpointer) _tmp11_); + result = _tmp12_; + return result; +} + + +static void gee_array_list_iterator_real_remove (GeeIterator* base) { + GeeArrayListIterator * self; + gint _tmp0_; + GeeArrayList* _tmp1_; + gint _tmp2_; + gint _tmp3_; + gint _tmp4_; + GeeArrayList* _tmp5_; + gint _tmp6_; + gboolean _tmp7_; + GeeArrayList* _tmp8_; + gint _tmp9_; + gpointer _tmp10_ = NULL; + gpointer _tmp11_; + gint _tmp12_; + GeeArrayList* _tmp13_; + gint _tmp14_; + self = (GeeArrayListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp"); + _tmp3_ = self->priv->_index; + _vala_assert (_tmp3_ >= 0, "_index >= 0"); + _tmp4_ = self->priv->_index; + _tmp5_ = self->priv->_list; + _tmp6_ = _tmp5_->_size; + _vala_assert (_tmp4_ < _tmp6_, "_index < _list._size"); + _tmp7_ = self->priv->_removed; + _vala_assert (!_tmp7_, "! _removed"); + _tmp8_ = self->priv->_list; + _tmp9_ = self->priv->_index; + _tmp10_ = gee_abstract_list_remove_at ((GeeAbstractList*) _tmp8_, _tmp9_); + _tmp11_ = _tmp10_; + ((_tmp11_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp11_ = (self->priv->g_destroy_func (_tmp11_), NULL)); + _tmp12_ = self->priv->_index; + self->priv->_index = _tmp12_ - 1; + self->priv->_removed = TRUE; + _tmp13_ = self->priv->_list; + _tmp14_ = _tmp13_->priv->_stamp; + self->priv->_stamp = _tmp14_; +} + + +static gboolean gee_array_list_iterator_real_previous (GeeBidirIterator* base) { + GeeArrayListIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeArrayList* _tmp1_; + gint _tmp2_; + gint _tmp3_; + self = (GeeArrayListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp"); + _tmp3_ = self->priv->_index; + if (_tmp3_ > 0) { + gint _tmp4_; + _tmp4_ = self->priv->_index; + self->priv->_index = _tmp4_ - 1; + result = TRUE; + return result; + } + result = FALSE; + return result; +} + + +static gboolean gee_array_list_iterator_real_has_previous (GeeBidirIterator* base) { + GeeArrayListIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeArrayList* _tmp1_; + gint _tmp2_; + gint _tmp3_; + self = (GeeArrayListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp"); + _tmp3_ = self->priv->_index; + result = (_tmp3_ - 1) >= 0; + return result; +} + + +static gboolean gee_array_list_iterator_real_last (GeeBidirIterator* base) { + GeeArrayListIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeArrayList* _tmp1_; + gint _tmp2_; + GeeArrayList* _tmp3_; + gint _tmp4_; + gint _tmp5_; + GeeArrayList* _tmp6_; + gint _tmp7_; + self = (GeeArrayListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp"); + _tmp3_ = self->priv->_list; + _tmp4_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp3_); + _tmp5_ = _tmp4_; + if (_tmp5_ == 0) { + result = FALSE; + return result; + } + _tmp6_ = self->priv->_list; + _tmp7_ = _tmp6_->_size; + self->priv->_index = _tmp7_ - 1; + result = TRUE; + return result; +} + + +static void gee_array_list_iterator_real_set (GeeListIterator* base, gconstpointer item) { + GeeArrayListIterator * self; + gint _tmp0_; + GeeArrayList* _tmp1_; + gint _tmp2_; + gint _tmp3_; + gint _tmp4_; + GeeArrayList* _tmp5_; + gint _tmp6_; + GeeArrayList* _tmp7_; + gpointer* _tmp8_; + gint _tmp8__length1; + gint _tmp9_; + gconstpointer _tmp10_; + gpointer _tmp11_; + gpointer _tmp12_; + GeeArrayList* _tmp13_; + GeeArrayList* _tmp14_; + gint _tmp15_; + gint _tmp16_; + self = (GeeArrayListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp"); + _tmp3_ = self->priv->_index; + _vala_assert (_tmp3_ >= 0, "_index >= 0"); + _tmp4_ = self->priv->_index; + _tmp5_ = self->priv->_list; + _tmp6_ = _tmp5_->_size; + _vala_assert (_tmp4_ < _tmp6_, "_index < _list._size"); + _tmp7_ = self->priv->_list; + _tmp8_ = _tmp7_->_items; + _tmp8__length1 = _tmp7_->_items_length1; + _tmp9_ = self->priv->_index; + _tmp10_ = item; + _tmp11_ = ((_tmp10_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp10_) : ((gpointer) _tmp10_); + ((_tmp8_[_tmp9_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp8_[_tmp9_] = (self->priv->g_destroy_func (_tmp8_[_tmp9_]), NULL)); + _tmp8_[_tmp9_] = _tmp11_; + _tmp12_ = _tmp8_[_tmp9_]; + _tmp13_ = self->priv->_list; + _tmp14_ = self->priv->_list; + _tmp15_ = _tmp14_->priv->_stamp; + _tmp14_->priv->_stamp = _tmp15_ + 1; + _tmp16_ = _tmp14_->priv->_stamp; + self->priv->_stamp = _tmp16_; +} + + +static void gee_array_list_iterator_real_insert (GeeListIterator* base, gconstpointer item) { + GeeArrayListIterator * self; + gint _tmp0_; + GeeArrayList* _tmp1_; + gint _tmp2_; + gint _tmp3_; + gint _tmp4_; + GeeArrayList* _tmp5_; + gint _tmp6_; + GeeArrayList* _tmp7_; + gint _tmp8_; + gconstpointer _tmp9_; + gint _tmp10_; + GeeArrayList* _tmp11_; + gint _tmp12_; + self = (GeeArrayListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp"); + _tmp3_ = self->priv->_index; + _vala_assert (_tmp3_ >= 0, "_index >= 0"); + _tmp4_ = self->priv->_index; + _tmp5_ = self->priv->_list; + _tmp6_ = _tmp5_->_size; + _vala_assert (_tmp4_ < _tmp6_, "_index < _list._size"); + _tmp7_ = self->priv->_list; + _tmp8_ = self->priv->_index; + _tmp9_ = item; + gee_abstract_list_insert ((GeeAbstractList*) _tmp7_, _tmp8_, _tmp9_); + _tmp10_ = self->priv->_index; + self->priv->_index = _tmp10_ + 1; + _tmp11_ = self->priv->_list; + _tmp12_ = _tmp11_->priv->_stamp; + self->priv->_stamp = _tmp12_; +} + + +static void gee_array_list_iterator_real_add (GeeListIterator* base, gconstpointer item) { + GeeArrayListIterator * self; + gint _tmp0_; + GeeArrayList* _tmp1_; + gint _tmp2_; + gint _tmp3_; + gint _tmp4_; + GeeArrayList* _tmp5_; + gint _tmp6_; + GeeArrayList* _tmp7_; + gint _tmp8_; + gconstpointer _tmp9_; + gint _tmp10_; + GeeArrayList* _tmp11_; + gint _tmp12_; + self = (GeeArrayListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp"); + _tmp3_ = self->priv->_index; + _vala_assert (_tmp3_ >= 0, "_index >= 0"); + _tmp4_ = self->priv->_index; + _tmp5_ = self->priv->_list; + _tmp6_ = _tmp5_->_size; + _vala_assert (_tmp4_ < _tmp6_, "_index < _list._size"); + _tmp7_ = self->priv->_list; + _tmp8_ = self->priv->_index; + _tmp9_ = item; + gee_abstract_list_insert ((GeeAbstractList*) _tmp7_, _tmp8_ + 1, _tmp9_); + _tmp10_ = self->priv->_index; + self->priv->_index = _tmp10_ + 1; + _tmp11_ = self->priv->_list; + _tmp12_ = _tmp11_->priv->_stamp; + self->priv->_stamp = _tmp12_; +} + + +static gint gee_array_list_iterator_real_index (GeeListIterator* base) { + GeeArrayListIterator * self; + gint result = 0; + gint _tmp0_; + GeeArrayList* _tmp1_; + gint _tmp2_; + gint _tmp3_; + gint _tmp4_; + GeeArrayList* _tmp5_; + gint _tmp6_; + gint _tmp7_; + self = (GeeArrayListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp"); + _tmp3_ = self->priv->_index; + _vala_assert (_tmp3_ >= 0, "_index >= 0"); + _tmp4_ = self->priv->_index; + _tmp5_ = self->priv->_list; + _tmp6_ = _tmp5_->_size; + _vala_assert (_tmp4_ < _tmp6_, "_index < _list._size"); + _tmp7_ = self->priv->_index; + result = _tmp7_; + return result; +} + + +static void gee_array_list_iterator_class_init (GeeArrayListIteratorClass * klass) { + gee_array_list_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeArrayListIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_array_list_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_array_list_iterator_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_array_list_iterator_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ARRAY_LIST_ITERATOR_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ARRAY_LIST_ITERATOR_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ARRAY_LIST_ITERATOR_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_array_list_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) { + gee_array_list_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->next = (gboolean (*)(GeeIterator*)) gee_array_list_iterator_real_next; + iface->has_next = (gboolean (*)(GeeIterator*)) gee_array_list_iterator_real_has_next; + iface->first = (gboolean (*)(GeeIterator*)) gee_array_list_iterator_real_first; + iface->get = (gpointer (*)(GeeIterator*)) gee_array_list_iterator_real_get; + iface->remove = (void (*)(GeeIterator*)) gee_array_list_iterator_real_remove; +} + + +static void gee_array_list_iterator_gee_bidir_iterator_interface_init (GeeBidirIteratorIface * iface) { + gee_array_list_iterator_gee_bidir_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->previous = (gboolean (*)(GeeBidirIterator*)) gee_array_list_iterator_real_previous; + iface->has_previous = (gboolean (*)(GeeBidirIterator*)) gee_array_list_iterator_real_has_previous; + iface->last = (gboolean (*)(GeeBidirIterator*)) gee_array_list_iterator_real_last; +} + + +static void gee_array_list_iterator_gee_list_iterator_interface_init (GeeListIteratorIface * iface) { + gee_array_list_iterator_gee_list_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->set = (void (*)(GeeListIterator*, gconstpointer)) gee_array_list_iterator_real_set; + iface->insert = (void (*)(GeeListIterator*, gconstpointer)) gee_array_list_iterator_real_insert; + iface->add = (void (*)(GeeListIterator*, gconstpointer)) gee_array_list_iterator_real_add; + iface->index = (gint (*)(GeeListIterator*)) gee_array_list_iterator_real_index; +} + + +static void gee_array_list_iterator_instance_init (GeeArrayListIterator * self) { + self->priv = GEE_ARRAY_LIST_ITERATOR_GET_PRIVATE (self); + self->priv->_index = -1; + self->priv->_removed = FALSE; + self->priv->_stamp = 0; +} + + +static void gee_array_list_iterator_finalize (GObject* obj) { + GeeArrayListIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_ARRAY_LIST_TYPE_ITERATOR, GeeArrayListIterator); + _g_object_unref0 (self->priv->_list); + G_OBJECT_CLASS (gee_array_list_iterator_parent_class)->finalize (obj); +} + + +static GType gee_array_list_iterator_get_type (void) { + static volatile gsize gee_array_list_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_array_list_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeArrayListIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_array_list_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeArrayListIterator), 0, (GInstanceInitFunc) gee_array_list_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_array_list_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + static const GInterfaceInfo gee_bidir_iterator_info = { (GInterfaceInitFunc) gee_array_list_iterator_gee_bidir_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + static const GInterfaceInfo gee_list_iterator_info = { (GInterfaceInitFunc) gee_array_list_iterator_gee_list_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_array_list_iterator_type_id; + gee_array_list_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeArrayListIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_array_list_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info); + g_type_add_interface_static (gee_array_list_iterator_type_id, GEE_TYPE_BIDIR_ITERATOR, &gee_bidir_iterator_info); + g_type_add_interface_static (gee_array_list_iterator_type_id, GEE_TYPE_LIST_ITERATOR, &gee_list_iterator_info); + g_once_init_leave (&gee_array_list_iterator_type_id__volatile, gee_array_list_iterator_type_id); + } + return gee_array_list_iterator_type_id__volatile; +} + + +static void _vala_gee_array_list_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeArrayListIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_ARRAY_LIST_TYPE_ITERATOR, GeeArrayListIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_array_list_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeArrayListIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_ARRAY_LIST_TYPE_ITERATOR, GeeArrayListIterator); + switch (property_id) { + case GEE_ARRAY_LIST_ITERATOR_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_ARRAY_LIST_ITERATOR_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_ARRAY_LIST_ITERATOR_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void gee_array_list_class_init (GeeArrayListClass * klass) { + gee_array_list_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeArrayListPrivate)); + GEE_ABSTRACT_COLLECTION_CLASS (klass)->iterator = gee_array_list_real_iterator; + GEE_ABSTRACT_LIST_CLASS (klass)->list_iterator = gee_array_list_real_list_iterator; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains = gee_array_list_real_contains; + GEE_ABSTRACT_LIST_CLASS (klass)->index_of = gee_array_list_real_index_of; + GEE_ABSTRACT_LIST_CLASS (klass)->get = gee_array_list_real_get; + GEE_ABSTRACT_LIST_CLASS (klass)->set = gee_array_list_real_set; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add = gee_array_list_real_add; + GEE_ABSTRACT_LIST_CLASS (klass)->insert = gee_array_list_real_insert; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove = gee_array_list_real_remove; + GEE_ABSTRACT_LIST_CLASS (klass)->remove_at = gee_array_list_real_remove_at; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->clear = gee_array_list_real_clear; + GEE_ABSTRACT_LIST_CLASS (klass)->slice = gee_array_list_real_slice; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add_all = gee_array_list_real_add_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_size = gee_array_list_real_get_size; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_array_list_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_array_list_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_array_list_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ARRAY_LIST_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ARRAY_LIST_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ARRAY_LIST_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ARRAY_LIST_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The elements' equality testing function. + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ARRAY_LIST_EQUAL_FUNC, g_param_spec_pointer ("equal-func", "equal-func", "equal-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_array_list_instance_init (GeeArrayList * self) { + gpointer* _tmp0_ = NULL; + self->priv = GEE_ARRAY_LIST_GET_PRIVATE (self); + _tmp0_ = g_new0 (gpointer, 4); + self->_items = _tmp0_; + self->_items_length1 = 4; + self->__items_size_ = self->_items_length1; + self->priv->_stamp = 0; +} + + +static void gee_array_list_finalize (GObject* obj) { + GeeArrayList * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_ARRAY_LIST, GeeArrayList); + self->_items = (_vala_array_free (self->_items, self->_items_length1, (GDestroyNotify) self->priv->g_destroy_func), NULL); + G_OBJECT_CLASS (gee_array_list_parent_class)->finalize (obj); +} + + +/** + * Resizable array implementation of the {@link List} interface. + * + * The storage array grows automatically when needed. + * + * This implementation is pretty good for rarely modified data. Because they are + * stored in an array this structure does not fit for highly mutable data. For an + * alternative implementation see {@link LinkedList}. + * + * @see LinkedList + */ +GType gee_array_list_get_type (void) { + static volatile gsize gee_array_list_type_id__volatile = 0; + if (g_once_init_enter (&gee_array_list_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeArrayListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_array_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeArrayList), 0, (GInstanceInitFunc) gee_array_list_instance_init, NULL }; + GType gee_array_list_type_id; + gee_array_list_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_LIST, "GeeArrayList", &g_define_type_info, 0); + g_once_init_leave (&gee_array_list_type_id__volatile, gee_array_list_type_id); + } + return gee_array_list_type_id__volatile; +} + + +static void _vala_gee_array_list_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeArrayList * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ARRAY_LIST, GeeArrayList); + switch (property_id) { + case GEE_ARRAY_LIST_SIZE: + g_value_set_int (value, gee_abstract_collection_get_size ((GeeAbstractCollection*) self)); + break; + case GEE_ARRAY_LIST_EQUAL_FUNC: + g_value_set_pointer (value, gee_array_list_get_equal_func (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_array_list_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeArrayList * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ARRAY_LIST, GeeArrayList); + switch (property_id) { + case GEE_ARRAY_LIST_EQUAL_FUNC: + gee_array_list_set_equal_func (self, g_value_get_pointer (value)); + break; + case GEE_ARRAY_LIST_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_ARRAY_LIST_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_ARRAY_LIST_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + +static void _vala_array_move (gpointer array, gsize element_size, gint src, gint dest, gint length) { + g_memmove (((char*) array) + (dest * element_size), ((char*) array) + (src * element_size), length * element_size); + if ((src < dest) && ((src + length) > dest)) { + memset (((char*) array) + (src * element_size), 0, (dest - src) * element_size); + } else if ((src > dest) && (src < (dest + length))) { + memset (((char*) array) + ((dest + length) * element_size), 0, (src - dest) * element_size); + } else if (src != dest) { + memset (((char*) array) + (src * element_size), 0, length * element_size); + } +} + + + diff --git a/gee/arraylist.vala b/gee/arraylist.vala new file mode 100644 index 0000000..5c369b5 --- /dev/null +++ b/gee/arraylist.vala @@ -0,0 +1,378 @@ +/* arraylist.vala + * + * Copyright (C) 2004-2005 Novell, Inc + * Copyright (C) 2005 David Waite + * Copyright (C) 2007-2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes Villevalois + */ + +using GLib; + +/** + * Resizable array implementation of the {@link List} interface. + * + * The storage array grows automatically when needed. + * + * This implementation is pretty good for rarely modified data. Because they are + * stored in an array this structure does not fit for highly mutable data. For an + * alternative implementation see {@link LinkedList}. + * + * @see LinkedList + */ +public class Gee.ArrayList : AbstractList { + /** + * {@inheritDoc} + */ + public override int size { + get { return _size; } + } + + /** + * The elements' equality testing function. + */ + public EqualFunc equal_func { private set; get; } + + internal G[] _items = new G[4]; + internal int _size; + + // concurrent modification protection + private int _stamp = 0; + + /** + * Constructs a new, empty array list. + * + * If not provided, the function parameter is requested to the + * {@link Functions} function factory methods. + * + * @param equal_func an optional element equality testing function + */ + public ArrayList (EqualFunc? equal_func = null) { + if (equal_func == null) { + equal_func = Functions.get_equal_func_for (typeof (G)); + } + this.equal_func = equal_func; + } + + /** + * {@inheritDoc} + */ + public override Gee.Iterator iterator () { + return new Iterator (this); + } + + /** + * {@inheritDoc} + */ + public override ListIterator list_iterator () { + return new Iterator (this); + } + + /** + * {@inheritDoc} + */ + public override bool contains (G item) { + return (index_of (item) != -1); + } + + /** + * {@inheritDoc} + */ + public override int index_of (G item) { + for (int index = 0; index < _size; index++) { + if (equal_func (_items[index], item)) { + return index; + } + } + return -1; + } + + /** + * {@inheritDoc} + */ + public override G get (int index) { + assert (index >= 0); + assert (index < _size); + + return _items[index]; + } + + /** + * {@inheritDoc} + */ + public override void set (int index, G item) { + assert (index >= 0); + assert (index < _size); + + _items[index] = item; + } + + /** + * {@inheritDoc} + */ + public override bool add (G item) { + if (_size == _items.length) { + grow_if_needed (1); + } + _items[_size++] = item; + _stamp++; + return true; + } + + /** + * {@inheritDoc} + */ + public override void insert (int index, G item) { + assert (index >= 0); + assert (index <= _size); + + if (_size == _items.length) { + grow_if_needed (1); + } + shift (index, 1); + _items[index] = item; + _stamp++; + } + + /** + * {@inheritDoc} + */ + public override bool remove (G item) { + for (int index = 0; index < _size; index++) { + if (equal_func (_items[index], item)) { + remove_at (index); + return true; + } + } + return false; + } + + /** + * {@inheritDoc} + */ + public override G remove_at (int index) { + assert (index >= 0); + assert (index < _size); + + G item = _items[index]; + _items[index] = null; + + shift (index + 1, -1); + + _stamp++; + return item; + } + + /** + * {@inheritDoc} + */ + public override void clear () { + for (int index = 0; index < _size; index++) { + _items[index] = null; + } + _size = 0; + _stamp++; + } + + /** + * {@inheritDoc} + */ + public override List? slice (int start, int stop) { + return_val_if_fail (start <= stop, null); + return_val_if_fail (start >= 0, null); + return_val_if_fail (stop <= _size, null); + + var slice = new ArrayList (this.equal_func); + for (int i = start; i < stop; i++) { + slice.add (this[i]); + } + + return slice; + } + + /** + * {@inheritDoc} + */ + public override bool add_all (Collection collection) { + if (collection.is_empty) { + return false; + } + + grow_if_needed (collection.size); + foreach (G item in collection) { + _items[_size++] = item; + } + _stamp++; + return true; + } + + /** + * Sorts items by comparing with the specified compare function. + * + * @deprecated This method has only been added as hack and will be + * deprecated after the next odd minor version bump (>= 0.7.x). + * + * @param compare_func compare function to use to compare items + */ + public void sort_with_data (CompareDataFunc compare) { + TimSort.sort_with_data (this, compare); + } + + private void shift (int start, int delta) { + assert (start >= 0); + assert (start <= _size); + assert (start >= -delta); + + _items.move (start, start + delta, _size - start); + + _size += delta; + } + + private void grow_if_needed (int new_count) { + assert (new_count >= 0); + + int minimum_size = _size + new_count; + if (minimum_size > _items.length) { + // double the capacity unless we add even more items at this time + set_capacity (new_count > _items.length ? minimum_size : 2 * _items.length); + } + } + + private void set_capacity (int value) { + assert (value >= _size); + + _items.resize (value); + } + + private class Iterator : Object, Gee.Iterator, BidirIterator, ListIterator { + private ArrayList _list; + private int _index = -1; + private bool _removed = false; + + // concurrent modification protection + private int _stamp = 0; + + public Iterator (ArrayList list) { + _list = list; + _stamp = _list._stamp; + } + + public bool next () { + assert (_stamp == _list._stamp); + if (_index + 1 < _list._size) { + _index++; + _removed = false; + return true; + } + return false; + } + + public bool has_next () { + assert (_stamp == _list._stamp); + return (_index + 1 < _list._size); + } + + public bool first () { + assert (_stamp == _list._stamp); + if (_list.size == 0) { + return false; + } + _index = 0; + _removed = false; + return true; + } + + public new G get () { + assert (_stamp == _list._stamp); + assert (_index >= 0); + assert (_index < _list._size); + assert (! _removed); + return _list._items[_index]; + } + + public void remove () { + assert (_stamp == _list._stamp); + assert (_index >= 0); + assert (_index < _list._size); + assert (! _removed); + _list.remove_at (_index); + _index--; + _removed = true; + _stamp = _list._stamp; + } + + public bool previous () { + assert (_stamp == _list._stamp); + if (_index > 0) { + _index--; + return true; + } + return false; + } + + public bool has_previous () { + assert (_stamp == _list._stamp); + return (_index - 1 >= 0); + } + + public bool last () { + assert (_stamp == _list._stamp); + if (_list.size == 0) { + return false; + } + _index = _list._size - 1; + return true; + } + + public new void set (G item) { + assert (_stamp == _list._stamp); + assert (_index >= 0); + assert (_index < _list._size); + _list._items[_index] = item; + _stamp = ++_list._stamp; + } + + public void insert (G item) { + assert (_stamp == _list._stamp); + assert (_index >= 0); + assert (_index < _list._size); + _list.insert (_index, item); + _index++; + _stamp = _list._stamp; + } + + public void add (G item) { + assert (_stamp == _list._stamp); + assert (_index >= 0); + assert (_index < _list._size); + _list.insert (_index + 1, item); + _index++; + _stamp = _list._stamp; + } + + public int index () { + assert (_stamp == _list._stamp); + assert (_index >= 0); + assert (_index < _list._size); + return _index; + } + } +} + diff --git a/gee/assemblyinfo.c b/gee/assemblyinfo.c new file mode 100644 index 0000000..fd02c94 --- /dev/null +++ b/gee/assemblyinfo.c @@ -0,0 +1,34 @@ +/* assemblyinfo.c generated by valac 0.18.0, the Vala compiler + * generated from assemblyinfo.vala, do not modify */ + +/* functions.vala + * + * Copyright (C) 2011 Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Maciej Piechotka + */ + +#include +#include + + + + + + + diff --git a/gee/assemblyinfo.vala b/gee/assemblyinfo.vala new file mode 100644 index 0000000..1fdde6d --- /dev/null +++ b/gee/assemblyinfo.vala @@ -0,0 +1,25 @@ +/* functions.vala + * + * Copyright (C) 2011 Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Maciej Piechotka + */ + +[CCode (gir_namespace = "Gee", gir_version = "1.0")] +namespace Gee {} + diff --git a/gee/bidiriterator.c b/gee/bidiriterator.c new file mode 100644 index 0000000..ae37adf --- /dev/null +++ b/gee/bidiriterator.c @@ -0,0 +1,128 @@ +/* bidiriterator.c generated by valac 0.18.0, the Vala compiler + * generated from bidiriterator.vala, do not modify */ + +/* bidiriterator.vala + * + * Copyright (C) 2009 Didier Villevalois, Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Maciej Piechotka + */ + +#include +#include + + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_BIDIR_ITERATOR (gee_bidir_iterator_get_type ()) +#define GEE_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIterator)) +#define GEE_IS_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_ITERATOR)) +#define GEE_BIDIR_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIteratorIface)) + +typedef struct _GeeBidirIterator GeeBidirIterator; +typedef struct _GeeBidirIteratorIface GeeBidirIteratorIface; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeBidirIteratorIface { + GTypeInterface parent_iface; + gboolean (*previous) (GeeBidirIterator* self); + gboolean (*has_previous) (GeeBidirIterator* self); + gboolean (*last) (GeeBidirIterator* self); +}; + + + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_bidir_iterator_get_type (void) G_GNUC_CONST; +gboolean gee_bidir_iterator_previous (GeeBidirIterator* self); +gboolean gee_bidir_iterator_has_previous (GeeBidirIterator* self); +gboolean gee_bidir_iterator_last (GeeBidirIterator* self); + + +/** + * Rewinds to the previous element in the iteration. + * + * @return ``true`` if the iterator has a previous element + */ +gboolean gee_bidir_iterator_previous (GeeBidirIterator* self) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_BIDIR_ITERATOR_GET_INTERFACE (self)->previous (self); +} + + +/** + * Checks whether there is a previous element in the iteration. + * + * @return ``true`` if the iterator has a previous element + */ +gboolean gee_bidir_iterator_has_previous (GeeBidirIterator* self) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_BIDIR_ITERATOR_GET_INTERFACE (self)->has_previous (self); +} + + +/** + * Advances to the last element in the iteration. + * + * @return ``true`` if the iterator has a last element + */ +gboolean gee_bidir_iterator_last (GeeBidirIterator* self) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_BIDIR_ITERATOR_GET_INTERFACE (self)->last (self); +} + + +static void gee_bidir_iterator_base_init (GeeBidirIteratorIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + } +} + + +/** + * A bi-directional iterator. + */ +GType gee_bidir_iterator_get_type (void) { + static volatile gsize gee_bidir_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_bidir_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeBidirIteratorIface), (GBaseInitFunc) gee_bidir_iterator_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_bidir_iterator_type_id; + gee_bidir_iterator_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeBidirIterator", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_bidir_iterator_type_id, GEE_TYPE_ITERATOR); + g_once_init_leave (&gee_bidir_iterator_type_id__volatile, gee_bidir_iterator_type_id); + } + return gee_bidir_iterator_type_id__volatile; +} + + + diff --git a/gee/bidiriterator.vala b/gee/bidiriterator.vala new file mode 100644 index 0000000..03d8ce2 --- /dev/null +++ b/gee/bidiriterator.vala @@ -0,0 +1,47 @@ +/* bidiriterator.vala + * + * Copyright (C) 2009 Didier Villevalois, Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Maciej Piechotka + */ + +/** + * A bi-directional iterator. + */ +public interface Gee.BidirIterator : Gee.Iterator { + /** + * Rewinds to the previous element in the iteration. + * + * @return ``true`` if the iterator has a previous element + */ + public abstract bool previous (); + + /** + * Checks whether there is a previous element in the iteration. + * + * @return ``true`` if the iterator has a previous element + */ + public abstract bool has_previous (); + + /** + * Advances to the last element in the iteration. + * + * @return ``true`` if the iterator has a last element + */ + public abstract bool last (); +} diff --git a/gee/collection.c b/gee/collection.c new file mode 100644 index 0000000..93a556e --- /dev/null +++ b/gee/collection.c @@ -0,0 +1,357 @@ +/* collection.c generated by valac 0.18.0, the Vala compiler + * generated from collection.vala, do not modify */ + +/* collection.vala + * + * Copyright (C) 2007-2009 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; + +#define GEE_TYPE_ABSTRACT_SET (gee_abstract_set_get_type ()) +#define GEE_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSet)) +#define GEE_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) +#define GEE_IS_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_SET)) +#define GEE_IS_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_SET)) +#define GEE_ABSTRACT_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) + +typedef struct _GeeAbstractSet GeeAbstractSet; +typedef struct _GeeAbstractSetClass GeeAbstractSetClass; + +#define GEE_TYPE_HASH_SET (gee_hash_set_get_type ()) +#define GEE_HASH_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_HASH_SET, GeeHashSet)) +#define GEE_HASH_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_HASH_SET, GeeHashSetClass)) +#define GEE_IS_HASH_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_HASH_SET)) +#define GEE_IS_HASH_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_HASH_SET)) +#define GEE_HASH_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_HASH_SET, GeeHashSetClass)) + +typedef struct _GeeHashSet GeeHashSet; +typedef struct _GeeHashSetClass GeeHashSetClass; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + + + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +gboolean gee_collection_contains (GeeCollection* self, gconstpointer item); +gboolean gee_collection_add (GeeCollection* self, gconstpointer item); +gboolean gee_collection_remove (GeeCollection* self, gconstpointer item); +void gee_collection_clear (GeeCollection* self); +gboolean gee_collection_add_all (GeeCollection* self, GeeCollection* collection); +gboolean gee_collection_contains_all (GeeCollection* self, GeeCollection* collection); +gboolean gee_collection_remove_all (GeeCollection* self, GeeCollection* collection); +gboolean gee_collection_retain_all (GeeCollection* self, GeeCollection* collection); +gpointer* gee_collection_to_array (GeeCollection* self, int* result_length1); +GeeCollection* gee_collection_empty (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeHashSet* gee_hash_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func); +GeeHashSet* gee_hash_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func); +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_set_get_type (void) G_GNUC_CONST; +GType gee_hash_set_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GeeSet* gee_abstract_set_get_read_only_view (GeeAbstractSet* self); +gint gee_collection_get_size (GeeCollection* self); +gboolean gee_collection_get_is_empty (GeeCollection* self); +GeeCollection* gee_collection_get_read_only_view (GeeCollection* self); + + +/** + * Determines whether this collection contains the specified item. + * + * @param item the item to locate in the collection + * + * @return ``true`` if item is found, ``false`` otherwise + */ +gboolean gee_collection_contains (GeeCollection* self, gconstpointer item) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_COLLECTION_GET_INTERFACE (self)->contains (self, item); +} + + +/** + * Adds an item to this collection. Must not be called on read-only + * collections. + * + * @param item the item to add to the collection + * + * @return ``true`` if the collection has been changed, ``false`` otherwise + */ +gboolean gee_collection_add (GeeCollection* self, gconstpointer item) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_COLLECTION_GET_INTERFACE (self)->add (self, item); +} + + +/** + * Removes the first occurence of an item from this collection. Must not + * be called on read-only collections. + * + * @param item the item to remove from the collection + * + * @return ``true`` if the collection has been changed, ``false`` otherwise + */ +gboolean gee_collection_remove (GeeCollection* self, gconstpointer item) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_COLLECTION_GET_INTERFACE (self)->remove (self, item); +} + + +/** + * Removes all items from this collection. Must not be called on + * read-only collections. + */ +void gee_collection_clear (GeeCollection* self) { + g_return_if_fail (self != NULL); + GEE_COLLECTION_GET_INTERFACE (self)->clear (self); +} + + +/** + * Adds all items in the input collection to this collection. + * + * @param collection the collection which items will be added to this + * collection. + * + * @return ``true`` if the collection has been changed, ``false`` otherwise + */ +gboolean gee_collection_add_all (GeeCollection* self, GeeCollection* collection) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_COLLECTION_GET_INTERFACE (self)->add_all (self, collection); +} + + +/** + * Returns ``true`` it this collection contains all items as the input + * collection. + * + * @param collection the collection which items will be compared with + * this collection. + * + * @return ``true`` if the collection has been changed, ``false`` otherwise + */ +gboolean gee_collection_contains_all (GeeCollection* self, GeeCollection* collection) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_COLLECTION_GET_INTERFACE (self)->contains_all (self, collection); +} + + +/** + * Removes the subset of items in this collection corresponding to the + * elments in the input collection. If there is several occurrences of + * the same value in this collection they are decremented of the number + * of occurrences in the input collection. + * + * @param collection the collection which items will be compared with + * this collection. + * + * @return ``true`` if the collection has been changed, ``false`` otherwise + */ +gboolean gee_collection_remove_all (GeeCollection* self, GeeCollection* collection) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_COLLECTION_GET_INTERFACE (self)->remove_all (self, collection); +} + + +/** + * Removes all items in this collection that are not contained in the input + * collection. In other words all common items of both collections are + * retained in this collection. + * + * @param collection the collection which items will be compared with + * this collection. + * + * @return ``true`` if the collection has been changed, ``false`` otherwise + */ +gboolean gee_collection_retain_all (GeeCollection* self, GeeCollection* collection) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_COLLECTION_GET_INTERFACE (self)->retain_all (self, collection); +} + + +/** + * Returns an array containing all of items from this collection. + * + * @return an array containing all of items from this collection + */ +gpointer* gee_collection_to_array (GeeCollection* self, int* result_length1) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_COLLECTION_GET_INTERFACE (self)->to_array (self, result_length1); +} + + +/** + * Returns an immutable empty collection. + * + * @return an immutable empty collection + */ +GeeCollection* gee_collection_empty (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) { + GeeCollection* result = NULL; + GeeHashSet* _tmp0_; + GeeHashSet* _tmp1_; + GeeSet* _tmp2_; + GeeSet* _tmp3_; + GeeCollection* _tmp4_; + _tmp0_ = gee_hash_set_new (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, NULL, NULL); + _tmp1_ = _tmp0_; + _tmp2_ = gee_abstract_set_get_read_only_view ((GeeAbstractSet*) _tmp1_); + _tmp3_ = _tmp2_; + _tmp4_ = (GeeCollection*) _tmp3_; + _g_object_unref0 (_tmp1_); + result = _tmp4_; + return result; +} + + +gint gee_collection_get_size (GeeCollection* self) { + g_return_val_if_fail (self != NULL, 0); + return GEE_COLLECTION_GET_INTERFACE (self)->get_size (self); +} + + +gboolean gee_collection_get_is_empty (GeeCollection* self) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_COLLECTION_GET_INTERFACE (self)->get_is_empty (self); +} + + +GeeCollection* gee_collection_get_read_only_view (GeeCollection* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_COLLECTION_GET_INTERFACE (self)->get_read_only_view (self); +} + + +static void gee_collection_base_init (GeeCollectionIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + /** + * The number of items in this collection. + */ + g_object_interface_install_property (iface, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * Specifies whether this collection is empty. + */ + g_object_interface_install_property (iface, g_param_spec_boolean ("is-empty", "is-empty", "is-empty", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The read-only view of this collection. + */ + g_object_interface_install_property (iface, g_param_spec_object ("read-only-view", "read-only-view", "read-only-view", GEE_TYPE_COLLECTION, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + } +} + + +/** + * A generic collection of objects. + */ +GType gee_collection_get_type (void) { + static volatile gsize gee_collection_type_id__volatile = 0; + if (g_once_init_enter (&gee_collection_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeCollectionIface), (GBaseInitFunc) gee_collection_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_collection_type_id; + gee_collection_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeCollection", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_collection_type_id, GEE_TYPE_ITERABLE); + g_once_init_leave (&gee_collection_type_id__volatile, gee_collection_type_id); + } + return gee_collection_type_id__volatile; +} + + + diff --git a/gee/collection.vala b/gee/collection.vala new file mode 100644 index 0000000..3bc12a8 --- /dev/null +++ b/gee/collection.vala @@ -0,0 +1,139 @@ +/* collection.vala + * + * Copyright (C) 2007-2009 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +/** + * A generic collection of objects. + */ +public interface Gee.Collection : Iterable { + /** + * The number of items in this collection. + */ + public abstract int size { get; } + + /** + * Specifies whether this collection is empty. + */ + public abstract bool is_empty { get; } + + /** + * Determines whether this collection contains the specified item. + * + * @param item the item to locate in the collection + * + * @return ``true`` if item is found, ``false`` otherwise + */ + public abstract bool contains (G item); + + /** + * Adds an item to this collection. Must not be called on read-only + * collections. + * + * @param item the item to add to the collection + * + * @return ``true`` if the collection has been changed, ``false`` otherwise + */ + public abstract bool add (G item); + + /** + * Removes the first occurence of an item from this collection. Must not + * be called on read-only collections. + * + * @param item the item to remove from the collection + * + * @return ``true`` if the collection has been changed, ``false`` otherwise + */ + public abstract bool remove (G item); + + /** + * Removes all items from this collection. Must not be called on + * read-only collections. + */ + public abstract void clear (); + + /** + * Adds all items in the input collection to this collection. + * + * @param collection the collection which items will be added to this + * collection. + * + * @return ``true`` if the collection has been changed, ``false`` otherwise + */ + public abstract bool add_all (Collection collection); + + /** + * Returns ``true`` it this collection contains all items as the input + * collection. + * + * @param collection the collection which items will be compared with + * this collection. + * + * @return ``true`` if the collection has been changed, ``false`` otherwise + */ + public abstract bool contains_all (Collection collection); + + /** + * Removes the subset of items in this collection corresponding to the + * elments in the input collection. If there is several occurrences of + * the same value in this collection they are decremented of the number + * of occurrences in the input collection. + * + * @param collection the collection which items will be compared with + * this collection. + * + * @return ``true`` if the collection has been changed, ``false`` otherwise + */ + public abstract bool remove_all (Collection collection); + + /** + * Removes all items in this collection that are not contained in the input + * collection. In other words all common items of both collections are + * retained in this collection. + * + * @param collection the collection which items will be compared with + * this collection. + * + * @return ``true`` if the collection has been changed, ``false`` otherwise + */ + public abstract bool retain_all (Collection collection); + + /** + * Returns an array containing all of items from this collection. + * + * @return an array containing all of items from this collection + */ + public abstract G[] to_array(); + + /** + * The read-only view of this collection. + */ + public abstract Collection read_only_view { owned get; } + + /** + * Returns an immutable empty collection. + * + * @return an immutable empty collection + */ + public static Collection empty () { + return new HashSet ().read_only_view; + } +} + diff --git a/gee/comparable.c b/gee/comparable.c new file mode 100644 index 0000000..e85f7ba --- /dev/null +++ b/gee/comparable.c @@ -0,0 +1,86 @@ +/* comparable.c generated by valac 0.18.0, the Vala compiler + * generated from comparable.vala, do not modify */ + +/* comparable.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +#include +#include + + +#define GEE_TYPE_COMPARABLE (gee_comparable_get_type ()) +#define GEE_COMPARABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COMPARABLE, GeeComparable)) +#define GEE_IS_COMPARABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COMPARABLE)) +#define GEE_COMPARABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COMPARABLE, GeeComparableIface)) + +typedef struct _GeeComparable GeeComparable; +typedef struct _GeeComparableIface GeeComparableIface; + +struct _GeeComparableIface { + GTypeInterface parent_iface; + gint (*compare_to) (GeeComparable* self, gconstpointer object); +}; + + + +GType gee_comparable_get_type (void) G_GNUC_CONST; +gint gee_comparable_compare_to (GeeComparable* self, gconstpointer object); + + +/** + * Compares this object with the specifed object. + * + * @return a negative integer, zero, or a positive integer as this object + * is less than, equal to, or greater than the specified object + */ +gint gee_comparable_compare_to (GeeComparable* self, gconstpointer object) { + g_return_val_if_fail (self != NULL, 0); + return GEE_COMPARABLE_GET_INTERFACE (self)->compare_to (self, object); +} + + +static void gee_comparable_base_init (GeeComparableIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + } +} + + +/** + * This interface defines a total ordering among instances of each class + * implementing it. + */ +GType gee_comparable_get_type (void) { + static volatile gsize gee_comparable_type_id__volatile = 0; + if (g_once_init_enter (&gee_comparable_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeComparableIface), (GBaseInitFunc) gee_comparable_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_comparable_type_id; + gee_comparable_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeComparable", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_comparable_type_id, G_TYPE_OBJECT); + g_once_init_leave (&gee_comparable_type_id__volatile, gee_comparable_type_id); + } + return gee_comparable_type_id__volatile; +} + + + diff --git a/gee/comparable.vala b/gee/comparable.vala new file mode 100644 index 0000000..01e9a5e --- /dev/null +++ b/gee/comparable.vala @@ -0,0 +1,35 @@ +/* comparable.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +/** + * This interface defines a total ordering among instances of each class + * implementing it. + */ +public interface Gee.Comparable : Object { + /** + * Compares this object with the specifed object. + * + * @return a negative integer, zero, or a positive integer as this object + * is less than, equal to, or greater than the specified object + */ + public abstract int compare_to (G object); +} diff --git a/gee/deque.c b/gee/deque.c new file mode 100644 index 0000000..7fe46d8 --- /dev/null +++ b/gee/deque.c @@ -0,0 +1,293 @@ +/* deque.c generated by valac 0.18.0, the Vala compiler + * generated from deque.vala, do not modify */ + +/* deque.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_QUEUE (gee_queue_get_type ()) +#define GEE_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_QUEUE, GeeQueue)) +#define GEE_IS_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_QUEUE)) +#define GEE_QUEUE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_QUEUE, GeeQueueIface)) + +typedef struct _GeeQueue GeeQueue; +typedef struct _GeeQueueIface GeeQueueIface; + +#define GEE_TYPE_DEQUE (gee_deque_get_type ()) +#define GEE_DEQUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_DEQUE, GeeDeque)) +#define GEE_IS_DEQUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_DEQUE)) +#define GEE_DEQUE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_DEQUE, GeeDequeIface)) + +typedef struct _GeeDeque GeeDeque; +typedef struct _GeeDequeIface GeeDequeIface; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeQueueIface { + GTypeInterface parent_iface; + gboolean (*offer) (GeeQueue* self, gconstpointer element); + gpointer (*peek) (GeeQueue* self); + gpointer (*poll) (GeeQueue* self); + gint (*drain) (GeeQueue* self, GeeCollection* recipient, gint amount); + gint (*get_capacity) (GeeQueue* self); + gint (*get_remaining_capacity) (GeeQueue* self); + gboolean (*get_is_full) (GeeQueue* self); +}; + +struct _GeeDequeIface { + GTypeInterface parent_iface; + gboolean (*offer_head) (GeeDeque* self, gconstpointer element); + gpointer (*peek_head) (GeeDeque* self); + gpointer (*poll_head) (GeeDeque* self); + gint (*drain_head) (GeeDeque* self, GeeCollection* recipient, gint amount); + gboolean (*offer_tail) (GeeDeque* self, gconstpointer element); + gpointer (*peek_tail) (GeeDeque* self); + gpointer (*poll_tail) (GeeDeque* self); + gint (*drain_tail) (GeeDeque* self, GeeCollection* recipient, gint amount); +}; + + + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_queue_get_type (void) G_GNUC_CONST; +GType gee_deque_get_type (void) G_GNUC_CONST; +gboolean gee_deque_offer_head (GeeDeque* self, gconstpointer element); +gpointer gee_deque_peek_head (GeeDeque* self); +gpointer gee_deque_poll_head (GeeDeque* self); +gint gee_deque_drain_head (GeeDeque* self, GeeCollection* recipient, gint amount); +gboolean gee_deque_offer_tail (GeeDeque* self, gconstpointer element); +gpointer gee_deque_peek_tail (GeeDeque* self); +gpointer gee_deque_poll_tail (GeeDeque* self); +gint gee_deque_drain_tail (GeeDeque* self, GeeCollection* recipient, gint amount); + + +/** + * Offers the specified element to the head of this deque. + * + * @param element the element to offer to the queue + * + * @return ``true`` if the element was added to the queue + */ +gboolean gee_deque_offer_head (GeeDeque* self, gconstpointer element) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_DEQUE_GET_INTERFACE (self)->offer_head (self, element); +} + + +/** + * Peeks (retrieves, but not remove) an element from this queue. + * + * @return the element peeked from the queue (or ``null`` if none was + * available) + */ +gpointer gee_deque_peek_head (GeeDeque* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_DEQUE_GET_INTERFACE (self)->peek_head (self); +} + + +/** + * Polls (retrieves and remove) an element from the head of this queue. + * + * @return the element polled from the queue (or ``null`` if none was + * available) + */ +gpointer gee_deque_poll_head (GeeDeque* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_DEQUE_GET_INTERFACE (self)->poll_head (self); +} + + +/** + * Drains the specified amount of elements from the head of this queue in + * the specified recipient collection. + * + * @param recipient the recipient collection to drain the elements to + * @param amount the amount of elements to drain + * + * @return the amount of elements that were actually drained + */ +gint gee_deque_drain_head (GeeDeque* self, GeeCollection* recipient, gint amount) { + g_return_val_if_fail (self != NULL, 0); + return GEE_DEQUE_GET_INTERFACE (self)->drain_head (self, recipient, amount); +} + + +/** + * Offers the specified element to the tail of this deque + * + * @param element the element to offer to the queue + * + * @return ``true`` if the element was added to the queue + */ +gboolean gee_deque_offer_tail (GeeDeque* self, gconstpointer element) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_DEQUE_GET_INTERFACE (self)->offer_tail (self, element); +} + + +/** + * Peeks (retrieves, but not remove) an element from the tail of this + * queue. + * + * @return the element peeked from the queue (or ``null`` if none was + * available) + */ +gpointer gee_deque_peek_tail (GeeDeque* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_DEQUE_GET_INTERFACE (self)->peek_tail (self); +} + + +/** + * Polls (retrieves and remove) an element from the tail of this queue. + * + * @return the element polled from the queue (or ``null`` if none was + * available) + */ +gpointer gee_deque_poll_tail (GeeDeque* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_DEQUE_GET_INTERFACE (self)->poll_tail (self); +} + + +/** + * Drains the specified amount of elements from the tail of this queue in + * the specified recipient collection. + * + * @param recipient the recipient collection to drain the elements to + * @param amount the amount of elements to drain + * + * @return the amount of elements that were actually drained + */ +gint gee_deque_drain_tail (GeeDeque* self, GeeCollection* recipient, gint amount) { + g_return_val_if_fail (self != NULL, 0); + return GEE_DEQUE_GET_INTERFACE (self)->drain_tail (self, recipient, amount); +} + + +static void gee_deque_base_init (GeeDequeIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + } +} + + +/** + * A double-ended queue. + * + * A deque can be used either as a queue (First-In-First-Out behavior) or as a + * stack (Last-In-First-Out behavior). + * + * The methods defined by this interface behaves exactely in the same way as + * the {@link Queue} methods with respect to capacity bounds. + * + * The Deque interface inherits from the {@link Queue} interface. Thus, to use + * a deque as a queue, you can equivalently use the folowing method set: + * + * ||<)(> ''Queue method'' ||<)(> ''Deque method'' || + * || {@link Queue.offer} || {@link offer_tail} || + * || {@link Queue.peek} || {@link peek_head} || + * || {@link Queue.poll} || {@link poll_head} || + * || {@link Queue.drain} || {@link drain_head} || + * + * To use a deque as a stack, just use the method set that acts at the head of + * the deque: + * + * ||<)(> ''Operation'' ||<)(> ''Deque method'' || + * || push an element || {@link offer_head} || + * || peek an element || {@link peek_head} || + * || pop an element || {@link poll_head} || + */ +GType gee_deque_get_type (void) { + static volatile gsize gee_deque_type_id__volatile = 0; + if (g_once_init_enter (&gee_deque_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeDequeIface), (GBaseInitFunc) gee_deque_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_deque_type_id; + gee_deque_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeDeque", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_deque_type_id, GEE_TYPE_QUEUE); + g_once_init_leave (&gee_deque_type_id__volatile, gee_deque_type_id); + } + return gee_deque_type_id__volatile; +} + + + diff --git a/gee/deque.vala b/gee/deque.vala new file mode 100644 index 0000000..ad5d50e --- /dev/null +++ b/gee/deque.vala @@ -0,0 +1,122 @@ +/* deque.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +/** + * A double-ended queue. + * + * A deque can be used either as a queue (First-In-First-Out behavior) or as a + * stack (Last-In-First-Out behavior). + * + * The methods defined by this interface behaves exactely in the same way as + * the {@link Queue} methods with respect to capacity bounds. + * + * The Deque interface inherits from the {@link Queue} interface. Thus, to use + * a deque as a queue, you can equivalently use the folowing method set: + * + * ||<)(> ''Queue method'' ||<)(> ''Deque method'' || + * || {@link Queue.offer} || {@link offer_tail} || + * || {@link Queue.peek} || {@link peek_head} || + * || {@link Queue.poll} || {@link poll_head} || + * || {@link Queue.drain} || {@link drain_head} || + * + * To use a deque as a stack, just use the method set that acts at the head of + * the deque: + * + * ||<)(> ''Operation'' ||<)(> ''Deque method'' || + * || push an element || {@link offer_head} || + * || peek an element || {@link peek_head} || + * || pop an element || {@link poll_head} || + */ +public interface Gee.Deque : Queue { + /** + * Offers the specified element to the head of this deque. + * + * @param element the element to offer to the queue + * + * @return ``true`` if the element was added to the queue + */ + public abstract bool offer_head (G element); + + /** + * Peeks (retrieves, but not remove) an element from this queue. + * + * @return the element peeked from the queue (or ``null`` if none was + * available) + */ + public abstract G? peek_head (); + + /** + * Polls (retrieves and remove) an element from the head of this queue. + * + * @return the element polled from the queue (or ``null`` if none was + * available) + */ + public abstract G? poll_head (); + + /** + * Drains the specified amount of elements from the head of this queue in + * the specified recipient collection. + * + * @param recipient the recipient collection to drain the elements to + * @param amount the amount of elements to drain + * + * @return the amount of elements that were actually drained + */ + public abstract int drain_head (Collection recipient, int amount = -1); + + /** + * Offers the specified element to the tail of this deque + * + * @param element the element to offer to the queue + * + * @return ``true`` if the element was added to the queue + */ + public abstract bool offer_tail (G element); + + /** + * Peeks (retrieves, but not remove) an element from the tail of this + * queue. + * + * @return the element peeked from the queue (or ``null`` if none was + * available) + */ + public abstract G? peek_tail (); + + /** + * Polls (retrieves and remove) an element from the tail of this queue. + * + * @return the element polled from the queue (or ``null`` if none was + * available) + */ + public abstract G? poll_tail (); + + /** + * Drains the specified amount of elements from the tail of this queue in + * the specified recipient collection. + * + * @param recipient the recipient collection to drain the elements to + * @param amount the amount of elements to drain + * + * @return the amount of elements that were actually drained + */ + public abstract int drain_tail (Collection recipient, int amount = -1); +} diff --git a/gee/functions.c b/gee/functions.c new file mode 100644 index 0000000..b1bcded --- /dev/null +++ b/gee/functions.c @@ -0,0 +1,182 @@ +/* functions.c generated by valac 0.18.0, the Vala compiler + * generated from functions.vala, do not modify */ + +/* functions.vala + * + * Copyright (C) 2009 Didier Villevalois, Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + * Maciej Piechotka + */ + +#include +#include +#include +#include + + +#define GEE_TYPE_COMPARABLE (gee_comparable_get_type ()) +#define GEE_COMPARABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COMPARABLE, GeeComparable)) +#define GEE_IS_COMPARABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COMPARABLE)) +#define GEE_COMPARABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COMPARABLE, GeeComparableIface)) + +typedef struct _GeeComparable GeeComparable; +typedef struct _GeeComparableIface GeeComparableIface; + +struct _GeeComparableIface { + GTypeInterface parent_iface; + gint (*compare_to) (GeeComparable* self, gconstpointer object); +}; + + + +GEqualFunc gee_functions_get_equal_func_for (GType t); +GHashFunc gee_functions_get_hash_func_for (GType t); +GCompareFunc gee_functions_get_compare_func_for (GType t); +GType gee_comparable_get_type (void) G_GNUC_CONST; +gint gee_comparable_compare_to (GeeComparable* self, gconstpointer object); +gint gee_direct_compare (void* _val1, void* _val2); + + +/** + * Get a equality testing function for a given type. + * + * @param t the type which to get an equality testing function for. + * + * @return the equality testing function corresponding to the given type. + */ +GEqualFunc gee_functions_get_equal_func_for (GType t) { + GEqualFunc result = NULL; + GType _tmp0_; + _tmp0_ = t; + if (_tmp0_ == G_TYPE_STRING) { + GEqualFunc _tmp1_; + _tmp1_ = g_str_equal; + result = _tmp1_; + return result; + } else { + GEqualFunc _tmp2_; + _tmp2_ = g_direct_equal; + result = _tmp2_; + return result; + } +} + + +/** + * Get a hash function for a given type. + * + * @param t the type which to get the hash function for. + * + * @return the hash function corresponding to the given type. + */ +GHashFunc gee_functions_get_hash_func_for (GType t) { + GHashFunc result = NULL; + GType _tmp0_; + _tmp0_ = t; + if (_tmp0_ == G_TYPE_STRING) { + GHashFunc _tmp1_; + _tmp1_ = g_str_hash; + result = _tmp1_; + return result; + } else { + GHashFunc _tmp2_; + _tmp2_ = g_direct_hash; + result = _tmp2_; + return result; + } +} + + +/** + * Get a comparator function for a given type. + * + * @param t the type which to get a comparator function for. + * + * @return the comparator function corresponding to the given type. + */ +GCompareFunc gee_functions_get_compare_func_for (GType t) { + GCompareFunc result = NULL; + GType _tmp0_; + _tmp0_ = t; + if (_tmp0_ == G_TYPE_STRING) { + GCompareFunc _tmp1_; + _tmp1_ = g_strcmp0; + result = (GCompareFunc) _tmp1_; + return result; + } else { + GType _tmp2_; + gboolean _tmp3_ = FALSE; + _tmp2_ = t; + _tmp3_ = g_type_is_a (_tmp2_, GEE_TYPE_COMPARABLE); + if (_tmp3_) { + result = (GCompareFunc) gee_comparable_compare_to; + return result; + } else { + result = (GCompareFunc) gee_direct_compare; + return result; + } + } +} + + +/** + * Compares two arbitrary elements together. + * + * The comparison is done on pointers and not on values behind. + * + * @param _val1 the first value to compare. + * @param _val2 the second value to compare. + * + * @return a negative value if _val1 is lesser than _val2, a positive value + * if _val1 is greater then _val2 and zero if both are equal. + */ +gint gee_direct_compare (void* _val1, void* _val2) { + gint result = 0; + void* _tmp0_; + glong val1; + void* _tmp1_; + glong val2; + glong _tmp2_; + glong _tmp3_; + _tmp0_ = _val1; + val1 = (glong) _tmp0_; + _tmp1_ = _val2; + val2 = (glong) _tmp1_; + _tmp2_ = val1; + _tmp3_ = val2; + if (_tmp2_ > _tmp3_) { + result = 1; + return result; + } else { + glong _tmp4_; + glong _tmp5_; + _tmp4_ = val1; + _tmp5_ = val2; + if (_tmp4_ == _tmp5_) { + result = 0; + return result; + } else { + result = -1; + return result; + } + } +} + + + diff --git a/gee/functions.vala b/gee/functions.vala new file mode 100644 index 0000000..8067172 --- /dev/null +++ b/gee/functions.vala @@ -0,0 +1,111 @@ +/* functions.vala + * + * Copyright (C) 2009 Didier Villevalois, Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + * Maciej Piechotka + */ + +using GLib; + +namespace Gee { + + /** + * Helpers for equal, hash and compare functions. + * + * With those functions, you can retrieve the equal, hash and compare + * functions that best match your element, key or value types. Supported + * types are (non-boxed) primitive, string and ``Object`` types. + * + * A special care is taken for classes inheriting from the + * {@link Comparable} interface. For such types, an appropriate compare + * function is returned that calls {@link Comparable.compare_to}. + * + */ + namespace Functions { + + /** + * Get a equality testing function for a given type. + * + * @param t the type which to get an equality testing function for. + * + * @return the equality testing function corresponding to the given type. + */ + public static EqualFunc get_equal_func_for (Type t) { + if (t == typeof (string)) { + return str_equal; + } else { + return direct_equal; + } + } + + /** + * Get a hash function for a given type. + * + * @param t the type which to get the hash function for. + * + * @return the hash function corresponding to the given type. + */ + public static HashFunc get_hash_func_for (Type t) { + if (t == typeof (string)) { + return str_hash; + } else { + return direct_hash; + } + } + + /** + * Get a comparator function for a given type. + * + * @param t the type which to get a comparator function for. + * + * @return the comparator function corresponding to the given type. + */ + public static CompareFunc get_compare_func_for (Type t) { + if (t == typeof (string)) { + return (CompareFunc) strcmp; + } else if (t.is_a (typeof (Comparable))) { + return (CompareFunc) Comparable.compare_to; + } else { + return (CompareFunc) direct_compare; + } + } + } + + /** + * Compares two arbitrary elements together. + * + * The comparison is done on pointers and not on values behind. + * + * @param _val1 the first value to compare. + * @param _val2 the second value to compare. + * + * @return a negative value if _val1 is lesser than _val2, a positive value + * if _val1 is greater then _val2 and zero if both are equal. + */ + public static int direct_compare (void* _val1, void* _val2) { + long val1 = (long)_val1, val2 = (long)_val2; + if (val1 > val2) { + return 1; + } else if (val1 == val2) { + return 0; + } else { + return -1; + } + } +} diff --git a/gee/gee-1.0.vapi b/gee/gee-1.0.vapi new file mode 100644 index 0000000..4240448 --- /dev/null +++ b/gee/gee-1.0.vapi @@ -0,0 +1,414 @@ +/* gee-1.0.vapi generated by valac 0.18.0, do not modify. */ + +[CCode (gir_namespace = "Gee", gir_version = "1.0")] +namespace Gee { + namespace Functions { + [CCode (cheader_filename = "gee.h")] + public static GLib.CompareFunc get_compare_func_for (GLib.Type t); + [CCode (cheader_filename = "gee.h")] + public static GLib.EqualFunc get_equal_func_for (GLib.Type t); + [CCode (cheader_filename = "gee.h")] + public static GLib.HashFunc get_hash_func_for (GLib.Type t); + } + [CCode (cheader_filename = "gee.h")] + public abstract class AbstractCollection : GLib.Object, Gee.Iterable, Gee.Collection { + public AbstractCollection (); + public abstract bool add (G item); + public virtual bool add_all (Gee.Collection collection); + public abstract void clear (); + public abstract bool contains (G item); + public virtual bool contains_all (Gee.Collection collection); + public abstract Gee.Iterator iterator (); + public abstract bool remove (G item); + public virtual bool remove_all (Gee.Collection collection); + public virtual bool retain_all (Gee.Collection collection); + public virtual G[] to_array (); + public virtual bool is_empty { get; } + public virtual Gee.Collection read_only_view { owned get; } + public abstract int size { get; } + } + [CCode (cheader_filename = "gee.h")] + public abstract class AbstractList : Gee.AbstractCollection, Gee.List { + public AbstractList (); + public virtual G first (); + public abstract new G @get (int index); + public abstract int index_of (G item); + public abstract void insert (int index, G item); + public virtual void insert_all (int index, Gee.Collection collection); + public virtual G last (); + public abstract Gee.ListIterator list_iterator (); + public abstract G remove_at (int index); + public abstract new void @set (int index, G item); + public abstract Gee.List? slice (int start, int stop); + public virtual Gee.List read_only_view { owned get; } + } + [CCode (cheader_filename = "gee.h")] + public abstract class AbstractMap : GLib.Object, Gee.Iterable>, Gee.Map { + public AbstractMap (); + public abstract void clear (); + public abstract new V @get (K key); + public abstract bool has (K key, V value); + public virtual bool has_all (Gee.Map map); + public abstract bool has_key (K key); + public abstract Gee.MapIterator map_iterator (); + public abstract new void @set (K key, V value); + public virtual void set_all (Gee.Map map); + public abstract bool unset (K key, out V value = null); + public virtual bool unset_all (Gee.Map map); + public abstract Gee.Set> entries { owned get; } + public virtual bool is_empty { get; } + public abstract Gee.Set keys { owned get; } + public virtual Gee.Map read_only_view { owned get; } + public abstract int size { get; } + public abstract Gee.Collection values { owned get; } + } + [CCode (cheader_filename = "gee.h")] + public abstract class AbstractMultiMap : GLib.Object, Gee.MultiMap { + protected Gee.Map> _storage_map; + public AbstractMultiMap (Gee.Map> storage_map); + protected abstract Gee.MultiSet create_multi_key_set (); + protected abstract Gee.Collection create_value_storage (); + protected abstract GLib.EqualFunc get_value_equal_func (); + } + [CCode (cheader_filename = "gee.h")] + public abstract class AbstractMultiSet : Gee.AbstractCollection, Gee.MultiSet { + protected Gee.Map _storage_map; + public AbstractMultiSet (Gee.Map storage_map); + public override bool add (G item); + public override void clear (); + public override bool contains (G item); + public override Gee.Iterator iterator (); + public override bool remove (G item); + public override int size { get; } + } + [CCode (cheader_filename = "gee.h")] + public abstract class AbstractQueue : Gee.AbstractCollection, Gee.Queue { + public AbstractQueue (); + public abstract int drain (Gee.Collection recipient, int amount = -1); + public abstract bool offer (G element); + public abstract G peek (); + public abstract G poll (); + public abstract int capacity { get; } + public abstract bool is_full { get; } + public abstract int remaining_capacity { get; } + } + [CCode (cheader_filename = "gee.h")] + public abstract class AbstractSet : Gee.AbstractCollection, Gee.Set { + public AbstractSet (); + public virtual Gee.Set read_only_view { owned get; } + } + [CCode (cheader_filename = "gee.h")] + public class ArrayList : Gee.AbstractList { + public ArrayList (GLib.EqualFunc? equal_func = null); + public override bool add (G item); + public override bool add_all (Gee.Collection collection); + public override void clear (); + public override bool contains (G item); + public override G @get (int index); + public override int index_of (G item); + public override void insert (int index, G item); + public override Gee.Iterator iterator (); + public override Gee.ListIterator list_iterator (); + public override bool remove (G item); + public override G remove_at (int index); + public override void @set (int index, G item); + public override Gee.List? slice (int start, int stop); + public void sort_with_data (GLib.CompareDataFunc compare); + public GLib.EqualFunc equal_func { get; private set; } + public override int size { get; } + } + [CCode (cheader_filename = "gee.h")] + public class HashMap : Gee.AbstractMap { + public HashMap (GLib.HashFunc? key_hash_func = null, GLib.EqualFunc? key_equal_func = null, GLib.EqualFunc? value_equal_func = null); + public override void clear (); + public override V @get (K key); + public override bool has (K key, V value); + public override bool has_key (K key); + public override Gee.MapIterator map_iterator (); + public override void @set (K key, V value); + public override bool unset (K key, out V value = null); + public override Gee.Set> entries { owned get; } + public GLib.EqualFunc key_equal_func { get; private set; } + public GLib.HashFunc key_hash_func { get; private set; } + public override Gee.Set keys { owned get; } + public override int size { get; } + public GLib.EqualFunc value_equal_func { get; private set; } + public override Gee.Collection values { owned get; } + } + [CCode (cheader_filename = "gee.h")] + public class HashMultiMap : Gee.AbstractMultiMap { + public HashMultiMap (GLib.HashFunc? key_hash_func = null, GLib.EqualFunc? key_equal_func = null, GLib.HashFunc? value_hash_func = null, GLib.EqualFunc? value_equal_func = null); + protected override Gee.MultiSet create_multi_key_set (); + protected override Gee.Collection create_value_storage (); + protected override GLib.EqualFunc get_value_equal_func (); + public GLib.EqualFunc key_equal_func { get; } + public GLib.HashFunc key_hash_func { get; } + public GLib.EqualFunc value_equal_func { get; private set; } + public GLib.HashFunc value_hash_func { get; private set; } + } + [CCode (cheader_filename = "gee.h")] + public class HashMultiSet : Gee.AbstractMultiSet { + public HashMultiSet (GLib.HashFunc? hash_func = null, GLib.EqualFunc? equal_func = null); + public GLib.EqualFunc equal_func { get; } + public GLib.HashFunc hash_func { get; } + } + [CCode (cheader_filename = "gee.h")] + public class HashSet : Gee.AbstractSet { + public HashSet (GLib.HashFunc? hash_func = null, GLib.EqualFunc? equal_func = null); + public override bool add (G key); + public override void clear (); + public override bool contains (G key); + public override Gee.Iterator iterator (); + public override bool remove (G key); + public GLib.EqualFunc equal_func { get; private set; } + public GLib.HashFunc hash_func { get; private set; } + public override int size { get; } + } + [CCode (cheader_filename = "gee.h")] + public class LinkedList : Gee.AbstractList, Gee.Queue, Gee.Deque { + public LinkedList (GLib.EqualFunc? equal_func = null); + public override bool add (G item); + public override void clear (); + public override bool contains (G item); + public override G first (); + public override G @get (int index); + public override int index_of (G item); + public override void insert (int index, G item); + public override Gee.Iterator iterator (); + public override G last (); + public override Gee.ListIterator list_iterator (); + public override bool remove (G item); + public override G remove_at (int index); + public override void @set (int index, G item); + public override Gee.List? slice (int start, int stop); + public GLib.EqualFunc equal_func { get; private set; } + public override int size { get; } + } + [CCode (cheader_filename = "gee.h")] + public class PriorityQueue : Gee.AbstractQueue { + public PriorityQueue (GLib.CompareFunc? compare_func = null); + public override bool add (G item); + public override void clear (); + public override bool contains (G item); + public override int drain (Gee.Collection recipient, int amount = -1); + public override Gee.Iterator iterator (); + public override bool offer (G element); + public override G peek (); + public override G poll (); + public override bool remove (G item); + public override int capacity { get; } + public GLib.CompareFunc compare_func { get; private set; } + public override bool is_full { get; } + public override int remaining_capacity { get; } + public override int size { get; } + } + [CCode (cheader_filename = "gee.h")] + public class TreeMap : Gee.AbstractMap { + public TreeMap (GLib.CompareFunc? key_compare_func = null, GLib.EqualFunc? value_equal_func = null); + public override void clear (); + public override V @get (K key); + public override bool has (K key, V value); + public override bool has_key (K key); + public override Gee.MapIterator map_iterator (); + public override void @set (K key, V value); + public override bool unset (K key, out V value = null); + public override Gee.Set> entries { owned get; } + public GLib.CompareFunc key_compare_func { get; private set; } + public override Gee.Set keys { owned get; } + public override int size { get; } + public GLib.EqualFunc value_equal_func { get; private set; } + public override Gee.Collection values { owned get; } + } + [CCode (cheader_filename = "gee.h")] + public class TreeMultiMap : Gee.AbstractMultiMap { + public TreeMultiMap (GLib.CompareFunc? key_compare_func = null, GLib.CompareFunc? value_compare_func = null); + protected override Gee.MultiSet create_multi_key_set (); + protected override Gee.Collection create_value_storage (); + protected override GLib.EqualFunc get_value_equal_func (); + public GLib.CompareFunc key_compare_func { get; } + public GLib.CompareFunc value_compare_func { get; private set; } + } + [CCode (cheader_filename = "gee.h")] + public class TreeMultiSet : Gee.AbstractMultiSet { + public TreeMultiSet (GLib.CompareFunc? compare_func = null); + public GLib.CompareFunc compare_func { get; } + } + [CCode (cheader_filename = "gee.h")] + public class TreeSet : Gee.AbstractSet, Gee.SortedSet { + public TreeSet (GLib.CompareFunc? compare_func = null); + public override bool add (G item); + public override void clear (); + public override bool contains (G item); + public override Gee.Iterator iterator (); + public override bool remove (G item); + public GLib.CompareFunc compare_func { get; private set; } + public override int size { get; } + } + [CCode (cheader_filename = "gee.h")] + public interface BidirIterator : Gee.Iterator { + public abstract bool has_previous (); + public abstract bool last (); + public abstract bool previous (); + } + [CCode (cheader_filename = "gee.h")] + public interface Collection : Gee.Iterable { + public abstract bool add (G item); + public abstract bool add_all (Gee.Collection collection); + public abstract void clear (); + public abstract bool contains (G item); + public abstract bool contains_all (Gee.Collection collection); + public static Gee.Collection empty (); + public abstract bool remove (G item); + public abstract bool remove_all (Gee.Collection collection); + public abstract bool retain_all (Gee.Collection collection); + public abstract G[] to_array (); + public abstract bool is_empty { get; } + public abstract Gee.Collection read_only_view { owned get; } + public abstract int size { get; } + } + [CCode (cheader_filename = "gee.h")] + public interface Comparable : GLib.Object { + public abstract int compare_to (G object); + } + [CCode (cheader_filename = "gee.h")] + public interface Deque : Gee.Queue { + public abstract int drain_head (Gee.Collection recipient, int amount = -1); + public abstract int drain_tail (Gee.Collection recipient, int amount = -1); + public abstract bool offer_head (G element); + public abstract bool offer_tail (G element); + public abstract G peek_head (); + public abstract G peek_tail (); + public abstract G poll_head (); + public abstract G poll_tail (); + } + [CCode (cheader_filename = "gee.h")] + public interface Iterable : GLib.Object { + public abstract Gee.Iterator iterator (); + public abstract GLib.Type element_type { get; } + } + [CCode (cheader_filename = "gee.h")] + public interface Iterator : GLib.Object { + public abstract bool first (); + public abstract G @get (); + public abstract bool has_next (); + public abstract bool next (); + public abstract void remove (); + } + [CCode (cheader_filename = "gee.h")] + public interface List : Gee.Collection { + public static Gee.List empty (); + public abstract G first (); + public abstract G @get (int index); + public abstract int index_of (G item); + public abstract void insert (int index, G item); + public abstract void insert_all (int index, Gee.Collection collection); + public abstract G last (); + public abstract new Gee.ListIterator list_iterator (); + public abstract G remove_at (int index); + public abstract void @set (int index, G item); + public abstract Gee.List? slice (int start, int stop); + public abstract void sort (GLib.CompareFunc? compare_func = null); + public abstract Gee.List read_only_view { owned get; } + } + [CCode (cheader_filename = "gee.h")] + public interface ListIterator : Gee.BidirIterator { + public abstract void add (G item); + public abstract int index (); + public abstract void insert (G item); + public abstract void @set (G item); + } + [CCode (cheader_filename = "gee.h")] + public interface Map : GLib.Object, Gee.Iterable> { + public abstract class Entry : GLib.Object { + public Entry (); + public abstract K key { get; } + public abstract V value { get; set; } + } + public abstract void clear (); + [Deprecated] + public abstract bool contains (K key); + [Deprecated] + public abstract bool contains_all (Gee.Map map); + public static Gee.Map empty (); + public abstract V @get (K key); + public abstract bool has (K key, V value); + public abstract bool has_all (Gee.Map map); + public abstract bool has_key (K key); + public abstract Gee.MapIterator map_iterator (); + [Deprecated] + public abstract bool remove (K key, out V value = null); + [Deprecated] + public abstract bool remove_all (Gee.Map map); + public abstract void @set (K key, V value); + public abstract void set_all (Gee.Map map); + public abstract bool unset (K key, out V value = null); + public abstract bool unset_all (Gee.Map map); + public abstract Gee.Set> entries { owned get; } + public abstract bool is_empty { get; } + public abstract GLib.Type key_type { get; } + public abstract Gee.Set keys { owned get; } + public abstract Gee.Map read_only_view { owned get; } + public abstract int size { get; } + public abstract GLib.Type value_type { get; } + public abstract Gee.Collection values { owned get; } + } + [CCode (cheader_filename = "gee.h")] + public interface MapIterator : GLib.Object { + public abstract bool first (); + public abstract K get_key (); + public abstract V get_value (); + public abstract bool has_next (); + public abstract bool next (); + public abstract void set_value (V value); + public abstract void unset (); + } + [CCode (cheader_filename = "gee.h")] + public interface MultiMap : GLib.Object { + public abstract void clear (); + public abstract bool contains (K key); + public abstract Gee.Collection @get (K key); + public abstract Gee.MultiSet get_all_keys (); + public abstract Gee.Set get_keys (); + public abstract Gee.Collection get_values (); + public abstract bool remove (K key, V value); + public abstract bool remove_all (K key); + public abstract void @set (K key, V value); + public abstract int size { get; } + } + [CCode (cheader_filename = "gee.h")] + public interface MultiSet : Gee.Collection { + public abstract int count (G item); + } + [CCode (cheader_filename = "gee.h")] + public interface Queue : Gee.Collection { + public const int UNBOUNDED_CAPACITY; + public abstract int drain (Gee.Collection recipient, int amount = -1); + public abstract bool offer (G element); + public abstract G peek (); + public abstract G poll (); + public abstract int capacity { get; } + public abstract bool is_full { get; } + public abstract int remaining_capacity { get; } + } + [CCode (cheader_filename = "gee.h")] + public interface Set : Gee.Collection { + public static Gee.Set empty (); + public abstract Gee.Set read_only_view { owned get; } + } + [CCode (cheader_filename = "gee.h")] + public interface SortedSet : Gee.Set { + public abstract Gee.BidirIterator bidir_iterator (); + public abstract G ceil (G element); + public abstract G first (); + public abstract G floor (G element); + public abstract Gee.SortedSet head_set (G before); + public abstract G higher (G element); + public abstract Gee.BidirIterator? iterator_at (G element); + public abstract G last (); + public abstract G lower (G element); + public abstract Gee.SortedSet sub_set (G from, G to); + public abstract Gee.SortedSet tail_set (G after); + } + [CCode (cheader_filename = "gee.h")] + public static int direct_compare (void* _val1, void* _val2); +} diff --git a/gee/gee.h b/gee/gee.h new file mode 100644 index 0000000..b1b93e6 --- /dev/null +++ b/gee/gee.h @@ -0,0 +1,998 @@ +/* gee.h generated by valac 0.18.0, the Vala compiler, do not modify */ + + +#ifndef __GEE_H__ +#define __GEE_H__ + +#include +#include + +G_BEGIN_DECLS + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; +typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate; + +#define GEE_TYPE_LIST (gee_list_get_type ()) +#define GEE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST, GeeList)) +#define GEE_IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST)) +#define GEE_LIST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST, GeeListIface)) + +typedef struct _GeeList GeeList; +typedef struct _GeeListIface GeeListIface; + +#define GEE_TYPE_BIDIR_ITERATOR (gee_bidir_iterator_get_type ()) +#define GEE_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIterator)) +#define GEE_IS_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_ITERATOR)) +#define GEE_BIDIR_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIteratorIface)) + +typedef struct _GeeBidirIterator GeeBidirIterator; +typedef struct _GeeBidirIteratorIface GeeBidirIteratorIface; + +#define GEE_TYPE_LIST_ITERATOR (gee_list_iterator_get_type ()) +#define GEE_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIterator)) +#define GEE_IS_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST_ITERATOR)) +#define GEE_LIST_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIteratorIface)) + +typedef struct _GeeListIterator GeeListIterator; +typedef struct _GeeListIteratorIface GeeListIteratorIface; + +#define GEE_TYPE_ABSTRACT_LIST (gee_abstract_list_get_type ()) +#define GEE_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractList)) +#define GEE_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass)) +#define GEE_IS_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_LIST)) +#define GEE_IS_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_LIST)) +#define GEE_ABSTRACT_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass)) + +typedef struct _GeeAbstractList GeeAbstractList; +typedef struct _GeeAbstractListClass GeeAbstractListClass; +typedef struct _GeeAbstractListPrivate GeeAbstractListPrivate; + +#define GEE_TYPE_MAP (gee_map_get_type ()) +#define GEE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP, GeeMap)) +#define GEE_IS_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP)) +#define GEE_MAP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP, GeeMapIface)) + +typedef struct _GeeMap GeeMap; +typedef struct _GeeMapIface GeeMapIface; + +#define GEE_TYPE_MAP_ITERATOR (gee_map_iterator_get_type ()) +#define GEE_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIterator)) +#define GEE_IS_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP_ITERATOR)) +#define GEE_MAP_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIteratorIface)) + +typedef struct _GeeMapIterator GeeMapIterator; +typedef struct _GeeMapIteratorIface GeeMapIteratorIface; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_MAP_TYPE_ENTRY (gee_map_entry_get_type ()) +#define GEE_MAP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntry)) +#define GEE_MAP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) +#define GEE_MAP_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) + +typedef struct _GeeMapEntry GeeMapEntry; +typedef struct _GeeMapEntryClass GeeMapEntryClass; + +#define GEE_TYPE_ABSTRACT_MAP (gee_abstract_map_get_type ()) +#define GEE_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap)) +#define GEE_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) +#define GEE_IS_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_IS_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_ABSTRACT_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) + +typedef struct _GeeAbstractMap GeeAbstractMap; +typedef struct _GeeAbstractMapClass GeeAbstractMapClass; +typedef struct _GeeAbstractMapPrivate GeeAbstractMapPrivate; + +#define GEE_TYPE_MULTI_MAP (gee_multi_map_get_type ()) +#define GEE_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MULTI_MAP, GeeMultiMap)) +#define GEE_IS_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MULTI_MAP)) +#define GEE_MULTI_MAP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MULTI_MAP, GeeMultiMapIface)) + +typedef struct _GeeMultiMap GeeMultiMap; +typedef struct _GeeMultiMapIface GeeMultiMapIface; + +#define GEE_TYPE_MULTI_SET (gee_multi_set_get_type ()) +#define GEE_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MULTI_SET, GeeMultiSet)) +#define GEE_IS_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MULTI_SET)) +#define GEE_MULTI_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MULTI_SET, GeeMultiSetIface)) + +typedef struct _GeeMultiSet GeeMultiSet; +typedef struct _GeeMultiSetIface GeeMultiSetIface; + +#define GEE_TYPE_ABSTRACT_MULTI_MAP (gee_abstract_multi_map_get_type ()) +#define GEE_ABSTRACT_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MULTI_MAP, GeeAbstractMultiMap)) +#define GEE_ABSTRACT_MULTI_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MULTI_MAP, GeeAbstractMultiMapClass)) +#define GEE_IS_ABSTRACT_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MULTI_MAP)) +#define GEE_IS_ABSTRACT_MULTI_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MULTI_MAP)) +#define GEE_ABSTRACT_MULTI_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MULTI_MAP, GeeAbstractMultiMapClass)) + +typedef struct _GeeAbstractMultiMap GeeAbstractMultiMap; +typedef struct _GeeAbstractMultiMapClass GeeAbstractMultiMapClass; +typedef struct _GeeAbstractMultiMapPrivate GeeAbstractMultiMapPrivate; + +#define GEE_TYPE_ABSTRACT_MULTI_SET (gee_abstract_multi_set_get_type ()) +#define GEE_ABSTRACT_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSet)) +#define GEE_ABSTRACT_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSetClass)) +#define GEE_IS_ABSTRACT_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MULTI_SET)) +#define GEE_IS_ABSTRACT_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MULTI_SET)) +#define GEE_ABSTRACT_MULTI_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSetClass)) + +typedef struct _GeeAbstractMultiSet GeeAbstractMultiSet; +typedef struct _GeeAbstractMultiSetClass GeeAbstractMultiSetClass; +typedef struct _GeeAbstractMultiSetPrivate GeeAbstractMultiSetPrivate; + +#define GEE_TYPE_QUEUE (gee_queue_get_type ()) +#define GEE_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_QUEUE, GeeQueue)) +#define GEE_IS_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_QUEUE)) +#define GEE_QUEUE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_QUEUE, GeeQueueIface)) + +typedef struct _GeeQueue GeeQueue; +typedef struct _GeeQueueIface GeeQueueIface; + +#define GEE_TYPE_ABSTRACT_QUEUE (gee_abstract_queue_get_type ()) +#define GEE_ABSTRACT_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_QUEUE, GeeAbstractQueue)) +#define GEE_ABSTRACT_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_QUEUE, GeeAbstractQueueClass)) +#define GEE_IS_ABSTRACT_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_QUEUE)) +#define GEE_IS_ABSTRACT_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_QUEUE)) +#define GEE_ABSTRACT_QUEUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_QUEUE, GeeAbstractQueueClass)) + +typedef struct _GeeAbstractQueue GeeAbstractQueue; +typedef struct _GeeAbstractQueueClass GeeAbstractQueueClass; +typedef struct _GeeAbstractQueuePrivate GeeAbstractQueuePrivate; + +#define GEE_TYPE_ABSTRACT_SET (gee_abstract_set_get_type ()) +#define GEE_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSet)) +#define GEE_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) +#define GEE_IS_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_SET)) +#define GEE_IS_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_SET)) +#define GEE_ABSTRACT_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) + +typedef struct _GeeAbstractSet GeeAbstractSet; +typedef struct _GeeAbstractSetClass GeeAbstractSetClass; +typedef struct _GeeAbstractSetPrivate GeeAbstractSetPrivate; + +#define GEE_TYPE_ARRAY_LIST (gee_array_list_get_type ()) +#define GEE_ARRAY_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ARRAY_LIST, GeeArrayList)) +#define GEE_ARRAY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ARRAY_LIST, GeeArrayListClass)) +#define GEE_IS_ARRAY_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ARRAY_LIST)) +#define GEE_IS_ARRAY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ARRAY_LIST)) +#define GEE_ARRAY_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ARRAY_LIST, GeeArrayListClass)) + +typedef struct _GeeArrayList GeeArrayList; +typedef struct _GeeArrayListClass GeeArrayListClass; +typedef struct _GeeArrayListPrivate GeeArrayListPrivate; + +#define GEE_TYPE_COMPARABLE (gee_comparable_get_type ()) +#define GEE_COMPARABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COMPARABLE, GeeComparable)) +#define GEE_IS_COMPARABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COMPARABLE)) +#define GEE_COMPARABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COMPARABLE, GeeComparableIface)) + +typedef struct _GeeComparable GeeComparable; +typedef struct _GeeComparableIface GeeComparableIface; + +#define GEE_TYPE_DEQUE (gee_deque_get_type ()) +#define GEE_DEQUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_DEQUE, GeeDeque)) +#define GEE_IS_DEQUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_DEQUE)) +#define GEE_DEQUE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_DEQUE, GeeDequeIface)) + +typedef struct _GeeDeque GeeDeque; +typedef struct _GeeDequeIface GeeDequeIface; + +#define GEE_TYPE_HASH_MAP (gee_hash_map_get_type ()) +#define GEE_HASH_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_HASH_MAP, GeeHashMap)) +#define GEE_HASH_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_HASH_MAP, GeeHashMapClass)) +#define GEE_IS_HASH_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_HASH_MAP)) +#define GEE_IS_HASH_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_HASH_MAP)) +#define GEE_HASH_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_HASH_MAP, GeeHashMapClass)) + +typedef struct _GeeHashMap GeeHashMap; +typedef struct _GeeHashMapClass GeeHashMapClass; +typedef struct _GeeHashMapPrivate GeeHashMapPrivate; + +#define GEE_TYPE_HASH_MULTI_MAP (gee_hash_multi_map_get_type ()) +#define GEE_HASH_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_HASH_MULTI_MAP, GeeHashMultiMap)) +#define GEE_HASH_MULTI_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_HASH_MULTI_MAP, GeeHashMultiMapClass)) +#define GEE_IS_HASH_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_HASH_MULTI_MAP)) +#define GEE_IS_HASH_MULTI_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_HASH_MULTI_MAP)) +#define GEE_HASH_MULTI_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_HASH_MULTI_MAP, GeeHashMultiMapClass)) + +typedef struct _GeeHashMultiMap GeeHashMultiMap; +typedef struct _GeeHashMultiMapClass GeeHashMultiMapClass; +typedef struct _GeeHashMultiMapPrivate GeeHashMultiMapPrivate; + +#define GEE_TYPE_HASH_MULTI_SET (gee_hash_multi_set_get_type ()) +#define GEE_HASH_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_HASH_MULTI_SET, GeeHashMultiSet)) +#define GEE_HASH_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_HASH_MULTI_SET, GeeHashMultiSetClass)) +#define GEE_IS_HASH_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_HASH_MULTI_SET)) +#define GEE_IS_HASH_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_HASH_MULTI_SET)) +#define GEE_HASH_MULTI_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_HASH_MULTI_SET, GeeHashMultiSetClass)) + +typedef struct _GeeHashMultiSet GeeHashMultiSet; +typedef struct _GeeHashMultiSetClass GeeHashMultiSetClass; +typedef struct _GeeHashMultiSetPrivate GeeHashMultiSetPrivate; + +#define GEE_TYPE_HASH_SET (gee_hash_set_get_type ()) +#define GEE_HASH_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_HASH_SET, GeeHashSet)) +#define GEE_HASH_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_HASH_SET, GeeHashSetClass)) +#define GEE_IS_HASH_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_HASH_SET)) +#define GEE_IS_HASH_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_HASH_SET)) +#define GEE_HASH_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_HASH_SET, GeeHashSetClass)) + +typedef struct _GeeHashSet GeeHashSet; +typedef struct _GeeHashSetClass GeeHashSetClass; +typedef struct _GeeHashSetPrivate GeeHashSetPrivate; + +#define GEE_TYPE_LINKED_LIST (gee_linked_list_get_type ()) +#define GEE_LINKED_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LINKED_LIST, GeeLinkedList)) +#define GEE_LINKED_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_LINKED_LIST, GeeLinkedListClass)) +#define GEE_IS_LINKED_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LINKED_LIST)) +#define GEE_IS_LINKED_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_LINKED_LIST)) +#define GEE_LINKED_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_LINKED_LIST, GeeLinkedListClass)) + +typedef struct _GeeLinkedList GeeLinkedList; +typedef struct _GeeLinkedListClass GeeLinkedListClass; +typedef struct _GeeLinkedListPrivate GeeLinkedListPrivate; +typedef struct _GeeMapEntryPrivate GeeMapEntryPrivate; + +#define GEE_TYPE_PRIORITY_QUEUE (gee_priority_queue_get_type ()) +#define GEE_PRIORITY_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_PRIORITY_QUEUE, GeePriorityQueue)) +#define GEE_PRIORITY_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_PRIORITY_QUEUE, GeePriorityQueueClass)) +#define GEE_IS_PRIORITY_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_PRIORITY_QUEUE)) +#define GEE_IS_PRIORITY_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_PRIORITY_QUEUE)) +#define GEE_PRIORITY_QUEUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_PRIORITY_QUEUE, GeePriorityQueueClass)) + +typedef struct _GeePriorityQueue GeePriorityQueue; +typedef struct _GeePriorityQueueClass GeePriorityQueueClass; +typedef struct _GeePriorityQueuePrivate GeePriorityQueuePrivate; + +#define GEE_TYPE_SORTED_SET (gee_sorted_set_get_type ()) +#define GEE_SORTED_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SORTED_SET, GeeSortedSet)) +#define GEE_IS_SORTED_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SORTED_SET)) +#define GEE_SORTED_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SORTED_SET, GeeSortedSetIface)) + +typedef struct _GeeSortedSet GeeSortedSet; +typedef struct _GeeSortedSetIface GeeSortedSetIface; + +#define GEE_TYPE_TREE_MAP (gee_tree_map_get_type ()) +#define GEE_TREE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TREE_MAP, GeeTreeMap)) +#define GEE_TREE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TREE_MAP, GeeTreeMapClass)) +#define GEE_IS_TREE_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TREE_MAP)) +#define GEE_IS_TREE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TREE_MAP)) +#define GEE_TREE_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TREE_MAP, GeeTreeMapClass)) + +typedef struct _GeeTreeMap GeeTreeMap; +typedef struct _GeeTreeMapClass GeeTreeMapClass; +typedef struct _GeeTreeMapPrivate GeeTreeMapPrivate; + +#define GEE_TYPE_TREE_MULTI_MAP (gee_tree_multi_map_get_type ()) +#define GEE_TREE_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TREE_MULTI_MAP, GeeTreeMultiMap)) +#define GEE_TREE_MULTI_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TREE_MULTI_MAP, GeeTreeMultiMapClass)) +#define GEE_IS_TREE_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TREE_MULTI_MAP)) +#define GEE_IS_TREE_MULTI_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TREE_MULTI_MAP)) +#define GEE_TREE_MULTI_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TREE_MULTI_MAP, GeeTreeMultiMapClass)) + +typedef struct _GeeTreeMultiMap GeeTreeMultiMap; +typedef struct _GeeTreeMultiMapClass GeeTreeMultiMapClass; +typedef struct _GeeTreeMultiMapPrivate GeeTreeMultiMapPrivate; + +#define GEE_TYPE_TREE_MULTI_SET (gee_tree_multi_set_get_type ()) +#define GEE_TREE_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TREE_MULTI_SET, GeeTreeMultiSet)) +#define GEE_TREE_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TREE_MULTI_SET, GeeTreeMultiSetClass)) +#define GEE_IS_TREE_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TREE_MULTI_SET)) +#define GEE_IS_TREE_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TREE_MULTI_SET)) +#define GEE_TREE_MULTI_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TREE_MULTI_SET, GeeTreeMultiSetClass)) + +typedef struct _GeeTreeMultiSet GeeTreeMultiSet; +typedef struct _GeeTreeMultiSetClass GeeTreeMultiSetClass; +typedef struct _GeeTreeMultiSetPrivate GeeTreeMultiSetPrivate; + +#define GEE_TYPE_TREE_SET (gee_tree_set_get_type ()) +#define GEE_TREE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TREE_SET, GeeTreeSet)) +#define GEE_TREE_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TREE_SET, GeeTreeSetClass)) +#define GEE_IS_TREE_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TREE_SET)) +#define GEE_IS_TREE_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TREE_SET)) +#define GEE_TREE_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TREE_SET, GeeTreeSetClass)) + +typedef struct _GeeTreeSet GeeTreeSet; +typedef struct _GeeTreeSetClass GeeTreeSetClass; +typedef struct _GeeTreeSetPrivate GeeTreeSetPrivate; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeAbstractCollection { + GObject parent_instance; + GeeAbstractCollectionPrivate * priv; +}; + +struct _GeeAbstractCollectionClass { + GObjectClass parent_class; + gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*add) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item); + void (*clear) (GeeAbstractCollection* self); + gpointer* (*to_array) (GeeAbstractCollection* self, int* result_length1); + gboolean (*add_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeAbstractCollection* self, GeeCollection* collection); + GeeIterator* (*iterator) (GeeAbstractCollection* self); + gint (*get_size) (GeeAbstractCollection* self); + gboolean (*get_is_empty) (GeeAbstractCollection* self); + GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self); +}; + +struct _GeeBidirIteratorIface { + GTypeInterface parent_iface; + gboolean (*previous) (GeeBidirIterator* self); + gboolean (*has_previous) (GeeBidirIterator* self); + gboolean (*last) (GeeBidirIterator* self); +}; + +struct _GeeListIteratorIface { + GTypeInterface parent_iface; + void (*set) (GeeListIterator* self, gconstpointer item); + void (*insert) (GeeListIterator* self, gconstpointer item); + void (*add) (GeeListIterator* self, gconstpointer item); + gint (*index) (GeeListIterator* self); +}; + +struct _GeeListIface { + GTypeInterface parent_iface; + GeeListIterator* (*list_iterator) (GeeList* self); + gpointer (*get) (GeeList* self, gint index); + void (*set) (GeeList* self, gint index, gconstpointer item); + gint (*index_of) (GeeList* self, gconstpointer item); + void (*insert) (GeeList* self, gint index, gconstpointer item); + gpointer (*remove_at) (GeeList* self, gint index); + GeeList* (*slice) (GeeList* self, gint start, gint stop); + gpointer (*first) (GeeList* self); + gpointer (*last) (GeeList* self); + void (*insert_all) (GeeList* self, gint index, GeeCollection* collection); + void (*sort) (GeeList* self, GCompareFunc compare_func); + GeeList* (*get_read_only_view) (GeeList* self); +}; + +struct _GeeAbstractList { + GeeAbstractCollection parent_instance; + GeeAbstractListPrivate * priv; +}; + +struct _GeeAbstractListClass { + GeeAbstractCollectionClass parent_class; + GeeListIterator* (*list_iterator) (GeeAbstractList* self); + gpointer (*get) (GeeAbstractList* self, gint index); + void (*set) (GeeAbstractList* self, gint index, gconstpointer item); + gint (*index_of) (GeeAbstractList* self, gconstpointer item); + void (*insert) (GeeAbstractList* self, gint index, gconstpointer item); + gpointer (*remove_at) (GeeAbstractList* self, gint index); + GeeList* (*slice) (GeeAbstractList* self, gint start, gint stop); + gpointer (*first) (GeeAbstractList* self); + gpointer (*last) (GeeAbstractList* self); + void (*insert_all) (GeeAbstractList* self, gint index, GeeCollection* collection); + GeeList* (*get_read_only_view) (GeeAbstractList* self); +}; + +struct _GeeMapIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeMapIterator* self); + gboolean (*has_next) (GeeMapIterator* self); + gboolean (*first) (GeeMapIterator* self); + gpointer (*get_key) (GeeMapIterator* self); + gpointer (*get_value) (GeeMapIterator* self); + void (*set_value) (GeeMapIterator* self, gconstpointer value); + void (*unset) (GeeMapIterator* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeMapIface { + GTypeInterface parent_iface; + gboolean (*has_key) (GeeMap* self, gconstpointer key); + gboolean (*contains) (GeeMap* self, gconstpointer key); + gboolean (*has) (GeeMap* self, gconstpointer key, gconstpointer value); + gpointer (*get) (GeeMap* self, gconstpointer key); + void (*set) (GeeMap* self, gconstpointer key, gconstpointer value); + gboolean (*unset) (GeeMap* self, gconstpointer key, gpointer* value); + gboolean (*remove) (GeeMap* self, gconstpointer key, gpointer* value); + void (*clear) (GeeMap* self); + GeeMapIterator* (*map_iterator) (GeeMap* self); + void (*set_all) (GeeMap* self, GeeMap* map); + gboolean (*unset_all) (GeeMap* self, GeeMap* map); + gboolean (*remove_all) (GeeMap* self, GeeMap* map); + gboolean (*has_all) (GeeMap* self, GeeMap* map); + gboolean (*contains_all) (GeeMap* self, GeeMap* map); + gint (*get_size) (GeeMap* self); + gboolean (*get_is_empty) (GeeMap* self); + GeeSet* (*get_keys) (GeeMap* self); + GeeCollection* (*get_values) (GeeMap* self); + GeeSet* (*get_entries) (GeeMap* self); + GeeMap* (*get_read_only_view) (GeeMap* self); + GType (*get_key_type) (GeeMap* self); + GType (*get_value_type) (GeeMap* self); +}; + +struct _GeeAbstractMap { + GObject parent_instance; + GeeAbstractMapPrivate * priv; +}; + +struct _GeeAbstractMapClass { + GObjectClass parent_class; + gboolean (*has_key) (GeeAbstractMap* self, gconstpointer key); + gboolean (*has) (GeeAbstractMap* self, gconstpointer key, gconstpointer value); + gpointer (*get) (GeeAbstractMap* self, gconstpointer key); + void (*set) (GeeAbstractMap* self, gconstpointer key, gconstpointer value); + gboolean (*unset) (GeeAbstractMap* self, gconstpointer key, gpointer* value); + GeeMapIterator* (*map_iterator) (GeeAbstractMap* self); + void (*clear) (GeeAbstractMap* self); + void (*set_all) (GeeAbstractMap* self, GeeMap* map); + gboolean (*unset_all) (GeeAbstractMap* self, GeeMap* map); + gboolean (*has_all) (GeeAbstractMap* self, GeeMap* map); + gint (*get_size) (GeeAbstractMap* self); + gboolean (*get_is_empty) (GeeAbstractMap* self); + GeeSet* (*get_keys) (GeeAbstractMap* self); + GeeCollection* (*get_values) (GeeAbstractMap* self); + GeeSet* (*get_entries) (GeeAbstractMap* self); + GeeMap* (*get_read_only_view) (GeeAbstractMap* self); +}; + +struct _GeeMultiSetIface { + GTypeInterface parent_iface; + gint (*count) (GeeMultiSet* self, gconstpointer item); +}; + +struct _GeeMultiMapIface { + GTypeInterface parent_iface; + GeeSet* (*get_keys) (GeeMultiMap* self); + GeeMultiSet* (*get_all_keys) (GeeMultiMap* self); + GeeCollection* (*get_values) (GeeMultiMap* self); + gboolean (*contains) (GeeMultiMap* self, gconstpointer key); + GeeCollection* (*get) (GeeMultiMap* self, gconstpointer key); + void (*set) (GeeMultiMap* self, gconstpointer key, gconstpointer value); + gboolean (*remove) (GeeMultiMap* self, gconstpointer key, gconstpointer value); + gboolean (*remove_all) (GeeMultiMap* self, gconstpointer key); + void (*clear) (GeeMultiMap* self); + gint (*get_size) (GeeMultiMap* self); +}; + +struct _GeeAbstractMultiMap { + GObject parent_instance; + GeeAbstractMultiMapPrivate * priv; + GeeMap* _storage_map; +}; + +struct _GeeAbstractMultiMapClass { + GObjectClass parent_class; + GeeCollection* (*create_value_storage) (GeeAbstractMultiMap* self); + GeeMultiSet* (*create_multi_key_set) (GeeAbstractMultiMap* self); + GEqualFunc (*get_value_equal_func) (GeeAbstractMultiMap* self); +}; + +struct _GeeAbstractMultiSet { + GeeAbstractCollection parent_instance; + GeeAbstractMultiSetPrivate * priv; + GeeMap* _storage_map; +}; + +struct _GeeAbstractMultiSetClass { + GeeAbstractCollectionClass parent_class; +}; + +struct _GeeQueueIface { + GTypeInterface parent_iface; + gboolean (*offer) (GeeQueue* self, gconstpointer element); + gpointer (*peek) (GeeQueue* self); + gpointer (*poll) (GeeQueue* self); + gint (*drain) (GeeQueue* self, GeeCollection* recipient, gint amount); + gint (*get_capacity) (GeeQueue* self); + gint (*get_remaining_capacity) (GeeQueue* self); + gboolean (*get_is_full) (GeeQueue* self); +}; + +struct _GeeAbstractQueue { + GeeAbstractCollection parent_instance; + GeeAbstractQueuePrivate * priv; +}; + +struct _GeeAbstractQueueClass { + GeeAbstractCollectionClass parent_class; + gboolean (*offer) (GeeAbstractQueue* self, gconstpointer element); + gpointer (*peek) (GeeAbstractQueue* self); + gpointer (*poll) (GeeAbstractQueue* self); + gint (*drain) (GeeAbstractQueue* self, GeeCollection* recipient, gint amount); + gint (*get_capacity) (GeeAbstractQueue* self); + gint (*get_remaining_capacity) (GeeAbstractQueue* self); + gboolean (*get_is_full) (GeeAbstractQueue* self); +}; + +struct _GeeAbstractSet { + GeeAbstractCollection parent_instance; + GeeAbstractSetPrivate * priv; +}; + +struct _GeeAbstractSetClass { + GeeAbstractCollectionClass parent_class; + GeeSet* (*get_read_only_view) (GeeAbstractSet* self); +}; + +struct _GeeArrayList { + GeeAbstractList parent_instance; + GeeArrayListPrivate * priv; + gpointer* _items; + gint _items_length1; + gint __items_size_; + gint _size; +}; + +struct _GeeArrayListClass { + GeeAbstractListClass parent_class; +}; + +struct _GeeComparableIface { + GTypeInterface parent_iface; + gint (*compare_to) (GeeComparable* self, gconstpointer object); +}; + +struct _GeeDequeIface { + GTypeInterface parent_iface; + gboolean (*offer_head) (GeeDeque* self, gconstpointer element); + gpointer (*peek_head) (GeeDeque* self); + gpointer (*poll_head) (GeeDeque* self); + gint (*drain_head) (GeeDeque* self, GeeCollection* recipient, gint amount); + gboolean (*offer_tail) (GeeDeque* self, gconstpointer element); + gpointer (*peek_tail) (GeeDeque* self); + gpointer (*poll_tail) (GeeDeque* self); + gint (*drain_tail) (GeeDeque* self, GeeCollection* recipient, gint amount); +}; + +struct _GeeHashMap { + GeeAbstractMap parent_instance; + GeeHashMapPrivate * priv; +}; + +struct _GeeHashMapClass { + GeeAbstractMapClass parent_class; +}; + +struct _GeeHashMultiMap { + GeeAbstractMultiMap parent_instance; + GeeHashMultiMapPrivate * priv; +}; + +struct _GeeHashMultiMapClass { + GeeAbstractMultiMapClass parent_class; +}; + +struct _GeeHashMultiSet { + GeeAbstractMultiSet parent_instance; + GeeHashMultiSetPrivate * priv; +}; + +struct _GeeHashMultiSetClass { + GeeAbstractMultiSetClass parent_class; +}; + +struct _GeeHashSet { + GeeAbstractSet parent_instance; + GeeHashSetPrivate * priv; +}; + +struct _GeeHashSetClass { + GeeAbstractSetClass parent_class; +}; + +struct _GeeLinkedList { + GeeAbstractList parent_instance; + GeeLinkedListPrivate * priv; +}; + +struct _GeeLinkedListClass { + GeeAbstractListClass parent_class; +}; + +struct _GeeMapEntry { + GObject parent_instance; + GeeMapEntryPrivate * priv; +}; + +struct _GeeMapEntryClass { + GObjectClass parent_class; + gconstpointer (*get_key) (GeeMapEntry* self); + gconstpointer (*get_value) (GeeMapEntry* self); + void (*set_value) (GeeMapEntry* self, gconstpointer value); +}; + +struct _GeePriorityQueue { + GeeAbstractQueue parent_instance; + GeePriorityQueuePrivate * priv; +}; + +struct _GeePriorityQueueClass { + GeeAbstractQueueClass parent_class; +}; + +struct _GeeSortedSetIface { + GTypeInterface parent_iface; + gpointer (*first) (GeeSortedSet* self); + gpointer (*last) (GeeSortedSet* self); + GeeBidirIterator* (*bidir_iterator) (GeeSortedSet* self); + GeeBidirIterator* (*iterator_at) (GeeSortedSet* self, gconstpointer element); + gpointer (*lower) (GeeSortedSet* self, gconstpointer element); + gpointer (*higher) (GeeSortedSet* self, gconstpointer element); + gpointer (*floor) (GeeSortedSet* self, gconstpointer element); + gpointer (*ceil) (GeeSortedSet* self, gconstpointer element); + GeeSortedSet* (*head_set) (GeeSortedSet* self, gconstpointer before); + GeeSortedSet* (*tail_set) (GeeSortedSet* self, gconstpointer after); + GeeSortedSet* (*sub_set) (GeeSortedSet* self, gconstpointer from, gconstpointer to); +}; + +struct _GeeTreeMap { + GeeAbstractMap parent_instance; + GeeTreeMapPrivate * priv; +}; + +struct _GeeTreeMapClass { + GeeAbstractMapClass parent_class; +}; + +struct _GeeTreeMultiMap { + GeeAbstractMultiMap parent_instance; + GeeTreeMultiMapPrivate * priv; +}; + +struct _GeeTreeMultiMapClass { + GeeAbstractMultiMapClass parent_class; +}; + +struct _GeeTreeMultiSet { + GeeAbstractMultiSet parent_instance; + GeeTreeMultiSetPrivate * priv; +}; + +struct _GeeTreeMultiSetClass { + GeeAbstractMultiSetClass parent_class; +}; + +struct _GeeTreeSet { + GeeAbstractSet parent_instance; + GeeTreeSetPrivate * priv; +}; + +struct _GeeTreeSetClass { + GeeAbstractSetClass parent_class; +}; + + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +gboolean gee_abstract_collection_contains (GeeAbstractCollection* self, gconstpointer item); +gboolean gee_abstract_collection_add (GeeAbstractCollection* self, gconstpointer item); +gboolean gee_abstract_collection_remove (GeeAbstractCollection* self, gconstpointer item); +void gee_abstract_collection_clear (GeeAbstractCollection* self); +gpointer* gee_abstract_collection_to_array (GeeAbstractCollection* self, int* result_length1); +gboolean gee_abstract_collection_add_all (GeeAbstractCollection* self, GeeCollection* collection); +gboolean gee_abstract_collection_contains_all (GeeAbstractCollection* self, GeeCollection* collection); +gboolean gee_abstract_collection_remove_all (GeeAbstractCollection* self, GeeCollection* collection); +gboolean gee_abstract_collection_retain_all (GeeAbstractCollection* self, GeeCollection* collection); +GeeIterator* gee_abstract_collection_iterator (GeeAbstractCollection* self); +GeeAbstractCollection* gee_abstract_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +gint gee_abstract_collection_get_size (GeeAbstractCollection* self); +gboolean gee_abstract_collection_get_is_empty (GeeAbstractCollection* self); +GeeCollection* gee_abstract_collection_get_read_only_view (GeeAbstractCollection* self); +GType gee_bidir_iterator_get_type (void) G_GNUC_CONST; +GType gee_list_iterator_get_type (void) G_GNUC_CONST; +GType gee_list_get_type (void) G_GNUC_CONST; +GType gee_abstract_list_get_type (void) G_GNUC_CONST; +GeeListIterator* gee_abstract_list_list_iterator (GeeAbstractList* self); +gpointer gee_abstract_list_get (GeeAbstractList* self, gint index); +void gee_abstract_list_set (GeeAbstractList* self, gint index, gconstpointer item); +gint gee_abstract_list_index_of (GeeAbstractList* self, gconstpointer item); +void gee_abstract_list_insert (GeeAbstractList* self, gint index, gconstpointer item); +gpointer gee_abstract_list_remove_at (GeeAbstractList* self, gint index); +GeeList* gee_abstract_list_slice (GeeAbstractList* self, gint start, gint stop); +gpointer gee_abstract_list_first (GeeAbstractList* self); +gpointer gee_abstract_list_last (GeeAbstractList* self); +void gee_abstract_list_insert_all (GeeAbstractList* self, gint index, GeeCollection* collection); +GeeAbstractList* gee_abstract_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeList* gee_abstract_list_get_read_only_view (GeeAbstractList* self); +GType gee_map_iterator_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_map_entry_get_type (void) G_GNUC_CONST; +GType gee_map_get_type (void) G_GNUC_CONST; +GType gee_abstract_map_get_type (void) G_GNUC_CONST; +gboolean gee_abstract_map_has_key (GeeAbstractMap* self, gconstpointer key); +gboolean gee_abstract_map_has (GeeAbstractMap* self, gconstpointer key, gconstpointer value); +gpointer gee_abstract_map_get (GeeAbstractMap* self, gconstpointer key); +void gee_abstract_map_set (GeeAbstractMap* self, gconstpointer key, gconstpointer value); +gboolean gee_abstract_map_unset (GeeAbstractMap* self, gconstpointer key, gpointer* value); +GeeMapIterator* gee_abstract_map_map_iterator (GeeAbstractMap* self); +void gee_abstract_map_clear (GeeAbstractMap* self); +void gee_abstract_map_set_all (GeeAbstractMap* self, GeeMap* map); +gboolean gee_abstract_map_unset_all (GeeAbstractMap* self, GeeMap* map); +gboolean gee_abstract_map_has_all (GeeAbstractMap* self, GeeMap* map); +GeeAbstractMap* gee_abstract_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func); +gint gee_abstract_map_get_size (GeeAbstractMap* self); +gboolean gee_abstract_map_get_is_empty (GeeAbstractMap* self); +GeeSet* gee_abstract_map_get_keys (GeeAbstractMap* self); +GeeCollection* gee_abstract_map_get_values (GeeAbstractMap* self); +GeeSet* gee_abstract_map_get_entries (GeeAbstractMap* self); +GeeMap* gee_abstract_map_get_read_only_view (GeeAbstractMap* self); +GType gee_multi_set_get_type (void) G_GNUC_CONST; +GType gee_multi_map_get_type (void) G_GNUC_CONST; +GType gee_abstract_multi_map_get_type (void) G_GNUC_CONST; +GeeAbstractMultiMap* gee_abstract_multi_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeMap* storage_map); +GeeCollection* gee_abstract_multi_map_create_value_storage (GeeAbstractMultiMap* self); +GeeMultiSet* gee_abstract_multi_map_create_multi_key_set (GeeAbstractMultiMap* self); +GEqualFunc gee_abstract_multi_map_get_value_equal_func (GeeAbstractMultiMap* self); +GType gee_abstract_multi_set_get_type (void) G_GNUC_CONST; +GeeAbstractMultiSet* gee_abstract_multi_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeMap* storage_map); +GType gee_queue_get_type (void) G_GNUC_CONST; +GType gee_abstract_queue_get_type (void) G_GNUC_CONST; +gboolean gee_abstract_queue_offer (GeeAbstractQueue* self, gconstpointer element); +gpointer gee_abstract_queue_peek (GeeAbstractQueue* self); +gpointer gee_abstract_queue_poll (GeeAbstractQueue* self); +gint gee_abstract_queue_drain (GeeAbstractQueue* self, GeeCollection* recipient, gint amount); +GeeAbstractQueue* gee_abstract_queue_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +gint gee_abstract_queue_get_capacity (GeeAbstractQueue* self); +gint gee_abstract_queue_get_remaining_capacity (GeeAbstractQueue* self); +gboolean gee_abstract_queue_get_is_full (GeeAbstractQueue* self); +GType gee_abstract_set_get_type (void) G_GNUC_CONST; +GeeAbstractSet* gee_abstract_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeSet* gee_abstract_set_get_read_only_view (GeeAbstractSet* self); +GType gee_array_list_get_type (void) G_GNUC_CONST; +GeeArrayList* gee_array_list_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func); +GeeArrayList* gee_array_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func); +void gee_array_list_sort_with_data (GeeArrayList* self, GCompareDataFunc compare, void* compare_target); +GEqualFunc gee_array_list_get_equal_func (GeeArrayList* self); +gboolean gee_bidir_iterator_previous (GeeBidirIterator* self); +gboolean gee_bidir_iterator_has_previous (GeeBidirIterator* self); +gboolean gee_bidir_iterator_last (GeeBidirIterator* self); +gboolean gee_collection_contains (GeeCollection* self, gconstpointer item); +gboolean gee_collection_add (GeeCollection* self, gconstpointer item); +gboolean gee_collection_remove (GeeCollection* self, gconstpointer item); +void gee_collection_clear (GeeCollection* self); +gboolean gee_collection_add_all (GeeCollection* self, GeeCollection* collection); +gboolean gee_collection_contains_all (GeeCollection* self, GeeCollection* collection); +gboolean gee_collection_remove_all (GeeCollection* self, GeeCollection* collection); +gboolean gee_collection_retain_all (GeeCollection* self, GeeCollection* collection); +gpointer* gee_collection_to_array (GeeCollection* self, int* result_length1); +GeeCollection* gee_collection_empty (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +gint gee_collection_get_size (GeeCollection* self); +gboolean gee_collection_get_is_empty (GeeCollection* self); +GeeCollection* gee_collection_get_read_only_view (GeeCollection* self); +GType gee_comparable_get_type (void) G_GNUC_CONST; +gint gee_comparable_compare_to (GeeComparable* self, gconstpointer object); +GType gee_deque_get_type (void) G_GNUC_CONST; +gboolean gee_deque_offer_head (GeeDeque* self, gconstpointer element); +gpointer gee_deque_peek_head (GeeDeque* self); +gpointer gee_deque_poll_head (GeeDeque* self); +gint gee_deque_drain_head (GeeDeque* self, GeeCollection* recipient, gint amount); +gboolean gee_deque_offer_tail (GeeDeque* self, gconstpointer element); +gpointer gee_deque_peek_tail (GeeDeque* self); +gpointer gee_deque_poll_tail (GeeDeque* self); +gint gee_deque_drain_tail (GeeDeque* self, GeeCollection* recipient, gint amount); +GEqualFunc gee_functions_get_equal_func_for (GType t); +GHashFunc gee_functions_get_hash_func_for (GType t); +GCompareFunc gee_functions_get_compare_func_for (GType t); +gint gee_direct_compare (void* _val1, void* _val2); +GType gee_hash_map_get_type (void) G_GNUC_CONST; +GeeHashMap* gee_hash_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GEqualFunc value_equal_func); +GeeHashMap* gee_hash_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GEqualFunc value_equal_func); +GHashFunc gee_hash_map_get_key_hash_func (GeeHashMap* self); +GEqualFunc gee_hash_map_get_key_equal_func (GeeHashMap* self); +GEqualFunc gee_hash_map_get_value_equal_func (GeeHashMap* self); +GType gee_hash_multi_map_get_type (void) G_GNUC_CONST; +GeeHashMultiMap* gee_hash_multi_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GHashFunc value_hash_func, GEqualFunc value_equal_func); +GeeHashMultiMap* gee_hash_multi_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GHashFunc value_hash_func, GEqualFunc value_equal_func); +GHashFunc gee_hash_multi_map_get_key_hash_func (GeeHashMultiMap* self); +GEqualFunc gee_hash_multi_map_get_key_equal_func (GeeHashMultiMap* self); +GHashFunc gee_hash_multi_map_get_value_hash_func (GeeHashMultiMap* self); +GEqualFunc gee_hash_multi_map_get_value_equal_func (GeeHashMultiMap* self); +GType gee_hash_multi_set_get_type (void) G_GNUC_CONST; +GeeHashMultiSet* gee_hash_multi_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func); +GeeHashMultiSet* gee_hash_multi_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func); +GHashFunc gee_hash_multi_set_get_hash_func (GeeHashMultiSet* self); +GEqualFunc gee_hash_multi_set_get_equal_func (GeeHashMultiSet* self); +GType gee_hash_set_get_type (void) G_GNUC_CONST; +GeeHashSet* gee_hash_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func); +GeeHashSet* gee_hash_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func); +GHashFunc gee_hash_set_get_hash_func (GeeHashSet* self); +GEqualFunc gee_hash_set_get_equal_func (GeeHashSet* self); +GeeIterator* gee_iterable_iterator (GeeIterable* self); +GType gee_iterable_get_element_type (GeeIterable* self); +gboolean gee_iterator_next (GeeIterator* self); +gboolean gee_iterator_has_next (GeeIterator* self); +gboolean gee_iterator_first (GeeIterator* self); +gpointer gee_iterator_get (GeeIterator* self); +void gee_iterator_remove (GeeIterator* self); +GType gee_linked_list_get_type (void) G_GNUC_CONST; +GeeLinkedList* gee_linked_list_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func); +GeeLinkedList* gee_linked_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func); +GEqualFunc gee_linked_list_get_equal_func (GeeLinkedList* self); +GeeListIterator* gee_list_list_iterator (GeeList* self); +gpointer gee_list_get (GeeList* self, gint index); +void gee_list_set (GeeList* self, gint index, gconstpointer item); +gint gee_list_index_of (GeeList* self, gconstpointer item); +void gee_list_insert (GeeList* self, gint index, gconstpointer item); +gpointer gee_list_remove_at (GeeList* self, gint index); +GeeList* gee_list_slice (GeeList* self, gint start, gint stop); +gpointer gee_list_first (GeeList* self); +gpointer gee_list_last (GeeList* self); +void gee_list_insert_all (GeeList* self, gint index, GeeCollection* collection); +void gee_list_sort (GeeList* self, GCompareFunc compare_func); +GeeList* gee_list_empty (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeList* gee_list_get_read_only_view (GeeList* self); +void gee_list_iterator_set (GeeListIterator* self, gconstpointer item); +void gee_list_iterator_insert (GeeListIterator* self, gconstpointer item); +void gee_list_iterator_add (GeeListIterator* self, gconstpointer item); +gint gee_list_iterator_index (GeeListIterator* self); +gboolean gee_map_has_key (GeeMap* self, gconstpointer key); +gboolean gee_map_contains (GeeMap* self, gconstpointer key) G_GNUC_DEPRECATED; +gboolean gee_map_has (GeeMap* self, gconstpointer key, gconstpointer value); +gpointer gee_map_get (GeeMap* self, gconstpointer key); +void gee_map_set (GeeMap* self, gconstpointer key, gconstpointer value); +gboolean gee_map_unset (GeeMap* self, gconstpointer key, gpointer* value); +gboolean gee_map_remove (GeeMap* self, gconstpointer key, gpointer* value) G_GNUC_DEPRECATED; +void gee_map_clear (GeeMap* self); +GeeMapIterator* gee_map_map_iterator (GeeMap* self); +void gee_map_set_all (GeeMap* self, GeeMap* map); +gboolean gee_map_unset_all (GeeMap* self, GeeMap* map); +gboolean gee_map_remove_all (GeeMap* self, GeeMap* map) G_GNUC_DEPRECATED; +gboolean gee_map_has_all (GeeMap* self, GeeMap* map); +gboolean gee_map_contains_all (GeeMap* self, GeeMap* map) G_GNUC_DEPRECATED; +GeeMap* gee_map_empty (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func); +gint gee_map_get_size (GeeMap* self); +gboolean gee_map_get_is_empty (GeeMap* self); +GeeSet* gee_map_get_keys (GeeMap* self); +GeeCollection* gee_map_get_values (GeeMap* self); +GeeSet* gee_map_get_entries (GeeMap* self); +GeeMap* gee_map_get_read_only_view (GeeMap* self); +GType gee_map_get_key_type (GeeMap* self); +GType gee_map_get_value_type (GeeMap* self); +GeeMapEntry* gee_map_entry_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func); +gconstpointer gee_map_entry_get_key (GeeMapEntry* self); +gconstpointer gee_map_entry_get_value (GeeMapEntry* self); +void gee_map_entry_set_value (GeeMapEntry* self, gconstpointer value); +gboolean gee_map_iterator_next (GeeMapIterator* self); +gboolean gee_map_iterator_has_next (GeeMapIterator* self); +gboolean gee_map_iterator_first (GeeMapIterator* self); +gpointer gee_map_iterator_get_key (GeeMapIterator* self); +gpointer gee_map_iterator_get_value (GeeMapIterator* self); +void gee_map_iterator_set_value (GeeMapIterator* self, gconstpointer value); +void gee_map_iterator_unset (GeeMapIterator* self); +GeeSet* gee_multi_map_get_keys (GeeMultiMap* self); +GeeMultiSet* gee_multi_map_get_all_keys (GeeMultiMap* self); +GeeCollection* gee_multi_map_get_values (GeeMultiMap* self); +gboolean gee_multi_map_contains (GeeMultiMap* self, gconstpointer key); +GeeCollection* gee_multi_map_get (GeeMultiMap* self, gconstpointer key); +void gee_multi_map_set (GeeMultiMap* self, gconstpointer key, gconstpointer value); +gboolean gee_multi_map_remove (GeeMultiMap* self, gconstpointer key, gconstpointer value); +gboolean gee_multi_map_remove_all (GeeMultiMap* self, gconstpointer key); +void gee_multi_map_clear (GeeMultiMap* self); +gint gee_multi_map_get_size (GeeMultiMap* self); +gint gee_multi_set_count (GeeMultiSet* self, gconstpointer item); +GType gee_priority_queue_get_type (void) G_GNUC_CONST; +GeePriorityQueue* gee_priority_queue_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func); +GeePriorityQueue* gee_priority_queue_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func); +GCompareFunc gee_priority_queue_get_compare_func (GeePriorityQueue* self); +gboolean gee_queue_offer (GeeQueue* self, gconstpointer element); +gpointer gee_queue_peek (GeeQueue* self); +gpointer gee_queue_poll (GeeQueue* self); +gint gee_queue_drain (GeeQueue* self, GeeCollection* recipient, gint amount); +#define GEE_QUEUE_UNBOUNDED_CAPACITY (-1) +gint gee_queue_get_capacity (GeeQueue* self); +gint gee_queue_get_remaining_capacity (GeeQueue* self); +gboolean gee_queue_get_is_full (GeeQueue* self); +GeeSet* gee_set_empty (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeSet* gee_set_get_read_only_view (GeeSet* self); +GType gee_sorted_set_get_type (void) G_GNUC_CONST; +gpointer gee_sorted_set_first (GeeSortedSet* self); +gpointer gee_sorted_set_last (GeeSortedSet* self); +GeeBidirIterator* gee_sorted_set_bidir_iterator (GeeSortedSet* self); +GeeBidirIterator* gee_sorted_set_iterator_at (GeeSortedSet* self, gconstpointer element); +gpointer gee_sorted_set_lower (GeeSortedSet* self, gconstpointer element); +gpointer gee_sorted_set_higher (GeeSortedSet* self, gconstpointer element); +gpointer gee_sorted_set_floor (GeeSortedSet* self, gconstpointer element); +gpointer gee_sorted_set_ceil (GeeSortedSet* self, gconstpointer element); +GeeSortedSet* gee_sorted_set_head_set (GeeSortedSet* self, gconstpointer before); +GeeSortedSet* gee_sorted_set_tail_set (GeeSortedSet* self, gconstpointer after); +GeeSortedSet* gee_sorted_set_sub_set (GeeSortedSet* self, gconstpointer from, gconstpointer to); +GType gee_tree_map_get_type (void) G_GNUC_CONST; +GeeTreeMap* gee_tree_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GCompareFunc key_compare_func, GEqualFunc value_equal_func); +GeeTreeMap* gee_tree_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GCompareFunc key_compare_func, GEqualFunc value_equal_func); +GCompareFunc gee_tree_map_get_key_compare_func (GeeTreeMap* self); +GEqualFunc gee_tree_map_get_value_equal_func (GeeTreeMap* self); +GType gee_tree_multi_map_get_type (void) G_GNUC_CONST; +GeeTreeMultiMap* gee_tree_multi_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GCompareFunc key_compare_func, GCompareFunc value_compare_func); +GeeTreeMultiMap* gee_tree_multi_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GCompareFunc key_compare_func, GCompareFunc value_compare_func); +GCompareFunc gee_tree_multi_map_get_key_compare_func (GeeTreeMultiMap* self); +GCompareFunc gee_tree_multi_map_get_value_compare_func (GeeTreeMultiMap* self); +GType gee_tree_multi_set_get_type (void) G_GNUC_CONST; +GeeTreeMultiSet* gee_tree_multi_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func); +GeeTreeMultiSet* gee_tree_multi_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func); +GCompareFunc gee_tree_multi_set_get_compare_func (GeeTreeMultiSet* self); +GType gee_tree_set_get_type (void) G_GNUC_CONST; +GeeTreeSet* gee_tree_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func); +GeeTreeSet* gee_tree_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func); +GCompareFunc gee_tree_set_get_compare_func (GeeTreeSet* self); + + +G_END_DECLS + +#endif diff --git a/gee/gee.vala.stamp b/gee/gee.vala.stamp new file mode 100644 index 0000000..e69de29 diff --git a/gee/hashmap.c b/gee/hashmap.c new file mode 100644 index 0000000..2f853a6 --- /dev/null +++ b/gee/hashmap.c @@ -0,0 +1,3646 @@ +/* hashmap.c generated by valac 0.18.0, the Vala compiler + * generated from hashmap.vala, do not modify */ + +/* hashmap.vala + * + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * Copyright (C) 1997-2000 GLib Team and others + * Copyright (C) 2007-2009 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_MAP (gee_map_get_type ()) +#define GEE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP, GeeMap)) +#define GEE_IS_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP)) +#define GEE_MAP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP, GeeMapIface)) + +typedef struct _GeeMap GeeMap; +typedef struct _GeeMapIface GeeMapIface; + +#define GEE_TYPE_MAP_ITERATOR (gee_map_iterator_get_type ()) +#define GEE_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIterator)) +#define GEE_IS_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP_ITERATOR)) +#define GEE_MAP_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIteratorIface)) + +typedef struct _GeeMapIterator GeeMapIterator; +typedef struct _GeeMapIteratorIface GeeMapIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_MAP_TYPE_ENTRY (gee_map_entry_get_type ()) +#define GEE_MAP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntry)) +#define GEE_MAP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) +#define GEE_MAP_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) + +typedef struct _GeeMapEntry GeeMapEntry; +typedef struct _GeeMapEntryClass GeeMapEntryClass; + +#define GEE_TYPE_ABSTRACT_MAP (gee_abstract_map_get_type ()) +#define GEE_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap)) +#define GEE_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) +#define GEE_IS_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_IS_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_ABSTRACT_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) + +typedef struct _GeeAbstractMap GeeAbstractMap; +typedef struct _GeeAbstractMapClass GeeAbstractMapClass; +typedef struct _GeeAbstractMapPrivate GeeAbstractMapPrivate; + +#define GEE_TYPE_HASH_MAP (gee_hash_map_get_type ()) +#define GEE_HASH_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_HASH_MAP, GeeHashMap)) +#define GEE_HASH_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_HASH_MAP, GeeHashMapClass)) +#define GEE_IS_HASH_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_HASH_MAP)) +#define GEE_IS_HASH_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_HASH_MAP)) +#define GEE_HASH_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_HASH_MAP, GeeHashMapClass)) + +typedef struct _GeeHashMap GeeHashMap; +typedef struct _GeeHashMapClass GeeHashMapClass; +typedef struct _GeeHashMapPrivate GeeHashMapPrivate; +typedef struct _GeeHashMapNode GeeHashMapNode; +#define _gee_hash_map_node_free0(var) ((var == NULL) ? NULL : (var = (gee_hash_map_node_free (var), NULL))) + +#define GEE_HASH_MAP_TYPE_NODE_ITERATOR (gee_hash_map_node_iterator_get_type ()) +#define GEE_HASH_MAP_NODE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_HASH_MAP_TYPE_NODE_ITERATOR, GeeHashMapNodeIterator)) +#define GEE_HASH_MAP_NODE_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_HASH_MAP_TYPE_NODE_ITERATOR, GeeHashMapNodeIteratorClass)) +#define GEE_HASH_MAP_IS_NODE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_HASH_MAP_TYPE_NODE_ITERATOR)) +#define GEE_HASH_MAP_IS_NODE_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_HASH_MAP_TYPE_NODE_ITERATOR)) +#define GEE_HASH_MAP_NODE_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_HASH_MAP_TYPE_NODE_ITERATOR, GeeHashMapNodeIteratorClass)) + +typedef struct _GeeHashMapNodeIterator GeeHashMapNodeIterator; +typedef struct _GeeHashMapNodeIteratorClass GeeHashMapNodeIteratorClass; + +#define GEE_HASH_MAP_TYPE_MAP_ITERATOR (gee_hash_map_map_iterator_get_type ()) +#define GEE_HASH_MAP_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_HASH_MAP_TYPE_MAP_ITERATOR, GeeHashMapMapIterator)) +#define GEE_HASH_MAP_MAP_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_HASH_MAP_TYPE_MAP_ITERATOR, GeeHashMapMapIteratorClass)) +#define GEE_HASH_MAP_IS_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_HASH_MAP_TYPE_MAP_ITERATOR)) +#define GEE_HASH_MAP_IS_MAP_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_HASH_MAP_TYPE_MAP_ITERATOR)) +#define GEE_HASH_MAP_MAP_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_HASH_MAP_TYPE_MAP_ITERATOR, GeeHashMapMapIteratorClass)) + +typedef struct _GeeHashMapMapIterator GeeHashMapMapIterator; +typedef struct _GeeHashMapMapIteratorClass GeeHashMapMapIteratorClass; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; + +#define GEE_TYPE_ABSTRACT_SET (gee_abstract_set_get_type ()) +#define GEE_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSet)) +#define GEE_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) +#define GEE_IS_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_SET)) +#define GEE_IS_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_SET)) +#define GEE_ABSTRACT_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) + +typedef struct _GeeAbstractSet GeeAbstractSet; +typedef struct _GeeAbstractSetClass GeeAbstractSetClass; + +#define GEE_HASH_MAP_TYPE_KEY_SET (gee_hash_map_key_set_get_type ()) +#define GEE_HASH_MAP_KEY_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_HASH_MAP_TYPE_KEY_SET, GeeHashMapKeySet)) +#define GEE_HASH_MAP_KEY_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_HASH_MAP_TYPE_KEY_SET, GeeHashMapKeySetClass)) +#define GEE_HASH_MAP_IS_KEY_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_HASH_MAP_TYPE_KEY_SET)) +#define GEE_HASH_MAP_IS_KEY_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_HASH_MAP_TYPE_KEY_SET)) +#define GEE_HASH_MAP_KEY_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_HASH_MAP_TYPE_KEY_SET, GeeHashMapKeySetClass)) + +typedef struct _GeeHashMapKeySet GeeHashMapKeySet; +typedef struct _GeeHashMapKeySetClass GeeHashMapKeySetClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define GEE_HASH_MAP_TYPE_VALUE_COLLECTION (gee_hash_map_value_collection_get_type ()) +#define GEE_HASH_MAP_VALUE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_HASH_MAP_TYPE_VALUE_COLLECTION, GeeHashMapValueCollection)) +#define GEE_HASH_MAP_VALUE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_HASH_MAP_TYPE_VALUE_COLLECTION, GeeHashMapValueCollectionClass)) +#define GEE_HASH_MAP_IS_VALUE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_HASH_MAP_TYPE_VALUE_COLLECTION)) +#define GEE_HASH_MAP_IS_VALUE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_HASH_MAP_TYPE_VALUE_COLLECTION)) +#define GEE_HASH_MAP_VALUE_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_HASH_MAP_TYPE_VALUE_COLLECTION, GeeHashMapValueCollectionClass)) + +typedef struct _GeeHashMapValueCollection GeeHashMapValueCollection; +typedef struct _GeeHashMapValueCollectionClass GeeHashMapValueCollectionClass; + +#define GEE_HASH_MAP_TYPE_ENTRY_SET (gee_hash_map_entry_set_get_type ()) +#define GEE_HASH_MAP_ENTRY_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_HASH_MAP_TYPE_ENTRY_SET, GeeHashMapEntrySet)) +#define GEE_HASH_MAP_ENTRY_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_HASH_MAP_TYPE_ENTRY_SET, GeeHashMapEntrySetClass)) +#define GEE_HASH_MAP_IS_ENTRY_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_HASH_MAP_TYPE_ENTRY_SET)) +#define GEE_HASH_MAP_IS_ENTRY_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_HASH_MAP_TYPE_ENTRY_SET)) +#define GEE_HASH_MAP_ENTRY_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_HASH_MAP_TYPE_ENTRY_SET, GeeHashMapEntrySetClass)) + +typedef struct _GeeHashMapEntrySet GeeHashMapEntrySet; +typedef struct _GeeHashMapEntrySetClass GeeHashMapEntrySetClass; +typedef struct _GeeMapEntryPrivate GeeMapEntryPrivate; + +#define GEE_HASH_MAP_TYPE_ENTRY (gee_hash_map_entry_get_type ()) +#define GEE_HASH_MAP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_HASH_MAP_TYPE_ENTRY, GeeHashMapEntry)) +#define GEE_HASH_MAP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_HASH_MAP_TYPE_ENTRY, GeeHashMapEntryClass)) +#define GEE_HASH_MAP_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_HASH_MAP_TYPE_ENTRY)) +#define GEE_HASH_MAP_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_HASH_MAP_TYPE_ENTRY)) +#define GEE_HASH_MAP_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_HASH_MAP_TYPE_ENTRY, GeeHashMapEntryClass)) + +typedef struct _GeeHashMapEntry GeeHashMapEntry; +typedef struct _GeeHashMapEntryClass GeeHashMapEntryClass; +typedef struct _GeeHashMapEntryPrivate GeeHashMapEntryPrivate; +typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate; +typedef struct _GeeAbstractSetPrivate GeeAbstractSetPrivate; +typedef struct _GeeHashMapKeySetPrivate GeeHashMapKeySetPrivate; + +#define GEE_HASH_MAP_TYPE_KEY_ITERATOR (gee_hash_map_key_iterator_get_type ()) +#define GEE_HASH_MAP_KEY_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_HASH_MAP_TYPE_KEY_ITERATOR, GeeHashMapKeyIterator)) +#define GEE_HASH_MAP_KEY_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_HASH_MAP_TYPE_KEY_ITERATOR, GeeHashMapKeyIteratorClass)) +#define GEE_HASH_MAP_IS_KEY_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_HASH_MAP_TYPE_KEY_ITERATOR)) +#define GEE_HASH_MAP_IS_KEY_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_HASH_MAP_TYPE_KEY_ITERATOR)) +#define GEE_HASH_MAP_KEY_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_HASH_MAP_TYPE_KEY_ITERATOR, GeeHashMapKeyIteratorClass)) + +typedef struct _GeeHashMapKeyIterator GeeHashMapKeyIterator; +typedef struct _GeeHashMapKeyIteratorClass GeeHashMapKeyIteratorClass; +typedef struct _GeeHashMapValueCollectionPrivate GeeHashMapValueCollectionPrivate; + +#define GEE_HASH_MAP_TYPE_VALUE_ITERATOR (gee_hash_map_value_iterator_get_type ()) +#define GEE_HASH_MAP_VALUE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_HASH_MAP_TYPE_VALUE_ITERATOR, GeeHashMapValueIterator)) +#define GEE_HASH_MAP_VALUE_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_HASH_MAP_TYPE_VALUE_ITERATOR, GeeHashMapValueIteratorClass)) +#define GEE_HASH_MAP_IS_VALUE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_HASH_MAP_TYPE_VALUE_ITERATOR)) +#define GEE_HASH_MAP_IS_VALUE_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_HASH_MAP_TYPE_VALUE_ITERATOR)) +#define GEE_HASH_MAP_VALUE_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_HASH_MAP_TYPE_VALUE_ITERATOR, GeeHashMapValueIteratorClass)) + +typedef struct _GeeHashMapValueIterator GeeHashMapValueIterator; +typedef struct _GeeHashMapValueIteratorClass GeeHashMapValueIteratorClass; +typedef struct _GeeHashMapEntrySetPrivate GeeHashMapEntrySetPrivate; + +#define GEE_HASH_MAP_TYPE_ENTRY_ITERATOR (gee_hash_map_entry_iterator_get_type ()) +#define GEE_HASH_MAP_ENTRY_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_HASH_MAP_TYPE_ENTRY_ITERATOR, GeeHashMapEntryIterator)) +#define GEE_HASH_MAP_ENTRY_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_HASH_MAP_TYPE_ENTRY_ITERATOR, GeeHashMapEntryIteratorClass)) +#define GEE_HASH_MAP_IS_ENTRY_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_HASH_MAP_TYPE_ENTRY_ITERATOR)) +#define GEE_HASH_MAP_IS_ENTRY_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_HASH_MAP_TYPE_ENTRY_ITERATOR)) +#define GEE_HASH_MAP_ENTRY_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_HASH_MAP_TYPE_ENTRY_ITERATOR, GeeHashMapEntryIteratorClass)) + +typedef struct _GeeHashMapEntryIterator GeeHashMapEntryIterator; +typedef struct _GeeHashMapEntryIteratorClass GeeHashMapEntryIteratorClass; +typedef struct _GeeHashMapNodeIteratorPrivate GeeHashMapNodeIteratorPrivate; +typedef struct _GeeHashMapKeyIteratorPrivate GeeHashMapKeyIteratorPrivate; +typedef struct _GeeHashMapMapIteratorPrivate GeeHashMapMapIteratorPrivate; +typedef struct _GeeHashMapValueIteratorPrivate GeeHashMapValueIteratorPrivate; +typedef struct _GeeHashMapEntryIteratorPrivate GeeHashMapEntryIteratorPrivate; +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeMapIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeMapIterator* self); + gboolean (*has_next) (GeeMapIterator* self); + gboolean (*first) (GeeMapIterator* self); + gpointer (*get_key) (GeeMapIterator* self); + gpointer (*get_value) (GeeMapIterator* self); + void (*set_value) (GeeMapIterator* self, gconstpointer value); + void (*unset) (GeeMapIterator* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeMapIface { + GTypeInterface parent_iface; + gboolean (*has_key) (GeeMap* self, gconstpointer key); + gboolean (*contains) (GeeMap* self, gconstpointer key); + gboolean (*has) (GeeMap* self, gconstpointer key, gconstpointer value); + gpointer (*get) (GeeMap* self, gconstpointer key); + void (*set) (GeeMap* self, gconstpointer key, gconstpointer value); + gboolean (*unset) (GeeMap* self, gconstpointer key, gpointer* value); + gboolean (*remove) (GeeMap* self, gconstpointer key, gpointer* value); + void (*clear) (GeeMap* self); + GeeMapIterator* (*map_iterator) (GeeMap* self); + void (*set_all) (GeeMap* self, GeeMap* map); + gboolean (*unset_all) (GeeMap* self, GeeMap* map); + gboolean (*remove_all) (GeeMap* self, GeeMap* map); + gboolean (*has_all) (GeeMap* self, GeeMap* map); + gboolean (*contains_all) (GeeMap* self, GeeMap* map); + gint (*get_size) (GeeMap* self); + gboolean (*get_is_empty) (GeeMap* self); + GeeSet* (*get_keys) (GeeMap* self); + GeeCollection* (*get_values) (GeeMap* self); + GeeSet* (*get_entries) (GeeMap* self); + GeeMap* (*get_read_only_view) (GeeMap* self); + GType (*get_key_type) (GeeMap* self); + GType (*get_value_type) (GeeMap* self); +}; + +struct _GeeAbstractMap { + GObject parent_instance; + GeeAbstractMapPrivate * priv; +}; + +struct _GeeAbstractMapClass { + GObjectClass parent_class; + gboolean (*has_key) (GeeAbstractMap* self, gconstpointer key); + gboolean (*has) (GeeAbstractMap* self, gconstpointer key, gconstpointer value); + gpointer (*get) (GeeAbstractMap* self, gconstpointer key); + void (*set) (GeeAbstractMap* self, gconstpointer key, gconstpointer value); + gboolean (*unset) (GeeAbstractMap* self, gconstpointer key, gpointer* value); + GeeMapIterator* (*map_iterator) (GeeAbstractMap* self); + void (*clear) (GeeAbstractMap* self); + void (*set_all) (GeeAbstractMap* self, GeeMap* map); + gboolean (*unset_all) (GeeAbstractMap* self, GeeMap* map); + gboolean (*has_all) (GeeAbstractMap* self, GeeMap* map); + gint (*get_size) (GeeAbstractMap* self); + gboolean (*get_is_empty) (GeeAbstractMap* self); + GeeSet* (*get_keys) (GeeAbstractMap* self); + GeeCollection* (*get_values) (GeeAbstractMap* self); + GeeSet* (*get_entries) (GeeAbstractMap* self); + GeeMap* (*get_read_only_view) (GeeAbstractMap* self); +}; + +struct _GeeHashMap { + GeeAbstractMap parent_instance; + GeeHashMapPrivate * priv; +}; + +struct _GeeHashMapClass { + GeeAbstractMapClass parent_class; +}; + +struct _GeeHashMapPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + GHashFunc _key_hash_func; + GEqualFunc _key_equal_func; + GEqualFunc _value_equal_func; + gint _array_size; + gint _nnodes; + GeeHashMapNode** _nodes; + gint _nodes_length1; + gint __nodes_size_; + GeeSet* _keys; + GeeCollection* _values; + GeeSet* _entries; + gint _stamp; +}; + +struct _GeeHashMapNode { + gpointer key; + gpointer value; + GeeHashMapNode* next; + guint key_hash; + GeeMapEntry* entry; +}; + +struct _GeeMapEntry { + GObject parent_instance; + GeeMapEntryPrivate * priv; +}; + +struct _GeeMapEntryClass { + GObjectClass parent_class; + gconstpointer (*get_key) (GeeMapEntry* self); + gconstpointer (*get_value) (GeeMapEntry* self); + void (*set_value) (GeeMapEntry* self, gconstpointer value); +}; + +struct _GeeHashMapEntry { + GeeMapEntry parent_instance; + GeeHashMapEntryPrivate * priv; +}; + +struct _GeeHashMapEntryClass { + GeeMapEntryClass parent_class; +}; + +struct _GeeHashMapEntryPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + GeeHashMapNode* _node; +}; + +struct _GeeAbstractCollection { + GObject parent_instance; + GeeAbstractCollectionPrivate * priv; +}; + +struct _GeeAbstractCollectionClass { + GObjectClass parent_class; + gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*add) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item); + void (*clear) (GeeAbstractCollection* self); + gpointer* (*to_array) (GeeAbstractCollection* self, int* result_length1); + gboolean (*add_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeAbstractCollection* self, GeeCollection* collection); + GeeIterator* (*iterator) (GeeAbstractCollection* self); + gint (*get_size) (GeeAbstractCollection* self); + gboolean (*get_is_empty) (GeeAbstractCollection* self); + GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self); +}; + +struct _GeeAbstractSet { + GeeAbstractCollection parent_instance; + GeeAbstractSetPrivate * priv; +}; + +struct _GeeAbstractSetClass { + GeeAbstractCollectionClass parent_class; + GeeSet* (*get_read_only_view) (GeeAbstractSet* self); +}; + +struct _GeeHashMapKeySet { + GeeAbstractSet parent_instance; + GeeHashMapKeySetPrivate * priv; +}; + +struct _GeeHashMapKeySetClass { + GeeAbstractSetClass parent_class; +}; + +struct _GeeHashMapKeySetPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + GeeHashMap* _map; +}; + +struct _GeeHashMapValueCollection { + GeeAbstractCollection parent_instance; + GeeHashMapValueCollectionPrivate * priv; +}; + +struct _GeeHashMapValueCollectionClass { + GeeAbstractCollectionClass parent_class; +}; + +struct _GeeHashMapValueCollectionPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + GeeHashMap* _map; +}; + +struct _GeeHashMapEntrySet { + GeeAbstractSet parent_instance; + GeeHashMapEntrySetPrivate * priv; +}; + +struct _GeeHashMapEntrySetClass { + GeeAbstractSetClass parent_class; +}; + +struct _GeeHashMapEntrySetPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + GeeHashMap* _map; +}; + +struct _GeeHashMapNodeIterator { + GObject parent_instance; + GeeHashMapNodeIteratorPrivate * priv; + GeeHashMap* _map; + GeeHashMapNode* _node; + GeeHashMapNode* _next; + gint _stamp; +}; + +struct _GeeHashMapNodeIteratorClass { + GObjectClass parent_class; +}; + +struct _GeeHashMapNodeIteratorPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + gint _index; +}; + +struct _GeeHashMapKeyIterator { + GeeHashMapNodeIterator parent_instance; + GeeHashMapKeyIteratorPrivate * priv; +}; + +struct _GeeHashMapKeyIteratorClass { + GeeHashMapNodeIteratorClass parent_class; +}; + +struct _GeeHashMapKeyIteratorPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; +}; + +struct _GeeHashMapMapIterator { + GeeHashMapNodeIterator parent_instance; + GeeHashMapMapIteratorPrivate * priv; +}; + +struct _GeeHashMapMapIteratorClass { + GeeHashMapNodeIteratorClass parent_class; +}; + +struct _GeeHashMapMapIteratorPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; +}; + +struct _GeeHashMapValueIterator { + GeeHashMapNodeIterator parent_instance; + GeeHashMapValueIteratorPrivate * priv; +}; + +struct _GeeHashMapValueIteratorClass { + GeeHashMapNodeIteratorClass parent_class; +}; + +struct _GeeHashMapValueIteratorPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; +}; + +struct _GeeHashMapEntryIterator { + GeeHashMapNodeIterator parent_instance; + GeeHashMapEntryIteratorPrivate * priv; +}; + +struct _GeeHashMapEntryIteratorClass { + GeeHashMapNodeIteratorClass parent_class; +}; + +struct _GeeHashMapEntryIteratorPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; +}; + + +static gpointer gee_hash_map_parent_class = NULL; +static gpointer gee_hash_map_entry_parent_class = NULL; +static gpointer gee_hash_map_key_set_parent_class = NULL; +static gpointer gee_hash_map_value_collection_parent_class = NULL; +static gpointer gee_hash_map_entry_set_parent_class = NULL; +static gpointer gee_hash_map_node_iterator_parent_class = NULL; +static gpointer gee_hash_map_key_iterator_parent_class = NULL; +static GeeIteratorIface* gee_hash_map_key_iterator_gee_iterator_parent_iface = NULL; +static gpointer gee_hash_map_map_iterator_parent_class = NULL; +static GeeMapIteratorIface* gee_hash_map_map_iterator_gee_map_iterator_parent_iface = NULL; +static gpointer gee_hash_map_value_iterator_parent_class = NULL; +static GeeIteratorIface* gee_hash_map_value_iterator_gee_iterator_parent_iface = NULL; +static gpointer gee_hash_map_entry_iterator_parent_class = NULL; +static GeeIteratorIface* gee_hash_map_entry_iterator_gee_iterator_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_map_iterator_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_map_entry_get_type (void) G_GNUC_CONST; +GType gee_map_get_type (void) G_GNUC_CONST; +GType gee_abstract_map_get_type (void) G_GNUC_CONST; +GType gee_hash_map_get_type (void) G_GNUC_CONST; +static void gee_hash_map_node_free (GeeHashMapNode* self); +#define GEE_HASH_MAP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_HASH_MAP, GeeHashMapPrivate)) +enum { + GEE_HASH_MAP_DUMMY_PROPERTY, + GEE_HASH_MAP_K_TYPE, + GEE_HASH_MAP_K_DUP_FUNC, + GEE_HASH_MAP_K_DESTROY_FUNC, + GEE_HASH_MAP_V_TYPE, + GEE_HASH_MAP_V_DUP_FUNC, + GEE_HASH_MAP_V_DESTROY_FUNC, + GEE_HASH_MAP_SIZE, + GEE_HASH_MAP_KEYS, + GEE_HASH_MAP_VALUES, + GEE_HASH_MAP_ENTRIES, + GEE_HASH_MAP_KEY_HASH_FUNC, + GEE_HASH_MAP_KEY_EQUAL_FUNC, + GEE_HASH_MAP_VALUE_EQUAL_FUNC +}; +void gee_abstract_map_clear (GeeAbstractMap* self); +#define GEE_HASH_MAP_MIN_SIZE 11 +#define GEE_HASH_MAP_MAX_SIZE 13845163 +GeeHashMap* gee_hash_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GEqualFunc value_equal_func); +GeeHashMap* gee_hash_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GEqualFunc value_equal_func); +GeeAbstractMap* gee_abstract_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func); +GHashFunc gee_functions_get_hash_func_for (GType t); +GEqualFunc gee_functions_get_equal_func_for (GType t); +static void gee_hash_map_set_key_hash_func (GeeHashMap* self, GHashFunc value); +static void gee_hash_map_set_key_equal_func (GeeHashMap* self, GEqualFunc value); +static void gee_hash_map_set_value_equal_func (GeeHashMap* self, GEqualFunc value); +static GeeHashMapNode** gee_hash_map_lookup_node (GeeHashMap* self, gconstpointer key); +GHashFunc gee_hash_map_get_key_hash_func (GeeHashMap* self); +GEqualFunc gee_hash_map_get_key_equal_func (GeeHashMap* self); +static gboolean gee_hash_map_real_has_key (GeeAbstractMap* base, gconstpointer key); +static gboolean gee_hash_map_real_has (GeeAbstractMap* base, gconstpointer key, gconstpointer value); +GEqualFunc gee_hash_map_get_value_equal_func (GeeHashMap* self); +static gpointer gee_hash_map_real_get (GeeAbstractMap* base, gconstpointer key); +static void gee_hash_map_real_set (GeeAbstractMap* base, gconstpointer key, gconstpointer value); +static GeeHashMapNode* gee_hash_map_node_new (gpointer k, gpointer v, guint hash); +static GeeHashMapNode* gee_hash_map_node_new (gpointer k, gpointer v, guint hash); +static inline void gee_hash_map_resize (GeeHashMap* self); +static gboolean gee_hash_map_real_unset (GeeAbstractMap* base, gconstpointer key, gpointer* value); +static inline gboolean gee_hash_map_unset_helper (GeeHashMap* self, gconstpointer key, gpointer* value); +static void gee_hash_map_real_clear (GeeAbstractMap* base); +static GeeMapIterator* gee_hash_map_real_map_iterator (GeeAbstractMap* base); +static GeeHashMapMapIterator* gee_hash_map_map_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map); +static GeeHashMapMapIterator* gee_hash_map_map_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map); +static GType gee_hash_map_node_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static GType gee_hash_map_map_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static GeeHashMapKeySet* gee_hash_map_key_set_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map); +static GeeHashMapKeySet* gee_hash_map_key_set_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map); +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_set_get_type (void) G_GNUC_CONST; +static GType gee_hash_map_key_set_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static GeeHashMapValueCollection* gee_hash_map_value_collection_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map); +static GeeHashMapValueCollection* gee_hash_map_value_collection_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map); +static GType gee_hash_map_value_collection_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static GeeHashMapEntrySet* gee_hash_map_entry_set_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map); +static GeeHashMapEntrySet* gee_hash_map_entry_set_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map); +static GType gee_hash_map_entry_set_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static void gee_hash_map_node_instance_init (GeeHashMapNode * self); +static GType gee_hash_map_entry_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +#define GEE_HASH_MAP_ENTRY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_HASH_MAP_TYPE_ENTRY, GeeHashMapEntryPrivate)) +enum { + GEE_HASH_MAP_ENTRY_DUMMY_PROPERTY, + GEE_HASH_MAP_ENTRY_K_TYPE, + GEE_HASH_MAP_ENTRY_K_DUP_FUNC, + GEE_HASH_MAP_ENTRY_K_DESTROY_FUNC, + GEE_HASH_MAP_ENTRY_V_TYPE, + GEE_HASH_MAP_ENTRY_V_DUP_FUNC, + GEE_HASH_MAP_ENTRY_V_DESTROY_FUNC, + GEE_HASH_MAP_ENTRY_KEY, + GEE_HASH_MAP_ENTRY_VALUE +}; +static GeeMapEntry* gee_hash_map_entry_entry_for (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMapNode* node); +static GeeHashMapEntry* gee_hash_map_entry_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMapNode* node); +static GeeHashMapEntry* gee_hash_map_entry_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMapNode* node); +GeeMapEntry* gee_map_entry_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func); +static void gee_hash_map_entry_finalize (GObject* obj); +gconstpointer gee_map_entry_get_key (GeeMapEntry* self); +gconstpointer gee_map_entry_get_value (GeeMapEntry* self); +static void _vala_gee_hash_map_entry_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +void gee_map_entry_set_value (GeeMapEntry* self, gconstpointer value); +static void _vala_gee_hash_map_entry_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +#define GEE_HASH_MAP_KEY_SET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_HASH_MAP_TYPE_KEY_SET, GeeHashMapKeySetPrivate)) +enum { + GEE_HASH_MAP_KEY_SET_DUMMY_PROPERTY, + GEE_HASH_MAP_KEY_SET_K_TYPE, + GEE_HASH_MAP_KEY_SET_K_DUP_FUNC, + GEE_HASH_MAP_KEY_SET_K_DESTROY_FUNC, + GEE_HASH_MAP_KEY_SET_V_TYPE, + GEE_HASH_MAP_KEY_SET_V_DUP_FUNC, + GEE_HASH_MAP_KEY_SET_V_DESTROY_FUNC, + GEE_HASH_MAP_KEY_SET_SIZE +}; +GeeAbstractSet* gee_abstract_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +static GeeIterator* gee_hash_map_key_set_real_iterator (GeeAbstractCollection* base); +static GeeHashMapKeyIterator* gee_hash_map_key_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map); +static GeeHashMapKeyIterator* gee_hash_map_key_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map); +static GType gee_hash_map_key_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static gboolean gee_hash_map_key_set_real_add (GeeAbstractCollection* base, gconstpointer key); +static void gee_hash_map_key_set_real_clear (GeeAbstractCollection* base); +static gboolean gee_hash_map_key_set_real_remove (GeeAbstractCollection* base, gconstpointer key); +static gboolean gee_hash_map_key_set_real_contains (GeeAbstractCollection* base, gconstpointer key); +gboolean gee_abstract_map_has_key (GeeAbstractMap* self, gconstpointer key); +static gboolean gee_hash_map_key_set_real_add_all (GeeAbstractCollection* base, GeeCollection* collection); +static gboolean gee_hash_map_key_set_real_remove_all (GeeAbstractCollection* base, GeeCollection* collection); +static gboolean gee_hash_map_key_set_real_retain_all (GeeAbstractCollection* base, GeeCollection* collection); +gint gee_abstract_map_get_size (GeeAbstractMap* self); +static void gee_hash_map_key_set_finalize (GObject* obj); +gint gee_abstract_collection_get_size (GeeAbstractCollection* self); +static void _vala_gee_hash_map_key_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_hash_map_key_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +#define GEE_HASH_MAP_VALUE_COLLECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_HASH_MAP_TYPE_VALUE_COLLECTION, GeeHashMapValueCollectionPrivate)) +enum { + GEE_HASH_MAP_VALUE_COLLECTION_DUMMY_PROPERTY, + GEE_HASH_MAP_VALUE_COLLECTION_K_TYPE, + GEE_HASH_MAP_VALUE_COLLECTION_K_DUP_FUNC, + GEE_HASH_MAP_VALUE_COLLECTION_K_DESTROY_FUNC, + GEE_HASH_MAP_VALUE_COLLECTION_V_TYPE, + GEE_HASH_MAP_VALUE_COLLECTION_V_DUP_FUNC, + GEE_HASH_MAP_VALUE_COLLECTION_V_DESTROY_FUNC, + GEE_HASH_MAP_VALUE_COLLECTION_SIZE +}; +GeeAbstractCollection* gee_abstract_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +static GeeIterator* gee_hash_map_value_collection_real_iterator (GeeAbstractCollection* base); +static GeeHashMapValueIterator* gee_hash_map_value_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map); +static GeeHashMapValueIterator* gee_hash_map_value_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map); +static GType gee_hash_map_value_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static gboolean gee_hash_map_value_collection_real_add (GeeAbstractCollection* base, gconstpointer value); +static void gee_hash_map_value_collection_real_clear (GeeAbstractCollection* base); +static gboolean gee_hash_map_value_collection_real_remove (GeeAbstractCollection* base, gconstpointer value); +static gboolean gee_hash_map_value_collection_real_contains (GeeAbstractCollection* base, gconstpointer value); +GeeIterator* gee_abstract_collection_iterator (GeeAbstractCollection* self); +gboolean gee_iterator_next (GeeIterator* self); +gpointer gee_iterator_get (GeeIterator* self); +static gboolean gee_hash_map_value_collection_real_add_all (GeeAbstractCollection* base, GeeCollection* collection); +static gboolean gee_hash_map_value_collection_real_remove_all (GeeAbstractCollection* base, GeeCollection* collection); +static gboolean gee_hash_map_value_collection_real_retain_all (GeeAbstractCollection* base, GeeCollection* collection); +static void gee_hash_map_value_collection_finalize (GObject* obj); +static void _vala_gee_hash_map_value_collection_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_hash_map_value_collection_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +#define GEE_HASH_MAP_ENTRY_SET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_HASH_MAP_TYPE_ENTRY_SET, GeeHashMapEntrySetPrivate)) +enum { + GEE_HASH_MAP_ENTRY_SET_DUMMY_PROPERTY, + GEE_HASH_MAP_ENTRY_SET_K_TYPE, + GEE_HASH_MAP_ENTRY_SET_K_DUP_FUNC, + GEE_HASH_MAP_ENTRY_SET_K_DESTROY_FUNC, + GEE_HASH_MAP_ENTRY_SET_V_TYPE, + GEE_HASH_MAP_ENTRY_SET_V_DUP_FUNC, + GEE_HASH_MAP_ENTRY_SET_V_DESTROY_FUNC, + GEE_HASH_MAP_ENTRY_SET_SIZE +}; +static GeeIterator* gee_hash_map_entry_set_real_iterator (GeeAbstractCollection* base); +static GeeHashMapEntryIterator* gee_hash_map_entry_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map); +static GeeHashMapEntryIterator* gee_hash_map_entry_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map); +static GType gee_hash_map_entry_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static gboolean gee_hash_map_entry_set_real_add (GeeAbstractCollection* base, GeeMapEntry* entry); +static void gee_hash_map_entry_set_real_clear (GeeAbstractCollection* base); +static gboolean gee_hash_map_entry_set_real_remove (GeeAbstractCollection* base, GeeMapEntry* entry); +static gboolean gee_hash_map_entry_set_real_contains (GeeAbstractCollection* base, GeeMapEntry* entry); +gboolean gee_abstract_map_has (GeeAbstractMap* self, gconstpointer key, gconstpointer value); +static gboolean gee_hash_map_entry_set_real_add_all (GeeAbstractCollection* base, GeeCollection* entries); +static gboolean gee_hash_map_entry_set_real_remove_all (GeeAbstractCollection* base, GeeCollection* entries); +static gboolean gee_hash_map_entry_set_real_retain_all (GeeAbstractCollection* base, GeeCollection* entries); +static void gee_hash_map_entry_set_finalize (GObject* obj); +static void _vala_gee_hash_map_entry_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_hash_map_entry_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +#define GEE_HASH_MAP_NODE_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_HASH_MAP_TYPE_NODE_ITERATOR, GeeHashMapNodeIteratorPrivate)) +enum { + GEE_HASH_MAP_NODE_ITERATOR_DUMMY_PROPERTY, + GEE_HASH_MAP_NODE_ITERATOR_K_TYPE, + GEE_HASH_MAP_NODE_ITERATOR_K_DUP_FUNC, + GEE_HASH_MAP_NODE_ITERATOR_K_DESTROY_FUNC, + GEE_HASH_MAP_NODE_ITERATOR_V_TYPE, + GEE_HASH_MAP_NODE_ITERATOR_V_DUP_FUNC, + GEE_HASH_MAP_NODE_ITERATOR_V_DESTROY_FUNC +}; +static GeeHashMapNodeIterator* gee_hash_map_node_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map); +static gboolean gee_hash_map_node_iterator_next (GeeHashMapNodeIterator* self); +static gboolean gee_hash_map_node_iterator_has_next (GeeHashMapNodeIterator* self); +static gboolean gee_hash_map_node_iterator_first (GeeHashMapNodeIterator* self); +static void gee_hash_map_node_iterator_finalize (GObject* obj); +static void _vala_gee_hash_map_node_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_hash_map_node_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +#define GEE_HASH_MAP_KEY_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_HASH_MAP_TYPE_KEY_ITERATOR, GeeHashMapKeyIteratorPrivate)) +enum { + GEE_HASH_MAP_KEY_ITERATOR_DUMMY_PROPERTY, + GEE_HASH_MAP_KEY_ITERATOR_K_TYPE, + GEE_HASH_MAP_KEY_ITERATOR_K_DUP_FUNC, + GEE_HASH_MAP_KEY_ITERATOR_K_DESTROY_FUNC, + GEE_HASH_MAP_KEY_ITERATOR_V_TYPE, + GEE_HASH_MAP_KEY_ITERATOR_V_DUP_FUNC, + GEE_HASH_MAP_KEY_ITERATOR_V_DESTROY_FUNC +}; +static gpointer gee_hash_map_key_iterator_real_get (GeeIterator* base); +static void gee_hash_map_key_iterator_real_remove (GeeIterator* base); +static void _vala_gee_hash_map_key_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_hash_map_key_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +#define GEE_HASH_MAP_MAP_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_HASH_MAP_TYPE_MAP_ITERATOR, GeeHashMapMapIteratorPrivate)) +enum { + GEE_HASH_MAP_MAP_ITERATOR_DUMMY_PROPERTY, + GEE_HASH_MAP_MAP_ITERATOR_K_TYPE, + GEE_HASH_MAP_MAP_ITERATOR_K_DUP_FUNC, + GEE_HASH_MAP_MAP_ITERATOR_K_DESTROY_FUNC, + GEE_HASH_MAP_MAP_ITERATOR_V_TYPE, + GEE_HASH_MAP_MAP_ITERATOR_V_DUP_FUNC, + GEE_HASH_MAP_MAP_ITERATOR_V_DESTROY_FUNC +}; +static gpointer gee_hash_map_map_iterator_real_get_key (GeeMapIterator* base); +static void gee_hash_map_map_iterator_real_unset (GeeMapIterator* base); +gboolean gee_map_iterator_has_next (GeeMapIterator* self); +gboolean gee_abstract_map_unset (GeeAbstractMap* self, gconstpointer key, gpointer* value); +static gpointer gee_hash_map_map_iterator_real_get_value (GeeMapIterator* base); +static void gee_hash_map_map_iterator_real_set_value (GeeMapIterator* base, gconstpointer value); +void gee_abstract_map_set (GeeAbstractMap* self, gconstpointer key, gconstpointer value); +static void _vala_gee_hash_map_map_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_hash_map_map_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +#define GEE_HASH_MAP_VALUE_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_HASH_MAP_TYPE_VALUE_ITERATOR, GeeHashMapValueIteratorPrivate)) +enum { + GEE_HASH_MAP_VALUE_ITERATOR_DUMMY_PROPERTY, + GEE_HASH_MAP_VALUE_ITERATOR_K_TYPE, + GEE_HASH_MAP_VALUE_ITERATOR_K_DUP_FUNC, + GEE_HASH_MAP_VALUE_ITERATOR_K_DESTROY_FUNC, + GEE_HASH_MAP_VALUE_ITERATOR_V_TYPE, + GEE_HASH_MAP_VALUE_ITERATOR_V_DUP_FUNC, + GEE_HASH_MAP_VALUE_ITERATOR_V_DESTROY_FUNC +}; +static gpointer gee_hash_map_value_iterator_real_get (GeeIterator* base); +static void gee_hash_map_value_iterator_real_remove (GeeIterator* base); +static void _vala_gee_hash_map_value_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_hash_map_value_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +#define GEE_HASH_MAP_ENTRY_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_HASH_MAP_TYPE_ENTRY_ITERATOR, GeeHashMapEntryIteratorPrivate)) +enum { + GEE_HASH_MAP_ENTRY_ITERATOR_DUMMY_PROPERTY, + GEE_HASH_MAP_ENTRY_ITERATOR_K_TYPE, + GEE_HASH_MAP_ENTRY_ITERATOR_K_DUP_FUNC, + GEE_HASH_MAP_ENTRY_ITERATOR_K_DESTROY_FUNC, + GEE_HASH_MAP_ENTRY_ITERATOR_V_TYPE, + GEE_HASH_MAP_ENTRY_ITERATOR_V_DUP_FUNC, + GEE_HASH_MAP_ENTRY_ITERATOR_V_DESTROY_FUNC +}; +static GeeMapEntry* gee_hash_map_entry_iterator_real_get (GeeIterator* base); +static void gee_hash_map_entry_iterator_real_remove (GeeIterator* base); +static void _vala_gee_hash_map_entry_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_hash_map_entry_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void gee_hash_map_finalize (GObject* obj); +GeeSet* gee_abstract_map_get_keys (GeeAbstractMap* self); +GeeCollection* gee_abstract_map_get_values (GeeAbstractMap* self); +GeeSet* gee_abstract_map_get_entries (GeeAbstractMap* self); +static void _vala_gee_hash_map_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_hash_map_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); + + +/** + * Constructs a new, empty hash map. + * + * If not provided, the functions parameters are requested to the + * {@link Functions} function factory methods. + * + * @param key_hash_func an optional key hash function + * @param key_equal_func an optional key equality testing function + * @param value_equal_func an optional value equality testing function + */ +GeeHashMap* gee_hash_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GEqualFunc value_equal_func) { + GeeHashMap * self = NULL; + GHashFunc _tmp0_; + GEqualFunc _tmp2_; + GEqualFunc _tmp4_; + GHashFunc _tmp6_; + GEqualFunc _tmp7_; + GEqualFunc _tmp8_; + gint _tmp9_; + GeeHashMapNode** _tmp10_ = NULL; + self = (GeeHashMap*) gee_abstract_map_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _tmp0_ = key_hash_func; + if (_tmp0_ == NULL) { + GHashFunc _tmp1_ = NULL; + _tmp1_ = gee_functions_get_hash_func_for (k_type); + key_hash_func = _tmp1_; + } + _tmp2_ = key_equal_func; + if (_tmp2_ == NULL) { + GEqualFunc _tmp3_ = NULL; + _tmp3_ = gee_functions_get_equal_func_for (k_type); + key_equal_func = _tmp3_; + } + _tmp4_ = value_equal_func; + if (_tmp4_ == NULL) { + GEqualFunc _tmp5_ = NULL; + _tmp5_ = gee_functions_get_equal_func_for (v_type); + value_equal_func = _tmp5_; + } + _tmp6_ = key_hash_func; + gee_hash_map_set_key_hash_func (self, _tmp6_); + _tmp7_ = key_equal_func; + gee_hash_map_set_key_equal_func (self, _tmp7_); + _tmp8_ = value_equal_func; + gee_hash_map_set_value_equal_func (self, _tmp8_); + self->priv->_array_size = GEE_HASH_MAP_MIN_SIZE; + _tmp9_ = self->priv->_array_size; + _tmp10_ = g_new0 (GeeHashMapNode*, _tmp9_ + 1); + self->priv->_nodes = (_vala_array_free (self->priv->_nodes, self->priv->_nodes_length1, (GDestroyNotify) gee_hash_map_node_free), NULL); + self->priv->_nodes = _tmp10_; + self->priv->_nodes_length1 = _tmp9_; + self->priv->__nodes_size_ = self->priv->_nodes_length1; + return self; +} + + +GeeHashMap* gee_hash_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GEqualFunc value_equal_func) { + return gee_hash_map_construct (GEE_TYPE_HASH_MAP, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, key_hash_func, key_equal_func, value_equal_func); +} + + +static GeeHashMapNode** gee_hash_map_lookup_node (GeeHashMap* self, gconstpointer key) { + GeeHashMapNode** result = NULL; + GHashFunc _tmp0_; + GHashFunc _tmp1_; + gconstpointer _tmp2_; + guint _tmp3_ = 0U; + guint hash_value; + GeeHashMapNode** _tmp4_; + gint _tmp4__length1; + guint _tmp5_; + gint _tmp6_; + GeeHashMapNode** node; + GeeHashMapNode** _tmp22_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = gee_hash_map_get_key_hash_func (self); + _tmp1_ = _tmp0_; + _tmp2_ = key; + _tmp3_ = _tmp1_ (_tmp2_); + hash_value = _tmp3_; + _tmp4_ = self->priv->_nodes; + _tmp4__length1 = self->priv->_nodes_length1; + _tmp5_ = hash_value; + _tmp6_ = self->priv->_array_size; + node = &_tmp4_[_tmp5_ % _tmp6_]; + while (TRUE) { + gboolean _tmp7_ = FALSE; + GeeHashMapNode** _tmp8_; + gboolean _tmp20_; + GeeHashMapNode** _tmp21_; + _tmp8_ = node; + if ((*_tmp8_) != NULL) { + gboolean _tmp9_ = FALSE; + guint _tmp10_; + GeeHashMapNode** _tmp11_; + guint _tmp12_; + gboolean _tmp19_; + _tmp10_ = hash_value; + _tmp11_ = node; + _tmp12_ = (*_tmp11_)->key_hash; + if (_tmp10_ != _tmp12_) { + _tmp9_ = TRUE; + } else { + GEqualFunc _tmp13_; + GEqualFunc _tmp14_; + GeeHashMapNode** _tmp15_; + gconstpointer _tmp16_; + gconstpointer _tmp17_; + gboolean _tmp18_ = FALSE; + _tmp13_ = gee_hash_map_get_key_equal_func (self); + _tmp14_ = _tmp13_; + _tmp15_ = node; + _tmp16_ = (*_tmp15_)->key; + _tmp17_ = key; + _tmp18_ = _tmp14_ (_tmp16_, _tmp17_); + _tmp9_ = !_tmp18_; + } + _tmp19_ = _tmp9_; + _tmp7_ = _tmp19_; + } else { + _tmp7_ = FALSE; + } + _tmp20_ = _tmp7_; + if (!_tmp20_) { + break; + } + _tmp21_ = node; + node = &(*_tmp21_)->next; + } + _tmp22_ = node; + result = _tmp22_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_hash_map_real_has_key (GeeAbstractMap* base, gconstpointer key) { + GeeHashMap * self; + gboolean result = FALSE; + gconstpointer _tmp0_; + GeeHashMapNode** _tmp1_ = NULL; + GeeHashMapNode** node; + self = (GeeHashMap*) base; + _tmp0_ = key; + _tmp1_ = gee_hash_map_lookup_node (self, _tmp0_); + node = _tmp1_; + result = (*node) != NULL; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_hash_map_real_has (GeeAbstractMap* base, gconstpointer key, gconstpointer value) { + GeeHashMap * self; + gboolean result = FALSE; + gconstpointer _tmp0_; + GeeHashMapNode** _tmp1_ = NULL; + GeeHashMapNode** node; + gboolean _tmp2_ = FALSE; + GeeHashMapNode** _tmp3_; + gboolean _tmp10_; + self = (GeeHashMap*) base; + _tmp0_ = key; + _tmp1_ = gee_hash_map_lookup_node (self, _tmp0_); + node = _tmp1_; + _tmp3_ = node; + if ((*_tmp3_) != NULL) { + GEqualFunc _tmp4_; + GEqualFunc _tmp5_; + GeeHashMapNode** _tmp6_; + gconstpointer _tmp7_; + gconstpointer _tmp8_; + gboolean _tmp9_ = FALSE; + _tmp4_ = gee_hash_map_get_value_equal_func (self); + _tmp5_ = _tmp4_; + _tmp6_ = node; + _tmp7_ = (*_tmp6_)->value; + _tmp8_ = value; + _tmp9_ = _tmp5_ (_tmp7_, _tmp8_); + _tmp2_ = _tmp9_; + } else { + _tmp2_ = FALSE; + } + _tmp10_ = _tmp2_; + result = _tmp10_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_hash_map_real_get (GeeAbstractMap* base, gconstpointer key) { + GeeHashMap * self; + gpointer result = NULL; + gconstpointer _tmp0_; + GeeHashMapNode** _tmp1_ = NULL; + GeeHashMapNode* node; + GeeHashMapNode* _tmp2_; + self = (GeeHashMap*) base; + _tmp0_ = key; + _tmp1_ = gee_hash_map_lookup_node (self, _tmp0_); + node = *_tmp1_; + _tmp2_ = node; + if (_tmp2_ != NULL) { + GeeHashMapNode* _tmp3_; + gconstpointer _tmp4_; + gpointer _tmp5_; + _tmp3_ = node; + _tmp4_ = _tmp3_->value; + _tmp5_ = ((_tmp4_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp4_) : ((gpointer) _tmp4_); + result = _tmp5_; + return result; + } else { + result = NULL; + return result; + } +} + + +/** + * {@inheritDoc} + */ +static void gee_hash_map_real_set (GeeAbstractMap* base, gconstpointer key, gconstpointer value) { + GeeHashMap * self; + gconstpointer _tmp0_; + GeeHashMapNode** _tmp1_ = NULL; + GeeHashMapNode** node; + GeeHashMapNode** _tmp2_; + gint _tmp19_; + self = (GeeHashMap*) base; + _tmp0_ = key; + _tmp1_ = gee_hash_map_lookup_node (self, _tmp0_); + node = _tmp1_; + _tmp2_ = node; + if ((*_tmp2_) != NULL) { + GeeHashMapNode** _tmp3_; + gconstpointer _tmp4_; + gpointer _tmp5_; + _tmp3_ = node; + _tmp4_ = value; + _tmp5_ = ((_tmp4_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp4_) : ((gpointer) _tmp4_); + (((*_tmp3_)->value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : ((*_tmp3_)->value = (self->priv->v_destroy_func ((*_tmp3_)->value), NULL)); + (*_tmp3_)->value = _tmp5_; + } else { + GHashFunc _tmp6_; + GHashFunc _tmp7_; + gconstpointer _tmp8_; + guint _tmp9_ = 0U; + guint hash_value; + GeeHashMapNode** _tmp10_; + gconstpointer _tmp11_; + gpointer _tmp12_; + gconstpointer _tmp13_; + gpointer _tmp14_; + guint _tmp15_; + GeeHashMapNode* _tmp16_; + GeeHashMapNode* _tmp17_; + gint _tmp18_; + _tmp6_ = gee_hash_map_get_key_hash_func (self); + _tmp7_ = _tmp6_; + _tmp8_ = key; + _tmp9_ = _tmp7_ (_tmp8_); + hash_value = _tmp9_; + _tmp10_ = node; + _tmp11_ = key; + _tmp12_ = ((_tmp11_ != NULL) && (self->priv->k_dup_func != NULL)) ? self->priv->k_dup_func ((gpointer) _tmp11_) : ((gpointer) _tmp11_); + _tmp13_ = value; + _tmp14_ = ((_tmp13_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp13_) : ((gpointer) _tmp13_); + _tmp15_ = hash_value; + _tmp16_ = gee_hash_map_node_new (_tmp12_, _tmp14_, _tmp15_); + *_tmp10_ = _tmp16_; + _tmp17_ = *_tmp10_; + _tmp18_ = self->priv->_nnodes; + self->priv->_nnodes = _tmp18_ + 1; + gee_hash_map_resize (self); + } + _tmp19_ = self->priv->_stamp; + self->priv->_stamp = _tmp19_ + 1; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_hash_map_real_unset (GeeAbstractMap* base, gconstpointer key, gpointer* value) { + GeeHashMap * self; + gpointer _vala_value = NULL; + gboolean result = FALSE; + gconstpointer _tmp0_; + gpointer _tmp1_ = NULL; + gboolean _tmp2_ = FALSE; + gboolean b; + gboolean _tmp3_; + self = (GeeHashMap*) base; + _tmp0_ = key; + _tmp2_ = gee_hash_map_unset_helper (self, _tmp0_, &_tmp1_); + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + _vala_value = _tmp1_; + b = _tmp2_; + _tmp3_ = b; + if (_tmp3_) { + gee_hash_map_resize (self); + } + result = b; + if (value) { + *value = _vala_value; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + } + return result; +} + + +/** + * {@inheritDoc} + */ +static void gee_hash_map_real_clear (GeeAbstractMap* base) { + GeeHashMap * self; + self = (GeeHashMap*) base; + { + gint i; + i = 0; + { + gboolean _tmp0_; + _tmp0_ = TRUE; + while (TRUE) { + gboolean _tmp1_; + gint _tmp3_; + gint _tmp4_; + GeeHashMapNode** _tmp5_; + gint _tmp5__length1; + gint _tmp6_; + GeeHashMapNode* _tmp7_; + GeeHashMapNode* node; + _tmp1_ = _tmp0_; + if (!_tmp1_) { + gint _tmp2_; + _tmp2_ = i; + i = _tmp2_ + 1; + } + _tmp0_ = FALSE; + _tmp3_ = i; + _tmp4_ = self->priv->_array_size; + if (!(_tmp3_ < _tmp4_)) { + break; + } + _tmp5_ = self->priv->_nodes; + _tmp5__length1 = self->priv->_nodes_length1; + _tmp6_ = i; + _tmp7_ = _tmp5_[_tmp6_]; + _tmp5_[_tmp6_] = NULL; + node = _tmp7_; + while (TRUE) { + GeeHashMapNode* _tmp8_; + GeeHashMapNode* _tmp9_; + GeeHashMapNode* _tmp10_; + GeeHashMapNode* next; + GeeHashMapNode* _tmp11_; + GeeHashMapNode* _tmp12_; + GeeHashMapNode* _tmp13_; + _tmp8_ = node; + if (!(_tmp8_ != NULL)) { + break; + } + _tmp9_ = node; + _tmp10_ = _tmp9_->next; + _tmp9_->next = NULL; + next = _tmp10_; + _tmp11_ = node; + ((_tmp11_->key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (_tmp11_->key = (self->priv->k_destroy_func (_tmp11_->key), NULL)); + _tmp11_->key = NULL; + _tmp12_ = node; + ((_tmp12_->value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_tmp12_->value = (self->priv->v_destroy_func (_tmp12_->value), NULL)); + _tmp12_->value = NULL; + _tmp13_ = next; + next = NULL; + _gee_hash_map_node_free0 (node); + node = _tmp13_; + _gee_hash_map_node_free0 (next); + } + _gee_hash_map_node_free0 (node); + } + } + } + self->priv->_nnodes = 0; + gee_hash_map_resize (self); +} + + +/** + * {@inheritDoc} + */ +static GeeMapIterator* gee_hash_map_real_map_iterator (GeeAbstractMap* base) { + GeeHashMap * self; + GeeMapIterator* result = NULL; + GeeHashMapMapIterator* _tmp0_; + self = (GeeHashMap*) base; + _tmp0_ = gee_hash_map_map_iterator_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, self); + result = (GeeMapIterator*) _tmp0_; + return result; +} + + +static inline gboolean gee_hash_map_unset_helper (GeeHashMap* self, gconstpointer key, gpointer* value) { + gpointer _vala_value = NULL; + gboolean result = FALSE; + gconstpointer _tmp0_; + GeeHashMapNode** _tmp1_ = NULL; + GeeHashMapNode** node; + GeeHashMapNode** _tmp2_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = key; + _tmp1_ = gee_hash_map_lookup_node (self, _tmp0_); + node = _tmp1_; + _tmp2_ = node; + if ((*_tmp2_) != NULL) { + GeeHashMapNode** _tmp3_; + GeeHashMapNode* _tmp4_; + GeeHashMapNode* next; + GeeHashMapNode** _tmp7_; + GeeHashMapNode** _tmp8_; + GeeHashMapNode** _tmp9_; + GeeHashMapNode** _tmp10_; + GeeHashMapNode* _tmp11_; + GeeHashMapNode* _tmp12_; + gint _tmp13_; + gint _tmp14_; + _tmp3_ = node; + _tmp4_ = (*_tmp3_)->next; + (*_tmp3_)->next = NULL; + next = _tmp4_; + if ((&_vala_value) != NULL) { + GeeHashMapNode** _tmp5_; + gpointer _tmp6_; + _tmp5_ = node; + _tmp6_ = (*_tmp5_)->value; + (*_tmp5_)->value = NULL; + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + _vala_value = _tmp6_; + } + _tmp7_ = node; + (((*_tmp7_)->key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : ((*_tmp7_)->key = (self->priv->k_destroy_func ((*_tmp7_)->key), NULL)); + (*_tmp7_)->key = NULL; + _tmp8_ = node; + (((*_tmp8_)->value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : ((*_tmp8_)->value = (self->priv->v_destroy_func ((*_tmp8_)->value), NULL)); + (*_tmp8_)->value = NULL; + _tmp9_ = node; + gee_hash_map_node_free (*_tmp9_); + _tmp10_ = node; + _tmp11_ = next; + next = NULL; + *_tmp10_ = _tmp11_; + _tmp12_ = *_tmp10_; + _tmp13_ = self->priv->_nnodes; + self->priv->_nnodes = _tmp13_ - 1; + _tmp14_ = self->priv->_stamp; + self->priv->_stamp = _tmp14_ + 1; + result = TRUE; + _gee_hash_map_node_free0 (next); + if (value) { + *value = _vala_value; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + } + return result; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + _vala_value = NULL; + } + result = FALSE; + if (value) { + *value = _vala_value; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + } + return result; +} + + +static inline void gee_hash_map_resize (GeeHashMap* self) { + gboolean _tmp0_ = FALSE; + gboolean _tmp1_ = FALSE; + gint _tmp2_; + gint _tmp3_; + gboolean _tmp5_; + gboolean _tmp11_; + g_return_if_fail (self != NULL); + _tmp2_ = self->priv->_array_size; + _tmp3_ = self->priv->_nnodes; + if (_tmp2_ >= (3 * _tmp3_)) { + gint _tmp4_; + _tmp4_ = self->priv->_array_size; + _tmp1_ = _tmp4_ >= GEE_HASH_MAP_MIN_SIZE; + } else { + _tmp1_ = FALSE; + } + _tmp5_ = _tmp1_; + if (_tmp5_) { + _tmp0_ = TRUE; + } else { + gboolean _tmp6_ = FALSE; + gint _tmp7_; + gint _tmp8_; + gboolean _tmp10_; + _tmp7_ = self->priv->_array_size; + _tmp8_ = self->priv->_nnodes; + if ((3 * _tmp7_) <= _tmp8_) { + gint _tmp9_; + _tmp9_ = self->priv->_array_size; + _tmp6_ = _tmp9_ < GEE_HASH_MAP_MAX_SIZE; + } else { + _tmp6_ = FALSE; + } + _tmp10_ = _tmp6_; + _tmp0_ = _tmp10_; + } + _tmp11_ = _tmp0_; + if (_tmp11_) { + gint _tmp12_; + guint _tmp13_ = 0U; + gint new_array_size; + gint _tmp14_; + gint _tmp15_ = 0; + gint _tmp16_; + GeeHashMapNode** _tmp17_ = NULL; + GeeHashMapNode** new_nodes; + gint new_nodes_length1; + gint _new_nodes_size_; + GeeHashMapNode** _tmp43_; + gint _tmp43__length1; + gint _tmp44_; + _tmp12_ = self->priv->_nnodes; + _tmp13_ = g_spaced_primes_closest ((guint) _tmp12_); + new_array_size = (gint) _tmp13_; + _tmp14_ = new_array_size; + _tmp15_ = CLAMP (_tmp14_, GEE_HASH_MAP_MIN_SIZE, GEE_HASH_MAP_MAX_SIZE); + new_array_size = _tmp15_; + _tmp16_ = new_array_size; + _tmp17_ = g_new0 (GeeHashMapNode*, _tmp16_ + 1); + new_nodes = _tmp17_; + new_nodes_length1 = _tmp16_; + _new_nodes_size_ = new_nodes_length1; + { + gint i; + i = 0; + { + gboolean _tmp18_; + _tmp18_ = TRUE; + while (TRUE) { + gboolean _tmp19_; + gint _tmp21_; + gint _tmp22_; + GeeHashMapNode* node = NULL; + GeeHashMapNode* next; + _tmp19_ = _tmp18_; + if (!_tmp19_) { + gint _tmp20_; + _tmp20_ = i; + i = _tmp20_ + 1; + } + _tmp18_ = FALSE; + _tmp21_ = i; + _tmp22_ = self->priv->_array_size; + if (!(_tmp21_ < _tmp22_)) { + break; + } + next = NULL; + { + GeeHashMapNode** _tmp23_; + gint _tmp23__length1; + gint _tmp24_; + GeeHashMapNode* _tmp25_; + gboolean _tmp26_; + _tmp23_ = self->priv->_nodes; + _tmp23__length1 = self->priv->_nodes_length1; + _tmp24_ = i; + _tmp25_ = _tmp23_[_tmp24_]; + _tmp23_[_tmp24_] = NULL; + _gee_hash_map_node_free0 (node); + node = _tmp25_; + _tmp26_ = TRUE; + while (TRUE) { + gboolean _tmp27_; + GeeHashMapNode* _tmp29_; + GeeHashMapNode* _tmp30_; + GeeHashMapNode* _tmp31_; + GeeHashMapNode* _tmp32_; + guint _tmp33_; + gint _tmp34_; + guint hash_val; + GeeHashMapNode* _tmp35_; + GeeHashMapNode** _tmp36_; + gint _tmp36__length1; + guint _tmp37_; + GeeHashMapNode* _tmp38_; + GeeHashMapNode** _tmp39_; + gint _tmp39__length1; + guint _tmp40_; + GeeHashMapNode* _tmp41_; + GeeHashMapNode* _tmp42_; + _tmp27_ = _tmp26_; + if (!_tmp27_) { + GeeHashMapNode* _tmp28_; + _tmp28_ = next; + next = NULL; + _gee_hash_map_node_free0 (node); + node = _tmp28_; + } + _tmp26_ = FALSE; + _tmp29_ = node; + if (!(_tmp29_ != NULL)) { + break; + } + _tmp30_ = node; + _tmp31_ = _tmp30_->next; + _tmp30_->next = NULL; + _gee_hash_map_node_free0 (next); + next = _tmp31_; + _tmp32_ = node; + _tmp33_ = _tmp32_->key_hash; + _tmp34_ = new_array_size; + hash_val = _tmp33_ % _tmp34_; + _tmp35_ = node; + _tmp36_ = new_nodes; + _tmp36__length1 = new_nodes_length1; + _tmp37_ = hash_val; + _tmp38_ = _tmp36_[_tmp37_]; + _tmp36_[_tmp37_] = NULL; + _gee_hash_map_node_free0 (_tmp35_->next); + _tmp35_->next = _tmp38_; + _tmp39_ = new_nodes; + _tmp39__length1 = new_nodes_length1; + _tmp40_ = hash_val; + _tmp41_ = node; + node = NULL; + _gee_hash_map_node_free0 (_tmp39_[_tmp40_]); + _tmp39_[_tmp40_] = _tmp41_; + _tmp42_ = _tmp39_[_tmp40_]; + } + } + _gee_hash_map_node_free0 (next); + _gee_hash_map_node_free0 (node); + } + } + } + _tmp43_ = new_nodes; + _tmp43__length1 = new_nodes_length1; + new_nodes = NULL; + self->priv->_nodes = (_vala_array_free (self->priv->_nodes, self->priv->_nodes_length1, (GDestroyNotify) gee_hash_map_node_free), NULL); + self->priv->_nodes = _tmp43_; + self->priv->_nodes_length1 = _tmp43__length1; + self->priv->__nodes_size_ = self->priv->_nodes_length1; + _tmp44_ = new_array_size; + self->priv->_array_size = _tmp44_; + new_nodes = (_vala_array_free (new_nodes, new_nodes_length1, (GDestroyNotify) gee_hash_map_node_free), NULL); + } +} + + +static gint gee_hash_map_real_get_size (GeeAbstractMap* base) { + gint result; + GeeHashMap* self; + gint _tmp0_; + self = (GeeHashMap*) base; + _tmp0_ = self->priv->_nnodes; + result = _tmp0_; + return result; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static GeeSet* gee_hash_map_real_get_keys (GeeAbstractMap* base) { + GeeSet* result; + GeeHashMap* self; + GeeSet* _tmp0_; + GeeSet* _tmp1_; + GeeSet* keys; + GeeSet* _tmp2_; + self = (GeeHashMap*) base; + _tmp0_ = self->priv->_keys; + _tmp1_ = _g_object_ref0 (_tmp0_); + keys = _tmp1_; + _tmp2_ = self->priv->_keys; + if (_tmp2_ == NULL) { + GeeHashMapKeySet* _tmp3_; + GeeSet* _tmp4_; + GeeSet* _tmp5_; + _tmp3_ = gee_hash_map_key_set_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, self); + _g_object_unref0 (keys); + keys = (GeeSet*) _tmp3_; + _tmp4_ = keys; + self->priv->_keys = _tmp4_; + _tmp5_ = keys; + g_object_add_weak_pointer ((GObject*) _tmp5_, (void**) (&self->priv->_keys)); + } + result = keys; + return result; +} + + +static GeeCollection* gee_hash_map_real_get_values (GeeAbstractMap* base) { + GeeCollection* result; + GeeHashMap* self; + GeeCollection* _tmp0_; + GeeCollection* _tmp1_; + GeeCollection* values; + GeeCollection* _tmp2_; + self = (GeeHashMap*) base; + _tmp0_ = self->priv->_values; + _tmp1_ = _g_object_ref0 (_tmp0_); + values = _tmp1_; + _tmp2_ = self->priv->_values; + if (_tmp2_ == NULL) { + GeeHashMapValueCollection* _tmp3_; + GeeCollection* _tmp4_; + GeeCollection* _tmp5_; + _tmp3_ = gee_hash_map_value_collection_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, self); + _g_object_unref0 (values); + values = (GeeCollection*) _tmp3_; + _tmp4_ = values; + self->priv->_values = _tmp4_; + _tmp5_ = values; + g_object_add_weak_pointer ((GObject*) _tmp5_, (void**) (&self->priv->_values)); + } + result = values; + return result; +} + + +static GeeSet* gee_hash_map_real_get_entries (GeeAbstractMap* base) { + GeeSet* result; + GeeHashMap* self; + GeeSet* _tmp0_; + GeeSet* _tmp1_; + GeeSet* entries; + GeeSet* _tmp2_; + self = (GeeHashMap*) base; + _tmp0_ = self->priv->_entries; + _tmp1_ = _g_object_ref0 (_tmp0_); + entries = _tmp1_; + _tmp2_ = self->priv->_entries; + if (_tmp2_ == NULL) { + GeeHashMapEntrySet* _tmp3_; + GeeSet* _tmp4_; + GeeSet* _tmp5_; + _tmp3_ = gee_hash_map_entry_set_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, self); + _g_object_unref0 (entries); + entries = (GeeSet*) _tmp3_; + _tmp4_ = entries; + self->priv->_entries = _tmp4_; + _tmp5_ = entries; + g_object_add_weak_pointer ((GObject*) _tmp5_, (void**) (&self->priv->_entries)); + } + result = entries; + return result; +} + + +GHashFunc gee_hash_map_get_key_hash_func (GeeHashMap* self) { + GHashFunc result; + GHashFunc _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->_key_hash_func; + result = _tmp0_; + return result; +} + + +static void gee_hash_map_set_key_hash_func (GeeHashMap* self, GHashFunc value) { + GHashFunc _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = value; + self->priv->_key_hash_func = _tmp0_; + g_object_notify ((GObject *) self, "key-hash-func"); +} + + +GEqualFunc gee_hash_map_get_key_equal_func (GeeHashMap* self) { + GEqualFunc result; + GEqualFunc _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->_key_equal_func; + result = _tmp0_; + return result; +} + + +static void gee_hash_map_set_key_equal_func (GeeHashMap* self, GEqualFunc value) { + GEqualFunc _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = value; + self->priv->_key_equal_func = _tmp0_; + g_object_notify ((GObject *) self, "key-equal-func"); +} + + +GEqualFunc gee_hash_map_get_value_equal_func (GeeHashMap* self) { + GEqualFunc result; + GEqualFunc _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->_value_equal_func; + result = _tmp0_; + return result; +} + + +static void gee_hash_map_set_value_equal_func (GeeHashMap* self, GEqualFunc value) { + GEqualFunc _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = value; + self->priv->_value_equal_func = _tmp0_; + g_object_notify ((GObject *) self, "value-equal-func"); +} + + +static GeeHashMapNode* gee_hash_map_node_new (gpointer k, gpointer v, guint hash) { + GeeHashMapNode* self; + gpointer _tmp0_; + gpointer _tmp1_; + guint _tmp2_; + self = g_slice_new0 (GeeHashMapNode); + gee_hash_map_node_instance_init (self); + _tmp0_ = k; + k = NULL; + self->key = _tmp0_; + _tmp1_ = v; + v = NULL; + self->value = _tmp1_; + _tmp2_ = hash; + self->key_hash = _tmp2_; + self->entry = NULL; + return self; +} + + +static void gee_hash_map_node_instance_init (GeeHashMapNode * self) { +} + + +static void gee_hash_map_node_free (GeeHashMapNode* self) { + _gee_hash_map_node_free0 (self->next); + g_slice_free (GeeHashMapNode, self); +} + + +static GeeMapEntry* gee_hash_map_entry_entry_for (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMapNode* node) { + GeeMapEntry* result = NULL; + GeeHashMapNode* _tmp0_; + GeeMapEntry* _tmp1_; + GeeMapEntry* _tmp2_; + GeeMapEntry* _result_; + GeeHashMapNode* _tmp3_; + GeeMapEntry* _tmp4_; + g_return_val_if_fail (node != NULL, NULL); + _tmp0_ = node; + _tmp1_ = _tmp0_->entry; + _tmp2_ = _g_object_ref0 (_tmp1_); + _result_ = _tmp2_; + _tmp3_ = node; + _tmp4_ = _tmp3_->entry; + if (_tmp4_ == NULL) { + GeeHashMapNode* _tmp5_; + GeeHashMapEntry* _tmp6_; + GeeHashMapNode* _tmp7_; + GeeMapEntry* _tmp8_; + GeeMapEntry* _tmp9_; + GeeHashMapNode* _tmp10_; + _tmp5_ = node; + _tmp6_ = gee_hash_map_entry_new (k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func, _tmp5_); + _g_object_unref0 (_result_); + _result_ = (GeeMapEntry*) _tmp6_; + _tmp7_ = node; + _tmp8_ = _result_; + _tmp7_->entry = _tmp8_; + _tmp9_ = _result_; + _tmp10_ = node; + g_object_add_weak_pointer ((GObject*) _tmp9_, (void**) (&_tmp10_->entry)); + } + result = _result_; + return result; +} + + +static GeeHashMapEntry* gee_hash_map_entry_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMapNode* node) { + GeeHashMapEntry * self = NULL; + GeeHashMapNode* _tmp0_; + g_return_val_if_fail (node != NULL, NULL); + self = (GeeHashMapEntry*) gee_map_entry_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _tmp0_ = node; + self->priv->_node = _tmp0_; + return self; +} + + +static GeeHashMapEntry* gee_hash_map_entry_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMapNode* node) { + return gee_hash_map_entry_construct (GEE_HASH_MAP_TYPE_ENTRY, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, node); +} + + +static gconstpointer gee_hash_map_entry_real_get_key (GeeMapEntry* base) { + gconstpointer result; + GeeHashMapEntry* self; + GeeHashMapNode* _tmp0_; + gconstpointer _tmp1_; + self = (GeeHashMapEntry*) base; + _tmp0_ = self->priv->_node; + _tmp1_ = _tmp0_->key; + result = _tmp1_; + return result; +} + + +static gconstpointer gee_hash_map_entry_real_get_value (GeeMapEntry* base) { + gconstpointer result; + GeeHashMapEntry* self; + GeeHashMapNode* _tmp0_; + gconstpointer _tmp1_; + self = (GeeHashMapEntry*) base; + _tmp0_ = self->priv->_node; + _tmp1_ = _tmp0_->value; + result = _tmp1_; + return result; +} + + +static void gee_hash_map_entry_real_set_value (GeeMapEntry* base, gconstpointer value) { + GeeHashMapEntry* self; + GeeHashMapNode* _tmp0_; + gconstpointer _tmp1_; + gpointer _tmp2_; + self = (GeeHashMapEntry*) base; + _tmp0_ = self->priv->_node; + _tmp1_ = value; + _tmp2_ = ((_tmp1_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp1_) : ((gpointer) _tmp1_); + ((_tmp0_->value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_tmp0_->value = (self->priv->v_destroy_func (_tmp0_->value), NULL)); + _tmp0_->value = _tmp2_; + g_object_notify ((GObject *) self, "value"); +} + + +static void gee_hash_map_entry_class_init (GeeHashMapEntryClass * klass) { + gee_hash_map_entry_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeHashMapEntryPrivate)); + GEE_MAP_ENTRY_CLASS (klass)->get_key = gee_hash_map_entry_real_get_key; + GEE_MAP_ENTRY_CLASS (klass)->get_value = gee_hash_map_entry_real_get_value; + GEE_MAP_ENTRY_CLASS (klass)->set_value = gee_hash_map_entry_real_set_value; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_hash_map_entry_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_hash_map_entry_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_hash_map_entry_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_KEY, g_param_spec_pointer ("key", "key", "key", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_VALUE, g_param_spec_pointer ("value", "value", "value", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +static void gee_hash_map_entry_instance_init (GeeHashMapEntry * self) { + self->priv = GEE_HASH_MAP_ENTRY_GET_PRIVATE (self); +} + + +static void gee_hash_map_entry_finalize (GObject* obj) { + GeeHashMapEntry * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_HASH_MAP_TYPE_ENTRY, GeeHashMapEntry); + G_OBJECT_CLASS (gee_hash_map_entry_parent_class)->finalize (obj); +} + + +static GType gee_hash_map_entry_get_type (void) { + static volatile gsize gee_hash_map_entry_type_id__volatile = 0; + if (g_once_init_enter (&gee_hash_map_entry_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeHashMapEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_hash_map_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeHashMapEntry), 0, (GInstanceInitFunc) gee_hash_map_entry_instance_init, NULL }; + GType gee_hash_map_entry_type_id; + gee_hash_map_entry_type_id = g_type_register_static (GEE_MAP_TYPE_ENTRY, "GeeHashMapEntry", &g_define_type_info, 0); + g_once_init_leave (&gee_hash_map_entry_type_id__volatile, gee_hash_map_entry_type_id); + } + return gee_hash_map_entry_type_id__volatile; +} + + +static void _vala_gee_hash_map_entry_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeHashMapEntry * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_ENTRY, GeeHashMapEntry); + switch (property_id) { + case GEE_HASH_MAP_ENTRY_KEY: + g_value_set_pointer (value, gee_map_entry_get_key ((GeeMapEntry*) self)); + break; + case GEE_HASH_MAP_ENTRY_VALUE: + g_value_set_pointer (value, gee_map_entry_get_value ((GeeMapEntry*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_hash_map_entry_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeHashMapEntry * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_ENTRY, GeeHashMapEntry); + switch (property_id) { + case GEE_HASH_MAP_ENTRY_VALUE: + gee_map_entry_set_value ((GeeMapEntry*) self, g_value_get_pointer (value)); + break; + case GEE_HASH_MAP_ENTRY_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_ENTRY_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_ENTRY_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_ENTRY_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_ENTRY_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_ENTRY_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeHashMapKeySet* gee_hash_map_key_set_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map) { + GeeHashMapKeySet * self = NULL; + GeeHashMap* _tmp0_; + GeeHashMap* _tmp1_; + g_return_val_if_fail (map != NULL, NULL); + self = (GeeHashMapKeySet*) gee_abstract_set_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _tmp0_ = map; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->_map); + self->priv->_map = _tmp1_; + return self; +} + + +static GeeHashMapKeySet* gee_hash_map_key_set_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map) { + return gee_hash_map_key_set_construct (GEE_HASH_MAP_TYPE_KEY_SET, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, map); +} + + +static GeeIterator* gee_hash_map_key_set_real_iterator (GeeAbstractCollection* base) { + GeeHashMapKeySet * self; + GeeIterator* result = NULL; + GeeHashMap* _tmp0_; + GeeHashMapKeyIterator* _tmp1_; + self = (GeeHashMapKeySet*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_hash_map_key_iterator_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, _tmp0_); + result = (GeeIterator*) _tmp1_; + return result; +} + + +static gboolean gee_hash_map_key_set_real_add (GeeAbstractCollection* base, gconstpointer key) { + GeeHashMapKeySet * self; + gboolean result = FALSE; + self = (GeeHashMapKeySet*) base; + g_assert_not_reached (); + return result; +} + + +static void gee_hash_map_key_set_real_clear (GeeAbstractCollection* base) { + GeeHashMapKeySet * self; + self = (GeeHashMapKeySet*) base; + g_assert_not_reached (); +} + + +static gboolean gee_hash_map_key_set_real_remove (GeeAbstractCollection* base, gconstpointer key) { + GeeHashMapKeySet * self; + gboolean result = FALSE; + self = (GeeHashMapKeySet*) base; + g_assert_not_reached (); + return result; +} + + +static gboolean gee_hash_map_key_set_real_contains (GeeAbstractCollection* base, gconstpointer key) { + GeeHashMapKeySet * self; + gboolean result = FALSE; + GeeHashMap* _tmp0_; + gconstpointer _tmp1_; + gboolean _tmp2_ = FALSE; + self = (GeeHashMapKeySet*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = key; + _tmp2_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, _tmp1_); + result = _tmp2_; + return result; +} + + +static gboolean gee_hash_map_key_set_real_add_all (GeeAbstractCollection* base, GeeCollection* collection) { + GeeHashMapKeySet * self; + gboolean result = FALSE; + self = (GeeHashMapKeySet*) base; + g_return_val_if_fail (collection != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gboolean gee_hash_map_key_set_real_remove_all (GeeAbstractCollection* base, GeeCollection* collection) { + GeeHashMapKeySet * self; + gboolean result = FALSE; + self = (GeeHashMapKeySet*) base; + g_return_val_if_fail (collection != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gboolean gee_hash_map_key_set_real_retain_all (GeeAbstractCollection* base, GeeCollection* collection) { + GeeHashMapKeySet * self; + gboolean result = FALSE; + self = (GeeHashMapKeySet*) base; + g_return_val_if_fail (collection != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gint gee_hash_map_key_set_real_get_size (GeeAbstractCollection* base) { + gint result; + GeeHashMapKeySet* self; + GeeHashMap* _tmp0_; + gint _tmp1_; + gint _tmp2_; + self = (GeeHashMapKeySet*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_abstract_map_get_size ((GeeMap*) _tmp0_); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +static void gee_hash_map_key_set_class_init (GeeHashMapKeySetClass * klass) { + gee_hash_map_key_set_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeHashMapKeySetPrivate)); + GEE_ABSTRACT_COLLECTION_CLASS (klass)->iterator = gee_hash_map_key_set_real_iterator; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add = gee_hash_map_key_set_real_add; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->clear = gee_hash_map_key_set_real_clear; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove = gee_hash_map_key_set_real_remove; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains = gee_hash_map_key_set_real_contains; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add_all = gee_hash_map_key_set_real_add_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove_all = gee_hash_map_key_set_real_remove_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->retain_all = gee_hash_map_key_set_real_retain_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_size = gee_hash_map_key_set_real_get_size; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_hash_map_key_set_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_hash_map_key_set_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_hash_map_key_set_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_KEY_SET_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_KEY_SET_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_KEY_SET_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_KEY_SET_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_KEY_SET_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_KEY_SET_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_KEY_SET_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_hash_map_key_set_instance_init (GeeHashMapKeySet * self) { + self->priv = GEE_HASH_MAP_KEY_SET_GET_PRIVATE (self); +} + + +static void gee_hash_map_key_set_finalize (GObject* obj) { + GeeHashMapKeySet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_HASH_MAP_TYPE_KEY_SET, GeeHashMapKeySet); + _g_object_unref0 (self->priv->_map); + G_OBJECT_CLASS (gee_hash_map_key_set_parent_class)->finalize (obj); +} + + +static GType gee_hash_map_key_set_get_type (void) { + static volatile gsize gee_hash_map_key_set_type_id__volatile = 0; + if (g_once_init_enter (&gee_hash_map_key_set_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeHashMapKeySetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_hash_map_key_set_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeHashMapKeySet), 0, (GInstanceInitFunc) gee_hash_map_key_set_instance_init, NULL }; + GType gee_hash_map_key_set_type_id; + gee_hash_map_key_set_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_SET, "GeeHashMapKeySet", &g_define_type_info, 0); + g_once_init_leave (&gee_hash_map_key_set_type_id__volatile, gee_hash_map_key_set_type_id); + } + return gee_hash_map_key_set_type_id__volatile; +} + + +static void _vala_gee_hash_map_key_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeHashMapKeySet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_KEY_SET, GeeHashMapKeySet); + switch (property_id) { + case GEE_HASH_MAP_KEY_SET_SIZE: + g_value_set_int (value, gee_abstract_collection_get_size ((GeeAbstractCollection*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_hash_map_key_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeHashMapKeySet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_KEY_SET, GeeHashMapKeySet); + switch (property_id) { + case GEE_HASH_MAP_KEY_SET_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_KEY_SET_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_KEY_SET_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_KEY_SET_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_KEY_SET_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_KEY_SET_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeHashMapValueCollection* gee_hash_map_value_collection_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map) { + GeeHashMapValueCollection * self = NULL; + GeeHashMap* _tmp0_; + GeeHashMap* _tmp1_; + g_return_val_if_fail (map != NULL, NULL); + self = (GeeHashMapValueCollection*) gee_abstract_collection_construct (object_type, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _tmp0_ = map; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->_map); + self->priv->_map = _tmp1_; + return self; +} + + +static GeeHashMapValueCollection* gee_hash_map_value_collection_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map) { + return gee_hash_map_value_collection_construct (GEE_HASH_MAP_TYPE_VALUE_COLLECTION, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, map); +} + + +static GeeIterator* gee_hash_map_value_collection_real_iterator (GeeAbstractCollection* base) { + GeeHashMapValueCollection * self; + GeeIterator* result = NULL; + GeeHashMap* _tmp0_; + GeeHashMapValueIterator* _tmp1_; + self = (GeeHashMapValueCollection*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_hash_map_value_iterator_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, _tmp0_); + result = (GeeIterator*) _tmp1_; + return result; +} + + +static gboolean gee_hash_map_value_collection_real_add (GeeAbstractCollection* base, gconstpointer value) { + GeeHashMapValueCollection * self; + gboolean result = FALSE; + self = (GeeHashMapValueCollection*) base; + g_assert_not_reached (); + return result; +} + + +static void gee_hash_map_value_collection_real_clear (GeeAbstractCollection* base) { + GeeHashMapValueCollection * self; + self = (GeeHashMapValueCollection*) base; + g_assert_not_reached (); +} + + +static gboolean gee_hash_map_value_collection_real_remove (GeeAbstractCollection* base, gconstpointer value) { + GeeHashMapValueCollection * self; + gboolean result = FALSE; + self = (GeeHashMapValueCollection*) base; + g_assert_not_reached (); + return result; +} + + +static gboolean gee_hash_map_value_collection_real_contains (GeeAbstractCollection* base, gconstpointer value) { + GeeHashMapValueCollection * self; + gboolean result = FALSE; + GeeIterator* _tmp0_ = NULL; + GeeIterator* it; + self = (GeeHashMapValueCollection*) base; + _tmp0_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self); + it = _tmp0_; + while (TRUE) { + GeeIterator* _tmp1_; + gboolean _tmp2_ = FALSE; + GeeHashMap* _tmp3_; + GEqualFunc _tmp4_; + GEqualFunc _tmp5_; + GeeIterator* _tmp6_; + gpointer _tmp7_ = NULL; + gpointer _tmp8_; + gconstpointer _tmp9_; + gboolean _tmp10_ = FALSE; + gboolean _tmp11_; + _tmp1_ = it; + _tmp2_ = gee_iterator_next (_tmp1_); + if (!_tmp2_) { + break; + } + _tmp3_ = self->priv->_map; + _tmp4_ = gee_hash_map_get_value_equal_func (_tmp3_); + _tmp5_ = _tmp4_; + _tmp6_ = it; + _tmp7_ = gee_iterator_get (_tmp6_); + _tmp8_ = _tmp7_; + _tmp9_ = value; + _tmp10_ = _tmp5_ (_tmp8_, _tmp9_); + _tmp11_ = _tmp10_; + ((_tmp8_ == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_tmp8_ = (self->priv->v_destroy_func (_tmp8_), NULL)); + if (_tmp11_) { + result = TRUE; + _g_object_unref0 (it); + return result; + } + } + result = FALSE; + _g_object_unref0 (it); + return result; +} + + +static gboolean gee_hash_map_value_collection_real_add_all (GeeAbstractCollection* base, GeeCollection* collection) { + GeeHashMapValueCollection * self; + gboolean result = FALSE; + self = (GeeHashMapValueCollection*) base; + g_return_val_if_fail (collection != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gboolean gee_hash_map_value_collection_real_remove_all (GeeAbstractCollection* base, GeeCollection* collection) { + GeeHashMapValueCollection * self; + gboolean result = FALSE; + self = (GeeHashMapValueCollection*) base; + g_return_val_if_fail (collection != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gboolean gee_hash_map_value_collection_real_retain_all (GeeAbstractCollection* base, GeeCollection* collection) { + GeeHashMapValueCollection * self; + gboolean result = FALSE; + self = (GeeHashMapValueCollection*) base; + g_return_val_if_fail (collection != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gint gee_hash_map_value_collection_real_get_size (GeeAbstractCollection* base) { + gint result; + GeeHashMapValueCollection* self; + GeeHashMap* _tmp0_; + gint _tmp1_; + gint _tmp2_; + self = (GeeHashMapValueCollection*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_abstract_map_get_size ((GeeMap*) _tmp0_); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +static void gee_hash_map_value_collection_class_init (GeeHashMapValueCollectionClass * klass) { + gee_hash_map_value_collection_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeHashMapValueCollectionPrivate)); + GEE_ABSTRACT_COLLECTION_CLASS (klass)->iterator = gee_hash_map_value_collection_real_iterator; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add = gee_hash_map_value_collection_real_add; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->clear = gee_hash_map_value_collection_real_clear; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove = gee_hash_map_value_collection_real_remove; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains = gee_hash_map_value_collection_real_contains; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add_all = gee_hash_map_value_collection_real_add_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove_all = gee_hash_map_value_collection_real_remove_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->retain_all = gee_hash_map_value_collection_real_retain_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_size = gee_hash_map_value_collection_real_get_size; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_hash_map_value_collection_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_hash_map_value_collection_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_hash_map_value_collection_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_VALUE_COLLECTION_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_VALUE_COLLECTION_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_VALUE_COLLECTION_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_VALUE_COLLECTION_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_VALUE_COLLECTION_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_VALUE_COLLECTION_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_VALUE_COLLECTION_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_hash_map_value_collection_instance_init (GeeHashMapValueCollection * self) { + self->priv = GEE_HASH_MAP_VALUE_COLLECTION_GET_PRIVATE (self); +} + + +static void gee_hash_map_value_collection_finalize (GObject* obj) { + GeeHashMapValueCollection * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_HASH_MAP_TYPE_VALUE_COLLECTION, GeeHashMapValueCollection); + _g_object_unref0 (self->priv->_map); + G_OBJECT_CLASS (gee_hash_map_value_collection_parent_class)->finalize (obj); +} + + +static GType gee_hash_map_value_collection_get_type (void) { + static volatile gsize gee_hash_map_value_collection_type_id__volatile = 0; + if (g_once_init_enter (&gee_hash_map_value_collection_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeHashMapValueCollectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_hash_map_value_collection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeHashMapValueCollection), 0, (GInstanceInitFunc) gee_hash_map_value_collection_instance_init, NULL }; + GType gee_hash_map_value_collection_type_id; + gee_hash_map_value_collection_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_COLLECTION, "GeeHashMapValueCollection", &g_define_type_info, 0); + g_once_init_leave (&gee_hash_map_value_collection_type_id__volatile, gee_hash_map_value_collection_type_id); + } + return gee_hash_map_value_collection_type_id__volatile; +} + + +static void _vala_gee_hash_map_value_collection_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeHashMapValueCollection * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_VALUE_COLLECTION, GeeHashMapValueCollection); + switch (property_id) { + case GEE_HASH_MAP_VALUE_COLLECTION_SIZE: + g_value_set_int (value, gee_abstract_collection_get_size ((GeeAbstractCollection*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_hash_map_value_collection_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeHashMapValueCollection * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_VALUE_COLLECTION, GeeHashMapValueCollection); + switch (property_id) { + case GEE_HASH_MAP_VALUE_COLLECTION_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_VALUE_COLLECTION_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_VALUE_COLLECTION_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_VALUE_COLLECTION_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_VALUE_COLLECTION_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_VALUE_COLLECTION_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeHashMapEntrySet* gee_hash_map_entry_set_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map) { + GeeHashMapEntrySet * self = NULL; + GeeHashMap* _tmp0_; + GeeHashMap* _tmp1_; + g_return_val_if_fail (map != NULL, NULL); + self = (GeeHashMapEntrySet*) gee_abstract_set_construct (object_type, GEE_MAP_TYPE_ENTRY, (GBoxedCopyFunc) g_object_ref, g_object_unref); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _tmp0_ = map; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->_map); + self->priv->_map = _tmp1_; + return self; +} + + +static GeeHashMapEntrySet* gee_hash_map_entry_set_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map) { + return gee_hash_map_entry_set_construct (GEE_HASH_MAP_TYPE_ENTRY_SET, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, map); +} + + +static GeeIterator* gee_hash_map_entry_set_real_iterator (GeeAbstractCollection* base) { + GeeHashMapEntrySet * self; + GeeIterator* result = NULL; + GeeHashMap* _tmp0_; + GeeHashMapEntryIterator* _tmp1_; + self = (GeeHashMapEntrySet*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_hash_map_entry_iterator_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, _tmp0_); + result = (GeeIterator*) _tmp1_; + return result; +} + + +static gboolean gee_hash_map_entry_set_real_add (GeeAbstractCollection* base, GeeMapEntry* entry) { + GeeHashMapEntrySet * self; + gboolean result = FALSE; + self = (GeeHashMapEntrySet*) base; + g_return_val_if_fail (entry != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static void gee_hash_map_entry_set_real_clear (GeeAbstractCollection* base) { + GeeHashMapEntrySet * self; + self = (GeeHashMapEntrySet*) base; + g_assert_not_reached (); +} + + +static gboolean gee_hash_map_entry_set_real_remove (GeeAbstractCollection* base, GeeMapEntry* entry) { + GeeHashMapEntrySet * self; + gboolean result = FALSE; + self = (GeeHashMapEntrySet*) base; + g_return_val_if_fail (entry != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gboolean gee_hash_map_entry_set_real_contains (GeeAbstractCollection* base, GeeMapEntry* entry) { + GeeHashMapEntrySet * self; + gboolean result = FALSE; + GeeHashMap* _tmp0_; + GeeMapEntry* _tmp1_; + gconstpointer _tmp2_; + gconstpointer _tmp3_; + GeeMapEntry* _tmp4_; + gconstpointer _tmp5_; + gconstpointer _tmp6_; + gboolean _tmp7_ = FALSE; + self = (GeeHashMapEntrySet*) base; + g_return_val_if_fail (entry != NULL, FALSE); + _tmp0_ = self->priv->_map; + _tmp1_ = entry; + _tmp2_ = gee_map_entry_get_key (_tmp1_); + _tmp3_ = _tmp2_; + _tmp4_ = entry; + _tmp5_ = gee_map_entry_get_value (_tmp4_); + _tmp6_ = _tmp5_; + _tmp7_ = gee_abstract_map_has ((GeeAbstractMap*) _tmp0_, _tmp3_, _tmp6_); + result = _tmp7_; + return result; +} + + +static gboolean gee_hash_map_entry_set_real_add_all (GeeAbstractCollection* base, GeeCollection* entries) { + GeeHashMapEntrySet * self; + gboolean result = FALSE; + self = (GeeHashMapEntrySet*) base; + g_return_val_if_fail (entries != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gboolean gee_hash_map_entry_set_real_remove_all (GeeAbstractCollection* base, GeeCollection* entries) { + GeeHashMapEntrySet * self; + gboolean result = FALSE; + self = (GeeHashMapEntrySet*) base; + g_return_val_if_fail (entries != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gboolean gee_hash_map_entry_set_real_retain_all (GeeAbstractCollection* base, GeeCollection* entries) { + GeeHashMapEntrySet * self; + gboolean result = FALSE; + self = (GeeHashMapEntrySet*) base; + g_return_val_if_fail (entries != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gint gee_hash_map_entry_set_real_get_size (GeeAbstractCollection* base) { + gint result; + GeeHashMapEntrySet* self; + GeeHashMap* _tmp0_; + gint _tmp1_; + gint _tmp2_; + self = (GeeHashMapEntrySet*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_abstract_map_get_size ((GeeMap*) _tmp0_); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +static void gee_hash_map_entry_set_class_init (GeeHashMapEntrySetClass * klass) { + gee_hash_map_entry_set_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeHashMapEntrySetPrivate)); + GEE_ABSTRACT_COLLECTION_CLASS (klass)->iterator = gee_hash_map_entry_set_real_iterator; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add = gee_hash_map_entry_set_real_add; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->clear = gee_hash_map_entry_set_real_clear; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove = gee_hash_map_entry_set_real_remove; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains = gee_hash_map_entry_set_real_contains; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add_all = gee_hash_map_entry_set_real_add_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove_all = gee_hash_map_entry_set_real_remove_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->retain_all = gee_hash_map_entry_set_real_retain_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_size = gee_hash_map_entry_set_real_get_size; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_hash_map_entry_set_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_hash_map_entry_set_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_hash_map_entry_set_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_SET_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_SET_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_SET_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_SET_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_SET_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_SET_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_SET_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_hash_map_entry_set_instance_init (GeeHashMapEntrySet * self) { + self->priv = GEE_HASH_MAP_ENTRY_SET_GET_PRIVATE (self); +} + + +static void gee_hash_map_entry_set_finalize (GObject* obj) { + GeeHashMapEntrySet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_HASH_MAP_TYPE_ENTRY_SET, GeeHashMapEntrySet); + _g_object_unref0 (self->priv->_map); + G_OBJECT_CLASS (gee_hash_map_entry_set_parent_class)->finalize (obj); +} + + +static GType gee_hash_map_entry_set_get_type (void) { + static volatile gsize gee_hash_map_entry_set_type_id__volatile = 0; + if (g_once_init_enter (&gee_hash_map_entry_set_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeHashMapEntrySetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_hash_map_entry_set_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeHashMapEntrySet), 0, (GInstanceInitFunc) gee_hash_map_entry_set_instance_init, NULL }; + GType gee_hash_map_entry_set_type_id; + gee_hash_map_entry_set_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_SET, "GeeHashMapEntrySet", &g_define_type_info, 0); + g_once_init_leave (&gee_hash_map_entry_set_type_id__volatile, gee_hash_map_entry_set_type_id); + } + return gee_hash_map_entry_set_type_id__volatile; +} + + +static void _vala_gee_hash_map_entry_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeHashMapEntrySet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_ENTRY_SET, GeeHashMapEntrySet); + switch (property_id) { + case GEE_HASH_MAP_ENTRY_SET_SIZE: + g_value_set_int (value, gee_abstract_collection_get_size ((GeeAbstractCollection*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_hash_map_entry_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeHashMapEntrySet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_ENTRY_SET, GeeHashMapEntrySet); + switch (property_id) { + case GEE_HASH_MAP_ENTRY_SET_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_ENTRY_SET_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_ENTRY_SET_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_ENTRY_SET_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_ENTRY_SET_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_ENTRY_SET_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeHashMapNodeIterator* gee_hash_map_node_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map) { + GeeHashMapNodeIterator * self = NULL; + GeeHashMap* _tmp0_; + GeeHashMap* _tmp1_; + GeeHashMap* _tmp2_; + gint _tmp3_; + g_return_val_if_fail (map != NULL, NULL); + self = (GeeHashMapNodeIterator*) g_object_new (object_type, NULL); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _tmp0_ = map; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->_map); + self->_map = _tmp1_; + _tmp2_ = self->_map; + _tmp3_ = _tmp2_->priv->_stamp; + self->_stamp = _tmp3_; + return self; +} + + +static gboolean gee_hash_map_node_iterator_next (GeeHashMapNodeIterator* self) { + gboolean result = FALSE; + gint _tmp0_; + GeeHashMap* _tmp1_; + gint _tmp2_; + gboolean _tmp3_ = FALSE; + GeeHashMapNode* _tmp4_; + GeeHashMapNode* _tmp5_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = self->_stamp; + _tmp1_ = self->_map; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _map._stamp"); + _tmp3_ = gee_hash_map_node_iterator_has_next (self); + if (!_tmp3_) { + result = FALSE; + return result; + } + _tmp4_ = self->_next; + self->_node = _tmp4_; + self->_next = NULL; + _tmp5_ = self->_node; + result = _tmp5_ != NULL; + return result; +} + + +static gboolean gee_hash_map_node_iterator_has_next (GeeHashMapNodeIterator* self) { + gboolean result = FALSE; + gint _tmp0_; + GeeHashMap* _tmp1_; + gint _tmp2_; + GeeHashMapNode* _tmp3_; + GeeHashMapNode* _tmp19_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = self->_stamp; + _tmp1_ = self->_map; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _map._stamp"); + _tmp3_ = self->_next; + if (_tmp3_ == NULL) { + GeeHashMapNode* _tmp4_; + GeeHashMapNode* _tmp5_; + _tmp4_ = self->_node; + self->_next = _tmp4_; + _tmp5_ = self->_next; + if (_tmp5_ != NULL) { + GeeHashMapNode* _tmp6_; + GeeHashMapNode* _tmp7_; + _tmp6_ = self->_next; + _tmp7_ = _tmp6_->next; + self->_next = _tmp7_; + } + while (TRUE) { + gboolean _tmp8_ = FALSE; + GeeHashMapNode* _tmp9_; + gboolean _tmp13_; + gint _tmp14_; + GeeHashMap* _tmp15_; + GeeHashMapNode** _tmp16_; + gint _tmp16__length1; + gint _tmp17_; + GeeHashMapNode* _tmp18_; + _tmp9_ = self->_next; + if (_tmp9_ == NULL) { + gint _tmp10_; + GeeHashMap* _tmp11_; + gint _tmp12_; + _tmp10_ = self->priv->_index; + _tmp11_ = self->_map; + _tmp12_ = _tmp11_->priv->_array_size; + _tmp8_ = (_tmp10_ + 1) < _tmp12_; + } else { + _tmp8_ = FALSE; + } + _tmp13_ = _tmp8_; + if (!_tmp13_) { + break; + } + _tmp14_ = self->priv->_index; + self->priv->_index = _tmp14_ + 1; + _tmp15_ = self->_map; + _tmp16_ = _tmp15_->priv->_nodes; + _tmp16__length1 = _tmp15_->priv->_nodes_length1; + _tmp17_ = self->priv->_index; + _tmp18_ = _tmp16_[_tmp17_]; + self->_next = _tmp18_; + } + } + _tmp19_ = self->_next; + result = _tmp19_ != NULL; + return result; +} + + +static gboolean gee_hash_map_node_iterator_first (GeeHashMapNodeIterator* self) { + gboolean result = FALSE; + gint _tmp0_; + GeeHashMap* _tmp1_; + gint _tmp2_; + GeeHashMap* _tmp3_; + gint _tmp4_; + gint _tmp5_; + gboolean _tmp6_ = FALSE; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = self->_stamp; + _tmp1_ = self->_map; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _map._stamp"); + _tmp3_ = self->_map; + _tmp4_ = gee_abstract_map_get_size ((GeeMap*) _tmp3_); + _tmp5_ = _tmp4_; + if (_tmp5_ == 0) { + result = FALSE; + return result; + } + self->priv->_index = -1; + self->_next = NULL; + _tmp6_ = gee_hash_map_node_iterator_next (self); + result = _tmp6_; + return result; +} + + +static void gee_hash_map_node_iterator_class_init (GeeHashMapNodeIteratorClass * klass) { + gee_hash_map_node_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeHashMapNodeIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_hash_map_node_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_hash_map_node_iterator_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_hash_map_node_iterator_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_NODE_ITERATOR_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_NODE_ITERATOR_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_NODE_ITERATOR_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_NODE_ITERATOR_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_NODE_ITERATOR_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_NODE_ITERATOR_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_hash_map_node_iterator_instance_init (GeeHashMapNodeIterator * self) { + self->priv = GEE_HASH_MAP_NODE_ITERATOR_GET_PRIVATE (self); + self->priv->_index = -1; +} + + +static void gee_hash_map_node_iterator_finalize (GObject* obj) { + GeeHashMapNodeIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_HASH_MAP_TYPE_NODE_ITERATOR, GeeHashMapNodeIterator); + _g_object_unref0 (self->_map); + G_OBJECT_CLASS (gee_hash_map_node_iterator_parent_class)->finalize (obj); +} + + +static GType gee_hash_map_node_iterator_get_type (void) { + static volatile gsize gee_hash_map_node_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_hash_map_node_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeHashMapNodeIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_hash_map_node_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeHashMapNodeIterator), 0, (GInstanceInitFunc) gee_hash_map_node_iterator_instance_init, NULL }; + GType gee_hash_map_node_iterator_type_id; + gee_hash_map_node_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeHashMapNodeIterator", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&gee_hash_map_node_iterator_type_id__volatile, gee_hash_map_node_iterator_type_id); + } + return gee_hash_map_node_iterator_type_id__volatile; +} + + +static void _vala_gee_hash_map_node_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeHashMapNodeIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_NODE_ITERATOR, GeeHashMapNodeIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_hash_map_node_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeHashMapNodeIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_NODE_ITERATOR, GeeHashMapNodeIterator); + switch (property_id) { + case GEE_HASH_MAP_NODE_ITERATOR_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_NODE_ITERATOR_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_NODE_ITERATOR_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_NODE_ITERATOR_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_NODE_ITERATOR_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_NODE_ITERATOR_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeHashMapKeyIterator* gee_hash_map_key_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map) { + GeeHashMapKeyIterator * self = NULL; + GeeHashMap* _tmp0_; + g_return_val_if_fail (map != NULL, NULL); + _tmp0_ = map; + self = (GeeHashMapKeyIterator*) gee_hash_map_node_iterator_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func, _tmp0_); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + return self; +} + + +static GeeHashMapKeyIterator* gee_hash_map_key_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map) { + return gee_hash_map_key_iterator_construct (GEE_HASH_MAP_TYPE_KEY_ITERATOR, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, map); +} + + +static gpointer gee_hash_map_key_iterator_real_get (GeeIterator* base) { + GeeHashMapKeyIterator * self; + gpointer result = NULL; + gint _tmp0_; + GeeHashMap* _tmp1_; + gint _tmp2_; + GeeHashMapNode* _tmp3_; + GeeHashMapNode* _tmp4_; + gconstpointer _tmp5_; + gpointer _tmp6_; + self = (GeeHashMapKeyIterator*) base; + _tmp0_ = ((GeeHashMapNodeIterator*) self)->_stamp; + _tmp1_ = ((GeeHashMapNodeIterator*) self)->_map; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _map._stamp"); + _tmp3_ = ((GeeHashMapNodeIterator*) self)->_node; + _vala_assert (_tmp3_ != NULL, "_node != null"); + _tmp4_ = ((GeeHashMapNodeIterator*) self)->_node; + _tmp5_ = _tmp4_->key; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->k_dup_func != NULL)) ? self->priv->k_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + result = _tmp6_; + return result; +} + + +static void gee_hash_map_key_iterator_real_remove (GeeIterator* base) { + GeeHashMapKeyIterator * self; + self = (GeeHashMapKeyIterator*) base; + g_assert_not_reached (); +} + + +static void gee_hash_map_key_iterator_class_init (GeeHashMapKeyIteratorClass * klass) { + gee_hash_map_key_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeHashMapKeyIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_hash_map_key_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_hash_map_key_iterator_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_KEY_ITERATOR_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_KEY_ITERATOR_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_KEY_ITERATOR_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_KEY_ITERATOR_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_KEY_ITERATOR_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_KEY_ITERATOR_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_hash_map_key_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) { + gee_hash_map_key_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->get = (gpointer (*)(GeeIterator*)) gee_hash_map_key_iterator_real_get; + iface->remove = (void (*)(GeeIterator*)) gee_hash_map_key_iterator_real_remove; + iface->next = (gboolean (*)(GeeIterator*)) gee_hash_map_node_iterator_next; + iface->has_next = (gboolean (*)(GeeIterator*)) gee_hash_map_node_iterator_has_next; + iface->first = (gboolean (*)(GeeIterator*)) gee_hash_map_node_iterator_first; +} + + +static void gee_hash_map_key_iterator_instance_init (GeeHashMapKeyIterator * self) { + self->priv = GEE_HASH_MAP_KEY_ITERATOR_GET_PRIVATE (self); +} + + +static GType gee_hash_map_key_iterator_get_type (void) { + static volatile gsize gee_hash_map_key_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_hash_map_key_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeHashMapKeyIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_hash_map_key_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeHashMapKeyIterator), 0, (GInstanceInitFunc) gee_hash_map_key_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_hash_map_key_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_hash_map_key_iterator_type_id; + gee_hash_map_key_iterator_type_id = g_type_register_static (GEE_HASH_MAP_TYPE_NODE_ITERATOR, "GeeHashMapKeyIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_hash_map_key_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info); + g_once_init_leave (&gee_hash_map_key_iterator_type_id__volatile, gee_hash_map_key_iterator_type_id); + } + return gee_hash_map_key_iterator_type_id__volatile; +} + + +static void _vala_gee_hash_map_key_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeHashMapKeyIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_KEY_ITERATOR, GeeHashMapKeyIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_hash_map_key_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeHashMapKeyIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_KEY_ITERATOR, GeeHashMapKeyIterator); + switch (property_id) { + case GEE_HASH_MAP_KEY_ITERATOR_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_KEY_ITERATOR_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_KEY_ITERATOR_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_KEY_ITERATOR_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_KEY_ITERATOR_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_KEY_ITERATOR_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeHashMapMapIterator* gee_hash_map_map_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map) { + GeeHashMapMapIterator * self = NULL; + GeeHashMap* _tmp0_; + g_return_val_if_fail (map != NULL, NULL); + _tmp0_ = map; + self = (GeeHashMapMapIterator*) gee_hash_map_node_iterator_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func, _tmp0_); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + return self; +} + + +static GeeHashMapMapIterator* gee_hash_map_map_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map) { + return gee_hash_map_map_iterator_construct (GEE_HASH_MAP_TYPE_MAP_ITERATOR, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, map); +} + + +static gpointer gee_hash_map_map_iterator_real_get_key (GeeMapIterator* base) { + GeeHashMapMapIterator * self; + gpointer result = NULL; + gint _tmp0_; + GeeHashMap* _tmp1_; + gint _tmp2_; + GeeHashMapNode* _tmp3_; + GeeHashMapNode* _tmp4_; + gconstpointer _tmp5_; + gpointer _tmp6_; + self = (GeeHashMapMapIterator*) base; + _tmp0_ = ((GeeHashMapNodeIterator*) self)->_stamp; + _tmp1_ = ((GeeHashMapNodeIterator*) self)->_map; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _map._stamp"); + _tmp3_ = ((GeeHashMapNodeIterator*) self)->_node; + _vala_assert (_tmp3_ != NULL, "_node != null"); + _tmp4_ = ((GeeHashMapNodeIterator*) self)->_node; + _tmp5_ = _tmp4_->key; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->k_dup_func != NULL)) ? self->priv->k_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + result = _tmp6_; + return result; +} + + +static void gee_hash_map_map_iterator_real_unset (GeeMapIterator* base) { + GeeHashMapMapIterator * self; + gint _tmp0_; + GeeHashMap* _tmp1_; + gint _tmp2_; + GeeHashMapNode* _tmp3_; + GeeHashMap* _tmp4_; + GeeHashMapNode* _tmp5_; + gconstpointer _tmp6_; + GeeHashMap* _tmp7_; + gint _tmp8_; + self = (GeeHashMapMapIterator*) base; + _tmp0_ = ((GeeHashMapNodeIterator*) self)->_stamp; + _tmp1_ = ((GeeHashMapNodeIterator*) self)->_map; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _map._stamp"); + _tmp3_ = ((GeeHashMapNodeIterator*) self)->_node; + _vala_assert (_tmp3_ != NULL, "_node != null"); + gee_map_iterator_has_next ((GeeMapIterator*) self); + _tmp4_ = ((GeeHashMapNodeIterator*) self)->_map; + _tmp5_ = ((GeeHashMapNodeIterator*) self)->_node; + _tmp6_ = _tmp5_->key; + gee_abstract_map_unset ((GeeAbstractMap*) _tmp4_, _tmp6_, NULL); + ((GeeHashMapNodeIterator*) self)->_node = NULL; + _tmp7_ = ((GeeHashMapNodeIterator*) self)->_map; + _tmp8_ = _tmp7_->priv->_stamp; + ((GeeHashMapNodeIterator*) self)->_stamp = _tmp8_; +} + + +static gpointer gee_hash_map_map_iterator_real_get_value (GeeMapIterator* base) { + GeeHashMapMapIterator * self; + gpointer result = NULL; + gint _tmp0_; + GeeHashMap* _tmp1_; + gint _tmp2_; + GeeHashMapNode* _tmp3_; + GeeHashMapNode* _tmp4_; + gconstpointer _tmp5_; + gpointer _tmp6_; + self = (GeeHashMapMapIterator*) base; + _tmp0_ = ((GeeHashMapNodeIterator*) self)->_stamp; + _tmp1_ = ((GeeHashMapNodeIterator*) self)->_map; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _map._stamp"); + _tmp3_ = ((GeeHashMapNodeIterator*) self)->_node; + _vala_assert (_tmp3_ != NULL, "_node != null"); + _tmp4_ = ((GeeHashMapNodeIterator*) self)->_node; + _tmp5_ = _tmp4_->value; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + result = _tmp6_; + return result; +} + + +static void gee_hash_map_map_iterator_real_set_value (GeeMapIterator* base, gconstpointer value) { + GeeHashMapMapIterator * self; + gint _tmp0_; + GeeHashMap* _tmp1_; + gint _tmp2_; + GeeHashMapNode* _tmp3_; + GeeHashMap* _tmp4_; + GeeHashMapNode* _tmp5_; + gconstpointer _tmp6_; + gconstpointer _tmp7_; + GeeHashMap* _tmp8_; + gint _tmp9_; + self = (GeeHashMapMapIterator*) base; + _tmp0_ = ((GeeHashMapNodeIterator*) self)->_stamp; + _tmp1_ = ((GeeHashMapNodeIterator*) self)->_map; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _map._stamp"); + _tmp3_ = ((GeeHashMapNodeIterator*) self)->_node; + _vala_assert (_tmp3_ != NULL, "_node != null"); + _tmp4_ = ((GeeHashMapNodeIterator*) self)->_map; + _tmp5_ = ((GeeHashMapNodeIterator*) self)->_node; + _tmp6_ = _tmp5_->key; + _tmp7_ = value; + gee_abstract_map_set ((GeeAbstractMap*) _tmp4_, _tmp6_, _tmp7_); + _tmp8_ = ((GeeHashMapNodeIterator*) self)->_map; + _tmp9_ = _tmp8_->priv->_stamp; + ((GeeHashMapNodeIterator*) self)->_stamp = _tmp9_; +} + + +static void gee_hash_map_map_iterator_class_init (GeeHashMapMapIteratorClass * klass) { + gee_hash_map_map_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeHashMapMapIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_hash_map_map_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_hash_map_map_iterator_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_MAP_ITERATOR_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_MAP_ITERATOR_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_MAP_ITERATOR_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_MAP_ITERATOR_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_MAP_ITERATOR_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_MAP_ITERATOR_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_hash_map_map_iterator_gee_map_iterator_interface_init (GeeMapIteratorIface * iface) { + gee_hash_map_map_iterator_gee_map_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->get_key = (gpointer (*)(GeeMapIterator*)) gee_hash_map_map_iterator_real_get_key; + iface->unset = (void (*)(GeeMapIterator*)) gee_hash_map_map_iterator_real_unset; + iface->get_value = (gpointer (*)(GeeMapIterator*)) gee_hash_map_map_iterator_real_get_value; + iface->set_value = (void (*)(GeeMapIterator*, gconstpointer)) gee_hash_map_map_iterator_real_set_value; + iface->next = (gboolean (*)(GeeMapIterator*)) gee_hash_map_node_iterator_next; + iface->has_next = (gboolean (*)(GeeMapIterator*)) gee_hash_map_node_iterator_has_next; + iface->first = (gboolean (*)(GeeMapIterator*)) gee_hash_map_node_iterator_first; +} + + +static void gee_hash_map_map_iterator_instance_init (GeeHashMapMapIterator * self) { + self->priv = GEE_HASH_MAP_MAP_ITERATOR_GET_PRIVATE (self); +} + + +static GType gee_hash_map_map_iterator_get_type (void) { + static volatile gsize gee_hash_map_map_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_hash_map_map_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeHashMapMapIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_hash_map_map_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeHashMapMapIterator), 0, (GInstanceInitFunc) gee_hash_map_map_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_map_iterator_info = { (GInterfaceInitFunc) gee_hash_map_map_iterator_gee_map_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_hash_map_map_iterator_type_id; + gee_hash_map_map_iterator_type_id = g_type_register_static (GEE_HASH_MAP_TYPE_NODE_ITERATOR, "GeeHashMapMapIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_hash_map_map_iterator_type_id, GEE_TYPE_MAP_ITERATOR, &gee_map_iterator_info); + g_once_init_leave (&gee_hash_map_map_iterator_type_id__volatile, gee_hash_map_map_iterator_type_id); + } + return gee_hash_map_map_iterator_type_id__volatile; +} + + +static void _vala_gee_hash_map_map_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeHashMapMapIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_MAP_ITERATOR, GeeHashMapMapIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_hash_map_map_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeHashMapMapIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_MAP_ITERATOR, GeeHashMapMapIterator); + switch (property_id) { + case GEE_HASH_MAP_MAP_ITERATOR_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_MAP_ITERATOR_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_MAP_ITERATOR_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_MAP_ITERATOR_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_MAP_ITERATOR_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_MAP_ITERATOR_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeHashMapValueIterator* gee_hash_map_value_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map) { + GeeHashMapValueIterator * self = NULL; + GeeHashMap* _tmp0_; + g_return_val_if_fail (map != NULL, NULL); + _tmp0_ = map; + self = (GeeHashMapValueIterator*) gee_hash_map_node_iterator_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func, _tmp0_); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + return self; +} + + +static GeeHashMapValueIterator* gee_hash_map_value_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map) { + return gee_hash_map_value_iterator_construct (GEE_HASH_MAP_TYPE_VALUE_ITERATOR, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, map); +} + + +static gpointer gee_hash_map_value_iterator_real_get (GeeIterator* base) { + GeeHashMapValueIterator * self; + gpointer result = NULL; + gint _tmp0_; + GeeHashMap* _tmp1_; + gint _tmp2_; + GeeHashMapNode* _tmp3_; + GeeHashMapNode* _tmp4_; + gconstpointer _tmp5_; + gpointer _tmp6_; + self = (GeeHashMapValueIterator*) base; + _tmp0_ = ((GeeHashMapNodeIterator*) self)->_stamp; + _tmp1_ = ((GeeHashMapNodeIterator*) self)->_map; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _map._stamp"); + _tmp3_ = ((GeeHashMapNodeIterator*) self)->_node; + _vala_assert (_tmp3_ != NULL, "_node != null"); + _tmp4_ = ((GeeHashMapNodeIterator*) self)->_node; + _tmp5_ = _tmp4_->value; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + result = _tmp6_; + return result; +} + + +static void gee_hash_map_value_iterator_real_remove (GeeIterator* base) { + GeeHashMapValueIterator * self; + self = (GeeHashMapValueIterator*) base; + g_assert_not_reached (); +} + + +static void gee_hash_map_value_iterator_class_init (GeeHashMapValueIteratorClass * klass) { + gee_hash_map_value_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeHashMapValueIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_hash_map_value_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_hash_map_value_iterator_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_VALUE_ITERATOR_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_VALUE_ITERATOR_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_VALUE_ITERATOR_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_VALUE_ITERATOR_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_VALUE_ITERATOR_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_VALUE_ITERATOR_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_hash_map_value_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) { + gee_hash_map_value_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->get = (gpointer (*)(GeeIterator*)) gee_hash_map_value_iterator_real_get; + iface->remove = (void (*)(GeeIterator*)) gee_hash_map_value_iterator_real_remove; + iface->next = (gboolean (*)(GeeIterator*)) gee_hash_map_node_iterator_next; + iface->has_next = (gboolean (*)(GeeIterator*)) gee_hash_map_node_iterator_has_next; + iface->first = (gboolean (*)(GeeIterator*)) gee_hash_map_node_iterator_first; +} + + +static void gee_hash_map_value_iterator_instance_init (GeeHashMapValueIterator * self) { + self->priv = GEE_HASH_MAP_VALUE_ITERATOR_GET_PRIVATE (self); +} + + +static GType gee_hash_map_value_iterator_get_type (void) { + static volatile gsize gee_hash_map_value_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_hash_map_value_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeHashMapValueIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_hash_map_value_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeHashMapValueIterator), 0, (GInstanceInitFunc) gee_hash_map_value_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_hash_map_value_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_hash_map_value_iterator_type_id; + gee_hash_map_value_iterator_type_id = g_type_register_static (GEE_HASH_MAP_TYPE_NODE_ITERATOR, "GeeHashMapValueIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_hash_map_value_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info); + g_once_init_leave (&gee_hash_map_value_iterator_type_id__volatile, gee_hash_map_value_iterator_type_id); + } + return gee_hash_map_value_iterator_type_id__volatile; +} + + +static void _vala_gee_hash_map_value_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeHashMapValueIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_VALUE_ITERATOR, GeeHashMapValueIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_hash_map_value_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeHashMapValueIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_VALUE_ITERATOR, GeeHashMapValueIterator); + switch (property_id) { + case GEE_HASH_MAP_VALUE_ITERATOR_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_VALUE_ITERATOR_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_VALUE_ITERATOR_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_VALUE_ITERATOR_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_VALUE_ITERATOR_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_VALUE_ITERATOR_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeHashMapEntryIterator* gee_hash_map_entry_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map) { + GeeHashMapEntryIterator * self = NULL; + GeeHashMap* _tmp0_; + g_return_val_if_fail (map != NULL, NULL); + _tmp0_ = map; + self = (GeeHashMapEntryIterator*) gee_hash_map_node_iterator_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func, _tmp0_); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + return self; +} + + +static GeeHashMapEntryIterator* gee_hash_map_entry_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeHashMap* map) { + return gee_hash_map_entry_iterator_construct (GEE_HASH_MAP_TYPE_ENTRY_ITERATOR, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, map); +} + + +static GeeMapEntry* gee_hash_map_entry_iterator_real_get (GeeIterator* base) { + GeeHashMapEntryIterator * self; + GeeMapEntry* result = NULL; + gint _tmp0_; + GeeHashMap* _tmp1_; + gint _tmp2_; + GeeHashMapNode* _tmp3_; + GeeHashMapNode* _tmp4_; + GeeMapEntry* _tmp5_ = NULL; + self = (GeeHashMapEntryIterator*) base; + _tmp0_ = ((GeeHashMapNodeIterator*) self)->_stamp; + _tmp1_ = ((GeeHashMapNodeIterator*) self)->_map; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _map._stamp"); + _tmp3_ = ((GeeHashMapNodeIterator*) self)->_node; + _vala_assert (_tmp3_ != NULL, "_node != null"); + _tmp4_ = ((GeeHashMapNodeIterator*) self)->_node; + _tmp5_ = gee_hash_map_entry_entry_for (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, _tmp4_); + result = _tmp5_; + return result; +} + + +static void gee_hash_map_entry_iterator_real_remove (GeeIterator* base) { + GeeHashMapEntryIterator * self; + self = (GeeHashMapEntryIterator*) base; + g_assert_not_reached (); +} + + +static void gee_hash_map_entry_iterator_class_init (GeeHashMapEntryIteratorClass * klass) { + gee_hash_map_entry_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeHashMapEntryIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_hash_map_entry_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_hash_map_entry_iterator_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_ITERATOR_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_ITERATOR_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_ITERATOR_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_ITERATOR_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_ITERATOR_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRY_ITERATOR_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_hash_map_entry_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) { + gee_hash_map_entry_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->get = (gpointer (*)(GeeIterator*)) gee_hash_map_entry_iterator_real_get; + iface->remove = (void (*)(GeeIterator*)) gee_hash_map_entry_iterator_real_remove; + iface->next = (gboolean (*)(GeeIterator*)) gee_hash_map_node_iterator_next; + iface->has_next = (gboolean (*)(GeeIterator*)) gee_hash_map_node_iterator_has_next; + iface->first = (gboolean (*)(GeeIterator*)) gee_hash_map_node_iterator_first; +} + + +static void gee_hash_map_entry_iterator_instance_init (GeeHashMapEntryIterator * self) { + self->priv = GEE_HASH_MAP_ENTRY_ITERATOR_GET_PRIVATE (self); +} + + +static GType gee_hash_map_entry_iterator_get_type (void) { + static volatile gsize gee_hash_map_entry_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_hash_map_entry_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeHashMapEntryIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_hash_map_entry_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeHashMapEntryIterator), 0, (GInstanceInitFunc) gee_hash_map_entry_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_hash_map_entry_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_hash_map_entry_iterator_type_id; + gee_hash_map_entry_iterator_type_id = g_type_register_static (GEE_HASH_MAP_TYPE_NODE_ITERATOR, "GeeHashMapEntryIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_hash_map_entry_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info); + g_once_init_leave (&gee_hash_map_entry_iterator_type_id__volatile, gee_hash_map_entry_iterator_type_id); + } + return gee_hash_map_entry_iterator_type_id__volatile; +} + + +static void _vala_gee_hash_map_entry_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeHashMapEntryIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_ENTRY_ITERATOR, GeeHashMapEntryIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_hash_map_entry_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeHashMapEntryIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_MAP_TYPE_ENTRY_ITERATOR, GeeHashMapEntryIterator); + switch (property_id) { + case GEE_HASH_MAP_ENTRY_ITERATOR_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_ENTRY_ITERATOR_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_ENTRY_ITERATOR_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_ENTRY_ITERATOR_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_ENTRY_ITERATOR_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_ENTRY_ITERATOR_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void gee_hash_map_class_init (GeeHashMapClass * klass) { + gee_hash_map_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeHashMapPrivate)); + GEE_ABSTRACT_MAP_CLASS (klass)->has_key = gee_hash_map_real_has_key; + GEE_ABSTRACT_MAP_CLASS (klass)->has = gee_hash_map_real_has; + GEE_ABSTRACT_MAP_CLASS (klass)->get = gee_hash_map_real_get; + GEE_ABSTRACT_MAP_CLASS (klass)->set = gee_hash_map_real_set; + GEE_ABSTRACT_MAP_CLASS (klass)->unset = gee_hash_map_real_unset; + GEE_ABSTRACT_MAP_CLASS (klass)->clear = gee_hash_map_real_clear; + GEE_ABSTRACT_MAP_CLASS (klass)->map_iterator = gee_hash_map_real_map_iterator; + GEE_ABSTRACT_MAP_CLASS (klass)->get_size = gee_hash_map_real_get_size; + GEE_ABSTRACT_MAP_CLASS (klass)->get_keys = gee_hash_map_real_get_keys; + GEE_ABSTRACT_MAP_CLASS (klass)->get_values = gee_hash_map_real_get_values; + GEE_ABSTRACT_MAP_CLASS (klass)->get_entries = gee_hash_map_real_get_entries; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_hash_map_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_hash_map_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_hash_map_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_KEYS, g_param_spec_object ("keys", "keys", "keys", GEE_TYPE_SET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_VALUES, g_param_spec_object ("values", "values", "values", GEE_TYPE_COLLECTION, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_ENTRIES, g_param_spec_object ("entries", "entries", "entries", GEE_TYPE_SET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The keys' hash function. + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_KEY_HASH_FUNC, g_param_spec_pointer ("key-hash-func", "key-hash-func", "key-hash-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The keys' equality testing function. + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_KEY_EQUAL_FUNC, g_param_spec_pointer ("key-equal-func", "key-equal-func", "key-equal-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The values' equality testing function. + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MAP_VALUE_EQUAL_FUNC, g_param_spec_pointer ("value-equal-func", "value-equal-func", "value-equal-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_hash_map_instance_init (GeeHashMap * self) { + self->priv = GEE_HASH_MAP_GET_PRIVATE (self); + self->priv->_stamp = 0; +} + + +static void gee_hash_map_finalize (GObject* obj) { + GeeHashMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_HASH_MAP, GeeHashMap); + gee_abstract_map_clear ((GeeAbstractMap*) self); + self->priv->_nodes = (_vala_array_free (self->priv->_nodes, self->priv->_nodes_length1, (GDestroyNotify) gee_hash_map_node_free), NULL); + G_OBJECT_CLASS (gee_hash_map_parent_class)->finalize (obj); +} + + +/** + * Hash table implementation of the {@link Map} interface. + * + * This implementation is better fit for highly heterogenous key values. + * In case of high key hashes redundancy or higher amount of data prefer using + * tree implementation like {@link TreeMap}. + * + * @see TreeMap + */ +GType gee_hash_map_get_type (void) { + static volatile gsize gee_hash_map_type_id__volatile = 0; + if (g_once_init_enter (&gee_hash_map_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeHashMapClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_hash_map_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeHashMap), 0, (GInstanceInitFunc) gee_hash_map_instance_init, NULL }; + GType gee_hash_map_type_id; + gee_hash_map_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_MAP, "GeeHashMap", &g_define_type_info, 0); + g_once_init_leave (&gee_hash_map_type_id__volatile, gee_hash_map_type_id); + } + return gee_hash_map_type_id__volatile; +} + + +static void _vala_gee_hash_map_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeHashMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_HASH_MAP, GeeHashMap); + switch (property_id) { + case GEE_HASH_MAP_SIZE: + g_value_set_int (value, gee_abstract_map_get_size ((GeeAbstractMap*) self)); + break; + case GEE_HASH_MAP_KEYS: + g_value_take_object (value, gee_abstract_map_get_keys ((GeeAbstractMap*) self)); + break; + case GEE_HASH_MAP_VALUES: + g_value_take_object (value, gee_abstract_map_get_values ((GeeAbstractMap*) self)); + break; + case GEE_HASH_MAP_ENTRIES: + g_value_take_object (value, gee_abstract_map_get_entries ((GeeAbstractMap*) self)); + break; + case GEE_HASH_MAP_KEY_HASH_FUNC: + g_value_set_pointer (value, gee_hash_map_get_key_hash_func (self)); + break; + case GEE_HASH_MAP_KEY_EQUAL_FUNC: + g_value_set_pointer (value, gee_hash_map_get_key_equal_func (self)); + break; + case GEE_HASH_MAP_VALUE_EQUAL_FUNC: + g_value_set_pointer (value, gee_hash_map_get_value_equal_func (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_hash_map_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeHashMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_HASH_MAP, GeeHashMap); + switch (property_id) { + case GEE_HASH_MAP_KEY_HASH_FUNC: + gee_hash_map_set_key_hash_func (self, g_value_get_pointer (value)); + break; + case GEE_HASH_MAP_KEY_EQUAL_FUNC: + gee_hash_map_set_key_equal_func (self, g_value_get_pointer (value)); + break; + case GEE_HASH_MAP_VALUE_EQUAL_FUNC: + gee_hash_map_set_value_equal_func (self, g_value_get_pointer (value)); + break; + case GEE_HASH_MAP_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_HASH_MAP_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MAP_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + + diff --git a/gee/hashmap.vala b/gee/hashmap.vala new file mode 100644 index 0000000..6e8670f --- /dev/null +++ b/gee/hashmap.vala @@ -0,0 +1,597 @@ +/* hashmap.vala + * + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * Copyright (C) 1997-2000 GLib Team and others + * Copyright (C) 2007-2009 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +using GLib; + +/** + * Hash table implementation of the {@link Map} interface. + * + * This implementation is better fit for highly heterogenous key values. + * In case of high key hashes redundancy or higher amount of data prefer using + * tree implementation like {@link TreeMap}. + * + * @see TreeMap + */ +public class Gee.HashMap : Gee.AbstractMap { + /** + * {@inheritDoc} + */ + public override int size { + get { return _nnodes; } + } + + /** + * {@inheritDoc} + */ + public override Set keys { + owned get { + Set keys = _keys; + if (_keys == null) { + keys = new KeySet (this); + _keys = keys; + keys.add_weak_pointer ((void**) (&_keys)); + } + return keys; + } + } + + /** + * {@inheritDoc} + */ + public override Collection values { + owned get { + Collection values = _values; + if (_values == null) { + values = new ValueCollection (this); + _values = values; + values.add_weak_pointer ((void**) (&_values)); + } + return values; + } + } + + /** + * {@inheritDoc} + */ + public override Set> entries { + owned get { + Set> entries = _entries; + if (_entries == null) { + entries = new EntrySet (this); + _entries = entries; + entries.add_weak_pointer ((void**) (&_entries)); + } + return entries; + } + } + + /** + * The keys' hash function. + */ + public HashFunc key_hash_func { private set; get; } + + /** + * The keys' equality testing function. + */ + public EqualFunc key_equal_func { private set; get; } + + /** + * The values' equality testing function. + */ + public EqualFunc value_equal_func { private set; get; } + + private int _array_size; + private int _nnodes; + private Node[] _nodes; + + private weak Set _keys; + private weak Collection _values; + private weak Set> _entries; + + // concurrent modification protection + private int _stamp = 0; + + private const int MIN_SIZE = 11; + private const int MAX_SIZE = 13845163; + + /** + * Constructs a new, empty hash map. + * + * If not provided, the functions parameters are requested to the + * {@link Functions} function factory methods. + * + * @param key_hash_func an optional key hash function + * @param key_equal_func an optional key equality testing function + * @param value_equal_func an optional value equality testing function + */ + public HashMap (HashFunc? key_hash_func = null, EqualFunc? key_equal_func = null, EqualFunc? value_equal_func = null) { + if (key_hash_func == null) { + key_hash_func = Functions.get_hash_func_for (typeof (K)); + } + if (key_equal_func == null) { + key_equal_func = Functions.get_equal_func_for (typeof (K)); + } + if (value_equal_func == null) { + value_equal_func = Functions.get_equal_func_for (typeof (V)); + } + this.key_hash_func = key_hash_func; + this.key_equal_func = key_equal_func; + this.value_equal_func = value_equal_func; + + _array_size = MIN_SIZE; + _nodes = new Node[_array_size]; + } + + private Node** lookup_node (K key) { + uint hash_value = key_hash_func (key); + Node** node = &_nodes[hash_value % _array_size]; + while ((*node) != null && (hash_value != (*node)->key_hash || !key_equal_func ((*node)->key, key))) { + node = &((*node)->next); + } + return node; + } + + /** + * {@inheritDoc} + */ + public override bool has_key (K key) { + Node** node = lookup_node (key); + return (*node != null); + } + + /** + * {@inheritDoc} + */ + public override bool has (K key, V value) { + Node** node = lookup_node (key); + return (*node != null && value_equal_func ((*node)->value, value)); + } + + /** + * {@inheritDoc} + */ + public override V? get (K key) { + Node* node = (*lookup_node (key)); + if (node != null) { + return node->value; + } else { + return null; + } + } + + /** + * {@inheritDoc} + */ + public override void set (K key, V value) { + Node** node = lookup_node (key); + if (*node != null) { + (*node)->value = value; + } else { + uint hash_value = key_hash_func (key); + *node = new Node (key, value, hash_value); + _nnodes++; + resize (); + } + _stamp++; + } + + /** + * {@inheritDoc} + */ + public override bool unset (K key, out V? value = null) { + bool b = unset_helper (key, out value); + if(b) { + resize(); + } + return b; + } + + /** + * {@inheritDoc} + */ + public override void clear () { + for (int i = 0; i < _array_size; i++) { + Node node = (owned) _nodes[i]; + while (node != null) { + Node next = (owned) node.next; + node.key = null; + node.value = null; + node = (owned) next; + } + } + _nnodes = 0; + resize (); + } + + /** + * {@inheritDoc} + */ + public override Gee.MapIterator map_iterator () { + return new MapIterator (this); + } + + private inline bool unset_helper (K key, out V? value = null) { + Node** node = lookup_node (key); + if (*node != null) { + Node next = (owned) (*node)->next; + + if (&value != null) { + value = (owned) (*node)->value; + } + + (*node)->key = null; + (*node)->value = null; + delete *node; + + *node = (owned) next; + + _nnodes--; + _stamp++; + return true; + } else { + value = null; + } + return false; + } + + private inline void resize () { + if ((_array_size >= 3 * _nnodes && _array_size >= MIN_SIZE) || + (3 * _array_size <= _nnodes && _array_size < MAX_SIZE)) { + int new_array_size = (int) SpacedPrimes.closest (_nnodes); + new_array_size = new_array_size.clamp (MIN_SIZE, MAX_SIZE); + + Node[] new_nodes = new Node[new_array_size]; + + for (int i = 0; i < _array_size; i++) { + Node node; + Node next = null; + for (node = (owned) _nodes[i]; node != null; node = (owned) next) { + next = (owned) node.next; + uint hash_val = node.key_hash % new_array_size; + node.next = (owned) new_nodes[hash_val]; + new_nodes[hash_val] = (owned) node; + } + } + _nodes = (owned) new_nodes; + _array_size = new_array_size; + } + } + + ~HashSet () { + clear (); + } + + [Compact] + private class Node { + public K key; + public V value; + public Node next; + public uint key_hash; + public unowned Map.Entry? entry; + + public Node (owned K k, owned V v, uint hash) { + key = (owned) k; + value = (owned) v; + key_hash = hash; + entry = null; + } + } + + private class Entry : Map.Entry { + private unowned Node _node; + + public static Map.Entry entry_for (Node node) { + Map.Entry result = node.entry; + if (node.entry == null) { + result = new Entry (node); + node.entry = result; + result.add_weak_pointer ((void**) (&node.entry)); + } + return result; + } + + public Entry (Node node) { + _node = node; + } + + public override K key { get { return _node.key; } } + + public override V value { + get { return _node.value; } + set { _node.value = value; } + } + } + + private class KeySet : AbstractSet { + private HashMap _map; + + public KeySet (HashMap map) { + _map = map; + } + + public override Iterator iterator () { + return new KeyIterator (_map); + } + + public override int size { + get { return _map.size; } + } + + public override bool add (K key) { + assert_not_reached (); + } + + public override void clear () { + assert_not_reached (); + } + + public override bool remove (K key) { + assert_not_reached (); + } + + public override bool contains (K key) { + return _map.has_key (key); + } + + public override bool add_all (Collection collection) { + assert_not_reached (); + } + + public override bool remove_all (Collection collection) { + assert_not_reached (); + } + + public override bool retain_all (Collection collection) { + assert_not_reached (); + } + + } + + private class ValueCollection : AbstractCollection { + private HashMap _map; + + public ValueCollection (HashMap map) { + _map = map; + } + + public override Iterator iterator () { + return new ValueIterator (_map); + } + + public override int size { + get { return _map.size; } + } + + public override bool add (V value) { + assert_not_reached (); + } + + public override void clear () { + assert_not_reached (); + } + + public override bool remove (V value) { + assert_not_reached (); + } + + public override bool contains (V value) { + Iterator it = iterator (); + while (it.next ()) { + if (_map.value_equal_func (it.get (), value)) { + return true; + } + } + return false; + } + + public override bool add_all (Collection collection) { + assert_not_reached (); + } + + public override bool remove_all (Collection collection) { + assert_not_reached (); + } + + public override bool retain_all (Collection collection) { + assert_not_reached (); + } + } + + private class EntrySet : AbstractSet> { + private HashMap _map; + + public EntrySet (HashMap map) { + _map = map; + } + + public override Iterator> iterator () { + return new EntryIterator (_map); + } + + public override int size { + get { return _map.size; } + } + + public override bool add (Map.Entry entry) { + assert_not_reached (); + } + + public override void clear () { + assert_not_reached (); + } + + public override bool remove (Map.Entry entry) { + assert_not_reached (); + } + + public override bool contains (Map.Entry entry) { + return _map.has (entry.key, entry.value); + } + + public override bool add_all (Collection> entries) { + assert_not_reached (); + } + + public override bool remove_all (Collection> entries) { + assert_not_reached (); + } + + public override bool retain_all (Collection> entries) { + assert_not_reached (); + } + } + + private abstract class NodeIterator : Object { + protected HashMap _map; + private int _index = -1; + protected weak Node _node; + protected weak Node _next; + + // concurrent modification protection + protected int _stamp; + + public NodeIterator (HashMap map) { + _map = map; + _stamp = _map._stamp; + } + + public bool next () { + assert (_stamp == _map._stamp); + if (!has_next ()) { + return false; + } + _node = _next; + _next = null; + return (_node != null); + } + + public bool has_next () { + assert (_stamp == _map._stamp); + if (_next == null) { + _next = _node; + if (_next != null) { + _next = _next.next; + } + while (_next == null && _index + 1 < _map._array_size) { + _index++; + _next = _map._nodes[_index]; + } + } + return (_next != null); + } + + public bool first () { + assert (_stamp == _map._stamp); + if (_map.size == 0) { + return false; + } + _index = -1; + _next = null; + return next (); + } + } + + private class KeyIterator : NodeIterator, Iterator { + public KeyIterator (HashMap map) { + base (map); + } + + public new K get () { + assert (_stamp == _map._stamp); + assert (_node != null); + return _node.key; + } + + public void remove () { + assert_not_reached (); + } + } + + private class MapIterator : NodeIterator, Gee.MapIterator { + public MapIterator (HashMap map) { + base (map); + } + + public new K get_key () { + assert (_stamp == _map._stamp); + assert (_node != null); + return _node.key; + } + + public void unset () { + assert (_stamp == _map._stamp); + assert (_node != null); + has_next (); + _map.unset (_node.key); + _node = null; + _stamp = _map._stamp; + } + + public V get_value () { + assert (_stamp == _map._stamp); + assert (_node != null); + return _node.value; + } + + public void set_value (V value) { + assert (_stamp == _map._stamp); + assert (_node != null); + _map.set (_node.key, value); + _stamp = _map._stamp; + } + } + + private class ValueIterator : NodeIterator, Iterator { + public ValueIterator (HashMap map) { + base (map); + } + + public new V get () { + assert (_stamp == _map._stamp); + assert (_node != null); + return _node.value; + } + + public void remove () { + assert_not_reached (); + } + } + + private class EntryIterator : NodeIterator, Iterator> { + public EntryIterator (HashMap map) { + base (map); + } + + public new Map.Entry get () { + assert (_stamp == _map._stamp); + assert (_node != null); + return Entry.entry_for (_node); + } + + public void remove () { + assert_not_reached (); + } + } +} + diff --git a/gee/hashmultimap.c b/gee/hashmultimap.c new file mode 100644 index 0000000..acb30b1 --- /dev/null +++ b/gee/hashmultimap.c @@ -0,0 +1,662 @@ +/* hashmultimap.c generated by valac 0.18.0, the Vala compiler + * generated from hashmultimap.vala, do not modify */ + +/* hashmultimap.vala + * + * Copyright (C) 2009 Ali Sabil + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Ali Sabil + */ + +#include +#include + + +#define GEE_TYPE_MULTI_MAP (gee_multi_map_get_type ()) +#define GEE_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MULTI_MAP, GeeMultiMap)) +#define GEE_IS_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MULTI_MAP)) +#define GEE_MULTI_MAP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MULTI_MAP, GeeMultiMapIface)) + +typedef struct _GeeMultiMap GeeMultiMap; +typedef struct _GeeMultiMapIface GeeMultiMapIface; + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_TYPE_MULTI_SET (gee_multi_set_get_type ()) +#define GEE_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MULTI_SET, GeeMultiSet)) +#define GEE_IS_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MULTI_SET)) +#define GEE_MULTI_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MULTI_SET, GeeMultiSetIface)) + +typedef struct _GeeMultiSet GeeMultiSet; +typedef struct _GeeMultiSetIface GeeMultiSetIface; + +#define GEE_TYPE_ABSTRACT_MULTI_MAP (gee_abstract_multi_map_get_type ()) +#define GEE_ABSTRACT_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MULTI_MAP, GeeAbstractMultiMap)) +#define GEE_ABSTRACT_MULTI_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MULTI_MAP, GeeAbstractMultiMapClass)) +#define GEE_IS_ABSTRACT_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MULTI_MAP)) +#define GEE_IS_ABSTRACT_MULTI_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MULTI_MAP)) +#define GEE_ABSTRACT_MULTI_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MULTI_MAP, GeeAbstractMultiMapClass)) + +typedef struct _GeeAbstractMultiMap GeeAbstractMultiMap; +typedef struct _GeeAbstractMultiMapClass GeeAbstractMultiMapClass; +typedef struct _GeeAbstractMultiMapPrivate GeeAbstractMultiMapPrivate; + +#define GEE_TYPE_MAP (gee_map_get_type ()) +#define GEE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP, GeeMap)) +#define GEE_IS_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP)) +#define GEE_MAP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP, GeeMapIface)) + +typedef struct _GeeMap GeeMap; +typedef struct _GeeMapIface GeeMapIface; + +#define GEE_TYPE_MAP_ITERATOR (gee_map_iterator_get_type ()) +#define GEE_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIterator)) +#define GEE_IS_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP_ITERATOR)) +#define GEE_MAP_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIteratorIface)) + +typedef struct _GeeMapIterator GeeMapIterator; +typedef struct _GeeMapIteratorIface GeeMapIteratorIface; + +#define GEE_MAP_TYPE_ENTRY (gee_map_entry_get_type ()) +#define GEE_MAP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntry)) +#define GEE_MAP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) +#define GEE_MAP_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) + +typedef struct _GeeMapEntry GeeMapEntry; +typedef struct _GeeMapEntryClass GeeMapEntryClass; + +#define GEE_TYPE_HASH_MULTI_MAP (gee_hash_multi_map_get_type ()) +#define GEE_HASH_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_HASH_MULTI_MAP, GeeHashMultiMap)) +#define GEE_HASH_MULTI_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_HASH_MULTI_MAP, GeeHashMultiMapClass)) +#define GEE_IS_HASH_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_HASH_MULTI_MAP)) +#define GEE_IS_HASH_MULTI_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_HASH_MULTI_MAP)) +#define GEE_HASH_MULTI_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_HASH_MULTI_MAP, GeeHashMultiMapClass)) + +typedef struct _GeeHashMultiMap GeeHashMultiMap; +typedef struct _GeeHashMultiMapClass GeeHashMultiMapClass; +typedef struct _GeeHashMultiMapPrivate GeeHashMultiMapPrivate; + +#define GEE_TYPE_ABSTRACT_MAP (gee_abstract_map_get_type ()) +#define GEE_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap)) +#define GEE_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) +#define GEE_IS_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_IS_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_ABSTRACT_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) + +typedef struct _GeeAbstractMap GeeAbstractMap; +typedef struct _GeeAbstractMapClass GeeAbstractMapClass; + +#define GEE_TYPE_HASH_MAP (gee_hash_map_get_type ()) +#define GEE_HASH_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_HASH_MAP, GeeHashMap)) +#define GEE_HASH_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_HASH_MAP, GeeHashMapClass)) +#define GEE_IS_HASH_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_HASH_MAP)) +#define GEE_IS_HASH_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_HASH_MAP)) +#define GEE_HASH_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_HASH_MAP, GeeHashMapClass)) + +typedef struct _GeeHashMap GeeHashMap; +typedef struct _GeeHashMapClass GeeHashMapClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; + +#define GEE_TYPE_ABSTRACT_SET (gee_abstract_set_get_type ()) +#define GEE_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSet)) +#define GEE_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) +#define GEE_IS_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_SET)) +#define GEE_IS_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_SET)) +#define GEE_ABSTRACT_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) + +typedef struct _GeeAbstractSet GeeAbstractSet; +typedef struct _GeeAbstractSetClass GeeAbstractSetClass; + +#define GEE_TYPE_HASH_SET (gee_hash_set_get_type ()) +#define GEE_HASH_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_HASH_SET, GeeHashSet)) +#define GEE_HASH_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_HASH_SET, GeeHashSetClass)) +#define GEE_IS_HASH_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_HASH_SET)) +#define GEE_IS_HASH_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_HASH_SET)) +#define GEE_HASH_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_HASH_SET, GeeHashSetClass)) + +typedef struct _GeeHashSet GeeHashSet; +typedef struct _GeeHashSetClass GeeHashSetClass; + +#define GEE_TYPE_ABSTRACT_MULTI_SET (gee_abstract_multi_set_get_type ()) +#define GEE_ABSTRACT_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSet)) +#define GEE_ABSTRACT_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSetClass)) +#define GEE_IS_ABSTRACT_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MULTI_SET)) +#define GEE_IS_ABSTRACT_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MULTI_SET)) +#define GEE_ABSTRACT_MULTI_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSetClass)) + +typedef struct _GeeAbstractMultiSet GeeAbstractMultiSet; +typedef struct _GeeAbstractMultiSetClass GeeAbstractMultiSetClass; + +#define GEE_TYPE_HASH_MULTI_SET (gee_hash_multi_set_get_type ()) +#define GEE_HASH_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_HASH_MULTI_SET, GeeHashMultiSet)) +#define GEE_HASH_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_HASH_MULTI_SET, GeeHashMultiSetClass)) +#define GEE_IS_HASH_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_HASH_MULTI_SET)) +#define GEE_IS_HASH_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_HASH_MULTI_SET)) +#define GEE_HASH_MULTI_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_HASH_MULTI_SET, GeeHashMultiSetClass)) + +typedef struct _GeeHashMultiSet GeeHashMultiSet; +typedef struct _GeeHashMultiSetClass GeeHashMultiSetClass; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeMultiSetIface { + GTypeInterface parent_iface; + gint (*count) (GeeMultiSet* self, gconstpointer item); +}; + +struct _GeeMultiMapIface { + GTypeInterface parent_iface; + GeeSet* (*get_keys) (GeeMultiMap* self); + GeeMultiSet* (*get_all_keys) (GeeMultiMap* self); + GeeCollection* (*get_values) (GeeMultiMap* self); + gboolean (*contains) (GeeMultiMap* self, gconstpointer key); + GeeCollection* (*get) (GeeMultiMap* self, gconstpointer key); + void (*set) (GeeMultiMap* self, gconstpointer key, gconstpointer value); + gboolean (*remove) (GeeMultiMap* self, gconstpointer key, gconstpointer value); + gboolean (*remove_all) (GeeMultiMap* self, gconstpointer key); + void (*clear) (GeeMultiMap* self); + gint (*get_size) (GeeMultiMap* self); +}; + +struct _GeeMapIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeMapIterator* self); + gboolean (*has_next) (GeeMapIterator* self); + gboolean (*first) (GeeMapIterator* self); + gpointer (*get_key) (GeeMapIterator* self); + gpointer (*get_value) (GeeMapIterator* self); + void (*set_value) (GeeMapIterator* self, gconstpointer value); + void (*unset) (GeeMapIterator* self); +}; + +struct _GeeMapIface { + GTypeInterface parent_iface; + gboolean (*has_key) (GeeMap* self, gconstpointer key); + gboolean (*contains) (GeeMap* self, gconstpointer key); + gboolean (*has) (GeeMap* self, gconstpointer key, gconstpointer value); + gpointer (*get) (GeeMap* self, gconstpointer key); + void (*set) (GeeMap* self, gconstpointer key, gconstpointer value); + gboolean (*unset) (GeeMap* self, gconstpointer key, gpointer* value); + gboolean (*remove) (GeeMap* self, gconstpointer key, gpointer* value); + void (*clear) (GeeMap* self); + GeeMapIterator* (*map_iterator) (GeeMap* self); + void (*set_all) (GeeMap* self, GeeMap* map); + gboolean (*unset_all) (GeeMap* self, GeeMap* map); + gboolean (*remove_all) (GeeMap* self, GeeMap* map); + gboolean (*has_all) (GeeMap* self, GeeMap* map); + gboolean (*contains_all) (GeeMap* self, GeeMap* map); + gint (*get_size) (GeeMap* self); + gboolean (*get_is_empty) (GeeMap* self); + GeeSet* (*get_keys) (GeeMap* self); + GeeCollection* (*get_values) (GeeMap* self); + GeeSet* (*get_entries) (GeeMap* self); + GeeMap* (*get_read_only_view) (GeeMap* self); + GType (*get_key_type) (GeeMap* self); + GType (*get_value_type) (GeeMap* self); +}; + +struct _GeeAbstractMultiMap { + GObject parent_instance; + GeeAbstractMultiMapPrivate * priv; + GeeMap* _storage_map; +}; + +struct _GeeAbstractMultiMapClass { + GObjectClass parent_class; + GeeCollection* (*create_value_storage) (GeeAbstractMultiMap* self); + GeeMultiSet* (*create_multi_key_set) (GeeAbstractMultiMap* self); + GEqualFunc (*get_value_equal_func) (GeeAbstractMultiMap* self); +}; + +struct _GeeHashMultiMap { + GeeAbstractMultiMap parent_instance; + GeeHashMultiMapPrivate * priv; +}; + +struct _GeeHashMultiMapClass { + GeeAbstractMultiMapClass parent_class; +}; + +struct _GeeHashMultiMapPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + GHashFunc _value_hash_func; + GEqualFunc _value_equal_func; +}; + + +static gpointer gee_hash_multi_map_parent_class = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_multi_set_get_type (void) G_GNUC_CONST; +GType gee_multi_map_get_type (void) G_GNUC_CONST; +GType gee_abstract_multi_map_get_type (void) G_GNUC_CONST; +GType gee_map_iterator_get_type (void) G_GNUC_CONST; +GType gee_map_entry_get_type (void) G_GNUC_CONST; +GType gee_map_get_type (void) G_GNUC_CONST; +GType gee_hash_multi_map_get_type (void) G_GNUC_CONST; +#define GEE_HASH_MULTI_MAP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_HASH_MULTI_MAP, GeeHashMultiMapPrivate)) +enum { + GEE_HASH_MULTI_MAP_DUMMY_PROPERTY, + GEE_HASH_MULTI_MAP_K_TYPE, + GEE_HASH_MULTI_MAP_K_DUP_FUNC, + GEE_HASH_MULTI_MAP_K_DESTROY_FUNC, + GEE_HASH_MULTI_MAP_V_TYPE, + GEE_HASH_MULTI_MAP_V_DUP_FUNC, + GEE_HASH_MULTI_MAP_V_DESTROY_FUNC, + GEE_HASH_MULTI_MAP_KEY_HASH_FUNC, + GEE_HASH_MULTI_MAP_KEY_EQUAL_FUNC, + GEE_HASH_MULTI_MAP_VALUE_HASH_FUNC, + GEE_HASH_MULTI_MAP_VALUE_EQUAL_FUNC +}; +GeeHashMultiMap* gee_hash_multi_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GHashFunc value_hash_func, GEqualFunc value_equal_func); +GeeHashMultiMap* gee_hash_multi_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GHashFunc value_hash_func, GEqualFunc value_equal_func); +GeeHashMap* gee_hash_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GEqualFunc value_equal_func); +GeeHashMap* gee_hash_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GEqualFunc value_equal_func); +GType gee_abstract_map_get_type (void) G_GNUC_CONST; +GType gee_hash_map_get_type (void) G_GNUC_CONST; +GeeAbstractMultiMap* gee_abstract_multi_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeMap* storage_map); +GHashFunc gee_functions_get_hash_func_for (GType t); +GEqualFunc gee_functions_get_equal_func_for (GType t); +static void gee_hash_multi_map_set_value_hash_func (GeeHashMultiMap* self, GHashFunc value); +static void gee_hash_multi_map_set_value_equal_func (GeeHashMultiMap* self, GEqualFunc value); +static GeeCollection* gee_hash_multi_map_real_create_value_storage (GeeAbstractMultiMap* base); +GeeHashSet* gee_hash_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func); +GeeHashSet* gee_hash_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func); +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_set_get_type (void) G_GNUC_CONST; +GType gee_hash_set_get_type (void) G_GNUC_CONST; +static GeeMultiSet* gee_hash_multi_map_real_create_multi_key_set (GeeAbstractMultiMap* base); +GHashFunc gee_hash_multi_map_get_key_hash_func (GeeHashMultiMap* self); +GEqualFunc gee_hash_multi_map_get_key_equal_func (GeeHashMultiMap* self); +GeeHashMultiSet* gee_hash_multi_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func); +GeeHashMultiSet* gee_hash_multi_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func); +GType gee_abstract_multi_set_get_type (void) G_GNUC_CONST; +GType gee_hash_multi_set_get_type (void) G_GNUC_CONST; +static GEqualFunc gee_hash_multi_map_real_get_value_equal_func (GeeAbstractMultiMap* base); +GHashFunc gee_hash_map_get_key_hash_func (GeeHashMap* self); +GEqualFunc gee_hash_map_get_key_equal_func (GeeHashMap* self); +GHashFunc gee_hash_multi_map_get_value_hash_func (GeeHashMultiMap* self); +GEqualFunc gee_hash_multi_map_get_value_equal_func (GeeHashMultiMap* self); +static void gee_hash_multi_map_finalize (GObject* obj); +static void _vala_gee_hash_multi_map_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_hash_multi_map_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +/** + * Constructs a new, empty hash multimap. + * + * If not provided, the functions parameters are requested to the + * {@link Functions} function factory methods. + * + * @param key_hash_func an optional key hash function + * @param key_equal_func an optional key equality testing function + * @param value_hash_func an optional value hash function + * @param value_equal_func an optional value equality testing function + */ +GeeHashMultiMap* gee_hash_multi_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GHashFunc value_hash_func, GEqualFunc value_equal_func) { + GeeHashMultiMap * self = NULL; + GHashFunc _tmp0_; + GEqualFunc _tmp1_; + GEqualFunc _tmp2_; + GeeHashMap* _tmp3_; + GeeHashMap* _tmp4_; + GHashFunc _tmp5_; + GEqualFunc _tmp7_; + GHashFunc _tmp9_; + GEqualFunc _tmp10_; + _tmp0_ = key_hash_func; + _tmp1_ = key_equal_func; + _tmp2_ = g_direct_equal; + _tmp3_ = gee_hash_map_new (k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, GEE_TYPE_SET, (GBoxedCopyFunc) g_object_ref, g_object_unref, _tmp0_, _tmp1_, _tmp2_); + _tmp4_ = _tmp3_; + self = (GeeHashMultiMap*) gee_abstract_multi_map_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func, (GeeMap*) _tmp4_); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _g_object_unref0 (_tmp4_); + _tmp5_ = value_hash_func; + if (_tmp5_ == NULL) { + GHashFunc _tmp6_ = NULL; + _tmp6_ = gee_functions_get_hash_func_for (v_type); + value_hash_func = _tmp6_; + } + _tmp7_ = value_equal_func; + if (_tmp7_ == NULL) { + GEqualFunc _tmp8_ = NULL; + _tmp8_ = gee_functions_get_equal_func_for (v_type); + value_equal_func = _tmp8_; + } + _tmp9_ = value_hash_func; + gee_hash_multi_map_set_value_hash_func (self, _tmp9_); + _tmp10_ = value_equal_func; + gee_hash_multi_map_set_value_equal_func (self, _tmp10_); + return self; +} + + +GeeHashMultiMap* gee_hash_multi_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GHashFunc value_hash_func, GEqualFunc value_equal_func) { + return gee_hash_multi_map_construct (GEE_TYPE_HASH_MULTI_MAP, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, key_hash_func, key_equal_func, value_hash_func, value_equal_func); +} + + +static GeeCollection* gee_hash_multi_map_real_create_value_storage (GeeAbstractMultiMap* base) { + GeeHashMultiMap * self; + GeeCollection* result = NULL; + GHashFunc _tmp0_; + GEqualFunc _tmp1_; + GeeHashSet* _tmp2_; + self = (GeeHashMultiMap*) base; + _tmp0_ = self->priv->_value_hash_func; + _tmp1_ = self->priv->_value_equal_func; + _tmp2_ = gee_hash_set_new (self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, _tmp0_, _tmp1_); + result = (GeeCollection*) _tmp2_; + return result; +} + + +static GeeMultiSet* gee_hash_multi_map_real_create_multi_key_set (GeeAbstractMultiMap* base) { + GeeHashMultiMap * self; + GeeMultiSet* result = NULL; + GHashFunc _tmp0_; + GHashFunc _tmp1_; + GEqualFunc _tmp2_; + GEqualFunc _tmp3_; + GeeHashMultiSet* _tmp4_; + self = (GeeHashMultiMap*) base; + _tmp0_ = gee_hash_multi_map_get_key_hash_func (self); + _tmp1_ = _tmp0_; + _tmp2_ = gee_hash_multi_map_get_key_equal_func (self); + _tmp3_ = _tmp2_; + _tmp4_ = gee_hash_multi_set_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, _tmp1_, _tmp3_); + result = (GeeMultiSet*) _tmp4_; + return result; +} + + +static GEqualFunc gee_hash_multi_map_real_get_value_equal_func (GeeAbstractMultiMap* base) { + GeeHashMultiMap * self; + GEqualFunc result = NULL; + GEqualFunc _tmp0_; + self = (GeeHashMultiMap*) base; + _tmp0_ = self->priv->_value_equal_func; + result = _tmp0_; + return result; +} + + +GHashFunc gee_hash_multi_map_get_key_hash_func (GeeHashMultiMap* self) { + GHashFunc result; + GeeMap* _tmp0_; + GHashFunc _tmp1_; + GHashFunc _tmp2_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = ((GeeAbstractMultiMap*) self)->_storage_map; + _tmp1_ = gee_hash_map_get_key_hash_func (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_HASH_MAP, GeeHashMap)); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +GEqualFunc gee_hash_multi_map_get_key_equal_func (GeeHashMultiMap* self) { + GEqualFunc result; + GeeMap* _tmp0_; + GEqualFunc _tmp1_; + GEqualFunc _tmp2_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = ((GeeAbstractMultiMap*) self)->_storage_map; + _tmp1_ = gee_hash_map_get_key_equal_func (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_HASH_MAP, GeeHashMap)); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +GHashFunc gee_hash_multi_map_get_value_hash_func (GeeHashMultiMap* self) { + GHashFunc result; + GHashFunc _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->_value_hash_func; + result = _tmp0_; + return result; +} + + +static void gee_hash_multi_map_set_value_hash_func (GeeHashMultiMap* self, GHashFunc value) { + GHashFunc _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = value; + self->priv->_value_hash_func = _tmp0_; + g_object_notify ((GObject *) self, "value-hash-func"); +} + + +GEqualFunc gee_hash_multi_map_get_value_equal_func (GeeHashMultiMap* self) { + GEqualFunc result; + GEqualFunc _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->_value_equal_func; + result = _tmp0_; + return result; +} + + +static void gee_hash_multi_map_set_value_equal_func (GeeHashMultiMap* self, GEqualFunc value) { + GEqualFunc _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = value; + self->priv->_value_equal_func = _tmp0_; + g_object_notify ((GObject *) self, "value-equal-func"); +} + + +static void gee_hash_multi_map_class_init (GeeHashMultiMapClass * klass) { + gee_hash_multi_map_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeHashMultiMapPrivate)); + GEE_ABSTRACT_MULTI_MAP_CLASS (klass)->create_value_storage = gee_hash_multi_map_real_create_value_storage; + GEE_ABSTRACT_MULTI_MAP_CLASS (klass)->create_multi_key_set = gee_hash_multi_map_real_create_multi_key_set; + GEE_ABSTRACT_MULTI_MAP_CLASS (klass)->get_value_equal_func = gee_hash_multi_map_real_get_value_equal_func; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_hash_multi_map_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_hash_multi_map_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_hash_multi_map_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MULTI_MAP_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MULTI_MAP_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MULTI_MAP_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MULTI_MAP_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MULTI_MAP_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MULTI_MAP_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MULTI_MAP_KEY_HASH_FUNC, g_param_spec_pointer ("key-hash-func", "key-hash-func", "key-hash-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MULTI_MAP_KEY_EQUAL_FUNC, g_param_spec_pointer ("key-equal-func", "key-equal-func", "key-equal-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MULTI_MAP_VALUE_HASH_FUNC, g_param_spec_pointer ("value-hash-func", "value-hash-func", "value-hash-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MULTI_MAP_VALUE_EQUAL_FUNC, g_param_spec_pointer ("value-equal-func", "value-equal-func", "value-equal-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_hash_multi_map_instance_init (GeeHashMultiMap * self) { + self->priv = GEE_HASH_MULTI_MAP_GET_PRIVATE (self); +} + + +static void gee_hash_multi_map_finalize (GObject* obj) { + GeeHashMultiMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_HASH_MULTI_MAP, GeeHashMultiMap); + G_OBJECT_CLASS (gee_hash_multi_map_parent_class)->finalize (obj); +} + + +/** + * Hash table implementation of the {@link MultiMap} interface. + */ +GType gee_hash_multi_map_get_type (void) { + static volatile gsize gee_hash_multi_map_type_id__volatile = 0; + if (g_once_init_enter (&gee_hash_multi_map_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeHashMultiMapClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_hash_multi_map_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeHashMultiMap), 0, (GInstanceInitFunc) gee_hash_multi_map_instance_init, NULL }; + GType gee_hash_multi_map_type_id; + gee_hash_multi_map_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_MULTI_MAP, "GeeHashMultiMap", &g_define_type_info, 0); + g_once_init_leave (&gee_hash_multi_map_type_id__volatile, gee_hash_multi_map_type_id); + } + return gee_hash_multi_map_type_id__volatile; +} + + +static void _vala_gee_hash_multi_map_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeHashMultiMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_HASH_MULTI_MAP, GeeHashMultiMap); + switch (property_id) { + case GEE_HASH_MULTI_MAP_KEY_HASH_FUNC: + g_value_set_pointer (value, gee_hash_multi_map_get_key_hash_func (self)); + break; + case GEE_HASH_MULTI_MAP_KEY_EQUAL_FUNC: + g_value_set_pointer (value, gee_hash_multi_map_get_key_equal_func (self)); + break; + case GEE_HASH_MULTI_MAP_VALUE_HASH_FUNC: + g_value_set_pointer (value, gee_hash_multi_map_get_value_hash_func (self)); + break; + case GEE_HASH_MULTI_MAP_VALUE_EQUAL_FUNC: + g_value_set_pointer (value, gee_hash_multi_map_get_value_equal_func (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_hash_multi_map_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeHashMultiMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_HASH_MULTI_MAP, GeeHashMultiMap); + switch (property_id) { + case GEE_HASH_MULTI_MAP_VALUE_HASH_FUNC: + gee_hash_multi_map_set_value_hash_func (self, g_value_get_pointer (value)); + break; + case GEE_HASH_MULTI_MAP_VALUE_EQUAL_FUNC: + gee_hash_multi_map_set_value_equal_func (self, g_value_get_pointer (value)); + break; + case GEE_HASH_MULTI_MAP_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_HASH_MULTI_MAP_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MULTI_MAP_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_HASH_MULTI_MAP_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_HASH_MULTI_MAP_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MULTI_MAP_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/gee/hashmultimap.vala b/gee/hashmultimap.vala new file mode 100644 index 0000000..3a10220 --- /dev/null +++ b/gee/hashmultimap.vala @@ -0,0 +1,74 @@ +/* hashmultimap.vala + * + * Copyright (C) 2009 Ali Sabil + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Ali Sabil + */ + +/** + * Hash table implementation of the {@link MultiMap} interface. + */ +public class Gee.HashMultiMap : AbstractMultiMap { + public HashFunc key_hash_func { + get { return ((HashMap>) _storage_map).key_hash_func; } + } + + public EqualFunc key_equal_func { + get { return ((HashMap>) _storage_map).key_equal_func; } + } + + public HashFunc value_hash_func { private set; get; } + + public EqualFunc value_equal_func { private set; get; } + + /** + * Constructs a new, empty hash multimap. + * + * If not provided, the functions parameters are requested to the + * {@link Functions} function factory methods. + * + * @param key_hash_func an optional key hash function + * @param key_equal_func an optional key equality testing function + * @param value_hash_func an optional value hash function + * @param value_equal_func an optional value equality testing function + */ + public HashMultiMap (HashFunc? key_hash_func = null, EqualFunc? key_equal_func = null, + HashFunc? value_hash_func = null, EqualFunc? value_equal_func = null) { + base (new HashMap> (key_hash_func, key_equal_func, direct_equal)); + if (value_hash_func == null) { + value_hash_func = Functions.get_hash_func_for (typeof (V)); + } + if (value_equal_func == null) { + value_equal_func = Functions.get_equal_func_for (typeof (V)); + } + this.value_hash_func = value_hash_func; + this.value_equal_func = value_equal_func; + } + + protected override Collection create_value_storage () { + return new HashSet (_value_hash_func, _value_equal_func); + } + + protected override MultiSet create_multi_key_set () { + return new HashMultiSet (key_hash_func, key_equal_func); + } + + protected override EqualFunc get_value_equal_func () { + return _value_equal_func; + } +} diff --git a/gee/hashmultiset.c b/gee/hashmultiset.c new file mode 100644 index 0000000..5f408d4 --- /dev/null +++ b/gee/hashmultiset.c @@ -0,0 +1,444 @@ +/* hashmultiset.c generated by valac 0.18.0, the Vala compiler + * generated from hashmultiset.vala, do not modify */ + +/* hashmultiset.vala + * + * Copyright (C) 2009 Ali Sabil + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Ali Sabil + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; +typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate; + +#define GEE_TYPE_MULTI_SET (gee_multi_set_get_type ()) +#define GEE_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MULTI_SET, GeeMultiSet)) +#define GEE_IS_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MULTI_SET)) +#define GEE_MULTI_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MULTI_SET, GeeMultiSetIface)) + +typedef struct _GeeMultiSet GeeMultiSet; +typedef struct _GeeMultiSetIface GeeMultiSetIface; + +#define GEE_TYPE_ABSTRACT_MULTI_SET (gee_abstract_multi_set_get_type ()) +#define GEE_ABSTRACT_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSet)) +#define GEE_ABSTRACT_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSetClass)) +#define GEE_IS_ABSTRACT_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MULTI_SET)) +#define GEE_IS_ABSTRACT_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MULTI_SET)) +#define GEE_ABSTRACT_MULTI_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSetClass)) + +typedef struct _GeeAbstractMultiSet GeeAbstractMultiSet; +typedef struct _GeeAbstractMultiSetClass GeeAbstractMultiSetClass; +typedef struct _GeeAbstractMultiSetPrivate GeeAbstractMultiSetPrivate; + +#define GEE_TYPE_MAP (gee_map_get_type ()) +#define GEE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP, GeeMap)) +#define GEE_IS_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP)) +#define GEE_MAP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP, GeeMapIface)) + +typedef struct _GeeMap GeeMap; +typedef struct _GeeMapIface GeeMapIface; + +#define GEE_TYPE_MAP_ITERATOR (gee_map_iterator_get_type ()) +#define GEE_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIterator)) +#define GEE_IS_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP_ITERATOR)) +#define GEE_MAP_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIteratorIface)) + +typedef struct _GeeMapIterator GeeMapIterator; +typedef struct _GeeMapIteratorIface GeeMapIteratorIface; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_MAP_TYPE_ENTRY (gee_map_entry_get_type ()) +#define GEE_MAP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntry)) +#define GEE_MAP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) +#define GEE_MAP_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) + +typedef struct _GeeMapEntry GeeMapEntry; +typedef struct _GeeMapEntryClass GeeMapEntryClass; + +#define GEE_TYPE_HASH_MULTI_SET (gee_hash_multi_set_get_type ()) +#define GEE_HASH_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_HASH_MULTI_SET, GeeHashMultiSet)) +#define GEE_HASH_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_HASH_MULTI_SET, GeeHashMultiSetClass)) +#define GEE_IS_HASH_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_HASH_MULTI_SET)) +#define GEE_IS_HASH_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_HASH_MULTI_SET)) +#define GEE_HASH_MULTI_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_HASH_MULTI_SET, GeeHashMultiSetClass)) + +typedef struct _GeeHashMultiSet GeeHashMultiSet; +typedef struct _GeeHashMultiSetClass GeeHashMultiSetClass; +typedef struct _GeeHashMultiSetPrivate GeeHashMultiSetPrivate; + +#define GEE_TYPE_ABSTRACT_MAP (gee_abstract_map_get_type ()) +#define GEE_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap)) +#define GEE_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) +#define GEE_IS_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_IS_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_ABSTRACT_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) + +typedef struct _GeeAbstractMap GeeAbstractMap; +typedef struct _GeeAbstractMapClass GeeAbstractMapClass; + +#define GEE_TYPE_HASH_MAP (gee_hash_map_get_type ()) +#define GEE_HASH_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_HASH_MAP, GeeHashMap)) +#define GEE_HASH_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_HASH_MAP, GeeHashMapClass)) +#define GEE_IS_HASH_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_HASH_MAP)) +#define GEE_IS_HASH_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_HASH_MAP)) +#define GEE_HASH_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_HASH_MAP, GeeHashMapClass)) + +typedef struct _GeeHashMap GeeHashMap; +typedef struct _GeeHashMapClass GeeHashMapClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeAbstractCollection { + GObject parent_instance; + GeeAbstractCollectionPrivate * priv; +}; + +struct _GeeAbstractCollectionClass { + GObjectClass parent_class; + gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*add) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item); + void (*clear) (GeeAbstractCollection* self); + gpointer* (*to_array) (GeeAbstractCollection* self, int* result_length1); + gboolean (*add_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeAbstractCollection* self, GeeCollection* collection); + GeeIterator* (*iterator) (GeeAbstractCollection* self); + gint (*get_size) (GeeAbstractCollection* self); + gboolean (*get_is_empty) (GeeAbstractCollection* self); + GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self); +}; + +struct _GeeMultiSetIface { + GTypeInterface parent_iface; + gint (*count) (GeeMultiSet* self, gconstpointer item); +}; + +struct _GeeMapIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeMapIterator* self); + gboolean (*has_next) (GeeMapIterator* self); + gboolean (*first) (GeeMapIterator* self); + gpointer (*get_key) (GeeMapIterator* self); + gpointer (*get_value) (GeeMapIterator* self); + void (*set_value) (GeeMapIterator* self, gconstpointer value); + void (*unset) (GeeMapIterator* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeMapIface { + GTypeInterface parent_iface; + gboolean (*has_key) (GeeMap* self, gconstpointer key); + gboolean (*contains) (GeeMap* self, gconstpointer key); + gboolean (*has) (GeeMap* self, gconstpointer key, gconstpointer value); + gpointer (*get) (GeeMap* self, gconstpointer key); + void (*set) (GeeMap* self, gconstpointer key, gconstpointer value); + gboolean (*unset) (GeeMap* self, gconstpointer key, gpointer* value); + gboolean (*remove) (GeeMap* self, gconstpointer key, gpointer* value); + void (*clear) (GeeMap* self); + GeeMapIterator* (*map_iterator) (GeeMap* self); + void (*set_all) (GeeMap* self, GeeMap* map); + gboolean (*unset_all) (GeeMap* self, GeeMap* map); + gboolean (*remove_all) (GeeMap* self, GeeMap* map); + gboolean (*has_all) (GeeMap* self, GeeMap* map); + gboolean (*contains_all) (GeeMap* self, GeeMap* map); + gint (*get_size) (GeeMap* self); + gboolean (*get_is_empty) (GeeMap* self); + GeeSet* (*get_keys) (GeeMap* self); + GeeCollection* (*get_values) (GeeMap* self); + GeeSet* (*get_entries) (GeeMap* self); + GeeMap* (*get_read_only_view) (GeeMap* self); + GType (*get_key_type) (GeeMap* self); + GType (*get_value_type) (GeeMap* self); +}; + +struct _GeeAbstractMultiSet { + GeeAbstractCollection parent_instance; + GeeAbstractMultiSetPrivate * priv; + GeeMap* _storage_map; +}; + +struct _GeeAbstractMultiSetClass { + GeeAbstractCollectionClass parent_class; +}; + +struct _GeeHashMultiSet { + GeeAbstractMultiSet parent_instance; + GeeHashMultiSetPrivate * priv; +}; + +struct _GeeHashMultiSetClass { + GeeAbstractMultiSetClass parent_class; +}; + +struct _GeeHashMultiSetPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; +}; + + +static gpointer gee_hash_multi_set_parent_class = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_multi_set_get_type (void) G_GNUC_CONST; +GType gee_abstract_multi_set_get_type (void) G_GNUC_CONST; +GType gee_map_iterator_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_map_entry_get_type (void) G_GNUC_CONST; +GType gee_map_get_type (void) G_GNUC_CONST; +GType gee_hash_multi_set_get_type (void) G_GNUC_CONST; +#define GEE_HASH_MULTI_SET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_HASH_MULTI_SET, GeeHashMultiSetPrivate)) +enum { + GEE_HASH_MULTI_SET_DUMMY_PROPERTY, + GEE_HASH_MULTI_SET_G_TYPE, + GEE_HASH_MULTI_SET_G_DUP_FUNC, + GEE_HASH_MULTI_SET_G_DESTROY_FUNC, + GEE_HASH_MULTI_SET_HASH_FUNC, + GEE_HASH_MULTI_SET_EQUAL_FUNC +}; +GeeHashMultiSet* gee_hash_multi_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func); +GeeHashMultiSet* gee_hash_multi_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func); +GeeHashMap* gee_hash_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GEqualFunc value_equal_func); +GeeHashMap* gee_hash_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GEqualFunc value_equal_func); +GType gee_abstract_map_get_type (void) G_GNUC_CONST; +GType gee_hash_map_get_type (void) G_GNUC_CONST; +GeeAbstractMultiSet* gee_abstract_multi_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeMap* storage_map); +GHashFunc gee_hash_multi_set_get_hash_func (GeeHashMultiSet* self); +GHashFunc gee_hash_map_get_key_hash_func (GeeHashMap* self); +GEqualFunc gee_hash_multi_set_get_equal_func (GeeHashMultiSet* self); +GEqualFunc gee_hash_map_get_key_equal_func (GeeHashMap* self); +static void _vala_gee_hash_multi_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_hash_multi_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +/** + * Constructs a new, empty hash multi set. + * + * If not provided, the functions parameters are requested to the + * {@link Functions} function factory methods. + * + * @param hash_func an optional element hash function + * @param equal_func an optional element equality testing function + */ +GeeHashMultiSet* gee_hash_multi_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func) { + GeeHashMultiSet * self = NULL; + GHashFunc _tmp0_; + GEqualFunc _tmp1_; + GeeHashMap* _tmp2_; + GeeHashMap* _tmp3_; + _tmp0_ = hash_func; + _tmp1_ = equal_func; + _tmp2_ = gee_hash_map_new (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, G_TYPE_INT, NULL, NULL, _tmp0_, _tmp1_, NULL); + _tmp3_ = _tmp2_; + self = (GeeHashMultiSet*) gee_abstract_multi_set_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, (GeeMap*) _tmp3_); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _g_object_unref0 (_tmp3_); + return self; +} + + +GeeHashMultiSet* gee_hash_multi_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func) { + return gee_hash_multi_set_construct (GEE_TYPE_HASH_MULTI_SET, g_type, g_dup_func, g_destroy_func, hash_func, equal_func); +} + + +GHashFunc gee_hash_multi_set_get_hash_func (GeeHashMultiSet* self) { + GHashFunc result; + GeeMap* _tmp0_; + GHashFunc _tmp1_; + GHashFunc _tmp2_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = ((GeeAbstractMultiSet*) self)->_storage_map; + _tmp1_ = gee_hash_map_get_key_hash_func (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_HASH_MAP, GeeHashMap)); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +GEqualFunc gee_hash_multi_set_get_equal_func (GeeHashMultiSet* self) { + GEqualFunc result; + GeeMap* _tmp0_; + GEqualFunc _tmp1_; + GEqualFunc _tmp2_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = ((GeeAbstractMultiSet*) self)->_storage_map; + _tmp1_ = gee_hash_map_get_key_equal_func (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_HASH_MAP, GeeHashMap)); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +static void gee_hash_multi_set_class_init (GeeHashMultiSetClass * klass) { + gee_hash_multi_set_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeHashMultiSetPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_hash_multi_set_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_hash_multi_set_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MULTI_SET_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MULTI_SET_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MULTI_SET_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MULTI_SET_HASH_FUNC, g_param_spec_pointer ("hash-func", "hash-func", "hash-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_MULTI_SET_EQUAL_FUNC, g_param_spec_pointer ("equal-func", "equal-func", "equal-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_hash_multi_set_instance_init (GeeHashMultiSet * self) { + self->priv = GEE_HASH_MULTI_SET_GET_PRIVATE (self); +} + + +/** + * Hash table implementation of the {@link MultiSet} interface. + */ +GType gee_hash_multi_set_get_type (void) { + static volatile gsize gee_hash_multi_set_type_id__volatile = 0; + if (g_once_init_enter (&gee_hash_multi_set_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeHashMultiSetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_hash_multi_set_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeHashMultiSet), 0, (GInstanceInitFunc) gee_hash_multi_set_instance_init, NULL }; + GType gee_hash_multi_set_type_id; + gee_hash_multi_set_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_MULTI_SET, "GeeHashMultiSet", &g_define_type_info, 0); + g_once_init_leave (&gee_hash_multi_set_type_id__volatile, gee_hash_multi_set_type_id); + } + return gee_hash_multi_set_type_id__volatile; +} + + +static void _vala_gee_hash_multi_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeHashMultiSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_HASH_MULTI_SET, GeeHashMultiSet); + switch (property_id) { + case GEE_HASH_MULTI_SET_HASH_FUNC: + g_value_set_pointer (value, gee_hash_multi_set_get_hash_func (self)); + break; + case GEE_HASH_MULTI_SET_EQUAL_FUNC: + g_value_set_pointer (value, gee_hash_multi_set_get_equal_func (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_hash_multi_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeHashMultiSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_HASH_MULTI_SET, GeeHashMultiSet); + switch (property_id) { + case GEE_HASH_MULTI_SET_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_HASH_MULTI_SET_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_MULTI_SET_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/gee/hashmultiset.vala b/gee/hashmultiset.vala new file mode 100644 index 0000000..596da77 --- /dev/null +++ b/gee/hashmultiset.vala @@ -0,0 +1,47 @@ +/* hashmultiset.vala + * + * Copyright (C) 2009 Ali Sabil + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Ali Sabil + */ + +/** + * Hash table implementation of the {@link MultiSet} interface. + */ +public class Gee.HashMultiSet : AbstractMultiSet { + public HashFunc hash_func { + get { return ((HashMap) _storage_map).key_hash_func; } + } + + public EqualFunc equal_func { + get { return ((HashMap) _storage_map).key_equal_func; } + } + + /** + * Constructs a new, empty hash multi set. + * + * If not provided, the functions parameters are requested to the + * {@link Functions} function factory methods. + * + * @param hash_func an optional element hash function + * @param equal_func an optional element equality testing function + */ + public HashMultiSet (HashFunc? hash_func = null, EqualFunc? equal_func = null) { + base (new HashMap (hash_func, equal_func)); + } +} diff --git a/gee/hashset.c b/gee/hashset.c new file mode 100644 index 0000000..49b431d --- /dev/null +++ b/gee/hashset.c @@ -0,0 +1,1344 @@ +/* hashset.c generated by valac 0.18.0, the Vala compiler + * generated from hashset.vala, do not modify */ + +/* hashset.vala + * + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * Copyright (C) 1997-2000 GLib Team and others + * Copyright (C) 2007-2009 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; +typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_TYPE_ABSTRACT_SET (gee_abstract_set_get_type ()) +#define GEE_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSet)) +#define GEE_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) +#define GEE_IS_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_SET)) +#define GEE_IS_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_SET)) +#define GEE_ABSTRACT_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) + +typedef struct _GeeAbstractSet GeeAbstractSet; +typedef struct _GeeAbstractSetClass GeeAbstractSetClass; +typedef struct _GeeAbstractSetPrivate GeeAbstractSetPrivate; + +#define GEE_TYPE_HASH_SET (gee_hash_set_get_type ()) +#define GEE_HASH_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_HASH_SET, GeeHashSet)) +#define GEE_HASH_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_HASH_SET, GeeHashSetClass)) +#define GEE_IS_HASH_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_HASH_SET)) +#define GEE_IS_HASH_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_HASH_SET)) +#define GEE_HASH_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_HASH_SET, GeeHashSetClass)) + +typedef struct _GeeHashSet GeeHashSet; +typedef struct _GeeHashSetClass GeeHashSetClass; +typedef struct _GeeHashSetPrivate GeeHashSetPrivate; +typedef struct _GeeHashSetNode GeeHashSetNode; + +#define GEE_HASH_SET_TYPE_ITERATOR (gee_hash_set_iterator_get_type ()) +#define GEE_HASH_SET_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_HASH_SET_TYPE_ITERATOR, GeeHashSetIterator)) +#define GEE_HASH_SET_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_HASH_SET_TYPE_ITERATOR, GeeHashSetIteratorClass)) +#define GEE_HASH_SET_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_HASH_SET_TYPE_ITERATOR)) +#define GEE_HASH_SET_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_HASH_SET_TYPE_ITERATOR)) +#define GEE_HASH_SET_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_HASH_SET_TYPE_ITERATOR, GeeHashSetIteratorClass)) + +typedef struct _GeeHashSetIterator GeeHashSetIterator; +typedef struct _GeeHashSetIteratorClass GeeHashSetIteratorClass; +#define _gee_hash_set_node_free0(var) ((var == NULL) ? NULL : (var = (gee_hash_set_node_free (var), NULL))) +typedef struct _GeeHashSetIteratorPrivate GeeHashSetIteratorPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeAbstractCollection { + GObject parent_instance; + GeeAbstractCollectionPrivate * priv; +}; + +struct _GeeAbstractCollectionClass { + GObjectClass parent_class; + gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*add) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item); + void (*clear) (GeeAbstractCollection* self); + gpointer* (*to_array) (GeeAbstractCollection* self, int* result_length1); + gboolean (*add_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeAbstractCollection* self, GeeCollection* collection); + GeeIterator* (*iterator) (GeeAbstractCollection* self); + gint (*get_size) (GeeAbstractCollection* self); + gboolean (*get_is_empty) (GeeAbstractCollection* self); + GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeAbstractSet { + GeeAbstractCollection parent_instance; + GeeAbstractSetPrivate * priv; +}; + +struct _GeeAbstractSetClass { + GeeAbstractCollectionClass parent_class; + GeeSet* (*get_read_only_view) (GeeAbstractSet* self); +}; + +struct _GeeHashSet { + GeeAbstractSet parent_instance; + GeeHashSetPrivate * priv; +}; + +struct _GeeHashSetClass { + GeeAbstractSetClass parent_class; +}; + +struct _GeeHashSetPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GHashFunc _hash_func; + GEqualFunc _equal_func; + gint _array_size; + gint _nnodes; + GeeHashSetNode** _nodes; + gint _nodes_length1; + gint __nodes_size_; + gint _stamp; +}; + +struct _GeeHashSetNode { + gpointer key; + GeeHashSetNode* next; + guint key_hash; +}; + +struct _GeeHashSetIterator { + GObject parent_instance; + GeeHashSetIteratorPrivate * priv; +}; + +struct _GeeHashSetIteratorClass { + GObjectClass parent_class; +}; + +struct _GeeHashSetIteratorPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GeeHashSet* _set; + gint _index; + GeeHashSetNode* _node; + GeeHashSetNode* _next; + gint _stamp; +}; + + +static gpointer gee_hash_set_parent_class = NULL; +static gpointer gee_hash_set_iterator_parent_class = NULL; +static GeeIteratorIface* gee_hash_set_iterator_gee_iterator_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_abstract_set_get_type (void) G_GNUC_CONST; +GType gee_hash_set_get_type (void) G_GNUC_CONST; +static void gee_hash_set_node_free (GeeHashSetNode* self); +#define GEE_HASH_SET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_HASH_SET, GeeHashSetPrivate)) +enum { + GEE_HASH_SET_DUMMY_PROPERTY, + GEE_HASH_SET_G_TYPE, + GEE_HASH_SET_G_DUP_FUNC, + GEE_HASH_SET_G_DESTROY_FUNC, + GEE_HASH_SET_SIZE, + GEE_HASH_SET_HASH_FUNC, + GEE_HASH_SET_EQUAL_FUNC +}; +void gee_abstract_collection_clear (GeeAbstractCollection* self); +#define GEE_HASH_SET_MIN_SIZE 11 +#define GEE_HASH_SET_MAX_SIZE 13845163 +GeeHashSet* gee_hash_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func); +GeeHashSet* gee_hash_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func); +GeeAbstractSet* gee_abstract_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GHashFunc gee_functions_get_hash_func_for (GType t); +GEqualFunc gee_functions_get_equal_func_for (GType t); +static void gee_hash_set_set_hash_func (GeeHashSet* self, GHashFunc value); +static void gee_hash_set_set_equal_func (GeeHashSet* self, GEqualFunc value); +static GeeHashSetNode** gee_hash_set_lookup_node (GeeHashSet* self, gconstpointer key); +GHashFunc gee_hash_set_get_hash_func (GeeHashSet* self); +GEqualFunc gee_hash_set_get_equal_func (GeeHashSet* self); +static gboolean gee_hash_set_real_contains (GeeAbstractCollection* base, gconstpointer key); +static GeeIterator* gee_hash_set_real_iterator (GeeAbstractCollection* base); +static GeeHashSetIterator* gee_hash_set_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeHashSet* set); +static GeeHashSetIterator* gee_hash_set_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeHashSet* set); +static GType gee_hash_set_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static gboolean gee_hash_set_real_add (GeeAbstractCollection* base, gconstpointer key); +static GeeHashSetNode* gee_hash_set_node_new (gpointer k, guint hash); +static GeeHashSetNode* gee_hash_set_node_new (gpointer k, guint hash); +static void gee_hash_set_resize (GeeHashSet* self); +static gboolean gee_hash_set_real_remove (GeeAbstractCollection* base, gconstpointer key); +static inline gboolean gee_hash_set_remove_helper (GeeHashSet* self, gconstpointer key); +static void gee_hash_set_real_clear (GeeAbstractCollection* base); +static void gee_hash_set_node_instance_init (GeeHashSetNode * self); +#define GEE_HASH_SET_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_HASH_SET_TYPE_ITERATOR, GeeHashSetIteratorPrivate)) +enum { + GEE_HASH_SET_ITERATOR_DUMMY_PROPERTY, + GEE_HASH_SET_ITERATOR_G_TYPE, + GEE_HASH_SET_ITERATOR_G_DUP_FUNC, + GEE_HASH_SET_ITERATOR_G_DESTROY_FUNC +}; +static gboolean gee_hash_set_iterator_real_next (GeeIterator* base); +gboolean gee_iterator_has_next (GeeIterator* self); +static gboolean gee_hash_set_iterator_real_has_next (GeeIterator* base); +static gboolean gee_hash_set_iterator_real_first (GeeIterator* base); +gint gee_abstract_collection_get_size (GeeAbstractCollection* self); +gboolean gee_iterator_next (GeeIterator* self); +static gpointer gee_hash_set_iterator_real_get (GeeIterator* base); +static void gee_hash_set_iterator_real_remove (GeeIterator* base); +static void gee_hash_set_iterator_finalize (GObject* obj); +static void _vala_gee_hash_set_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_hash_set_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void gee_hash_set_finalize (GObject* obj); +static void _vala_gee_hash_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_hash_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); + + +/** + * Constructs a new, empty hash set. + * + * If not provided, the functions parameters are requested to the + * {@link Functions} function factory methods. + * + * @param hash_func an optional hash function + * @param equal_func an optional equality testing function + */ +GeeHashSet* gee_hash_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func) { + GeeHashSet * self = NULL; + GHashFunc _tmp0_; + GEqualFunc _tmp2_; + GHashFunc _tmp4_; + GEqualFunc _tmp5_; + gint _tmp6_; + GeeHashSetNode** _tmp7_ = NULL; + self = (GeeHashSet*) gee_abstract_set_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = hash_func; + if (_tmp0_ == NULL) { + GHashFunc _tmp1_ = NULL; + _tmp1_ = gee_functions_get_hash_func_for (g_type); + hash_func = _tmp1_; + } + _tmp2_ = equal_func; + if (_tmp2_ == NULL) { + GEqualFunc _tmp3_ = NULL; + _tmp3_ = gee_functions_get_equal_func_for (g_type); + equal_func = _tmp3_; + } + _tmp4_ = hash_func; + gee_hash_set_set_hash_func (self, _tmp4_); + _tmp5_ = equal_func; + gee_hash_set_set_equal_func (self, _tmp5_); + self->priv->_array_size = GEE_HASH_SET_MIN_SIZE; + _tmp6_ = self->priv->_array_size; + _tmp7_ = g_new0 (GeeHashSetNode*, _tmp6_ + 1); + self->priv->_nodes = (_vala_array_free (self->priv->_nodes, self->priv->_nodes_length1, (GDestroyNotify) gee_hash_set_node_free), NULL); + self->priv->_nodes = _tmp7_; + self->priv->_nodes_length1 = _tmp6_; + self->priv->__nodes_size_ = self->priv->_nodes_length1; + return self; +} + + +GeeHashSet* gee_hash_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func) { + return gee_hash_set_construct (GEE_TYPE_HASH_SET, g_type, g_dup_func, g_destroy_func, hash_func, equal_func); +} + + +static GeeHashSetNode** gee_hash_set_lookup_node (GeeHashSet* self, gconstpointer key) { + GeeHashSetNode** result = NULL; + GHashFunc _tmp0_; + GHashFunc _tmp1_; + gconstpointer _tmp2_; + guint _tmp3_ = 0U; + guint hash_value; + GeeHashSetNode** _tmp4_; + gint _tmp4__length1; + guint _tmp5_; + gint _tmp6_; + GeeHashSetNode** node; + GeeHashSetNode** _tmp22_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = gee_hash_set_get_hash_func (self); + _tmp1_ = _tmp0_; + _tmp2_ = key; + _tmp3_ = _tmp1_ (_tmp2_); + hash_value = _tmp3_; + _tmp4_ = self->priv->_nodes; + _tmp4__length1 = self->priv->_nodes_length1; + _tmp5_ = hash_value; + _tmp6_ = self->priv->_array_size; + node = &_tmp4_[_tmp5_ % _tmp6_]; + while (TRUE) { + gboolean _tmp7_ = FALSE; + GeeHashSetNode** _tmp8_; + gboolean _tmp20_; + GeeHashSetNode** _tmp21_; + _tmp8_ = node; + if ((*_tmp8_) != NULL) { + gboolean _tmp9_ = FALSE; + guint _tmp10_; + GeeHashSetNode** _tmp11_; + guint _tmp12_; + gboolean _tmp19_; + _tmp10_ = hash_value; + _tmp11_ = node; + _tmp12_ = (*_tmp11_)->key_hash; + if (_tmp10_ != _tmp12_) { + _tmp9_ = TRUE; + } else { + GEqualFunc _tmp13_; + GEqualFunc _tmp14_; + GeeHashSetNode** _tmp15_; + gconstpointer _tmp16_; + gconstpointer _tmp17_; + gboolean _tmp18_ = FALSE; + _tmp13_ = gee_hash_set_get_equal_func (self); + _tmp14_ = _tmp13_; + _tmp15_ = node; + _tmp16_ = (*_tmp15_)->key; + _tmp17_ = key; + _tmp18_ = _tmp14_ (_tmp16_, _tmp17_); + _tmp9_ = !_tmp18_; + } + _tmp19_ = _tmp9_; + _tmp7_ = _tmp19_; + } else { + _tmp7_ = FALSE; + } + _tmp20_ = _tmp7_; + if (!_tmp20_) { + break; + } + _tmp21_ = node; + node = &(*_tmp21_)->next; + } + _tmp22_ = node; + result = _tmp22_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_hash_set_real_contains (GeeAbstractCollection* base, gconstpointer key) { + GeeHashSet * self; + gboolean result = FALSE; + gconstpointer _tmp0_; + GeeHashSetNode** _tmp1_ = NULL; + GeeHashSetNode** node; + self = (GeeHashSet*) base; + _tmp0_ = key; + _tmp1_ = gee_hash_set_lookup_node (self, _tmp0_); + node = _tmp1_; + result = (*node) != NULL; + return result; +} + + +/** + * {@inheritDoc} + */ +static GeeIterator* gee_hash_set_real_iterator (GeeAbstractCollection* base) { + GeeHashSet * self; + GeeIterator* result = NULL; + GeeHashSetIterator* _tmp0_; + self = (GeeHashSet*) base; + _tmp0_ = gee_hash_set_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, self); + result = (GeeIterator*) _tmp0_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_hash_set_real_add (GeeAbstractCollection* base, gconstpointer key) { + GeeHashSet * self; + gboolean result = FALSE; + gconstpointer _tmp0_; + GeeHashSetNode** _tmp1_ = NULL; + GeeHashSetNode** node; + GeeHashSetNode** _tmp2_; + self = (GeeHashSet*) base; + _tmp0_ = key; + _tmp1_ = gee_hash_set_lookup_node (self, _tmp0_); + node = _tmp1_; + _tmp2_ = node; + if ((*_tmp2_) != NULL) { + result = FALSE; + return result; + } else { + GHashFunc _tmp3_; + GHashFunc _tmp4_; + gconstpointer _tmp5_; + guint _tmp6_ = 0U; + guint hash_value; + GeeHashSetNode** _tmp7_; + gconstpointer _tmp8_; + gpointer _tmp9_; + guint _tmp10_; + GeeHashSetNode* _tmp11_; + GeeHashSetNode* _tmp12_; + gint _tmp13_; + gint _tmp14_; + _tmp3_ = gee_hash_set_get_hash_func (self); + _tmp4_ = _tmp3_; + _tmp5_ = key; + _tmp6_ = _tmp4_ (_tmp5_); + hash_value = _tmp6_; + _tmp7_ = node; + _tmp8_ = key; + _tmp9_ = ((_tmp8_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp8_) : ((gpointer) _tmp8_); + _tmp10_ = hash_value; + _tmp11_ = gee_hash_set_node_new (_tmp9_, _tmp10_); + *_tmp7_ = _tmp11_; + _tmp12_ = *_tmp7_; + _tmp13_ = self->priv->_nnodes; + self->priv->_nnodes = _tmp13_ + 1; + gee_hash_set_resize (self); + _tmp14_ = self->priv->_stamp; + self->priv->_stamp = _tmp14_ + 1; + result = TRUE; + return result; + } +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_hash_set_real_remove (GeeAbstractCollection* base, gconstpointer key) { + GeeHashSet * self; + gboolean result = FALSE; + gconstpointer _tmp0_; + gboolean _tmp1_ = FALSE; + gboolean b; + gboolean _tmp2_; + self = (GeeHashSet*) base; + _tmp0_ = key; + _tmp1_ = gee_hash_set_remove_helper (self, _tmp0_); + b = _tmp1_; + _tmp2_ = b; + if (_tmp2_) { + gee_hash_set_resize (self); + } + result = b; + return result; +} + + +/** + * {@inheritDoc} + */ +static void gee_hash_set_real_clear (GeeAbstractCollection* base) { + GeeHashSet * self; + self = (GeeHashSet*) base; + { + gint i; + i = 0; + { + gboolean _tmp0_; + _tmp0_ = TRUE; + while (TRUE) { + gboolean _tmp1_; + gint _tmp3_; + gint _tmp4_; + GeeHashSetNode** _tmp5_; + gint _tmp5__length1; + gint _tmp6_; + GeeHashSetNode* _tmp7_; + GeeHashSetNode* node; + _tmp1_ = _tmp0_; + if (!_tmp1_) { + gint _tmp2_; + _tmp2_ = i; + i = _tmp2_ + 1; + } + _tmp0_ = FALSE; + _tmp3_ = i; + _tmp4_ = self->priv->_array_size; + if (!(_tmp3_ < _tmp4_)) { + break; + } + _tmp5_ = self->priv->_nodes; + _tmp5__length1 = self->priv->_nodes_length1; + _tmp6_ = i; + _tmp7_ = _tmp5_[_tmp6_]; + _tmp5_[_tmp6_] = NULL; + node = _tmp7_; + while (TRUE) { + GeeHashSetNode* _tmp8_; + GeeHashSetNode* _tmp9_; + GeeHashSetNode* _tmp10_; + GeeHashSetNode* next; + GeeHashSetNode* _tmp11_; + GeeHashSetNode* _tmp12_; + _tmp8_ = node; + if (!(_tmp8_ != NULL)) { + break; + } + _tmp9_ = node; + _tmp10_ = _tmp9_->next; + _tmp9_->next = NULL; + next = _tmp10_; + _tmp11_ = node; + ((_tmp11_->key == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp11_->key = (self->priv->g_destroy_func (_tmp11_->key), NULL)); + _tmp11_->key = NULL; + _tmp12_ = next; + next = NULL; + _gee_hash_set_node_free0 (node); + node = _tmp12_; + _gee_hash_set_node_free0 (next); + } + _gee_hash_set_node_free0 (node); + } + } + } + self->priv->_nnodes = 0; + gee_hash_set_resize (self); +} + + +static inline gboolean gee_hash_set_remove_helper (GeeHashSet* self, gconstpointer key) { + gboolean result = FALSE; + gconstpointer _tmp0_; + GeeHashSetNode** _tmp1_ = NULL; + GeeHashSetNode** node; + GeeHashSetNode** _tmp2_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = key; + _tmp1_ = gee_hash_set_lookup_node (self, _tmp0_); + node = _tmp1_; + _tmp2_ = node; + if ((*_tmp2_) != NULL) { + GeeHashSetNode** _tmp3_; + GeeHashSetNode** _tmp4_; + GeeHashSetNode* _tmp5_; + GeeHashSetNode* next; + GeeHashSetNode** _tmp6_; + GeeHashSetNode** _tmp7_; + GeeHashSetNode** _tmp8_; + GeeHashSetNode* _tmp9_; + GeeHashSetNode* _tmp10_; + gint _tmp11_; + gint _tmp12_; + _tmp3_ = node; + _vala_assert ((*_tmp3_) != NULL, "*node != null"); + _tmp4_ = node; + _tmp5_ = (*_tmp4_)->next; + (*_tmp4_)->next = NULL; + next = _tmp5_; + _tmp6_ = node; + (((*_tmp6_)->key == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : ((*_tmp6_)->key = (self->priv->g_destroy_func ((*_tmp6_)->key), NULL)); + (*_tmp6_)->key = NULL; + _tmp7_ = node; + gee_hash_set_node_free (*_tmp7_); + _tmp8_ = node; + _tmp9_ = next; + next = NULL; + *_tmp8_ = _tmp9_; + _tmp10_ = *_tmp8_; + _tmp11_ = self->priv->_nnodes; + self->priv->_nnodes = _tmp11_ - 1; + _tmp12_ = self->priv->_stamp; + self->priv->_stamp = _tmp12_ + 1; + result = TRUE; + _gee_hash_set_node_free0 (next); + return result; + } + result = FALSE; + return result; +} + + +static void gee_hash_set_resize (GeeHashSet* self) { + gboolean _tmp0_ = FALSE; + gboolean _tmp1_ = FALSE; + gint _tmp2_; + gint _tmp3_; + gboolean _tmp5_; + gboolean _tmp11_; + g_return_if_fail (self != NULL); + _tmp2_ = self->priv->_array_size; + _tmp3_ = self->priv->_nnodes; + if (_tmp2_ >= (3 * _tmp3_)) { + gint _tmp4_; + _tmp4_ = self->priv->_array_size; + _tmp1_ = _tmp4_ >= GEE_HASH_SET_MIN_SIZE; + } else { + _tmp1_ = FALSE; + } + _tmp5_ = _tmp1_; + if (_tmp5_) { + _tmp0_ = TRUE; + } else { + gboolean _tmp6_ = FALSE; + gint _tmp7_; + gint _tmp8_; + gboolean _tmp10_; + _tmp7_ = self->priv->_array_size; + _tmp8_ = self->priv->_nnodes; + if ((3 * _tmp7_) <= _tmp8_) { + gint _tmp9_; + _tmp9_ = self->priv->_array_size; + _tmp6_ = _tmp9_ < GEE_HASH_SET_MAX_SIZE; + } else { + _tmp6_ = FALSE; + } + _tmp10_ = _tmp6_; + _tmp0_ = _tmp10_; + } + _tmp11_ = _tmp0_; + if (_tmp11_) { + gint _tmp12_; + guint _tmp13_ = 0U; + gint new_array_size; + gint _tmp14_; + gint _tmp15_ = 0; + gint _tmp16_; + GeeHashSetNode** _tmp17_ = NULL; + GeeHashSetNode** new_nodes; + gint new_nodes_length1; + gint _new_nodes_size_; + GeeHashSetNode** _tmp43_; + gint _tmp43__length1; + gint _tmp44_; + _tmp12_ = self->priv->_nnodes; + _tmp13_ = g_spaced_primes_closest ((guint) _tmp12_); + new_array_size = (gint) _tmp13_; + _tmp14_ = new_array_size; + _tmp15_ = CLAMP (_tmp14_, GEE_HASH_SET_MIN_SIZE, GEE_HASH_SET_MAX_SIZE); + new_array_size = _tmp15_; + _tmp16_ = new_array_size; + _tmp17_ = g_new0 (GeeHashSetNode*, _tmp16_ + 1); + new_nodes = _tmp17_; + new_nodes_length1 = _tmp16_; + _new_nodes_size_ = new_nodes_length1; + { + gint i; + i = 0; + { + gboolean _tmp18_; + _tmp18_ = TRUE; + while (TRUE) { + gboolean _tmp19_; + gint _tmp21_; + gint _tmp22_; + GeeHashSetNode* node = NULL; + GeeHashSetNode* next; + _tmp19_ = _tmp18_; + if (!_tmp19_) { + gint _tmp20_; + _tmp20_ = i; + i = _tmp20_ + 1; + } + _tmp18_ = FALSE; + _tmp21_ = i; + _tmp22_ = self->priv->_array_size; + if (!(_tmp21_ < _tmp22_)) { + break; + } + next = NULL; + { + GeeHashSetNode** _tmp23_; + gint _tmp23__length1; + gint _tmp24_; + GeeHashSetNode* _tmp25_; + gboolean _tmp26_; + _tmp23_ = self->priv->_nodes; + _tmp23__length1 = self->priv->_nodes_length1; + _tmp24_ = i; + _tmp25_ = _tmp23_[_tmp24_]; + _tmp23_[_tmp24_] = NULL; + _gee_hash_set_node_free0 (node); + node = _tmp25_; + _tmp26_ = TRUE; + while (TRUE) { + gboolean _tmp27_; + GeeHashSetNode* _tmp29_; + GeeHashSetNode* _tmp30_; + GeeHashSetNode* _tmp31_; + GeeHashSetNode* _tmp32_; + guint _tmp33_; + gint _tmp34_; + guint hash_val; + GeeHashSetNode* _tmp35_; + GeeHashSetNode** _tmp36_; + gint _tmp36__length1; + guint _tmp37_; + GeeHashSetNode* _tmp38_; + GeeHashSetNode** _tmp39_; + gint _tmp39__length1; + guint _tmp40_; + GeeHashSetNode* _tmp41_; + GeeHashSetNode* _tmp42_; + _tmp27_ = _tmp26_; + if (!_tmp27_) { + GeeHashSetNode* _tmp28_; + _tmp28_ = next; + next = NULL; + _gee_hash_set_node_free0 (node); + node = _tmp28_; + } + _tmp26_ = FALSE; + _tmp29_ = node; + if (!(_tmp29_ != NULL)) { + break; + } + _tmp30_ = node; + _tmp31_ = _tmp30_->next; + _tmp30_->next = NULL; + _gee_hash_set_node_free0 (next); + next = _tmp31_; + _tmp32_ = node; + _tmp33_ = _tmp32_->key_hash; + _tmp34_ = new_array_size; + hash_val = _tmp33_ % _tmp34_; + _tmp35_ = node; + _tmp36_ = new_nodes; + _tmp36__length1 = new_nodes_length1; + _tmp37_ = hash_val; + _tmp38_ = _tmp36_[_tmp37_]; + _tmp36_[_tmp37_] = NULL; + _gee_hash_set_node_free0 (_tmp35_->next); + _tmp35_->next = _tmp38_; + _tmp39_ = new_nodes; + _tmp39__length1 = new_nodes_length1; + _tmp40_ = hash_val; + _tmp41_ = node; + node = NULL; + _gee_hash_set_node_free0 (_tmp39_[_tmp40_]); + _tmp39_[_tmp40_] = _tmp41_; + _tmp42_ = _tmp39_[_tmp40_]; + } + } + _gee_hash_set_node_free0 (next); + _gee_hash_set_node_free0 (node); + } + } + } + _tmp43_ = new_nodes; + _tmp43__length1 = new_nodes_length1; + new_nodes = NULL; + self->priv->_nodes = (_vala_array_free (self->priv->_nodes, self->priv->_nodes_length1, (GDestroyNotify) gee_hash_set_node_free), NULL); + self->priv->_nodes = _tmp43_; + self->priv->_nodes_length1 = _tmp43__length1; + self->priv->__nodes_size_ = self->priv->_nodes_length1; + _tmp44_ = new_array_size; + self->priv->_array_size = _tmp44_; + new_nodes = (_vala_array_free (new_nodes, new_nodes_length1, (GDestroyNotify) gee_hash_set_node_free), NULL); + } +} + + +static gint gee_hash_set_real_get_size (GeeAbstractCollection* base) { + gint result; + GeeHashSet* self; + gint _tmp0_; + self = (GeeHashSet*) base; + _tmp0_ = self->priv->_nnodes; + result = _tmp0_; + return result; +} + + +GHashFunc gee_hash_set_get_hash_func (GeeHashSet* self) { + GHashFunc result; + GHashFunc _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->_hash_func; + result = _tmp0_; + return result; +} + + +static void gee_hash_set_set_hash_func (GeeHashSet* self, GHashFunc value) { + GHashFunc _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = value; + self->priv->_hash_func = _tmp0_; + g_object_notify ((GObject *) self, "hash-func"); +} + + +GEqualFunc gee_hash_set_get_equal_func (GeeHashSet* self) { + GEqualFunc result; + GEqualFunc _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->_equal_func; + result = _tmp0_; + return result; +} + + +static void gee_hash_set_set_equal_func (GeeHashSet* self, GEqualFunc value) { + GEqualFunc _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = value; + self->priv->_equal_func = _tmp0_; + g_object_notify ((GObject *) self, "equal-func"); +} + + +static GeeHashSetNode* gee_hash_set_node_new (gpointer k, guint hash) { + GeeHashSetNode* self; + gpointer _tmp0_; + guint _tmp1_; + self = g_slice_new0 (GeeHashSetNode); + gee_hash_set_node_instance_init (self); + _tmp0_ = k; + k = NULL; + self->key = _tmp0_; + _tmp1_ = hash; + self->key_hash = _tmp1_; + return self; +} + + +static void gee_hash_set_node_instance_init (GeeHashSetNode * self) { +} + + +static void gee_hash_set_node_free (GeeHashSetNode* self) { + _gee_hash_set_node_free0 (self->next); + g_slice_free (GeeHashSetNode, self); +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static GeeHashSetIterator* gee_hash_set_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeHashSet* set) { + GeeHashSetIterator * self = NULL; + GeeHashSet* _tmp0_; + GeeHashSet* _tmp1_; + GeeHashSet* _tmp2_; + gint _tmp3_; + g_return_val_if_fail (set != NULL, NULL); + self = (GeeHashSetIterator*) g_object_new (object_type, NULL); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = set; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->_set); + self->priv->_set = _tmp1_; + _tmp2_ = self->priv->_set; + _tmp3_ = _tmp2_->priv->_stamp; + self->priv->_stamp = _tmp3_; + return self; +} + + +static GeeHashSetIterator* gee_hash_set_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeHashSet* set) { + return gee_hash_set_iterator_construct (GEE_HASH_SET_TYPE_ITERATOR, g_type, g_dup_func, g_destroy_func, set); +} + + +static gboolean gee_hash_set_iterator_real_next (GeeIterator* base) { + GeeHashSetIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeHashSet* _tmp1_; + gint _tmp2_; + gboolean _tmp3_ = FALSE; + GeeHashSetNode* _tmp4_; + GeeHashSetNode* _tmp5_; + self = (GeeHashSetIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_set; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _set._stamp"); + _tmp3_ = gee_iterator_has_next ((GeeIterator*) self); + if (!_tmp3_) { + result = FALSE; + return result; + } + _tmp4_ = self->priv->_next; + self->priv->_node = _tmp4_; + self->priv->_next = NULL; + _tmp5_ = self->priv->_node; + result = _tmp5_ != NULL; + return result; +} + + +static gboolean gee_hash_set_iterator_real_has_next (GeeIterator* base) { + GeeHashSetIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeHashSet* _tmp1_; + gint _tmp2_; + GeeHashSetNode* _tmp3_; + GeeHashSetNode* _tmp19_; + self = (GeeHashSetIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_set; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _set._stamp"); + _tmp3_ = self->priv->_next; + if (_tmp3_ == NULL) { + GeeHashSetNode* _tmp4_; + GeeHashSetNode* _tmp5_; + _tmp4_ = self->priv->_node; + self->priv->_next = _tmp4_; + _tmp5_ = self->priv->_next; + if (_tmp5_ != NULL) { + GeeHashSetNode* _tmp6_; + GeeHashSetNode* _tmp7_; + _tmp6_ = self->priv->_next; + _tmp7_ = _tmp6_->next; + self->priv->_next = _tmp7_; + } + while (TRUE) { + gboolean _tmp8_ = FALSE; + GeeHashSetNode* _tmp9_; + gboolean _tmp13_; + gint _tmp14_; + GeeHashSet* _tmp15_; + GeeHashSetNode** _tmp16_; + gint _tmp16__length1; + gint _tmp17_; + GeeHashSetNode* _tmp18_; + _tmp9_ = self->priv->_next; + if (_tmp9_ == NULL) { + gint _tmp10_; + GeeHashSet* _tmp11_; + gint _tmp12_; + _tmp10_ = self->priv->_index; + _tmp11_ = self->priv->_set; + _tmp12_ = _tmp11_->priv->_array_size; + _tmp8_ = (_tmp10_ + 1) < _tmp12_; + } else { + _tmp8_ = FALSE; + } + _tmp13_ = _tmp8_; + if (!_tmp13_) { + break; + } + _tmp14_ = self->priv->_index; + self->priv->_index = _tmp14_ + 1; + _tmp15_ = self->priv->_set; + _tmp16_ = _tmp15_->priv->_nodes; + _tmp16__length1 = _tmp15_->priv->_nodes_length1; + _tmp17_ = self->priv->_index; + _tmp18_ = _tmp16_[_tmp17_]; + self->priv->_next = _tmp18_; + } + } + _tmp19_ = self->priv->_next; + result = _tmp19_ != NULL; + return result; +} + + +static gboolean gee_hash_set_iterator_real_first (GeeIterator* base) { + GeeHashSetIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeHashSet* _tmp1_; + gint _tmp2_; + GeeHashSet* _tmp3_; + gint _tmp4_; + gint _tmp5_; + gboolean _tmp6_ = FALSE; + self = (GeeHashSetIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_set; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _set._stamp"); + _tmp3_ = self->priv->_set; + _tmp4_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp3_); + _tmp5_ = _tmp4_; + if (_tmp5_ == 0) { + result = FALSE; + return result; + } + self->priv->_index = -1; + self->priv->_next = NULL; + _tmp6_ = gee_iterator_next ((GeeIterator*) self); + result = _tmp6_; + return result; +} + + +static gpointer gee_hash_set_iterator_real_get (GeeIterator* base) { + GeeHashSetIterator * self; + gpointer result = NULL; + gint _tmp0_; + GeeHashSet* _tmp1_; + gint _tmp2_; + GeeHashSetNode* _tmp3_; + GeeHashSetNode* _tmp4_; + gconstpointer _tmp5_; + gpointer _tmp6_; + self = (GeeHashSetIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_set; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _set._stamp"); + _tmp3_ = self->priv->_node; + _vala_assert (_tmp3_ != NULL, "_node != null"); + _tmp4_ = self->priv->_node; + _tmp5_ = _tmp4_->key; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + result = _tmp6_; + return result; +} + + +static void gee_hash_set_iterator_real_remove (GeeIterator* base) { + GeeHashSetIterator * self; + gint _tmp0_; + GeeHashSet* _tmp1_; + gint _tmp2_; + GeeHashSetNode* _tmp3_; + GeeHashSet* _tmp4_; + GeeHashSetNode* _tmp5_; + gconstpointer _tmp6_; + GeeHashSet* _tmp7_; + gint _tmp8_; + self = (GeeHashSetIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_set; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "_stamp == _set._stamp"); + _tmp3_ = self->priv->_node; + _vala_assert (_tmp3_ != NULL, "_node != null"); + gee_iterator_has_next ((GeeIterator*) self); + _tmp4_ = self->priv->_set; + _tmp5_ = self->priv->_node; + _tmp6_ = _tmp5_->key; + gee_hash_set_remove_helper (_tmp4_, _tmp6_); + self->priv->_node = NULL; + _tmp7_ = self->priv->_set; + _tmp8_ = _tmp7_->priv->_stamp; + self->priv->_stamp = _tmp8_; +} + + +static void gee_hash_set_iterator_class_init (GeeHashSetIteratorClass * klass) { + gee_hash_set_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeHashSetIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_hash_set_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_hash_set_iterator_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_hash_set_iterator_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_SET_ITERATOR_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_SET_ITERATOR_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_SET_ITERATOR_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_hash_set_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) { + gee_hash_set_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->next = (gboolean (*)(GeeIterator*)) gee_hash_set_iterator_real_next; + iface->has_next = (gboolean (*)(GeeIterator*)) gee_hash_set_iterator_real_has_next; + iface->first = (gboolean (*)(GeeIterator*)) gee_hash_set_iterator_real_first; + iface->get = (gpointer (*)(GeeIterator*)) gee_hash_set_iterator_real_get; + iface->remove = (void (*)(GeeIterator*)) gee_hash_set_iterator_real_remove; +} + + +static void gee_hash_set_iterator_instance_init (GeeHashSetIterator * self) { + self->priv = GEE_HASH_SET_ITERATOR_GET_PRIVATE (self); + self->priv->_index = -1; + self->priv->_stamp = 0; +} + + +static void gee_hash_set_iterator_finalize (GObject* obj) { + GeeHashSetIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_HASH_SET_TYPE_ITERATOR, GeeHashSetIterator); + _g_object_unref0 (self->priv->_set); + G_OBJECT_CLASS (gee_hash_set_iterator_parent_class)->finalize (obj); +} + + +static GType gee_hash_set_iterator_get_type (void) { + static volatile gsize gee_hash_set_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_hash_set_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeHashSetIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_hash_set_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeHashSetIterator), 0, (GInstanceInitFunc) gee_hash_set_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_hash_set_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_hash_set_iterator_type_id; + gee_hash_set_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeHashSetIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_hash_set_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info); + g_once_init_leave (&gee_hash_set_iterator_type_id__volatile, gee_hash_set_iterator_type_id); + } + return gee_hash_set_iterator_type_id__volatile; +} + + +static void _vala_gee_hash_set_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeHashSetIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_SET_TYPE_ITERATOR, GeeHashSetIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_hash_set_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeHashSetIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_HASH_SET_TYPE_ITERATOR, GeeHashSetIterator); + switch (property_id) { + case GEE_HASH_SET_ITERATOR_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_HASH_SET_ITERATOR_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_SET_ITERATOR_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void gee_hash_set_class_init (GeeHashSetClass * klass) { + gee_hash_set_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeHashSetPrivate)); + GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains = gee_hash_set_real_contains; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->iterator = gee_hash_set_real_iterator; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add = gee_hash_set_real_add; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove = gee_hash_set_real_remove; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->clear = gee_hash_set_real_clear; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_size = gee_hash_set_real_get_size; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_hash_set_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_hash_set_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_hash_set_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_SET_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_SET_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_SET_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_SET_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The elements' hash function. + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_SET_HASH_FUNC, g_param_spec_pointer ("hash-func", "hash-func", "hash-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The elements' equality testing function. + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_HASH_SET_EQUAL_FUNC, g_param_spec_pointer ("equal-func", "equal-func", "equal-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_hash_set_instance_init (GeeHashSet * self) { + self->priv = GEE_HASH_SET_GET_PRIVATE (self); + self->priv->_stamp = 0; +} + + +static void gee_hash_set_finalize (GObject* obj) { + GeeHashSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_HASH_SET, GeeHashSet); + gee_abstract_collection_clear ((GeeAbstractCollection*) self); + self->priv->_nodes = (_vala_array_free (self->priv->_nodes, self->priv->_nodes_length1, (GDestroyNotify) gee_hash_set_node_free), NULL); + G_OBJECT_CLASS (gee_hash_set_parent_class)->finalize (obj); +} + + +/** + * Hash table implementation of the {@link Set} interface. + * + * This implementation is better fit for highly heterogenous values. + * In case of high value hashes redundancy or higher amount of data prefer using + * tree implementation like {@link TreeSet}. + * + * @see TreeSet + */ +GType gee_hash_set_get_type (void) { + static volatile gsize gee_hash_set_type_id__volatile = 0; + if (g_once_init_enter (&gee_hash_set_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeHashSetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_hash_set_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeHashSet), 0, (GInstanceInitFunc) gee_hash_set_instance_init, NULL }; + GType gee_hash_set_type_id; + gee_hash_set_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_SET, "GeeHashSet", &g_define_type_info, 0); + g_once_init_leave (&gee_hash_set_type_id__volatile, gee_hash_set_type_id); + } + return gee_hash_set_type_id__volatile; +} + + +static void _vala_gee_hash_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeHashSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_HASH_SET, GeeHashSet); + switch (property_id) { + case GEE_HASH_SET_SIZE: + g_value_set_int (value, gee_abstract_collection_get_size ((GeeAbstractCollection*) self)); + break; + case GEE_HASH_SET_HASH_FUNC: + g_value_set_pointer (value, gee_hash_set_get_hash_func (self)); + break; + case GEE_HASH_SET_EQUAL_FUNC: + g_value_set_pointer (value, gee_hash_set_get_equal_func (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_hash_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeHashSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_HASH_SET, GeeHashSet); + switch (property_id) { + case GEE_HASH_SET_HASH_FUNC: + gee_hash_set_set_hash_func (self, g_value_get_pointer (value)); + break; + case GEE_HASH_SET_EQUAL_FUNC: + gee_hash_set_set_equal_func (self, g_value_get_pointer (value)); + break; + case GEE_HASH_SET_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_HASH_SET_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_HASH_SET_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + + diff --git a/gee/hashset.vala b/gee/hashset.vala new file mode 100644 index 0000000..2d83511 --- /dev/null +++ b/gee/hashset.vala @@ -0,0 +1,276 @@ +/* hashset.vala + * + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * Copyright (C) 1997-2000 GLib Team and others + * Copyright (C) 2007-2009 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +using GLib; + +/** + * Hash table implementation of the {@link Set} interface. + * + * This implementation is better fit for highly heterogenous values. + * In case of high value hashes redundancy or higher amount of data prefer using + * tree implementation like {@link TreeSet}. + * + * @see TreeSet + */ +public class Gee.HashSet : AbstractSet { + /** + * {@inheritDoc} + */ + public override int size { + get { return _nnodes; } + } + + /** + * The elements' hash function. + */ + public HashFunc hash_func { private set; get; } + + /** + * The elements' equality testing function. + */ + public EqualFunc equal_func { private set; get; } + + private int _array_size; + private int _nnodes; + private Node[] _nodes; + + // concurrent modification protection + private int _stamp = 0; + + private const int MIN_SIZE = 11; + private const int MAX_SIZE = 13845163; + + /** + * Constructs a new, empty hash set. + * + * If not provided, the functions parameters are requested to the + * {@link Functions} function factory methods. + * + * @param hash_func an optional hash function + * @param equal_func an optional equality testing function + */ + public HashSet (HashFunc? hash_func = null, EqualFunc? equal_func = null) { + if (hash_func == null) { + hash_func = Functions.get_hash_func_for (typeof (G)); + } + if (equal_func == null) { + equal_func = Functions.get_equal_func_for (typeof (G)); + } + this.hash_func = hash_func; + this.equal_func = equal_func; + _array_size = MIN_SIZE; + _nodes = new Node[_array_size]; + } + + private Node** lookup_node (G key) { + uint hash_value = hash_func (key); + Node** node = &_nodes[hash_value % _array_size]; + while ((*node) != null && (hash_value != (*node)->key_hash || !equal_func ((*node)->key, key))) { + node = &((*node)->next); + } + return node; + } + + /** + * {@inheritDoc} + */ + public override bool contains (G key) { + Node** node = lookup_node (key); + return (*node != null); + } + + /** + * {@inheritDoc} + */ + public override Gee.Iterator iterator () { + return new Iterator (this); + } + + /** + * {@inheritDoc} + */ + public override bool add (G key) { + Node** node = lookup_node (key); + if (*node != null) { + return false; + } else { + uint hash_value = hash_func (key); + *node = new Node (key, hash_value); + _nnodes++; + resize (); + _stamp++; + return true; + } + } + + /** + * {@inheritDoc} + */ + public override bool remove (G key) { + bool b = remove_helper(key); + if(b) { + resize (); + } + return b; + } + + /** + * {@inheritDoc} + */ + public override void clear () { + for (int i = 0; i < _array_size; i++) { + Node node = (owned) _nodes[i]; + while (node != null) { + Node next = (owned) node.next; + node.key = null; + node = (owned) next; + } + } + _nnodes = 0; + resize (); + } + + private inline bool remove_helper (G key) { + Node** node = lookup_node (key); + if (*node != null) { + assert (*node != null); + Node next = (owned) (*node)->next; + + (*node)->key = null; + delete *node; + + *node = (owned) next; + + _nnodes--; + _stamp++; + return true; + } + return false; + } + + private void resize () { + if ((_array_size >= 3 * _nnodes && _array_size >= MIN_SIZE) || + (3 * _array_size <= _nnodes && _array_size < MAX_SIZE)) { + int new_array_size = (int) SpacedPrimes.closest (_nnodes); + new_array_size = new_array_size.clamp (MIN_SIZE, MAX_SIZE); + + Node[] new_nodes = new Node[new_array_size]; + + for (int i = 0; i < _array_size; i++) { + Node node; + Node next = null; + for (node = (owned) _nodes[i]; node != null; node = (owned) next) { + next = (owned) node.next; + uint hash_val = node.key_hash % new_array_size; + node.next = (owned) new_nodes[hash_val]; + new_nodes[hash_val] = (owned) node; + } + } + _nodes = (owned) new_nodes; + _array_size = new_array_size; + } + } + + ~HashSet () { + clear (); + } + + [Compact] + private class Node { + public G key; + public Node next; + public uint key_hash; + + public Node (owned G k, uint hash) { + key = (owned) k; + key_hash = hash; + } + } + + private class Iterator : Object, Gee.Iterator { + private HashSet _set; + private int _index = -1; + private weak Node _node; + private weak Node _next; + + // concurrent modification protection + private int _stamp = 0; + + public Iterator (HashSet set) { + _set = set; + _stamp = _set._stamp; + } + + public bool next () { + assert (_stamp == _set._stamp); + if (!has_next ()) { + return false; + } + _node = _next; + _next = null; + return (_node != null); + } + + public bool has_next () { + assert (_stamp == _set._stamp); + if (_next == null) { + _next = _node; + if (_next != null) { + _next = _next.next; + } + while (_next == null && _index + 1 < _set._array_size) { + _index++; + _next = _set._nodes[_index]; + } + } + return (_next != null); + } + + public bool first () { + assert (_stamp == _set._stamp); + if (_set.size == 0) { + return false; + } + _index = -1; + _next = null; + return next (); + } + + public new G get () { + assert (_stamp == _set._stamp); + assert (_node != null); + return _node.key; + } + + public void remove () { + assert (_stamp == _set._stamp); + assert (_node != null); + has_next (); + _set.remove_helper (_node.key); + _node = null; + _stamp = _set._stamp; + } + } +} + diff --git a/gee/iterable.c b/gee/iterable.c new file mode 100644 index 0000000..cc60bfe --- /dev/null +++ b/gee/iterable.c @@ -0,0 +1,116 @@ +/* iterable.c generated by valac 0.18.0, the Vala compiler + * generated from iterable.vala, do not modify */ + +/* iterable.vala + * + * Copyright (C) 2007-2008 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + + + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GeeIterator* gee_iterable_iterator (GeeIterable* self); +GType gee_iterable_get_element_type (GeeIterable* self); + + +/** + * Returns a {@link Iterator} that can be used for simple iteration over a + * collection. + * + * @return a {@link Iterator} that can be used for simple iteration over a + * collection + */ +GeeIterator* gee_iterable_iterator (GeeIterable* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ITERABLE_GET_INTERFACE (self)->iterator (self); +} + + +GType gee_iterable_get_element_type (GeeIterable* self) { + g_return_val_if_fail (self != NULL, 0UL); + return GEE_ITERABLE_GET_INTERFACE (self)->get_element_type (self); +} + + +static void gee_iterable_base_init (GeeIterableIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + /** + * The type of the elements in this collection. + */ + g_object_interface_install_property (iface, g_param_spec_gtype ("element-type", "element-type", "element-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + } +} + + +/** + * An object that can provide an {@link Iterator}. + */ +GType gee_iterable_get_type (void) { + static volatile gsize gee_iterable_type_id__volatile = 0; + if (g_once_init_enter (&gee_iterable_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeIterableIface), (GBaseInitFunc) gee_iterable_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_iterable_type_id; + gee_iterable_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeIterable", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_iterable_type_id, G_TYPE_OBJECT); + g_once_init_leave (&gee_iterable_type_id__volatile, gee_iterable_type_id); + } + return gee_iterable_type_id__volatile; +} + + + diff --git a/gee/iterable.vala b/gee/iterable.vala new file mode 100644 index 0000000..a6ef612 --- /dev/null +++ b/gee/iterable.vala @@ -0,0 +1,43 @@ +/* iterable.vala + * + * Copyright (C) 2007-2008 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +using GLib; + +/** + * An object that can provide an {@link Iterator}. + */ +public interface Gee.Iterable : Object { + /** + * The type of the elements in this collection. + */ + public abstract Type element_type { get; } + + /** + * Returns a {@link Iterator} that can be used for simple iteration over a + * collection. + * + * @return a {@link Iterator} that can be used for simple iteration over a + * collection + */ + public abstract Iterator iterator (); +} + diff --git a/gee/iterator.c b/gee/iterator.c new file mode 100644 index 0000000..3ffe3ee --- /dev/null +++ b/gee/iterator.c @@ -0,0 +1,147 @@ +/* iterator.c generated by valac 0.18.0, the Vala compiler + * generated from iterator.vala, do not modify */ + +/* iterator.vala + * + * Copyright (C) 2007-2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Maciej Piechotka + * Didier 'Ptitjes Villevalois + */ + +#include +#include + + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + + + +GType gee_iterator_get_type (void) G_GNUC_CONST; +gboolean gee_iterator_next (GeeIterator* self); +gboolean gee_iterator_has_next (GeeIterator* self); +gboolean gee_iterator_first (GeeIterator* self); +gpointer gee_iterator_get (GeeIterator* self); +void gee_iterator_remove (GeeIterator* self); + + +/** + * Advances to the next element in the iteration. + * + * @return ``true`` if the iterator has a next element + */ +gboolean gee_iterator_next (GeeIterator* self) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ITERATOR_GET_INTERFACE (self)->next (self); +} + + +/** + * Checks whether there is a next element in the iteration. + * + * @return ``true`` if the iterator has a next element + */ +gboolean gee_iterator_has_next (GeeIterator* self) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ITERATOR_GET_INTERFACE (self)->has_next (self); +} + + +/** + * Rewinds to the first element in the iteration. + * + * @return ``true`` if the iterator has a first element + */ +gboolean gee_iterator_first (GeeIterator* self) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_ITERATOR_GET_INTERFACE (self)->first (self); +} + + +/** + * Returns the current element in the iteration. + * + * @return the current element in the iteration + */ +gpointer gee_iterator_get (GeeIterator* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_ITERATOR_GET_INTERFACE (self)->get (self); +} + + +/** + * Removes the current element in the iteration. The cursor is set in an + * in-between state. Both {@link get} and {@link remove} will fail until + * the next move of the cursor (calling {@link next} or {@link first}). + */ +void gee_iterator_remove (GeeIterator* self) { + g_return_if_fail (self != NULL); + GEE_ITERATOR_GET_INTERFACE (self)->remove (self); +} + + +static void gee_iterator_base_init (GeeIteratorIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + } +} + + +/** + * An iterator over a collection. + * + * Gee's iterators are "on-track" iterators. They always point to an item + * except before the first call to {@link next} or {@link first}, or, when an + * item has been removed, until the next call to {@link next} or {@link first}. + * + * Please note that when the iterator is out of track, neither {@link get} nor + * {@link remove} are defined and both will fail. After the next call to + * {@link next} or {@link first}, they will be defined again. + */ +GType gee_iterator_get_type (void) { + static volatile gsize gee_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeIteratorIface), (GBaseInitFunc) gee_iterator_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_iterator_type_id; + gee_iterator_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeIterator", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_iterator_type_id, G_TYPE_OBJECT); + g_once_init_leave (&gee_iterator_type_id__volatile, gee_iterator_type_id); + } + return gee_iterator_type_id__volatile; +} + + + diff --git a/gee/iterator.vala b/gee/iterator.vala new file mode 100644 index 0000000..8b243e6 --- /dev/null +++ b/gee/iterator.vala @@ -0,0 +1,73 @@ +/* iterator.vala + * + * Copyright (C) 2007-2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Maciej Piechotka + * Didier 'Ptitjes Villevalois + */ + +/** + * An iterator over a collection. + * + * Gee's iterators are "on-track" iterators. They always point to an item + * except before the first call to {@link next} or {@link first}, or, when an + * item has been removed, until the next call to {@link next} or {@link first}. + * + * Please note that when the iterator is out of track, neither {@link get} nor + * {@link remove} are defined and both will fail. After the next call to + * {@link next} or {@link first}, they will be defined again. + */ +public interface Gee.Iterator : Object { + /** + * Advances to the next element in the iteration. + * + * @return ``true`` if the iterator has a next element + */ + public abstract bool next (); + + /** + * Checks whether there is a next element in the iteration. + * + * @return ``true`` if the iterator has a next element + */ + public abstract bool has_next (); + + /** + * Rewinds to the first element in the iteration. + * + * @return ``true`` if the iterator has a first element + */ + public abstract bool first (); + + /** + * Returns the current element in the iteration. + * + * @return the current element in the iteration + */ + public abstract G get (); + + /** + * Removes the current element in the iteration. The cursor is set in an + * in-between state. Both {@link get} and {@link remove} will fail until + * the next move of the cursor (calling {@link next} or {@link first}). + */ + public abstract void remove (); +} + diff --git a/gee/linkedlist.c b/gee/linkedlist.c new file mode 100644 index 0000000..c622869 --- /dev/null +++ b/gee/linkedlist.c @@ -0,0 +1,2555 @@ +/* linkedlist.c generated by valac 0.18.0, the Vala compiler + * generated from linkedlist.vala, do not modify */ + +/* linkedlist.vala + * + * Copyright (C) 2004-2005 Novell, Inc + * Copyright (C) 2005 David Waite + * Copyright (C) 2007-2008 Jürg Billeter + * Copyright (C) 2009 Mark Lee, Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Mark Lee + * Didier 'Ptitjes Villevalois + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; +typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate; + +#define GEE_TYPE_LIST (gee_list_get_type ()) +#define GEE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST, GeeList)) +#define GEE_IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST)) +#define GEE_LIST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST, GeeListIface)) + +typedef struct _GeeList GeeList; +typedef struct _GeeListIface GeeListIface; + +#define GEE_TYPE_BIDIR_ITERATOR (gee_bidir_iterator_get_type ()) +#define GEE_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIterator)) +#define GEE_IS_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_ITERATOR)) +#define GEE_BIDIR_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIteratorIface)) + +typedef struct _GeeBidirIterator GeeBidirIterator; +typedef struct _GeeBidirIteratorIface GeeBidirIteratorIface; + +#define GEE_TYPE_LIST_ITERATOR (gee_list_iterator_get_type ()) +#define GEE_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIterator)) +#define GEE_IS_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST_ITERATOR)) +#define GEE_LIST_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIteratorIface)) + +typedef struct _GeeListIterator GeeListIterator; +typedef struct _GeeListIteratorIface GeeListIteratorIface; + +#define GEE_TYPE_ABSTRACT_LIST (gee_abstract_list_get_type ()) +#define GEE_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractList)) +#define GEE_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass)) +#define GEE_IS_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_LIST)) +#define GEE_IS_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_LIST)) +#define GEE_ABSTRACT_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass)) + +typedef struct _GeeAbstractList GeeAbstractList; +typedef struct _GeeAbstractListClass GeeAbstractListClass; +typedef struct _GeeAbstractListPrivate GeeAbstractListPrivate; + +#define GEE_TYPE_QUEUE (gee_queue_get_type ()) +#define GEE_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_QUEUE, GeeQueue)) +#define GEE_IS_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_QUEUE)) +#define GEE_QUEUE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_QUEUE, GeeQueueIface)) + +typedef struct _GeeQueue GeeQueue; +typedef struct _GeeQueueIface GeeQueueIface; + +#define GEE_TYPE_DEQUE (gee_deque_get_type ()) +#define GEE_DEQUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_DEQUE, GeeDeque)) +#define GEE_IS_DEQUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_DEQUE)) +#define GEE_DEQUE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_DEQUE, GeeDequeIface)) + +typedef struct _GeeDeque GeeDeque; +typedef struct _GeeDequeIface GeeDequeIface; + +#define GEE_TYPE_LINKED_LIST (gee_linked_list_get_type ()) +#define GEE_LINKED_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LINKED_LIST, GeeLinkedList)) +#define GEE_LINKED_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_LINKED_LIST, GeeLinkedListClass)) +#define GEE_IS_LINKED_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LINKED_LIST)) +#define GEE_IS_LINKED_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_LINKED_LIST)) +#define GEE_LINKED_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_LINKED_LIST, GeeLinkedListClass)) + +typedef struct _GeeLinkedList GeeLinkedList; +typedef struct _GeeLinkedListClass GeeLinkedListClass; +typedef struct _GeeLinkedListPrivate GeeLinkedListPrivate; +typedef struct _GeeLinkedListNode GeeLinkedListNode; +#define _gee_linked_list_node_free0(var) ((var == NULL) ? NULL : (var = (gee_linked_list_node_free (var), NULL))) + +#define GEE_LINKED_LIST_TYPE_ITERATOR (gee_linked_list_iterator_get_type ()) +#define GEE_LINKED_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_LINKED_LIST_TYPE_ITERATOR, GeeLinkedListIterator)) +#define GEE_LINKED_LIST_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_LINKED_LIST_TYPE_ITERATOR, GeeLinkedListIteratorClass)) +#define GEE_LINKED_LIST_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_LINKED_LIST_TYPE_ITERATOR)) +#define GEE_LINKED_LIST_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_LINKED_LIST_TYPE_ITERATOR)) +#define GEE_LINKED_LIST_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_LINKED_LIST_TYPE_ITERATOR, GeeLinkedListIteratorClass)) + +typedef struct _GeeLinkedListIterator GeeLinkedListIterator; +typedef struct _GeeLinkedListIteratorClass GeeLinkedListIteratorClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +typedef struct _GeeLinkedListIteratorPrivate GeeLinkedListIteratorPrivate; +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeAbstractCollection { + GObject parent_instance; + GeeAbstractCollectionPrivate * priv; +}; + +struct _GeeAbstractCollectionClass { + GObjectClass parent_class; + gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*add) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item); + void (*clear) (GeeAbstractCollection* self); + gpointer* (*to_array) (GeeAbstractCollection* self, int* result_length1); + gboolean (*add_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeAbstractCollection* self, GeeCollection* collection); + GeeIterator* (*iterator) (GeeAbstractCollection* self); + gint (*get_size) (GeeAbstractCollection* self); + gboolean (*get_is_empty) (GeeAbstractCollection* self); + GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self); +}; + +struct _GeeBidirIteratorIface { + GTypeInterface parent_iface; + gboolean (*previous) (GeeBidirIterator* self); + gboolean (*has_previous) (GeeBidirIterator* self); + gboolean (*last) (GeeBidirIterator* self); +}; + +struct _GeeListIteratorIface { + GTypeInterface parent_iface; + void (*set) (GeeListIterator* self, gconstpointer item); + void (*insert) (GeeListIterator* self, gconstpointer item); + void (*add) (GeeListIterator* self, gconstpointer item); + gint (*index) (GeeListIterator* self); +}; + +struct _GeeListIface { + GTypeInterface parent_iface; + GeeListIterator* (*list_iterator) (GeeList* self); + gpointer (*get) (GeeList* self, gint index); + void (*set) (GeeList* self, gint index, gconstpointer item); + gint (*index_of) (GeeList* self, gconstpointer item); + void (*insert) (GeeList* self, gint index, gconstpointer item); + gpointer (*remove_at) (GeeList* self, gint index); + GeeList* (*slice) (GeeList* self, gint start, gint stop); + gpointer (*first) (GeeList* self); + gpointer (*last) (GeeList* self); + void (*insert_all) (GeeList* self, gint index, GeeCollection* collection); + void (*sort) (GeeList* self, GCompareFunc compare_func); + GeeList* (*get_read_only_view) (GeeList* self); +}; + +struct _GeeAbstractList { + GeeAbstractCollection parent_instance; + GeeAbstractListPrivate * priv; +}; + +struct _GeeAbstractListClass { + GeeAbstractCollectionClass parent_class; + GeeListIterator* (*list_iterator) (GeeAbstractList* self); + gpointer (*get) (GeeAbstractList* self, gint index); + void (*set) (GeeAbstractList* self, gint index, gconstpointer item); + gint (*index_of) (GeeAbstractList* self, gconstpointer item); + void (*insert) (GeeAbstractList* self, gint index, gconstpointer item); + gpointer (*remove_at) (GeeAbstractList* self, gint index); + GeeList* (*slice) (GeeAbstractList* self, gint start, gint stop); + gpointer (*first) (GeeAbstractList* self); + gpointer (*last) (GeeAbstractList* self); + void (*insert_all) (GeeAbstractList* self, gint index, GeeCollection* collection); + GeeList* (*get_read_only_view) (GeeAbstractList* self); +}; + +struct _GeeQueueIface { + GTypeInterface parent_iface; + gboolean (*offer) (GeeQueue* self, gconstpointer element); + gpointer (*peek) (GeeQueue* self); + gpointer (*poll) (GeeQueue* self); + gint (*drain) (GeeQueue* self, GeeCollection* recipient, gint amount); + gint (*get_capacity) (GeeQueue* self); + gint (*get_remaining_capacity) (GeeQueue* self); + gboolean (*get_is_full) (GeeQueue* self); +}; + +struct _GeeDequeIface { + GTypeInterface parent_iface; + gboolean (*offer_head) (GeeDeque* self, gconstpointer element); + gpointer (*peek_head) (GeeDeque* self); + gpointer (*poll_head) (GeeDeque* self); + gint (*drain_head) (GeeDeque* self, GeeCollection* recipient, gint amount); + gboolean (*offer_tail) (GeeDeque* self, gconstpointer element); + gpointer (*peek_tail) (GeeDeque* self); + gpointer (*poll_tail) (GeeDeque* self); + gint (*drain_tail) (GeeDeque* self, GeeCollection* recipient, gint amount); +}; + +struct _GeeLinkedList { + GeeAbstractList parent_instance; + GeeLinkedListPrivate * priv; +}; + +struct _GeeLinkedListClass { + GeeAbstractListClass parent_class; +}; + +struct _GeeLinkedListPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + gint _size; + gint _stamp; + GeeLinkedListNode* _head; + GeeLinkedListNode* _tail; + GEqualFunc _equal_func; +}; + +struct _GeeLinkedListNode { + gpointer data; + GeeLinkedListNode* prev; + GeeLinkedListNode* next; +}; + +struct _GeeLinkedListIterator { + GObject parent_instance; + GeeLinkedListIteratorPrivate * priv; +}; + +struct _GeeLinkedListIteratorClass { + GObjectClass parent_class; +}; + +struct _GeeLinkedListIteratorPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + gboolean started; + gboolean removed; + GeeLinkedListNode* position; + gint _stamp; + GeeLinkedList* _list; + gint _index; +}; + + +static gpointer gee_linked_list_parent_class = NULL; +static gpointer gee_linked_list_iterator_parent_class = NULL; +static GeeIteratorIface* gee_linked_list_iterator_gee_iterator_parent_iface = NULL; +static GeeBidirIteratorIface* gee_linked_list_iterator_gee_bidir_iterator_parent_iface = NULL; +static GeeListIteratorIface* gee_linked_list_iterator_gee_list_iterator_parent_iface = NULL; +static GeeQueueIface* gee_linked_list_gee_queue_parent_iface = NULL; +static GeeDequeIface* gee_linked_list_gee_deque_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_bidir_iterator_get_type (void) G_GNUC_CONST; +GType gee_list_iterator_get_type (void) G_GNUC_CONST; +GType gee_list_get_type (void) G_GNUC_CONST; +GType gee_abstract_list_get_type (void) G_GNUC_CONST; +GType gee_queue_get_type (void) G_GNUC_CONST; +GType gee_deque_get_type (void) G_GNUC_CONST; +GType gee_linked_list_get_type (void) G_GNUC_CONST; +static void gee_linked_list_node_free (GeeLinkedListNode* self); +#define GEE_LINKED_LIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_LINKED_LIST, GeeLinkedListPrivate)) +enum { + GEE_LINKED_LIST_DUMMY_PROPERTY, + GEE_LINKED_LIST_G_TYPE, + GEE_LINKED_LIST_G_DUP_FUNC, + GEE_LINKED_LIST_G_DESTROY_FUNC, + GEE_LINKED_LIST_EQUAL_FUNC, + GEE_LINKED_LIST_SIZE, + GEE_LINKED_LIST_CAPACITY, + GEE_LINKED_LIST_REMAINING_CAPACITY, + GEE_LINKED_LIST_IS_FULL +}; +void gee_abstract_collection_clear (GeeAbstractCollection* self); +GeeLinkedList* gee_linked_list_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func); +GeeLinkedList* gee_linked_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func); +GeeAbstractList* gee_abstract_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GEqualFunc gee_functions_get_equal_func_for (GType t); +static void gee_linked_list_set_equal_func (GeeLinkedList* self, GEqualFunc value); +static GeeIterator* gee_linked_list_real_iterator (GeeAbstractCollection* base); +static GeeLinkedListIterator* gee_linked_list_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeLinkedList* list); +static GeeLinkedListIterator* gee_linked_list_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeLinkedList* list); +static GType gee_linked_list_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static GeeListIterator* gee_linked_list_real_list_iterator (GeeAbstractList* base); +static gboolean gee_linked_list_real_contains (GeeAbstractCollection* base, gconstpointer item); +gint gee_abstract_list_index_of (GeeAbstractList* self, gconstpointer item); +static gboolean gee_linked_list_real_add (GeeAbstractCollection* base, gconstpointer item); +static GeeLinkedListNode* gee_linked_list_node_new (gpointer data); +static GeeLinkedListNode* gee_linked_list_node_new (gpointer data); +static gboolean gee_linked_list_real_remove (GeeAbstractCollection* base, gconstpointer item); +GEqualFunc gee_linked_list_get_equal_func (GeeLinkedList* self); +static void _gee_linked_list_remove_node (GeeLinkedList* self, GeeLinkedListNode* _n); +static void gee_linked_list_real_clear (GeeAbstractCollection* base); +static gpointer gee_linked_list_real_get (GeeAbstractList* base, gint index); +static GeeLinkedListNode* _gee_linked_list_get_node_at (GeeLinkedList* self, gint index); +static void gee_linked_list_real_set (GeeAbstractList* base, gint index, gconstpointer item); +static gint gee_linked_list_real_index_of (GeeAbstractList* base, gconstpointer item); +gint gee_abstract_collection_get_size (GeeAbstractCollection* self); +gpointer gee_abstract_list_get (GeeAbstractList* self, gint index); +static void gee_linked_list_real_insert (GeeAbstractList* base, gint index, gconstpointer item); +gboolean gee_abstract_collection_add (GeeAbstractCollection* self, gconstpointer item); +static gpointer gee_linked_list_real_remove_at (GeeAbstractList* base, gint index); +static GeeList* gee_linked_list_real_slice (GeeAbstractList* base, gint start, gint stop); +gboolean gee_collection_add (GeeCollection* self, gconstpointer item); +static gpointer gee_linked_list_real_first (GeeAbstractList* base); +static gpointer gee_linked_list_real_last (GeeAbstractList* base); +static gboolean gee_linked_list_real_offer (GeeQueue* base, gconstpointer element); +gboolean gee_deque_offer_tail (GeeDeque* self, gconstpointer element); +static gpointer gee_linked_list_real_peek (GeeQueue* base); +gpointer gee_deque_peek_head (GeeDeque* self); +static gpointer gee_linked_list_real_poll (GeeQueue* base); +gpointer gee_deque_poll_head (GeeDeque* self); +static gint gee_linked_list_real_drain (GeeQueue* base, GeeCollection* recipient, gint amount); +gint gee_deque_drain_head (GeeDeque* self, GeeCollection* recipient, gint amount); +static gboolean gee_linked_list_real_offer_head (GeeDeque* base, gconstpointer element); +void gee_abstract_list_insert (GeeAbstractList* self, gint index, gconstpointer item); +static gpointer gee_linked_list_real_peek_head (GeeDeque* base); +static gpointer gee_linked_list_real_poll_head (GeeDeque* base); +gpointer gee_abstract_list_remove_at (GeeAbstractList* self, gint index); +static gint gee_linked_list_real_drain_head (GeeDeque* base, GeeCollection* recipient, gint amount); +static gboolean gee_linked_list_real_offer_tail (GeeDeque* base, gconstpointer element); +static gpointer gee_linked_list_real_peek_tail (GeeDeque* base); +static gpointer gee_linked_list_real_poll_tail (GeeDeque* base); +static gint gee_linked_list_real_drain_tail (GeeDeque* base, GeeCollection* recipient, gint amount); +#define GEE_QUEUE_UNBOUNDED_CAPACITY (-1) +static void gee_linked_list_node_instance_init (GeeLinkedListNode * self); +#define GEE_LINKED_LIST_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_LINKED_LIST_TYPE_ITERATOR, GeeLinkedListIteratorPrivate)) +enum { + GEE_LINKED_LIST_ITERATOR_DUMMY_PROPERTY, + GEE_LINKED_LIST_ITERATOR_G_TYPE, + GEE_LINKED_LIST_ITERATOR_G_DUP_FUNC, + GEE_LINKED_LIST_ITERATOR_G_DESTROY_FUNC +}; +static gboolean gee_linked_list_iterator_real_next (GeeIterator* base); +static gboolean gee_linked_list_iterator_real_has_next (GeeIterator* base); +static gboolean gee_linked_list_iterator_real_first (GeeIterator* base); +static gpointer gee_linked_list_iterator_real_get (GeeIterator* base); +static void gee_linked_list_iterator_real_remove (GeeIterator* base); +static gboolean gee_linked_list_iterator_real_previous (GeeBidirIterator* base); +static gboolean gee_linked_list_iterator_real_has_previous (GeeBidirIterator* base); +static gboolean gee_linked_list_iterator_real_last (GeeBidirIterator* base); +static void gee_linked_list_iterator_real_set (GeeListIterator* base, gconstpointer item); +static void gee_linked_list_iterator_real_insert (GeeListIterator* base, gconstpointer item); +static void gee_linked_list_iterator_real_add (GeeListIterator* base, gconstpointer item); +static gint gee_linked_list_iterator_real_index (GeeListIterator* base); +static void gee_linked_list_iterator_finalize (GObject* obj); +static void _vala_gee_linked_list_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_linked_list_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void gee_linked_list_finalize (GObject* obj); +gint gee_queue_get_capacity (GeeQueue* self); +gint gee_queue_get_remaining_capacity (GeeQueue* self); +gboolean gee_queue_get_is_full (GeeQueue* self); +static void _vala_gee_linked_list_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_linked_list_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +/** + * Constructs a new, empty linked list. + * + * If not provided, the function parameter is requested to the + * {@link Functions} function factory methods. + * + * @param equal_func an optional element equality testing function + */ +GeeLinkedList* gee_linked_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func) { + GeeLinkedList * self = NULL; + GEqualFunc _tmp0_; + GEqualFunc _tmp2_; + self = (GeeLinkedList*) gee_abstract_list_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = equal_func; + if (_tmp0_ == NULL) { + GEqualFunc _tmp1_ = NULL; + _tmp1_ = gee_functions_get_equal_func_for (g_type); + equal_func = _tmp1_; + } + _tmp2_ = equal_func; + gee_linked_list_set_equal_func (self, _tmp2_); + return self; +} + + +GeeLinkedList* gee_linked_list_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func) { + return gee_linked_list_construct (GEE_TYPE_LINKED_LIST, g_type, g_dup_func, g_destroy_func, equal_func); +} + + +/** + * {@inheritDoc} + */ +static GeeIterator* gee_linked_list_real_iterator (GeeAbstractCollection* base) { + GeeLinkedList * self; + GeeIterator* result = NULL; + GeeLinkedListIterator* _tmp0_; + self = (GeeLinkedList*) base; + _tmp0_ = gee_linked_list_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, self); + result = (GeeIterator*) _tmp0_; + return result; +} + + +/** + * {@inheritDoc} + */ +static GeeListIterator* gee_linked_list_real_list_iterator (GeeAbstractList* base) { + GeeLinkedList * self; + GeeListIterator* result = NULL; + GeeLinkedListIterator* _tmp0_; + self = (GeeLinkedList*) base; + _tmp0_ = gee_linked_list_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, self); + result = (GeeListIterator*) _tmp0_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_linked_list_real_contains (GeeAbstractCollection* base, gconstpointer item) { + GeeLinkedList * self; + gboolean result = FALSE; + gconstpointer _tmp0_; + gint _tmp1_ = 0; + self = (GeeLinkedList*) base; + _tmp0_ = item; + _tmp1_ = gee_abstract_list_index_of ((GeeAbstractList*) self, _tmp0_); + result = _tmp1_ != (-1); + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_linked_list_real_add (GeeAbstractCollection* base, gconstpointer item) { + GeeLinkedList * self; + gboolean result = FALSE; + gconstpointer _tmp0_; + gpointer _tmp1_; + GeeLinkedListNode* _tmp2_; + GeeLinkedListNode* n; + gboolean _tmp3_ = FALSE; + GeeLinkedListNode* _tmp4_; + gboolean _tmp6_; + gint _tmp15_; + self = (GeeLinkedList*) base; + _tmp0_ = item; + _tmp1_ = ((_tmp0_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp0_) : ((gpointer) _tmp0_); + _tmp2_ = gee_linked_list_node_new (_tmp1_); + n = _tmp2_; + _tmp4_ = self->priv->_head; + if (_tmp4_ == NULL) { + GeeLinkedListNode* _tmp5_; + _tmp5_ = self->priv->_tail; + _tmp3_ = _tmp5_ == NULL; + } else { + _tmp3_ = FALSE; + } + _tmp6_ = _tmp3_; + if (_tmp6_) { + GeeLinkedListNode* _tmp7_; + GeeLinkedListNode* _tmp8_; + _tmp7_ = n; + self->priv->_tail = _tmp7_; + _tmp8_ = n; + n = NULL; + _gee_linked_list_node_free0 (self->priv->_head); + self->priv->_head = _tmp8_; + } else { + GeeLinkedListNode* _tmp9_; + GeeLinkedListNode* _tmp10_; + GeeLinkedListNode* _tmp11_; + GeeLinkedListNode* _tmp12_; + GeeLinkedListNode* _tmp13_; + GeeLinkedListNode* _tmp14_; + _tmp9_ = n; + _tmp10_ = self->priv->_tail; + _tmp9_->prev = _tmp10_; + _tmp11_ = self->priv->_tail; + _tmp12_ = n; + n = NULL; + _gee_linked_list_node_free0 (_tmp11_->next); + _tmp11_->next = _tmp12_; + _tmp13_ = self->priv->_tail; + _tmp14_ = _tmp13_->next; + self->priv->_tail = _tmp14_; + } + _tmp15_ = self->priv->_size; + self->priv->_size = _tmp15_ + 1; + result = TRUE; + _gee_linked_list_node_free0 (n); + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_linked_list_real_remove (GeeAbstractCollection* base, gconstpointer item) { + GeeLinkedList * self; + gboolean result = FALSE; + self = (GeeLinkedList*) base; + { + GeeLinkedListNode* _tmp0_; + GeeLinkedListNode* n; + _tmp0_ = self->priv->_head; + n = _tmp0_; + { + gboolean _tmp1_; + _tmp1_ = TRUE; + while (TRUE) { + gboolean _tmp2_; + GeeLinkedListNode* _tmp5_; + GEqualFunc _tmp6_; + GEqualFunc _tmp7_; + gconstpointer _tmp8_; + GeeLinkedListNode* _tmp9_; + gconstpointer _tmp10_; + gboolean _tmp11_ = FALSE; + _tmp2_ = _tmp1_; + if (!_tmp2_) { + GeeLinkedListNode* _tmp3_; + GeeLinkedListNode* _tmp4_; + _tmp3_ = n; + _tmp4_ = _tmp3_->next; + n = _tmp4_; + } + _tmp1_ = FALSE; + _tmp5_ = n; + if (!(_tmp5_ != NULL)) { + break; + } + _tmp6_ = gee_linked_list_get_equal_func (self); + _tmp7_ = _tmp6_; + _tmp8_ = item; + _tmp9_ = n; + _tmp10_ = _tmp9_->data; + _tmp11_ = _tmp7_ (_tmp8_, _tmp10_); + if (_tmp11_) { + GeeLinkedListNode* _tmp12_; + _tmp12_ = n; + _gee_linked_list_remove_node (self, _tmp12_); + result = TRUE; + return result; + } + } + } + } + result = FALSE; + return result; +} + + +/** + * {@inheritDoc} + */ +static void gee_linked_list_real_clear (GeeAbstractCollection* base) { + GeeLinkedList * self; + gint _tmp2_; + self = (GeeLinkedList*) base; + while (TRUE) { + GeeLinkedListNode* _tmp0_; + GeeLinkedListNode* _tmp1_; + _tmp0_ = self->priv->_head; + if (!(_tmp0_ != NULL)) { + break; + } + _tmp1_ = self->priv->_head; + _gee_linked_list_remove_node (self, _tmp1_); + } + _tmp2_ = self->priv->_stamp; + self->priv->_stamp = _tmp2_ + 1; + _gee_linked_list_node_free0 (self->priv->_head); + self->priv->_head = NULL; + self->priv->_tail = NULL; + self->priv->_size = 0; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_linked_list_real_get (GeeAbstractList* base, gint index) { + GeeLinkedList * self; + gpointer result = NULL; + gint _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint _tmp3_; + GeeLinkedListNode* _tmp4_ = NULL; + GeeLinkedListNode* n; + gconstpointer _tmp5_; + gpointer _tmp6_; + self = (GeeLinkedList*) base; + _tmp0_ = index; + _vala_assert (_tmp0_ >= 0, "index >= 0"); + _tmp1_ = index; + _tmp2_ = self->priv->_size; + _vala_assert (_tmp1_ < _tmp2_, "index < this._size"); + _tmp3_ = index; + _tmp4_ = _gee_linked_list_get_node_at (self, _tmp3_); + n = _tmp4_; + _vala_assert (n != NULL, "n != null"); + _tmp5_ = n->data; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + result = _tmp6_; + return result; +} + + +/** + * {@inheritDoc} + */ +static void gee_linked_list_real_set (GeeAbstractList* base, gint index, gconstpointer item) { + GeeLinkedList * self; + gint _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint _tmp3_; + GeeLinkedListNode* _tmp4_ = NULL; + GeeLinkedListNode* n; + gconstpointer _tmp5_; + gpointer _tmp6_; + self = (GeeLinkedList*) base; + _tmp0_ = index; + _vala_assert (_tmp0_ >= 0, "index >= 0"); + _tmp1_ = index; + _tmp2_ = self->priv->_size; + _vala_assert (_tmp1_ < _tmp2_, "index < this._size"); + _tmp3_ = index; + _tmp4_ = _gee_linked_list_get_node_at (self, _tmp3_); + n = _tmp4_; + g_return_if_fail (n != NULL); + _tmp5_ = item; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + ((n->data == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (n->data = (self->priv->g_destroy_func (n->data), NULL)); + n->data = _tmp6_; +} + + +/** + * {@inheritDoc} + */ +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static gint gee_linked_list_real_index_of (GeeAbstractList* base, gconstpointer item) { + GeeLinkedList * self; + gint result = 0; + gint _result_; + gint idx; + self = (GeeLinkedList*) base; + _result_ = -1; + idx = 0; + { + GeeLinkedList* _tmp0_; + GeeLinkedList* _node_item_list; + GeeLinkedList* _tmp1_; + gint _tmp2_; + gint _tmp3_; + gint _node_item_size; + gint _node_item_index; + _tmp0_ = _g_object_ref0 (self); + _node_item_list = _tmp0_; + _tmp1_ = _node_item_list; + _tmp2_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp1_); + _tmp3_ = _tmp2_; + _node_item_size = _tmp3_; + _node_item_index = -1; + while (TRUE) { + gint _tmp4_; + gint _tmp5_; + gint _tmp6_; + GeeLinkedList* _tmp7_; + gint _tmp8_; + gpointer _tmp9_ = NULL; + gpointer node_item; + GEqualFunc _tmp10_; + GEqualFunc _tmp11_; + gconstpointer _tmp12_; + gconstpointer _tmp13_; + gboolean _tmp14_ = FALSE; + _tmp4_ = _node_item_index; + _node_item_index = _tmp4_ + 1; + _tmp5_ = _node_item_index; + _tmp6_ = _node_item_size; + if (!(_tmp5_ < _tmp6_)) { + break; + } + _tmp7_ = _node_item_list; + _tmp8_ = _node_item_index; + _tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, _tmp8_); + node_item = _tmp9_; + _tmp10_ = gee_linked_list_get_equal_func (self); + _tmp11_ = _tmp10_; + _tmp12_ = item; + _tmp13_ = node_item; + _tmp14_ = _tmp11_ (_tmp12_, _tmp13_); + if (_tmp14_) { + gint _tmp15_; + _tmp15_ = idx; + _result_ = _tmp15_; + ((node_item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (node_item = (self->priv->g_destroy_func (node_item), NULL)); + break; + } else { + gint _tmp16_; + _tmp16_ = idx; + idx = _tmp16_ + 1; + } + ((node_item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (node_item = (self->priv->g_destroy_func (node_item), NULL)); + } + _g_object_unref0 (_node_item_list); + } + result = _result_; + return result; +} + + +/** + * {@inheritDoc} + */ +static void gee_linked_list_real_insert (GeeAbstractList* base, gint index, gconstpointer item) { + GeeLinkedList * self; + gint _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint _tmp3_; + gint _tmp4_; + self = (GeeLinkedList*) base; + _tmp0_ = index; + _vala_assert (_tmp0_ >= 0, "index >= 0"); + _tmp1_ = index; + _tmp2_ = self->priv->_size; + _vala_assert (_tmp1_ <= _tmp2_, "index <= this._size"); + _tmp3_ = index; + _tmp4_ = self->priv->_size; + if (_tmp3_ == _tmp4_) { + gconstpointer _tmp5_; + _tmp5_ = item; + gee_abstract_collection_add ((GeeAbstractCollection*) self, _tmp5_); + } else { + gconstpointer _tmp6_; + gpointer _tmp7_; + GeeLinkedListNode* _tmp8_; + GeeLinkedListNode* n; + gint _tmp9_; + gint _tmp34_; + _tmp6_ = item; + _tmp7_ = ((_tmp6_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp6_) : ((gpointer) _tmp6_); + _tmp8_ = gee_linked_list_node_new (_tmp7_); + n = _tmp8_; + _tmp9_ = index; + if (_tmp9_ == 0) { + GeeLinkedListNode* _tmp10_; + GeeLinkedListNode* _tmp11_; + GeeLinkedListNode* _tmp12_; + GeeLinkedListNode* _tmp13_; + GeeLinkedListNode* _tmp14_; + GeeLinkedListNode* _tmp15_; + _tmp10_ = n; + _tmp11_ = self->priv->_head; + self->priv->_head = NULL; + _gee_linked_list_node_free0 (_tmp10_->next); + _tmp10_->next = _tmp11_; + _tmp12_ = n; + _tmp13_ = _tmp12_->next; + _tmp14_ = n; + _tmp13_->prev = _tmp14_; + _tmp15_ = n; + n = NULL; + _gee_linked_list_node_free0 (self->priv->_head); + self->priv->_head = _tmp15_; + } else { + GeeLinkedListNode* _tmp16_; + GeeLinkedListNode* prev; + GeeLinkedListNode* _tmp24_; + GeeLinkedListNode* _tmp25_; + GeeLinkedListNode* _tmp26_; + GeeLinkedListNode* _tmp27_; + GeeLinkedListNode* _tmp28_; + GeeLinkedListNode* _tmp29_; + GeeLinkedListNode* _tmp30_; + GeeLinkedListNode* _tmp31_; + GeeLinkedListNode* _tmp32_; + GeeLinkedListNode* _tmp33_; + _tmp16_ = self->priv->_head; + prev = _tmp16_; + { + gint i; + i = 0; + { + gboolean _tmp17_; + _tmp17_ = TRUE; + while (TRUE) { + gboolean _tmp18_; + gint _tmp20_; + gint _tmp21_; + GeeLinkedListNode* _tmp22_; + GeeLinkedListNode* _tmp23_; + _tmp18_ = _tmp17_; + if (!_tmp18_) { + gint _tmp19_; + _tmp19_ = i; + i = _tmp19_ + 1; + } + _tmp17_ = FALSE; + _tmp20_ = i; + _tmp21_ = index; + if (!(_tmp20_ < (_tmp21_ - 1))) { + break; + } + _tmp22_ = prev; + _tmp23_ = _tmp22_->next; + prev = _tmp23_; + } + } + } + _tmp24_ = n; + _tmp25_ = prev; + _tmp24_->prev = _tmp25_; + _tmp26_ = n; + _tmp27_ = prev; + _tmp28_ = _tmp27_->next; + _tmp27_->next = NULL; + _gee_linked_list_node_free0 (_tmp26_->next); + _tmp26_->next = _tmp28_; + _tmp29_ = n; + _tmp30_ = _tmp29_->next; + _tmp31_ = n; + _tmp30_->prev = _tmp31_; + _tmp32_ = prev; + _tmp33_ = n; + n = NULL; + _gee_linked_list_node_free0 (_tmp32_->next); + _tmp32_->next = _tmp33_; + } + _tmp34_ = self->priv->_size; + self->priv->_size = _tmp34_ + 1; + _gee_linked_list_node_free0 (n); + } +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_linked_list_real_remove_at (GeeAbstractList* base, gint index) { + GeeLinkedList * self; + gpointer result = NULL; + gint _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint _tmp3_; + GeeLinkedListNode* _tmp4_ = NULL; + GeeLinkedListNode* n; + gconstpointer _tmp5_; + gpointer _tmp6_; + gpointer element; + self = (GeeLinkedList*) base; + _tmp0_ = index; + _vala_assert (_tmp0_ >= 0, "index >= 0"); + _tmp1_ = index; + _tmp2_ = self->priv->_size; + _vala_assert (_tmp1_ < _tmp2_, "index < this._size"); + _tmp3_ = index; + _tmp4_ = _gee_linked_list_get_node_at (self, _tmp3_); + n = _tmp4_; + _vala_assert (n != NULL, "n != null"); + _tmp5_ = n->data; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + element = _tmp6_; + _gee_linked_list_remove_node (self, n); + result = element; + return result; +} + + +/** + * {@inheritDoc} + */ +static GeeList* gee_linked_list_real_slice (GeeAbstractList* base, gint start, gint stop) { + GeeLinkedList * self; + GeeList* result = NULL; + gint _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint _tmp3_; + gint _tmp4_; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + GeeLinkedList* _tmp7_; + GeeList* slice; + gint _tmp8_; + GeeLinkedListNode* _tmp9_ = NULL; + GeeLinkedListNode* n; + self = (GeeLinkedList*) base; + _tmp0_ = start; + _tmp1_ = stop; + g_return_val_if_fail (_tmp0_ <= _tmp1_, NULL); + _tmp2_ = start; + g_return_val_if_fail (_tmp2_ >= 0, NULL); + _tmp3_ = stop; + _tmp4_ = self->priv->_size; + g_return_val_if_fail (_tmp3_ <= _tmp4_, NULL); + _tmp5_ = gee_linked_list_get_equal_func (self); + _tmp6_ = _tmp5_; + _tmp7_ = gee_linked_list_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp6_); + slice = (GeeList*) _tmp7_; + _tmp8_ = start; + _tmp9_ = _gee_linked_list_get_node_at (self, _tmp8_); + n = _tmp9_; + { + gint _tmp10_; + gint i; + _tmp10_ = start; + i = _tmp10_; + { + gboolean _tmp11_; + _tmp11_ = TRUE; + while (TRUE) { + gboolean _tmp12_; + gint _tmp14_; + gint _tmp15_; + GeeList* _tmp16_; + GeeLinkedListNode* _tmp17_; + gconstpointer _tmp18_; + GeeLinkedListNode* _tmp19_; + GeeLinkedListNode* _tmp20_; + _tmp12_ = _tmp11_; + if (!_tmp12_) { + gint _tmp13_; + _tmp13_ = i; + i = _tmp13_ + 1; + } + _tmp11_ = FALSE; + _tmp14_ = i; + _tmp15_ = stop; + if (!(_tmp14_ < _tmp15_)) { + break; + } + _tmp16_ = slice; + _tmp17_ = n; + _tmp18_ = _tmp17_->data; + gee_collection_add ((GeeCollection*) _tmp16_, _tmp18_); + _tmp19_ = n; + _tmp20_ = _tmp19_->next; + n = _tmp20_; + } + } + } + result = slice; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_linked_list_real_first (GeeAbstractList* base) { + GeeLinkedList * self; + gpointer result = NULL; + gint _tmp0_; + GeeLinkedListNode* _tmp1_; + gconstpointer _tmp2_; + gpointer _tmp3_; + self = (GeeLinkedList*) base; + _tmp0_ = self->priv->_size; + _vala_assert (_tmp0_ > 0, "_size > 0"); + _tmp1_ = self->priv->_head; + _tmp2_ = _tmp1_->data; + _tmp3_ = ((_tmp2_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp2_) : ((gpointer) _tmp2_); + result = _tmp3_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_linked_list_real_last (GeeAbstractList* base) { + GeeLinkedList * self; + gpointer result = NULL; + gint _tmp0_; + GeeLinkedListNode* _tmp1_; + gconstpointer _tmp2_; + gpointer _tmp3_; + self = (GeeLinkedList*) base; + _tmp0_ = self->priv->_size; + _vala_assert (_tmp0_ > 0, "_size > 0"); + _tmp1_ = self->priv->_tail; + _tmp2_ = _tmp1_->data; + _tmp3_ = ((_tmp2_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp2_) : ((gpointer) _tmp2_); + result = _tmp3_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_linked_list_real_offer (GeeQueue* base, gconstpointer element) { + GeeLinkedList * self; + gboolean result = FALSE; + gconstpointer _tmp0_; + gboolean _tmp1_ = FALSE; + self = (GeeLinkedList*) base; + _tmp0_ = element; + _tmp1_ = gee_deque_offer_tail ((GeeDeque*) self, _tmp0_); + result = _tmp1_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_linked_list_real_peek (GeeQueue* base) { + GeeLinkedList * self; + gpointer result = NULL; + gpointer _tmp0_ = NULL; + self = (GeeLinkedList*) base; + _tmp0_ = gee_deque_peek_head ((GeeDeque*) self); + result = _tmp0_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_linked_list_real_poll (GeeQueue* base) { + GeeLinkedList * self; + gpointer result = NULL; + gpointer _tmp0_ = NULL; + self = (GeeLinkedList*) base; + _tmp0_ = gee_deque_poll_head ((GeeDeque*) self); + result = _tmp0_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gint gee_linked_list_real_drain (GeeQueue* base, GeeCollection* recipient, gint amount) { + GeeLinkedList * self; + gint result = 0; + GeeCollection* _tmp0_; + gint _tmp1_; + gint _tmp2_ = 0; + self = (GeeLinkedList*) base; + g_return_val_if_fail (recipient != NULL, 0); + _tmp0_ = recipient; + _tmp1_ = amount; + _tmp2_ = gee_deque_drain_head ((GeeDeque*) self, _tmp0_, _tmp1_); + result = _tmp2_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_linked_list_real_offer_head (GeeDeque* base, gconstpointer element) { + GeeLinkedList * self; + gboolean result = FALSE; + gconstpointer _tmp0_; + self = (GeeLinkedList*) base; + _tmp0_ = element; + gee_abstract_list_insert ((GeeAbstractList*) self, 0, _tmp0_); + result = TRUE; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_linked_list_real_peek_head (GeeDeque* base) { + GeeLinkedList * self; + gpointer result = NULL; + gint _tmp0_; + gpointer _tmp1_ = NULL; + self = (GeeLinkedList*) base; + _tmp0_ = self->priv->_size; + if (_tmp0_ == 0) { + result = NULL; + return result; + } + _tmp1_ = gee_abstract_list_get ((GeeAbstractList*) self, 0); + result = _tmp1_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_linked_list_real_poll_head (GeeDeque* base) { + GeeLinkedList * self; + gpointer result = NULL; + gint _tmp0_; + gpointer _tmp1_ = NULL; + self = (GeeLinkedList*) base; + _tmp0_ = self->priv->_size; + if (_tmp0_ == 0) { + result = NULL; + return result; + } + _tmp1_ = gee_abstract_list_remove_at ((GeeAbstractList*) self, 0); + result = _tmp1_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gint gee_linked_list_real_drain_head (GeeDeque* base, GeeCollection* recipient, gint amount) { + GeeLinkedList * self; + gint result = 0; + gint _tmp0_; + gint _tmp11_; + self = (GeeLinkedList*) base; + g_return_val_if_fail (recipient != NULL, 0); + _tmp0_ = amount; + if (_tmp0_ == (-1)) { + gint _tmp1_; + _tmp1_ = self->priv->_size; + amount = _tmp1_; + } + { + gint i; + i = 0; + { + gboolean _tmp2_; + _tmp2_ = TRUE; + while (TRUE) { + gboolean _tmp3_; + gint _tmp5_; + gint _tmp6_; + gint _tmp7_; + GeeCollection* _tmp8_; + gpointer _tmp9_ = NULL; + gpointer _tmp10_; + _tmp3_ = _tmp2_; + if (!_tmp3_) { + gint _tmp4_; + _tmp4_ = i; + i = _tmp4_ + 1; + } + _tmp2_ = FALSE; + _tmp5_ = i; + _tmp6_ = amount; + if (!(_tmp5_ < _tmp6_)) { + break; + } + _tmp7_ = self->priv->_size; + if (_tmp7_ == 0) { + result = i; + return result; + } + _tmp8_ = recipient; + _tmp9_ = gee_abstract_list_remove_at ((GeeAbstractList*) self, 0); + _tmp10_ = _tmp9_; + gee_collection_add (_tmp8_, _tmp10_); + ((_tmp10_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp10_ = (self->priv->g_destroy_func (_tmp10_), NULL)); + } + } + } + _tmp11_ = amount; + result = _tmp11_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_linked_list_real_offer_tail (GeeDeque* base, gconstpointer element) { + GeeLinkedList * self; + gboolean result = FALSE; + gconstpointer _tmp0_; + gboolean _tmp1_ = FALSE; + self = (GeeLinkedList*) base; + _tmp0_ = element; + _tmp1_ = gee_abstract_collection_add ((GeeAbstractCollection*) self, _tmp0_); + result = _tmp1_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_linked_list_real_peek_tail (GeeDeque* base) { + GeeLinkedList * self; + gpointer result = NULL; + gint _tmp0_; + gint _tmp1_; + gpointer _tmp2_ = NULL; + self = (GeeLinkedList*) base; + _tmp0_ = self->priv->_size; + if (_tmp0_ == 0) { + result = NULL; + return result; + } + _tmp1_ = self->priv->_size; + _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) self, _tmp1_ - 1); + result = _tmp2_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_linked_list_real_poll_tail (GeeDeque* base) { + GeeLinkedList * self; + gpointer result = NULL; + gint _tmp0_; + gint _tmp1_; + gpointer _tmp2_ = NULL; + self = (GeeLinkedList*) base; + _tmp0_ = self->priv->_size; + if (_tmp0_ == 0) { + result = NULL; + return result; + } + _tmp1_ = self->priv->_size; + _tmp2_ = gee_abstract_list_remove_at ((GeeAbstractList*) self, _tmp1_ - 1); + result = _tmp2_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gint gee_linked_list_real_drain_tail (GeeDeque* base, GeeCollection* recipient, gint amount) { + GeeLinkedList * self; + gint result = 0; + gint _tmp0_; + gint _tmp12_; + self = (GeeLinkedList*) base; + g_return_val_if_fail (recipient != NULL, 0); + _tmp0_ = amount; + if (_tmp0_ == (-1)) { + gint _tmp1_; + _tmp1_ = self->priv->_size; + amount = _tmp1_; + } + { + gint i; + i = 0; + { + gboolean _tmp2_; + _tmp2_ = TRUE; + while (TRUE) { + gboolean _tmp3_; + gint _tmp5_; + gint _tmp6_; + gint _tmp7_; + GeeCollection* _tmp8_; + gint _tmp9_; + gpointer _tmp10_ = NULL; + gpointer _tmp11_; + _tmp3_ = _tmp2_; + if (!_tmp3_) { + gint _tmp4_; + _tmp4_ = i; + i = _tmp4_ + 1; + } + _tmp2_ = FALSE; + _tmp5_ = i; + _tmp6_ = amount; + if (!(_tmp5_ < _tmp6_)) { + break; + } + _tmp7_ = self->priv->_size; + if (_tmp7_ == 0) { + result = i; + return result; + } + _tmp8_ = recipient; + _tmp9_ = self->priv->_size; + _tmp10_ = gee_abstract_list_remove_at ((GeeAbstractList*) self, _tmp9_ - 1); + _tmp11_ = _tmp10_; + gee_collection_add (_tmp8_, _tmp11_); + ((_tmp11_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp11_ = (self->priv->g_destroy_func (_tmp11_), NULL)); + } + } + } + _tmp12_ = amount; + result = _tmp12_; + return result; +} + + +static GeeLinkedListNode* _gee_linked_list_get_node_at (GeeLinkedList* self, gint index) { + GeeLinkedListNode* result = NULL; + GeeLinkedListNode* n; + gint _tmp0_; + GeeLinkedListNode* _tmp24_; + g_return_val_if_fail (self != NULL, NULL); + n = NULL; + _tmp0_ = index; + if (_tmp0_ == 0) { + GeeLinkedListNode* _tmp1_; + _tmp1_ = self->priv->_head; + n = _tmp1_; + } else { + gint _tmp2_; + gint _tmp3_; + _tmp2_ = index; + _tmp3_ = self->priv->_size; + if (_tmp2_ == (_tmp3_ - 1)) { + GeeLinkedListNode* _tmp4_; + _tmp4_ = self->priv->_tail; + n = _tmp4_; + } else { + gint _tmp5_; + gint _tmp6_; + _tmp5_ = index; + _tmp6_ = self->priv->_size; + if (_tmp5_ <= (_tmp6_ / 2)) { + GeeLinkedListNode* _tmp7_; + _tmp7_ = self->priv->_head; + n = _tmp7_; + { + gint i; + i = 0; + { + gboolean _tmp8_; + _tmp8_ = TRUE; + while (TRUE) { + gboolean _tmp9_; + gint _tmp11_; + gint _tmp12_; + GeeLinkedListNode* _tmp13_; + GeeLinkedListNode* _tmp14_; + _tmp9_ = _tmp8_; + if (!_tmp9_) { + gint _tmp10_; + _tmp10_ = i; + i = _tmp10_ + 1; + } + _tmp8_ = FALSE; + _tmp11_ = index; + _tmp12_ = i; + if (!(_tmp11_ != _tmp12_)) { + break; + } + _tmp13_ = n; + _tmp14_ = _tmp13_->next; + n = _tmp14_; + } + } + } + } else { + GeeLinkedListNode* _tmp15_; + _tmp15_ = self->priv->_tail; + n = _tmp15_; + { + gint _tmp16_; + gint i; + _tmp16_ = self->priv->_size; + i = _tmp16_ - 1; + { + gboolean _tmp17_; + _tmp17_ = TRUE; + while (TRUE) { + gboolean _tmp18_; + gint _tmp20_; + gint _tmp21_; + GeeLinkedListNode* _tmp22_; + GeeLinkedListNode* _tmp23_; + _tmp18_ = _tmp17_; + if (!_tmp18_) { + gint _tmp19_; + _tmp19_ = i; + i = _tmp19_ - 1; + } + _tmp17_ = FALSE; + _tmp20_ = index; + _tmp21_ = i; + if (!(_tmp20_ != _tmp21_)) { + break; + } + _tmp22_ = n; + _tmp23_ = _tmp22_->prev; + n = _tmp23_; + } + } + } + } + } + } + _tmp24_ = n; + result = _tmp24_; + return result; +} + + +static void _gee_linked_list_remove_node (GeeLinkedList* self, GeeLinkedListNode* _n) { + GeeLinkedListNode* n = NULL; + GeeLinkedListNode* next = NULL; + GeeLinkedListNode* _tmp0_; + GeeLinkedListNode* _tmp1_; + GeeLinkedListNode* _tmp14_; + GeeLinkedListNode* _tmp15_; + GeeLinkedListNode* _tmp21_; + GeeLinkedListNode* _tmp22_; + GeeLinkedListNode* _tmp23_; + gint _tmp24_; + gint _tmp25_; + g_return_if_fail (self != NULL); + g_return_if_fail (_n != NULL); + _tmp0_ = _n; + _tmp1_ = self->priv->_head; + if (_tmp0_ == _tmp1_) { + GeeLinkedListNode* _tmp2_; + GeeLinkedListNode* _tmp3_; + GeeLinkedListNode* _tmp4_; + GeeLinkedListNode* _tmp5_; + _tmp2_ = self->priv->_head; + self->priv->_head = NULL; + _gee_linked_list_node_free0 (n); + n = _tmp2_; + _tmp3_ = n; + _tmp4_ = _tmp3_->next; + _tmp3_->next = NULL; + _gee_linked_list_node_free0 (self->priv->_head); + self->priv->_head = _tmp4_; + _tmp5_ = self->priv->_head; + next = _tmp5_; + } else { + GeeLinkedListNode* _tmp6_; + GeeLinkedListNode* _tmp7_; + GeeLinkedListNode* _tmp8_; + GeeLinkedListNode* _tmp9_; + GeeLinkedListNode* _tmp10_; + GeeLinkedListNode* _tmp11_; + GeeLinkedListNode* _tmp12_; + GeeLinkedListNode* _tmp13_; + _tmp6_ = _n; + _tmp7_ = _tmp6_->prev; + _tmp8_ = _tmp7_->next; + _tmp7_->next = NULL; + _gee_linked_list_node_free0 (n); + n = _tmp8_; + _tmp9_ = n; + _tmp10_ = _tmp9_->prev; + _tmp11_ = n; + _tmp12_ = _tmp11_->next; + _tmp11_->next = NULL; + _gee_linked_list_node_free0 (_tmp10_->next); + _tmp10_->next = _tmp12_; + _tmp13_ = _tmp10_->next; + next = _tmp13_; + } + _tmp14_ = n; + _tmp15_ = self->priv->_tail; + if (_tmp14_ == _tmp15_) { + GeeLinkedListNode* _tmp16_; + GeeLinkedListNode* _tmp17_; + _tmp16_ = n; + _tmp17_ = _tmp16_->prev; + self->priv->_tail = _tmp17_; + } else { + GeeLinkedListNode* _tmp18_; + GeeLinkedListNode* _tmp19_; + GeeLinkedListNode* _tmp20_; + _tmp18_ = next; + _tmp19_ = n; + _tmp20_ = _tmp19_->prev; + _tmp18_->prev = _tmp20_; + } + _tmp21_ = n; + _tmp21_->prev = NULL; + _tmp22_ = n; + _gee_linked_list_node_free0 (_tmp22_->next); + _tmp22_->next = NULL; + _tmp23_ = n; + ((_tmp23_->data == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp23_->data = (self->priv->g_destroy_func (_tmp23_->data), NULL)); + _tmp23_->data = NULL; + _tmp24_ = self->priv->_stamp; + self->priv->_stamp = _tmp24_ + 1; + _tmp25_ = self->priv->_size; + self->priv->_size = _tmp25_ - 1; + _gee_linked_list_node_free0 (n); +} + + +GEqualFunc gee_linked_list_get_equal_func (GeeLinkedList* self) { + GEqualFunc result; + GEqualFunc _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->_equal_func; + result = _tmp0_; + return result; +} + + +static void gee_linked_list_set_equal_func (GeeLinkedList* self, GEqualFunc value) { + GEqualFunc _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = value; + self->priv->_equal_func = _tmp0_; + g_object_notify ((GObject *) self, "equal-func"); +} + + +static gint gee_linked_list_real_get_size (GeeAbstractCollection* base) { + gint result; + GeeLinkedList* self; + gint _tmp0_; + self = (GeeLinkedList*) base; + _tmp0_ = self->priv->_size; + result = _tmp0_; + return result; +} + + +static gint gee_linked_list_real_get_capacity (GeeQueue* base) { + gint result; + GeeLinkedList* self; + self = (GeeLinkedList*) base; + result = GEE_QUEUE_UNBOUNDED_CAPACITY; + return result; +} + + +static gint gee_linked_list_real_get_remaining_capacity (GeeQueue* base) { + gint result; + GeeLinkedList* self; + self = (GeeLinkedList*) base; + result = GEE_QUEUE_UNBOUNDED_CAPACITY; + return result; +} + + +static gboolean gee_linked_list_real_get_is_full (GeeQueue* base) { + gboolean result; + GeeLinkedList* self; + self = (GeeLinkedList*) base; + result = FALSE; + return result; +} + + +static GeeLinkedListNode* gee_linked_list_node_new (gpointer data) { + GeeLinkedListNode* self; + gconstpointer _tmp0_; + self = g_slice_new0 (GeeLinkedListNode); + gee_linked_list_node_instance_init (self); + _tmp0_ = data; + self->data = _tmp0_; + return self; +} + + +static void gee_linked_list_node_instance_init (GeeLinkedListNode * self) { + self->prev = NULL; + self->next = NULL; +} + + +static void gee_linked_list_node_free (GeeLinkedListNode* self) { + _gee_linked_list_node_free0 (self->next); + g_slice_free (GeeLinkedListNode, self); +} + + +static GeeLinkedListIterator* gee_linked_list_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeLinkedList* list) { + GeeLinkedListIterator * self = NULL; + GeeLinkedList* _tmp0_; + GeeLinkedList* _tmp1_; + GeeLinkedList* _tmp2_; + gint _tmp3_; + g_return_val_if_fail (list != NULL, NULL); + self = (GeeLinkedListIterator*) g_object_new (object_type, NULL); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = list; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->_list); + self->priv->_list = _tmp1_; + self->priv->position = NULL; + self->priv->_index = -1; + _tmp2_ = list; + _tmp3_ = _tmp2_->priv->_stamp; + self->priv->_stamp = _tmp3_; + return self; +} + + +static GeeLinkedListIterator* gee_linked_list_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeLinkedList* list) { + return gee_linked_list_iterator_construct (GEE_LINKED_LIST_TYPE_ITERATOR, g_type, g_dup_func, g_destroy_func, list); +} + + +static gboolean gee_linked_list_iterator_real_next (GeeIterator* base) { + GeeLinkedListIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeLinkedList* _tmp1_; + gint _tmp2_; + gboolean _tmp3_ = FALSE; + gboolean _tmp4_; + gboolean _tmp6_; + self = (GeeLinkedListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "this._stamp == this._list._stamp"); + _tmp4_ = self->priv->removed; + if (_tmp4_) { + GeeLinkedListNode* _tmp5_; + _tmp5_ = self->priv->position; + _tmp3_ = _tmp5_ != NULL; + } else { + _tmp3_ = FALSE; + } + _tmp6_ = _tmp3_; + if (_tmp6_) { + self->priv->removed = FALSE; + result = TRUE; + return result; + } else { + gboolean _tmp7_ = FALSE; + gboolean _tmp8_; + gboolean _tmp11_; + _tmp8_ = self->priv->started; + if (!_tmp8_) { + GeeLinkedList* _tmp9_; + GeeLinkedListNode* _tmp10_; + _tmp9_ = self->priv->_list; + _tmp10_ = _tmp9_->priv->_head; + _tmp7_ = _tmp10_ != NULL; + } else { + _tmp7_ = FALSE; + } + _tmp11_ = _tmp7_; + if (_tmp11_) { + GeeLinkedList* _tmp12_; + GeeLinkedListNode* _tmp13_; + gint _tmp14_; + self->priv->started = TRUE; + _tmp12_ = self->priv->_list; + _tmp13_ = _tmp12_->priv->_head; + self->priv->position = _tmp13_; + _tmp14_ = self->priv->_index; + self->priv->_index = _tmp14_ + 1; + result = TRUE; + return result; + } else { + gboolean _tmp15_ = FALSE; + GeeLinkedListNode* _tmp16_; + gboolean _tmp19_; + _tmp16_ = self->priv->position; + if (_tmp16_ != NULL) { + GeeLinkedListNode* _tmp17_; + GeeLinkedListNode* _tmp18_; + _tmp17_ = self->priv->position; + _tmp18_ = _tmp17_->next; + _tmp15_ = _tmp18_ != NULL; + } else { + _tmp15_ = FALSE; + } + _tmp19_ = _tmp15_; + if (_tmp19_) { + GeeLinkedListNode* _tmp20_; + GeeLinkedListNode* _tmp21_; + gint _tmp22_; + _tmp20_ = self->priv->position; + _tmp21_ = _tmp20_->next; + self->priv->position = _tmp21_; + _tmp22_ = self->priv->_index; + self->priv->_index = _tmp22_ + 1; + result = TRUE; + return result; + } + } + } + result = FALSE; + return result; +} + + +static gboolean gee_linked_list_iterator_real_has_next (GeeIterator* base) { + GeeLinkedListIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeLinkedList* _tmp1_; + gint _tmp2_; + gboolean _tmp3_; + self = (GeeLinkedListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "this._stamp == this._list._stamp"); + _tmp3_ = self->priv->removed; + if (_tmp3_) { + GeeLinkedListNode* _tmp4_; + _tmp4_ = self->priv->position; + result = _tmp4_ != NULL; + return result; + } else { + gboolean _tmp5_; + _tmp5_ = self->priv->started; + if (!_tmp5_) { + GeeLinkedList* _tmp6_; + GeeLinkedListNode* _tmp7_; + _tmp6_ = self->priv->_list; + _tmp7_ = _tmp6_->priv->_head; + result = _tmp7_ != NULL; + return result; + } else { + GeeLinkedListNode* _tmp8_; + _tmp8_ = self->priv->position; + if (_tmp8_ != NULL) { + GeeLinkedListNode* _tmp9_; + GeeLinkedListNode* _tmp10_; + _tmp9_ = self->priv->position; + _tmp10_ = _tmp9_->next; + result = _tmp10_ != NULL; + return result; + } + } + } + result = FALSE; + return result; +} + + +static gboolean gee_linked_list_iterator_real_first (GeeIterator* base) { + GeeLinkedListIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeLinkedList* _tmp1_; + gint _tmp2_; + GeeLinkedList* _tmp3_; + gint _tmp4_; + gint _tmp5_; + GeeLinkedList* _tmp6_; + GeeLinkedListNode* _tmp7_; + GeeLinkedListNode* _tmp8_; + self = (GeeLinkedListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "this._stamp == this._list._stamp"); + _tmp3_ = self->priv->_list; + _tmp4_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp3_); + _tmp5_ = _tmp4_; + if (_tmp5_ == 0) { + result = FALSE; + return result; + } + _tmp6_ = self->priv->_list; + _tmp7_ = _tmp6_->priv->_head; + self->priv->position = _tmp7_; + self->priv->started = TRUE; + self->priv->_index = 0; + self->priv->removed = FALSE; + _tmp8_ = self->priv->position; + result = _tmp8_ != NULL; + return result; +} + + +static gpointer gee_linked_list_iterator_real_get (GeeIterator* base) { + GeeLinkedListIterator * self; + gpointer result = NULL; + gint _tmp0_; + GeeLinkedList* _tmp1_; + gint _tmp2_; + GeeLinkedListNode* _tmp3_; + GeeLinkedListNode* _tmp4_; + gconstpointer _tmp5_; + gpointer _tmp6_; + self = (GeeLinkedListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "this._stamp == this._list._stamp"); + _tmp3_ = self->priv->position; + _vala_assert (_tmp3_ != NULL, "this.position != null"); + _tmp4_ = self->priv->position; + _tmp5_ = _tmp4_->data; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + result = _tmp6_; + return result; +} + + +static void gee_linked_list_iterator_real_remove (GeeIterator* base) { + GeeLinkedListIterator * self; + gint _tmp0_; + GeeLinkedList* _tmp1_; + gint _tmp2_; + GeeLinkedListNode* _tmp3_; + GeeLinkedListNode* _tmp4_; + GeeLinkedListNode* _tmp5_; + GeeLinkedListNode* new_position; + GeeLinkedListNode* _tmp6_; + GeeLinkedList* _tmp7_; + GeeLinkedListNode* _tmp8_; + GeeLinkedListNode* _tmp9_; + GeeLinkedList* _tmp10_; + gint _tmp11_; + self = (GeeLinkedListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "this._stamp == this._list._stamp"); + _tmp3_ = self->priv->position; + _vala_assert (_tmp3_ != NULL, "this.position != null"); + _tmp4_ = self->priv->position; + _tmp5_ = _tmp4_->next; + new_position = _tmp5_; + _tmp6_ = new_position; + if (_tmp6_ == NULL) { + self->priv->started = FALSE; + } + _tmp7_ = self->priv->_list; + _tmp8_ = self->priv->position; + _gee_linked_list_remove_node (_tmp7_, _tmp8_); + _tmp9_ = new_position; + self->priv->position = _tmp9_; + self->priv->removed = TRUE; + _tmp10_ = self->priv->_list; + _tmp11_ = _tmp10_->priv->_stamp; + self->priv->_stamp = _tmp11_; +} + + +static gboolean gee_linked_list_iterator_real_previous (GeeBidirIterator* base) { + GeeLinkedListIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeLinkedList* _tmp1_; + gint _tmp2_; + gboolean _tmp3_; + self = (GeeLinkedListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "this._stamp == this._list._stamp"); + _tmp3_ = self->priv->started; + if (!_tmp3_) { + self->priv->position = NULL; + result = FALSE; + return result; + } else { + gboolean _tmp4_ = FALSE; + GeeLinkedListNode* _tmp5_; + gboolean _tmp8_; + _tmp5_ = self->priv->position; + if (_tmp5_ != NULL) { + GeeLinkedListNode* _tmp6_; + GeeLinkedListNode* _tmp7_; + _tmp6_ = self->priv->position; + _tmp7_ = _tmp6_->prev; + _tmp4_ = _tmp7_ != NULL; + } else { + _tmp4_ = FALSE; + } + _tmp8_ = _tmp4_; + if (_tmp8_) { + GeeLinkedListNode* _tmp9_; + GeeLinkedListNode* _tmp10_; + gint _tmp11_; + _tmp9_ = self->priv->position; + _tmp10_ = _tmp9_->prev; + self->priv->position = _tmp10_; + _tmp11_ = self->priv->_index; + self->priv->_index = _tmp11_ - 1; + result = TRUE; + return result; + } + } + result = FALSE; + return result; +} + + +static gboolean gee_linked_list_iterator_real_has_previous (GeeBidirIterator* base) { + GeeLinkedListIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeLinkedList* _tmp1_; + gint _tmp2_; + gboolean _tmp3_; + self = (GeeLinkedListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "this._stamp == this._list._stamp"); + _tmp3_ = self->priv->started; + if (!_tmp3_) { + result = FALSE; + return result; + } else { + GeeLinkedListNode* _tmp4_; + _tmp4_ = self->priv->position; + if (_tmp4_ != NULL) { + GeeLinkedListNode* _tmp5_; + GeeLinkedListNode* _tmp6_; + _tmp5_ = self->priv->position; + _tmp6_ = _tmp5_->prev; + result = _tmp6_ != NULL; + return result; + } + } + result = FALSE; + return result; +} + + +static gboolean gee_linked_list_iterator_real_last (GeeBidirIterator* base) { + GeeLinkedListIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeLinkedList* _tmp1_; + gint _tmp2_; + GeeLinkedList* _tmp3_; + gint _tmp4_; + gint _tmp5_; + GeeLinkedList* _tmp6_; + GeeLinkedListNode* _tmp7_; + GeeLinkedList* _tmp8_; + gint _tmp9_; + GeeLinkedListNode* _tmp10_; + self = (GeeLinkedListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "this._stamp == this._list._stamp"); + _tmp3_ = self->priv->_list; + _tmp4_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp3_); + _tmp5_ = _tmp4_; + if (_tmp5_ == 0) { + result = FALSE; + return result; + } + _tmp6_ = self->priv->_list; + _tmp7_ = _tmp6_->priv->_tail; + self->priv->position = _tmp7_; + self->priv->started = TRUE; + _tmp8_ = self->priv->_list; + _tmp9_ = _tmp8_->priv->_size; + self->priv->_index = _tmp9_ - 1; + _tmp10_ = self->priv->position; + result = _tmp10_ != NULL; + return result; +} + + +static void gee_linked_list_iterator_real_set (GeeListIterator* base, gconstpointer item) { + GeeLinkedListIterator * self; + gint _tmp0_; + GeeLinkedList* _tmp1_; + gint _tmp2_; + GeeLinkedListNode* _tmp3_; + GeeLinkedListNode* _tmp4_; + gconstpointer _tmp5_; + gpointer _tmp6_; + self = (GeeLinkedListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "this._stamp == this._list._stamp"); + _tmp3_ = self->priv->position; + _vala_assert (_tmp3_ != NULL, "this.position != null"); + _tmp4_ = self->priv->position; + _tmp5_ = item; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + ((_tmp4_->data == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp4_->data = (self->priv->g_destroy_func (_tmp4_->data), NULL)); + _tmp4_->data = _tmp6_; +} + + +static void gee_linked_list_iterator_real_insert (GeeListIterator* base, gconstpointer item) { + GeeLinkedListIterator * self; + gint _tmp0_; + GeeLinkedList* _tmp1_; + gint _tmp2_; + GeeLinkedListNode* _tmp3_; + gconstpointer _tmp4_; + gpointer _tmp5_; + GeeLinkedListNode* _tmp6_; + GeeLinkedListNode* n; + GeeLinkedListNode* _tmp7_; + GeeLinkedListNode* _tmp8_; + GeeLinkedList* _tmp31_; + gint _tmp32_; + gint _tmp33_; + GeeLinkedList* _tmp34_; + gint _tmp35_; + self = (GeeLinkedListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "this._stamp == this._list._stamp"); + _tmp3_ = self->priv->position; + _vala_assert (_tmp3_ != NULL, "this.position != null"); + _tmp4_ = item; + _tmp5_ = ((_tmp4_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp4_) : ((gpointer) _tmp4_); + _tmp6_ = gee_linked_list_node_new (_tmp5_); + n = _tmp6_; + _tmp7_ = self->priv->position; + _tmp8_ = _tmp7_->prev; + if (_tmp8_ != NULL) { + GeeLinkedListNode* _tmp9_; + GeeLinkedListNode* _tmp10_; + GeeLinkedListNode* _tmp11_; + GeeLinkedListNode* position; + GeeLinkedListNode* _tmp12_; + GeeLinkedListNode* _tmp13_; + GeeLinkedListNode* _tmp14_; + GeeLinkedListNode* _tmp15_; + GeeLinkedListNode* _tmp16_; + GeeLinkedListNode* _tmp17_; + GeeLinkedListNode* _tmp18_; + GeeLinkedListNode* _tmp19_; + GeeLinkedListNode* _n; + GeeLinkedListNode* _tmp20_; + GeeLinkedListNode* _tmp21_; + GeeLinkedListNode* _tmp22_; + _tmp9_ = self->priv->position; + _tmp10_ = _tmp9_->prev; + _tmp11_ = _tmp10_->next; + _tmp10_->next = NULL; + position = _tmp11_; + _tmp12_ = n; + _tmp13_ = position; + _tmp14_ = _tmp13_->prev; + _tmp12_->prev = _tmp14_; + _tmp15_ = position; + _tmp16_ = n; + _tmp15_->prev = _tmp16_; + _tmp17_ = n; + _tmp18_ = position; + position = NULL; + _gee_linked_list_node_free0 (_tmp17_->next); + _tmp17_->next = _tmp18_; + _tmp19_ = n; + _n = _tmp19_; + _tmp20_ = _n; + _tmp21_ = _tmp20_->prev; + _tmp22_ = n; + n = NULL; + _gee_linked_list_node_free0 (_tmp21_->next); + _tmp21_->next = _tmp22_; + _gee_linked_list_node_free0 (position); + } else { + GeeLinkedList* _tmp23_; + GeeLinkedListNode* _tmp24_; + GeeLinkedListNode* position; + GeeLinkedListNode* _tmp25_; + GeeLinkedListNode* _tmp26_; + GeeLinkedListNode* _tmp27_; + GeeLinkedListNode* _tmp28_; + GeeLinkedList* _tmp29_; + GeeLinkedListNode* _tmp30_; + _tmp23_ = self->priv->_list; + _tmp24_ = _tmp23_->priv->_head; + _tmp23_->priv->_head = NULL; + position = _tmp24_; + _tmp25_ = position; + _tmp26_ = n; + _tmp25_->prev = _tmp26_; + _tmp27_ = n; + _tmp28_ = position; + position = NULL; + _gee_linked_list_node_free0 (_tmp27_->next); + _tmp27_->next = _tmp28_; + _tmp29_ = self->priv->_list; + _tmp30_ = n; + n = NULL; + _gee_linked_list_node_free0 (_tmp29_->priv->_head); + _tmp29_->priv->_head = _tmp30_; + _gee_linked_list_node_free0 (position); + } + _tmp31_ = self->priv->_list; + _tmp32_ = _tmp31_->priv->_size; + _tmp31_->priv->_size = _tmp32_ + 1; + _tmp33_ = self->priv->_index; + self->priv->_index = _tmp33_ + 1; + _tmp34_ = self->priv->_list; + _tmp35_ = _tmp34_->priv->_stamp; + self->priv->_stamp = _tmp35_; + _gee_linked_list_node_free0 (n); +} + + +static void gee_linked_list_iterator_real_add (GeeListIterator* base, gconstpointer item) { + GeeLinkedListIterator * self; + gint _tmp0_; + GeeLinkedList* _tmp1_; + gint _tmp2_; + GeeLinkedListNode* _tmp3_; + gconstpointer _tmp4_; + gpointer _tmp5_; + GeeLinkedListNode* _tmp6_; + GeeLinkedListNode* n; + GeeLinkedListNode* _tmp7_; + GeeLinkedListNode* _tmp8_; + GeeLinkedListNode* _tmp17_; + GeeLinkedListNode* _tmp18_; + GeeLinkedListNode* _tmp19_; + GeeLinkedListNode* _tmp20_; + GeeLinkedListNode* _tmp21_; + GeeLinkedListNode* _tmp22_; + GeeLinkedListNode* _tmp23_; + GeeLinkedList* _tmp24_; + gint _tmp25_; + gint _tmp26_; + GeeLinkedList* _tmp27_; + gint _tmp28_; + self = (GeeLinkedListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "this._stamp == this._list._stamp"); + _tmp3_ = self->priv->position; + _vala_assert (_tmp3_ != NULL, "this.position != null"); + _tmp4_ = item; + _tmp5_ = ((_tmp4_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp4_) : ((gpointer) _tmp4_); + _tmp6_ = gee_linked_list_node_new (_tmp5_); + n = _tmp6_; + _tmp7_ = self->priv->position; + _tmp8_ = _tmp7_->next; + if (_tmp8_ != NULL) { + GeeLinkedListNode* _tmp9_; + GeeLinkedListNode* _tmp10_; + GeeLinkedListNode* _tmp11_; + GeeLinkedListNode* _tmp12_; + GeeLinkedListNode* _tmp13_; + GeeLinkedListNode* _tmp14_; + _tmp9_ = self->priv->position; + _tmp10_ = _tmp9_->next; + _tmp11_ = n; + _tmp10_->prev = _tmp11_; + _tmp12_ = n; + _tmp13_ = self->priv->position; + _tmp14_ = _tmp13_->next; + _tmp13_->next = NULL; + _gee_linked_list_node_free0 (_tmp12_->next); + _tmp12_->next = _tmp14_; + } else { + GeeLinkedList* _tmp15_; + GeeLinkedListNode* _tmp16_; + _tmp15_ = self->priv->_list; + _tmp16_ = n; + _tmp15_->priv->_tail = _tmp16_; + } + _tmp17_ = self->priv->position; + _tmp18_ = n; + n = NULL; + _gee_linked_list_node_free0 (_tmp17_->next); + _tmp17_->next = _tmp18_; + _tmp19_ = self->priv->position; + _tmp20_ = _tmp19_->next; + _tmp21_ = self->priv->position; + _tmp20_->prev = _tmp21_; + _tmp22_ = self->priv->position; + _tmp23_ = _tmp22_->next; + self->priv->position = _tmp23_; + _tmp24_ = self->priv->_list; + _tmp25_ = _tmp24_->priv->_size; + _tmp24_->priv->_size = _tmp25_ + 1; + _tmp26_ = self->priv->_index; + self->priv->_index = _tmp26_ + 1; + _tmp27_ = self->priv->_list; + _tmp28_ = _tmp27_->priv->_stamp; + self->priv->_stamp = _tmp28_; + _gee_linked_list_node_free0 (n); +} + + +static gint gee_linked_list_iterator_real_index (GeeListIterator* base) { + GeeLinkedListIterator * self; + gint result = 0; + gint _tmp0_; + GeeLinkedList* _tmp1_; + gint _tmp2_; + GeeLinkedListNode* _tmp3_; + gint _tmp4_; + self = (GeeLinkedListIterator*) base; + _tmp0_ = self->priv->_stamp; + _tmp1_ = self->priv->_list; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "this._stamp == this._list._stamp"); + _tmp3_ = self->priv->position; + _vala_assert (_tmp3_ != NULL, "this.position != null"); + _tmp4_ = self->priv->_index; + result = _tmp4_; + return result; +} + + +static void gee_linked_list_iterator_class_init (GeeLinkedListIteratorClass * klass) { + gee_linked_list_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeLinkedListIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_linked_list_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_linked_list_iterator_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_linked_list_iterator_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_LINKED_LIST_ITERATOR_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_LINKED_LIST_ITERATOR_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_LINKED_LIST_ITERATOR_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_linked_list_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) { + gee_linked_list_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->next = (gboolean (*)(GeeIterator*)) gee_linked_list_iterator_real_next; + iface->has_next = (gboolean (*)(GeeIterator*)) gee_linked_list_iterator_real_has_next; + iface->first = (gboolean (*)(GeeIterator*)) gee_linked_list_iterator_real_first; + iface->get = (gpointer (*)(GeeIterator*)) gee_linked_list_iterator_real_get; + iface->remove = (void (*)(GeeIterator*)) gee_linked_list_iterator_real_remove; +} + + +static void gee_linked_list_iterator_gee_bidir_iterator_interface_init (GeeBidirIteratorIface * iface) { + gee_linked_list_iterator_gee_bidir_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->previous = (gboolean (*)(GeeBidirIterator*)) gee_linked_list_iterator_real_previous; + iface->has_previous = (gboolean (*)(GeeBidirIterator*)) gee_linked_list_iterator_real_has_previous; + iface->last = (gboolean (*)(GeeBidirIterator*)) gee_linked_list_iterator_real_last; +} + + +static void gee_linked_list_iterator_gee_list_iterator_interface_init (GeeListIteratorIface * iface) { + gee_linked_list_iterator_gee_list_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->set = (void (*)(GeeListIterator*, gconstpointer)) gee_linked_list_iterator_real_set; + iface->insert = (void (*)(GeeListIterator*, gconstpointer)) gee_linked_list_iterator_real_insert; + iface->add = (void (*)(GeeListIterator*, gconstpointer)) gee_linked_list_iterator_real_add; + iface->index = (gint (*)(GeeListIterator*)) gee_linked_list_iterator_real_index; +} + + +static void gee_linked_list_iterator_instance_init (GeeLinkedListIterator * self) { + self->priv = GEE_LINKED_LIST_ITERATOR_GET_PRIVATE (self); + self->priv->started = FALSE; + self->priv->removed = FALSE; +} + + +static void gee_linked_list_iterator_finalize (GObject* obj) { + GeeLinkedListIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_LINKED_LIST_TYPE_ITERATOR, GeeLinkedListIterator); + _g_object_unref0 (self->priv->_list); + G_OBJECT_CLASS (gee_linked_list_iterator_parent_class)->finalize (obj); +} + + +static GType gee_linked_list_iterator_get_type (void) { + static volatile gsize gee_linked_list_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_linked_list_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeLinkedListIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_linked_list_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeLinkedListIterator), 0, (GInstanceInitFunc) gee_linked_list_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_linked_list_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + static const GInterfaceInfo gee_bidir_iterator_info = { (GInterfaceInitFunc) gee_linked_list_iterator_gee_bidir_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + static const GInterfaceInfo gee_list_iterator_info = { (GInterfaceInitFunc) gee_linked_list_iterator_gee_list_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_linked_list_iterator_type_id; + gee_linked_list_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeLinkedListIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_linked_list_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info); + g_type_add_interface_static (gee_linked_list_iterator_type_id, GEE_TYPE_BIDIR_ITERATOR, &gee_bidir_iterator_info); + g_type_add_interface_static (gee_linked_list_iterator_type_id, GEE_TYPE_LIST_ITERATOR, &gee_list_iterator_info); + g_once_init_leave (&gee_linked_list_iterator_type_id__volatile, gee_linked_list_iterator_type_id); + } + return gee_linked_list_iterator_type_id__volatile; +} + + +static void _vala_gee_linked_list_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeLinkedListIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_LINKED_LIST_TYPE_ITERATOR, GeeLinkedListIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_linked_list_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeLinkedListIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_LINKED_LIST_TYPE_ITERATOR, GeeLinkedListIterator); + switch (property_id) { + case GEE_LINKED_LIST_ITERATOR_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_LINKED_LIST_ITERATOR_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_LINKED_LIST_ITERATOR_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void gee_linked_list_class_init (GeeLinkedListClass * klass) { + gee_linked_list_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeLinkedListPrivate)); + GEE_ABSTRACT_COLLECTION_CLASS (klass)->iterator = gee_linked_list_real_iterator; + GEE_ABSTRACT_LIST_CLASS (klass)->list_iterator = gee_linked_list_real_list_iterator; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains = gee_linked_list_real_contains; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add = gee_linked_list_real_add; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove = gee_linked_list_real_remove; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->clear = gee_linked_list_real_clear; + GEE_ABSTRACT_LIST_CLASS (klass)->get = gee_linked_list_real_get; + GEE_ABSTRACT_LIST_CLASS (klass)->set = gee_linked_list_real_set; + GEE_ABSTRACT_LIST_CLASS (klass)->index_of = gee_linked_list_real_index_of; + GEE_ABSTRACT_LIST_CLASS (klass)->insert = gee_linked_list_real_insert; + GEE_ABSTRACT_LIST_CLASS (klass)->remove_at = gee_linked_list_real_remove_at; + GEE_ABSTRACT_LIST_CLASS (klass)->slice = gee_linked_list_real_slice; + GEE_ABSTRACT_LIST_CLASS (klass)->first = gee_linked_list_real_first; + GEE_ABSTRACT_LIST_CLASS (klass)->last = gee_linked_list_real_last; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_size = gee_linked_list_real_get_size; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_linked_list_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_linked_list_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_linked_list_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_LINKED_LIST_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_LINKED_LIST_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_LINKED_LIST_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + /** + * The elements' equality testing function. + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_LINKED_LIST_EQUAL_FUNC, g_param_spec_pointer ("equal-func", "equal-func", "equal-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_LINKED_LIST_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_LINKED_LIST_CAPACITY, g_param_spec_int ("capacity", "capacity", "capacity", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_LINKED_LIST_REMAINING_CAPACITY, g_param_spec_int ("remaining-capacity", "remaining-capacity", "remaining-capacity", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_LINKED_LIST_IS_FULL, g_param_spec_boolean ("is-full", "is-full", "is-full", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_linked_list_gee_queue_interface_init (GeeQueueIface * iface) { + gee_linked_list_gee_queue_parent_iface = g_type_interface_peek_parent (iface); + iface->offer = (gboolean (*)(GeeQueue*, gconstpointer)) gee_linked_list_real_offer; + iface->peek = (gpointer (*)(GeeQueue*)) gee_linked_list_real_peek; + iface->poll = (gpointer (*)(GeeQueue*)) gee_linked_list_real_poll; + iface->drain = (gint (*)(GeeQueue*, GeeCollection*, gint)) gee_linked_list_real_drain; + iface->get_capacity = gee_linked_list_real_get_capacity; + iface->get_remaining_capacity = gee_linked_list_real_get_remaining_capacity; + iface->get_is_full = gee_linked_list_real_get_is_full; +} + + +static void gee_linked_list_gee_deque_interface_init (GeeDequeIface * iface) { + gee_linked_list_gee_deque_parent_iface = g_type_interface_peek_parent (iface); + iface->offer_head = (gboolean (*)(GeeDeque*, gconstpointer)) gee_linked_list_real_offer_head; + iface->peek_head = (gpointer (*)(GeeDeque*)) gee_linked_list_real_peek_head; + iface->poll_head = (gpointer (*)(GeeDeque*)) gee_linked_list_real_poll_head; + iface->drain_head = (gint (*)(GeeDeque*, GeeCollection*, gint)) gee_linked_list_real_drain_head; + iface->offer_tail = (gboolean (*)(GeeDeque*, gconstpointer)) gee_linked_list_real_offer_tail; + iface->peek_tail = (gpointer (*)(GeeDeque*)) gee_linked_list_real_peek_tail; + iface->poll_tail = (gpointer (*)(GeeDeque*)) gee_linked_list_real_poll_tail; + iface->drain_tail = (gint (*)(GeeDeque*, GeeCollection*, gint)) gee_linked_list_real_drain_tail; +} + + +static void gee_linked_list_instance_init (GeeLinkedList * self) { + self->priv = GEE_LINKED_LIST_GET_PRIVATE (self); + self->priv->_size = 0; + self->priv->_stamp = 0; + self->priv->_head = NULL; + self->priv->_tail = NULL; +} + + +static void gee_linked_list_finalize (GObject* obj) { + GeeLinkedList * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_LINKED_LIST, GeeLinkedList); + gee_abstract_collection_clear ((GeeAbstractCollection*) self); + _gee_linked_list_node_free0 (self->priv->_head); + G_OBJECT_CLASS (gee_linked_list_parent_class)->finalize (obj); +} + + +/** + * Doubly-linked list implementation of the {@link List} interface. + * + * This implementation is pretty well designed for highly mutable data. When + * indexed access is privileged prefer using {@link ArrayList}. + * + * @see ArrayList + */ +GType gee_linked_list_get_type (void) { + static volatile gsize gee_linked_list_type_id__volatile = 0; + if (g_once_init_enter (&gee_linked_list_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeLinkedListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_linked_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeLinkedList), 0, (GInstanceInitFunc) gee_linked_list_instance_init, NULL }; + static const GInterfaceInfo gee_queue_info = { (GInterfaceInitFunc) gee_linked_list_gee_queue_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + static const GInterfaceInfo gee_deque_info = { (GInterfaceInitFunc) gee_linked_list_gee_deque_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_linked_list_type_id; + gee_linked_list_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_LIST, "GeeLinkedList", &g_define_type_info, 0); + g_type_add_interface_static (gee_linked_list_type_id, GEE_TYPE_QUEUE, &gee_queue_info); + g_type_add_interface_static (gee_linked_list_type_id, GEE_TYPE_DEQUE, &gee_deque_info); + g_once_init_leave (&gee_linked_list_type_id__volatile, gee_linked_list_type_id); + } + return gee_linked_list_type_id__volatile; +} + + +static void _vala_gee_linked_list_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeLinkedList * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_LINKED_LIST, GeeLinkedList); + switch (property_id) { + case GEE_LINKED_LIST_EQUAL_FUNC: + g_value_set_pointer (value, gee_linked_list_get_equal_func (self)); + break; + case GEE_LINKED_LIST_SIZE: + g_value_set_int (value, gee_abstract_collection_get_size ((GeeAbstractCollection*) self)); + break; + case GEE_LINKED_LIST_CAPACITY: + g_value_set_int (value, gee_queue_get_capacity ((GeeQueue*) self)); + break; + case GEE_LINKED_LIST_REMAINING_CAPACITY: + g_value_set_int (value, gee_queue_get_remaining_capacity ((GeeQueue*) self)); + break; + case GEE_LINKED_LIST_IS_FULL: + g_value_set_boolean (value, gee_queue_get_is_full ((GeeQueue*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_linked_list_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeLinkedList * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_LINKED_LIST, GeeLinkedList); + switch (property_id) { + case GEE_LINKED_LIST_EQUAL_FUNC: + gee_linked_list_set_equal_func (self, g_value_get_pointer (value)); + break; + case GEE_LINKED_LIST_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_LINKED_LIST_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_LINKED_LIST_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/gee/linkedlist.vala b/gee/linkedlist.vala new file mode 100644 index 0000000..5c9cfd3 --- /dev/null +++ b/gee/linkedlist.vala @@ -0,0 +1,625 @@ +/* linkedlist.vala + * + * Copyright (C) 2004-2005 Novell, Inc + * Copyright (C) 2005 David Waite + * Copyright (C) 2007-2008 Jürg Billeter + * Copyright (C) 2009 Mark Lee, Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Mark Lee + * Didier 'Ptitjes Villevalois + */ + +/** + * Doubly-linked list implementation of the {@link List} interface. + * + * This implementation is pretty well designed for highly mutable data. When + * indexed access is privileged prefer using {@link ArrayList}. + * + * @see ArrayList + */ +public class Gee.LinkedList : AbstractList, Queue, Deque { + private int _size = 0; + private int _stamp = 0; + private Node? _head = null; + private weak Node? _tail = null; + + /** + * The elements' equality testing function. + */ + public EqualFunc equal_func { private set; get; } + + /** + * Constructs a new, empty linked list. + * + * If not provided, the function parameter is requested to the + * {@link Functions} function factory methods. + * + * @param equal_func an optional element equality testing function + */ + public LinkedList (EqualFunc? equal_func = null) { + if (equal_func == null) { + equal_func = Functions.get_equal_func_for (typeof (G)); + } + this.equal_func = equal_func; + } + + ~LinkedList () { + this.clear (); + } + + /** + * {@inheritDoc} + */ + public override Gee.Iterator iterator () { + return new Iterator (this); + } + + /** + * {@inheritDoc} + */ + public override ListIterator list_iterator () { + return new Iterator (this); + } + + /** + * {@inheritDoc} + */ + public override int size { + get { return this._size; } + } + + /** + * {@inheritDoc} + */ + public override bool contains (G item) { + return this.index_of (item) != -1; + } + + /** + * {@inheritDoc} + */ + public override bool add (G item) { + Node n = new Node (item); + if (this._head == null && this._tail == null) { + this._tail = n; + this._head = (owned) n; + } else { + n.prev = this._tail; + this._tail.next = (owned) n; + this._tail = this._tail.next; + } + + // Adding items to the list during iterations is allowed. + //++this._stamp; + + this._size++; + return true; + } + + /** + * {@inheritDoc} + */ + public override bool remove (G item) { // Should remove only the first occurence (a test should be added) + for (weak Node n = this._head; n != null; n = n.next) { + if (this.equal_func (item, n.data)) { + this._remove_node (n); + return true; + } + } + return false; + } + + /** + * {@inheritDoc} + */ + public override void clear () { + while (_head != null) { + _remove_node (_head); + } + + ++this._stamp; + this._head = null; + this._tail = null; + this._size = 0; + } + + /** + * {@inheritDoc} + */ + public override G get (int index) { + assert (index >= 0); + assert (index < this._size); + + unowned Node? n = this._get_node_at (index); + assert (n != null); + return n.data; + } + + /** + * {@inheritDoc} + */ + public override void set (int index, G item) { + assert (index >= 0); + assert (index < this._size); + + unowned Node? n = this._get_node_at (index); + return_if_fail (n != null); + n.data = item; + } + + /** + * {@inheritDoc} + */ + public override int index_of (G item) { + int result = -1; + int idx = 0; + foreach (G node_item in this) { + if (this.equal_func (item, node_item)) { + result = idx; + break; + } else { + idx++; + } + } + return result; + } + + /** + * {@inheritDoc} + */ + public override void insert (int index, G item) { + assert (index >= 0); + assert (index <= this._size); + + if (index == this._size) { + this.add (item); + } else { + Node n = new Node (item); + if (index == 0) { + n.next = (owned) this._head; + n.next.prev = n; + this._head = (owned)n; + } else { + weak Node prev = this._head; + for (int i = 0; i < index - 1; i++) { + prev = prev.next; + } + n.prev = prev; + n.next = (owned) prev.next; + n.next.prev = n; + prev.next = (owned) n; + } + + // Adding items to the list during iterations is allowed. + //++this._stamp; + + this._size++; + } + } + + /** + * {@inheritDoc} + */ + public override G remove_at (int index) { + assert (index >= 0); + assert (index < this._size); + + unowned Node? n = this._get_node_at (index); + assert (n != null); + G element = n.data; + this._remove_node (n); + return element; + } + + /** + * {@inheritDoc} + */ + public override List? slice (int start, int stop) { + return_val_if_fail (start <= stop, null); + return_val_if_fail (start >= 0, null); + return_val_if_fail (stop <= this._size, null); + + List slice = new LinkedList (this.equal_func); + weak Node n = this._get_node_at (start); + for (int i = start; i < stop; i++) { + slice.add (n.data); + n = n.next; + } + + return slice; + } + + /** + * {@inheritDoc} + */ + public override G first () { + assert (_size > 0); + return _head.data; + } + + /** + * {@inheritDoc} + */ + public override G last () { + assert (_size > 0); + return _tail.data; + } + + /** + * {@inheritDoc} + */ + public int capacity { + get { return UNBOUNDED_CAPACITY; } + } + + /** + * {@inheritDoc} + */ + public int remaining_capacity { + get { return UNBOUNDED_CAPACITY; } + } + + /** + * {@inheritDoc} + */ + public bool is_full { + get { return false; } + } + + /** + * {@inheritDoc} + */ + public bool offer (G element) { + return offer_tail (element); + } + + /** + * {@inheritDoc} + */ + public G? peek () { + return peek_head (); + } + + /** + * {@inheritDoc} + */ + public G? poll () { + return poll_head (); + } + + /** + * {@inheritDoc} + */ + public int drain (Collection recipient, int amount = -1) { + return drain_head (recipient, amount); + } + + /** + * {@inheritDoc} + */ + public bool offer_head (G element) { + insert (0, element); + return true; + } + + /** + * {@inheritDoc} + */ + public G? peek_head () { + if (this._size == 0) { + return null; + } + return get (0); + } + + /** + * {@inheritDoc} + */ + public G? poll_head () { + if (this._size == 0) { + return null; + } + return remove_at (0); + } + + /** + * {@inheritDoc} + */ + public int drain_head (Collection recipient, int amount = -1) { + if (amount == -1) { + amount = this._size; + } + for (int i = 0; i < amount; i++) { + if (this._size == 0) { + return i; + } + recipient.add (remove_at (0)); + } + return amount; + } + + /** + * {@inheritDoc} + */ + public bool offer_tail (G element) { + return add (element); + } + + /** + * {@inheritDoc} + */ + public G? peek_tail () { + if (this._size == 0) { + return null; + } + return get (_size - 1); + } + + /** + * {@inheritDoc} + */ + public G? poll_tail () { + if (this._size == 0) { + return null; + } + return remove_at (_size - 1); + } + + /** + * {@inheritDoc} + */ + public int drain_tail (Collection recipient, int amount = -1) { + if (amount == -1) { + amount = this._size; + } + for (int i = 0; i < amount; i++) { + if (this._size == 0) { + return i; + } + recipient.add (remove_at (this._size - 1)); + } + return amount; + } + + [Compact] + private class Node { // Maybe a compact class should be used? + public G data; + public weak Node? prev = null; + public Node? next = null; + public Node (owned G data) { + this.data = data; + } + } + + private class Iterator : Object, Gee.Iterator, BidirIterator, ListIterator { + private bool started = false; + private bool removed = false; + private unowned Node? position; + private int _stamp; + private LinkedList _list; + private int _index; + + public Iterator (LinkedList list) { + this._list = list; + this.position = null; + this._index = -1; + this._stamp = list._stamp; + } + + public bool next () { + assert (this._stamp == this._list._stamp); + + if (this.removed && this.position != null) { + this.removed = false; + return true; + } else if (!this.started && this._list._head != null) { + this.started = true; + this.position = this._list._head; + this._index++; + return true; + } else if (this.position != null && this.position.next != null) { + this.position = this.position.next; + this._index++; + return true; + } + return false; + } + + public bool has_next () { + assert (this._stamp == this._list._stamp); + + if (this.removed) { + return this.position != null; + } else if (!this.started) { + return this._list._head != null; + } else if (this.position != null) { + return this.position.next != null; + } + return false; + } + + public bool first () { + assert (this._stamp == this._list._stamp); + if (this._list.size == 0) { + return false; + } + this.position = this._list._head; + this.started = true; + this._index = 0; + this.removed = false; + return this.position != null; + } + + public new G get () { + assert (this._stamp == this._list._stamp); + assert (this.position != null); + + return this.position.data; + } + + public void remove () { + assert (this._stamp == this._list._stamp); + assert (this.position != null); + + unowned Node? new_position = this.position.next; + if (new_position == null) { + started = false; + } + _list._remove_node (this.position); + this.position = new_position; + this.removed = true; + this._stamp = this._list._stamp; + } + + public bool previous () { + assert (this._stamp == this._list._stamp); + + if (!this.started) { + this.position = null; + return false; + } else if (this.position != null && this.position.prev != null) { + this.position = this.position.prev; + this._index--; + return true; + } + return false; + } + + public bool has_previous () { + assert (this._stamp == this._list._stamp); + + if (!this.started) { + return false; + } else if (this.position != null) { + return this.position.prev != null; + } + return false; + } + + public bool last () { + assert (this._stamp == this._list._stamp); + + if (this._list.size == 0) { + return false; + } + this.position = this._list._tail; + this.started = true; + this._index = this._list._size - 1; + return this.position != null; + } + + public new void set (G item) { + assert (this._stamp == this._list._stamp); + assert (this.position != null); + + this.position.data = item; + } + + public void insert (G item) { + assert (this._stamp == this._list._stamp); + assert (this.position != null); + + Node n = new Node (item); + if (this.position.prev != null) { + Node position = (owned) this.position.prev.next; + n.prev = position.prev; + position.prev = n; + n.next = (owned) position; + weak Node _n = n; + _n.prev.next = (owned) n; + } else { + Node position = (owned) this._list._head; + position.prev = n; + n.next = (owned) position; + this._list._head = (owned) n; + } + this._list._size++; + this._index++; + _stamp = _list._stamp; + } + + public void add (G item) { + assert (this._stamp == this._list._stamp); + assert (this.position != null); + + Node n = new Node (item); + if (this.position.next != null) { + this.position.next.prev = n; + n.next = (owned) this.position.next; + } else { + this._list._tail = n; + } + this.position.next = (owned) n; + this.position.next.prev = this.position; + this.position = this.position.next; + this._list._size++; + this._index++; + _stamp = _list._stamp; + } + + public int index () { + assert (this._stamp == this._list._stamp); + assert (this.position != null); + + return this._index; + } + } + + private unowned Node? _get_node_at (int index) { + unowned Node? n = null;; + if (index == 0) { + n = this._head; + } else if (index == this._size - 1) { + n = this._tail; + } else if (index <= this._size / 2) { + n = this._head; + for (int i = 0; index != i; i++) { + n = n.next; + } + } else { + n = this._tail; + for (int i = this._size - 1; index != i; i--) { + n = n.prev; + } + } + return n; + } + + private void _remove_node (Node _n) { + Node n; + weak Node next; + if (_n == this._head) { + n = (owned) this._head; + next = this._head = (owned) n.next; + } else { + n = (owned) _n.prev.next; + next = n.prev.next = (owned) n.next; + } + if (n == this._tail) { + this._tail = n.prev; + } else { + next.prev = n.prev; + } + n.prev = null; + n.next = null; + n.data = null; + ++this._stamp; + this._size--; + } +} + diff --git a/gee/list.c b/gee/list.c new file mode 100644 index 0000000..d8bdbe7 --- /dev/null +++ b/gee/list.c @@ -0,0 +1,390 @@ +/* list.c generated by valac 0.18.0, the Vala compiler + * generated from list.vala, do not modify */ + +/* list.vala + * + * Copyright (C) 2007 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_LIST (gee_list_get_type ()) +#define GEE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST, GeeList)) +#define GEE_IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST)) +#define GEE_LIST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST, GeeListIface)) + +typedef struct _GeeList GeeList; +typedef struct _GeeListIface GeeListIface; + +#define GEE_TYPE_BIDIR_ITERATOR (gee_bidir_iterator_get_type ()) +#define GEE_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIterator)) +#define GEE_IS_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_ITERATOR)) +#define GEE_BIDIR_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIteratorIface)) + +typedef struct _GeeBidirIterator GeeBidirIterator; +typedef struct _GeeBidirIteratorIface GeeBidirIteratorIface; + +#define GEE_TYPE_LIST_ITERATOR (gee_list_iterator_get_type ()) +#define GEE_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIterator)) +#define GEE_IS_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST_ITERATOR)) +#define GEE_LIST_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIteratorIface)) + +typedef struct _GeeListIterator GeeListIterator; +typedef struct _GeeListIteratorIface GeeListIteratorIface; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; + +#define GEE_TYPE_ABSTRACT_LIST (gee_abstract_list_get_type ()) +#define GEE_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractList)) +#define GEE_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass)) +#define GEE_IS_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_LIST)) +#define GEE_IS_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_LIST)) +#define GEE_ABSTRACT_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass)) + +typedef struct _GeeAbstractList GeeAbstractList; +typedef struct _GeeAbstractListClass GeeAbstractListClass; + +#define GEE_TYPE_LINKED_LIST (gee_linked_list_get_type ()) +#define GEE_LINKED_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LINKED_LIST, GeeLinkedList)) +#define GEE_LINKED_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_LINKED_LIST, GeeLinkedListClass)) +#define GEE_IS_LINKED_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LINKED_LIST)) +#define GEE_IS_LINKED_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_LINKED_LIST)) +#define GEE_LINKED_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_LINKED_LIST, GeeLinkedListClass)) + +typedef struct _GeeLinkedList GeeLinkedList; +typedef struct _GeeLinkedListClass GeeLinkedListClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeBidirIteratorIface { + GTypeInterface parent_iface; + gboolean (*previous) (GeeBidirIterator* self); + gboolean (*has_previous) (GeeBidirIterator* self); + gboolean (*last) (GeeBidirIterator* self); +}; + +struct _GeeListIteratorIface { + GTypeInterface parent_iface; + void (*set) (GeeListIterator* self, gconstpointer item); + void (*insert) (GeeListIterator* self, gconstpointer item); + void (*add) (GeeListIterator* self, gconstpointer item); + gint (*index) (GeeListIterator* self); +}; + +struct _GeeListIface { + GTypeInterface parent_iface; + GeeListIterator* (*list_iterator) (GeeList* self); + gpointer (*get) (GeeList* self, gint index); + void (*set) (GeeList* self, gint index, gconstpointer item); + gint (*index_of) (GeeList* self, gconstpointer item); + void (*insert) (GeeList* self, gint index, gconstpointer item); + gpointer (*remove_at) (GeeList* self, gint index); + GeeList* (*slice) (GeeList* self, gint start, gint stop); + gpointer (*first) (GeeList* self); + gpointer (*last) (GeeList* self); + void (*insert_all) (GeeList* self, gint index, GeeCollection* collection); + void (*sort) (GeeList* self, GCompareFunc compare_func); + GeeList* (*get_read_only_view) (GeeList* self); +}; + + + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_bidir_iterator_get_type (void) G_GNUC_CONST; +GType gee_list_iterator_get_type (void) G_GNUC_CONST; +GType gee_list_get_type (void) G_GNUC_CONST; +GeeListIterator* gee_list_list_iterator (GeeList* self); +gpointer gee_list_get (GeeList* self, gint index); +void gee_list_set (GeeList* self, gint index, gconstpointer item); +gint gee_list_index_of (GeeList* self, gconstpointer item); +void gee_list_insert (GeeList* self, gint index, gconstpointer item); +gpointer gee_list_remove_at (GeeList* self, gint index); +GeeList* gee_list_slice (GeeList* self, gint start, gint stop); +gpointer gee_list_first (GeeList* self); +gpointer gee_list_last (GeeList* self); +void gee_list_insert_all (GeeList* self, gint index, GeeCollection* collection); +void gee_list_sort (GeeList* self, GCompareFunc compare_func); +GeeList* gee_list_empty (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeLinkedList* gee_linked_list_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func); +GeeLinkedList* gee_linked_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func); +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_list_get_type (void) G_GNUC_CONST; +GType gee_linked_list_get_type (void) G_GNUC_CONST; +GeeList* gee_abstract_list_get_read_only_view (GeeAbstractList* self); +GeeList* gee_list_get_read_only_view (GeeList* self); + + +/** + * Returns a ListIterator that can be used for iteration over this list. + * + * @return a ListIterator that can be used for iteration over this list + */ +GeeListIterator* gee_list_list_iterator (GeeList* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_LIST_GET_INTERFACE (self)->list_iterator (self); +} + + +/** + * Returns the item at the specified index in this list. + * + * @param index zero-based index of the item to be returned + * + * @return the item at the specified index in the list + */ +gpointer gee_list_get (GeeList* self, gint index) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_LIST_GET_INTERFACE (self)->get (self, index); +} + + +/** + * Sets the item at the specified index in this list. + * + * @param index zero-based index of the item to be set + */ +void gee_list_set (GeeList* self, gint index, gconstpointer item) { + g_return_if_fail (self != NULL); + GEE_LIST_GET_INTERFACE (self)->set (self, index, item); +} + + +/** + * Returns the index of the first occurence of the specified item in + * this list. + * + * @return the index of the first occurence of the specified item, or + * -1 if the item could not be found + */ +gint gee_list_index_of (GeeList* self, gconstpointer item) { + g_return_val_if_fail (self != NULL, 0); + return GEE_LIST_GET_INTERFACE (self)->index_of (self, item); +} + + +/** + * Inserts an item into this list at the specified position. + * + * @param index zero-based index at which item is inserted + * @param item item to insert into the list + */ +void gee_list_insert (GeeList* self, gint index, gconstpointer item) { + g_return_if_fail (self != NULL); + GEE_LIST_GET_INTERFACE (self)->insert (self, index, item); +} + + +/** + * Removes the item at the specified index of this list. + * + * @param index zero-based index of the item to be removed + * + * @return the removed element + */ +gpointer gee_list_remove_at (GeeList* self, gint index) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_LIST_GET_INTERFACE (self)->remove_at (self, index); +} + + +/** + * Returns a slice of this list. + * + * @param start zero-based index of the begin of the slice + * @param stop zero-based index after the end of the slice + * + * @return A list containing a slice of this list + */ +GeeList* gee_list_slice (GeeList* self, gint start, gint stop) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_LIST_GET_INTERFACE (self)->slice (self, start, stop); +} + + +/** + * Returns the first item of the list. Fails if the list is empty. + * + * @return first item in the list + */ +gpointer gee_list_first (GeeList* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_LIST_GET_INTERFACE (self)->first (self); +} + + +/** + * Returns the last item of the list. Fails if the list is empty. + * + * @return last item in the list + */ +gpointer gee_list_last (GeeList* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_LIST_GET_INTERFACE (self)->last (self); +} + + +/** + * Inserts items into this list for the input collection at the + * specified position. + * + * @param index zero-based index of the items to be inserted + * @param collection collection of items to be inserted + */ +void gee_list_insert_all (GeeList* self, gint index, GeeCollection* collection) { + g_return_if_fail (self != NULL); + GEE_LIST_GET_INTERFACE (self)->insert_all (self, index, collection); +} + + +/** + * Sorts items by comparing with the specified compare function. + * + * @param compare_func compare function to use to compare items + */ +void gee_list_sort (GeeList* self, GCompareFunc compare_func) { + g_return_if_fail (self != NULL); + GEE_LIST_GET_INTERFACE (self)->sort (self, compare_func); +} + + +/** + * Returns an immutable empty list. + * + * @return an immutable empty list + */ +GeeList* gee_list_empty (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) { + GeeList* result = NULL; + GeeLinkedList* _tmp0_; + GeeLinkedList* _tmp1_; + GeeList* _tmp2_; + GeeList* _tmp3_; + GeeList* _tmp4_; + _tmp0_ = gee_linked_list_new (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, NULL); + _tmp1_ = _tmp0_; + _tmp2_ = gee_abstract_list_get_read_only_view ((GeeAbstractList*) _tmp1_); + _tmp3_ = _tmp2_; + _tmp4_ = _tmp3_; + _g_object_unref0 (_tmp1_); + result = _tmp4_; + return result; +} + + +GeeList* gee_list_get_read_only_view (GeeList* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_LIST_GET_INTERFACE (self)->get_read_only_view (self); +} + + +static void gee_list_base_init (GeeListIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + /** + * The read-only view of this list. + */ + g_object_interface_install_property (iface, g_param_spec_object ("read-only-view", "read-only-view", "read-only-view", GEE_TYPE_LIST, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + } +} + + +/** + * An ordered collection. + */ +GType gee_list_get_type (void) { + static volatile gsize gee_list_type_id__volatile = 0; + if (g_once_init_enter (&gee_list_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeListIface), (GBaseInitFunc) gee_list_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_list_type_id; + gee_list_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeList", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_list_type_id, GEE_TYPE_COLLECTION); + g_once_init_leave (&gee_list_type_id__volatile, gee_list_type_id); + } + return gee_list_type_id__volatile; +} + + + diff --git a/gee/list.vala b/gee/list.vala new file mode 100644 index 0000000..d5193e3 --- /dev/null +++ b/gee/list.vala @@ -0,0 +1,130 @@ +/* list.vala + * + * Copyright (C) 2007 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +/** + * An ordered collection. + */ +public interface Gee.List : Collection { + /** + * Returns a ListIterator that can be used for iteration over this list. + * + * @return a ListIterator that can be used for iteration over this list + */ + public abstract new ListIterator list_iterator (); + + /** + * Returns the item at the specified index in this list. + * + * @param index zero-based index of the item to be returned + * + * @return the item at the specified index in the list + */ + public abstract G get (int index); + + /** + * Sets the item at the specified index in this list. + * + * @param index zero-based index of the item to be set + */ + public abstract void set (int index, G item); + + /** + * Returns the index of the first occurence of the specified item in + * this list. + * + * @return the index of the first occurence of the specified item, or + * -1 if the item could not be found + */ + public abstract int index_of (G item); + + /** + * Inserts an item into this list at the specified position. + * + * @param index zero-based index at which item is inserted + * @param item item to insert into the list + */ + public abstract void insert (int index, G item); + + /** + * Removes the item at the specified index of this list. + * + * @param index zero-based index of the item to be removed + * + * @return the removed element + */ + public abstract G remove_at (int index); + + /** + * Returns a slice of this list. + * + * @param start zero-based index of the begin of the slice + * @param stop zero-based index after the end of the slice + * + * @return A list containing a slice of this list + */ + public abstract List? slice (int start, int stop); + + /** + * Returns the first item of the list. Fails if the list is empty. + * + * @return first item in the list + */ + public abstract G first (); + + /** + * Returns the last item of the list. Fails if the list is empty. + * + * @return last item in the list + */ + public abstract G last (); + + /** + * Inserts items into this list for the input collection at the + * specified position. + * + * @param index zero-based index of the items to be inserted + * @param collection collection of items to be inserted + */ + public abstract void insert_all (int index, Collection collection); + + /** + * Sorts items by comparing with the specified compare function. + * + * @param compare_func compare function to use to compare items + */ + public abstract void sort (CompareFunc? compare_func = null); + + /** + * The read-only view of this list. + */ + public abstract new List read_only_view { owned get; } + + /** + * Returns an immutable empty list. + * + * @return an immutable empty list + */ + public static List empty () { + return new LinkedList ().read_only_view; + } +} + diff --git a/gee/listiterator.c b/gee/listiterator.c new file mode 100644 index 0000000..577d80c --- /dev/null +++ b/gee/listiterator.c @@ -0,0 +1,153 @@ +/* listiterator.c generated by valac 0.18.0, the Vala compiler + * generated from listiterator.vala, do not modify */ + +/* listiterator.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +#include +#include + + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_BIDIR_ITERATOR (gee_bidir_iterator_get_type ()) +#define GEE_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIterator)) +#define GEE_IS_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_ITERATOR)) +#define GEE_BIDIR_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIteratorIface)) + +typedef struct _GeeBidirIterator GeeBidirIterator; +typedef struct _GeeBidirIteratorIface GeeBidirIteratorIface; + +#define GEE_TYPE_LIST_ITERATOR (gee_list_iterator_get_type ()) +#define GEE_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIterator)) +#define GEE_IS_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST_ITERATOR)) +#define GEE_LIST_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIteratorIface)) + +typedef struct _GeeListIterator GeeListIterator; +typedef struct _GeeListIteratorIface GeeListIteratorIface; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeBidirIteratorIface { + GTypeInterface parent_iface; + gboolean (*previous) (GeeBidirIterator* self); + gboolean (*has_previous) (GeeBidirIterator* self); + gboolean (*last) (GeeBidirIterator* self); +}; + +struct _GeeListIteratorIface { + GTypeInterface parent_iface; + void (*set) (GeeListIterator* self, gconstpointer item); + void (*insert) (GeeListIterator* self, gconstpointer item); + void (*add) (GeeListIterator* self, gconstpointer item); + gint (*index) (GeeListIterator* self); +}; + + + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_bidir_iterator_get_type (void) G_GNUC_CONST; +GType gee_list_iterator_get_type (void) G_GNUC_CONST; +void gee_list_iterator_set (GeeListIterator* self, gconstpointer item); +void gee_list_iterator_insert (GeeListIterator* self, gconstpointer item); +void gee_list_iterator_add (GeeListIterator* self, gconstpointer item); +gint gee_list_iterator_index (GeeListIterator* self); + + +/** + * Sets the current item in the iteration to the specified new item. + */ +void gee_list_iterator_set (GeeListIterator* self, gconstpointer item) { + g_return_if_fail (self != NULL); + GEE_LIST_ITERATOR_GET_INTERFACE (self)->set (self, item); +} + + +/** + * Inserts the specified item before the current item in the iteration. The + * cursor is let to point to the current item. + */ +void gee_list_iterator_insert (GeeListIterator* self, gconstpointer item) { + g_return_if_fail (self != NULL); + GEE_LIST_ITERATOR_GET_INTERFACE (self)->insert (self, item); +} + + +/** + * Adds the specified item after the current item in the iteration. The + * cursor is moved to point to the new added item. + */ +void gee_list_iterator_add (GeeListIterator* self, gconstpointer item) { + g_return_if_fail (self != NULL); + GEE_LIST_ITERATOR_GET_INTERFACE (self)->add (self, item); +} + + +/** + * Returns the current index in the iteration. + * + * @return the current index + */ +gint gee_list_iterator_index (GeeListIterator* self) { + g_return_val_if_fail (self != NULL, 0); + return GEE_LIST_ITERATOR_GET_INTERFACE (self)->index (self); +} + + +static void gee_list_iterator_base_init (GeeListIteratorIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + } +} + + +/** + * A list iterator. This supports bi-directionnal and index-based iteration. + */ +GType gee_list_iterator_get_type (void) { + static volatile gsize gee_list_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_list_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeListIteratorIface), (GBaseInitFunc) gee_list_iterator_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_list_iterator_type_id; + gee_list_iterator_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeListIterator", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_list_iterator_type_id, GEE_TYPE_BIDIR_ITERATOR); + g_once_init_leave (&gee_list_iterator_type_id__volatile, gee_list_iterator_type_id); + } + return gee_list_iterator_type_id__volatile; +} + + + diff --git a/gee/listiterator.vala b/gee/listiterator.vala new file mode 100644 index 0000000..34eb3e0 --- /dev/null +++ b/gee/listiterator.vala @@ -0,0 +1,50 @@ +/* listiterator.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +/** + * A list iterator. This supports bi-directionnal and index-based iteration. + */ +public interface Gee.ListIterator : Gee.BidirIterator { + /** + * Sets the current item in the iteration to the specified new item. + */ + public abstract void set (G item); + + /** + * Inserts the specified item before the current item in the iteration. The + * cursor is let to point to the current item. + */ + public abstract void insert (G item); + + /** + * Adds the specified item after the current item in the iteration. The + * cursor is moved to point to the new added item. + */ + public abstract void add (G item); + + /** + * Returns the current index in the iteration. + * + * @return the current index + */ + public abstract int index (); +} diff --git a/gee/map.c b/gee/map.c new file mode 100644 index 0000000..56fc4f7 --- /dev/null +++ b/gee/map.c @@ -0,0 +1,683 @@ +/* map.c generated by valac 0.18.0, the Vala compiler + * generated from map.vala, do not modify */ + +/* map.vala + * + * Copyright (C) 2007 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_MAP (gee_map_get_type ()) +#define GEE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP, GeeMap)) +#define GEE_IS_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP)) +#define GEE_MAP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP, GeeMapIface)) + +typedef struct _GeeMap GeeMap; +typedef struct _GeeMapIface GeeMapIface; + +#define GEE_TYPE_MAP_ITERATOR (gee_map_iterator_get_type ()) +#define GEE_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIterator)) +#define GEE_IS_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP_ITERATOR)) +#define GEE_MAP_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIteratorIface)) + +typedef struct _GeeMapIterator GeeMapIterator; +typedef struct _GeeMapIteratorIface GeeMapIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_MAP_TYPE_ENTRY (gee_map_entry_get_type ()) +#define GEE_MAP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntry)) +#define GEE_MAP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) +#define GEE_MAP_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) + +typedef struct _GeeMapEntry GeeMapEntry; +typedef struct _GeeMapEntryClass GeeMapEntryClass; + +#define GEE_TYPE_ABSTRACT_MAP (gee_abstract_map_get_type ()) +#define GEE_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap)) +#define GEE_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) +#define GEE_IS_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_IS_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_ABSTRACT_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) + +typedef struct _GeeAbstractMap GeeAbstractMap; +typedef struct _GeeAbstractMapClass GeeAbstractMapClass; + +#define GEE_TYPE_HASH_MAP (gee_hash_map_get_type ()) +#define GEE_HASH_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_HASH_MAP, GeeHashMap)) +#define GEE_HASH_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_HASH_MAP, GeeHashMapClass)) +#define GEE_IS_HASH_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_HASH_MAP)) +#define GEE_IS_HASH_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_HASH_MAP)) +#define GEE_HASH_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_HASH_MAP, GeeHashMapClass)) + +typedef struct _GeeHashMap GeeHashMap; +typedef struct _GeeHashMapClass GeeHashMapClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +typedef struct _GeeMapEntryPrivate GeeMapEntryPrivate; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeMapIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeMapIterator* self); + gboolean (*has_next) (GeeMapIterator* self); + gboolean (*first) (GeeMapIterator* self); + gpointer (*get_key) (GeeMapIterator* self); + gpointer (*get_value) (GeeMapIterator* self); + void (*set_value) (GeeMapIterator* self, gconstpointer value); + void (*unset) (GeeMapIterator* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeMapIface { + GTypeInterface parent_iface; + gboolean (*has_key) (GeeMap* self, gconstpointer key); + gboolean (*contains) (GeeMap* self, gconstpointer key); + gboolean (*has) (GeeMap* self, gconstpointer key, gconstpointer value); + gpointer (*get) (GeeMap* self, gconstpointer key); + void (*set) (GeeMap* self, gconstpointer key, gconstpointer value); + gboolean (*unset) (GeeMap* self, gconstpointer key, gpointer* value); + gboolean (*remove) (GeeMap* self, gconstpointer key, gpointer* value); + void (*clear) (GeeMap* self); + GeeMapIterator* (*map_iterator) (GeeMap* self); + void (*set_all) (GeeMap* self, GeeMap* map); + gboolean (*unset_all) (GeeMap* self, GeeMap* map); + gboolean (*remove_all) (GeeMap* self, GeeMap* map); + gboolean (*has_all) (GeeMap* self, GeeMap* map); + gboolean (*contains_all) (GeeMap* self, GeeMap* map); + gint (*get_size) (GeeMap* self); + gboolean (*get_is_empty) (GeeMap* self); + GeeSet* (*get_keys) (GeeMap* self); + GeeCollection* (*get_values) (GeeMap* self); + GeeSet* (*get_entries) (GeeMap* self); + GeeMap* (*get_read_only_view) (GeeMap* self); + GType (*get_key_type) (GeeMap* self); + GType (*get_value_type) (GeeMap* self); +}; + +struct _GeeMapEntry { + GObject parent_instance; + GeeMapEntryPrivate * priv; +}; + +struct _GeeMapEntryClass { + GObjectClass parent_class; + gconstpointer (*get_key) (GeeMapEntry* self); + gconstpointer (*get_value) (GeeMapEntry* self); + void (*set_value) (GeeMapEntry* self, gconstpointer value); +}; + +struct _GeeMapEntryPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; +}; + + +static gpointer gee_map_entry_parent_class = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_map_iterator_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_map_entry_get_type (void) G_GNUC_CONST; +GType gee_map_get_type (void) G_GNUC_CONST; +gboolean gee_map_has_key (GeeMap* self, gconstpointer key); +gboolean gee_map_contains (GeeMap* self, gconstpointer key) G_GNUC_DEPRECATED; +gboolean gee_map_has (GeeMap* self, gconstpointer key, gconstpointer value); +gpointer gee_map_get (GeeMap* self, gconstpointer key); +void gee_map_set (GeeMap* self, gconstpointer key, gconstpointer value); +gboolean gee_map_unset (GeeMap* self, gconstpointer key, gpointer* value); +gboolean gee_map_remove (GeeMap* self, gconstpointer key, gpointer* value) G_GNUC_DEPRECATED; +void gee_map_clear (GeeMap* self); +GeeMapIterator* gee_map_map_iterator (GeeMap* self); +void gee_map_set_all (GeeMap* self, GeeMap* map); +gboolean gee_map_unset_all (GeeMap* self, GeeMap* map); +gboolean gee_map_remove_all (GeeMap* self, GeeMap* map) G_GNUC_DEPRECATED; +gboolean gee_map_has_all (GeeMap* self, GeeMap* map); +gboolean gee_map_contains_all (GeeMap* self, GeeMap* map) G_GNUC_DEPRECATED; +GeeMap* gee_map_empty (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func); +GeeHashMap* gee_hash_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GEqualFunc value_equal_func); +GeeHashMap* gee_hash_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GEqualFunc value_equal_func); +GType gee_abstract_map_get_type (void) G_GNUC_CONST; +GType gee_hash_map_get_type (void) G_GNUC_CONST; +GeeMap* gee_abstract_map_get_read_only_view (GeeAbstractMap* self); +gint gee_map_get_size (GeeMap* self); +gboolean gee_map_get_is_empty (GeeMap* self); +GeeSet* gee_map_get_keys (GeeMap* self); +GeeCollection* gee_map_get_values (GeeMap* self); +GeeSet* gee_map_get_entries (GeeMap* self); +GeeMap* gee_map_get_read_only_view (GeeMap* self); +GType gee_map_get_key_type (GeeMap* self); +GType gee_map_get_value_type (GeeMap* self); +#define GEE_MAP_ENTRY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_MAP_TYPE_ENTRY, GeeMapEntryPrivate)) +enum { + GEE_MAP_ENTRY_DUMMY_PROPERTY, + GEE_MAP_ENTRY_K_TYPE, + GEE_MAP_ENTRY_K_DUP_FUNC, + GEE_MAP_ENTRY_K_DESTROY_FUNC, + GEE_MAP_ENTRY_V_TYPE, + GEE_MAP_ENTRY_V_DUP_FUNC, + GEE_MAP_ENTRY_V_DESTROY_FUNC, + GEE_MAP_ENTRY_KEY, + GEE_MAP_ENTRY_VALUE +}; +GeeMapEntry* gee_map_entry_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func); +gconstpointer gee_map_entry_get_key (GeeMapEntry* self); +gconstpointer gee_map_entry_get_value (GeeMapEntry* self); +void gee_map_entry_set_value (GeeMapEntry* self, gconstpointer value); +static void _vala_gee_map_entry_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_map_entry_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +/** + * Determines whether this map has the specified key. + * + * @param key the key to locate in the map + * + * @return ``true`` if key is found, ``false`` otherwise + */ +gboolean gee_map_has_key (GeeMap* self, gconstpointer key) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_MAP_GET_INTERFACE (self)->has_key (self, key); +} + + +/** + * Determines whether this map contains the specified key. + * + * @param key the key to locate in the map + * + * @return ``true`` if key is found, ``false`` otherwise + * + * @deprecated Use {@link has_key} method instead. + */ +gboolean gee_map_contains (GeeMap* self, gconstpointer key) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_MAP_GET_INTERFACE (self)->contains (self, key); +} + + +/** + * Determines whether this map has the specified key/value entry. + * + * @param key the key to locate in the map + * @param value the corresponding value + * + * @return ``true`` if key is found, ``false`` otherwise + */ +gboolean gee_map_has (GeeMap* self, gconstpointer key, gconstpointer value) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_MAP_GET_INTERFACE (self)->has (self, key, value); +} + + +/** + * Returns the value of the specified key in this map. + * + * @param key the key whose value is to be retrieved + * + * @return the value associated with the key, or ``null`` if the key + * couldn't be found + */ +gpointer gee_map_get (GeeMap* self, gconstpointer key) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_MAP_GET_INTERFACE (self)->get (self, key); +} + + +/** + * Inserts a new key and value into this map. + * + * @param key the key to insert + * @param value the value to associate with the key + */ +void gee_map_set (GeeMap* self, gconstpointer key, gconstpointer value) { + g_return_if_fail (self != NULL); + GEE_MAP_GET_INTERFACE (self)->set (self, key, value); +} + + +/** + * Removes the specified key from this map. + * + * @param key the key to remove from the map + * @param value the receiver variable for the removed value + * + * @return ``true`` if the map has been changed, ``false`` otherwise + */ +gboolean gee_map_unset (GeeMap* self, gconstpointer key, gpointer* value) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_MAP_GET_INTERFACE (self)->unset (self, key, value); +} + + +/** + * Removes the specified key from this map. + * + * @param key the key to remove from the map + * @param value the receiver variable for the removed value + * + * @return ``true`` if the map has been changed, ``false`` otherwise + * + * @deprecated Use {@link unset} method instead. + */ +gboolean gee_map_remove (GeeMap* self, gconstpointer key, gpointer* value) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_MAP_GET_INTERFACE (self)->remove (self, key, value); +} + + +/** + * Removes all items from this collection. Must not be called on + * read-only collections. + */ +void gee_map_clear (GeeMap* self) { + g_return_if_fail (self != NULL); + GEE_MAP_GET_INTERFACE (self)->clear (self); +} + + +/** + * Returns an iterator for this map. + * + * @return a map iterator + */ +GeeMapIterator* gee_map_map_iterator (GeeMap* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_MAP_GET_INTERFACE (self)->map_iterator (self); +} + + +/** + * Inserts all items that are contained in the input map to this map. + * + * @param map the map which items are inserted to this map + */ +void gee_map_set_all (GeeMap* self, GeeMap* map) { + g_return_if_fail (self != NULL); + GEE_MAP_GET_INTERFACE (self)->set_all (self, map); +} + + +/** + * Removes all items from this map that are common to the input map + * and this map. + * + * @param map the map which common items are deleted from this map + */ +gboolean gee_map_unset_all (GeeMap* self, GeeMap* map) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_MAP_GET_INTERFACE (self)->unset_all (self, map); +} + + +/** + * Removes all items from this map that are common to the input map + * and this map. + * + * @param map the map which common items are deleted from this map + * + * @deprecated Use {@link unset_all} method instead. + */ +gboolean gee_map_remove_all (GeeMap* self, GeeMap* map) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_MAP_GET_INTERFACE (self)->remove_all (self, map); +} + + +/** + * Returns ``true`` it this map contains all items as the input map. + * + * @param map the map which items will be compared with this map + */ +gboolean gee_map_has_all (GeeMap* self, GeeMap* map) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_MAP_GET_INTERFACE (self)->has_all (self, map); +} + + +/** + * Returns ``true`` it this map contains all items as the input map. + * + * @param map the map which items will be compared with this map + * + * @deprecated Use {@link has_all} method instead. + */ +gboolean gee_map_contains_all (GeeMap* self, GeeMap* map) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_MAP_GET_INTERFACE (self)->contains_all (self, map); +} + + +/** + * Returns an immutable empty map. + * + * @return an immutable empty map + */ +GeeMap* gee_map_empty (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func) { + GeeMap* result = NULL; + GeeHashMap* _tmp0_; + GeeHashMap* _tmp1_; + GeeMap* _tmp2_; + GeeMap* _tmp3_; + GeeMap* _tmp4_; + _tmp0_ = gee_hash_map_new (k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func, NULL, NULL, NULL); + _tmp1_ = _tmp0_; + _tmp2_ = gee_abstract_map_get_read_only_view ((GeeAbstractMap*) _tmp1_); + _tmp3_ = _tmp2_; + _tmp4_ = _tmp3_; + _g_object_unref0 (_tmp1_); + result = _tmp4_; + return result; +} + + +gint gee_map_get_size (GeeMap* self) { + g_return_val_if_fail (self != NULL, 0); + return GEE_MAP_GET_INTERFACE (self)->get_size (self); +} + + +gboolean gee_map_get_is_empty (GeeMap* self) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_MAP_GET_INTERFACE (self)->get_is_empty (self); +} + + +GeeSet* gee_map_get_keys (GeeMap* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_MAP_GET_INTERFACE (self)->get_keys (self); +} + + +GeeCollection* gee_map_get_values (GeeMap* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_MAP_GET_INTERFACE (self)->get_values (self); +} + + +GeeSet* gee_map_get_entries (GeeMap* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_MAP_GET_INTERFACE (self)->get_entries (self); +} + + +GeeMap* gee_map_get_read_only_view (GeeMap* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_MAP_GET_INTERFACE (self)->get_read_only_view (self); +} + + +GType gee_map_get_key_type (GeeMap* self) { + g_return_val_if_fail (self != NULL, 0UL); + return GEE_MAP_GET_INTERFACE (self)->get_key_type (self); +} + + +GType gee_map_get_value_type (GeeMap* self) { + g_return_val_if_fail (self != NULL, 0UL); + return GEE_MAP_GET_INTERFACE (self)->get_value_type (self); +} + + +GeeMapEntry* gee_map_entry_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func) { + GeeMapEntry * self = NULL; + self = (GeeMapEntry*) g_object_new (object_type, NULL); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + return self; +} + + +gconstpointer gee_map_entry_get_key (GeeMapEntry* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_MAP_ENTRY_GET_CLASS (self)->get_key (self); +} + + +gconstpointer gee_map_entry_get_value (GeeMapEntry* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_MAP_ENTRY_GET_CLASS (self)->get_value (self); +} + + +void gee_map_entry_set_value (GeeMapEntry* self, gconstpointer value) { + g_return_if_fail (self != NULL); + GEE_MAP_ENTRY_GET_CLASS (self)->set_value (self, value); +} + + +static void gee_map_entry_class_init (GeeMapEntryClass * klass) { + gee_map_entry_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeMapEntryPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_map_entry_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_map_entry_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_MAP_ENTRY_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_MAP_ENTRY_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_MAP_ENTRY_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_MAP_ENTRY_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_MAP_ENTRY_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_MAP_ENTRY_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + /** + * The key of this entry. + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_MAP_ENTRY_KEY, g_param_spec_pointer ("key", "key", "key", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The value of this entry. + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_MAP_ENTRY_VALUE, g_param_spec_pointer ("value", "value", "value", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +static void gee_map_entry_instance_init (GeeMapEntry * self) { + self->priv = GEE_MAP_ENTRY_GET_PRIVATE (self); +} + + +/** + * An entry of a map. + */ +GType gee_map_entry_get_type (void) { + static volatile gsize gee_map_entry_type_id__volatile = 0; + if (g_once_init_enter (&gee_map_entry_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeMapEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_map_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeMapEntry), 0, (GInstanceInitFunc) gee_map_entry_instance_init, NULL }; + GType gee_map_entry_type_id; + gee_map_entry_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeMapEntry", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&gee_map_entry_type_id__volatile, gee_map_entry_type_id); + } + return gee_map_entry_type_id__volatile; +} + + +static void _vala_gee_map_entry_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeMapEntry * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_MAP_TYPE_ENTRY, GeeMapEntry); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_map_entry_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeMapEntry * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_MAP_TYPE_ENTRY, GeeMapEntry); + switch (property_id) { + case GEE_MAP_ENTRY_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_MAP_ENTRY_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_MAP_ENTRY_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_MAP_ENTRY_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_MAP_ENTRY_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_MAP_ENTRY_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void gee_map_base_init (GeeMapIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + /** + * The number of items in this map. + */ + g_object_interface_install_property (iface, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * Specifies whether this map is empty. + */ + g_object_interface_install_property (iface, g_param_spec_boolean ("is-empty", "is-empty", "is-empty", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The read-only view of the keys of this map. + */ + g_object_interface_install_property (iface, g_param_spec_object ("keys", "keys", "keys", GEE_TYPE_SET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The read-only view of the values of this map. + */ + g_object_interface_install_property (iface, g_param_spec_object ("values", "values", "values", GEE_TYPE_COLLECTION, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The read-only view of the entries of this map. + */ + g_object_interface_install_property (iface, g_param_spec_object ("entries", "entries", "entries", GEE_TYPE_SET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The read-only view this map. + */ + g_object_interface_install_property (iface, g_param_spec_object ("read-only-view", "read-only-view", "read-only-view", GEE_TYPE_MAP, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The type of the keys in this map. + */ + g_object_interface_install_property (iface, g_param_spec_gtype ("key-type", "key-type", "key-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The type of the values in this map. + */ + g_object_interface_install_property (iface, g_param_spec_gtype ("value-type", "value-type", "value-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + } +} + + +/** + * An object that maps keys to values. + */ +GType gee_map_get_type (void) { + static volatile gsize gee_map_type_id__volatile = 0; + if (g_once_init_enter (&gee_map_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeMapIface), (GBaseInitFunc) gee_map_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_map_type_id; + gee_map_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeMap", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_map_type_id, G_TYPE_OBJECT); + g_type_interface_add_prerequisite (gee_map_type_id, GEE_TYPE_ITERABLE); + g_once_init_leave (&gee_map_type_id__volatile, gee_map_type_id); + } + return gee_map_type_id__volatile; +} + + + diff --git a/gee/map.vala b/gee/map.vala new file mode 100644 index 0000000..a2b9a3b --- /dev/null +++ b/gee/map.vala @@ -0,0 +1,219 @@ +/* map.vala + * + * Copyright (C) 2007 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +/** + * An object that maps keys to values. + */ +public interface Gee.Map : Object, Iterable> { + /** + * The number of items in this map. + */ + public abstract int size { get; } + + /** + * Specifies whether this map is empty. + */ + public abstract bool is_empty { get; } + + /** + * The read-only view of the keys of this map. + */ + public abstract Set keys { owned get; } + + /** + * The read-only view of the values of this map. + */ + public abstract Collection values { owned get; } + + /** + * The read-only view of the entries of this map. + */ + public abstract Set> entries { owned get; } + + /** + * An entry of a map. + */ + public abstract class Entry : Object { + /** + * The key of this entry. + */ + public abstract K key { get; } + + /** + * The value of this entry. + */ + public abstract V value { get; set; } + } + + /** + * Determines whether this map has the specified key. + * + * @param key the key to locate in the map + * + * @return ``true`` if key is found, ``false`` otherwise + */ + public abstract bool has_key (K key); + + /** + * Determines whether this map contains the specified key. + * + * @param key the key to locate in the map + * + * @return ``true`` if key is found, ``false`` otherwise + * + * @deprecated Use {@link has_key} method instead. + */ + [Deprecated] + public abstract bool contains (K key); + + /** + * Determines whether this map has the specified key/value entry. + * + * @param key the key to locate in the map + * @param value the corresponding value + * + * @return ``true`` if key is found, ``false`` otherwise + */ + public abstract bool has (K key, V value); + + /** + * Returns the value of the specified key in this map. + * + * @param key the key whose value is to be retrieved + * + * @return the value associated with the key, or ``null`` if the key + * couldn't be found + */ + public abstract V? get (K key); + + /** + * Inserts a new key and value into this map. + * + * @param key the key to insert + * @param value the value to associate with the key + */ + public abstract void set (K key, V value); + + /** + * Removes the specified key from this map. + * + * @param key the key to remove from the map + * @param value the receiver variable for the removed value + * + * @return ``true`` if the map has been changed, ``false`` otherwise + */ + public abstract bool unset (K key, out V? value = null); + + /** + * Removes the specified key from this map. + * + * @param key the key to remove from the map + * @param value the receiver variable for the removed value + * + * @return ``true`` if the map has been changed, ``false`` otherwise + * + * @deprecated Use {@link unset} method instead. + */ + [Deprecated] + public abstract bool remove (K key, out V? value = null); + + /** + * Removes all items from this collection. Must not be called on + * read-only collections. + */ + public abstract void clear (); + + /** + * Returns an iterator for this map. + * + * @return a map iterator + */ + public abstract MapIterator map_iterator (); + + /** + * Inserts all items that are contained in the input map to this map. + * + * @param map the map which items are inserted to this map + */ + public abstract void set_all (Map map); + + /** + * Removes all items from this map that are common to the input map + * and this map. + * + * @param map the map which common items are deleted from this map + */ + public abstract bool unset_all (Map map); + + /** + * Removes all items from this map that are common to the input map + * and this map. + * + * @param map the map which common items are deleted from this map + * + * @deprecated Use {@link unset_all} method instead. + */ + [Deprecated] + public abstract bool remove_all (Map map); + + /** + * Returns ``true`` it this map contains all items as the input map. + * + * @param map the map which items will be compared with this map + */ + public abstract bool has_all (Map map); + + /** + * Returns ``true`` it this map contains all items as the input map. + * + * @param map the map which items will be compared with this map + * + * @deprecated Use {@link has_all} method instead. + */ + [Deprecated] + public abstract bool contains_all (Map map); + + /** + * The read-only view this map. + */ + public abstract Map read_only_view { owned get; } + + /** + * The type of the keys in this map. + */ + public abstract Type key_type { get; } + + /** + * The type of the values in this map. + */ + public abstract Type value_type { get; } + + /** + * Returns an immutable empty map. + * + * @return an immutable empty map + */ + public static Map empty () { + return new HashMap ().read_only_view; + } +} + diff --git a/gee/mapiterator.c b/gee/mapiterator.c new file mode 100644 index 0000000..82d133b --- /dev/null +++ b/gee/mapiterator.c @@ -0,0 +1,172 @@ +/* mapiterator.c generated by valac 0.18.0, the Vala compiler + * generated from mapiterator.vala, do not modify */ + +/* mapiterator.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +#include +#include + + +#define GEE_TYPE_MAP_ITERATOR (gee_map_iterator_get_type ()) +#define GEE_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIterator)) +#define GEE_IS_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP_ITERATOR)) +#define GEE_MAP_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIteratorIface)) + +typedef struct _GeeMapIterator GeeMapIterator; +typedef struct _GeeMapIteratorIface GeeMapIteratorIface; + +struct _GeeMapIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeMapIterator* self); + gboolean (*has_next) (GeeMapIterator* self); + gboolean (*first) (GeeMapIterator* self); + gpointer (*get_key) (GeeMapIterator* self); + gpointer (*get_value) (GeeMapIterator* self); + void (*set_value) (GeeMapIterator* self, gconstpointer value); + void (*unset) (GeeMapIterator* self); +}; + + + +GType gee_map_iterator_get_type (void) G_GNUC_CONST; +gboolean gee_map_iterator_next (GeeMapIterator* self); +gboolean gee_map_iterator_has_next (GeeMapIterator* self); +gboolean gee_map_iterator_first (GeeMapIterator* self); +gpointer gee_map_iterator_get_key (GeeMapIterator* self); +gpointer gee_map_iterator_get_value (GeeMapIterator* self); +void gee_map_iterator_set_value (GeeMapIterator* self, gconstpointer value); +void gee_map_iterator_unset (GeeMapIterator* self); + + +/** + * Advances to the next entry in the iteration. + * + * @return ``true`` if the iterator has a next entry + */ +gboolean gee_map_iterator_next (GeeMapIterator* self) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_MAP_ITERATOR_GET_INTERFACE (self)->next (self); +} + + +/** + * Checks whether there is a next entry in the iteration. + * + * @return ``true`` if the iterator has a next entry + */ +gboolean gee_map_iterator_has_next (GeeMapIterator* self) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_MAP_ITERATOR_GET_INTERFACE (self)->has_next (self); +} + + +/** + * Rewinds to the first entry in the iteration. + * + * @return ``true`` if the iterator has a first entry + */ +gboolean gee_map_iterator_first (GeeMapIterator* self) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_MAP_ITERATOR_GET_INTERFACE (self)->first (self); +} + + +/** + * Returns the current key in the iteration. + * + * @return the current key in the iteration + */ +gpointer gee_map_iterator_get_key (GeeMapIterator* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_MAP_ITERATOR_GET_INTERFACE (self)->get_key (self); +} + + +/** + * Returns the value associated with the current key in the iteration. + * + * @return the value for the current key + */ +gpointer gee_map_iterator_get_value (GeeMapIterator* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_MAP_ITERATOR_GET_INTERFACE (self)->get_value (self); +} + + +/** + * Sets the value associated with the current key in the iteration. + * + * @param value the new value for the current key + */ +void gee_map_iterator_set_value (GeeMapIterator* self, gconstpointer value) { + g_return_if_fail (self != NULL); + GEE_MAP_ITERATOR_GET_INTERFACE (self)->set_value (self, value); +} + + +/** + * Unsets the current entry in the iteration. The cursor is set in an + * in-between state. {@link get_key}, {@link get_value}, {@link set_value} + * and {@link unset} will fail until the next move of the cursor (calling + * {@link next} or {@link first}). + */ +void gee_map_iterator_unset (GeeMapIterator* self) { + g_return_if_fail (self != NULL); + GEE_MAP_ITERATOR_GET_INTERFACE (self)->unset (self); +} + + +static void gee_map_iterator_base_init (GeeMapIteratorIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + } +} + + +/** + * An iterator over a map. + * + * Gee's iterators are "on-track" iterators. They always point to an item + * except before the first call to {@link next} or {@link first}, or, when an + * item has been removed, until the next call to {@link next} or {@link first}. + * + * Please note that when the iterator is out of track, neither {@link get_key}, + * {@link get_value}, {@link set_value} nor {@link unset} are defined and all + * will fail. After the next call to {@link next} or {@link first}, they will + * be defined again. + */ +GType gee_map_iterator_get_type (void) { + static volatile gsize gee_map_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_map_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeMapIteratorIface), (GBaseInitFunc) gee_map_iterator_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_map_iterator_type_id; + gee_map_iterator_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeMapIterator", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_map_iterator_type_id, G_TYPE_OBJECT); + g_once_init_leave (&gee_map_iterator_type_id__volatile, gee_map_iterator_type_id); + } + return gee_map_iterator_type_id__volatile; +} + + + diff --git a/gee/mapiterator.vala b/gee/mapiterator.vala new file mode 100644 index 0000000..45c1e5b --- /dev/null +++ b/gee/mapiterator.vala @@ -0,0 +1,86 @@ +/* mapiterator.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +/** + * An iterator over a map. + * + * Gee's iterators are "on-track" iterators. They always point to an item + * except before the first call to {@link next} or {@link first}, or, when an + * item has been removed, until the next call to {@link next} or {@link first}. + * + * Please note that when the iterator is out of track, neither {@link get_key}, + * {@link get_value}, {@link set_value} nor {@link unset} are defined and all + * will fail. After the next call to {@link next} or {@link first}, they will + * be defined again. + */ +public interface Gee.MapIterator : Object { + /** + * Advances to the next entry in the iteration. + * + * @return ``true`` if the iterator has a next entry + */ + public abstract bool next (); + + /** + * Checks whether there is a next entry in the iteration. + * + * @return ``true`` if the iterator has a next entry + */ + public abstract bool has_next (); + + /** + * Rewinds to the first entry in the iteration. + * + * @return ``true`` if the iterator has a first entry + */ + public abstract bool first (); + + /** + * Returns the current key in the iteration. + * + * @return the current key in the iteration + */ + public abstract K get_key (); + + /** + * Returns the value associated with the current key in the iteration. + * + * @return the value for the current key + */ + public abstract V get_value (); + + /** + * Sets the value associated with the current key in the iteration. + * + * @param value the new value for the current key + */ + public abstract void set_value (V value); + + /** + * Unsets the current entry in the iteration. The cursor is set in an + * in-between state. {@link get_key}, {@link get_value}, {@link set_value} + * and {@link unset} will fail until the next move of the cursor (calling + * {@link next} or {@link first}). + */ + public abstract void unset (); +} + diff --git a/gee/multimap.c b/gee/multimap.c new file mode 100644 index 0000000..457ed79 --- /dev/null +++ b/gee/multimap.c @@ -0,0 +1,295 @@ +/* multimap.c generated by valac 0.18.0, the Vala compiler + * generated from multimap.vala, do not modify */ + +/* multimap.vala + * + * Copyright (C) 2009 Ali Sabil + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Ali Sabil + */ + +#include +#include + + +#define GEE_TYPE_MULTI_MAP (gee_multi_map_get_type ()) +#define GEE_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MULTI_MAP, GeeMultiMap)) +#define GEE_IS_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MULTI_MAP)) +#define GEE_MULTI_MAP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MULTI_MAP, GeeMultiMapIface)) + +typedef struct _GeeMultiMap GeeMultiMap; +typedef struct _GeeMultiMapIface GeeMultiMapIface; + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_TYPE_MULTI_SET (gee_multi_set_get_type ()) +#define GEE_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MULTI_SET, GeeMultiSet)) +#define GEE_IS_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MULTI_SET)) +#define GEE_MULTI_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MULTI_SET, GeeMultiSetIface)) + +typedef struct _GeeMultiSet GeeMultiSet; +typedef struct _GeeMultiSetIface GeeMultiSetIface; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeMultiSetIface { + GTypeInterface parent_iface; + gint (*count) (GeeMultiSet* self, gconstpointer item); +}; + +struct _GeeMultiMapIface { + GTypeInterface parent_iface; + GeeSet* (*get_keys) (GeeMultiMap* self); + GeeMultiSet* (*get_all_keys) (GeeMultiMap* self); + GeeCollection* (*get_values) (GeeMultiMap* self); + gboolean (*contains) (GeeMultiMap* self, gconstpointer key); + GeeCollection* (*get) (GeeMultiMap* self, gconstpointer key); + void (*set) (GeeMultiMap* self, gconstpointer key, gconstpointer value); + gboolean (*remove) (GeeMultiMap* self, gconstpointer key, gconstpointer value); + gboolean (*remove_all) (GeeMultiMap* self, gconstpointer key); + void (*clear) (GeeMultiMap* self); + gint (*get_size) (GeeMultiMap* self); +}; + + + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_multi_set_get_type (void) G_GNUC_CONST; +GType gee_multi_map_get_type (void) G_GNUC_CONST; +GeeSet* gee_multi_map_get_keys (GeeMultiMap* self); +GeeMultiSet* gee_multi_map_get_all_keys (GeeMultiMap* self); +GeeCollection* gee_multi_map_get_values (GeeMultiMap* self); +gboolean gee_multi_map_contains (GeeMultiMap* self, gconstpointer key); +GeeCollection* gee_multi_map_get (GeeMultiMap* self, gconstpointer key); +void gee_multi_map_set (GeeMultiMap* self, gconstpointer key, gconstpointer value); +gboolean gee_multi_map_remove (GeeMultiMap* self, gconstpointer key, gconstpointer value); +gboolean gee_multi_map_remove_all (GeeMultiMap* self, gconstpointer key); +void gee_multi_map_clear (GeeMultiMap* self); +gint gee_multi_map_get_size (GeeMultiMap* self); + + +/** + * Returns the keys of this multimap as a read-only set. + * + * @return the keys of the map + */ +GeeSet* gee_multi_map_get_keys (GeeMultiMap* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_MULTI_MAP_GET_INTERFACE (self)->get_keys (self); +} + + +/** + * Returns the keys of this multimap as a read-only set. + * + * @return the keys of the map + */ +GeeMultiSet* gee_multi_map_get_all_keys (GeeMultiMap* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_MULTI_MAP_GET_INTERFACE (self)->get_all_keys (self); +} + + +/** + * Returns the values of this map as a read-only collection. + * + * @return the values of the map + */ +GeeCollection* gee_multi_map_get_values (GeeMultiMap* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_MULTI_MAP_GET_INTERFACE (self)->get_values (self); +} + + +/** + * Determines whether this map contains the specified key. + * + * @param key the key to locate in the map + * + * @return ``true`` if key is found, ``false`` otherwise + */ +gboolean gee_multi_map_contains (GeeMultiMap* self, gconstpointer key) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_MULTI_MAP_GET_INTERFACE (self)->contains (self, key); +} + + +/** + * Returns the values for the specified key in this map. + * + * @param key the key whose values are to be retrieved + * + * @return a Collection of values associated with the given key + */ +GeeCollection* gee_multi_map_get (GeeMultiMap* self, gconstpointer key) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_MULTI_MAP_GET_INTERFACE (self)->get (self, key); +} + + +/** + * Inserts a key/value pair into this map. + * + * @param key the key to insert + * @param value the value to associate with the key + */ +void gee_multi_map_set (GeeMultiMap* self, gconstpointer key, gconstpointer value) { + g_return_if_fail (self != NULL); + GEE_MULTI_MAP_GET_INTERFACE (self)->set (self, key, value); +} + + +/** + * Removes the specified key/value pair from this multimap. + * + * @param key the key to remove from the map + * @param value the value to remove from the map + * + * @return ``true`` if the map has been changed, ``false`` otherwise + */ +gboolean gee_multi_map_remove (GeeMultiMap* self, gconstpointer key, gconstpointer value) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_MULTI_MAP_GET_INTERFACE (self)->remove (self, key, value); +} + + +/** + * Removes the specified key and all the associated values from this + * multimap. + * + * @param key the key to remove from the map + * + * @return ``true`` if the map has been changed, ``false`` otherwise + */ +gboolean gee_multi_map_remove_all (GeeMultiMap* self, gconstpointer key) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_MULTI_MAP_GET_INTERFACE (self)->remove_all (self, key); +} + + +/** + * Removes all items from this collection. + */ +void gee_multi_map_clear (GeeMultiMap* self) { + g_return_if_fail (self != NULL); + GEE_MULTI_MAP_GET_INTERFACE (self)->clear (self); +} + + +gint gee_multi_map_get_size (GeeMultiMap* self) { + g_return_val_if_fail (self != NULL, 0); + return GEE_MULTI_MAP_GET_INTERFACE (self)->get_size (self); +} + + +static void gee_multi_map_base_init (GeeMultiMapIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + /** + * The number of key/value pairs in this map. + */ + g_object_interface_install_property (iface, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + } +} + + +/** + * A map with multiple values per key. + */ +GType gee_multi_map_get_type (void) { + static volatile gsize gee_multi_map_type_id__volatile = 0; + if (g_once_init_enter (&gee_multi_map_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeMultiMapIface), (GBaseInitFunc) gee_multi_map_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_multi_map_type_id; + gee_multi_map_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeMultiMap", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_multi_map_type_id, G_TYPE_OBJECT); + g_once_init_leave (&gee_multi_map_type_id__volatile, gee_multi_map_type_id); + } + return gee_multi_map_type_id__volatile; +} + + + diff --git a/gee/multimap.vala b/gee/multimap.vala new file mode 100644 index 0000000..7b4aac2 --- /dev/null +++ b/gee/multimap.vala @@ -0,0 +1,103 @@ +/* multimap.vala + * + * Copyright (C) 2009 Ali Sabil + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Ali Sabil + */ + +/** + * A map with multiple values per key. + */ +public interface Gee.MultiMap : Object { + /** + * The number of key/value pairs in this map. + */ + public abstract int size { get; } + + /** + * Returns the keys of this multimap as a read-only set. + * + * @return the keys of the map + */ + public abstract Set get_keys (); + + /** + * Returns the keys of this multimap as a read-only set. + * + * @return the keys of the map + */ + public abstract MultiSet get_all_keys (); + + /** + * Returns the values of this map as a read-only collection. + * + * @return the values of the map + */ + public abstract Collection get_values (); + + /** + * Determines whether this map contains the specified key. + * + * @param key the key to locate in the map + * + * @return ``true`` if key is found, ``false`` otherwise + */ + public abstract bool contains (K key); + + /** + * Returns the values for the specified key in this map. + * + * @param key the key whose values are to be retrieved + * + * @return a Collection of values associated with the given key + */ + public abstract Collection get (K key); + + /** + * Inserts a key/value pair into this map. + * + * @param key the key to insert + * @param value the value to associate with the key + */ + public abstract void set (K key, V value); + + /** + * Removes the specified key/value pair from this multimap. + * + * @param key the key to remove from the map + * @param value the value to remove from the map + * + * @return ``true`` if the map has been changed, ``false`` otherwise + */ + public abstract bool remove (K key, V value); + + /** + * Removes the specified key and all the associated values from this + * multimap. + * + * @param key the key to remove from the map + * + * @return ``true`` if the map has been changed, ``false`` otherwise + */ + public abstract bool remove_all (K key); + + /** + * Removes all items from this collection. + */ + public abstract void clear (); +} diff --git a/gee/multiset.c b/gee/multiset.c new file mode 100644 index 0000000..73e2507 --- /dev/null +++ b/gee/multiset.c @@ -0,0 +1,144 @@ +/* multiset.c generated by valac 0.18.0, the Vala compiler + * generated from multiset.vala, do not modify */ + +/* multiset.vala + * + * Copyright (C) 2009 Ali Sabil + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Ali Sabil + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_MULTI_SET (gee_multi_set_get_type ()) +#define GEE_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MULTI_SET, GeeMultiSet)) +#define GEE_IS_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MULTI_SET)) +#define GEE_MULTI_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MULTI_SET, GeeMultiSetIface)) + +typedef struct _GeeMultiSet GeeMultiSet; +typedef struct _GeeMultiSetIface GeeMultiSetIface; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeMultiSetIface { + GTypeInterface parent_iface; + gint (*count) (GeeMultiSet* self, gconstpointer item); +}; + + + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_multi_set_get_type (void) G_GNUC_CONST; +gint gee_multi_set_count (GeeMultiSet* self, gconstpointer item); + + +/** + * Returns the number of occurences of an item in this multiset. + * + * @param item the item to count occurences of + * + * @return the number of occurences of the item in this multiset. + */ +gint gee_multi_set_count (GeeMultiSet* self, gconstpointer item) { + g_return_val_if_fail (self != NULL, 0); + return GEE_MULTI_SET_GET_INTERFACE (self)->count (self, item); +} + + +static void gee_multi_set_base_init (GeeMultiSetIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + } +} + + +/** + * A collection with duplicate elements. + */ +GType gee_multi_set_get_type (void) { + static volatile gsize gee_multi_set_type_id__volatile = 0; + if (g_once_init_enter (&gee_multi_set_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeMultiSetIface), (GBaseInitFunc) gee_multi_set_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_multi_set_type_id; + gee_multi_set_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeMultiSet", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_multi_set_type_id, GEE_TYPE_COLLECTION); + g_once_init_leave (&gee_multi_set_type_id__volatile, gee_multi_set_type_id); + } + return gee_multi_set_type_id__volatile; +} + + + diff --git a/gee/multiset.vala b/gee/multiset.vala new file mode 100644 index 0000000..0c169e9 --- /dev/null +++ b/gee/multiset.vala @@ -0,0 +1,35 @@ +/* multiset.vala + * + * Copyright (C) 2009 Ali Sabil + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Ali Sabil + */ + +/** + * A collection with duplicate elements. + */ +public interface Gee.MultiSet : Collection { + /** + * Returns the number of occurences of an item in this multiset. + * + * @param item the item to count occurences of + * + * @return the number of occurences of the item in this multiset. + */ + public abstract int count (G item); +} diff --git a/gee/priorityqueue.c b/gee/priorityqueue.c new file mode 100644 index 0000000..358c41a --- /dev/null +++ b/gee/priorityqueue.c @@ -0,0 +1,4078 @@ +/* priorityqueue.c generated by valac 0.18.0, the Vala compiler + * generated from priorityqueue.vala, do not modify */ + +/* priorityqueue.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +#include +#include +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; +typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate; + +#define GEE_TYPE_QUEUE (gee_queue_get_type ()) +#define GEE_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_QUEUE, GeeQueue)) +#define GEE_IS_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_QUEUE)) +#define GEE_QUEUE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_QUEUE, GeeQueueIface)) + +typedef struct _GeeQueue GeeQueue; +typedef struct _GeeQueueIface GeeQueueIface; + +#define GEE_TYPE_ABSTRACT_QUEUE (gee_abstract_queue_get_type ()) +#define GEE_ABSTRACT_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_QUEUE, GeeAbstractQueue)) +#define GEE_ABSTRACT_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_QUEUE, GeeAbstractQueueClass)) +#define GEE_IS_ABSTRACT_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_QUEUE)) +#define GEE_IS_ABSTRACT_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_QUEUE)) +#define GEE_ABSTRACT_QUEUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_QUEUE, GeeAbstractQueueClass)) + +typedef struct _GeeAbstractQueue GeeAbstractQueue; +typedef struct _GeeAbstractQueueClass GeeAbstractQueueClass; +typedef struct _GeeAbstractQueuePrivate GeeAbstractQueuePrivate; + +#define GEE_TYPE_PRIORITY_QUEUE (gee_priority_queue_get_type ()) +#define GEE_PRIORITY_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_PRIORITY_QUEUE, GeePriorityQueue)) +#define GEE_PRIORITY_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_PRIORITY_QUEUE, GeePriorityQueueClass)) +#define GEE_IS_PRIORITY_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_PRIORITY_QUEUE)) +#define GEE_IS_PRIORITY_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_PRIORITY_QUEUE)) +#define GEE_PRIORITY_QUEUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_PRIORITY_QUEUE, GeePriorityQueueClass)) + +typedef struct _GeePriorityQueue GeePriorityQueue; +typedef struct _GeePriorityQueueClass GeePriorityQueueClass; +typedef struct _GeePriorityQueuePrivate GeePriorityQueuePrivate; + +#define GEE_PRIORITY_QUEUE_TYPE_NODE (gee_priority_queue_node_get_type ()) +#define GEE_PRIORITY_QUEUE_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_PRIORITY_QUEUE_TYPE_NODE, GeePriorityQueueNode)) +#define GEE_PRIORITY_QUEUE_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_PRIORITY_QUEUE_TYPE_NODE, GeePriorityQueueNodeClass)) +#define GEE_PRIORITY_QUEUE_IS_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_PRIORITY_QUEUE_TYPE_NODE)) +#define GEE_PRIORITY_QUEUE_IS_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_PRIORITY_QUEUE_TYPE_NODE)) +#define GEE_PRIORITY_QUEUE_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_PRIORITY_QUEUE_TYPE_NODE, GeePriorityQueueNodeClass)) + +typedef struct _GeePriorityQueueNode GeePriorityQueueNode; +typedef struct _GeePriorityQueueNodeClass GeePriorityQueueNodeClass; + +#define GEE_PRIORITY_QUEUE_TYPE_TYPE1_NODE (gee_priority_queue_type1_node_get_type ()) +#define GEE_PRIORITY_QUEUE_TYPE1_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_PRIORITY_QUEUE_TYPE_TYPE1_NODE, GeePriorityQueueType1Node)) +#define GEE_PRIORITY_QUEUE_TYPE1_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_PRIORITY_QUEUE_TYPE_TYPE1_NODE, GeePriorityQueueType1NodeClass)) +#define GEE_PRIORITY_QUEUE_IS_TYPE1_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_PRIORITY_QUEUE_TYPE_TYPE1_NODE)) +#define GEE_PRIORITY_QUEUE_IS_TYPE1_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_PRIORITY_QUEUE_TYPE_TYPE1_NODE)) +#define GEE_PRIORITY_QUEUE_TYPE1_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_PRIORITY_QUEUE_TYPE_TYPE1_NODE, GeePriorityQueueType1NodeClass)) + +typedef struct _GeePriorityQueueType1Node GeePriorityQueueType1Node; +typedef struct _GeePriorityQueueType1NodeClass GeePriorityQueueType1NodeClass; + +#define GEE_PRIORITY_QUEUE_TYPE_TYPE2_NODE (gee_priority_queue_type2_node_get_type ()) +#define GEE_PRIORITY_QUEUE_TYPE2_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_PRIORITY_QUEUE_TYPE_TYPE2_NODE, GeePriorityQueueType2Node)) +#define GEE_PRIORITY_QUEUE_TYPE2_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_PRIORITY_QUEUE_TYPE_TYPE2_NODE, GeePriorityQueueType2NodeClass)) +#define GEE_PRIORITY_QUEUE_IS_TYPE2_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_PRIORITY_QUEUE_TYPE_TYPE2_NODE)) +#define GEE_PRIORITY_QUEUE_IS_TYPE2_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_PRIORITY_QUEUE_TYPE_TYPE2_NODE)) +#define GEE_PRIORITY_QUEUE_TYPE2_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_PRIORITY_QUEUE_TYPE_TYPE2_NODE, GeePriorityQueueType2NodeClass)) + +typedef struct _GeePriorityQueueType2Node GeePriorityQueueType2Node; +typedef struct _GeePriorityQueueType2NodeClass GeePriorityQueueType2NodeClass; + +#define GEE_PRIORITY_QUEUE_TYPE_NODE_PAIR (gee_priority_queue_node_pair_get_type ()) +#define GEE_PRIORITY_QUEUE_NODE_PAIR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_PRIORITY_QUEUE_TYPE_NODE_PAIR, GeePriorityQueueNodePair)) +#define GEE_PRIORITY_QUEUE_NODE_PAIR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_PRIORITY_QUEUE_TYPE_NODE_PAIR, GeePriorityQueueNodePairClass)) +#define GEE_PRIORITY_QUEUE_IS_NODE_PAIR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_PRIORITY_QUEUE_TYPE_NODE_PAIR)) +#define GEE_PRIORITY_QUEUE_IS_NODE_PAIR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_PRIORITY_QUEUE_TYPE_NODE_PAIR)) +#define GEE_PRIORITY_QUEUE_NODE_PAIR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_PRIORITY_QUEUE_TYPE_NODE_PAIR, GeePriorityQueueNodePairClass)) + +typedef struct _GeePriorityQueueNodePair GeePriorityQueueNodePair; +typedef struct _GeePriorityQueueNodePairClass GeePriorityQueueNodePairClass; +#define _gee_priority_queue_node_unref0(var) ((var == NULL) ? NULL : (var = (gee_priority_queue_node_unref (var), NULL))) +#define _gee_priority_queue_node_pair_unref0(var) ((var == NULL) ? NULL : (var = (gee_priority_queue_node_pair_unref (var), NULL))) +typedef struct _GeePriorityQueueNodePrivate GeePriorityQueueNodePrivate; +typedef struct _GeePriorityQueueType1NodePrivate GeePriorityQueueType1NodePrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define GEE_PRIORITY_QUEUE_TYPE_ITERATOR (gee_priority_queue_iterator_get_type ()) +#define GEE_PRIORITY_QUEUE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_PRIORITY_QUEUE_TYPE_ITERATOR, GeePriorityQueueIterator)) +#define GEE_PRIORITY_QUEUE_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_PRIORITY_QUEUE_TYPE_ITERATOR, GeePriorityQueueIteratorClass)) +#define GEE_PRIORITY_QUEUE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_PRIORITY_QUEUE_TYPE_ITERATOR)) +#define GEE_PRIORITY_QUEUE_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_PRIORITY_QUEUE_TYPE_ITERATOR)) +#define GEE_PRIORITY_QUEUE_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_PRIORITY_QUEUE_TYPE_ITERATOR, GeePriorityQueueIteratorClass)) + +typedef struct _GeePriorityQueueIterator GeePriorityQueueIterator; +typedef struct _GeePriorityQueueIteratorClass GeePriorityQueueIteratorClass; +typedef struct _GeePriorityQueueNodePairPrivate GeePriorityQueueNodePairPrivate; +#define _g_destroy_func0(var) (((var == NULL) || (g_destroy_func == NULL)) ? NULL : (var = (g_destroy_func (var), NULL))) +typedef struct _GeePriorityQueueParamSpecNode GeePriorityQueueParamSpecNode; +typedef struct _GeePriorityQueueType2NodePrivate GeePriorityQueueType2NodePrivate; + +#define GEE_PRIORITY_QUEUE_TYPE_DUMMY_NODE (gee_priority_queue_dummy_node_get_type ()) +#define GEE_PRIORITY_QUEUE_DUMMY_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_PRIORITY_QUEUE_TYPE_DUMMY_NODE, GeePriorityQueueDummyNode)) +#define GEE_PRIORITY_QUEUE_DUMMY_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_PRIORITY_QUEUE_TYPE_DUMMY_NODE, GeePriorityQueueDummyNodeClass)) +#define GEE_PRIORITY_QUEUE_IS_DUMMY_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_PRIORITY_QUEUE_TYPE_DUMMY_NODE)) +#define GEE_PRIORITY_QUEUE_IS_DUMMY_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_PRIORITY_QUEUE_TYPE_DUMMY_NODE)) +#define GEE_PRIORITY_QUEUE_DUMMY_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_PRIORITY_QUEUE_TYPE_DUMMY_NODE, GeePriorityQueueDummyNodeClass)) + +typedef struct _GeePriorityQueueDummyNode GeePriorityQueueDummyNode; +typedef struct _GeePriorityQueueDummyNodeClass GeePriorityQueueDummyNodeClass; +typedef struct _GeePriorityQueueDummyNodePrivate GeePriorityQueueDummyNodePrivate; +typedef struct _GeePriorityQueueParamSpecNodePair GeePriorityQueueParamSpecNodePair; +typedef struct _GeePriorityQueueIteratorPrivate GeePriorityQueueIteratorPrivate; +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeAbstractCollection { + GObject parent_instance; + GeeAbstractCollectionPrivate * priv; +}; + +struct _GeeAbstractCollectionClass { + GObjectClass parent_class; + gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*add) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item); + void (*clear) (GeeAbstractCollection* self); + gpointer* (*to_array) (GeeAbstractCollection* self, int* result_length1); + gboolean (*add_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeAbstractCollection* self, GeeCollection* collection); + GeeIterator* (*iterator) (GeeAbstractCollection* self); + gint (*get_size) (GeeAbstractCollection* self); + gboolean (*get_is_empty) (GeeAbstractCollection* self); + GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self); +}; + +struct _GeeQueueIface { + GTypeInterface parent_iface; + gboolean (*offer) (GeeQueue* self, gconstpointer element); + gpointer (*peek) (GeeQueue* self); + gpointer (*poll) (GeeQueue* self); + gint (*drain) (GeeQueue* self, GeeCollection* recipient, gint amount); + gint (*get_capacity) (GeeQueue* self); + gint (*get_remaining_capacity) (GeeQueue* self); + gboolean (*get_is_full) (GeeQueue* self); +}; + +struct _GeeAbstractQueue { + GeeAbstractCollection parent_instance; + GeeAbstractQueuePrivate * priv; +}; + +struct _GeeAbstractQueueClass { + GeeAbstractCollectionClass parent_class; + gboolean (*offer) (GeeAbstractQueue* self, gconstpointer element); + gpointer (*peek) (GeeAbstractQueue* self); + gpointer (*poll) (GeeAbstractQueue* self); + gint (*drain) (GeeAbstractQueue* self, GeeCollection* recipient, gint amount); + gint (*get_capacity) (GeeAbstractQueue* self); + gint (*get_remaining_capacity) (GeeAbstractQueue* self); + gboolean (*get_is_full) (GeeAbstractQueue* self); +}; + +struct _GeePriorityQueue { + GeeAbstractQueue parent_instance; + GeePriorityQueuePrivate * priv; +}; + +struct _GeePriorityQueueClass { + GeeAbstractQueueClass parent_class; +}; + +struct _GeePriorityQueuePrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GCompareFunc _compare_func; + gint _size; + gint _stamp; + GeePriorityQueueType1Node* _r; + GeePriorityQueueType2Node* _r_prime; + GeePriorityQueueType2Node* _lm_head; + GeePriorityQueueType2Node* _lm_tail; + GeePriorityQueueType1Node* _p; + GeePriorityQueueType1Node** _a; + gint _a_length1; + gint __a_size_; + GeePriorityQueueNodePair* _lp_head; + GeePriorityQueueNodePair* _lp_tail; + gboolean* _b; + gint _b_length1; + gint __b_size_; + GeePriorityQueueType1Node* _ll_head; + GeePriorityQueueType1Node* _ll_tail; + GeePriorityQueueNode* _iter_head; + GeePriorityQueueNode* _iter_tail; +}; + +struct _GeePriorityQueueNode { + GTypeInstance parent_instance; + volatile int ref_count; + GeePriorityQueueNodePrivate * priv; + gpointer data; + GeePriorityQueueNode* parent; + gint type1_children_count; + GeePriorityQueueType1Node* type1_children_head; + GeePriorityQueueType1Node* type1_children_tail; + GeePriorityQueueNode* iter_prev; + GeePriorityQueueNode* iter_next; + gboolean pending_drop; +}; + +struct _GeePriorityQueueNodeClass { + GTypeClass parent_class; + void (*finalize) (GeePriorityQueueNode *self); +}; + +struct _GeePriorityQueueType1Node { + GeePriorityQueueNode parent_instance; + GeePriorityQueueType1NodePrivate * priv; + guint lost; + GeePriorityQueueType1Node* brothers_prev; + GeePriorityQueueType1Node* brothers_next; + GeePriorityQueueType2Node* type2_child; + GeePriorityQueueType1Node* ll_prev; + GeePriorityQueueType1Node* ll_next; + GeePriorityQueueNodePair* pair; +}; + +struct _GeePriorityQueueType1NodeClass { + GeePriorityQueueNodeClass parent_class; +}; + +struct _GeePriorityQueueNodePair { + GTypeInstance parent_instance; + volatile int ref_count; + GeePriorityQueueNodePairPrivate * priv; + GeePriorityQueueNodePair* lp_prev; + GeePriorityQueueNodePair* lp_next; + GeePriorityQueueType1Node* node1; + GeePriorityQueueType1Node* node2; +}; + +struct _GeePriorityQueueNodePairClass { + GTypeClass parent_class; + void (*finalize) (GeePriorityQueueNodePair *self); +}; + +struct _GeePriorityQueueNodePrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; +}; + +struct _GeePriorityQueueParamSpecNode { + GParamSpec parent_instance; +}; + +struct _GeePriorityQueueType1NodePrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; +}; + +struct _GeePriorityQueueType2Node { + GeePriorityQueueNode parent_instance; + GeePriorityQueueType2NodePrivate * priv; +}; + +struct _GeePriorityQueueType2NodeClass { + GeePriorityQueueNodeClass parent_class; +}; + +struct _GeePriorityQueueType2NodePrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; +}; + +struct _GeePriorityQueueDummyNode { + GeePriorityQueueNode parent_instance; + GeePriorityQueueDummyNodePrivate * priv; +}; + +struct _GeePriorityQueueDummyNodeClass { + GeePriorityQueueNodeClass parent_class; +}; + +struct _GeePriorityQueueDummyNodePrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; +}; + +struct _GeePriorityQueueNodePairPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; +}; + +struct _GeePriorityQueueParamSpecNodePair { + GParamSpec parent_instance; +}; + +struct _GeePriorityQueueIterator { + GObject parent_instance; + GeePriorityQueueIteratorPrivate * priv; +}; + +struct _GeePriorityQueueIteratorClass { + GObjectClass parent_class; +}; + +struct _GeePriorityQueueIteratorPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GeePriorityQueue* queue; + GeePriorityQueueNode* position; + GeePriorityQueueNode* previous; + gint stamp; +}; + + +static gpointer gee_priority_queue_parent_class = NULL; +static gpointer gee_priority_queue_node_parent_class = NULL; +static gpointer gee_priority_queue_type1_node_parent_class = NULL; +static gpointer gee_priority_queue_type2_node_parent_class = NULL; +static gpointer gee_priority_queue_dummy_node_parent_class = NULL; +static gpointer gee_priority_queue_node_pair_parent_class = NULL; +static gpointer gee_priority_queue_iterator_parent_class = NULL; +static GeeIteratorIface* gee_priority_queue_iterator_gee_iterator_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_queue_get_type (void) G_GNUC_CONST; +GType gee_abstract_queue_get_type (void) G_GNUC_CONST; +GType gee_priority_queue_get_type (void) G_GNUC_CONST; +static gpointer gee_priority_queue_node_ref (gpointer instance); +static void gee_priority_queue_node_unref (gpointer instance); +static GParamSpec* gee_priority_queue_param_spec_node (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) G_GNUC_UNUSED; +static void gee_priority_queue_value_set_node (GValue* value, gpointer v_object) G_GNUC_UNUSED; +static void gee_priority_queue_value_take_node (GValue* value, gpointer v_object) G_GNUC_UNUSED; +static gpointer gee_priority_queue_value_get_node (const GValue* value) G_GNUC_UNUSED; +static GType gee_priority_queue_node_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static GType gee_priority_queue_type1_node_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static GType gee_priority_queue_type2_node_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static gpointer gee_priority_queue_node_pair_ref (gpointer instance); +static void gee_priority_queue_node_pair_unref (gpointer instance); +static GParamSpec* gee_priority_queue_param_spec_node_pair (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) G_GNUC_UNUSED; +static void gee_priority_queue_value_set_node_pair (GValue* value, gpointer v_object) G_GNUC_UNUSED; +static void gee_priority_queue_value_take_node_pair (GValue* value, gpointer v_object) G_GNUC_UNUSED; +static gpointer gee_priority_queue_value_get_node_pair (const GValue* value) G_GNUC_UNUSED; +static GType gee_priority_queue_node_pair_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +#define GEE_PRIORITY_QUEUE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_PRIORITY_QUEUE, GeePriorityQueuePrivate)) +enum { + GEE_PRIORITY_QUEUE_DUMMY_PROPERTY, + GEE_PRIORITY_QUEUE_G_TYPE, + GEE_PRIORITY_QUEUE_G_DUP_FUNC, + GEE_PRIORITY_QUEUE_G_DESTROY_FUNC, + GEE_PRIORITY_QUEUE_COMPARE_FUNC, + GEE_PRIORITY_QUEUE_CAPACITY, + GEE_PRIORITY_QUEUE_REMAINING_CAPACITY, + GEE_PRIORITY_QUEUE_IS_FULL, + GEE_PRIORITY_QUEUE_SIZE +}; +GeePriorityQueue* gee_priority_queue_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func); +GeePriorityQueue* gee_priority_queue_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func); +GeeAbstractQueue* gee_abstract_queue_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GCompareFunc gee_functions_get_compare_func_for (GType t); +static void gee_priority_queue_set_compare_func (GeePriorityQueue* self, GCompareFunc value); +static gboolean gee_priority_queue_real_offer (GeeAbstractQueue* base, gconstpointer element); +static GeePriorityQueueType1Node* gee_priority_queue_type1_node_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer data, GeePriorityQueueNode** head, GeePriorityQueueNode** tail); +static GeePriorityQueueType1Node* gee_priority_queue_type1_node_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer data, GeePriorityQueueNode** head, GeePriorityQueueNode** tail); +static GeePriorityQueueType2Node* gee_priority_queue_type2_node_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer data, GeePriorityQueueNode** head, GeePriorityQueueNode** tail); +static GeePriorityQueueType2Node* gee_priority_queue_type2_node_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer data, GeePriorityQueueNode** head, GeePriorityQueueNode** tail); +static inline gint _gee_priority_queue_compare (GeePriorityQueue* self, GeePriorityQueueNode* node1, GeePriorityQueueNode* node2); +static inline void _gee_priority_queue_swap_data (GeePriorityQueue* self, GeePriorityQueueNode* node1, GeePriorityQueueNode* node2); +static void _gee_priority_queue_add (GeePriorityQueue* self, GeePriorityQueueType1Node* n); +static gpointer gee_priority_queue_real_peek (GeeAbstractQueue* base); +static gpointer gee_priority_queue_real_poll (GeeAbstractQueue* base); +static inline void _gee_priority_queue_move_data (GeePriorityQueue* self, GeePriorityQueueNode* target, GeePriorityQueueNode* source); +static void _gee_priority_queue_remove_type2_node (GeePriorityQueue* self, GeePriorityQueueType2Node* node, gboolean with_iteration); +static void _gee_priority_queue_remove_type1_node (GeePriorityQueue* self, GeePriorityQueueType1Node* node, gboolean with_iteration); +static void _gee_priority_queue_add_in_r_prime (GeePriorityQueue* self, GeePriorityQueueType1Node* node); +static void _gee_priority_queue_adjust (GeePriorityQueue* self, GeePriorityQueueType1Node* p1, GeePriorityQueueType1Node* p2); +static gboolean _gee_priority_queue_check_linkable (GeePriorityQueue* self); +static gint gee_priority_queue_real_drain (GeeAbstractQueue* base, GeeCollection* recipient, gint amount); +gboolean gee_collection_add (GeeCollection* self, gconstpointer item); +gpointer gee_abstract_queue_poll (GeeAbstractQueue* self); +static gboolean gee_priority_queue_real_contains (GeeAbstractCollection* base, gconstpointer item); +GeeIterator* gee_abstract_collection_iterator (GeeAbstractCollection* self); +gboolean gee_iterator_next (GeeIterator* self); +gpointer gee_iterator_get (GeeIterator* self); +GCompareFunc gee_priority_queue_get_compare_func (GeePriorityQueue* self); +static gboolean gee_priority_queue_real_add (GeeAbstractCollection* base, gconstpointer item); +gboolean gee_abstract_queue_offer (GeeAbstractQueue* self, gconstpointer element); +static gboolean gee_priority_queue_real_remove (GeeAbstractCollection* base, gconstpointer item); +static GeePriorityQueueIterator* gee_priority_queue_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeePriorityQueue* queue); +static GeePriorityQueueIterator* gee_priority_queue_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeePriorityQueue* queue); +static GType gee_priority_queue_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +void gee_iterator_remove (GeeIterator* self); +static void gee_priority_queue_real_clear (GeeAbstractCollection* base); +static GeeIterator* gee_priority_queue_real_iterator (GeeAbstractCollection* base); +static void _gee_priority_queue_link (GeePriorityQueue* self, GeePriorityQueueType1Node* ri, GeePriorityQueueType1Node* rj); +static inline gint gee_priority_queue_node_degree (GeePriorityQueueNode* self); +static void _gee_priority_queue_add_to (GeePriorityQueue* self, GeePriorityQueueType1Node* node, GeePriorityQueueType1Node* parent); +static GeePriorityQueueNode* _gee_priority_queue_re_insert (GeePriorityQueue* self, GeePriorityQueueType1Node* n); +static void _gee_priority_queue_delete (GeePriorityQueue* self, GeePriorityQueueNode* n, GeePriorityQueueNode** prev); +static void _gee_priority_queue_decrease_key (GeePriorityQueue* self, GeePriorityQueueNode* n); +static inline void gee_priority_queue_type1_node_add (GeePriorityQueueType1Node* self, GeePriorityQueueType1Node* node); +static GeePriorityQueueNodePair* gee_priority_queue_node_pair_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeePriorityQueueType1Node* node1, GeePriorityQueueType1Node* node2); +static GeePriorityQueueNodePair* gee_priority_queue_node_pair_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeePriorityQueueType1Node* node1, GeePriorityQueueType1Node* node2); +static void _gee_priority_queue_updated_degree (GeePriorityQueue* self, GeePriorityQueueType1Node* node, gboolean child_removed); +static inline void gee_priority_queue_type1_node_remove (GeePriorityQueueType1Node* self); +#define GEE_QUEUE_UNBOUNDED_CAPACITY (-1) +#define GEE_PRIORITY_QUEUE_NODE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_PRIORITY_QUEUE_TYPE_NODE, GeePriorityQueueNodePrivate)) +enum { + GEE_PRIORITY_QUEUE_NODE_DUMMY_PROPERTY +}; +static GeePriorityQueueNode* gee_priority_queue_node_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer data, GeePriorityQueueNode** head, GeePriorityQueueNode** tail); +static void gee_priority_queue_node_finalize (GeePriorityQueueNode* obj); +#define GEE_PRIORITY_QUEUE_TYPE1_NODE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_PRIORITY_QUEUE_TYPE_TYPE1_NODE, GeePriorityQueueType1NodePrivate)) +enum { + GEE_PRIORITY_QUEUE_TYPE1_NODE_DUMMY_PROPERTY +}; +static void gee_priority_queue_type1_node_finalize (GeePriorityQueueNode* obj); +#define GEE_PRIORITY_QUEUE_TYPE2_NODE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_PRIORITY_QUEUE_TYPE_TYPE2_NODE, GeePriorityQueueType2NodePrivate)) +enum { + GEE_PRIORITY_QUEUE_TYPE2_NODE_DUMMY_PROPERTY +}; +static GType gee_priority_queue_dummy_node_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +#define GEE_PRIORITY_QUEUE_DUMMY_NODE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_PRIORITY_QUEUE_TYPE_DUMMY_NODE, GeePriorityQueueDummyNodePrivate)) +enum { + GEE_PRIORITY_QUEUE_DUMMY_NODE_DUMMY_PROPERTY +}; +static GeePriorityQueueDummyNode* gee_priority_queue_dummy_node_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeePriorityQueueNode** prev_next, GeePriorityQueueNode** next_prev, GeePriorityQueueNode* iter_prev, GeePriorityQueueNode* iter_next); +static GeePriorityQueueDummyNode* gee_priority_queue_dummy_node_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeePriorityQueueNode** prev_next, GeePriorityQueueNode** next_prev, GeePriorityQueueNode* iter_prev, GeePriorityQueueNode* iter_next); +#define GEE_PRIORITY_QUEUE_NODE_PAIR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_PRIORITY_QUEUE_TYPE_NODE_PAIR, GeePriorityQueueNodePairPrivate)) +enum { + GEE_PRIORITY_QUEUE_NODE_PAIR_DUMMY_PROPERTY +}; +static void gee_priority_queue_node_pair_finalize (GeePriorityQueueNodePair* obj); +#define GEE_PRIORITY_QUEUE_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_PRIORITY_QUEUE_TYPE_ITERATOR, GeePriorityQueueIteratorPrivate)) +enum { + GEE_PRIORITY_QUEUE_ITERATOR_DUMMY_PROPERTY, + GEE_PRIORITY_QUEUE_ITERATOR_G_TYPE, + GEE_PRIORITY_QUEUE_ITERATOR_G_DUP_FUNC, + GEE_PRIORITY_QUEUE_ITERATOR_G_DESTROY_FUNC +}; +static gboolean gee_priority_queue_iterator_real_next (GeeIterator* base); +static inline GeePriorityQueueNode* _gee_priority_queue_iterator_get_next_node (GeePriorityQueueIterator* self); +static gboolean gee_priority_queue_iterator_real_has_next (GeeIterator* base); +static gboolean gee_priority_queue_iterator_real_first (GeeIterator* base); +static gpointer gee_priority_queue_iterator_real_get (GeeIterator* base); +static void gee_priority_queue_iterator_real_remove (GeeIterator* base); +static void gee_priority_queue_iterator_finalize (GObject* obj); +static void _vala_gee_priority_queue_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_priority_queue_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void gee_priority_queue_finalize (GObject* obj); +gint gee_abstract_queue_get_capacity (GeeAbstractQueue* self); +gint gee_abstract_queue_get_remaining_capacity (GeeAbstractQueue* self); +gboolean gee_abstract_queue_get_is_full (GeeAbstractQueue* self); +gint gee_abstract_collection_get_size (GeeAbstractCollection* self); +static void _vala_gee_priority_queue_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_priority_queue_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); + + +/** + * Constructs a new, empty priority queue. + * + * If not provided, the function parameter is requested to the + * {@link Functions} function factory methods. + * + * @param compare_func an optional element comparator function + */ +GeePriorityQueue* gee_priority_queue_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func) { + GeePriorityQueue * self = NULL; + GCompareFunc _tmp0_; + GCompareFunc _tmp2_; + self = (GeePriorityQueue*) gee_abstract_queue_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = compare_func; + if (_tmp0_ == NULL) { + GCompareFunc _tmp1_ = NULL; + _tmp1_ = gee_functions_get_compare_func_for (g_type); + compare_func = _tmp1_; + } + _tmp2_ = compare_func; + gee_priority_queue_set_compare_func (self, _tmp2_); + return self; +} + + +GeePriorityQueue* gee_priority_queue_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func) { + return gee_priority_queue_construct (GEE_TYPE_PRIORITY_QUEUE, g_type, g_dup_func, g_destroy_func, compare_func); +} + + +/** + * {@inheritDoc} + */ +static gpointer _gee_priority_queue_node_ref0 (gpointer self) { + return self ? gee_priority_queue_node_ref (self) : NULL; +} + + +static gboolean gee_priority_queue_real_offer (GeeAbstractQueue* base, gconstpointer element) { + GeePriorityQueue * self; + gboolean result = FALSE; + GeePriorityQueueType1Node* _tmp0_; + gint _tmp21_; + gint _tmp22_; + self = (GeePriorityQueue*) base; + _tmp0_ = self->priv->_r; + if (_tmp0_ == NULL) { + gconstpointer _tmp1_; + GeePriorityQueueType1Node* _tmp2_; + GeePriorityQueueType1Node* _tmp3_; + GeePriorityQueueType1Node* _tmp4_; + _tmp1_ = element; + _tmp2_ = gee_priority_queue_type1_node_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp1_, &self->priv->_iter_head, &self->priv->_iter_tail); + _gee_priority_queue_node_unref0 (self->priv->_r); + self->priv->_r = _tmp2_; + _tmp3_ = self->priv->_r; + _tmp4_ = _gee_priority_queue_node_ref0 (_tmp3_); + _gee_priority_queue_node_unref0 (self->priv->_p); + self->priv->_p = _tmp4_; + } else { + GeePriorityQueueType2Node* _tmp5_; + _tmp5_ = self->priv->_r_prime; + if (_tmp5_ == NULL) { + gconstpointer _tmp6_; + GeePriorityQueueType2Node* _tmp7_; + GeePriorityQueueType2Node* _tmp8_; + GeePriorityQueueType1Node* _tmp9_; + GeePriorityQueueType1Node* _tmp10_; + GeePriorityQueueType2Node* _tmp11_; + GeePriorityQueueType2Node* _tmp12_; + GeePriorityQueueType2Node* _tmp13_; + GeePriorityQueueType1Node* _tmp14_; + gint _tmp15_ = 0; + _tmp6_ = element; + _tmp7_ = gee_priority_queue_type2_node_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp6_, &self->priv->_iter_head, &self->priv->_iter_tail); + _gee_priority_queue_node_unref0 (self->priv->_r_prime); + self->priv->_r_prime = _tmp7_; + _tmp8_ = self->priv->_r_prime; + _tmp9_ = self->priv->_r; + ((GeePriorityQueueNode*) _tmp8_)->parent = (GeePriorityQueueNode*) _tmp9_; + _tmp10_ = self->priv->_r; + _tmp11_ = self->priv->_r_prime; + _tmp12_ = _gee_priority_queue_node_ref0 (_tmp11_); + _gee_priority_queue_node_unref0 (_tmp10_->type2_child); + _tmp10_->type2_child = _tmp12_; + _tmp13_ = self->priv->_r_prime; + _tmp14_ = self->priv->_r; + _tmp15_ = _gee_priority_queue_compare (self, (GeePriorityQueueNode*) _tmp13_, (GeePriorityQueueNode*) _tmp14_); + if (_tmp15_ < 0) { + GeePriorityQueueType2Node* _tmp16_; + GeePriorityQueueType1Node* _tmp17_; + _tmp16_ = self->priv->_r_prime; + _tmp17_ = self->priv->_r; + _gee_priority_queue_swap_data (self, (GeePriorityQueueNode*) _tmp16_, (GeePriorityQueueNode*) _tmp17_); + } + } else { + gconstpointer _tmp18_; + GeePriorityQueueType1Node* _tmp19_; + GeePriorityQueueType1Node* node; + GeePriorityQueueType1Node* _tmp20_; + _tmp18_ = element; + _tmp19_ = gee_priority_queue_type1_node_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp18_, &self->priv->_iter_head, &self->priv->_iter_tail); + node = _tmp19_; + _tmp20_ = node; + _gee_priority_queue_add (self, _tmp20_); + _gee_priority_queue_node_unref0 (node); + } + } + _tmp21_ = self->priv->_stamp; + self->priv->_stamp = _tmp21_ + 1; + _tmp22_ = self->priv->_size; + self->priv->_size = _tmp22_ + 1; + result = TRUE; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_priority_queue_real_peek (GeeAbstractQueue* base) { + GeePriorityQueue * self; + gpointer result = NULL; + GeePriorityQueueType1Node* _tmp0_; + GeePriorityQueueType1Node* _tmp1_; + gconstpointer _tmp2_; + gpointer _tmp3_; + self = (GeePriorityQueue*) base; + _tmp0_ = self->priv->_r; + if (_tmp0_ == NULL) { + result = NULL; + return result; + } + _tmp1_ = self->priv->_r; + _tmp2_ = ((GeePriorityQueueNode*) _tmp1_)->data; + _tmp3_ = ((_tmp2_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp2_) : ((gpointer) _tmp2_); + result = _tmp3_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_priority_queue_real_poll (GeeAbstractQueue* base) { + GeePriorityQueue * self; + gpointer result = NULL; + GeePriorityQueueType1Node* _tmp0_; + GeePriorityQueueType1Node* _tmp1_; + gconstpointer _tmp2_; + gpointer _tmp3_; + gpointer min; + GeePriorityQueueType1Node* _tmp4_; + gint _tmp5_; + gint _tmp6_; + GeePriorityQueueType2Node* _tmp7_; + GeePriorityQueueType1Node* _tmp28_; + GeePriorityQueueType2Node* _tmp29_; + GeePriorityQueueType2Node* _tmp30_; + GeePriorityQueueType1Node* _tmp31_; + GeePriorityQueueType1Node* r_second; + GeePriorityQueueType2Node* _tmp33_; + GeePriorityQueueType1Node* _tmp34_; + GeePriorityQueueType1Node* _tmp35_; + GeePriorityQueueType1Node* node; + GeePriorityQueueType2Node* _tmp48_; + GeePriorityQueueType1Node* _tmp49_; + GeePriorityQueueType1Node* _tmp50_; + GeePriorityQueueType1Node* _tmp51_; + GeePriorityQueueType1Node* _tmp52_; + GeePriorityQueueType1Node* _tmp53_; + GeePriorityQueueType1Node* _tmp62_; + GeePriorityQueueType1Node* _tmp65_; + GeePriorityQueueType1Node* _tmp66_; + self = (GeePriorityQueue*) base; + _tmp0_ = self->priv->_r; + if (_tmp0_ == NULL) { + result = NULL; + return result; + } + _tmp1_ = self->priv->_r; + _tmp2_ = ((GeePriorityQueueNode*) _tmp1_)->data; + _tmp3_ = ((_tmp2_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp2_) : ((gpointer) _tmp2_); + min = _tmp3_; + _tmp4_ = self->priv->_r; + ((GeePriorityQueueNode*) _tmp4_)->pending_drop = FALSE; + _tmp5_ = self->priv->_stamp; + self->priv->_stamp = _tmp5_ + 1; + _tmp6_ = self->priv->_size; + self->priv->_size = _tmp6_ - 1; + _tmp7_ = self->priv->_r_prime; + if (_tmp7_ == NULL) { + GeePriorityQueueType1Node* _tmp8_; + GeePriorityQueueNode* _tmp9_; + GeePriorityQueueType1Node* _tmp14_; + GeePriorityQueueNode* _tmp15_; + GeePriorityQueueNode* _tmp20_; + GeePriorityQueueType1Node* _tmp21_; + GeePriorityQueueNode* _tmp24_; + GeePriorityQueueType1Node* _tmp25_; + _tmp8_ = self->priv->_r; + _tmp9_ = ((GeePriorityQueueNode*) _tmp8_)->iter_next; + if (_tmp9_ != NULL) { + GeePriorityQueueType1Node* _tmp10_; + GeePriorityQueueNode* _tmp11_; + GeePriorityQueueType1Node* _tmp12_; + GeePriorityQueueNode* _tmp13_; + _tmp10_ = self->priv->_r; + _tmp11_ = ((GeePriorityQueueNode*) _tmp10_)->iter_next; + _tmp12_ = self->priv->_r; + _tmp13_ = ((GeePriorityQueueNode*) _tmp12_)->iter_prev; + _tmp11_->iter_prev = _tmp13_; + } + _tmp14_ = self->priv->_r; + _tmp15_ = ((GeePriorityQueueNode*) _tmp14_)->iter_prev; + if (_tmp15_ != NULL) { + GeePriorityQueueType1Node* _tmp16_; + GeePriorityQueueNode* _tmp17_; + GeePriorityQueueType1Node* _tmp18_; + GeePriorityQueueNode* _tmp19_; + _tmp16_ = self->priv->_r; + _tmp17_ = ((GeePriorityQueueNode*) _tmp16_)->iter_prev; + _tmp18_ = self->priv->_r; + _tmp19_ = ((GeePriorityQueueNode*) _tmp18_)->iter_next; + _tmp17_->iter_next = _tmp19_; + } + _tmp20_ = self->priv->_iter_head; + _tmp21_ = self->priv->_r; + if (_tmp20_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, GEE_PRIORITY_QUEUE_TYPE_NODE, GeePriorityQueueNode)) { + GeePriorityQueueType1Node* _tmp22_; + GeePriorityQueueNode* _tmp23_; + _tmp22_ = self->priv->_r; + _tmp23_ = ((GeePriorityQueueNode*) _tmp22_)->iter_next; + self->priv->_iter_head = _tmp23_; + } + _tmp24_ = self->priv->_iter_tail; + _tmp25_ = self->priv->_r; + if (_tmp24_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp25_, GEE_PRIORITY_QUEUE_TYPE_NODE, GeePriorityQueueNode)) { + GeePriorityQueueType1Node* _tmp26_; + GeePriorityQueueNode* _tmp27_; + _tmp26_ = self->priv->_r; + _tmp27_ = ((GeePriorityQueueNode*) _tmp26_)->iter_prev; + self->priv->_iter_tail = _tmp27_; + } + _gee_priority_queue_node_unref0 (self->priv->_r); + self->priv->_r = NULL; + _gee_priority_queue_node_unref0 (self->priv->_p); + self->priv->_p = NULL; + result = min; + return result; + } + _tmp28_ = self->priv->_r; + _tmp29_ = self->priv->_r_prime; + _gee_priority_queue_move_data (self, (GeePriorityQueueNode*) _tmp28_, (GeePriorityQueueNode*) _tmp29_); + _tmp30_ = self->priv->_r_prime; + _tmp31_ = ((GeePriorityQueueNode*) _tmp30_)->type1_children_head; + if (_tmp31_ == NULL) { + GeePriorityQueueType2Node* _tmp32_; + _tmp32_ = self->priv->_r_prime; + _gee_priority_queue_remove_type2_node (self, _tmp32_, TRUE); + _gee_priority_queue_node_unref0 (self->priv->_r_prime); + self->priv->_r_prime = NULL; + result = min; + return result; + } + r_second = NULL; + _tmp33_ = self->priv->_r_prime; + _tmp34_ = ((GeePriorityQueueNode*) _tmp33_)->type1_children_head; + _tmp35_ = _gee_priority_queue_node_ref0 (_tmp34_); + node = _tmp35_; + while (TRUE) { + GeePriorityQueueType1Node* _tmp36_; + gboolean _tmp37_ = FALSE; + GeePriorityQueueType1Node* _tmp38_; + gboolean _tmp42_; + GeePriorityQueueType1Node* _tmp45_; + GeePriorityQueueType1Node* _tmp46_; + GeePriorityQueueType1Node* _tmp47_; + _tmp36_ = node; + if (!(_tmp36_ != NULL)) { + break; + } + _tmp38_ = r_second; + if (_tmp38_ == NULL) { + _tmp37_ = TRUE; + } else { + GeePriorityQueueType1Node* _tmp39_; + GeePriorityQueueType1Node* _tmp40_; + gint _tmp41_ = 0; + _tmp39_ = node; + _tmp40_ = r_second; + _tmp41_ = _gee_priority_queue_compare (self, (GeePriorityQueueNode*) _tmp39_, (GeePriorityQueueNode*) _tmp40_); + _tmp37_ = _tmp41_ < 0; + } + _tmp42_ = _tmp37_; + if (_tmp42_) { + GeePriorityQueueType1Node* _tmp43_; + GeePriorityQueueType1Node* _tmp44_; + _tmp43_ = node; + _tmp44_ = _gee_priority_queue_node_ref0 (_tmp43_); + _gee_priority_queue_node_unref0 (r_second); + r_second = _tmp44_; + } + _tmp45_ = node; + _tmp46_ = _tmp45_->brothers_next; + _tmp47_ = _gee_priority_queue_node_ref0 (_tmp46_); + _gee_priority_queue_node_unref0 (node); + node = _tmp47_; + } + _tmp48_ = self->priv->_r_prime; + _tmp49_ = r_second; + _gee_priority_queue_move_data (self, (GeePriorityQueueNode*) _tmp48_, (GeePriorityQueueNode*) _tmp49_); + _tmp50_ = r_second; + _gee_priority_queue_remove_type1_node (self, _tmp50_, TRUE); + _tmp51_ = r_second; + _tmp52_ = ((GeePriorityQueueNode*) _tmp51_)->type1_children_head; + _tmp53_ = _gee_priority_queue_node_ref0 (_tmp52_); + _gee_priority_queue_node_unref0 (node); + node = _tmp53_; + while (TRUE) { + GeePriorityQueueType1Node* _tmp54_; + GeePriorityQueueType1Node* _tmp55_; + GeePriorityQueueType1Node* _tmp56_; + GeePriorityQueueType1Node* _tmp57_; + GeePriorityQueueType1Node* next; + GeePriorityQueueType1Node* _tmp58_; + GeePriorityQueueType1Node* _tmp59_; + GeePriorityQueueType1Node* _tmp60_; + GeePriorityQueueType1Node* _tmp61_; + _tmp54_ = node; + if (!(_tmp54_ != NULL)) { + break; + } + _tmp55_ = node; + _tmp56_ = _tmp55_->brothers_next; + _tmp57_ = _gee_priority_queue_node_ref0 (_tmp56_); + next = _tmp57_; + _tmp58_ = node; + _gee_priority_queue_remove_type1_node (self, _tmp58_, FALSE); + _tmp59_ = node; + _gee_priority_queue_add_in_r_prime (self, _tmp59_); + _tmp60_ = next; + _tmp61_ = _gee_priority_queue_node_ref0 (_tmp60_); + _gee_priority_queue_node_unref0 (node); + node = _tmp61_; + _gee_priority_queue_node_unref0 (next); + } + _tmp62_ = self->priv->_p; + if (_tmp62_ == NULL) { + GeePriorityQueueType1Node* _tmp63_; + GeePriorityQueueType1Node* _tmp64_; + _tmp63_ = self->priv->_r; + _tmp64_ = _gee_priority_queue_node_ref0 (_tmp63_); + _gee_priority_queue_node_unref0 (self->priv->_p); + self->priv->_p = _tmp64_; + } + _tmp65_ = self->priv->_p; + _tmp66_ = self->priv->_p; + _gee_priority_queue_adjust (self, _tmp65_, _tmp66_); + while (TRUE) { + gboolean _tmp67_ = FALSE; + _tmp67_ = _gee_priority_queue_check_linkable (self); + if (!_tmp67_) { + break; + } + } + result = min; + _gee_priority_queue_node_unref0 (node); + _gee_priority_queue_node_unref0 (r_second); + return result; +} + + +/** + * {@inheritDoc} + */ +static gint gee_priority_queue_real_drain (GeeAbstractQueue* base, GeeCollection* recipient, gint amount) { + GeePriorityQueue * self; + gint result = 0; + gint _tmp0_; + gint _tmp11_; + self = (GeePriorityQueue*) base; + g_return_val_if_fail (recipient != NULL, 0); + _tmp0_ = amount; + if (_tmp0_ == (-1)) { + gint _tmp1_; + _tmp1_ = self->priv->_size; + amount = _tmp1_; + } + { + gint i; + i = 0; + { + gboolean _tmp2_; + _tmp2_ = TRUE; + while (TRUE) { + gboolean _tmp3_; + gint _tmp5_; + gint _tmp6_; + gint _tmp7_; + GeeCollection* _tmp8_; + gpointer _tmp9_ = NULL; + gpointer _tmp10_; + _tmp3_ = _tmp2_; + if (!_tmp3_) { + gint _tmp4_; + _tmp4_ = i; + i = _tmp4_ + 1; + } + _tmp2_ = FALSE; + _tmp5_ = i; + _tmp6_ = amount; + if (!(_tmp5_ < _tmp6_)) { + break; + } + _tmp7_ = self->priv->_size; + if (_tmp7_ == 0) { + result = i; + return result; + } + _tmp8_ = recipient; + _tmp9_ = gee_abstract_queue_poll ((GeeAbstractQueue*) self); + _tmp10_ = _tmp9_; + gee_collection_add (_tmp8_, _tmp10_); + ((_tmp10_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp10_ = (self->priv->g_destroy_func (_tmp10_), NULL)); + } + } + } + _tmp11_ = amount; + result = _tmp11_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_priority_queue_real_contains (GeeAbstractCollection* base, gconstpointer item) { + GeePriorityQueue * self; + gboolean result = FALSE; + self = (GeePriorityQueue*) base; + { + GeeIterator* _tmp0_ = NULL; + GeeIterator* _an_item_it; + _tmp0_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self); + _an_item_it = _tmp0_; + while (TRUE) { + GeeIterator* _tmp1_; + gboolean _tmp2_ = FALSE; + GeeIterator* _tmp3_; + gpointer _tmp4_ = NULL; + gpointer an_item; + GCompareFunc _tmp5_; + GCompareFunc _tmp6_; + gconstpointer _tmp7_; + gconstpointer _tmp8_; + gint _tmp9_ = 0; + _tmp1_ = _an_item_it; + _tmp2_ = gee_iterator_next (_tmp1_); + if (!_tmp2_) { + break; + } + _tmp3_ = _an_item_it; + _tmp4_ = gee_iterator_get (_tmp3_); + an_item = _tmp4_; + _tmp5_ = gee_priority_queue_get_compare_func (self); + _tmp6_ = _tmp5_; + _tmp7_ = item; + _tmp8_ = an_item; + _tmp9_ = _tmp6_ (_tmp7_, _tmp8_); + if (_tmp9_ == 0) { + result = TRUE; + ((an_item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (an_item = (self->priv->g_destroy_func (an_item), NULL)); + _g_object_unref0 (_an_item_it); + return result; + } + ((an_item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (an_item = (self->priv->g_destroy_func (an_item), NULL)); + } + _g_object_unref0 (_an_item_it); + } + result = FALSE; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_priority_queue_real_add (GeeAbstractCollection* base, gconstpointer item) { + GeePriorityQueue * self; + gboolean result = FALSE; + gconstpointer _tmp0_; + gboolean _tmp1_ = FALSE; + self = (GeePriorityQueue*) base; + _tmp0_ = item; + _tmp1_ = gee_abstract_queue_offer ((GeeAbstractQueue*) self, _tmp0_); + result = _tmp1_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_priority_queue_real_remove (GeeAbstractCollection* base, gconstpointer item) { + GeePriorityQueue * self; + gboolean result = FALSE; + GeePriorityQueueIterator* _tmp0_; + GeePriorityQueueIterator* iterator; + self = (GeePriorityQueue*) base; + _tmp0_ = gee_priority_queue_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, self); + iterator = _tmp0_; + while (TRUE) { + GeePriorityQueueIterator* _tmp1_; + gboolean _tmp2_ = FALSE; + GeePriorityQueueIterator* _tmp3_; + gpointer _tmp4_ = NULL; + gpointer an_item; + GCompareFunc _tmp5_; + GCompareFunc _tmp6_; + gconstpointer _tmp7_; + gconstpointer _tmp8_; + gint _tmp9_ = 0; + _tmp1_ = iterator; + _tmp2_ = gee_iterator_next ((GeeIterator*) _tmp1_); + if (!_tmp2_) { + break; + } + _tmp3_ = iterator; + _tmp4_ = gee_iterator_get ((GeeIterator*) _tmp3_); + an_item = _tmp4_; + _tmp5_ = gee_priority_queue_get_compare_func (self); + _tmp6_ = _tmp5_; + _tmp7_ = item; + _tmp8_ = an_item; + _tmp9_ = _tmp6_ (_tmp7_, _tmp8_); + if (_tmp9_ == 0) { + GeePriorityQueueIterator* _tmp10_; + _tmp10_ = iterator; + gee_iterator_remove ((GeeIterator*) _tmp10_); + result = TRUE; + ((an_item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (an_item = (self->priv->g_destroy_func (an_item), NULL)); + _g_object_unref0 (iterator); + return result; + } + ((an_item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (an_item = (self->priv->g_destroy_func (an_item), NULL)); + } + result = FALSE; + _g_object_unref0 (iterator); + return result; +} + + +/** + * {@inheritDoc} + */ +static void gee_priority_queue_real_clear (GeeAbstractCollection* base) { + GeePriorityQueue * self; + GeePriorityQueueType1Node** _tmp0_ = NULL; + gboolean* _tmp1_ = NULL; + self = (GeePriorityQueue*) base; + self->priv->_size = 0; + _gee_priority_queue_node_unref0 (self->priv->_r); + self->priv->_r = NULL; + _gee_priority_queue_node_unref0 (self->priv->_r_prime); + self->priv->_r_prime = NULL; + _gee_priority_queue_node_unref0 (self->priv->_lm_head); + self->priv->_lm_head = NULL; + _gee_priority_queue_node_unref0 (self->priv->_lm_tail); + self->priv->_lm_tail = NULL; + _gee_priority_queue_node_unref0 (self->priv->_p); + self->priv->_p = NULL; + _tmp0_ = g_new0 (GeePriorityQueueType1Node*, 0 + 1); + self->priv->_a = (_vala_array_free (self->priv->_a, self->priv->_a_length1, (GDestroyNotify) gee_priority_queue_node_unref), NULL); + self->priv->_a = _tmp0_; + self->priv->_a_length1 = 0; + self->priv->__a_size_ = self->priv->_a_length1; + _gee_priority_queue_node_pair_unref0 (self->priv->_lp_head); + self->priv->_lp_head = NULL; + _gee_priority_queue_node_pair_unref0 (self->priv->_lp_tail); + self->priv->_lp_tail = NULL; + _tmp1_ = g_new0 (gboolean, 0); + self->priv->_b = (g_free (self->priv->_b), NULL); + self->priv->_b = _tmp1_; + self->priv->_b_length1 = 0; + self->priv->__b_size_ = self->priv->_b_length1; + _gee_priority_queue_node_unref0 (self->priv->_ll_head); + self->priv->_ll_head = NULL; + _gee_priority_queue_node_unref0 (self->priv->_ll_tail); + self->priv->_ll_tail = NULL; + self->priv->_iter_head = NULL; + self->priv->_iter_tail = NULL; +} + + +/** + * {@inheritDoc} + */ +static GeeIterator* gee_priority_queue_real_iterator (GeeAbstractCollection* base) { + GeePriorityQueue * self; + GeeIterator* result = NULL; + GeePriorityQueueIterator* _tmp0_; + self = (GeePriorityQueue*) base; + _tmp0_ = gee_priority_queue_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, self); + result = (GeeIterator*) _tmp0_; + return result; +} + + +static inline gint _gee_priority_queue_compare (GeePriorityQueue* self, GeePriorityQueueNode* node1, GeePriorityQueueNode* node2) { + gint result = 0; + GeePriorityQueueNode* _tmp0_; + gboolean _tmp1_; + g_return_val_if_fail (self != NULL, 0); + g_return_val_if_fail (node1 != NULL, 0); + g_return_val_if_fail (node2 != NULL, 0); + _tmp0_ = node1; + _tmp1_ = _tmp0_->pending_drop; + if (_tmp1_) { + result = -1; + return result; + } else { + GeePriorityQueueNode* _tmp2_; + gboolean _tmp3_; + _tmp2_ = node2; + _tmp3_ = _tmp2_->pending_drop; + if (_tmp3_) { + result = 1; + return result; + } else { + GCompareFunc _tmp4_; + GCompareFunc _tmp5_; + GeePriorityQueueNode* _tmp6_; + gconstpointer _tmp7_; + GeePriorityQueueNode* _tmp8_; + gconstpointer _tmp9_; + gint _tmp10_ = 0; + _tmp4_ = gee_priority_queue_get_compare_func (self); + _tmp5_ = _tmp4_; + _tmp6_ = node1; + _tmp7_ = _tmp6_->data; + _tmp8_ = node2; + _tmp9_ = _tmp8_->data; + _tmp10_ = _tmp5_ (_tmp7_, _tmp9_); + result = _tmp10_; + return result; + } + } +} + + +static inline void _gee_priority_queue_swap_data (GeePriorityQueue* self, GeePriorityQueueNode* node1, GeePriorityQueueNode* node2) { + GeePriorityQueueNode* _tmp0_; + gpointer _tmp1_; + gpointer temp_data; + GeePriorityQueueNode* _tmp2_; + gboolean _tmp3_; + gboolean temp_pending_drop; + GeePriorityQueueNode* _tmp4_; + GeePriorityQueueNode* _tmp5_; + gpointer _tmp6_; + GeePriorityQueueNode* _tmp7_; + GeePriorityQueueNode* _tmp8_; + gboolean _tmp9_; + GeePriorityQueueNode* _tmp10_; + gpointer _tmp11_; + GeePriorityQueueNode* _tmp12_; + gboolean _tmp13_; + GeePriorityQueueNode* _tmp14_; + GeePriorityQueueNode* _tmp15_; + GeePriorityQueueNode* _tmp16_; + GeePriorityQueueNode* _tmp58_; + GeePriorityQueueNode* _tmp59_; + GeePriorityQueueNode* _tmp64_; + GeePriorityQueueNode* _tmp65_; + GeePriorityQueueNode* _tmp70_; + GeePriorityQueueNode* _tmp71_; + GeePriorityQueueNode* _tmp75_; + GeePriorityQueueNode* _tmp76_; + GeePriorityQueueNode* _tmp80_; + GeePriorityQueueNode* _tmp81_; + GeePriorityQueueNode* _tmp85_; + GeePriorityQueueNode* _tmp86_; + g_return_if_fail (self != NULL); + g_return_if_fail (node1 != NULL); + g_return_if_fail (node2 != NULL); + _tmp0_ = node1; + _tmp1_ = _tmp0_->data; + _tmp0_->data = NULL; + temp_data = _tmp1_; + _tmp2_ = node1; + _tmp3_ = _tmp2_->pending_drop; + temp_pending_drop = _tmp3_; + _tmp4_ = node1; + _tmp5_ = node2; + _tmp6_ = _tmp5_->data; + _tmp5_->data = NULL; + ((_tmp4_->data == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp4_->data = (self->priv->g_destroy_func (_tmp4_->data), NULL)); + _tmp4_->data = _tmp6_; + _tmp7_ = node1; + _tmp8_ = node2; + _tmp9_ = _tmp8_->pending_drop; + _tmp7_->pending_drop = _tmp9_; + _tmp10_ = node2; + _tmp11_ = temp_data; + temp_data = NULL; + ((_tmp10_->data == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp10_->data = (self->priv->g_destroy_func (_tmp10_->data), NULL)); + _tmp10_->data = _tmp11_; + _tmp12_ = node2; + _tmp13_ = temp_pending_drop; + _tmp12_->pending_drop = _tmp13_; + _tmp14_ = node1; + _tmp15_ = _tmp14_->iter_next; + _tmp16_ = node2; + if (_tmp15_ == _tmp16_) { + GeePriorityQueueNode* _tmp17_; + GeePriorityQueueNode* _tmp18_; + GeePriorityQueueNode* temp_iter_prev; + GeePriorityQueueNode* _tmp19_; + GeePriorityQueueNode* _tmp20_; + GeePriorityQueueNode* temp_iter_next; + GeePriorityQueueNode* _tmp21_; + GeePriorityQueueNode* _tmp22_; + GeePriorityQueueNode* _tmp23_; + GeePriorityQueueNode* _tmp24_; + GeePriorityQueueNode* _tmp25_; + GeePriorityQueueNode* _tmp26_; + GeePriorityQueueNode* _tmp27_; + GeePriorityQueueNode* _tmp28_; + _tmp17_ = node1; + _tmp18_ = _tmp17_->iter_prev; + temp_iter_prev = _tmp18_; + _tmp19_ = node2; + _tmp20_ = _tmp19_->iter_next; + temp_iter_next = _tmp20_; + _tmp21_ = node1; + _tmp22_ = node2; + _tmp21_->iter_prev = _tmp22_; + _tmp23_ = node1; + _tmp24_ = temp_iter_next; + _tmp23_->iter_next = _tmp24_; + _tmp25_ = node2; + _tmp26_ = temp_iter_prev; + _tmp25_->iter_prev = _tmp26_; + _tmp27_ = node2; + _tmp28_ = node1; + _tmp27_->iter_next = _tmp28_; + } else { + GeePriorityQueueNode* _tmp29_; + GeePriorityQueueNode* _tmp30_; + GeePriorityQueueNode* _tmp31_; + _tmp29_ = node1; + _tmp30_ = _tmp29_->iter_prev; + _tmp31_ = node2; + if (_tmp30_ == _tmp31_) { + GeePriorityQueueNode* _tmp32_; + GeePriorityQueueNode* _tmp33_; + GeePriorityQueueNode* temp_iter_prev; + GeePriorityQueueNode* _tmp34_; + GeePriorityQueueNode* _tmp35_; + GeePriorityQueueNode* temp_iter_next; + GeePriorityQueueNode* _tmp36_; + GeePriorityQueueNode* _tmp37_; + GeePriorityQueueNode* _tmp38_; + GeePriorityQueueNode* _tmp39_; + GeePriorityQueueNode* _tmp40_; + GeePriorityQueueNode* _tmp41_; + GeePriorityQueueNode* _tmp42_; + GeePriorityQueueNode* _tmp43_; + _tmp32_ = node2; + _tmp33_ = _tmp32_->iter_prev; + temp_iter_prev = _tmp33_; + _tmp34_ = node1; + _tmp35_ = _tmp34_->iter_next; + temp_iter_next = _tmp35_; + _tmp36_ = node1; + _tmp37_ = temp_iter_prev; + _tmp36_->iter_prev = _tmp37_; + _tmp38_ = node1; + _tmp39_ = node2; + _tmp38_->iter_next = _tmp39_; + _tmp40_ = node2; + _tmp41_ = node1; + _tmp40_->iter_prev = _tmp41_; + _tmp42_ = node2; + _tmp43_ = temp_iter_next; + _tmp42_->iter_next = _tmp43_; + } else { + GeePriorityQueueNode* _tmp44_; + GeePriorityQueueNode* _tmp45_; + GeePriorityQueueNode* temp_iter_prev; + GeePriorityQueueNode* _tmp46_; + GeePriorityQueueNode* _tmp47_; + GeePriorityQueueNode* temp_iter_next; + GeePriorityQueueNode* _tmp48_; + GeePriorityQueueNode* _tmp49_; + GeePriorityQueueNode* _tmp50_; + GeePriorityQueueNode* _tmp51_; + GeePriorityQueueNode* _tmp52_; + GeePriorityQueueNode* _tmp53_; + GeePriorityQueueNode* _tmp54_; + GeePriorityQueueNode* _tmp55_; + GeePriorityQueueNode* _tmp56_; + GeePriorityQueueNode* _tmp57_; + _tmp44_ = node1; + _tmp45_ = _tmp44_->iter_prev; + temp_iter_prev = _tmp45_; + _tmp46_ = node1; + _tmp47_ = _tmp46_->iter_next; + temp_iter_next = _tmp47_; + _tmp48_ = node1; + _tmp49_ = node2; + _tmp50_ = _tmp49_->iter_prev; + _tmp48_->iter_prev = _tmp50_; + _tmp51_ = node1; + _tmp52_ = node2; + _tmp53_ = _tmp52_->iter_next; + _tmp51_->iter_next = _tmp53_; + _tmp54_ = node2; + _tmp55_ = temp_iter_prev; + _tmp54_->iter_prev = _tmp55_; + _tmp56_ = node2; + _tmp57_ = temp_iter_next; + _tmp56_->iter_next = _tmp57_; + } + } + _tmp58_ = node2; + _tmp59_ = self->priv->_iter_head; + if (_tmp58_ == _tmp59_) { + GeePriorityQueueNode* _tmp60_; + _tmp60_ = node1; + self->priv->_iter_head = _tmp60_; + } else { + GeePriorityQueueNode* _tmp61_; + GeePriorityQueueNode* _tmp62_; + _tmp61_ = node1; + _tmp62_ = self->priv->_iter_head; + if (_tmp61_ == _tmp62_) { + GeePriorityQueueNode* _tmp63_; + _tmp63_ = node2; + self->priv->_iter_head = _tmp63_; + } + } + _tmp64_ = node2; + _tmp65_ = self->priv->_iter_tail; + if (_tmp64_ == _tmp65_) { + GeePriorityQueueNode* _tmp66_; + _tmp66_ = node1; + self->priv->_iter_tail = _tmp66_; + } else { + GeePriorityQueueNode* _tmp67_; + GeePriorityQueueNode* _tmp68_; + _tmp67_ = node1; + _tmp68_ = self->priv->_iter_tail; + if (_tmp67_ == _tmp68_) { + GeePriorityQueueNode* _tmp69_; + _tmp69_ = node2; + self->priv->_iter_tail = _tmp69_; + } + } + _tmp70_ = node1; + _tmp71_ = _tmp70_->iter_prev; + if (_tmp71_ != NULL) { + GeePriorityQueueNode* _tmp72_; + GeePriorityQueueNode* _tmp73_; + GeePriorityQueueNode* _tmp74_; + _tmp72_ = node1; + _tmp73_ = _tmp72_->iter_prev; + _tmp74_ = node1; + _tmp73_->iter_next = _tmp74_; + } + _tmp75_ = node1; + _tmp76_ = _tmp75_->iter_next; + if (_tmp76_ != NULL) { + GeePriorityQueueNode* _tmp77_; + GeePriorityQueueNode* _tmp78_; + GeePriorityQueueNode* _tmp79_; + _tmp77_ = node1; + _tmp78_ = _tmp77_->iter_next; + _tmp79_ = node1; + _tmp78_->iter_prev = _tmp79_; + } + _tmp80_ = node2; + _tmp81_ = _tmp80_->iter_prev; + if (_tmp81_ != NULL) { + GeePriorityQueueNode* _tmp82_; + GeePriorityQueueNode* _tmp83_; + GeePriorityQueueNode* _tmp84_; + _tmp82_ = node2; + _tmp83_ = _tmp82_->iter_prev; + _tmp84_ = node2; + _tmp83_->iter_next = _tmp84_; + } + _tmp85_ = node2; + _tmp86_ = _tmp85_->iter_next; + if (_tmp86_ != NULL) { + GeePriorityQueueNode* _tmp87_; + GeePriorityQueueNode* _tmp88_; + GeePriorityQueueNode* _tmp89_; + _tmp87_ = node2; + _tmp88_ = _tmp87_->iter_next; + _tmp89_ = node2; + _tmp88_->iter_prev = _tmp89_; + } + ((temp_data == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (temp_data = (self->priv->g_destroy_func (temp_data), NULL)); +} + + +static inline void _gee_priority_queue_move_data (GeePriorityQueue* self, GeePriorityQueueNode* target, GeePriorityQueueNode* source) { + GeePriorityQueueNode* _tmp0_; + GeePriorityQueueNode* _tmp1_; + GeePriorityQueueNode* _tmp10_; + GeePriorityQueueNode* _tmp11_; + GeePriorityQueueNode* _tmp20_; + GeePriorityQueueNode* _tmp21_; + gconstpointer _tmp22_; + gpointer _tmp23_; + GeePriorityQueueNode* _tmp24_; + GeePriorityQueueNode* _tmp25_; + gboolean _tmp26_; + GeePriorityQueueNode* _tmp27_; + GeePriorityQueueNode* _tmp28_; + GeePriorityQueueNode* _tmp29_; + GeePriorityQueueNode* _tmp30_; + GeePriorityQueueNode* _tmp31_; + GeePriorityQueueNode* _tmp32_; + GeePriorityQueueNode* _tmp33_; + GeePriorityQueueNode* _tmp34_; + GeePriorityQueueNode* _tmp35_; + GeePriorityQueueNode* _tmp36_; + GeePriorityQueueNode* _tmp43_; + GeePriorityQueueNode* _tmp44_; + g_return_if_fail (self != NULL); + g_return_if_fail (target != NULL); + g_return_if_fail (source != NULL); + _tmp0_ = target; + _tmp1_ = _tmp0_->iter_next; + if (_tmp1_ != NULL) { + GeePriorityQueueNode* _tmp2_; + GeePriorityQueueNode* _tmp3_; + GeePriorityQueueNode* _tmp4_; + GeePriorityQueueNode* _tmp5_; + _tmp2_ = target; + _tmp3_ = _tmp2_->iter_next; + _tmp4_ = target; + _tmp5_ = _tmp4_->iter_prev; + _tmp3_->iter_prev = _tmp5_; + } else { + GeePriorityQueueNode* _tmp6_; + GeePriorityQueueNode* _tmp7_; + _tmp6_ = self->priv->_iter_tail; + _tmp7_ = target; + if (_tmp6_ == _tmp7_) { + GeePriorityQueueNode* _tmp8_; + GeePriorityQueueNode* _tmp9_; + _tmp8_ = target; + _tmp9_ = _tmp8_->iter_prev; + self->priv->_iter_tail = _tmp9_; + } + } + _tmp10_ = target; + _tmp11_ = _tmp10_->iter_prev; + if (_tmp11_ != NULL) { + GeePriorityQueueNode* _tmp12_; + GeePriorityQueueNode* _tmp13_; + GeePriorityQueueNode* _tmp14_; + GeePriorityQueueNode* _tmp15_; + _tmp12_ = target; + _tmp13_ = _tmp12_->iter_prev; + _tmp14_ = target; + _tmp15_ = _tmp14_->iter_next; + _tmp13_->iter_next = _tmp15_; + } else { + GeePriorityQueueNode* _tmp16_; + GeePriorityQueueNode* _tmp17_; + _tmp16_ = self->priv->_iter_head; + _tmp17_ = target; + if (_tmp16_ == _tmp17_) { + GeePriorityQueueNode* _tmp18_; + GeePriorityQueueNode* _tmp19_; + _tmp18_ = target; + _tmp19_ = _tmp18_->iter_next; + self->priv->_iter_head = _tmp19_; + } + } + _tmp20_ = target; + _tmp21_ = source; + _tmp22_ = _tmp21_->data; + _tmp23_ = ((_tmp22_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp22_) : ((gpointer) _tmp22_); + ((_tmp20_->data == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp20_->data = (self->priv->g_destroy_func (_tmp20_->data), NULL)); + _tmp20_->data = _tmp23_; + _tmp24_ = target; + _tmp25_ = source; + _tmp26_ = _tmp25_->pending_drop; + _tmp24_->pending_drop = _tmp26_; + _tmp27_ = target; + _tmp28_ = source; + _tmp29_ = _tmp28_->iter_next; + _tmp27_->iter_next = _tmp29_; + _tmp30_ = target; + _tmp31_ = source; + _tmp32_ = _tmp31_->iter_prev; + _tmp30_->iter_prev = _tmp32_; + _tmp33_ = source; + _tmp33_->iter_next = NULL; + _tmp34_ = source; + _tmp34_->iter_prev = NULL; + _tmp35_ = target; + _tmp36_ = _tmp35_->iter_next; + if (_tmp36_ != NULL) { + GeePriorityQueueNode* _tmp37_; + GeePriorityQueueNode* _tmp38_; + GeePriorityQueueNode* _tmp39_; + _tmp37_ = target; + _tmp38_ = _tmp37_->iter_next; + _tmp39_ = target; + _tmp38_->iter_prev = _tmp39_; + } else { + GeePriorityQueueNode* _tmp40_; + GeePriorityQueueNode* _tmp41_; + _tmp40_ = self->priv->_iter_tail; + _tmp41_ = source; + if (_tmp40_ == _tmp41_) { + GeePriorityQueueNode* _tmp42_; + _tmp42_ = target; + self->priv->_iter_tail = _tmp42_; + } + } + _tmp43_ = target; + _tmp44_ = _tmp43_->iter_prev; + if (_tmp44_ != NULL) { + GeePriorityQueueNode* _tmp45_; + GeePriorityQueueNode* _tmp46_; + GeePriorityQueueNode* _tmp47_; + _tmp45_ = target; + _tmp46_ = _tmp45_->iter_prev; + _tmp47_ = target; + _tmp46_->iter_next = _tmp47_; + } else { + GeePriorityQueueNode* _tmp48_; + GeePriorityQueueNode* _tmp49_; + _tmp48_ = self->priv->_iter_head; + _tmp49_ = source; + if (_tmp48_ == _tmp49_) { + GeePriorityQueueNode* _tmp50_; + _tmp50_ = target; + self->priv->_iter_head = _tmp50_; + } + } +} + + +static void _gee_priority_queue_link (GeePriorityQueue* self, GeePriorityQueueType1Node* ri, GeePriorityQueueType1Node* rj) { + GeePriorityQueueType1Node* _tmp0_; + gint _tmp1_ = 0; + GeePriorityQueueType1Node* _tmp2_; + gint _tmp3_ = 0; + GeePriorityQueueType1Node* _tmp4_; + GeePriorityQueueType1Node* _tmp5_; + GeePriorityQueueType1Node* _tmp6_; + GeePriorityQueueType1Node* _tmp7_; + gint _tmp8_ = 0; + GeePriorityQueueType1Node* _tmp15_; + GeePriorityQueueType1Node* _tmp16_; + GeePriorityQueueType1Node* _tmp17_; + g_return_if_fail (self != NULL); + g_return_if_fail (ri != NULL); + g_return_if_fail (rj != NULL); + _tmp0_ = ri; + _tmp1_ = gee_priority_queue_node_degree ((GeePriorityQueueNode*) _tmp0_); + _tmp2_ = rj; + _tmp3_ = gee_priority_queue_node_degree ((GeePriorityQueueNode*) _tmp2_); + _vala_assert (_tmp1_ == _tmp3_, "ri.degree () == rj.degree ()"); + _tmp4_ = ri; + _gee_priority_queue_remove_type1_node (self, _tmp4_, FALSE); + _tmp5_ = rj; + _gee_priority_queue_remove_type1_node (self, _tmp5_, FALSE); + _tmp6_ = ri; + _tmp7_ = rj; + _tmp8_ = _gee_priority_queue_compare (self, (GeePriorityQueueNode*) _tmp6_, (GeePriorityQueueNode*) _tmp7_); + if (_tmp8_ > 0) { + GeePriorityQueueType1Node* _tmp9_; + GeePriorityQueueType1Node* _tmp10_; + GeePriorityQueueType1Node* temp; + GeePriorityQueueType1Node* _tmp11_; + GeePriorityQueueType1Node* _tmp12_; + GeePriorityQueueType1Node* _tmp13_; + GeePriorityQueueType1Node* _tmp14_; + _tmp9_ = ri; + _tmp10_ = _gee_priority_queue_node_ref0 (_tmp9_); + temp = _tmp10_; + _tmp11_ = rj; + _tmp12_ = _gee_priority_queue_node_ref0 (_tmp11_); + _gee_priority_queue_node_unref0 (ri); + ri = _tmp12_; + _tmp13_ = temp; + _tmp14_ = _gee_priority_queue_node_ref0 (_tmp13_); + _gee_priority_queue_node_unref0 (rj); + rj = _tmp14_; + _gee_priority_queue_node_unref0 (temp); + } + _tmp15_ = rj; + _tmp16_ = ri; + _gee_priority_queue_add_to (self, _tmp15_, _tmp16_); + _tmp17_ = ri; + _gee_priority_queue_add_in_r_prime (self, _tmp17_); + _gee_priority_queue_node_unref0 (ri); + _gee_priority_queue_node_unref0 (rj); +} + + +static void _gee_priority_queue_add (GeePriorityQueue* self, GeePriorityQueueType1Node* n) { + GeePriorityQueueType1Node* _tmp0_; + GeePriorityQueueType1Node* _tmp1_; + GeePriorityQueueType2Node* _tmp2_; + gint _tmp3_ = 0; + GeePriorityQueueType2Node* _tmp6_; + GeePriorityQueueType1Node* _tmp7_; + gint _tmp8_ = 0; + g_return_if_fail (self != NULL); + g_return_if_fail (n != NULL); + _tmp0_ = n; + _gee_priority_queue_add_in_r_prime (self, _tmp0_); + _tmp1_ = n; + _tmp2_ = self->priv->_r_prime; + _tmp3_ = _gee_priority_queue_compare (self, (GeePriorityQueueNode*) _tmp1_, (GeePriorityQueueNode*) _tmp2_); + if (_tmp3_ < 0) { + GeePriorityQueueType1Node* _tmp4_; + GeePriorityQueueType2Node* _tmp5_; + _tmp4_ = n; + _tmp5_ = self->priv->_r_prime; + _gee_priority_queue_swap_data (self, (GeePriorityQueueNode*) _tmp4_, (GeePriorityQueueNode*) _tmp5_); + } + _tmp6_ = self->priv->_r_prime; + _tmp7_ = self->priv->_r; + _tmp8_ = _gee_priority_queue_compare (self, (GeePriorityQueueNode*) _tmp6_, (GeePriorityQueueNode*) _tmp7_); + if (_tmp8_ < 0) { + GeePriorityQueueType2Node* _tmp9_; + GeePriorityQueueType1Node* _tmp10_; + _tmp9_ = self->priv->_r_prime; + _tmp10_ = self->priv->_r; + _gee_priority_queue_swap_data (self, (GeePriorityQueueNode*) _tmp9_, (GeePriorityQueueNode*) _tmp10_); + } + _gee_priority_queue_check_linkable (self); +} + + +static gpointer _gee_priority_queue_node_pair_ref0 (gpointer self) { + return self ? gee_priority_queue_node_pair_ref (self) : NULL; +} + + +static gboolean _gee_priority_queue_check_linkable (GeePriorityQueue* self) { + gboolean result = FALSE; + GeePriorityQueueNodePair* _tmp0_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = self->priv->_lp_head; + if (_tmp0_ != NULL) { + GeePriorityQueueNodePair* _tmp1_; + GeePriorityQueueNodePair* _tmp2_; + GeePriorityQueueNodePair* pair; + GeePriorityQueueNodePair* _tmp3_; + GeePriorityQueueType1Node* _tmp4_; + GeePriorityQueueType1Node* _tmp5_; + GeePriorityQueueNodePair* _tmp6_; + GeePriorityQueueType1Node* _tmp7_; + GeePriorityQueueType1Node* _tmp8_; + _tmp1_ = self->priv->_lp_head; + _tmp2_ = _gee_priority_queue_node_pair_ref0 (_tmp1_); + pair = _tmp2_; + _tmp3_ = pair; + _tmp4_ = _tmp3_->node1; + _tmp5_ = _gee_priority_queue_node_ref0 (_tmp4_); + _tmp6_ = pair; + _tmp7_ = _tmp6_->node2; + _tmp8_ = _gee_priority_queue_node_ref0 (_tmp7_); + _gee_priority_queue_link (self, _tmp5_, _tmp8_); + result = TRUE; + _gee_priority_queue_node_pair_unref0 (pair); + return result; + } + result = FALSE; + return result; +} + + +static GeePriorityQueueNode* _gee_priority_queue_re_insert (GeePriorityQueue* self, GeePriorityQueueType1Node* n) { + GeePriorityQueueNode* result = NULL; + GeePriorityQueueType1Node* _tmp0_; + GeePriorityQueueType1Node* _tmp1_; + GeePriorityQueueType1Node* _tmp2_; + GeePriorityQueueNode* _tmp3_; + GeePriorityQueueNode* _tmp4_; + GeePriorityQueueNode* parent; + GeePriorityQueueType1Node* _tmp5_; + GeePriorityQueueType1Node* _tmp6_; + g_return_val_if_fail (self != NULL, NULL); + g_return_val_if_fail (n != NULL, NULL); + _tmp0_ = n; + _tmp1_ = self->priv->_r; + _vala_assert (_tmp0_ != _tmp1_, "n != _r"); + _tmp2_ = n; + _tmp3_ = ((GeePriorityQueueNode*) _tmp2_)->parent; + _tmp4_ = _gee_priority_queue_node_ref0 (_tmp3_); + parent = _tmp4_; + _tmp5_ = n; + _gee_priority_queue_remove_type1_node (self, _tmp5_, FALSE); + _tmp6_ = n; + _gee_priority_queue_add (self, _tmp6_); + result = parent; + _gee_priority_queue_node_unref0 (n); + return result; +} + + +static void _gee_priority_queue_adjust (GeePriorityQueue* self, GeePriorityQueueType1Node* p1, GeePriorityQueueType1Node* p2) { + GeePriorityQueueType1Node* _tmp0_; + GeePriorityQueueType1Node* m = NULL; + GeePriorityQueueType1Node* _tmp1_; + guint _tmp2_; + GeePriorityQueueType1Node* _tmp3_; + guint _tmp4_; + GeePriorityQueueType1Node* _tmp9_; + guint _tmp10_; + GeePriorityQueueType1Node* _tmp20_; + GeePriorityQueueType1Node* _tmp21_; + GeePriorityQueueNode* _tmp22_ = NULL; + g_return_if_fail (self != NULL); + g_return_if_fail (p1 != NULL); + g_return_if_fail (p2 != NULL); + _tmp0_ = self->priv->_ll_head; + if (_tmp0_ == NULL) { + return; + } + _tmp1_ = p1; + _tmp2_ = _tmp1_->lost; + _tmp3_ = p2; + _tmp4_ = _tmp3_->lost; + if (_tmp2_ > _tmp4_) { + GeePriorityQueueType1Node* _tmp5_; + GeePriorityQueueType1Node* _tmp6_; + _tmp5_ = p1; + _tmp6_ = _gee_priority_queue_node_ref0 (_tmp5_); + _gee_priority_queue_node_unref0 (m); + m = _tmp6_; + } else { + GeePriorityQueueType1Node* _tmp7_; + GeePriorityQueueType1Node* _tmp8_; + _tmp7_ = p2; + _tmp8_ = _gee_priority_queue_node_ref0 (_tmp7_); + _gee_priority_queue_node_unref0 (m); + m = _tmp8_; + } + _tmp9_ = m; + _tmp10_ = _tmp9_->lost; + if (_tmp10_ <= ((guint) 1)) { + GeePriorityQueueType1Node* _tmp11_; + GeePriorityQueueType1Node* _tmp12_; + GeePriorityQueueType1Node* _tmp13_; + GeePriorityQueueType1Node* _tmp14_; + GeePriorityQueueType1Node* _tmp17_; + GeePriorityQueueType1Node* _tmp18_; + GeePriorityQueueType1Node* _tmp19_; + _tmp11_ = self->priv->_ll_head; + _tmp12_ = _gee_priority_queue_node_ref0 (_tmp11_); + _gee_priority_queue_node_unref0 (m); + m = _tmp12_; + _tmp13_ = self->priv->_ll_head; + _tmp14_ = _tmp13_->ll_next; + if (_tmp14_ != NULL) { + GeePriorityQueueType1Node* _tmp15_; + GeePriorityQueueType1Node* _tmp16_; + _tmp15_ = self->priv->_ll_head; + _tmp16_ = _tmp15_->ll_next; + _tmp16_->ll_prev = NULL; + } + _tmp17_ = self->priv->_ll_head; + _tmp18_ = _tmp17_->ll_next; + _tmp19_ = _gee_priority_queue_node_ref0 (_tmp18_); + _gee_priority_queue_node_unref0 (self->priv->_ll_head); + self->priv->_ll_head = _tmp19_; + } + _tmp20_ = m; + _tmp21_ = _gee_priority_queue_node_ref0 (_tmp20_); + _tmp22_ = _gee_priority_queue_re_insert (self, _tmp21_); + _gee_priority_queue_node_unref0 (self->priv->_p); + self->priv->_p = G_TYPE_CHECK_INSTANCE_CAST (_tmp22_, GEE_PRIORITY_QUEUE_TYPE_TYPE1_NODE, GeePriorityQueueType1Node); + _gee_priority_queue_node_unref0 (m); +} + + +static void _gee_priority_queue_delete (GeePriorityQueue* self, GeePriorityQueueNode* n, GeePriorityQueueNode** prev) { + GeePriorityQueueNode* _vala_prev = NULL; + GeePriorityQueueNode* _tmp0_; + gpointer _tmp1_ = NULL; + gpointer _tmp2_; + g_return_if_fail (self != NULL); + g_return_if_fail (n != NULL); + _tmp0_ = n; + _gee_priority_queue_decrease_key (self, _tmp0_); + _tmp1_ = gee_abstract_queue_poll ((GeeAbstractQueue*) self); + _tmp2_ = _tmp1_; + ((_tmp2_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp2_ = (self->priv->g_destroy_func (_tmp2_), NULL)); + if (prev) { + *prev = _vala_prev; + } +} + + +static void _gee_priority_queue_decrease_key (GeePriorityQueue* self, GeePriorityQueueNode* n) { + gboolean _tmp0_ = FALSE; + GeePriorityQueueNode* _tmp1_; + GeePriorityQueueType1Node* _tmp2_; + gboolean _tmp4_; + GeePriorityQueueNode* _tmp5_; + gboolean _tmp6_ = FALSE; + GeePriorityQueueNode* _tmp7_; + GeePriorityQueueType2Node* _tmp8_; + gboolean _tmp12_; + GeePriorityQueueNode* _tmp15_; + GeePriorityQueueType1Node* _tmp16_; + GeePriorityQueueNode* _tmp17_ = NULL; + GeePriorityQueueNode* p_prime; + GeePriorityQueueNode* _tmp18_; + g_return_if_fail (self != NULL); + g_return_if_fail (n != NULL); + _tmp1_ = n; + _tmp2_ = self->priv->_r; + if (_tmp1_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GEE_PRIORITY_QUEUE_TYPE_NODE, GeePriorityQueueNode)) { + _tmp0_ = TRUE; + } else { + GeePriorityQueueType2Node* _tmp3_; + _tmp3_ = self->priv->_r_prime; + _tmp0_ = _tmp3_ == NULL; + } + _tmp4_ = _tmp0_; + if (_tmp4_) { + return; + } + _tmp5_ = n; + _tmp5_->pending_drop = TRUE; + _tmp7_ = n; + _tmp8_ = self->priv->_r_prime; + if (_tmp7_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, GEE_PRIORITY_QUEUE_TYPE_NODE, GeePriorityQueueNode)) { + GeePriorityQueueType2Node* _tmp9_; + GeePriorityQueueType1Node* _tmp10_; + gint _tmp11_ = 0; + _tmp9_ = self->priv->_r_prime; + _tmp10_ = self->priv->_r; + _tmp11_ = _gee_priority_queue_compare (self, (GeePriorityQueueNode*) _tmp9_, (GeePriorityQueueNode*) _tmp10_); + _tmp6_ = _tmp11_ < 0; + } else { + _tmp6_ = FALSE; + } + _tmp12_ = _tmp6_; + if (_tmp12_) { + GeePriorityQueueType2Node* _tmp13_; + GeePriorityQueueType1Node* _tmp14_; + _tmp13_ = self->priv->_r_prime; + _tmp14_ = self->priv->_r; + _gee_priority_queue_swap_data (self, (GeePriorityQueueNode*) _tmp13_, (GeePriorityQueueNode*) _tmp14_); + return; + } + _tmp15_ = n; + _tmp16_ = _gee_priority_queue_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, GEE_PRIORITY_QUEUE_TYPE_TYPE1_NODE, GeePriorityQueueType1Node)); + _tmp17_ = _gee_priority_queue_re_insert (self, _tmp16_); + p_prime = _tmp17_; + _tmp18_ = p_prime; + if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp18_, GEE_PRIORITY_QUEUE_TYPE_TYPE2_NODE)) { + GeePriorityQueueType1Node* _tmp19_; + GeePriorityQueueType1Node* _tmp20_; + _tmp19_ = self->priv->_p; + _tmp20_ = self->priv->_p; + _gee_priority_queue_adjust (self, _tmp19_, _tmp20_); + } else { + GeePriorityQueueType1Node* _tmp21_; + GeePriorityQueueNode* _tmp22_; + _tmp21_ = self->priv->_p; + _tmp22_ = p_prime; + _gee_priority_queue_adjust (self, _tmp21_, G_TYPE_CHECK_INSTANCE_CAST (_tmp22_, GEE_PRIORITY_QUEUE_TYPE_TYPE1_NODE, GeePriorityQueueType1Node)); + } + _gee_priority_queue_node_unref0 (p_prime); +} + + +static void _gee_priority_queue_add_to (GeePriorityQueue* self, GeePriorityQueueType1Node* node, GeePriorityQueueType1Node* parent) { + GeePriorityQueueType1Node* _tmp0_; + GeePriorityQueueType1Node* _tmp1_; + GeePriorityQueueType1Node* _tmp2_; + g_return_if_fail (self != NULL); + g_return_if_fail (node != NULL); + g_return_if_fail (parent != NULL); + _tmp0_ = parent; + _tmp1_ = node; + gee_priority_queue_type1_node_add (_tmp0_, _tmp1_); + _tmp2_ = parent; + _tmp2_->lost = (guint) 0; +} + + +static void _gee_priority_queue_add_in_r_prime (GeePriorityQueue* self, GeePriorityQueueType1Node* node) { + GeePriorityQueueType1Node* _tmp0_; + gint _tmp1_ = 0; + gint degree; + GeePriorityQueueType1Node* insertion_point; + gint _tmp2_; + GeePriorityQueueType1Node** _tmp3_; + gint _tmp3__length1; + GeePriorityQueueType1Node* _tmp8_; + GeePriorityQueueType1Node* _tmp41_; + GeePriorityQueueType2Node* _tmp42_; + gint _tmp43_; + GeePriorityQueueType1Node** _tmp44_; + gint _tmp44__length1; + GeePriorityQueueType1Node** _tmp49_; + gint _tmp49__length1; + gint _tmp50_; + GeePriorityQueueType1Node* _tmp51_; + GeePriorityQueueType1Node** _tmp85_; + gint _tmp85__length1; + gint _tmp86_; + GeePriorityQueueType1Node* _tmp87_; + GeePriorityQueueType1Node* _tmp88_; + GeePriorityQueueType1Node* _tmp89_; + g_return_if_fail (self != NULL); + g_return_if_fail (node != NULL); + _tmp0_ = node; + _tmp1_ = gee_priority_queue_node_degree ((GeePriorityQueueNode*) _tmp0_); + degree = _tmp1_; + insertion_point = NULL; + _tmp2_ = degree; + _tmp3_ = self->priv->_a; + _tmp3__length1 = self->priv->_a_length1; + if (_tmp2_ < _tmp3__length1) { + GeePriorityQueueType1Node** _tmp4_; + gint _tmp4__length1; + gint _tmp5_; + GeePriorityQueueType1Node* _tmp6_; + GeePriorityQueueType1Node* _tmp7_; + _tmp4_ = self->priv->_a; + _tmp4__length1 = self->priv->_a_length1; + _tmp5_ = degree; + _tmp6_ = _tmp4_[_tmp5_]; + _tmp7_ = _gee_priority_queue_node_ref0 (_tmp6_); + _gee_priority_queue_node_unref0 (insertion_point); + insertion_point = _tmp7_; + } + _tmp8_ = insertion_point; + if (_tmp8_ == NULL) { + GeePriorityQueueType2Node* _tmp9_; + GeePriorityQueueType1Node* _tmp10_; + GeePriorityQueueType2Node* _tmp21_; + GeePriorityQueueType1Node* _tmp22_; + GeePriorityQueueType1Node* _tmp23_; + _tmp9_ = self->priv->_r_prime; + _tmp10_ = ((GeePriorityQueueNode*) _tmp9_)->type1_children_tail; + if (_tmp10_ != NULL) { + GeePriorityQueueType1Node* _tmp11_; + GeePriorityQueueType2Node* _tmp12_; + GeePriorityQueueType1Node* _tmp13_; + GeePriorityQueueType2Node* _tmp14_; + GeePriorityQueueType1Node* _tmp15_; + GeePriorityQueueType1Node* _tmp16_; + GeePriorityQueueType1Node* _tmp17_; + _tmp11_ = node; + _tmp12_ = self->priv->_r_prime; + _tmp13_ = ((GeePriorityQueueNode*) _tmp12_)->type1_children_tail; + _tmp11_->brothers_prev = _tmp13_; + _tmp14_ = self->priv->_r_prime; + _tmp15_ = ((GeePriorityQueueNode*) _tmp14_)->type1_children_tail; + _tmp16_ = node; + _tmp17_ = _gee_priority_queue_node_ref0 (_tmp16_); + _gee_priority_queue_node_unref0 (_tmp15_->brothers_next); + _tmp15_->brothers_next = _tmp17_; + } else { + GeePriorityQueueType2Node* _tmp18_; + GeePriorityQueueType1Node* _tmp19_; + GeePriorityQueueType1Node* _tmp20_; + _tmp18_ = self->priv->_r_prime; + _tmp19_ = node; + _tmp20_ = _gee_priority_queue_node_ref0 (_tmp19_); + _gee_priority_queue_node_unref0 (((GeePriorityQueueNode*) _tmp18_)->type1_children_head); + ((GeePriorityQueueNode*) _tmp18_)->type1_children_head = _tmp20_; + } + _tmp21_ = self->priv->_r_prime; + _tmp22_ = node; + _tmp23_ = _gee_priority_queue_node_ref0 (_tmp22_); + _gee_priority_queue_node_unref0 (((GeePriorityQueueNode*) _tmp21_)->type1_children_tail); + ((GeePriorityQueueNode*) _tmp21_)->type1_children_tail = _tmp23_; + } else { + GeePriorityQueueType1Node* _tmp24_; + GeePriorityQueueType1Node* _tmp25_; + GeePriorityQueueType1Node* _tmp36_; + GeePriorityQueueType1Node* _tmp37_; + GeePriorityQueueType1Node* _tmp38_; + GeePriorityQueueType1Node* _tmp39_; + GeePriorityQueueType1Node* _tmp40_; + _tmp24_ = insertion_point; + _tmp25_ = _tmp24_->brothers_prev; + if (_tmp25_ != NULL) { + GeePriorityQueueType1Node* _tmp26_; + GeePriorityQueueType1Node* _tmp27_; + GeePriorityQueueType1Node* _tmp28_; + GeePriorityQueueType1Node* _tmp29_; + GeePriorityQueueType1Node* _tmp30_; + GeePriorityQueueType1Node* _tmp31_; + GeePriorityQueueType1Node* _tmp32_; + _tmp26_ = insertion_point; + _tmp27_ = _tmp26_->brothers_prev; + _tmp28_ = node; + _tmp29_ = _gee_priority_queue_node_ref0 (_tmp28_); + _gee_priority_queue_node_unref0 (_tmp27_->brothers_next); + _tmp27_->brothers_next = _tmp29_; + _tmp30_ = node; + _tmp31_ = insertion_point; + _tmp32_ = _tmp31_->brothers_prev; + _tmp30_->brothers_prev = _tmp32_; + } else { + GeePriorityQueueType2Node* _tmp33_; + GeePriorityQueueType1Node* _tmp34_; + GeePriorityQueueType1Node* _tmp35_; + _tmp33_ = self->priv->_r_prime; + _tmp34_ = node; + _tmp35_ = _gee_priority_queue_node_ref0 (_tmp34_); + _gee_priority_queue_node_unref0 (((GeePriorityQueueNode*) _tmp33_)->type1_children_head); + ((GeePriorityQueueNode*) _tmp33_)->type1_children_head = _tmp35_; + } + _tmp36_ = node; + _tmp37_ = insertion_point; + _tmp38_ = _gee_priority_queue_node_ref0 (_tmp37_); + _gee_priority_queue_node_unref0 (_tmp36_->brothers_next); + _tmp36_->brothers_next = _tmp38_; + _tmp39_ = insertion_point; + _tmp40_ = node; + _tmp39_->brothers_prev = _tmp40_; + } + _tmp41_ = node; + _tmp42_ = self->priv->_r_prime; + ((GeePriorityQueueNode*) _tmp41_)->parent = (GeePriorityQueueNode*) _tmp42_; + _tmp43_ = degree; + _tmp44_ = self->priv->_a; + _tmp44__length1 = self->priv->_a_length1; + if (_tmp43_ >= _tmp44__length1) { + gint _tmp45_; + gint _tmp46_ = 0; + gint _tmp47_; + gint _tmp48_ = 0; + _tmp45_ = degree; + _tmp46_ = _tmp45_ + 1; + self->priv->_a = g_renew (GeePriorityQueueType1Node*, self->priv->_a, _tmp45_ + 1); + (_tmp46_ > self->priv->_a_length1) ? memset (self->priv->_a + self->priv->_a_length1, 0, sizeof (GeePriorityQueueType1Node*) * (_tmp46_ - self->priv->_a_length1)) : NULL; + self->priv->_a_length1 = _tmp46_; + self->priv->__a_size_ = _tmp46_; + _tmp47_ = degree; + _tmp48_ = _tmp47_ + 1; + self->priv->_b = g_renew (gboolean, self->priv->_b, _tmp47_ + 1); + (_tmp48_ > self->priv->_b_length1) ? memset (self->priv->_b + self->priv->_b_length1, 0, sizeof (gboolean) * (_tmp48_ - self->priv->_b_length1)) : NULL; + self->priv->_b_length1 = _tmp48_; + self->priv->__b_size_ = _tmp48_; + } + _tmp49_ = self->priv->_a; + _tmp49__length1 = self->priv->_a_length1; + _tmp50_ = degree; + _tmp51_ = _tmp49_[_tmp50_]; + if (_tmp51_ == NULL) { + gboolean* _tmp52_; + gint _tmp52__length1; + gint _tmp53_; + gboolean _tmp54_; + _tmp52_ = self->priv->_b; + _tmp52__length1 = self->priv->_b_length1; + _tmp53_ = degree; + _tmp52_[_tmp53_] = TRUE; + _tmp54_ = _tmp52_[_tmp53_]; + } else { + gboolean* _tmp55_; + gint _tmp55__length1; + gint _tmp56_; + gboolean _tmp57_; + _tmp55_ = self->priv->_b; + _tmp55__length1 = self->priv->_b_length1; + _tmp56_ = degree; + _tmp57_ = _tmp55_[_tmp56_]; + if (_tmp57_) { + GeePriorityQueueType1Node* _tmp58_; + GeePriorityQueueType1Node* _tmp59_; + GeePriorityQueueType1Node* _tmp60_; + GeePriorityQueueNodePair* _tmp61_; + GeePriorityQueueNodePair* pair; + GeePriorityQueueType1Node* _tmp62_; + GeePriorityQueueType1Node* _tmp63_; + GeePriorityQueueNodePair* _tmp64_; + GeePriorityQueueType1Node* _tmp65_; + GeePriorityQueueNodePair* _tmp66_; + GeePriorityQueueNodePair* _tmp67_; + gboolean* _tmp79_; + gint _tmp79__length1; + gint _tmp80_; + gboolean _tmp81_; + _tmp58_ = node; + _tmp59_ = node; + _tmp60_ = _tmp59_->brothers_next; + _tmp61_ = gee_priority_queue_node_pair_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp58_, _tmp60_); + pair = _tmp61_; + _tmp62_ = node; + _tmp63_ = _tmp62_->brothers_next; + _tmp64_ = pair; + _tmp63_->pair = _tmp64_; + _tmp65_ = node; + _tmp66_ = pair; + _tmp65_->pair = _tmp66_; + _tmp67_ = self->priv->_lp_head; + if (_tmp67_ == NULL) { + GeePriorityQueueNodePair* _tmp68_; + GeePriorityQueueNodePair* _tmp69_; + GeePriorityQueueNodePair* _tmp70_; + GeePriorityQueueNodePair* _tmp71_; + _tmp68_ = pair; + _tmp69_ = _gee_priority_queue_node_pair_ref0 (_tmp68_); + _gee_priority_queue_node_pair_unref0 (self->priv->_lp_head); + self->priv->_lp_head = _tmp69_; + _tmp70_ = pair; + _tmp71_ = _gee_priority_queue_node_pair_ref0 (_tmp70_); + _gee_priority_queue_node_pair_unref0 (self->priv->_lp_tail); + self->priv->_lp_tail = _tmp71_; + } else { + GeePriorityQueueNodePair* _tmp72_; + GeePriorityQueueNodePair* _tmp73_; + GeePriorityQueueNodePair* _tmp74_; + GeePriorityQueueNodePair* _tmp75_; + GeePriorityQueueNodePair* _tmp76_; + GeePriorityQueueNodePair* _tmp77_; + GeePriorityQueueNodePair* _tmp78_; + _tmp72_ = pair; + _tmp73_ = self->priv->_lp_tail; + _tmp72_->lp_prev = _tmp73_; + _tmp74_ = self->priv->_lp_tail; + _tmp75_ = pair; + _tmp76_ = _gee_priority_queue_node_pair_ref0 (_tmp75_); + _gee_priority_queue_node_pair_unref0 (_tmp74_->lp_next); + _tmp74_->lp_next = _tmp76_; + _tmp77_ = pair; + _tmp78_ = _gee_priority_queue_node_pair_ref0 (_tmp77_); + _gee_priority_queue_node_pair_unref0 (self->priv->_lp_tail); + self->priv->_lp_tail = _tmp78_; + } + _tmp79_ = self->priv->_b; + _tmp79__length1 = self->priv->_b_length1; + _tmp80_ = degree; + _tmp79_[_tmp80_] = FALSE; + _tmp81_ = _tmp79_[_tmp80_]; + _gee_priority_queue_node_pair_unref0 (pair); + } else { + gboolean* _tmp82_; + gint _tmp82__length1; + gint _tmp83_; + gboolean _tmp84_; + _tmp82_ = self->priv->_b; + _tmp82__length1 = self->priv->_b_length1; + _tmp83_ = degree; + _tmp82_[_tmp83_] = TRUE; + _tmp84_ = _tmp82_[_tmp83_]; + } + } + _tmp85_ = self->priv->_a; + _tmp85__length1 = self->priv->_a_length1; + _tmp86_ = degree; + _tmp87_ = node; + _tmp88_ = _gee_priority_queue_node_ref0 (_tmp87_); + _gee_priority_queue_node_unref0 (_tmp85_[_tmp86_]); + _tmp85_[_tmp86_] = _tmp88_; + _tmp89_ = _tmp85_[_tmp86_]; + _gee_priority_queue_node_unref0 (insertion_point); +} + + +static void _gee_priority_queue_remove_type1_node (GeePriorityQueue* self, GeePriorityQueueType1Node* node, gboolean with_iteration) { + GeePriorityQueueType1Node* _tmp0_; + GeePriorityQueueNode* _tmp1_; + GeePriorityQueueType2Node* _tmp2_; + GeePriorityQueueType1Node* _tmp55_; + GeePriorityQueueType1Node* _tmp56_; + GeePriorityQueueType1Node* _tmp57_; + gboolean _tmp58_; + g_return_if_fail (self != NULL); + g_return_if_fail (node != NULL); + _tmp0_ = node; + _tmp1_ = ((GeePriorityQueueNode*) _tmp0_)->parent; + _tmp2_ = self->priv->_r_prime; + if (_tmp1_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GEE_PRIORITY_QUEUE_TYPE_NODE, GeePriorityQueueNode)) { + GeePriorityQueueType1Node* _tmp3_; + _tmp3_ = node; + _gee_priority_queue_updated_degree (self, _tmp3_, FALSE); + } else { + GeePriorityQueueType1Node* _tmp4_; + GeePriorityQueueType1Node* _tmp5_; + GeePriorityQueueType1Node* _tmp16_; + GeePriorityQueueType1Node* _tmp17_; + GeePriorityQueueType1Node* _tmp27_; + GeePriorityQueueNode* _tmp28_; + _tmp4_ = node; + _tmp5_ = _tmp4_->ll_prev; + if (_tmp5_ != NULL) { + GeePriorityQueueType1Node* _tmp6_; + GeePriorityQueueType1Node* _tmp7_; + GeePriorityQueueType1Node* _tmp8_; + GeePriorityQueueType1Node* _tmp9_; + GeePriorityQueueType1Node* _tmp10_; + _tmp6_ = node; + _tmp7_ = _tmp6_->ll_prev; + _tmp8_ = node; + _tmp9_ = _tmp8_->ll_next; + _tmp10_ = _gee_priority_queue_node_ref0 (_tmp9_); + _gee_priority_queue_node_unref0 (_tmp7_->ll_next); + _tmp7_->ll_next = _tmp10_; + } else { + GeePriorityQueueType1Node* _tmp11_; + GeePriorityQueueType1Node* _tmp12_; + _tmp11_ = self->priv->_ll_head; + _tmp12_ = node; + if (_tmp11_ == _tmp12_) { + GeePriorityQueueType1Node* _tmp13_; + GeePriorityQueueType1Node* _tmp14_; + GeePriorityQueueType1Node* _tmp15_; + _tmp13_ = node; + _tmp14_ = _tmp13_->ll_next; + _tmp15_ = _gee_priority_queue_node_ref0 (_tmp14_); + _gee_priority_queue_node_unref0 (self->priv->_ll_head); + self->priv->_ll_head = _tmp15_; + } + } + _tmp16_ = node; + _tmp17_ = _tmp16_->ll_next; + if (_tmp17_ != NULL) { + GeePriorityQueueType1Node* _tmp18_; + GeePriorityQueueType1Node* _tmp19_; + GeePriorityQueueType1Node* _tmp20_; + GeePriorityQueueType1Node* _tmp21_; + _tmp18_ = node; + _tmp19_ = _tmp18_->ll_next; + _tmp20_ = node; + _tmp21_ = _tmp20_->ll_prev; + _tmp19_->ll_prev = _tmp21_; + } else { + GeePriorityQueueType1Node* _tmp22_; + GeePriorityQueueType1Node* _tmp23_; + _tmp22_ = self->priv->_ll_tail; + _tmp23_ = node; + if (_tmp22_ == _tmp23_) { + GeePriorityQueueType1Node* _tmp24_; + GeePriorityQueueType1Node* _tmp25_; + GeePriorityQueueType1Node* _tmp26_; + _tmp24_ = node; + _tmp25_ = _tmp24_->ll_prev; + _tmp26_ = _gee_priority_queue_node_ref0 (_tmp25_); + _gee_priority_queue_node_unref0 (self->priv->_ll_tail); + self->priv->_ll_tail = _tmp26_; + } + } + _tmp27_ = node; + _tmp28_ = ((GeePriorityQueueNode*) _tmp27_)->parent; + if (_tmp28_ != NULL) { + GeePriorityQueueType1Node* _tmp29_; + GeePriorityQueueNode* _tmp30_; + GeePriorityQueueNode* _tmp31_; + GeePriorityQueueType2Node* _tmp32_; + _tmp29_ = node; + _tmp30_ = ((GeePriorityQueueNode*) _tmp29_)->parent; + _tmp31_ = _tmp30_->parent; + _tmp32_ = self->priv->_r_prime; + if (_tmp31_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp32_, GEE_PRIORITY_QUEUE_TYPE_NODE, GeePriorityQueueNode)) { + GeePriorityQueueType1Node* _tmp33_; + GeePriorityQueueNode* _tmp34_; + _tmp33_ = node; + _tmp34_ = ((GeePriorityQueueNode*) _tmp33_)->parent; + _gee_priority_queue_updated_degree (self, G_TYPE_CHECK_INSTANCE_CAST (_tmp34_, GEE_PRIORITY_QUEUE_TYPE_TYPE1_NODE, GeePriorityQueueType1Node), TRUE); + } else { + GeePriorityQueueType1Node* _tmp35_; + GeePriorityQueueNode* _tmp36_; + GeePriorityQueueNode* _tmp37_; + _tmp35_ = node; + _tmp36_ = ((GeePriorityQueueNode*) _tmp35_)->parent; + _tmp37_ = _tmp36_->parent; + if (_tmp37_ != NULL) { + GeePriorityQueueType1Node* _tmp38_; + GeePriorityQueueNode* _tmp39_; + GeePriorityQueueType1Node* _tmp40_; + GeePriorityQueueType1Node* parent; + GeePriorityQueueType1Node* _tmp41_; + guint _tmp42_; + GeePriorityQueueType1Node* _tmp43_; + guint _tmp44_; + _tmp38_ = node; + _tmp39_ = ((GeePriorityQueueNode*) _tmp38_)->parent; + _tmp40_ = _gee_priority_queue_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp39_, GEE_PRIORITY_QUEUE_TYPE_TYPE1_NODE, GeePriorityQueueType1Node)); + parent = _tmp40_; + _tmp41_ = parent; + _tmp42_ = _tmp41_->lost; + _tmp41_->lost = _tmp42_ + 1; + _tmp43_ = parent; + _tmp44_ = _tmp43_->lost; + if (_tmp44_ > ((guint) 1)) { + GeePriorityQueueType1Node* _tmp45_; + GeePriorityQueueType1Node* _tmp53_; + GeePriorityQueueType1Node* _tmp54_; + _tmp45_ = self->priv->_ll_tail; + if (_tmp45_ != NULL) { + GeePriorityQueueType1Node* _tmp46_; + GeePriorityQueueType1Node* _tmp47_; + GeePriorityQueueType1Node* _tmp48_; + GeePriorityQueueType1Node* _tmp49_; + GeePriorityQueueType1Node* _tmp50_; + _tmp46_ = parent; + _tmp47_ = self->priv->_ll_tail; + _tmp46_->ll_prev = _tmp47_; + _tmp48_ = self->priv->_ll_tail; + _tmp49_ = parent; + _tmp50_ = _gee_priority_queue_node_ref0 (_tmp49_); + _gee_priority_queue_node_unref0 (_tmp48_->ll_next); + _tmp48_->ll_next = _tmp50_; + } else { + GeePriorityQueueType1Node* _tmp51_; + GeePriorityQueueType1Node* _tmp52_; + _tmp51_ = parent; + _tmp52_ = _gee_priority_queue_node_ref0 (_tmp51_); + _gee_priority_queue_node_unref0 (self->priv->_ll_head); + self->priv->_ll_head = _tmp52_; + } + _tmp53_ = parent; + _tmp54_ = _gee_priority_queue_node_ref0 (_tmp53_); + _gee_priority_queue_node_unref0 (self->priv->_ll_tail); + self->priv->_ll_tail = _tmp54_; + } + _gee_priority_queue_node_unref0 (parent); + } + } + } + } + _tmp55_ = node; + _tmp56_ = self->priv->_p; + if (_tmp55_ == _tmp56_) { + _gee_priority_queue_node_unref0 (self->priv->_p); + self->priv->_p = NULL; + } + _tmp57_ = node; + gee_priority_queue_type1_node_remove (_tmp57_); + _tmp58_ = with_iteration; + if (_tmp58_) { + GeePriorityQueueType1Node* _tmp59_; + GeePriorityQueueNode* _tmp60_; + GeePriorityQueueType1Node* _tmp69_; + GeePriorityQueueNode* _tmp70_; + _tmp59_ = node; + _tmp60_ = ((GeePriorityQueueNode*) _tmp59_)->iter_prev; + if (_tmp60_ != NULL) { + GeePriorityQueueType1Node* _tmp61_; + GeePriorityQueueNode* _tmp62_; + GeePriorityQueueType1Node* _tmp63_; + GeePriorityQueueNode* _tmp64_; + _tmp61_ = node; + _tmp62_ = ((GeePriorityQueueNode*) _tmp61_)->iter_prev; + _tmp63_ = node; + _tmp64_ = ((GeePriorityQueueNode*) _tmp63_)->iter_next; + _tmp62_->iter_next = _tmp64_; + } else { + GeePriorityQueueNode* _tmp65_; + GeePriorityQueueType1Node* _tmp66_; + _tmp65_ = self->priv->_iter_head; + _tmp66_ = node; + if (_tmp65_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp66_, GEE_PRIORITY_QUEUE_TYPE_NODE, GeePriorityQueueNode)) { + GeePriorityQueueType1Node* _tmp67_; + GeePriorityQueueNode* _tmp68_; + _tmp67_ = node; + _tmp68_ = ((GeePriorityQueueNode*) _tmp67_)->iter_next; + self->priv->_iter_head = _tmp68_; + } + } + _tmp69_ = node; + _tmp70_ = ((GeePriorityQueueNode*) _tmp69_)->iter_next; + if (_tmp70_ != NULL) { + GeePriorityQueueType1Node* _tmp71_; + GeePriorityQueueNode* _tmp72_; + GeePriorityQueueType1Node* _tmp73_; + GeePriorityQueueNode* _tmp74_; + _tmp71_ = node; + _tmp72_ = ((GeePriorityQueueNode*) _tmp71_)->iter_next; + _tmp73_ = node; + _tmp74_ = ((GeePriorityQueueNode*) _tmp73_)->iter_prev; + _tmp72_->iter_prev = _tmp74_; + } else { + GeePriorityQueueNode* _tmp75_; + GeePriorityQueueType1Node* _tmp76_; + _tmp75_ = self->priv->_iter_tail; + _tmp76_ = node; + if (_tmp75_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp76_, GEE_PRIORITY_QUEUE_TYPE_NODE, GeePriorityQueueNode)) { + GeePriorityQueueType1Node* _tmp77_; + GeePriorityQueueNode* _tmp78_; + _tmp77_ = node; + _tmp78_ = ((GeePriorityQueueNode*) _tmp77_)->iter_prev; + self->priv->_iter_tail = _tmp78_; + } + } + } +} + + +static void _gee_priority_queue_updated_degree (GeePriorityQueue* self, GeePriorityQueueType1Node* node, gboolean child_removed) { + GeePriorityQueueType1Node* _tmp0_; + gint _tmp1_ = 0; + gint degree; + gboolean _tmp2_ = FALSE; + gboolean _tmp3_; + gboolean _tmp7_; + gboolean* _tmp19_; + gint _tmp19__length1; + gint _tmp20_; + gboolean* _tmp21_; + gint _tmp21__length1; + gint _tmp22_; + gboolean _tmp23_; + gboolean _tmp24_; + GeePriorityQueueType1Node** _tmp25_; + gint _tmp25__length1; + gint _tmp26_; + GeePriorityQueueType1Node* _tmp27_; + GeePriorityQueueType1Node* _tmp28_; + GeePriorityQueueType1Node* _tmp58_; + GeePriorityQueueNodePair* _tmp59_; + g_return_if_fail (self != NULL); + g_return_if_fail (node != NULL); + _tmp0_ = node; + _tmp1_ = gee_priority_queue_node_degree ((GeePriorityQueueNode*) _tmp0_); + degree = _tmp1_; + _tmp3_ = child_removed; + if (_tmp3_) { + GeePriorityQueueType1Node** _tmp4_; + gint _tmp4__length1; + gint _tmp5_; + GeePriorityQueueType1Node* _tmp6_; + _tmp4_ = self->priv->_a; + _tmp4__length1 = self->priv->_a_length1; + _tmp5_ = degree; + _tmp6_ = _tmp4_[_tmp5_ - 1]; + _tmp2_ = _tmp6_ == NULL; + } else { + _tmp2_ = FALSE; + } + _tmp7_ = _tmp2_; + if (_tmp7_) { + GeePriorityQueueType1Node** _tmp8_; + gint _tmp8__length1; + gint _tmp9_; + GeePriorityQueueType1Node* _tmp10_; + GeePriorityQueueType1Node* _tmp11_; + GeePriorityQueueType1Node* _tmp12_; + gboolean* _tmp13_; + gint _tmp13__length1; + gint _tmp14_; + gboolean* _tmp15_; + gint _tmp15__length1; + gint _tmp16_; + gboolean _tmp17_; + gboolean _tmp18_; + _tmp8_ = self->priv->_a; + _tmp8__length1 = self->priv->_a_length1; + _tmp9_ = degree; + _tmp10_ = node; + _tmp11_ = _gee_priority_queue_node_ref0 (_tmp10_); + _gee_priority_queue_node_unref0 (_tmp8_[_tmp9_ - 1]); + _tmp8_[_tmp9_ - 1] = _tmp11_; + _tmp12_ = _tmp8_[_tmp9_ - 1]; + _tmp13_ = self->priv->_b; + _tmp13__length1 = self->priv->_b_length1; + _tmp14_ = degree; + _tmp15_ = self->priv->_b; + _tmp15__length1 = self->priv->_b_length1; + _tmp16_ = degree; + _tmp17_ = _tmp15_[_tmp16_ - 1]; + _tmp13_[_tmp14_ - 1] = !_tmp17_; + _tmp18_ = _tmp13_[_tmp14_ - 1]; + } + _tmp19_ = self->priv->_b; + _tmp19__length1 = self->priv->_b_length1; + _tmp20_ = degree; + _tmp21_ = self->priv->_b; + _tmp21__length1 = self->priv->_b_length1; + _tmp22_ = degree; + _tmp23_ = _tmp21_[_tmp22_]; + _tmp19_[_tmp20_] = !_tmp23_; + _tmp24_ = _tmp19_[_tmp20_]; + _tmp25_ = self->priv->_a; + _tmp25__length1 = self->priv->_a_length1; + _tmp26_ = degree; + _tmp27_ = _tmp25_[_tmp26_]; + _tmp28_ = node; + if (_tmp27_ == _tmp28_) { + GeePriorityQueueType1Node* _tmp29_; + GeePriorityQueueType1Node* _tmp30_; + GeePriorityQueueType1Node* _tmp31_; + GeePriorityQueueType1Node* next; + gboolean _tmp32_ = FALSE; + GeePriorityQueueType1Node* _tmp33_; + gboolean _tmp37_; + _tmp29_ = node; + _tmp30_ = _tmp29_->brothers_next; + _tmp31_ = _gee_priority_queue_node_ref0 (_tmp30_); + next = _tmp31_; + _tmp33_ = next; + if (_tmp33_ != NULL) { + GeePriorityQueueType1Node* _tmp34_; + gint _tmp35_ = 0; + gint _tmp36_; + _tmp34_ = next; + _tmp35_ = gee_priority_queue_node_degree ((GeePriorityQueueNode*) _tmp34_); + _tmp36_ = degree; + _tmp32_ = _tmp35_ == _tmp36_; + } else { + _tmp32_ = FALSE; + } + _tmp37_ = _tmp32_; + if (_tmp37_) { + GeePriorityQueueType1Node** _tmp38_; + gint _tmp38__length1; + gint _tmp39_; + GeePriorityQueueType1Node* _tmp40_; + GeePriorityQueueType1Node* _tmp41_; + GeePriorityQueueType1Node* _tmp42_; + _tmp38_ = self->priv->_a; + _tmp38__length1 = self->priv->_a_length1; + _tmp39_ = degree; + _tmp40_ = next; + _tmp41_ = _gee_priority_queue_node_ref0 (_tmp40_); + _gee_priority_queue_node_unref0 (_tmp38_[_tmp39_]); + _tmp38_[_tmp39_] = _tmp41_; + _tmp42_ = _tmp38_[_tmp39_]; + } else { + GeePriorityQueueType1Node** _tmp43_; + gint _tmp43__length1; + gint _tmp44_; + GeePriorityQueueType1Node* _tmp45_; + GeePriorityQueueType1Node** _tmp46_; + gint _tmp46__length1; + gint i; + gint _tmp54_; + gint _tmp55_ = 0; + gint _tmp56_; + gint _tmp57_ = 0; + _tmp43_ = self->priv->_a; + _tmp43__length1 = self->priv->_a_length1; + _tmp44_ = degree; + _gee_priority_queue_node_unref0 (_tmp43_[_tmp44_]); + _tmp43_[_tmp44_] = NULL; + _tmp45_ = _tmp43_[_tmp44_]; + _tmp46_ = self->priv->_a; + _tmp46__length1 = self->priv->_a_length1; + i = _tmp46__length1 - 1; + while (TRUE) { + gboolean _tmp47_ = FALSE; + gint _tmp48_; + gboolean _tmp52_; + gint _tmp53_; + _tmp48_ = i; + if (_tmp48_ >= 0) { + GeePriorityQueueType1Node** _tmp49_; + gint _tmp49__length1; + gint _tmp50_; + GeePriorityQueueType1Node* _tmp51_; + _tmp49_ = self->priv->_a; + _tmp49__length1 = self->priv->_a_length1; + _tmp50_ = i; + _tmp51_ = _tmp49_[_tmp50_]; + _tmp47_ = _tmp51_ == NULL; + } else { + _tmp47_ = FALSE; + } + _tmp52_ = _tmp47_; + if (!_tmp52_) { + break; + } + _tmp53_ = i; + i = _tmp53_ - 1; + } + _tmp54_ = i; + _tmp55_ = _tmp54_ + 1; + self->priv->_a = g_renew (GeePriorityQueueType1Node*, self->priv->_a, _tmp54_ + 1); + (_tmp55_ > self->priv->_a_length1) ? memset (self->priv->_a + self->priv->_a_length1, 0, sizeof (GeePriorityQueueType1Node*) * (_tmp55_ - self->priv->_a_length1)) : NULL; + self->priv->_a_length1 = _tmp55_; + self->priv->__a_size_ = _tmp55_; + _tmp56_ = i; + _tmp57_ = _tmp56_ + 1; + self->priv->_b = g_renew (gboolean, self->priv->_b, _tmp56_ + 1); + (_tmp57_ > self->priv->_b_length1) ? memset (self->priv->_b + self->priv->_b_length1, 0, sizeof (gboolean) * (_tmp57_ - self->priv->_b_length1)) : NULL; + self->priv->_b_length1 = _tmp57_; + self->priv->__b_size_ = _tmp57_; + } + _gee_priority_queue_node_unref0 (next); + } + _tmp58_ = node; + _tmp59_ = _tmp58_->pair; + if (_tmp59_ != NULL) { + GeePriorityQueueType1Node* _tmp60_; + GeePriorityQueueNodePair* _tmp61_; + GeePriorityQueueNodePair* _tmp62_; + GeePriorityQueueNodePair* pair; + GeePriorityQueueType1Node* _tmp63_ = NULL; + GeePriorityQueueNodePair* _tmp64_; + GeePriorityQueueType1Node* _tmp65_; + GeePriorityQueueType1Node* _tmp66_; + GeePriorityQueueType1Node* _tmp71_; + GeePriorityQueueType1Node* _tmp72_; + GeePriorityQueueType1Node* other; + GeePriorityQueueType1Node* _tmp73_; + GeePriorityQueueType1Node* _tmp74_; + GeePriorityQueueNodePair* _tmp75_; + GeePriorityQueueNodePair* _tmp76_; + GeePriorityQueueNodePair* _tmp85_; + GeePriorityQueueNodePair* _tmp86_; + _tmp60_ = node; + _tmp61_ = _tmp60_->pair; + _tmp62_ = _gee_priority_queue_node_pair_ref0 (_tmp61_); + pair = _tmp62_; + _tmp64_ = pair; + _tmp65_ = _tmp64_->node1; + _tmp66_ = node; + if (_tmp65_ == _tmp66_) { + GeePriorityQueueNodePair* _tmp67_; + GeePriorityQueueType1Node* _tmp68_; + _tmp67_ = pair; + _tmp68_ = _tmp67_->node2; + _tmp63_ = _tmp68_; + } else { + GeePriorityQueueNodePair* _tmp69_; + GeePriorityQueueType1Node* _tmp70_; + _tmp69_ = pair; + _tmp70_ = _tmp69_->node1; + _tmp63_ = _tmp70_; + } + _tmp71_ = _tmp63_; + _tmp72_ = _gee_priority_queue_node_ref0 (_tmp71_); + other = _tmp72_; + _tmp73_ = node; + _tmp73_->pair = NULL; + _tmp74_ = other; + _tmp74_->pair = NULL; + _tmp75_ = pair; + _tmp76_ = _tmp75_->lp_prev; + if (_tmp76_ != NULL) { + GeePriorityQueueNodePair* _tmp77_; + GeePriorityQueueNodePair* _tmp78_; + GeePriorityQueueNodePair* _tmp79_; + GeePriorityQueueNodePair* _tmp80_; + GeePriorityQueueNodePair* _tmp81_; + _tmp77_ = pair; + _tmp78_ = _tmp77_->lp_prev; + _tmp79_ = pair; + _tmp80_ = _tmp79_->lp_next; + _tmp81_ = _gee_priority_queue_node_pair_ref0 (_tmp80_); + _gee_priority_queue_node_pair_unref0 (_tmp78_->lp_next); + _tmp78_->lp_next = _tmp81_; + } else { + GeePriorityQueueNodePair* _tmp82_; + GeePriorityQueueNodePair* _tmp83_; + GeePriorityQueueNodePair* _tmp84_; + _tmp82_ = pair; + _tmp83_ = _tmp82_->lp_next; + _tmp84_ = _gee_priority_queue_node_pair_ref0 (_tmp83_); + _gee_priority_queue_node_pair_unref0 (self->priv->_lp_head); + self->priv->_lp_head = _tmp84_; + } + _tmp85_ = pair; + _tmp86_ = _tmp85_->lp_next; + if (_tmp86_ != NULL) { + GeePriorityQueueNodePair* _tmp87_; + GeePriorityQueueNodePair* _tmp88_; + GeePriorityQueueNodePair* _tmp89_; + GeePriorityQueueNodePair* _tmp90_; + _tmp87_ = pair; + _tmp88_ = _tmp87_->lp_next; + _tmp89_ = pair; + _tmp90_ = _tmp89_->lp_prev; + _tmp88_->lp_prev = _tmp90_; + } else { + GeePriorityQueueNodePair* _tmp91_; + GeePriorityQueueNodePair* _tmp92_; + GeePriorityQueueNodePair* _tmp93_; + _tmp91_ = pair; + _tmp92_ = _tmp91_->lp_prev; + _tmp93_ = _gee_priority_queue_node_pair_ref0 (_tmp92_); + _gee_priority_queue_node_pair_unref0 (self->priv->_lp_tail); + self->priv->_lp_tail = _tmp93_; + } + _gee_priority_queue_node_unref0 (other); + _gee_priority_queue_node_pair_unref0 (pair); + } +} + + +static void _gee_priority_queue_remove_type2_node (GeePriorityQueue* self, GeePriorityQueueType2Node* node, gboolean with_iteration) { + GeePriorityQueueType2Node* _tmp0_; + GeePriorityQueueNode* _tmp1_; + GeePriorityQueueType2Node* _tmp2_; + gboolean _tmp3_; + g_return_if_fail (self != NULL); + g_return_if_fail (node != NULL); + _tmp0_ = node; + _tmp1_ = ((GeePriorityQueueNode*) _tmp0_)->parent; + _gee_priority_queue_node_unref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GEE_PRIORITY_QUEUE_TYPE_TYPE1_NODE, GeePriorityQueueType1Node)->type2_child); + G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GEE_PRIORITY_QUEUE_TYPE_TYPE1_NODE, GeePriorityQueueType1Node)->type2_child = NULL; + _tmp2_ = node; + ((GeePriorityQueueNode*) _tmp2_)->parent = NULL; + _tmp3_ = with_iteration; + if (_tmp3_) { + GeePriorityQueueType2Node* _tmp4_; + GeePriorityQueueNode* _tmp5_; + GeePriorityQueueType2Node* _tmp14_; + GeePriorityQueueNode* _tmp15_; + _tmp4_ = node; + _tmp5_ = ((GeePriorityQueueNode*) _tmp4_)->iter_prev; + if (_tmp5_ != NULL) { + GeePriorityQueueType2Node* _tmp6_; + GeePriorityQueueNode* _tmp7_; + GeePriorityQueueType2Node* _tmp8_; + GeePriorityQueueNode* _tmp9_; + _tmp6_ = node; + _tmp7_ = ((GeePriorityQueueNode*) _tmp6_)->iter_prev; + _tmp8_ = node; + _tmp9_ = ((GeePriorityQueueNode*) _tmp8_)->iter_next; + _tmp7_->iter_next = _tmp9_; + } else { + GeePriorityQueueNode* _tmp10_; + GeePriorityQueueType2Node* _tmp11_; + _tmp10_ = self->priv->_iter_head; + _tmp11_ = node; + if (_tmp10_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, GEE_PRIORITY_QUEUE_TYPE_NODE, GeePriorityQueueNode)) { + GeePriorityQueueType2Node* _tmp12_; + GeePriorityQueueNode* _tmp13_; + _tmp12_ = node; + _tmp13_ = ((GeePriorityQueueNode*) _tmp12_)->iter_next; + self->priv->_iter_head = _tmp13_; + } + } + _tmp14_ = node; + _tmp15_ = ((GeePriorityQueueNode*) _tmp14_)->iter_next; + if (_tmp15_ != NULL) { + GeePriorityQueueType2Node* _tmp16_; + GeePriorityQueueNode* _tmp17_; + GeePriorityQueueType2Node* _tmp18_; + GeePriorityQueueNode* _tmp19_; + _tmp16_ = node; + _tmp17_ = ((GeePriorityQueueNode*) _tmp16_)->iter_next; + _tmp18_ = node; + _tmp19_ = ((GeePriorityQueueNode*) _tmp18_)->iter_prev; + _tmp17_->iter_prev = _tmp19_; + } else { + GeePriorityQueueNode* _tmp20_; + GeePriorityQueueType2Node* _tmp21_; + _tmp20_ = self->priv->_iter_tail; + _tmp21_ = node; + if (_tmp20_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, GEE_PRIORITY_QUEUE_TYPE_NODE, GeePriorityQueueNode)) { + GeePriorityQueueType2Node* _tmp22_; + GeePriorityQueueNode* _tmp23_; + _tmp22_ = node; + _tmp23_ = ((GeePriorityQueueNode*) _tmp22_)->iter_prev; + self->priv->_iter_tail = _tmp23_; + } + } + } +} + + +GCompareFunc gee_priority_queue_get_compare_func (GeePriorityQueue* self) { + GCompareFunc result; + GCompareFunc _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->_compare_func; + result = _tmp0_; + return result; +} + + +static void gee_priority_queue_set_compare_func (GeePriorityQueue* self, GCompareFunc value) { + GCompareFunc _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = value; + self->priv->_compare_func = _tmp0_; + g_object_notify ((GObject *) self, "compare-func"); +} + + +static gint gee_priority_queue_real_get_capacity (GeeAbstractQueue* base) { + gint result; + GeePriorityQueue* self; + self = (GeePriorityQueue*) base; + result = GEE_QUEUE_UNBOUNDED_CAPACITY; + return result; +} + + +static gint gee_priority_queue_real_get_remaining_capacity (GeeAbstractQueue* base) { + gint result; + GeePriorityQueue* self; + self = (GeePriorityQueue*) base; + result = GEE_QUEUE_UNBOUNDED_CAPACITY; + return result; +} + + +static gboolean gee_priority_queue_real_get_is_full (GeeAbstractQueue* base) { + gboolean result; + GeePriorityQueue* self; + self = (GeePriorityQueue*) base; + result = FALSE; + return result; +} + + +static gint gee_priority_queue_real_get_size (GeeAbstractCollection* base) { + gint result; + GeePriorityQueue* self; + gint _tmp0_; + self = (GeePriorityQueue*) base; + _tmp0_ = self->priv->_size; + result = _tmp0_; + return result; +} + + +static GeePriorityQueueNode* gee_priority_queue_node_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer data, GeePriorityQueueNode** head, GeePriorityQueueNode** tail) { + GeePriorityQueueNode* self = NULL; + gconstpointer _tmp0_; + gpointer _tmp1_; + GeePriorityQueueNode* _tmp2_; + GeePriorityQueueNode* _tmp3_; + GeePriorityQueueNode* _tmp5_; + self = (GeePriorityQueueNode*) g_type_create_instance (object_type); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = data; + _tmp1_ = ((_tmp0_ != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) _tmp0_) : ((gpointer) _tmp0_); + _g_destroy_func0 (self->data); + self->data = _tmp1_; + _tmp2_ = *tail; + self->iter_prev = _tmp2_; + *tail = self; + _tmp3_ = self->iter_prev; + if (_tmp3_ != NULL) { + GeePriorityQueueNode* _tmp4_; + _tmp4_ = self->iter_prev; + _tmp4_->iter_next = self; + } + _tmp5_ = *head; + if (_tmp5_ == NULL) { + *head = self; + } + return self; +} + + +static inline gint gee_priority_queue_node_degree (GeePriorityQueueNode* self) { + gint result = 0; + gint _tmp0_; + g_return_val_if_fail (self != NULL, 0); + _tmp0_ = self->type1_children_count; + result = _tmp0_; + return result; +} + + +static void gee_priority_queue_value_node_init (GValue* value) { + value->data[0].v_pointer = NULL; +} + + +static void gee_priority_queue_value_node_free_value (GValue* value) { + if (value->data[0].v_pointer) { + gee_priority_queue_node_unref (value->data[0].v_pointer); + } +} + + +static void gee_priority_queue_value_node_copy_value (const GValue* src_value, GValue* dest_value) { + if (src_value->data[0].v_pointer) { + dest_value->data[0].v_pointer = gee_priority_queue_node_ref (src_value->data[0].v_pointer); + } else { + dest_value->data[0].v_pointer = NULL; + } +} + + +static gpointer gee_priority_queue_value_node_peek_pointer (const GValue* value) { + return value->data[0].v_pointer; +} + + +static gchar* gee_priority_queue_value_node_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + if (collect_values[0].v_pointer) { + GeePriorityQueueNode* object; + object = collect_values[0].v_pointer; + if (object->parent_instance.g_class == NULL) { + return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); + } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { + return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); + } + value->data[0].v_pointer = gee_priority_queue_node_ref (object); + } else { + value->data[0].v_pointer = NULL; + } + return NULL; +} + + +static gchar* gee_priority_queue_value_node_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + GeePriorityQueueNode** object_p; + object_p = collect_values[0].v_pointer; + if (!object_p) { + return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); + } + if (!value->data[0].v_pointer) { + *object_p = NULL; + } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { + *object_p = value->data[0].v_pointer; + } else { + *object_p = gee_priority_queue_node_ref (value->data[0].v_pointer); + } + return NULL; +} + + +static GParamSpec* gee_priority_queue_param_spec_node (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { + GeePriorityQueueParamSpecNode* spec; + g_return_val_if_fail (g_type_is_a (object_type, GEE_PRIORITY_QUEUE_TYPE_NODE), NULL); + spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); + G_PARAM_SPEC (spec)->value_type = object_type; + return G_PARAM_SPEC (spec); +} + + +static gpointer gee_priority_queue_value_get_node (const GValue* value) { + g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_PRIORITY_QUEUE_TYPE_NODE), NULL); + return value->data[0].v_pointer; +} + + +static void gee_priority_queue_value_set_node (GValue* value, gpointer v_object) { + GeePriorityQueueNode* old; + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_PRIORITY_QUEUE_TYPE_NODE)); + old = value->data[0].v_pointer; + if (v_object) { + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_PRIORITY_QUEUE_TYPE_NODE)); + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); + value->data[0].v_pointer = v_object; + gee_priority_queue_node_ref (value->data[0].v_pointer); + } else { + value->data[0].v_pointer = NULL; + } + if (old) { + gee_priority_queue_node_unref (old); + } +} + + +static void gee_priority_queue_value_take_node (GValue* value, gpointer v_object) { + GeePriorityQueueNode* old; + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_PRIORITY_QUEUE_TYPE_NODE)); + old = value->data[0].v_pointer; + if (v_object) { + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_PRIORITY_QUEUE_TYPE_NODE)); + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); + value->data[0].v_pointer = v_object; + } else { + value->data[0].v_pointer = NULL; + } + if (old) { + gee_priority_queue_node_unref (old); + } +} + + +static void gee_priority_queue_node_class_init (GeePriorityQueueNodeClass * klass) { + gee_priority_queue_node_parent_class = g_type_class_peek_parent (klass); + GEE_PRIORITY_QUEUE_NODE_CLASS (klass)->finalize = gee_priority_queue_node_finalize; + g_type_class_add_private (klass, sizeof (GeePriorityQueueNodePrivate)); +} + + +static void gee_priority_queue_node_instance_init (GeePriorityQueueNode * self) { + self->priv = GEE_PRIORITY_QUEUE_NODE_GET_PRIVATE (self); + self->parent = NULL; + self->type1_children_head = NULL; + self->type1_children_tail = NULL; + self->iter_next = NULL; + self->ref_count = 1; +} + + +static void gee_priority_queue_node_finalize (GeePriorityQueueNode* obj) { + GeePriorityQueueNode * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_PRIORITY_QUEUE_TYPE_NODE, GeePriorityQueueNode); + ((self->data == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (self->data = (self->priv->g_destroy_func (self->data), NULL)); + _gee_priority_queue_node_unref0 (self->type1_children_head); + _gee_priority_queue_node_unref0 (self->type1_children_tail); +} + + +static GType gee_priority_queue_node_get_type (void) { + static volatile gsize gee_priority_queue_node_type_id__volatile = 0; + if (g_once_init_enter (&gee_priority_queue_node_type_id__volatile)) { + static const GTypeValueTable g_define_type_value_table = { gee_priority_queue_value_node_init, gee_priority_queue_value_node_free_value, gee_priority_queue_value_node_copy_value, gee_priority_queue_value_node_peek_pointer, "p", gee_priority_queue_value_node_collect_value, "p", gee_priority_queue_value_node_lcopy_value }; + static const GTypeInfo g_define_type_info = { sizeof (GeePriorityQueueNodeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_priority_queue_node_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeePriorityQueueNode), 0, (GInstanceInitFunc) gee_priority_queue_node_instance_init, &g_define_type_value_table }; + static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; + GType gee_priority_queue_node_type_id; + gee_priority_queue_node_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GeePriorityQueueNode", &g_define_type_info, &g_define_type_fundamental_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&gee_priority_queue_node_type_id__volatile, gee_priority_queue_node_type_id); + } + return gee_priority_queue_node_type_id__volatile; +} + + +static gpointer gee_priority_queue_node_ref (gpointer instance) { + GeePriorityQueueNode* self; + self = instance; + g_atomic_int_inc (&self->ref_count); + return instance; +} + + +static void gee_priority_queue_node_unref (gpointer instance) { + GeePriorityQueueNode* self; + self = instance; + if (g_atomic_int_dec_and_test (&self->ref_count)) { + GEE_PRIORITY_QUEUE_NODE_GET_CLASS (self)->finalize (self); + g_type_free_instance ((GTypeInstance *) self); + } +} + + +static GeePriorityQueueType1Node* gee_priority_queue_type1_node_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer data, GeePriorityQueueNode** head, GeePriorityQueueNode** tail) { + GeePriorityQueueType1Node* self = NULL; + gconstpointer _tmp0_; + _tmp0_ = data; + self = (GeePriorityQueueType1Node*) gee_priority_queue_node_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, _tmp0_, head, tail); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + return self; +} + + +static GeePriorityQueueType1Node* gee_priority_queue_type1_node_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer data, GeePriorityQueueNode** head, GeePriorityQueueNode** tail) { + return gee_priority_queue_type1_node_construct (GEE_PRIORITY_QUEUE_TYPE_TYPE1_NODE, g_type, g_dup_func, g_destroy_func, data, head, tail); +} + + +static inline void gee_priority_queue_type1_node_add (GeePriorityQueueType1Node* self, GeePriorityQueueType1Node* node) { + GeePriorityQueueType1Node* _tmp0_; + GeePriorityQueueType1Node* _tmp1_; + GeePriorityQueueType1Node* _tmp6_; + GeePriorityQueueType1Node* _tmp10_; + GeePriorityQueueType1Node* _tmp11_; + gint _tmp12_; + g_return_if_fail (self != NULL); + g_return_if_fail (node != NULL); + _tmp0_ = node; + ((GeePriorityQueueNode*) _tmp0_)->parent = (GeePriorityQueueNode*) self; + _tmp1_ = ((GeePriorityQueueNode*) self)->type1_children_head; + if (_tmp1_ == NULL) { + GeePriorityQueueType1Node* _tmp2_; + GeePriorityQueueType1Node* _tmp3_; + _tmp2_ = node; + _tmp3_ = _gee_priority_queue_node_ref0 (_tmp2_); + _gee_priority_queue_node_unref0 (((GeePriorityQueueNode*) self)->type1_children_head); + ((GeePriorityQueueNode*) self)->type1_children_head = _tmp3_; + } else { + GeePriorityQueueType1Node* _tmp4_; + GeePriorityQueueType1Node* _tmp5_; + _tmp4_ = node; + _tmp5_ = ((GeePriorityQueueNode*) self)->type1_children_tail; + _tmp4_->brothers_prev = _tmp5_; + } + _tmp6_ = ((GeePriorityQueueNode*) self)->type1_children_tail; + if (_tmp6_ != NULL) { + GeePriorityQueueType1Node* _tmp7_; + GeePriorityQueueType1Node* _tmp8_; + GeePriorityQueueType1Node* _tmp9_; + _tmp7_ = ((GeePriorityQueueNode*) self)->type1_children_tail; + _tmp8_ = node; + _tmp9_ = _gee_priority_queue_node_ref0 (_tmp8_); + _gee_priority_queue_node_unref0 (_tmp7_->brothers_next); + _tmp7_->brothers_next = _tmp9_; + } + _tmp10_ = node; + _tmp11_ = _gee_priority_queue_node_ref0 (_tmp10_); + _gee_priority_queue_node_unref0 (((GeePriorityQueueNode*) self)->type1_children_tail); + ((GeePriorityQueueNode*) self)->type1_children_tail = _tmp11_; + _tmp12_ = ((GeePriorityQueueNode*) self)->type1_children_count; + ((GeePriorityQueueNode*) self)->type1_children_count = _tmp12_ + 1; +} + + +static inline void gee_priority_queue_type1_node_remove (GeePriorityQueueType1Node* self) { + GeePriorityQueueType1Node* _tmp0_; + GeePriorityQueueType1Node* _tmp7_; + GeePriorityQueueNode* _tmp13_; + gint _tmp14_; + g_return_if_fail (self != NULL); + _tmp0_ = self->brothers_prev; + if (_tmp0_ == NULL) { + GeePriorityQueueNode* _tmp1_; + GeePriorityQueueType1Node* _tmp2_; + GeePriorityQueueType1Node* _tmp3_; + _tmp1_ = ((GeePriorityQueueNode*) self)->parent; + _tmp2_ = self->brothers_next; + _tmp3_ = _gee_priority_queue_node_ref0 (_tmp2_); + _gee_priority_queue_node_unref0 (_tmp1_->type1_children_head); + _tmp1_->type1_children_head = _tmp3_; + } else { + GeePriorityQueueType1Node* _tmp4_; + GeePriorityQueueType1Node* _tmp5_; + GeePriorityQueueType1Node* _tmp6_; + _tmp4_ = self->brothers_prev; + _tmp5_ = self->brothers_next; + _tmp6_ = _gee_priority_queue_node_ref0 (_tmp5_); + _gee_priority_queue_node_unref0 (_tmp4_->brothers_next); + _tmp4_->brothers_next = _tmp6_; + } + _tmp7_ = self->brothers_next; + if (_tmp7_ == NULL) { + GeePriorityQueueNode* _tmp8_; + GeePriorityQueueType1Node* _tmp9_; + GeePriorityQueueType1Node* _tmp10_; + _tmp8_ = ((GeePriorityQueueNode*) self)->parent; + _tmp9_ = self->brothers_prev; + _tmp10_ = _gee_priority_queue_node_ref0 (_tmp9_); + _gee_priority_queue_node_unref0 (_tmp8_->type1_children_tail); + _tmp8_->type1_children_tail = _tmp10_; + } else { + GeePriorityQueueType1Node* _tmp11_; + GeePriorityQueueType1Node* _tmp12_; + _tmp11_ = self->brothers_next; + _tmp12_ = self->brothers_prev; + _tmp11_->brothers_prev = _tmp12_; + } + _tmp13_ = ((GeePriorityQueueNode*) self)->parent; + _tmp14_ = _tmp13_->type1_children_count; + _tmp13_->type1_children_count = _tmp14_ - 1; + ((GeePriorityQueueNode*) self)->parent = NULL; + self->brothers_prev = NULL; + _gee_priority_queue_node_unref0 (self->brothers_next); + self->brothers_next = NULL; +} + + +static void gee_priority_queue_type1_node_class_init (GeePriorityQueueType1NodeClass * klass) { + gee_priority_queue_type1_node_parent_class = g_type_class_peek_parent (klass); + GEE_PRIORITY_QUEUE_NODE_CLASS (klass)->finalize = gee_priority_queue_type1_node_finalize; + g_type_class_add_private (klass, sizeof (GeePriorityQueueType1NodePrivate)); +} + + +static void gee_priority_queue_type1_node_instance_init (GeePriorityQueueType1Node * self) { + self->priv = GEE_PRIORITY_QUEUE_TYPE1_NODE_GET_PRIVATE (self); + self->brothers_prev = NULL; + self->brothers_next = NULL; + self->type2_child = NULL; + self->ll_prev = NULL; + self->ll_next = NULL; + self->pair = NULL; +} + + +static void gee_priority_queue_type1_node_finalize (GeePriorityQueueNode* obj) { + GeePriorityQueueType1Node * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_PRIORITY_QUEUE_TYPE_TYPE1_NODE, GeePriorityQueueType1Node); + _gee_priority_queue_node_unref0 (self->brothers_next); + _gee_priority_queue_node_unref0 (self->type2_child); + _gee_priority_queue_node_unref0 (self->ll_next); + GEE_PRIORITY_QUEUE_NODE_CLASS (gee_priority_queue_type1_node_parent_class)->finalize (obj); +} + + +static GType gee_priority_queue_type1_node_get_type (void) { + static volatile gsize gee_priority_queue_type1_node_type_id__volatile = 0; + if (g_once_init_enter (&gee_priority_queue_type1_node_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeePriorityQueueType1NodeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_priority_queue_type1_node_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeePriorityQueueType1Node), 0, (GInstanceInitFunc) gee_priority_queue_type1_node_instance_init, NULL }; + GType gee_priority_queue_type1_node_type_id; + gee_priority_queue_type1_node_type_id = g_type_register_static (GEE_PRIORITY_QUEUE_TYPE_NODE, "GeePriorityQueueType1Node", &g_define_type_info, 0); + g_once_init_leave (&gee_priority_queue_type1_node_type_id__volatile, gee_priority_queue_type1_node_type_id); + } + return gee_priority_queue_type1_node_type_id__volatile; +} + + +static GeePriorityQueueType2Node* gee_priority_queue_type2_node_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer data, GeePriorityQueueNode** head, GeePriorityQueueNode** tail) { + GeePriorityQueueType2Node* self = NULL; + gconstpointer _tmp0_; + _tmp0_ = data; + self = (GeePriorityQueueType2Node*) gee_priority_queue_node_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, _tmp0_, head, tail); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + return self; +} + + +static GeePriorityQueueType2Node* gee_priority_queue_type2_node_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer data, GeePriorityQueueNode** head, GeePriorityQueueNode** tail) { + return gee_priority_queue_type2_node_construct (GEE_PRIORITY_QUEUE_TYPE_TYPE2_NODE, g_type, g_dup_func, g_destroy_func, data, head, tail); +} + + +static void gee_priority_queue_type2_node_class_init (GeePriorityQueueType2NodeClass * klass) { + gee_priority_queue_type2_node_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeePriorityQueueType2NodePrivate)); +} + + +static void gee_priority_queue_type2_node_instance_init (GeePriorityQueueType2Node * self) { + self->priv = GEE_PRIORITY_QUEUE_TYPE2_NODE_GET_PRIVATE (self); +} + + +static GType gee_priority_queue_type2_node_get_type (void) { + static volatile gsize gee_priority_queue_type2_node_type_id__volatile = 0; + if (g_once_init_enter (&gee_priority_queue_type2_node_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeePriorityQueueType2NodeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_priority_queue_type2_node_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeePriorityQueueType2Node), 0, (GInstanceInitFunc) gee_priority_queue_type2_node_instance_init, NULL }; + GType gee_priority_queue_type2_node_type_id; + gee_priority_queue_type2_node_type_id = g_type_register_static (GEE_PRIORITY_QUEUE_TYPE_NODE, "GeePriorityQueueType2Node", &g_define_type_info, 0); + g_once_init_leave (&gee_priority_queue_type2_node_type_id__volatile, gee_priority_queue_type2_node_type_id); + } + return gee_priority_queue_type2_node_type_id__volatile; +} + + +static GeePriorityQueueDummyNode* gee_priority_queue_dummy_node_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeePriorityQueueNode** prev_next, GeePriorityQueueNode** next_prev, GeePriorityQueueNode* iter_prev, GeePriorityQueueNode* iter_next) { + GeePriorityQueueDummyNode* self = NULL; + GeePriorityQueueNode* _tmp0_; + GeePriorityQueueNode* _tmp1_; + GeePriorityQueueNode* _tmp2_; + self = (GeePriorityQueueDummyNode*) gee_priority_queue_node_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, NULL, prev_next, next_prev); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = iter_prev; + ((GeePriorityQueueNode*) self)->iter_prev = _tmp0_; + _tmp1_ = iter_next; + ((GeePriorityQueueNode*) self)->iter_next = _tmp1_; + *next_prev = (GeePriorityQueueNode*) self; + _tmp2_ = *next_prev; + *prev_next = _tmp2_; + return self; +} + + +static GeePriorityQueueDummyNode* gee_priority_queue_dummy_node_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeePriorityQueueNode** prev_next, GeePriorityQueueNode** next_prev, GeePriorityQueueNode* iter_prev, GeePriorityQueueNode* iter_next) { + return gee_priority_queue_dummy_node_construct (GEE_PRIORITY_QUEUE_TYPE_DUMMY_NODE, g_type, g_dup_func, g_destroy_func, prev_next, next_prev, iter_prev, iter_next); +} + + +static void gee_priority_queue_dummy_node_class_init (GeePriorityQueueDummyNodeClass * klass) { + gee_priority_queue_dummy_node_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeePriorityQueueDummyNodePrivate)); +} + + +static void gee_priority_queue_dummy_node_instance_init (GeePriorityQueueDummyNode * self) { + self->priv = GEE_PRIORITY_QUEUE_DUMMY_NODE_GET_PRIVATE (self); +} + + +static GType gee_priority_queue_dummy_node_get_type (void) { + static volatile gsize gee_priority_queue_dummy_node_type_id__volatile = 0; + if (g_once_init_enter (&gee_priority_queue_dummy_node_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeePriorityQueueDummyNodeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_priority_queue_dummy_node_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeePriorityQueueDummyNode), 0, (GInstanceInitFunc) gee_priority_queue_dummy_node_instance_init, NULL }; + GType gee_priority_queue_dummy_node_type_id; + gee_priority_queue_dummy_node_type_id = g_type_register_static (GEE_PRIORITY_QUEUE_TYPE_NODE, "GeePriorityQueueDummyNode", &g_define_type_info, 0); + g_once_init_leave (&gee_priority_queue_dummy_node_type_id__volatile, gee_priority_queue_dummy_node_type_id); + } + return gee_priority_queue_dummy_node_type_id__volatile; +} + + +static GeePriorityQueueNodePair* gee_priority_queue_node_pair_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeePriorityQueueType1Node* node1, GeePriorityQueueType1Node* node2) { + GeePriorityQueueNodePair* self = NULL; + GeePriorityQueueType1Node* _tmp0_; + GeePriorityQueueType1Node* _tmp1_; + GeePriorityQueueType1Node* _tmp2_; + GeePriorityQueueType1Node* _tmp3_; + g_return_val_if_fail (node1 != NULL, NULL); + g_return_val_if_fail (node2 != NULL, NULL); + self = (GeePriorityQueueNodePair*) g_type_create_instance (object_type); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = node1; + _tmp1_ = _gee_priority_queue_node_ref0 (_tmp0_); + _gee_priority_queue_node_unref0 (self->node1); + self->node1 = _tmp1_; + _tmp2_ = node2; + _tmp3_ = _gee_priority_queue_node_ref0 (_tmp2_); + _gee_priority_queue_node_unref0 (self->node2); + self->node2 = _tmp3_; + return self; +} + + +static GeePriorityQueueNodePair* gee_priority_queue_node_pair_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeePriorityQueueType1Node* node1, GeePriorityQueueType1Node* node2) { + return gee_priority_queue_node_pair_construct (GEE_PRIORITY_QUEUE_TYPE_NODE_PAIR, g_type, g_dup_func, g_destroy_func, node1, node2); +} + + +static void gee_priority_queue_value_node_pair_init (GValue* value) { + value->data[0].v_pointer = NULL; +} + + +static void gee_priority_queue_value_node_pair_free_value (GValue* value) { + if (value->data[0].v_pointer) { + gee_priority_queue_node_pair_unref (value->data[0].v_pointer); + } +} + + +static void gee_priority_queue_value_node_pair_copy_value (const GValue* src_value, GValue* dest_value) { + if (src_value->data[0].v_pointer) { + dest_value->data[0].v_pointer = gee_priority_queue_node_pair_ref (src_value->data[0].v_pointer); + } else { + dest_value->data[0].v_pointer = NULL; + } +} + + +static gpointer gee_priority_queue_value_node_pair_peek_pointer (const GValue* value) { + return value->data[0].v_pointer; +} + + +static gchar* gee_priority_queue_value_node_pair_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + if (collect_values[0].v_pointer) { + GeePriorityQueueNodePair* object; + object = collect_values[0].v_pointer; + if (object->parent_instance.g_class == NULL) { + return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); + } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { + return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); + } + value->data[0].v_pointer = gee_priority_queue_node_pair_ref (object); + } else { + value->data[0].v_pointer = NULL; + } + return NULL; +} + + +static gchar* gee_priority_queue_value_node_pair_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + GeePriorityQueueNodePair** object_p; + object_p = collect_values[0].v_pointer; + if (!object_p) { + return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); + } + if (!value->data[0].v_pointer) { + *object_p = NULL; + } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { + *object_p = value->data[0].v_pointer; + } else { + *object_p = gee_priority_queue_node_pair_ref (value->data[0].v_pointer); + } + return NULL; +} + + +static GParamSpec* gee_priority_queue_param_spec_node_pair (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { + GeePriorityQueueParamSpecNodePair* spec; + g_return_val_if_fail (g_type_is_a (object_type, GEE_PRIORITY_QUEUE_TYPE_NODE_PAIR), NULL); + spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); + G_PARAM_SPEC (spec)->value_type = object_type; + return G_PARAM_SPEC (spec); +} + + +static gpointer gee_priority_queue_value_get_node_pair (const GValue* value) { + g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_PRIORITY_QUEUE_TYPE_NODE_PAIR), NULL); + return value->data[0].v_pointer; +} + + +static void gee_priority_queue_value_set_node_pair (GValue* value, gpointer v_object) { + GeePriorityQueueNodePair* old; + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_PRIORITY_QUEUE_TYPE_NODE_PAIR)); + old = value->data[0].v_pointer; + if (v_object) { + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_PRIORITY_QUEUE_TYPE_NODE_PAIR)); + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); + value->data[0].v_pointer = v_object; + gee_priority_queue_node_pair_ref (value->data[0].v_pointer); + } else { + value->data[0].v_pointer = NULL; + } + if (old) { + gee_priority_queue_node_pair_unref (old); + } +} + + +static void gee_priority_queue_value_take_node_pair (GValue* value, gpointer v_object) { + GeePriorityQueueNodePair* old; + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_PRIORITY_QUEUE_TYPE_NODE_PAIR)); + old = value->data[0].v_pointer; + if (v_object) { + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_PRIORITY_QUEUE_TYPE_NODE_PAIR)); + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); + value->data[0].v_pointer = v_object; + } else { + value->data[0].v_pointer = NULL; + } + if (old) { + gee_priority_queue_node_pair_unref (old); + } +} + + +static void gee_priority_queue_node_pair_class_init (GeePriorityQueueNodePairClass * klass) { + gee_priority_queue_node_pair_parent_class = g_type_class_peek_parent (klass); + GEE_PRIORITY_QUEUE_NODE_PAIR_CLASS (klass)->finalize = gee_priority_queue_node_pair_finalize; + g_type_class_add_private (klass, sizeof (GeePriorityQueueNodePairPrivate)); +} + + +static void gee_priority_queue_node_pair_instance_init (GeePriorityQueueNodePair * self) { + self->priv = GEE_PRIORITY_QUEUE_NODE_PAIR_GET_PRIVATE (self); + self->lp_prev = NULL; + self->lp_next = NULL; + self->node1 = NULL; + self->node2 = NULL; + self->ref_count = 1; +} + + +static void gee_priority_queue_node_pair_finalize (GeePriorityQueueNodePair* obj) { + GeePriorityQueueNodePair * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_PRIORITY_QUEUE_TYPE_NODE_PAIR, GeePriorityQueueNodePair); + _gee_priority_queue_node_pair_unref0 (self->lp_next); + _gee_priority_queue_node_unref0 (self->node1); + _gee_priority_queue_node_unref0 (self->node2); +} + + +static GType gee_priority_queue_node_pair_get_type (void) { + static volatile gsize gee_priority_queue_node_pair_type_id__volatile = 0; + if (g_once_init_enter (&gee_priority_queue_node_pair_type_id__volatile)) { + static const GTypeValueTable g_define_type_value_table = { gee_priority_queue_value_node_pair_init, gee_priority_queue_value_node_pair_free_value, gee_priority_queue_value_node_pair_copy_value, gee_priority_queue_value_node_pair_peek_pointer, "p", gee_priority_queue_value_node_pair_collect_value, "p", gee_priority_queue_value_node_pair_lcopy_value }; + static const GTypeInfo g_define_type_info = { sizeof (GeePriorityQueueNodePairClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_priority_queue_node_pair_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeePriorityQueueNodePair), 0, (GInstanceInitFunc) gee_priority_queue_node_pair_instance_init, &g_define_type_value_table }; + static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; + GType gee_priority_queue_node_pair_type_id; + gee_priority_queue_node_pair_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GeePriorityQueueNodePair", &g_define_type_info, &g_define_type_fundamental_info, 0); + g_once_init_leave (&gee_priority_queue_node_pair_type_id__volatile, gee_priority_queue_node_pair_type_id); + } + return gee_priority_queue_node_pair_type_id__volatile; +} + + +static gpointer gee_priority_queue_node_pair_ref (gpointer instance) { + GeePriorityQueueNodePair* self; + self = instance; + g_atomic_int_inc (&self->ref_count); + return instance; +} + + +static void gee_priority_queue_node_pair_unref (gpointer instance) { + GeePriorityQueueNodePair* self; + self = instance; + if (g_atomic_int_dec_and_test (&self->ref_count)) { + GEE_PRIORITY_QUEUE_NODE_PAIR_GET_CLASS (self)->finalize (self); + g_type_free_instance ((GTypeInstance *) self); + } +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static GeePriorityQueueIterator* gee_priority_queue_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeePriorityQueue* queue) { + GeePriorityQueueIterator * self = NULL; + GeePriorityQueue* _tmp0_; + GeePriorityQueue* _tmp1_; + GeePriorityQueue* _tmp2_; + gint _tmp3_; + g_return_val_if_fail (queue != NULL, NULL); + self = (GeePriorityQueueIterator*) g_object_new (object_type, NULL); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = queue; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->queue); + self->priv->queue = _tmp1_; + self->priv->position = NULL; + self->priv->previous = NULL; + _tmp2_ = queue; + _tmp3_ = _tmp2_->priv->_stamp; + self->priv->stamp = _tmp3_; + return self; +} + + +static GeePriorityQueueIterator* gee_priority_queue_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeePriorityQueue* queue) { + return gee_priority_queue_iterator_construct (GEE_PRIORITY_QUEUE_TYPE_ITERATOR, g_type, g_dup_func, g_destroy_func, queue); +} + + +static gboolean gee_priority_queue_iterator_real_next (GeeIterator* base) { + GeePriorityQueueIterator * self; + gboolean result = FALSE; + GeePriorityQueueNode* _tmp0_ = NULL; + GeePriorityQueueNode* next; + GeePriorityQueueNode* _tmp1_; + GeePriorityQueueNode* _tmp4_; + self = (GeePriorityQueueIterator*) base; + _tmp0_ = _gee_priority_queue_iterator_get_next_node (self); + next = _tmp0_; + _tmp1_ = next; + if (_tmp1_ != NULL) { + GeePriorityQueueNode* _tmp2_; + GeePriorityQueueNode* _tmp3_; + _tmp2_ = self->priv->position; + self->priv->previous = _tmp2_; + _tmp3_ = next; + self->priv->position = _tmp3_; + } + _tmp4_ = next; + result = _tmp4_ != NULL; + return result; +} + + +static gboolean gee_priority_queue_iterator_real_has_next (GeeIterator* base) { + GeePriorityQueueIterator * self; + gboolean result = FALSE; + GeePriorityQueueNode* _tmp0_ = NULL; + self = (GeePriorityQueueIterator*) base; + _tmp0_ = _gee_priority_queue_iterator_get_next_node (self); + result = _tmp0_ != NULL; + return result; +} + + +static inline GeePriorityQueueNode* _gee_priority_queue_iterator_get_next_node (GeePriorityQueueIterator* self) { + GeePriorityQueueNode* result = NULL; + GeePriorityQueueNode* _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->position; + if (_tmp0_ != NULL) { + GeePriorityQueueNode* _tmp1_; + GeePriorityQueueNode* _tmp2_; + _tmp1_ = self->priv->position; + _tmp2_ = _tmp1_->iter_next; + result = _tmp2_; + return result; + } else { + GeePriorityQueueNode* _tmp3_ = NULL; + GeePriorityQueueNode* _tmp4_; + GeePriorityQueueNode* _tmp9_; + _tmp4_ = self->priv->previous; + if (_tmp4_ != NULL) { + GeePriorityQueueNode* _tmp5_; + GeePriorityQueueNode* _tmp6_; + _tmp5_ = self->priv->previous; + _tmp6_ = _tmp5_->iter_next; + _tmp3_ = _tmp6_; + } else { + GeePriorityQueue* _tmp7_; + GeePriorityQueueNode* _tmp8_; + _tmp7_ = self->priv->queue; + _tmp8_ = _tmp7_->priv->_iter_head; + _tmp3_ = _tmp8_; + } + _tmp9_ = _tmp3_; + result = _tmp9_; + return result; + } +} + + +static gboolean gee_priority_queue_iterator_real_first (GeeIterator* base) { + GeePriorityQueueIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeePriorityQueue* _tmp1_; + gint _tmp2_; + GeePriorityQueue* _tmp3_; + GeePriorityQueueNode* _tmp4_; + GeePriorityQueueNode* _tmp5_; + self = (GeePriorityQueueIterator*) base; + _tmp0_ = self->priv->stamp; + _tmp1_ = self->priv->queue; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == queue._stamp"); + _tmp3_ = self->priv->queue; + _tmp4_ = _tmp3_->priv->_iter_head; + self->priv->position = _tmp4_; + self->priv->previous = NULL; + _tmp5_ = self->priv->position; + result = _tmp5_ != NULL; + return result; +} + + +static gpointer gee_priority_queue_iterator_real_get (GeeIterator* base) { + GeePriorityQueueIterator * self; + gpointer result = NULL; + gint _tmp0_; + GeePriorityQueue* _tmp1_; + gint _tmp2_; + GeePriorityQueueNode* _tmp3_; + GeePriorityQueueNode* _tmp4_; + gconstpointer _tmp5_; + gpointer _tmp6_; + self = (GeePriorityQueueIterator*) base; + _tmp0_ = self->priv->stamp; + _tmp1_ = self->priv->queue; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == queue._stamp"); + _tmp3_ = self->priv->position; + _vala_assert (_tmp3_ != NULL, "position != null"); + _tmp4_ = self->priv->position; + _tmp5_ = _tmp4_->data; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + result = _tmp6_; + return result; +} + + +static void gee_priority_queue_iterator_real_remove (GeeIterator* base) { + GeePriorityQueueIterator * self; + gint _tmp0_; + GeePriorityQueue* _tmp1_; + gint _tmp2_; + GeePriorityQueueNode* _tmp3_; + GeePriorityQueueDummyNode* dn = NULL; + GeePriorityQueueNode* _tmp4_; + GeePriorityQueue* _tmp14_; + GeePriorityQueueNode* _tmp15_; + GeePriorityQueueNode* _tmp16_; + GeePriorityQueueDummyNode* _tmp20_; + GeePriorityQueue* _tmp21_; + GeePriorityQueueNode* _tmp22_; + GeePriorityQueueDummyNode* _tmp26_; + GeePriorityQueueNode* _tmp27_; + GeePriorityQueueDummyNode* _tmp31_; + GeePriorityQueue* _tmp32_; + GeePriorityQueueNode* _tmp33_; + gint _tmp36_; + gint _tmp37_; + GeePriorityQueue* _tmp38_; + gint _tmp39_; + self = (GeePriorityQueueIterator*) base; + _tmp0_ = self->priv->stamp; + _tmp1_ = self->priv->queue; + _tmp2_ = _tmp1_->priv->_stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == queue._stamp"); + _tmp3_ = self->priv->position; + _vala_assert (_tmp3_ != NULL, "position != null"); + _tmp4_ = self->priv->previous; + if (_tmp4_ != NULL) { + GeePriorityQueueNode* _tmp5_; + GeePriorityQueueNode* _tmp6_; + GeePriorityQueueNode* _tmp7_; + GeePriorityQueueNode* _tmp8_; + GeePriorityQueueDummyNode* _tmp9_; + _tmp5_ = self->priv->previous; + _tmp6_ = self->priv->position; + _tmp7_ = self->priv->previous; + _tmp8_ = self->priv->position; + _tmp9_ = gee_priority_queue_dummy_node_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, &_tmp5_->iter_next, &_tmp6_->iter_prev, _tmp7_, _tmp8_); + _gee_priority_queue_node_unref0 (dn); + dn = _tmp9_; + } else { + GeePriorityQueue* _tmp10_; + GeePriorityQueueNode* _tmp11_; + GeePriorityQueueNode* _tmp12_; + GeePriorityQueueDummyNode* _tmp13_; + _tmp10_ = self->priv->queue; + _tmp11_ = self->priv->position; + _tmp12_ = self->priv->position; + _tmp13_ = gee_priority_queue_dummy_node_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, &_tmp10_->priv->_iter_head, &_tmp11_->iter_prev, NULL, _tmp12_); + _gee_priority_queue_node_unref0 (dn); + dn = _tmp13_; + } + _tmp14_ = self->priv->queue; + _tmp15_ = self->priv->position; + _gee_priority_queue_delete (_tmp14_, _tmp15_, NULL); + self->priv->position = NULL; + _tmp16_ = self->priv->previous; + if (_tmp16_ != NULL) { + GeePriorityQueueNode* _tmp17_; + GeePriorityQueueDummyNode* _tmp18_; + GeePriorityQueueNode* _tmp19_; + _tmp17_ = self->priv->previous; + _tmp18_ = dn; + _tmp19_ = ((GeePriorityQueueNode*) _tmp18_)->iter_next; + _tmp17_->iter_next = _tmp19_; + } + _tmp20_ = dn; + _tmp21_ = self->priv->queue; + _tmp22_ = _tmp21_->priv->_iter_head; + if (G_TYPE_CHECK_INSTANCE_CAST (_tmp20_, GEE_PRIORITY_QUEUE_TYPE_NODE, GeePriorityQueueNode) == _tmp22_) { + GeePriorityQueue* _tmp23_; + GeePriorityQueueDummyNode* _tmp24_; + GeePriorityQueueNode* _tmp25_; + _tmp23_ = self->priv->queue; + _tmp24_ = dn; + _tmp25_ = ((GeePriorityQueueNode*) _tmp24_)->iter_next; + _tmp23_->priv->_iter_head = _tmp25_; + } + _tmp26_ = dn; + _tmp27_ = ((GeePriorityQueueNode*) _tmp26_)->iter_next; + if (_tmp27_ != NULL) { + GeePriorityQueueDummyNode* _tmp28_; + GeePriorityQueueNode* _tmp29_; + GeePriorityQueueNode* _tmp30_; + _tmp28_ = dn; + _tmp29_ = ((GeePriorityQueueNode*) _tmp28_)->iter_next; + _tmp30_ = self->priv->previous; + _tmp29_->iter_prev = _tmp30_; + } + _tmp31_ = dn; + _tmp32_ = self->priv->queue; + _tmp33_ = _tmp32_->priv->_iter_tail; + if (G_TYPE_CHECK_INSTANCE_CAST (_tmp31_, GEE_PRIORITY_QUEUE_TYPE_NODE, GeePriorityQueueNode) == _tmp33_) { + GeePriorityQueue* _tmp34_; + GeePriorityQueueNode* _tmp35_; + _tmp34_ = self->priv->queue; + _tmp35_ = self->priv->previous; + _tmp34_->priv->_iter_tail = _tmp35_; + } + _tmp36_ = self->priv->stamp; + self->priv->stamp = _tmp36_ + 1; + _tmp37_ = self->priv->stamp; + _tmp38_ = self->priv->queue; + _tmp39_ = _tmp38_->priv->_stamp; + _vala_assert (_tmp37_ == _tmp39_, "stamp == queue._stamp"); + _gee_priority_queue_node_unref0 (dn); +} + + +static void gee_priority_queue_iterator_class_init (GeePriorityQueueIteratorClass * klass) { + gee_priority_queue_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeePriorityQueueIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_priority_queue_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_priority_queue_iterator_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_priority_queue_iterator_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_PRIORITY_QUEUE_ITERATOR_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_PRIORITY_QUEUE_ITERATOR_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_PRIORITY_QUEUE_ITERATOR_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_priority_queue_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) { + gee_priority_queue_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->next = (gboolean (*)(GeeIterator*)) gee_priority_queue_iterator_real_next; + iface->has_next = (gboolean (*)(GeeIterator*)) gee_priority_queue_iterator_real_has_next; + iface->first = (gboolean (*)(GeeIterator*)) gee_priority_queue_iterator_real_first; + iface->get = (gpointer (*)(GeeIterator*)) gee_priority_queue_iterator_real_get; + iface->remove = (void (*)(GeeIterator*)) gee_priority_queue_iterator_real_remove; +} + + +static void gee_priority_queue_iterator_instance_init (GeePriorityQueueIterator * self) { + self->priv = GEE_PRIORITY_QUEUE_ITERATOR_GET_PRIVATE (self); +} + + +static void gee_priority_queue_iterator_finalize (GObject* obj) { + GeePriorityQueueIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_PRIORITY_QUEUE_TYPE_ITERATOR, GeePriorityQueueIterator); + _g_object_unref0 (self->priv->queue); + G_OBJECT_CLASS (gee_priority_queue_iterator_parent_class)->finalize (obj); +} + + +static GType gee_priority_queue_iterator_get_type (void) { + static volatile gsize gee_priority_queue_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_priority_queue_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeePriorityQueueIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_priority_queue_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeePriorityQueueIterator), 0, (GInstanceInitFunc) gee_priority_queue_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_priority_queue_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_priority_queue_iterator_type_id; + gee_priority_queue_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GeePriorityQueueIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_priority_queue_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info); + g_once_init_leave (&gee_priority_queue_iterator_type_id__volatile, gee_priority_queue_iterator_type_id); + } + return gee_priority_queue_iterator_type_id__volatile; +} + + +static void _vala_gee_priority_queue_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeePriorityQueueIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_PRIORITY_QUEUE_TYPE_ITERATOR, GeePriorityQueueIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_priority_queue_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeePriorityQueueIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_PRIORITY_QUEUE_TYPE_ITERATOR, GeePriorityQueueIterator); + switch (property_id) { + case GEE_PRIORITY_QUEUE_ITERATOR_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_PRIORITY_QUEUE_ITERATOR_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_PRIORITY_QUEUE_ITERATOR_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void gee_priority_queue_class_init (GeePriorityQueueClass * klass) { + gee_priority_queue_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeePriorityQueuePrivate)); + GEE_ABSTRACT_QUEUE_CLASS (klass)->offer = gee_priority_queue_real_offer; + GEE_ABSTRACT_QUEUE_CLASS (klass)->peek = gee_priority_queue_real_peek; + GEE_ABSTRACT_QUEUE_CLASS (klass)->poll = gee_priority_queue_real_poll; + GEE_ABSTRACT_QUEUE_CLASS (klass)->drain = gee_priority_queue_real_drain; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains = gee_priority_queue_real_contains; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add = gee_priority_queue_real_add; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove = gee_priority_queue_real_remove; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->clear = gee_priority_queue_real_clear; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->iterator = gee_priority_queue_real_iterator; + GEE_ABSTRACT_QUEUE_CLASS (klass)->get_capacity = gee_priority_queue_real_get_capacity; + GEE_ABSTRACT_QUEUE_CLASS (klass)->get_remaining_capacity = gee_priority_queue_real_get_remaining_capacity; + GEE_ABSTRACT_QUEUE_CLASS (klass)->get_is_full = gee_priority_queue_real_get_is_full; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_size = gee_priority_queue_real_get_size; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_priority_queue_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_priority_queue_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_priority_queue_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_PRIORITY_QUEUE_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_PRIORITY_QUEUE_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_PRIORITY_QUEUE_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + /** + * The elements' comparator function. + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_PRIORITY_QUEUE_COMPARE_FUNC, g_param_spec_pointer ("compare-func", "compare-func", "compare-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_PRIORITY_QUEUE_CAPACITY, g_param_spec_int ("capacity", "capacity", "capacity", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_PRIORITY_QUEUE_REMAINING_CAPACITY, g_param_spec_int ("remaining-capacity", "remaining-capacity", "remaining-capacity", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_PRIORITY_QUEUE_IS_FULL, g_param_spec_boolean ("is-full", "is-full", "is-full", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_PRIORITY_QUEUE_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_priority_queue_instance_init (GeePriorityQueue * self) { + GeePriorityQueueType1Node** _tmp0_ = NULL; + gboolean* _tmp1_ = NULL; + self->priv = GEE_PRIORITY_QUEUE_GET_PRIVATE (self); + self->priv->_size = 0; + self->priv->_stamp = 0; + self->priv->_r = NULL; + self->priv->_r_prime = NULL; + self->priv->_lm_head = NULL; + self->priv->_lm_tail = NULL; + self->priv->_p = NULL; + _tmp0_ = g_new0 (GeePriorityQueueType1Node*, 0 + 1); + self->priv->_a = _tmp0_; + self->priv->_a_length1 = 0; + self->priv->__a_size_ = self->priv->_a_length1; + self->priv->_lp_head = NULL; + self->priv->_lp_tail = NULL; + _tmp1_ = g_new0 (gboolean, 0); + self->priv->_b = _tmp1_; + self->priv->_b_length1 = 0; + self->priv->__b_size_ = self->priv->_b_length1; + self->priv->_ll_head = NULL; + self->priv->_ll_tail = NULL; + self->priv->_iter_head = NULL; + self->priv->_iter_tail = NULL; +} + + +static void gee_priority_queue_finalize (GObject* obj) { + GeePriorityQueue * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_PRIORITY_QUEUE, GeePriorityQueue); + _gee_priority_queue_node_unref0 (self->priv->_r); + _gee_priority_queue_node_unref0 (self->priv->_r_prime); + _gee_priority_queue_node_unref0 (self->priv->_lm_head); + _gee_priority_queue_node_unref0 (self->priv->_lm_tail); + _gee_priority_queue_node_unref0 (self->priv->_p); + self->priv->_a = (_vala_array_free (self->priv->_a, self->priv->_a_length1, (GDestroyNotify) gee_priority_queue_node_unref), NULL); + _gee_priority_queue_node_pair_unref0 (self->priv->_lp_head); + _gee_priority_queue_node_pair_unref0 (self->priv->_lp_tail); + self->priv->_b = (g_free (self->priv->_b), NULL); + _gee_priority_queue_node_unref0 (self->priv->_ll_head); + _gee_priority_queue_node_unref0 (self->priv->_ll_tail); + G_OBJECT_CLASS (gee_priority_queue_parent_class)->finalize (obj); +} + + +/** + * Relaxed fibonacci heap priority queue implementation of the {@link Queue}. + * + * The elements of the priority queue are ordered according to their natural + * ordering, or by a compare_func provided at queue construction time. A + * priority queue does not permit null elements and does not have bounded + * capacity. + * + * This implementation provides O(1) time for offer and peek methods, and + * O(log n) for poll method. It is based on the algorithms described by + * Boyapati Chandra Sekhar in: + * + * "Worst Case Efficient Data Structures + * for Priority Queues and Deques with Heap Order" + * Boyapati Chandra Sekhar (under the guidance of Prof. C. Pandu Rangan) + * Department of Computer Science and Engineering + * Indian Institute of Technology, Madras + * May 1996 + */ +GType gee_priority_queue_get_type (void) { + static volatile gsize gee_priority_queue_type_id__volatile = 0; + if (g_once_init_enter (&gee_priority_queue_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeePriorityQueueClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_priority_queue_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeePriorityQueue), 0, (GInstanceInitFunc) gee_priority_queue_instance_init, NULL }; + GType gee_priority_queue_type_id; + gee_priority_queue_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_QUEUE, "GeePriorityQueue", &g_define_type_info, 0); + g_once_init_leave (&gee_priority_queue_type_id__volatile, gee_priority_queue_type_id); + } + return gee_priority_queue_type_id__volatile; +} + + +static void _vala_gee_priority_queue_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeePriorityQueue * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_PRIORITY_QUEUE, GeePriorityQueue); + switch (property_id) { + case GEE_PRIORITY_QUEUE_COMPARE_FUNC: + g_value_set_pointer (value, gee_priority_queue_get_compare_func (self)); + break; + case GEE_PRIORITY_QUEUE_CAPACITY: + g_value_set_int (value, gee_abstract_queue_get_capacity ((GeeAbstractQueue*) self)); + break; + case GEE_PRIORITY_QUEUE_REMAINING_CAPACITY: + g_value_set_int (value, gee_abstract_queue_get_remaining_capacity ((GeeAbstractQueue*) self)); + break; + case GEE_PRIORITY_QUEUE_IS_FULL: + g_value_set_boolean (value, gee_abstract_queue_get_is_full ((GeeAbstractQueue*) self)); + break; + case GEE_PRIORITY_QUEUE_SIZE: + g_value_set_int (value, gee_abstract_collection_get_size ((GeeAbstractCollection*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_priority_queue_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeePriorityQueue * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_PRIORITY_QUEUE, GeePriorityQueue); + switch (property_id) { + case GEE_PRIORITY_QUEUE_COMPARE_FUNC: + gee_priority_queue_set_compare_func (self, g_value_get_pointer (value)); + break; + case GEE_PRIORITY_QUEUE_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_PRIORITY_QUEUE_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_PRIORITY_QUEUE_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + + diff --git a/gee/priorityqueue.vala b/gee/priorityqueue.vala new file mode 100644 index 0000000..e31601c --- /dev/null +++ b/gee/priorityqueue.vala @@ -0,0 +1,1186 @@ +/* priorityqueue.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +/** + * Relaxed fibonacci heap priority queue implementation of the {@link Queue}. + * + * The elements of the priority queue are ordered according to their natural + * ordering, or by a compare_func provided at queue construction time. A + * priority queue does not permit null elements and does not have bounded + * capacity. + * + * This implementation provides O(1) time for offer and peek methods, and + * O(log n) for poll method. It is based on the algorithms described by + * Boyapati Chandra Sekhar in: + * + * "Worst Case Efficient Data Structures + * for Priority Queues and Deques with Heap Order" + * Boyapati Chandra Sekhar (under the guidance of Prof. C. Pandu Rangan) + * Department of Computer Science and Engineering + * Indian Institute of Technology, Madras + * May 1996 + */ +public class Gee.PriorityQueue : Gee.AbstractQueue { + + /** + * The elements' comparator function. + */ + public CompareFunc compare_func { private set; get; } + + private int _size = 0; + private int _stamp = 0; + private Type1Node? _r = null; + private Type2Node? _r_prime = null; + private Type2Node? _lm_head = null; + private Type2Node? _lm_tail = null; + private Type1Node? _p = null; +#if VALA_0_16 + private Type1Node?[] _a = new Type1Node?[0]; +#else + private Type1Node?[] _a = new Type1Node[0]; +#endif + private NodePair? _lp_head = null; + private NodePair? _lp_tail = null; + private bool[] _b = new bool[0]; + private Type1Node? _ll_head = null; + private Type1Node? _ll_tail = null; + private unowned Node _iter_head = null; + private unowned Node _iter_tail = null; + + /** + * Constructs a new, empty priority queue. + * + * If not provided, the function parameter is requested to the + * {@link Functions} function factory methods. + * + * @param compare_func an optional element comparator function + */ + public PriorityQueue (CompareFunc? compare_func = null) { + if (compare_func == null) { + compare_func = Functions.get_compare_func_for (typeof (G)); + } + this.compare_func = compare_func; + } + + /** + * {@inheritDoc} + */ + public override int capacity { + get { return UNBOUNDED_CAPACITY; } + } + + /** + * {@inheritDoc} + */ + public override int remaining_capacity { + get { return UNBOUNDED_CAPACITY; } + } + + /** + * {@inheritDoc} + */ + public override bool is_full { + get { return false; } + } + + /** + * {@inheritDoc} + */ + public override bool offer (G element) { + #if DEBUG + _dump ("Start offer: %s".printf ((string)element)); + #endif + if (_r == null) { + _r = new Type1Node (element, ref _iter_head, ref _iter_tail); + _p = _r; + } else if (_r_prime == null) { + _r_prime = new Type2Node (element, ref _iter_head, ref _iter_tail); + _r_prime.parent = _r; + _r.type2_child = _r_prime; + if (_compare (_r_prime, _r) < 0) + _swap_data (_r_prime, _r); + } else { + // Form a tree with a single node N of type I consisting of element e + Type1Node node = new Type1Node (element, ref _iter_head, ref _iter_tail); + + //Add(Q, N) + _add (node); + } + + _stamp++; + _size++; + #if DEBUG + _dump ("End offer: %s".printf ((string)element)); + #endif + return true; + } + + /** + * {@inheritDoc} + */ + public override G? peek () { + if (_r == null) { + return null; + } + return _r.data; + } + + /** + * {@inheritDoc} + */ + public override G? poll () { + #if DEBUG + _dump ("Start poll:"); + #endif + + // 1a. M inElement <- R.element + if (_r == null) { + return null; + } + G min = _r.data; + _r.pending_drop = false; + _stamp++; + _size--; + + // 1b. R.element = R'.element + if (_r_prime == null) { + if (_r.iter_next != null) { + _r.iter_next.iter_prev = _r.iter_prev; + } + if (_r.iter_prev != null) { + _r.iter_prev.iter_next = _r.iter_next; + } + if (_iter_head == _r) { + _iter_head = _r.iter_next; + } + if (_iter_tail == _r) { + _iter_tail = _r.iter_prev; + } + _r = null; + _p = null; + return min; + } + _move_data (_r, _r_prime); + + + // 1c. R'' <- The child of R' containing the minimum element among the children of R' + if (_r_prime.type1_children_head == null) { + _remove_type2_node (_r_prime, true); + _r_prime = null; + return min; + } + Type1Node? r_second = null; + Type1Node node = _r_prime.type1_children_head; + while (node != null) { + if (r_second == null || _compare (node, r_second) < 0) { + r_second = node; + } + node = node.brothers_next; + } + + // 1d. R'.element <- R''.element + _move_data (_r_prime, r_second); + + // 2a. Delete the subtree rooted at R'' from Q + _remove_type1_node (r_second, true); + + // 2b. For all children N of type I of R'' do make N a child of R' of Q + node = r_second.type1_children_head; + while (node != null) { + Type1Node next = node.brothers_next; + _remove_type1_node (node, false); + _add_in_r_prime (node); + node = next; + } + + // For now we can't have type2 node other than R' (left for reference) + #if false + // 3a. If R'' has no child of type II then goto Step 4. + if (r_second.type2_child != null) { + // 3b. Let M' be the child of type II of R''. Insert(Q, M'.element) + Type2Node m_prime = r_second.type2_child; + _remove_type2_node (m_prime); + offer (m_prime.data); + + // 3c. For all children N of M do make N a child of R' of Q + node = m_prime.type1_children_head; + while (node != null) { + Type1Node next = node.brothers_next; + _remove_type1_node (node); + _add_in_r_prime (node); + node = next; + } + } + #endif + + // 4. Adjust(Q, P, P) + if (_p == null) { + _p = _r; + } + _adjust (_p, _p); + + // For now we can't have type2 node other than R' (left for reference) + #if false + // 5a. if LM is empty then goto Step 6 + if (_lm_head != null) { + // 5b. M <- Head(LM); LM <- Tail(LM) + Type2Node m = _lm_head; + + // 5c. Delete M from Q + _remove_type2_node (m); + + // 5d. I nsert(Q, M.element) + offer (m.data); + + // 5e. For all children N of M do make M a child of R' of Q + node = m.type1_children_head; + while (node != null) { + Type1Node next = node.brothers_next; + _remove_type1_node (node); + _add_in_r_prime (node); + node = next; + } + } + #endif + + // 6. While among the children of R' there exist any two different nodes Ri and Rj + // such that Ri.degree = Rj.degree do Link(Q, Ri, Rj) + while (_check_linkable ()) {} + + // 7. Return MinElement + return min; + } + + /** + * {@inheritDoc} + */ + public override int drain (Collection recipient, int amount = -1) { + if (amount == -1) { + amount = this._size; + } + for (int i = 0; i < amount; i++) { + if (this._size == 0) { + return i; + } + recipient.add (poll ()); + } + return amount; + } + + /** + * {@inheritDoc} + */ + public override int size { + get { return _size; } + } + + /** + * {@inheritDoc} + */ + public override bool contains (G item) { + foreach (G an_item in this) { + if (compare_func (item, an_item) == 0) { + return true; + } + } + return false; + } + + /** + * {@inheritDoc} + */ + public override bool add (G item) { + return offer (item); + } + + /** + * {@inheritDoc} + */ + public override bool remove (G item) { + #if DEBUG + _dump ("Start remove: %s".printf ((string) item)); + #endif + + Iterator iterator = new Iterator (this); + while (iterator.next ()) { + G an_item = iterator.get (); + if (compare_func (item, an_item) == 0) { + iterator.remove (); + return true; + } + } + return false; + } + + /** + * {@inheritDoc} + */ + public override void clear () { + _size = 0; + _r = null; + _r_prime = null; + _lm_head = null; + _lm_tail = null; + _p = null; +#if VALA_0_16 + _a = new Type1Node?[0]; +#else + _a = new Type1Node[0]; +#endif + _lp_head = null; + _lp_tail = null; + _b = new bool[0]; + _ll_head = null; + _ll_tail = null; + _iter_head = null; + _iter_tail = null; + } + + /** + * {@inheritDoc} + */ + public override Gee.Iterator iterator () { + return new Iterator (this); + } + + private inline int _compare (Node node1, Node node2) { + // Assume there can't be two nodes pending drop + if (node1.pending_drop) { + return -1; + } else if (node2.pending_drop) { + return 1; + } else { + return compare_func (node1.data, node2.data); + } + } + + private inline void _swap_data (Node node1, Node node2) { + #if DEBUG + _dump ("Before swap: %p(%s) %p(%s)".printf(node1, (string)node1.data, node2, (string)node2.data)); + #endif + G temp_data = (owned) node1.data; + bool temp_pending_drop = node1.pending_drop; + node1.data = (owned) node2.data; + node1.pending_drop = node2.pending_drop; + node2.data = (owned) temp_data; + node2.pending_drop = temp_pending_drop; + + if (node1.iter_next == node2) { // Before swap: N1 N2 + unowned Node temp_iter_prev = node1.iter_prev; + unowned Node temp_iter_next = node2.iter_next; + + node1.iter_prev = node2; + node1.iter_next = temp_iter_next; + node2.iter_prev = temp_iter_prev; + node2.iter_next = node1; + } else if (node1.iter_prev == node2) { // Before swap: N2 N1 + unowned Node temp_iter_prev = node2.iter_prev; + unowned Node temp_iter_next = node1.iter_next; + + node1.iter_prev = temp_iter_prev; + node1.iter_next = node2; + node2.iter_prev = node1; + node2.iter_next = temp_iter_next; + } else { + unowned Node temp_iter_prev = node1.iter_prev; + unowned Node temp_iter_next = node1.iter_next; + + node1.iter_prev = node2.iter_prev; + node1.iter_next = node2.iter_next; + node2.iter_prev = temp_iter_prev; + node2.iter_next = temp_iter_next; + } + + if (node2 == _iter_head) { + _iter_head = node1; + } else if (node1 == _iter_head) { + _iter_head = node2; + } + if (node2 == _iter_tail) { + _iter_tail = node1; + } else if (node1 == _iter_tail) { + _iter_tail = node2; + } + + if (node1.iter_prev != null) { + node1.iter_prev.iter_next = node1; + } + if (node1.iter_next != null) { + node1.iter_next.iter_prev = node1; + } + if (node2.iter_prev != null) { + node2.iter_prev.iter_next = node2; + } + if (node2.iter_next != null) { + node2.iter_next.iter_prev = node2; + } + + #if DEBUG + _dump ("After swap: %p(%s) %p(%s)".printf(node1, (string)node1.data, node2, (string)node2.data)); + #endif + } + + private inline void _move_data (Node target, Node source) { + #if DEBUG + _dump ("Before move: %p(%s) <- %p(%s)".printf(target, (string)target.data, source, (string)source.data)); + #endif + + if (target.iter_next != null) { + target.iter_next.iter_prev = target.iter_prev; + } else if (_iter_tail == target) { + _iter_tail = target.iter_prev; + } + if (target.iter_prev != null) { + target.iter_prev.iter_next = target.iter_next; + } else if (_iter_head == target) { + _iter_head = target.iter_next; + } + + target.data = source.data; + target.pending_drop = source.pending_drop; + target.iter_next = source.iter_next; + target.iter_prev = source.iter_prev; + source.iter_next = null; + source.iter_prev = null; + + if (target.iter_next != null) { + target.iter_next.iter_prev = target; + } else if (_iter_tail == source) { + _iter_tail = target; + } + if (target.iter_prev != null) { + target.iter_prev.iter_next = target; + } else if (_iter_head == source) { + _iter_head = target; + } + #if DEBUG + _dump ("After move:"); + #endif + } + + private void _link (owned Type1Node ri, owned Type1Node rj) { + assert (ri.degree () == rj.degree ()); + + // Delete the subtrees rooted at Ri and Rj from Q + _remove_type1_node (ri, false); + _remove_type1_node (rj, false); + + // If Ri.element > Rj.element then Swap(Ri,Rj) + if (_compare (ri, rj) > 0) { + Type1Node temp = ri; + ri = rj; + rj = temp; + } + + // Make Rj the last child of Ri + _add_to (rj, ri); + + // Make Ri (whose degree now = d+1) a child of R' of Q + _add_in_r_prime (ri); + } + + private void _add (Type1Node n) { + // Make N a child of R' of Q + _add_in_r_prime (n); + + // If N.element < R'.element then Swap(N.element, R'.element) + if (_compare (n, _r_prime) < 0) { + _swap_data (n, _r_prime); + } + + // If R'.element < R.element then Swap(R'.element, R.element) + if (_compare (_r_prime, _r) < 0) { + _swap_data (_r_prime, _r); + } + + // If among the children of R' there exist any two different nodes Ri and Rj + // such that Ri.degree = Rj.degree then Link(Q, Ri, Rj) + _check_linkable (); + + #if DEBUG + _dump ("End _add: %p(%s)".printf (n, (string) n.data)); + #endif + } + + private bool _check_linkable () { + #if DEBUG + _dump ("Start _check_linkable:"); + #endif + + if (_lp_head != null) { + NodePair pair = _lp_head; + _link (pair.node1, pair.node2); + return true; + } + return false; + } + + private Node _re_insert (owned Type1Node n) { + assert (n != _r); + + #if DEBUG + _dump ("Start _re_insert: %p(%s)".printf (n, (string) n.data)); + #endif + + //Parent <- N.parent + Node parent = n.parent; + + // Delete the subtree rooted at N from Q + _remove_type1_node (n, false); + + // Add(Q, N) + _add (n); + + // Return Parent + return parent; + } + + private void _adjust (Type1Node p1, Type1Node p2) { + // If M.lost <= 1 for all nodes M in Q then return + if (_ll_head == null) { + return; + } + + #if DEBUG + _dump ("Start _adjust: %p(%s), %p(%s)".printf (p1, (string) p1.data, p2, (string) p2.data)); + #endif + + // If P1.lost > P2.lost then M <- P1 else M <- P2 + Type1Node m; + if (p1.lost > p2.lost) { + m = p1; + } else { + m = p2; + } + + // If M.lost <= 1 then M <- M' for some node M' in Q such that M'.lost > 1 + if (m.lost <= 1) { + m = _ll_head; + if (_ll_head.ll_next != null) { + _ll_head.ll_next.ll_prev = null; + } + _ll_head = _ll_head.ll_next; + } + + // P <- ReInsert(Q, M) + _p = (Type1Node) _re_insert (m); + + #if DEBUG + _dump ("End _adjust: %p(%s), %p(%s)".printf (p1, (string) p1.data, p2, (string) p2.data)); + #endif + } + + private void _delete (Node n, out unowned Node prev = null) { + // DecreaseKey(Q, N, infinite) + _decrease_key (n); + + // DeleteMin(Q) + poll (); + } + + private void _decrease_key (Node n) { + #if DEBUG + _dump ("Start _decrease_key: %p(%s)".printf (n, (string) n.data)); + #endif + + if (n == _r || _r_prime == null) { + return; + } + + n.pending_drop = true; + + // If (N = R or R') and (R'.element < R.element) then + // Swap(R'.element, R.element); return + if (n == _r_prime && _compare (_r_prime, _r) < 0) { + _swap_data (_r_prime, _r); + return; + } + + // For now we can't have type2 node other than R' (left for reference) + #if false + // If (N is of type II) and (N.element < N.parent.element) then + // Swap(N.element, N.parent.element); N <- N.parent + if (n is Type2Node && _compare (n, n.parent) < 0) { + _swap_data (n, n.parent); + n = n.parent; + } + #endif + + // Can't occur as we made n be the most little (left for reference) + #if false + // If N.element >= N.parent.element then return + if (n.parent != null && _compare (n, n.parent) >= 0) { + return; + } + #endif + + // P' <- ReInsert(Q, N) + Node p_prime = _re_insert ((Type1Node) n); + + if (p_prime is Type2Node) { + // Adjust(Q, P, P); + _adjust (_p, _p); + } else { + // Adjust(Q, P, P'); + _adjust (_p, (Type1Node) p_prime); + } + } + + private void _add_to (Type1Node node, Type1Node parent) { + parent.add (node); + parent.lost = 0; + } + + private void _add_in_r_prime (Type1Node node) { + #if DEBUG + _dump ("Start _add_in_r_prime: %p(%s)".printf (node, (string) node.data)); + #endif + + int degree = node.degree (); + + Type1Node? insertion_point = null; + if (degree < _a.length) { + insertion_point = _a[degree]; + } + + if (insertion_point == null) { + if (_r_prime.type1_children_tail != null) { + node.brothers_prev = _r_prime.type1_children_tail; + _r_prime.type1_children_tail.brothers_next = node; + } else { + _r_prime.type1_children_head = node; + } + _r_prime.type1_children_tail = node; + } else { + if (insertion_point.brothers_prev != null) { + insertion_point.brothers_prev.brothers_next = node; + node.brothers_prev = insertion_point.brothers_prev; + } else { + _r_prime.type1_children_head = node; + } + node.brothers_next = insertion_point; + insertion_point.brothers_prev = node; + } + node.parent = _r_prime; + + // Maintain A, B and LP + if (degree >= _a.length) { + _a.resize (degree + 1); + _b.resize (degree + 1); + } + + // If there is already a child of such degree + if (_a[degree] == null) { + _b[degree] = true; + } else { + // Else if there is an odd number of child of such degree + if (_b[degree]) { + // Make a pair + NodePair pair = new NodePair (node, node.brothers_next); + node.brothers_next.pair = pair; + node.pair = pair; + if (_lp_head == null) { + _lp_head = pair; + _lp_tail = pair; + } else { + pair.lp_prev = _lp_tail; + _lp_tail.lp_next = pair; + _lp_tail = pair; + } + // There is now an even number of child of such degree + _b[degree] = false; + } else { + _b[degree] = true; + } + } + _a[degree] = node; + + #if DEBUG + _dump ("End _add_in_r_prime: %p(%s)".printf (node, (string) node.data)); + #endif + } + + private void _remove_type1_node (Type1Node node, bool with_iteration) { + #if DEBUG + _dump ("Start _remove_type1_node: %p(%s)".printf (node, (string) node.data)); + #endif + + if (node.parent == _r_prime) { + _updated_degree (node, false); + } else { + // Maintain LL + if (node.ll_prev != null) { + node.ll_prev.ll_next = node.ll_next; + } else if (_ll_head == node) { + _ll_head = node.ll_next; + } + if (node.ll_next != null) { + node.ll_next.ll_prev = node.ll_prev; + } else if (_ll_tail == node) { + _ll_tail = node.ll_prev; + } + + if (node.parent != null) { + if (node.parent.parent == _r_prime) { + _updated_degree ((Type1Node) node.parent, true); + } else if (node.parent.parent != null) { + Type1Node parent = (Type1Node) node.parent; + + // Increment parent's lost count + parent.lost++; + + // And add it to LL if needed + if (parent.lost > 1) { + if (_ll_tail != null) { + parent.ll_prev = _ll_tail; + _ll_tail.ll_next = parent; + } else { + _ll_head = parent; + } + _ll_tail = parent; + } + } + } + } + + // Check whether removed node is P + if (node == _p) { + _p = null; + } + + // Maintain brothers list + node.remove (); + + // Maintain iteration + if (with_iteration) { + if (node.iter_prev != null) { + node.iter_prev.iter_next = node.iter_next; + } else if (_iter_head == node) { + _iter_head = node.iter_next; + } + if (node.iter_next != null) { + node.iter_next.iter_prev = node.iter_prev; + } else if (_iter_tail == node) { + _iter_tail = node.iter_prev; + } + } + #if DEBUG + _dump ("End _remove_type1_node: %p(%s)".printf (node, (string) node.data)); + #endif + } + + private void _updated_degree (Type1Node node, bool child_removed) { + int degree = node.degree (); + + // Maintain A and B + if (child_removed && _a[degree - 1] == null) { + _a[degree - 1] = node; + _b[degree - 1] = ! _b[degree - 1]; + } + + _b[degree] = ! _b[degree]; + if (_a[degree] == node) { + Type1Node next = node.brothers_next; + if (next != null && next.degree () == degree) { + _a[degree] = next; + } else { + _a[degree] = null; + + int i = _a.length - 1; + while (i >= 0 && _a[i] == null) { + i--; + } + _a.resize (i + 1); + _b.resize (i + 1); + } + } + + // Maintain LP + if (node.pair != null) { + NodePair pair = node.pair; + Type1Node other = (pair.node1 == node ? pair.node2 : pair.node1); + node.pair = null; + other.pair = null; + if (pair.lp_prev != null) { + pair.lp_prev.lp_next = pair.lp_next; + } else { + _lp_head = pair.lp_next; + } + if (pair.lp_next != null) { + pair.lp_next.lp_prev = pair.lp_prev; + } else { + _lp_tail = pair.lp_prev; + } + } + } + + private void _remove_type2_node (Type2Node node, bool with_iteration) { + #if DEBUG + _dump ("Start _remove_type2_node: %p(%s)".printf (node, (string) node.data)); + #endif + ((Type1Node) node.parent).type2_child = null; + node.parent = null; + + // For now we can't have type2 node other than R' (left for reference) + #if false + // Maintain LM + if (node != _r_prime) { + if (node.lm_prev != null) { + node.lm_prev.lm_next = node.lm_next; + } else if (_lm_head == node) { + _lm_head = node.lm_next; + } + if (node.lm_next != null) { + node.lm_next.lm_prev = node.lm_prev; + } else if (_lm_tail == node) { + _lm_tail = node.lm_prev; + } + node.lm_next = null; + node.lm_prev = null; + } + #endif + + // Maintain iteration + if (with_iteration) { + if (node.iter_prev != null) { + node.iter_prev.iter_next = node.iter_next; + } else if (_iter_head == node) { + _iter_head = node.iter_next; + } + if (node.iter_next != null) { + node.iter_next.iter_prev = node.iter_prev; + } else if (_iter_tail == node) { + _iter_tail = node.iter_prev; + } + } + #if DEBUG + _dump ("End _remove_type2_node: %p(%s)".printf (node, (string) node.data)); + #endif + } + + #if DEBUG + public void _dump (string message) { + stdout.printf (">>>> %s\n", message); + + stdout.printf ("A.length = %d:", _a.length); + foreach (Node? node in _a) { + stdout.printf (" %p(%s);", node, node != null ? (string) node.data : null); + } + stdout.printf ("\n"); + + stdout.printf ("B.length = %d:", _b.length); + foreach (bool even in _b) { + stdout.printf (" %s;", even.to_string ()); + } + stdout.printf ("\n"); + + stdout.printf ("LP:"); + unowned NodePair? pair = _lp_head; + while (pair != null) { + stdout.printf (" (%p(%s),%p(%s));", pair.node1, (string) pair.node1.data, pair.node2, (string) pair.node2.data); + pair = pair.lp_next; + } + stdout.printf ("\n"); + + stdout.printf ("LL:"); + unowned Type1Node? node = _ll_head; + while (node != null) { + stdout.printf (" %p(%s);", node, (string) node.data); + node = node.ll_next; + } + stdout.printf ("\n"); + + stdout.printf ("ITER:"); + unowned Node? inode_prev = null; + unowned Node? inode = _iter_head; + while (inode != null) { + stdout.printf (" %p(%s);", inode, (string) inode.data); + assert (inode.iter_prev == inode_prev); + inode_prev = inode; + inode = inode.iter_next; + } + stdout.printf ("\n"); + + stdout.printf ("%s\n", _r != null ? _r.to_string () : null); + + stdout.printf ("\n"); + } + #endif + + private abstract class Node { + public G data; + public weak Node? parent = null; + + public int type1_children_count; + public Type1Node? type1_children_head = null; + public Type1Node? type1_children_tail = null; + + public unowned Node? iter_prev; + public unowned Node? iter_next = null; + + public bool pending_drop; + + protected Node (G data, ref unowned Node? head, ref unowned Node? tail) { + this.data = data; + iter_prev = tail; + tail = this; + if (iter_prev != null) { + iter_prev.iter_next = this; + } + if (head == null) { + head = this; + } + } + + public inline int degree () { + return type1_children_count; + } + + #if DEBUG + public string children_to_string (int level = 0) { + StringBuilder builder = new StringBuilder (); + bool first = true; + Type1Node child = type1_children_head; + while (child != null) { + if (!first) { + builder.append (",\n"); + } + first = false; + builder.append (child.to_string (level)); + child = child.brothers_next; + } + return builder.str; + } + + public abstract string to_string (int level = 0); + #endif + } + + private class Type1Node : Node { + public uint lost; + public weak Type1Node? brothers_prev = null; + public Type1Node? brothers_next = null; + public Type2Node? type2_child = null; + public weak Type1Node? ll_prev = null; + public Type1Node? ll_next = null; + public weak NodePair? pair = null; + + public Type1Node (G data, ref unowned Node? head, ref unowned Node? tail) { + base (data, ref head, ref tail); + } + + public inline void add (Type1Node node) { + node.parent = this; + if (type1_children_head == null) { + type1_children_head = node; + } else { + node.brothers_prev = type1_children_tail; + } + if (type1_children_tail != null) { + type1_children_tail.brothers_next = node; + } + type1_children_tail = node; + type1_children_count++; + } + + public inline void remove () { + if (brothers_prev == null) { + parent.type1_children_head = brothers_next; + } else { + brothers_prev.brothers_next = brothers_next; + } + if (brothers_next == null) { + parent.type1_children_tail = brothers_prev; + } else { + brothers_next.brothers_prev = brothers_prev; + } + parent.type1_children_count--; + parent = null; + brothers_prev = null; + brothers_next = null; + } + + #if DEBUG + public override string to_string (int level = 0) { + StringBuilder builder = new StringBuilder (); + builder.append (string.nfill (level, '\t')); + builder.append ("("); + builder.append_printf("%p(%s)/%u", this, (string)data, lost); + if (type1_children_head != null || type2_child != null) { + builder.append (":\n"); + } + if (type1_children_head != null) { + builder.append (children_to_string (level + 1)); + } + if (type1_children_head != null && type2_child != null) { + builder.append (",\n"); + } + if (type2_child != null) { + builder.append (type2_child.to_string (level + 1)); + } + if (type1_children_head != null || type2_child != null) { + builder.append ("\n"); + builder.append (string.nfill (level, '\t')); + } + builder.append (")"); + return builder.str; + } + #endif + } + + private class Type2Node : Node { + // For now we can't have type2 node other than R' (left for reference) + #if false + public weak Type2Node? lm_prev = null; + public Type2Node? lm_next = null; + #endif + + public Type2Node (G data, ref unowned Node? head, ref unowned Node? tail) { + base (data, ref head, ref tail); + } + + #if DEBUG + public override string to_string (int level = 0) { + StringBuilder builder = new StringBuilder (); + builder.append (string.nfill (level, '\t')); + builder.append_printf ("[%p(%s)", this, (string)data); + if (type1_children_head != null) { + builder.append (":\n"); + builder.append (children_to_string (level + 1)); + builder.append ("\n"); + builder.append (string.nfill (level, '\t')); + } + builder.append ("]"); + return builder.str; + } + #endif + } + + private class DummyNode : Node { + public DummyNode (ref unowned Node? prev_next, ref unowned Node? next_prev, Node? iter_prev, Node? iter_next) { + #if DEBUG + base ("<>", ref prev_next, ref next_prev); + #else + base (null, ref prev_next, ref next_prev); + #endif + this.iter_prev = iter_prev; + this.iter_next = iter_next; + prev_next = next_prev = this; + } + + #if DEBUG + public override string to_string (int level = 0) { + StringBuilder builder = new StringBuilder (); + builder.append (string.nfill (level, '\t')); + builder.append ("%p<>".printf(this)); + return builder.str; + } + #endif + } + + private class NodePair { + public weak NodePair? lp_prev = null; + public NodePair? lp_next = null; + public Type1Node node1 = null; + public Type1Node node2 = null; + + public NodePair (Type1Node node1, Type1Node node2) { + this.node1 = node1; + this.node2 = node2; + } + } + + private class Iterator : Object, Gee.Iterator { + private PriorityQueue queue; + private unowned Node? position; + private unowned Node? previous; + private int stamp; + + public Iterator (PriorityQueue queue) { + this.queue = queue; + this.position = null; + this.previous = null; + this.stamp = queue._stamp; + } + + public bool next () { + unowned Node? next = _get_next_node (); + if (next != null) { + previous = position; + position = next; + } + return next != null; + } + + public bool has_next () { + return _get_next_node () != null; + } + + private inline unowned Node? _get_next_node () { + if (position != null) { + return position.iter_next; + } else { + return (previous != null) ? previous.iter_next : queue._iter_head; + } + } + + public bool first () { + assert (stamp == queue._stamp); + position = queue._iter_head; + previous = null; + return position != null; + } + + public new G get () { + assert (stamp == queue._stamp); + assert (position != null); + return position.data; + } + + public void remove () { + assert (stamp == queue._stamp); + assert (position != null); + DummyNode dn; + if (previous != null) { + dn = new DummyNode (ref previous.iter_next, ref position.iter_prev, previous, position); + } else { + dn = new DummyNode (ref queue._iter_head, ref position.iter_prev, null, position); + } + queue._delete (position); + position = null; + if (previous != null) { + previous.iter_next = dn.iter_next; + } + if (dn == queue._iter_head) { + queue._iter_head = dn.iter_next; + } + if (dn.iter_next != null) { + dn.iter_next.iter_prev = previous; + } + if (dn == queue._iter_tail) { + queue._iter_tail = previous; + } + stamp++; + assert (stamp == queue._stamp); + } + } +} diff --git a/gee/queue.c b/gee/queue.c new file mode 100644 index 0000000..5971186 --- /dev/null +++ b/gee/queue.c @@ -0,0 +1,247 @@ +/* queue.c generated by valac 0.18.0, the Vala compiler + * generated from queue.vala, do not modify */ + +/* queue.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_QUEUE (gee_queue_get_type ()) +#define GEE_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_QUEUE, GeeQueue)) +#define GEE_IS_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_QUEUE)) +#define GEE_QUEUE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_QUEUE, GeeQueueIface)) + +typedef struct _GeeQueue GeeQueue; +typedef struct _GeeQueueIface GeeQueueIface; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeQueueIface { + GTypeInterface parent_iface; + gboolean (*offer) (GeeQueue* self, gconstpointer element); + gpointer (*peek) (GeeQueue* self); + gpointer (*poll) (GeeQueue* self); + gint (*drain) (GeeQueue* self, GeeCollection* recipient, gint amount); + gint (*get_capacity) (GeeQueue* self); + gint (*get_remaining_capacity) (GeeQueue* self); + gboolean (*get_is_full) (GeeQueue* self); +}; + + + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_queue_get_type (void) G_GNUC_CONST; +gboolean gee_queue_offer (GeeQueue* self, gconstpointer element); +gpointer gee_queue_peek (GeeQueue* self); +gpointer gee_queue_poll (GeeQueue* self); +gint gee_queue_drain (GeeQueue* self, GeeCollection* recipient, gint amount); +#define GEE_QUEUE_UNBOUNDED_CAPACITY (-1) +gint gee_queue_get_capacity (GeeQueue* self); +gint gee_queue_get_remaining_capacity (GeeQueue* self); +gboolean gee_queue_get_is_full (GeeQueue* self); + + +/** + * Offers the specified element to this queue. + * + * @param element the element to offer to the queue + * + * @return ``true`` if the element was added to the queue + */ +gboolean gee_queue_offer (GeeQueue* self, gconstpointer element) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_QUEUE_GET_INTERFACE (self)->offer (self, element); +} + + +/** + * Peeks (retrieves, but not remove) an element from this queue. + * + * @return the element peeked from the queue (or ``null`` if none was + * available) + */ +gpointer gee_queue_peek (GeeQueue* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_QUEUE_GET_INTERFACE (self)->peek (self); +} + + +/** + * Polls (retrieves and remove) an element from this queue. + * + * @return the element polled from the queue (or ``null`` if none was + * available) + */ +gpointer gee_queue_poll (GeeQueue* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_QUEUE_GET_INTERFACE (self)->poll (self); +} + + +/** + * Drains the specified amount of elements from this queue in the specified + * recipient collection. + * + * @param recipient the recipient collection to drain the elements to + * @param amount the amount of elements to drain + * + * @return the amount of elements that were actually drained + */ +gint gee_queue_drain (GeeQueue* self, GeeCollection* recipient, gint amount) { + g_return_val_if_fail (self != NULL, 0); + return GEE_QUEUE_GET_INTERFACE (self)->drain (self, recipient, amount); +} + + +gint gee_queue_get_capacity (GeeQueue* self) { + g_return_val_if_fail (self != NULL, 0); + return GEE_QUEUE_GET_INTERFACE (self)->get_capacity (self); +} + + +gint gee_queue_get_remaining_capacity (GeeQueue* self) { + g_return_val_if_fail (self != NULL, 0); + return GEE_QUEUE_GET_INTERFACE (self)->get_remaining_capacity (self); +} + + +gboolean gee_queue_get_is_full (GeeQueue* self) { + g_return_val_if_fail (self != NULL, FALSE); + return GEE_QUEUE_GET_INTERFACE (self)->get_is_full (self); +} + + +static void gee_queue_base_init (GeeQueueIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + /** + * The capacity of this queue (or ``null`` if capacity is not bound). + */ + g_object_interface_install_property (iface, g_param_spec_int ("capacity", "capacity", "capacity", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The remaining capacity of this queue (or ``null`` if capacity is not + * bound). + */ + g_object_interface_install_property (iface, g_param_spec_int ("remaining-capacity", "remaining-capacity", "remaining-capacity", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * Specifies whether this queue is full. + */ + g_object_interface_install_property (iface, g_param_spec_boolean ("is-full", "is-full", "is-full", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + } +} + + +/** + * A collection designed for holding elements prior to processing. + * + * Although all Queue implementations do not limit the amount of elements they + * can contain, this interface supports for capacity-bounded queues. When + * capacity is not bound, then the {@link capacity} and + * {@link remaining_capacity} both return {@link UNBOUNDED_CAPACITY}. + * + * This interface defines methods that will never fail whatever the state of + * the queue is. For capacity-bounded queues, those methods will either return + * ``false`` or ``null`` to specify that the insert or retrieval did not occur + * because the queue was full or empty. + * + * Queue implementations are not limited to First-In-First-Out behavior and can + * propose different ordering of their elements. Each Queue implementation have + * to specify how it orders its elements. + * + * Queue implementations do not allow insertion of ``null`` elements, although + * some implementations, such as {@link LinkedList}, do not prohibit insertion + * of ``null``. Even in the implementations that permit it, ``null`` should not be + * inserted into a Queue, as ``null`` is also used as a special return value by + * the poll method to indicate that the queue contains no elements. + */ +GType gee_queue_get_type (void) { + static volatile gsize gee_queue_type_id__volatile = 0; + if (g_once_init_enter (&gee_queue_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeQueueIface), (GBaseInitFunc) gee_queue_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_queue_type_id; + gee_queue_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeQueue", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_queue_type_id, GEE_TYPE_COLLECTION); + g_once_init_leave (&gee_queue_type_id__volatile, gee_queue_type_id); + } + return gee_queue_type_id__volatile; +} + + + diff --git a/gee/queue.vala b/gee/queue.vala new file mode 100644 index 0000000..787f80a --- /dev/null +++ b/gee/queue.vala @@ -0,0 +1,104 @@ +/* queue.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +/** + * A collection designed for holding elements prior to processing. + * + * Although all Queue implementations do not limit the amount of elements they + * can contain, this interface supports for capacity-bounded queues. When + * capacity is not bound, then the {@link capacity} and + * {@link remaining_capacity} both return {@link UNBOUNDED_CAPACITY}. + * + * This interface defines methods that will never fail whatever the state of + * the queue is. For capacity-bounded queues, those methods will either return + * ``false`` or ``null`` to specify that the insert or retrieval did not occur + * because the queue was full or empty. + * + * Queue implementations are not limited to First-In-First-Out behavior and can + * propose different ordering of their elements. Each Queue implementation have + * to specify how it orders its elements. + * + * Queue implementations do not allow insertion of ``null`` elements, although + * some implementations, such as {@link LinkedList}, do not prohibit insertion + * of ``null``. Even in the implementations that permit it, ``null`` should not be + * inserted into a Queue, as ``null`` is also used as a special return value by + * the poll method to indicate that the queue contains no elements. + */ +public interface Gee.Queue : Collection { + + /** + * The unbounded capacity value. + */ + public static const int UNBOUNDED_CAPACITY = -1; + + /** + * The capacity of this queue (or ``null`` if capacity is not bound). + */ + public abstract int capacity { get; } + + /** + * The remaining capacity of this queue (or ``null`` if capacity is not + * bound). + */ + public abstract int remaining_capacity { get; } + + /** + * Specifies whether this queue is full. + */ + public abstract bool is_full { get; } + + /** + * Offers the specified element to this queue. + * + * @param element the element to offer to the queue + * + * @return ``true`` if the element was added to the queue + */ + public abstract bool offer (G element); + + /** + * Peeks (retrieves, but not remove) an element from this queue. + * + * @return the element peeked from the queue (or ``null`` if none was + * available) + */ + public abstract G? peek (); + + /** + * Polls (retrieves and remove) an element from this queue. + * + * @return the element polled from the queue (or ``null`` if none was + * available) + */ + public abstract G? poll (); + + /** + * Drains the specified amount of elements from this queue in the specified + * recipient collection. + * + * @param recipient the recipient collection to drain the elements to + * @param amount the amount of elements to drain + * + * @return the amount of elements that were actually drained + */ + public abstract int drain (Collection recipient, int amount = -1); +} diff --git a/gee/readonlycollection.c b/gee/readonlycollection.c new file mode 100644 index 0000000..ba291ce --- /dev/null +++ b/gee/readonlycollection.c @@ -0,0 +1,748 @@ +/* readonlycollection.c generated by valac 0.18.0, the Vala compiler + * generated from readonlycollection.vala, do not modify */ + +/* readonlycollection.vala + * + * Copyright (C) 2007-2008 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_READ_ONLY_COLLECTION (gee_read_only_collection_get_type ()) +#define GEE_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollection)) +#define GEE_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass)) +#define GEE_IS_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_READ_ONLY_COLLECTION)) +#define GEE_IS_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_READ_ONLY_COLLECTION)) +#define GEE_READ_ONLY_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass)) + +typedef struct _GeeReadOnlyCollection GeeReadOnlyCollection; +typedef struct _GeeReadOnlyCollectionClass GeeReadOnlyCollectionClass; +typedef struct _GeeReadOnlyCollectionPrivate GeeReadOnlyCollectionPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR (gee_read_only_collection_iterator_get_type ()) +#define GEE_READ_ONLY_COLLECTION_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIterator)) +#define GEE_READ_ONLY_COLLECTION_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIteratorClass)) +#define GEE_READ_ONLY_COLLECTION_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR)) +#define GEE_READ_ONLY_COLLECTION_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR)) +#define GEE_READ_ONLY_COLLECTION_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIteratorClass)) + +typedef struct _GeeReadOnlyCollectionIterator GeeReadOnlyCollectionIterator; +typedef struct _GeeReadOnlyCollectionIteratorClass GeeReadOnlyCollectionIteratorClass; +typedef struct _GeeReadOnlyCollectionIteratorPrivate GeeReadOnlyCollectionIteratorPrivate; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeReadOnlyCollection { + GObject parent_instance; + GeeReadOnlyCollectionPrivate * priv; + GeeCollection* _collection; +}; + +struct _GeeReadOnlyCollectionClass { + GObjectClass parent_class; + GeeCollection* (*get_read_only_view) (GeeReadOnlyCollection* self); +}; + +struct _GeeReadOnlyCollectionPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; +}; + +struct _GeeReadOnlyCollectionIterator { + GObject parent_instance; + GeeReadOnlyCollectionIteratorPrivate * priv; + GeeIterator* _iter; +}; + +struct _GeeReadOnlyCollectionIteratorClass { + GObjectClass parent_class; +}; + +struct _GeeReadOnlyCollectionIteratorPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; +}; + + +static gpointer gee_read_only_collection_parent_class = NULL; +static gpointer gee_read_only_collection_iterator_parent_class = NULL; +static GeeIteratorIface* gee_read_only_collection_iterator_gee_iterator_parent_iface = NULL; +static GeeIterableIface* gee_read_only_collection_gee_iterable_parent_iface = NULL; +static GeeCollectionIface* gee_read_only_collection_gee_collection_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_read_only_collection_get_type (void) G_GNUC_CONST; +#define GEE_READ_ONLY_COLLECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionPrivate)) +enum { + GEE_READ_ONLY_COLLECTION_DUMMY_PROPERTY, + GEE_READ_ONLY_COLLECTION_G_TYPE, + GEE_READ_ONLY_COLLECTION_G_DUP_FUNC, + GEE_READ_ONLY_COLLECTION_G_DESTROY_FUNC, + GEE_READ_ONLY_COLLECTION_SIZE, + GEE_READ_ONLY_COLLECTION_IS_EMPTY, + GEE_READ_ONLY_COLLECTION_ELEMENT_TYPE, + GEE_READ_ONLY_COLLECTION_READ_ONLY_VIEW +}; +GeeReadOnlyCollection* gee_read_only_collection_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection); +GeeReadOnlyCollection* gee_read_only_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection); +static GeeIterator* gee_read_only_collection_real_iterator (GeeIterable* base); +GeeIterator* gee_iterable_iterator (GeeIterable* self); +GeeReadOnlyCollectionIterator* gee_read_only_collection_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeIterator* iterator); +GeeReadOnlyCollectionIterator* gee_read_only_collection_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeIterator* iterator); +GType gee_read_only_collection_iterator_get_type (void) G_GNUC_CONST; +static gboolean gee_read_only_collection_real_contains (GeeCollection* base, gconstpointer item); +gboolean gee_collection_contains (GeeCollection* self, gconstpointer item); +static gboolean gee_read_only_collection_real_add (GeeCollection* base, gconstpointer item); +static gboolean gee_read_only_collection_real_remove (GeeCollection* base, gconstpointer item); +static void gee_read_only_collection_real_clear (GeeCollection* base); +static gboolean gee_read_only_collection_real_add_all (GeeCollection* base, GeeCollection* collection); +static gboolean gee_read_only_collection_real_contains_all (GeeCollection* base, GeeCollection* collection); +gboolean gee_collection_contains_all (GeeCollection* self, GeeCollection* collection); +static gboolean gee_read_only_collection_real_remove_all (GeeCollection* base, GeeCollection* collection); +static gboolean gee_read_only_collection_real_retain_all (GeeCollection* base, GeeCollection* collection); +static gpointer* gee_read_only_collection_real_to_array (GeeCollection* base, int* result_length1); +gpointer* gee_collection_to_array (GeeCollection* self, int* result_length1); +gint gee_collection_get_size (GeeCollection* self); +gboolean gee_collection_get_is_empty (GeeCollection* self); +GeeCollection* gee_read_only_collection_get_read_only_view (GeeReadOnlyCollection* self); +#define GEE_READ_ONLY_COLLECTION_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIteratorPrivate)) +enum { + GEE_READ_ONLY_COLLECTION_ITERATOR_DUMMY_PROPERTY, + GEE_READ_ONLY_COLLECTION_ITERATOR_G_TYPE, + GEE_READ_ONLY_COLLECTION_ITERATOR_G_DUP_FUNC, + GEE_READ_ONLY_COLLECTION_ITERATOR_G_DESTROY_FUNC +}; +static gboolean gee_read_only_collection_iterator_real_next (GeeIterator* base); +gboolean gee_iterator_next (GeeIterator* self); +static gboolean gee_read_only_collection_iterator_real_has_next (GeeIterator* base); +gboolean gee_iterator_has_next (GeeIterator* self); +static gboolean gee_read_only_collection_iterator_real_first (GeeIterator* base); +gboolean gee_iterator_first (GeeIterator* self); +static gpointer gee_read_only_collection_iterator_real_get (GeeIterator* base); +gpointer gee_iterator_get (GeeIterator* self); +static void gee_read_only_collection_iterator_real_remove (GeeIterator* base); +static void gee_read_only_collection_iterator_finalize (GObject* obj); +static void _vala_gee_read_only_collection_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_read_only_collection_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void gee_read_only_collection_finalize (GObject* obj); +GType gee_iterable_get_element_type (GeeIterable* self); +static void _vala_gee_read_only_collection_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_read_only_collection_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +/** + * Constructs a read-only collection that mirrors the content of the + * specified collection. + * + * @param collection the collection to decorate. + */ +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +GeeReadOnlyCollection* gee_read_only_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection) { + GeeReadOnlyCollection * self = NULL; + GeeCollection* _tmp0_; + GeeCollection* _tmp1_; + g_return_val_if_fail (collection != NULL, NULL); + self = (GeeReadOnlyCollection*) g_object_new (object_type, NULL); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = collection; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->_collection); + self->_collection = _tmp1_; + return self; +} + + +GeeReadOnlyCollection* gee_read_only_collection_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection) { + return gee_read_only_collection_construct (GEE_TYPE_READ_ONLY_COLLECTION, g_type, g_dup_func, g_destroy_func, collection); +} + + +/** + * {@inheritDoc} + */ +static GeeIterator* gee_read_only_collection_real_iterator (GeeIterable* base) { + GeeReadOnlyCollection * self; + GeeIterator* result = NULL; + GeeCollection* _tmp0_; + GeeIterator* _tmp1_ = NULL; + GeeIterator* _tmp2_; + GeeReadOnlyCollectionIterator* _tmp3_; + GeeIterator* _tmp4_; + self = (GeeReadOnlyCollection*) base; + _tmp0_ = self->_collection; + _tmp1_ = gee_iterable_iterator ((GeeIterable*) _tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = gee_read_only_collection_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp2_); + _tmp4_ = (GeeIterator*) _tmp3_; + _g_object_unref0 (_tmp2_); + result = _tmp4_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_read_only_collection_real_contains (GeeCollection* base, gconstpointer item) { + GeeReadOnlyCollection * self; + gboolean result = FALSE; + GeeCollection* _tmp0_; + gconstpointer _tmp1_; + gboolean _tmp2_ = FALSE; + self = (GeeReadOnlyCollection*) base; + _tmp0_ = self->_collection; + _tmp1_ = item; + _tmp2_ = gee_collection_contains (_tmp0_, _tmp1_); + result = _tmp2_; + return result; +} + + +/** + * Unimplemented method (read only collection). + */ +static gboolean gee_read_only_collection_real_add (GeeCollection* base, gconstpointer item) { + GeeReadOnlyCollection * self; + gboolean result = FALSE; + self = (GeeReadOnlyCollection*) base; + g_assert_not_reached (); + return result; +} + + +/** + * Unimplemented method (read only collection). + */ +static gboolean gee_read_only_collection_real_remove (GeeCollection* base, gconstpointer item) { + GeeReadOnlyCollection * self; + gboolean result = FALSE; + self = (GeeReadOnlyCollection*) base; + g_assert_not_reached (); + return result; +} + + +/** + * Unimplemented method (read only collection). + */ +static void gee_read_only_collection_real_clear (GeeCollection* base) { + GeeReadOnlyCollection * self; + self = (GeeReadOnlyCollection*) base; + g_assert_not_reached (); +} + + +/** + * Unimplemented method (read only collection). + */ +static gboolean gee_read_only_collection_real_add_all (GeeCollection* base, GeeCollection* collection) { + GeeReadOnlyCollection * self; + gboolean result = FALSE; + self = (GeeReadOnlyCollection*) base; + g_return_val_if_fail (collection != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_read_only_collection_real_contains_all (GeeCollection* base, GeeCollection* collection) { + GeeReadOnlyCollection * self; + gboolean result = FALSE; + GeeCollection* _tmp0_; + GeeCollection* _tmp1_; + gboolean _tmp2_ = FALSE; + self = (GeeReadOnlyCollection*) base; + g_return_val_if_fail (collection != NULL, FALSE); + _tmp0_ = self->_collection; + _tmp1_ = collection; + _tmp2_ = gee_collection_contains_all (_tmp0_, _tmp1_); + result = _tmp2_; + return result; +} + + +/** + * Unimplemented method (read only collection). + */ +static gboolean gee_read_only_collection_real_remove_all (GeeCollection* base, GeeCollection* collection) { + GeeReadOnlyCollection * self; + gboolean result = FALSE; + self = (GeeReadOnlyCollection*) base; + g_return_val_if_fail (collection != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +/** + * Unimplemented method (read only collection). + */ +static gboolean gee_read_only_collection_real_retain_all (GeeCollection* base, GeeCollection* collection) { + GeeReadOnlyCollection * self; + gboolean result = FALSE; + self = (GeeReadOnlyCollection*) base; + g_return_val_if_fail (collection != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer* gee_read_only_collection_real_to_array (GeeCollection* base, int* result_length1) { + GeeReadOnlyCollection * self; + gpointer* result = NULL; + GeeCollection* _tmp0_; + gint _tmp1_ = 0; + gpointer* _tmp2_ = NULL; + gpointer* _tmp3_; + gint _tmp3__length1; + self = (GeeReadOnlyCollection*) base; + _tmp0_ = self->_collection; + _tmp2_ = gee_collection_to_array (_tmp0_, &_tmp1_); + _tmp3_ = _tmp2_; + _tmp3__length1 = _tmp1_; + if (result_length1) { + *result_length1 = _tmp3__length1; + } + result = _tmp3_; + return result; +} + + +static gint gee_read_only_collection_real_get_size (GeeCollection* base) { + gint result; + GeeReadOnlyCollection* self; + GeeCollection* _tmp0_; + gint _tmp1_; + gint _tmp2_; + self = (GeeReadOnlyCollection*) base; + _tmp0_ = self->_collection; + _tmp1_ = gee_collection_get_size (_tmp0_); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +static gboolean gee_read_only_collection_real_get_is_empty (GeeCollection* base) { + gboolean result; + GeeReadOnlyCollection* self; + GeeCollection* _tmp0_; + gboolean _tmp1_; + gboolean _tmp2_; + self = (GeeReadOnlyCollection*) base; + _tmp0_ = self->_collection; + _tmp1_ = gee_collection_get_is_empty (_tmp0_); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +static GType gee_read_only_collection_real_get_element_type (GeeIterable* base) { + GType result; + GeeReadOnlyCollection* self; + self = (GeeReadOnlyCollection*) base; + result = self->priv->g_type; + return result; +} + + +GeeCollection* gee_read_only_collection_get_read_only_view (GeeReadOnlyCollection* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_READ_ONLY_COLLECTION_GET_CLASS (self)->get_read_only_view (self); +} + + +static GeeCollection* gee_read_only_collection_real_get_read_only_view (GeeReadOnlyCollection* base) { + GeeCollection* result; + GeeReadOnlyCollection* self; + GeeCollection* _tmp0_; + self = base; + _tmp0_ = _g_object_ref0 ((GeeCollection*) self); + result = _tmp0_; + return result; +} + + +GeeReadOnlyCollectionIterator* gee_read_only_collection_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeIterator* iterator) { + GeeReadOnlyCollectionIterator * self = NULL; + GeeIterator* _tmp0_; + GeeIterator* _tmp1_; + g_return_val_if_fail (iterator != NULL, NULL); + self = (GeeReadOnlyCollectionIterator*) g_object_new (object_type, NULL); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = iterator; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->_iter); + self->_iter = _tmp1_; + return self; +} + + +GeeReadOnlyCollectionIterator* gee_read_only_collection_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeIterator* iterator) { + return gee_read_only_collection_iterator_construct (GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, g_type, g_dup_func, g_destroy_func, iterator); +} + + +static gboolean gee_read_only_collection_iterator_real_next (GeeIterator* base) { + GeeReadOnlyCollectionIterator * self; + gboolean result = FALSE; + GeeIterator* _tmp0_; + gboolean _tmp1_ = FALSE; + self = (GeeReadOnlyCollectionIterator*) base; + _tmp0_ = self->_iter; + _tmp1_ = gee_iterator_next (_tmp0_); + result = _tmp1_; + return result; +} + + +static gboolean gee_read_only_collection_iterator_real_has_next (GeeIterator* base) { + GeeReadOnlyCollectionIterator * self; + gboolean result = FALSE; + GeeIterator* _tmp0_; + gboolean _tmp1_ = FALSE; + self = (GeeReadOnlyCollectionIterator*) base; + _tmp0_ = self->_iter; + _tmp1_ = gee_iterator_has_next (_tmp0_); + result = _tmp1_; + return result; +} + + +static gboolean gee_read_only_collection_iterator_real_first (GeeIterator* base) { + GeeReadOnlyCollectionIterator * self; + gboolean result = FALSE; + GeeIterator* _tmp0_; + gboolean _tmp1_ = FALSE; + self = (GeeReadOnlyCollectionIterator*) base; + _tmp0_ = self->_iter; + _tmp1_ = gee_iterator_first (_tmp0_); + result = _tmp1_; + return result; +} + + +static gpointer gee_read_only_collection_iterator_real_get (GeeIterator* base) { + GeeReadOnlyCollectionIterator * self; + gpointer result = NULL; + GeeIterator* _tmp0_; + gpointer _tmp1_ = NULL; + self = (GeeReadOnlyCollectionIterator*) base; + _tmp0_ = self->_iter; + _tmp1_ = gee_iterator_get (_tmp0_); + result = _tmp1_; + return result; +} + + +static void gee_read_only_collection_iterator_real_remove (GeeIterator* base) { + GeeReadOnlyCollectionIterator * self; + self = (GeeReadOnlyCollectionIterator*) base; + g_assert_not_reached (); +} + + +static void gee_read_only_collection_iterator_class_init (GeeReadOnlyCollectionIteratorClass * klass) { + gee_read_only_collection_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeReadOnlyCollectionIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_read_only_collection_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_read_only_collection_iterator_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_read_only_collection_iterator_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_COLLECTION_ITERATOR_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_COLLECTION_ITERATOR_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_COLLECTION_ITERATOR_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_read_only_collection_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) { + gee_read_only_collection_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->next = (gboolean (*)(GeeIterator*)) gee_read_only_collection_iterator_real_next; + iface->has_next = (gboolean (*)(GeeIterator*)) gee_read_only_collection_iterator_real_has_next; + iface->first = (gboolean (*)(GeeIterator*)) gee_read_only_collection_iterator_real_first; + iface->get = (gpointer (*)(GeeIterator*)) gee_read_only_collection_iterator_real_get; + iface->remove = (void (*)(GeeIterator*)) gee_read_only_collection_iterator_real_remove; +} + + +static void gee_read_only_collection_iterator_instance_init (GeeReadOnlyCollectionIterator * self) { + self->priv = GEE_READ_ONLY_COLLECTION_ITERATOR_GET_PRIVATE (self); +} + + +static void gee_read_only_collection_iterator_finalize (GObject* obj) { + GeeReadOnlyCollectionIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIterator); + _g_object_unref0 (self->_iter); + G_OBJECT_CLASS (gee_read_only_collection_iterator_parent_class)->finalize (obj); +} + + +GType gee_read_only_collection_iterator_get_type (void) { + static volatile gsize gee_read_only_collection_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_read_only_collection_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeReadOnlyCollectionIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_read_only_collection_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeReadOnlyCollectionIterator), 0, (GInstanceInitFunc) gee_read_only_collection_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_read_only_collection_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_read_only_collection_iterator_type_id; + gee_read_only_collection_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeReadOnlyCollectionIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_read_only_collection_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info); + g_once_init_leave (&gee_read_only_collection_iterator_type_id__volatile, gee_read_only_collection_iterator_type_id); + } + return gee_read_only_collection_iterator_type_id__volatile; +} + + +static void _vala_gee_read_only_collection_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeReadOnlyCollectionIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_read_only_collection_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeReadOnlyCollectionIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIterator); + switch (property_id) { + case GEE_READ_ONLY_COLLECTION_ITERATOR_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_READ_ONLY_COLLECTION_ITERATOR_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_READ_ONLY_COLLECTION_ITERATOR_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void gee_read_only_collection_class_init (GeeReadOnlyCollectionClass * klass) { + gee_read_only_collection_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeReadOnlyCollectionPrivate)); + GEE_READ_ONLY_COLLECTION_CLASS (klass)->get_read_only_view = gee_read_only_collection_real_get_read_only_view; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_read_only_collection_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_read_only_collection_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_read_only_collection_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_COLLECTION_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_COLLECTION_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_COLLECTION_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_COLLECTION_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_COLLECTION_IS_EMPTY, g_param_spec_boolean ("is-empty", "is-empty", "is-empty", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_COLLECTION_ELEMENT_TYPE, g_param_spec_gtype ("element-type", "element-type", "element-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_COLLECTION_READ_ONLY_VIEW, g_param_spec_object ("read-only-view", "read-only-view", "read-only-view", GEE_TYPE_COLLECTION, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_read_only_collection_gee_iterable_interface_init (GeeIterableIface * iface) { + gee_read_only_collection_gee_iterable_parent_iface = g_type_interface_peek_parent (iface); + iface->iterator = (GeeIterator* (*)(GeeIterable*)) gee_read_only_collection_real_iterator; + iface->get_element_type = gee_read_only_collection_real_get_element_type; +} + + +static void gee_read_only_collection_gee_collection_interface_init (GeeCollectionIface * iface) { + gee_read_only_collection_gee_collection_parent_iface = g_type_interface_peek_parent (iface); + iface->contains = (gboolean (*)(GeeCollection*, gconstpointer)) gee_read_only_collection_real_contains; + iface->add = (gboolean (*)(GeeCollection*, gconstpointer)) gee_read_only_collection_real_add; + iface->remove = (gboolean (*)(GeeCollection*, gconstpointer)) gee_read_only_collection_real_remove; + iface->clear = (void (*)(GeeCollection*)) gee_read_only_collection_real_clear; + iface->add_all = (gboolean (*)(GeeCollection*, GeeCollection*)) gee_read_only_collection_real_add_all; + iface->contains_all = (gboolean (*)(GeeCollection*, GeeCollection*)) gee_read_only_collection_real_contains_all; + iface->remove_all = (gboolean (*)(GeeCollection*, GeeCollection*)) gee_read_only_collection_real_remove_all; + iface->retain_all = (gboolean (*)(GeeCollection*, GeeCollection*)) gee_read_only_collection_real_retain_all; + iface->to_array = (gpointer* (*)(GeeCollection*, int*)) gee_read_only_collection_real_to_array; + iface->get_size = gee_read_only_collection_real_get_size; + iface->get_is_empty = gee_read_only_collection_real_get_is_empty; + iface->get_read_only_view = (GeeCollection* (*) (GeeCollection *)) gee_read_only_collection_get_read_only_view; +} + + +static void gee_read_only_collection_instance_init (GeeReadOnlyCollection * self) { + self->priv = GEE_READ_ONLY_COLLECTION_GET_PRIVATE (self); +} + + +static void gee_read_only_collection_finalize (GObject* obj) { + GeeReadOnlyCollection * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollection); + _g_object_unref0 (self->_collection); + G_OBJECT_CLASS (gee_read_only_collection_parent_class)->finalize (obj); +} + + +/** + * Read-only view for {@link Collection} collections. + * + * This class decorates any class which implements the {@link Collection} + * interface by making it read only. Any method which normally modify data will + * throw an error. + * + * @see Collection + */ +GType gee_read_only_collection_get_type (void) { + static volatile gsize gee_read_only_collection_type_id__volatile = 0; + if (g_once_init_enter (&gee_read_only_collection_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeReadOnlyCollectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_read_only_collection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeReadOnlyCollection), 0, (GInstanceInitFunc) gee_read_only_collection_instance_init, NULL }; + static const GInterfaceInfo gee_iterable_info = { (GInterfaceInitFunc) gee_read_only_collection_gee_iterable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + static const GInterfaceInfo gee_collection_info = { (GInterfaceInitFunc) gee_read_only_collection_gee_collection_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_read_only_collection_type_id; + gee_read_only_collection_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeReadOnlyCollection", &g_define_type_info, 0); + g_type_add_interface_static (gee_read_only_collection_type_id, GEE_TYPE_ITERABLE, &gee_iterable_info); + g_type_add_interface_static (gee_read_only_collection_type_id, GEE_TYPE_COLLECTION, &gee_collection_info); + g_once_init_leave (&gee_read_only_collection_type_id__volatile, gee_read_only_collection_type_id); + } + return gee_read_only_collection_type_id__volatile; +} + + +static void _vala_gee_read_only_collection_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeReadOnlyCollection * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollection); + switch (property_id) { + case GEE_READ_ONLY_COLLECTION_SIZE: + g_value_set_int (value, gee_collection_get_size ((GeeCollection*) self)); + break; + case GEE_READ_ONLY_COLLECTION_IS_EMPTY: + g_value_set_boolean (value, gee_collection_get_is_empty ((GeeCollection*) self)); + break; + case GEE_READ_ONLY_COLLECTION_ELEMENT_TYPE: + g_value_set_gtype (value, gee_iterable_get_element_type ((GeeIterable*) self)); + break; + case GEE_READ_ONLY_COLLECTION_READ_ONLY_VIEW: + g_value_take_object (value, gee_read_only_collection_get_read_only_view (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_read_only_collection_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeReadOnlyCollection * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollection); + switch (property_id) { + case GEE_READ_ONLY_COLLECTION_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_READ_ONLY_COLLECTION_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_READ_ONLY_COLLECTION_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/gee/readonlycollection.vala b/gee/readonlycollection.vala new file mode 100644 index 0000000..54ff850 --- /dev/null +++ b/gee/readonlycollection.vala @@ -0,0 +1,172 @@ +/* readonlycollection.vala + * + * Copyright (C) 2007-2008 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +using GLib; + +/** + * Read-only view for {@link Collection} collections. + * + * This class decorates any class which implements the {@link Collection} + * interface by making it read only. Any method which normally modify data will + * throw an error. + * + * @see Collection + */ +internal class Gee.ReadOnlyCollection : Object, Iterable, Collection { + + /** + * {@inheritDoc} + */ + public int size { + get { return _collection.size; } + } + + /** + * {@inheritDoc} + */ + public bool is_empty { + get { return _collection.is_empty; } + } + + protected Collection _collection; + + /** + * Constructs a read-only collection that mirrors the content of the + * specified collection. + * + * @param collection the collection to decorate. + */ + public ReadOnlyCollection (Collection collection) { + this._collection = collection; + } + + /** + * {@inheritDoc} + */ + public Type element_type { + get { return typeof (G); } + } + + /** + * {@inheritDoc} + */ + public Gee.Iterator iterator () { + return new Iterator (_collection.iterator ()); + } + + /** + * {@inheritDoc} + */ + public bool contains (G item) { + return _collection.contains (item); + } + + /** + * Unimplemented method (read only collection). + */ + public bool add (G item) { + assert_not_reached (); + } + + /** + * Unimplemented method (read only collection). + */ + public bool remove (G item) { + assert_not_reached (); + } + + /** + * Unimplemented method (read only collection). + */ + public void clear () { + assert_not_reached (); + } + + /** + * Unimplemented method (read only collection). + */ + public bool add_all (Collection collection) { + assert_not_reached (); + } + + /** + * {@inheritDoc} + */ + public bool contains_all (Collection collection) { + return _collection.contains_all (collection); + } + + /** + * Unimplemented method (read only collection). + */ + public bool remove_all (Collection collection) { + assert_not_reached (); + } + + /** + * Unimplemented method (read only collection). + */ + public bool retain_all (Collection collection) { + assert_not_reached (); + } + + /** + * {@inheritDoc} + */ + public G[] to_array () { + return _collection.to_array (); + } + + protected class Iterator : Object, Gee.Iterator { + protected Gee.Iterator _iter; + + public Iterator (Gee.Iterator iterator) { + _iter = iterator; + } + + public bool next () { + return _iter.next (); + } + + public bool has_next () { + return _iter.has_next (); + } + + public bool first () { + return _iter.first (); + } + + public new G get () { + return _iter.get (); + } + + public void remove () { + assert_not_reached (); + } + } + + public virtual Collection read_only_view { + owned get { return this; } + } + +} + diff --git a/gee/readonlylist.c b/gee/readonlylist.c new file mode 100644 index 0000000..df7d687 --- /dev/null +++ b/gee/readonlylist.c @@ -0,0 +1,779 @@ +/* readonlylist.c generated by valac 0.18.0, the Vala compiler + * generated from readonlylist.vala, do not modify */ + +/* readonlylist.vala + * + * Copyright (C) 2007-2008 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_READ_ONLY_COLLECTION (gee_read_only_collection_get_type ()) +#define GEE_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollection)) +#define GEE_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass)) +#define GEE_IS_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_READ_ONLY_COLLECTION)) +#define GEE_IS_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_READ_ONLY_COLLECTION)) +#define GEE_READ_ONLY_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass)) + +typedef struct _GeeReadOnlyCollection GeeReadOnlyCollection; +typedef struct _GeeReadOnlyCollectionClass GeeReadOnlyCollectionClass; +typedef struct _GeeReadOnlyCollectionPrivate GeeReadOnlyCollectionPrivate; + +#define GEE_TYPE_LIST (gee_list_get_type ()) +#define GEE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST, GeeList)) +#define GEE_IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST)) +#define GEE_LIST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST, GeeListIface)) + +typedef struct _GeeList GeeList; +typedef struct _GeeListIface GeeListIface; + +#define GEE_TYPE_BIDIR_ITERATOR (gee_bidir_iterator_get_type ()) +#define GEE_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIterator)) +#define GEE_IS_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_ITERATOR)) +#define GEE_BIDIR_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIteratorIface)) + +typedef struct _GeeBidirIterator GeeBidirIterator; +typedef struct _GeeBidirIteratorIface GeeBidirIteratorIface; + +#define GEE_TYPE_LIST_ITERATOR (gee_list_iterator_get_type ()) +#define GEE_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIterator)) +#define GEE_IS_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST_ITERATOR)) +#define GEE_LIST_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIteratorIface)) + +typedef struct _GeeListIterator GeeListIterator; +typedef struct _GeeListIteratorIface GeeListIteratorIface; + +#define GEE_TYPE_READ_ONLY_LIST (gee_read_only_list_get_type ()) +#define GEE_READ_ONLY_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_READ_ONLY_LIST, GeeReadOnlyList)) +#define GEE_READ_ONLY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_READ_ONLY_LIST, GeeReadOnlyListClass)) +#define GEE_IS_READ_ONLY_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_READ_ONLY_LIST)) +#define GEE_IS_READ_ONLY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_READ_ONLY_LIST)) +#define GEE_READ_ONLY_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_READ_ONLY_LIST, GeeReadOnlyListClass)) + +typedef struct _GeeReadOnlyList GeeReadOnlyList; +typedef struct _GeeReadOnlyListClass GeeReadOnlyListClass; +typedef struct _GeeReadOnlyListPrivate GeeReadOnlyListPrivate; + +#define GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR (gee_read_only_collection_iterator_get_type ()) +#define GEE_READ_ONLY_COLLECTION_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIterator)) +#define GEE_READ_ONLY_COLLECTION_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIteratorClass)) +#define GEE_READ_ONLY_COLLECTION_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR)) +#define GEE_READ_ONLY_COLLECTION_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR)) +#define GEE_READ_ONLY_COLLECTION_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIteratorClass)) + +typedef struct _GeeReadOnlyCollectionIterator GeeReadOnlyCollectionIterator; +typedef struct _GeeReadOnlyCollectionIteratorClass GeeReadOnlyCollectionIteratorClass; + +#define GEE_READ_ONLY_LIST_TYPE_ITERATOR (gee_read_only_list_iterator_get_type ()) +#define GEE_READ_ONLY_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_READ_ONLY_LIST_TYPE_ITERATOR, GeeReadOnlyListIterator)) +#define GEE_READ_ONLY_LIST_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_READ_ONLY_LIST_TYPE_ITERATOR, GeeReadOnlyListIteratorClass)) +#define GEE_READ_ONLY_LIST_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_READ_ONLY_LIST_TYPE_ITERATOR)) +#define GEE_READ_ONLY_LIST_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_READ_ONLY_LIST_TYPE_ITERATOR)) +#define GEE_READ_ONLY_LIST_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_READ_ONLY_LIST_TYPE_ITERATOR, GeeReadOnlyListIteratorClass)) + +typedef struct _GeeReadOnlyListIterator GeeReadOnlyListIterator; +typedef struct _GeeReadOnlyListIteratorClass GeeReadOnlyListIteratorClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +typedef struct _GeeReadOnlyCollectionIteratorPrivate GeeReadOnlyCollectionIteratorPrivate; +typedef struct _GeeReadOnlyListIteratorPrivate GeeReadOnlyListIteratorPrivate; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeReadOnlyCollection { + GObject parent_instance; + GeeReadOnlyCollectionPrivate * priv; + GeeCollection* _collection; +}; + +struct _GeeReadOnlyCollectionClass { + GObjectClass parent_class; + GeeCollection* (*get_read_only_view) (GeeReadOnlyCollection* self); +}; + +struct _GeeBidirIteratorIface { + GTypeInterface parent_iface; + gboolean (*previous) (GeeBidirIterator* self); + gboolean (*has_previous) (GeeBidirIterator* self); + gboolean (*last) (GeeBidirIterator* self); +}; + +struct _GeeListIteratorIface { + GTypeInterface parent_iface; + void (*set) (GeeListIterator* self, gconstpointer item); + void (*insert) (GeeListIterator* self, gconstpointer item); + void (*add) (GeeListIterator* self, gconstpointer item); + gint (*index) (GeeListIterator* self); +}; + +struct _GeeListIface { + GTypeInterface parent_iface; + GeeListIterator* (*list_iterator) (GeeList* self); + gpointer (*get) (GeeList* self, gint index); + void (*set) (GeeList* self, gint index, gconstpointer item); + gint (*index_of) (GeeList* self, gconstpointer item); + void (*insert) (GeeList* self, gint index, gconstpointer item); + gpointer (*remove_at) (GeeList* self, gint index); + GeeList* (*slice) (GeeList* self, gint start, gint stop); + gpointer (*first) (GeeList* self); + gpointer (*last) (GeeList* self); + void (*insert_all) (GeeList* self, gint index, GeeCollection* collection); + void (*sort) (GeeList* self, GCompareFunc compare_func); + GeeList* (*get_read_only_view) (GeeList* self); +}; + +struct _GeeReadOnlyList { + GeeReadOnlyCollection parent_instance; + GeeReadOnlyListPrivate * priv; +}; + +struct _GeeReadOnlyListClass { + GeeReadOnlyCollectionClass parent_class; + GeeList* (*get_read_only_view) (GeeReadOnlyList* self); +}; + +struct _GeeReadOnlyListPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; +}; + +struct _GeeReadOnlyCollectionIterator { + GObject parent_instance; + GeeReadOnlyCollectionIteratorPrivate * priv; + GeeIterator* _iter; +}; + +struct _GeeReadOnlyCollectionIteratorClass { + GObjectClass parent_class; +}; + +struct _GeeReadOnlyListIterator { + GeeReadOnlyCollectionIterator parent_instance; + GeeReadOnlyListIteratorPrivate * priv; +}; + +struct _GeeReadOnlyListIteratorClass { + GeeReadOnlyCollectionIteratorClass parent_class; +}; + +struct _GeeReadOnlyListIteratorPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; +}; + + +static gpointer gee_read_only_list_parent_class = NULL; +static gpointer gee_read_only_list_iterator_parent_class = NULL; +static GeeBidirIteratorIface* gee_read_only_list_iterator_gee_bidir_iterator_parent_iface = NULL; +static GeeListIteratorIface* gee_read_only_list_iterator_gee_list_iterator_parent_iface = NULL; +static GeeListIface* gee_read_only_list_gee_list_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_read_only_collection_get_type (void) G_GNUC_CONST; +GType gee_bidir_iterator_get_type (void) G_GNUC_CONST; +GType gee_list_iterator_get_type (void) G_GNUC_CONST; +GType gee_list_get_type (void) G_GNUC_CONST; +GType gee_read_only_list_get_type (void) G_GNUC_CONST; +#define GEE_READ_ONLY_LIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_READ_ONLY_LIST, GeeReadOnlyListPrivate)) +enum { + GEE_READ_ONLY_LIST_DUMMY_PROPERTY, + GEE_READ_ONLY_LIST_G_TYPE, + GEE_READ_ONLY_LIST_G_DUP_FUNC, + GEE_READ_ONLY_LIST_G_DESTROY_FUNC, + GEE_READ_ONLY_LIST_READ_ONLY_VIEW +}; +GeeReadOnlyList* gee_read_only_list_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list); +GeeReadOnlyList* gee_read_only_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list); +GeeReadOnlyCollection* gee_read_only_collection_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection); +GeeReadOnlyCollection* gee_read_only_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection); +static GeeListIterator* gee_read_only_list_real_list_iterator (GeeList* base); +GeeListIterator* gee_list_list_iterator (GeeList* self); +static GeeReadOnlyListIterator* gee_read_only_list_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeListIterator* iterator); +static GeeReadOnlyListIterator* gee_read_only_list_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeListIterator* iterator); +GType gee_read_only_collection_iterator_get_type (void) G_GNUC_CONST; +static GType gee_read_only_list_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static gint gee_read_only_list_real_index_of (GeeList* base, gconstpointer item); +gint gee_list_index_of (GeeList* self, gconstpointer item); +static void gee_read_only_list_real_insert (GeeList* base, gint index, gconstpointer item); +static gpointer gee_read_only_list_real_remove_at (GeeList* base, gint index); +static gpointer gee_read_only_list_real_get (GeeList* base, gint index); +gpointer gee_list_get (GeeList* self, gint index); +static void gee_read_only_list_real_set (GeeList* base, gint index, gconstpointer o); +static GeeList* gee_read_only_list_real_slice (GeeList* base, gint start, gint stop); +static gpointer gee_read_only_list_real_first (GeeList* base); +gpointer gee_list_first (GeeList* self); +static gpointer gee_read_only_list_real_last (GeeList* base); +gpointer gee_list_last (GeeList* self); +static void gee_read_only_list_real_insert_all (GeeList* base, gint index, GeeCollection* collection); +static void gee_read_only_list_real_sort (GeeList* base, GCompareFunc compare); +GeeList* gee_read_only_list_get_read_only_view (GeeReadOnlyList* self); +#define GEE_READ_ONLY_LIST_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_READ_ONLY_LIST_TYPE_ITERATOR, GeeReadOnlyListIteratorPrivate)) +enum { + GEE_READ_ONLY_LIST_ITERATOR_DUMMY_PROPERTY, + GEE_READ_ONLY_LIST_ITERATOR_G_TYPE, + GEE_READ_ONLY_LIST_ITERATOR_G_DUP_FUNC, + GEE_READ_ONLY_LIST_ITERATOR_G_DESTROY_FUNC +}; +GeeReadOnlyCollectionIterator* gee_read_only_collection_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeIterator* iterator); +GeeReadOnlyCollectionIterator* gee_read_only_collection_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeIterator* iterator); +static gboolean gee_read_only_list_iterator_real_previous (GeeBidirIterator* base); +gboolean gee_bidir_iterator_previous (GeeBidirIterator* self); +static gboolean gee_read_only_list_iterator_real_has_previous (GeeBidirIterator* base); +gboolean gee_bidir_iterator_has_previous (GeeBidirIterator* self); +static gboolean gee_read_only_list_iterator_real_last (GeeBidirIterator* base); +gboolean gee_bidir_iterator_last (GeeBidirIterator* self); +static void gee_read_only_list_iterator_real_set (GeeListIterator* base, gconstpointer item); +static void gee_read_only_list_iterator_real_insert (GeeListIterator* base, gconstpointer item); +static void gee_read_only_list_iterator_real_add (GeeListIterator* base, gconstpointer item); +static gint gee_read_only_list_iterator_real_index (GeeListIterator* base); +gint gee_list_iterator_index (GeeListIterator* self); +static void _vala_gee_read_only_list_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_read_only_list_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void _vala_gee_read_only_list_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_read_only_list_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +/** + * Constructs a read-only list that mirrors the content of the specified + * list. + * + * @param list the list to decorate. + */ +GeeReadOnlyList* gee_read_only_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list) { + GeeReadOnlyList * self = NULL; + GeeList* _tmp0_; + g_return_val_if_fail (list != NULL, NULL); + _tmp0_ = list; + self = (GeeReadOnlyList*) gee_read_only_collection_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, (GeeCollection*) _tmp0_); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + return self; +} + + +GeeReadOnlyList* gee_read_only_list_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list) { + return gee_read_only_list_construct (GEE_TYPE_READ_ONLY_LIST, g_type, g_dup_func, g_destroy_func, list); +} + + +/** + * {@inheritDoc} + */ +static GeeListIterator* gee_read_only_list_real_list_iterator (GeeList* base) { + GeeReadOnlyList * self; + GeeListIterator* result = NULL; + GeeCollection* _tmp0_; + GeeListIterator* _tmp1_ = NULL; + GeeListIterator* _tmp2_; + GeeReadOnlyListIterator* _tmp3_; + GeeListIterator* _tmp4_; + self = (GeeReadOnlyList*) base; + _tmp0_ = ((GeeReadOnlyCollection*) self)->_collection; + _tmp1_ = gee_list_list_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST, GeeList)); + _tmp2_ = _tmp1_; + _tmp3_ = gee_read_only_list_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp2_); + _tmp4_ = (GeeListIterator*) _tmp3_; + _g_object_unref0 (_tmp2_); + result = _tmp4_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gint gee_read_only_list_real_index_of (GeeList* base, gconstpointer item) { + GeeReadOnlyList * self; + gint result = 0; + GeeCollection* _tmp0_; + gconstpointer _tmp1_; + gint _tmp2_ = 0; + self = (GeeReadOnlyList*) base; + _tmp0_ = ((GeeReadOnlyCollection*) self)->_collection; + _tmp1_ = item; + _tmp2_ = gee_list_index_of (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST, GeeList), _tmp1_); + result = _tmp2_; + return result; +} + + +/** + * Unimplemented method (read only list). + */ +static void gee_read_only_list_real_insert (GeeList* base, gint index, gconstpointer item) { + GeeReadOnlyList * self; + self = (GeeReadOnlyList*) base; + g_assert_not_reached (); +} + + +/** + * Unimplemented method (read only list). + */ +static gpointer gee_read_only_list_real_remove_at (GeeList* base, gint index) { + GeeReadOnlyList * self; + gpointer result = NULL; + self = (GeeReadOnlyList*) base; + g_assert_not_reached (); + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_read_only_list_real_get (GeeList* base, gint index) { + GeeReadOnlyList * self; + gpointer result = NULL; + GeeCollection* _tmp0_; + gint _tmp1_; + gpointer _tmp2_ = NULL; + self = (GeeReadOnlyList*) base; + _tmp0_ = ((GeeReadOnlyCollection*) self)->_collection; + _tmp1_ = index; + _tmp2_ = gee_list_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST, GeeList), _tmp1_); + result = _tmp2_; + return result; +} + + +/** + * Unimplemented method (read only list). + */ +static void gee_read_only_list_real_set (GeeList* base, gint index, gconstpointer o) { + GeeReadOnlyList * self; + self = (GeeReadOnlyList*) base; + g_assert_not_reached (); +} + + +/** + * Unimplemented method (read only list). + */ +static GeeList* gee_read_only_list_real_slice (GeeList* base, gint start, gint stop) { + GeeReadOnlyList * self; + GeeList* result = NULL; + self = (GeeReadOnlyList*) base; + g_assert_not_reached (); + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_read_only_list_real_first (GeeList* base) { + GeeReadOnlyList * self; + gpointer result = NULL; + GeeCollection* _tmp0_; + gpointer _tmp1_ = NULL; + self = (GeeReadOnlyList*) base; + _tmp0_ = ((GeeReadOnlyCollection*) self)->_collection; + _tmp1_ = gee_list_first (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST, GeeList)); + result = _tmp1_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_read_only_list_real_last (GeeList* base) { + GeeReadOnlyList * self; + gpointer result = NULL; + GeeCollection* _tmp0_; + gpointer _tmp1_ = NULL; + self = (GeeReadOnlyList*) base; + _tmp0_ = ((GeeReadOnlyCollection*) self)->_collection; + _tmp1_ = gee_list_last (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST, GeeList)); + result = _tmp1_; + return result; +} + + +/** + * Unimplemented method (read only list). + */ +static void gee_read_only_list_real_insert_all (GeeList* base, gint index, GeeCollection* collection) { + GeeReadOnlyList * self; + self = (GeeReadOnlyList*) base; + g_return_if_fail (collection != NULL); + g_assert_not_reached (); +} + + +/** + * {@inheritDoc} + */ +static void gee_read_only_list_real_sort (GeeList* base, GCompareFunc compare) { + GeeReadOnlyList * self; + self = (GeeReadOnlyList*) base; + g_assert_not_reached (); +} + + +GeeList* gee_read_only_list_get_read_only_view (GeeReadOnlyList* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_READ_ONLY_LIST_GET_CLASS (self)->get_read_only_view (self); +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static GeeList* gee_read_only_list_real_get_read_only_view (GeeReadOnlyList* base) { + GeeList* result; + GeeReadOnlyList* self; + GeeList* _tmp0_; + self = base; + _tmp0_ = _g_object_ref0 ((GeeList*) self); + result = _tmp0_; + return result; +} + + +static GeeReadOnlyListIterator* gee_read_only_list_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeListIterator* iterator) { + GeeReadOnlyListIterator * self = NULL; + GeeListIterator* _tmp0_; + g_return_val_if_fail (iterator != NULL, NULL); + _tmp0_ = iterator; + self = (GeeReadOnlyListIterator*) gee_read_only_collection_iterator_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, (GeeIterator*) _tmp0_); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + return self; +} + + +static GeeReadOnlyListIterator* gee_read_only_list_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeListIterator* iterator) { + return gee_read_only_list_iterator_construct (GEE_READ_ONLY_LIST_TYPE_ITERATOR, g_type, g_dup_func, g_destroy_func, iterator); +} + + +static gboolean gee_read_only_list_iterator_real_previous (GeeBidirIterator* base) { + GeeReadOnlyListIterator * self; + gboolean result = FALSE; + GeeIterator* _tmp0_; + gboolean _tmp1_ = FALSE; + self = (GeeReadOnlyListIterator*) base; + _tmp0_ = ((GeeReadOnlyCollectionIterator*) self)->_iter; + _tmp1_ = gee_bidir_iterator_previous ((GeeBidirIterator*) G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST_ITERATOR, GeeListIterator)); + result = _tmp1_; + return result; +} + + +static gboolean gee_read_only_list_iterator_real_has_previous (GeeBidirIterator* base) { + GeeReadOnlyListIterator * self; + gboolean result = FALSE; + GeeIterator* _tmp0_; + gboolean _tmp1_ = FALSE; + self = (GeeReadOnlyListIterator*) base; + _tmp0_ = ((GeeReadOnlyCollectionIterator*) self)->_iter; + _tmp1_ = gee_bidir_iterator_has_previous ((GeeBidirIterator*) G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST_ITERATOR, GeeListIterator)); + result = _tmp1_; + return result; +} + + +static gboolean gee_read_only_list_iterator_real_last (GeeBidirIterator* base) { + GeeReadOnlyListIterator * self; + gboolean result = FALSE; + GeeIterator* _tmp0_; + gboolean _tmp1_ = FALSE; + self = (GeeReadOnlyListIterator*) base; + _tmp0_ = ((GeeReadOnlyCollectionIterator*) self)->_iter; + _tmp1_ = gee_bidir_iterator_last ((GeeBidirIterator*) G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST_ITERATOR, GeeListIterator)); + result = _tmp1_; + return result; +} + + +static void gee_read_only_list_iterator_real_set (GeeListIterator* base, gconstpointer item) { + GeeReadOnlyListIterator * self; + self = (GeeReadOnlyListIterator*) base; + g_assert_not_reached (); +} + + +static void gee_read_only_list_iterator_real_insert (GeeListIterator* base, gconstpointer item) { + GeeReadOnlyListIterator * self; + self = (GeeReadOnlyListIterator*) base; + g_assert_not_reached (); +} + + +static void gee_read_only_list_iterator_real_add (GeeListIterator* base, gconstpointer item) { + GeeReadOnlyListIterator * self; + self = (GeeReadOnlyListIterator*) base; + g_assert_not_reached (); +} + + +static gint gee_read_only_list_iterator_real_index (GeeListIterator* base) { + GeeReadOnlyListIterator * self; + gint result = 0; + GeeIterator* _tmp0_; + gint _tmp1_ = 0; + self = (GeeReadOnlyListIterator*) base; + _tmp0_ = ((GeeReadOnlyCollectionIterator*) self)->_iter; + _tmp1_ = gee_list_iterator_index (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST_ITERATOR, GeeListIterator)); + result = _tmp1_; + return result; +} + + +static void gee_read_only_list_iterator_class_init (GeeReadOnlyListIteratorClass * klass) { + gee_read_only_list_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeReadOnlyListIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_read_only_list_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_read_only_list_iterator_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_LIST_ITERATOR_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_LIST_ITERATOR_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_LIST_ITERATOR_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_read_only_list_iterator_gee_bidir_iterator_interface_init (GeeBidirIteratorIface * iface) { + gee_read_only_list_iterator_gee_bidir_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->previous = (gboolean (*)(GeeBidirIterator*)) gee_read_only_list_iterator_real_previous; + iface->has_previous = (gboolean (*)(GeeBidirIterator*)) gee_read_only_list_iterator_real_has_previous; + iface->last = (gboolean (*)(GeeBidirIterator*)) gee_read_only_list_iterator_real_last; +} + + +static void gee_read_only_list_iterator_gee_list_iterator_interface_init (GeeListIteratorIface * iface) { + gee_read_only_list_iterator_gee_list_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->set = (void (*)(GeeListIterator*, gconstpointer)) gee_read_only_list_iterator_real_set; + iface->insert = (void (*)(GeeListIterator*, gconstpointer)) gee_read_only_list_iterator_real_insert; + iface->add = (void (*)(GeeListIterator*, gconstpointer)) gee_read_only_list_iterator_real_add; + iface->index = (gint (*)(GeeListIterator*)) gee_read_only_list_iterator_real_index; +} + + +static void gee_read_only_list_iterator_instance_init (GeeReadOnlyListIterator * self) { + self->priv = GEE_READ_ONLY_LIST_ITERATOR_GET_PRIVATE (self); +} + + +static GType gee_read_only_list_iterator_get_type (void) { + static volatile gsize gee_read_only_list_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_read_only_list_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeReadOnlyListIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_read_only_list_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeReadOnlyListIterator), 0, (GInstanceInitFunc) gee_read_only_list_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_bidir_iterator_info = { (GInterfaceInitFunc) gee_read_only_list_iterator_gee_bidir_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + static const GInterfaceInfo gee_list_iterator_info = { (GInterfaceInitFunc) gee_read_only_list_iterator_gee_list_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_read_only_list_iterator_type_id; + gee_read_only_list_iterator_type_id = g_type_register_static (GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, "GeeReadOnlyListIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_read_only_list_iterator_type_id, GEE_TYPE_BIDIR_ITERATOR, &gee_bidir_iterator_info); + g_type_add_interface_static (gee_read_only_list_iterator_type_id, GEE_TYPE_LIST_ITERATOR, &gee_list_iterator_info); + g_once_init_leave (&gee_read_only_list_iterator_type_id__volatile, gee_read_only_list_iterator_type_id); + } + return gee_read_only_list_iterator_type_id__volatile; +} + + +static void _vala_gee_read_only_list_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeReadOnlyListIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_READ_ONLY_LIST_TYPE_ITERATOR, GeeReadOnlyListIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_read_only_list_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeReadOnlyListIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_READ_ONLY_LIST_TYPE_ITERATOR, GeeReadOnlyListIterator); + switch (property_id) { + case GEE_READ_ONLY_LIST_ITERATOR_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_READ_ONLY_LIST_ITERATOR_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_READ_ONLY_LIST_ITERATOR_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void gee_read_only_list_class_init (GeeReadOnlyListClass * klass) { + gee_read_only_list_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeReadOnlyListPrivate)); + GEE_READ_ONLY_LIST_CLASS (klass)->get_read_only_view = gee_read_only_list_real_get_read_only_view; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_read_only_list_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_read_only_list_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_LIST_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_LIST_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_LIST_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_LIST_READ_ONLY_VIEW, g_param_spec_object ("read-only-view", "read-only-view", "read-only-view", GEE_TYPE_LIST, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_read_only_list_gee_list_interface_init (GeeListIface * iface) { + gee_read_only_list_gee_list_parent_iface = g_type_interface_peek_parent (iface); + iface->list_iterator = (GeeListIterator* (*)(GeeList*)) gee_read_only_list_real_list_iterator; + iface->index_of = (gint (*)(GeeList*, gconstpointer)) gee_read_only_list_real_index_of; + iface->insert = (void (*)(GeeList*, gint, gconstpointer)) gee_read_only_list_real_insert; + iface->remove_at = (gpointer (*)(GeeList*, gint)) gee_read_only_list_real_remove_at; + iface->get = (gpointer (*)(GeeList*, gint)) gee_read_only_list_real_get; + iface->set = (void (*)(GeeList*, gint, gconstpointer)) gee_read_only_list_real_set; + iface->slice = (GeeList* (*)(GeeList*, gint, gint)) gee_read_only_list_real_slice; + iface->first = (gpointer (*)(GeeList*)) gee_read_only_list_real_first; + iface->last = (gpointer (*)(GeeList*)) gee_read_only_list_real_last; + iface->insert_all = (void (*)(GeeList*, gint, GeeCollection*)) gee_read_only_list_real_insert_all; + iface->sort = (void (*)(GeeList*, GCompareFunc)) gee_read_only_list_real_sort; + iface->get_read_only_view = (GeeList* (*) (GeeList *)) gee_read_only_list_get_read_only_view; +} + + +static void gee_read_only_list_instance_init (GeeReadOnlyList * self) { + self->priv = GEE_READ_ONLY_LIST_GET_PRIVATE (self); +} + + +/** + * Read-only view for {@link List} collections. + * + * This class decorates any class which implements the {@link List} + * interface by making it read only. Any method which normally modify data will + * throw an error. + * + * @see List + */ +GType gee_read_only_list_get_type (void) { + static volatile gsize gee_read_only_list_type_id__volatile = 0; + if (g_once_init_enter (&gee_read_only_list_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeReadOnlyListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_read_only_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeReadOnlyList), 0, (GInstanceInitFunc) gee_read_only_list_instance_init, NULL }; + static const GInterfaceInfo gee_list_info = { (GInterfaceInitFunc) gee_read_only_list_gee_list_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_read_only_list_type_id; + gee_read_only_list_type_id = g_type_register_static (GEE_TYPE_READ_ONLY_COLLECTION, "GeeReadOnlyList", &g_define_type_info, 0); + g_type_add_interface_static (gee_read_only_list_type_id, GEE_TYPE_LIST, &gee_list_info); + g_once_init_leave (&gee_read_only_list_type_id__volatile, gee_read_only_list_type_id); + } + return gee_read_only_list_type_id__volatile; +} + + +static void _vala_gee_read_only_list_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeReadOnlyList * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_READ_ONLY_LIST, GeeReadOnlyList); + switch (property_id) { + case GEE_READ_ONLY_LIST_READ_ONLY_VIEW: + g_value_take_object (value, gee_read_only_list_get_read_only_view (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_read_only_list_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeReadOnlyList * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_READ_ONLY_LIST, GeeReadOnlyList); + switch (property_id) { + case GEE_READ_ONLY_LIST_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_READ_ONLY_LIST_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_READ_ONLY_LIST_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/gee/readonlylist.vala b/gee/readonlylist.vala new file mode 100644 index 0000000..58d5e9a --- /dev/null +++ b/gee/readonlylist.vala @@ -0,0 +1,165 @@ +/* readonlylist.vala + * + * Copyright (C) 2007-2008 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +using GLib; + +/** + * Read-only view for {@link List} collections. + * + * This class decorates any class which implements the {@link List} + * interface by making it read only. Any method which normally modify data will + * throw an error. + * + * @see List + */ +internal class Gee.ReadOnlyList : Gee.ReadOnlyCollection, List { + + /** + * Constructs a read-only list that mirrors the content of the specified + * list. + * + * @param list the list to decorate. + */ + public ReadOnlyList (List list) { + base (list); + } + + /** + * {@inheritDoc} + */ + public ListIterator list_iterator () { + return new Iterator (((Gee.List) _collection).list_iterator ()); + } + + /** + * {@inheritDoc} + */ + public int index_of (G item) { + return ((Gee.List) _collection).index_of (item); + } + + /** + * Unimplemented method (read only list). + */ + public void insert (int index, G item) { + assert_not_reached (); + } + + /** + * Unimplemented method (read only list). + */ + public G remove_at (int index) { + assert_not_reached (); + } + + /** + * {@inheritDoc} + */ + public new G? get (int index) { + return ((Gee.List) _collection).get (index); + } + + /** + * Unimplemented method (read only list). + */ + public new void set (int index, G o) { + assert_not_reached (); + } + + /** + * Unimplemented method (read only list). + */ + public List? slice (int start, int stop) { + assert_not_reached (); + } + + /** + * {@inheritDoc} + */ + public G? first () { + return ((Gee.List) _collection).first (); + } + + /** + * {@inheritDoc} + */ + public G? last () { + return ((Gee.List) _collection).last (); + } + + /** + * Unimplemented method (read only list). + */ + public void insert_all (int index, Collection collection) { + assert_not_reached (); + } + + /** + * {@inheritDoc} + */ + public void sort (CompareFunc? compare = null) { + assert_not_reached (); + } + + /** + * {@inheritDoc} + */ + public virtual new List read_only_view { + owned get { return this; } + } + + + private class Iterator : ReadOnlyCollection.Iterator, BidirIterator, ListIterator { + public Iterator (ListIterator iterator) { + base (iterator); + } + + public bool previous () { + return ((ListIterator) _iter).previous (); + } + + public bool has_previous () { + return ((ListIterator) _iter).has_previous (); + } + + public bool last () { + return ((ListIterator) _iter).last (); + } + + public new void set (G item) { + assert_not_reached (); + } + + public void insert (G item) { + assert_not_reached (); + } + + public void add (G item) { + assert_not_reached (); + } + + public int index () { + return ((ListIterator) _iter).index (); + } + } +} + diff --git a/gee/readonlymap.c b/gee/readonlymap.c new file mode 100644 index 0000000..08ad4b2 --- /dev/null +++ b/gee/readonlymap.c @@ -0,0 +1,1113 @@ +/* readonlymap.c generated by valac 0.18.0, the Vala compiler + * generated from readonlymap.vala, do not modify */ + +/* readonlymap.vala + * + * Copyright (C) 2007-2008 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_MAP (gee_map_get_type ()) +#define GEE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP, GeeMap)) +#define GEE_IS_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP)) +#define GEE_MAP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP, GeeMapIface)) + +typedef struct _GeeMap GeeMap; +typedef struct _GeeMapIface GeeMapIface; + +#define GEE_TYPE_MAP_ITERATOR (gee_map_iterator_get_type ()) +#define GEE_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIterator)) +#define GEE_IS_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP_ITERATOR)) +#define GEE_MAP_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIteratorIface)) + +typedef struct _GeeMapIterator GeeMapIterator; +typedef struct _GeeMapIteratorIface GeeMapIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_MAP_TYPE_ENTRY (gee_map_entry_get_type ()) +#define GEE_MAP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntry)) +#define GEE_MAP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) +#define GEE_MAP_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) + +typedef struct _GeeMapEntry GeeMapEntry; +typedef struct _GeeMapEntryClass GeeMapEntryClass; + +#define GEE_TYPE_READ_ONLY_MAP (gee_read_only_map_get_type ()) +#define GEE_READ_ONLY_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_READ_ONLY_MAP, GeeReadOnlyMap)) +#define GEE_READ_ONLY_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_READ_ONLY_MAP, GeeReadOnlyMapClass)) +#define GEE_IS_READ_ONLY_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_READ_ONLY_MAP)) +#define GEE_IS_READ_ONLY_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_READ_ONLY_MAP)) +#define GEE_READ_ONLY_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_READ_ONLY_MAP, GeeReadOnlyMapClass)) + +typedef struct _GeeReadOnlyMap GeeReadOnlyMap; +typedef struct _GeeReadOnlyMapClass GeeReadOnlyMapClass; +typedef struct _GeeReadOnlyMapPrivate GeeReadOnlyMapPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define GEE_READ_ONLY_MAP_TYPE_MAP_ITERATOR (gee_read_only_map_map_iterator_get_type ()) +#define GEE_READ_ONLY_MAP_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_READ_ONLY_MAP_TYPE_MAP_ITERATOR, GeeReadOnlyMapMapIterator)) +#define GEE_READ_ONLY_MAP_MAP_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_READ_ONLY_MAP_TYPE_MAP_ITERATOR, GeeReadOnlyMapMapIteratorClass)) +#define GEE_READ_ONLY_MAP_IS_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_READ_ONLY_MAP_TYPE_MAP_ITERATOR)) +#define GEE_READ_ONLY_MAP_IS_MAP_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_READ_ONLY_MAP_TYPE_MAP_ITERATOR)) +#define GEE_READ_ONLY_MAP_MAP_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_READ_ONLY_MAP_TYPE_MAP_ITERATOR, GeeReadOnlyMapMapIteratorClass)) + +typedef struct _GeeReadOnlyMapMapIterator GeeReadOnlyMapMapIterator; +typedef struct _GeeReadOnlyMapMapIteratorClass GeeReadOnlyMapMapIteratorClass; +typedef struct _GeeReadOnlyMapMapIteratorPrivate GeeReadOnlyMapMapIteratorPrivate; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeMapIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeMapIterator* self); + gboolean (*has_next) (GeeMapIterator* self); + gboolean (*first) (GeeMapIterator* self); + gpointer (*get_key) (GeeMapIterator* self); + gpointer (*get_value) (GeeMapIterator* self); + void (*set_value) (GeeMapIterator* self, gconstpointer value); + void (*unset) (GeeMapIterator* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeMapIface { + GTypeInterface parent_iface; + gboolean (*has_key) (GeeMap* self, gconstpointer key); + gboolean (*contains) (GeeMap* self, gconstpointer key); + gboolean (*has) (GeeMap* self, gconstpointer key, gconstpointer value); + gpointer (*get) (GeeMap* self, gconstpointer key); + void (*set) (GeeMap* self, gconstpointer key, gconstpointer value); + gboolean (*unset) (GeeMap* self, gconstpointer key, gpointer* value); + gboolean (*remove) (GeeMap* self, gconstpointer key, gpointer* value); + void (*clear) (GeeMap* self); + GeeMapIterator* (*map_iterator) (GeeMap* self); + void (*set_all) (GeeMap* self, GeeMap* map); + gboolean (*unset_all) (GeeMap* self, GeeMap* map); + gboolean (*remove_all) (GeeMap* self, GeeMap* map); + gboolean (*has_all) (GeeMap* self, GeeMap* map); + gboolean (*contains_all) (GeeMap* self, GeeMap* map); + gint (*get_size) (GeeMap* self); + gboolean (*get_is_empty) (GeeMap* self); + GeeSet* (*get_keys) (GeeMap* self); + GeeCollection* (*get_values) (GeeMap* self); + GeeSet* (*get_entries) (GeeMap* self); + GeeMap* (*get_read_only_view) (GeeMap* self); + GType (*get_key_type) (GeeMap* self); + GType (*get_value_type) (GeeMap* self); +}; + +struct _GeeReadOnlyMap { + GObject parent_instance; + GeeReadOnlyMapPrivate * priv; +}; + +struct _GeeReadOnlyMapClass { + GObjectClass parent_class; + GeeMap* (*get_read_only_view) (GeeReadOnlyMap* self); +}; + +struct _GeeReadOnlyMapPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + GeeMap* _map; +}; + +struct _GeeReadOnlyMapMapIterator { + GObject parent_instance; + GeeReadOnlyMapMapIteratorPrivate * priv; + GeeMapIterator* _iter; +}; + +struct _GeeReadOnlyMapMapIteratorClass { + GObjectClass parent_class; +}; + +struct _GeeReadOnlyMapMapIteratorPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; +}; + + +static gpointer gee_read_only_map_parent_class = NULL; +static gpointer gee_read_only_map_map_iterator_parent_class = NULL; +static GeeMapIteratorIface* gee_read_only_map_map_iterator_gee_map_iterator_parent_iface = NULL; +static GeeIterableIface* gee_read_only_map_gee_iterable_parent_iface = NULL; +static GeeMapIface* gee_read_only_map_gee_map_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_map_iterator_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_map_entry_get_type (void) G_GNUC_CONST; +GType gee_map_get_type (void) G_GNUC_CONST; +GType gee_read_only_map_get_type (void) G_GNUC_CONST; +#define GEE_READ_ONLY_MAP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_READ_ONLY_MAP, GeeReadOnlyMapPrivate)) +enum { + GEE_READ_ONLY_MAP_DUMMY_PROPERTY, + GEE_READ_ONLY_MAP_K_TYPE, + GEE_READ_ONLY_MAP_K_DUP_FUNC, + GEE_READ_ONLY_MAP_K_DESTROY_FUNC, + GEE_READ_ONLY_MAP_V_TYPE, + GEE_READ_ONLY_MAP_V_DUP_FUNC, + GEE_READ_ONLY_MAP_V_DESTROY_FUNC, + GEE_READ_ONLY_MAP_SIZE, + GEE_READ_ONLY_MAP_IS_EMPTY, + GEE_READ_ONLY_MAP_KEYS, + GEE_READ_ONLY_MAP_VALUES, + GEE_READ_ONLY_MAP_ENTRIES, + GEE_READ_ONLY_MAP_READ_ONLY_VIEW, + GEE_READ_ONLY_MAP_KEY_TYPE, + GEE_READ_ONLY_MAP_VALUE_TYPE, + GEE_READ_ONLY_MAP_ELEMENT_TYPE +}; +GeeReadOnlyMap* gee_read_only_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeMap* map); +GeeReadOnlyMap* gee_read_only_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeMap* map); +static gboolean gee_read_only_map_real_has_key (GeeMap* base, gconstpointer key); +gboolean gee_map_has_key (GeeMap* self, gconstpointer key); +static gboolean gee_read_only_map_real_contains (GeeMap* base, gconstpointer key); +static gboolean gee_read_only_map_real_has (GeeMap* base, gconstpointer key, gconstpointer value); +gboolean gee_map_has (GeeMap* self, gconstpointer key, gconstpointer value); +static gpointer gee_read_only_map_real_get (GeeMap* base, gconstpointer key); +gpointer gee_map_get (GeeMap* self, gconstpointer key); +static void gee_read_only_map_real_set (GeeMap* base, gconstpointer key, gconstpointer value); +static gboolean gee_read_only_map_real_unset (GeeMap* base, gconstpointer key, gpointer* value); +static gboolean gee_read_only_map_real_remove (GeeMap* base, gconstpointer key, gpointer* value); +static void gee_read_only_map_real_clear (GeeMap* base); +static GeeMapIterator* gee_read_only_map_real_map_iterator (GeeMap* base); +GeeMapIterator* gee_map_map_iterator (GeeMap* self); +GeeReadOnlyMapMapIterator* gee_read_only_map_map_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeMapIterator* iterator); +GeeReadOnlyMapMapIterator* gee_read_only_map_map_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeMapIterator* iterator); +GType gee_read_only_map_map_iterator_get_type (void) G_GNUC_CONST; +static void gee_read_only_map_real_set_all (GeeMap* base, GeeMap* map); +static gboolean gee_read_only_map_real_unset_all (GeeMap* base, GeeMap* map); +static gboolean gee_read_only_map_real_remove_all (GeeMap* base, GeeMap* map); +static gboolean gee_read_only_map_real_has_all (GeeMap* base, GeeMap* map); +gboolean gee_map_has_all (GeeMap* self, GeeMap* map); +static gboolean gee_read_only_map_real_contains_all (GeeMap* base, GeeMap* map); +static GeeIterator* gee_read_only_map_real_iterator (GeeIterable* base); +GeeSet* gee_map_get_entries (GeeMap* self); +GeeIterator* gee_iterable_iterator (GeeIterable* self); +gint gee_map_get_size (GeeMap* self); +gboolean gee_map_get_is_empty (GeeMap* self); +GeeSet* gee_map_get_keys (GeeMap* self); +GeeCollection* gee_map_get_values (GeeMap* self); +GeeMap* gee_read_only_map_get_read_only_view (GeeReadOnlyMap* self); +#define GEE_READ_ONLY_MAP_MAP_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_READ_ONLY_MAP_TYPE_MAP_ITERATOR, GeeReadOnlyMapMapIteratorPrivate)) +enum { + GEE_READ_ONLY_MAP_MAP_ITERATOR_DUMMY_PROPERTY, + GEE_READ_ONLY_MAP_MAP_ITERATOR_K_TYPE, + GEE_READ_ONLY_MAP_MAP_ITERATOR_K_DUP_FUNC, + GEE_READ_ONLY_MAP_MAP_ITERATOR_K_DESTROY_FUNC, + GEE_READ_ONLY_MAP_MAP_ITERATOR_V_TYPE, + GEE_READ_ONLY_MAP_MAP_ITERATOR_V_DUP_FUNC, + GEE_READ_ONLY_MAP_MAP_ITERATOR_V_DESTROY_FUNC +}; +static gboolean gee_read_only_map_map_iterator_real_next (GeeMapIterator* base); +gboolean gee_map_iterator_next (GeeMapIterator* self); +static gboolean gee_read_only_map_map_iterator_real_has_next (GeeMapIterator* base); +gboolean gee_map_iterator_has_next (GeeMapIterator* self); +static gboolean gee_read_only_map_map_iterator_real_first (GeeMapIterator* base); +gboolean gee_map_iterator_first (GeeMapIterator* self); +static gpointer gee_read_only_map_map_iterator_real_get_key (GeeMapIterator* base); +gpointer gee_map_iterator_get_key (GeeMapIterator* self); +static gpointer gee_read_only_map_map_iterator_real_get_value (GeeMapIterator* base); +gpointer gee_map_iterator_get_value (GeeMapIterator* self); +static void gee_read_only_map_map_iterator_real_set_value (GeeMapIterator* base, gconstpointer value); +static void gee_read_only_map_map_iterator_real_unset (GeeMapIterator* base); +static void gee_read_only_map_map_iterator_finalize (GObject* obj); +static void _vala_gee_read_only_map_map_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_read_only_map_map_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void gee_read_only_map_finalize (GObject* obj); +GType gee_map_get_key_type (GeeMap* self); +GType gee_map_get_value_type (GeeMap* self); +GType gee_iterable_get_element_type (GeeIterable* self); +static void _vala_gee_read_only_map_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_read_only_map_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +/** + * Constructs a read-only map that mirrors the content of the specified map. + * + * @param map the map to decorate. + */ +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +GeeReadOnlyMap* gee_read_only_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeMap* map) { + GeeReadOnlyMap * self = NULL; + GeeMap* _tmp0_; + GeeMap* _tmp1_; + g_return_val_if_fail (map != NULL, NULL); + self = (GeeReadOnlyMap*) g_object_new (object_type, NULL); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _tmp0_ = map; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->_map); + self->priv->_map = _tmp1_; + return self; +} + + +GeeReadOnlyMap* gee_read_only_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeMap* map) { + return gee_read_only_map_construct (GEE_TYPE_READ_ONLY_MAP, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, map); +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_read_only_map_real_has_key (GeeMap* base, gconstpointer key) { + GeeReadOnlyMap * self; + gboolean result = FALSE; + GeeMap* _tmp0_; + gconstpointer _tmp1_; + gboolean _tmp2_ = FALSE; + self = (GeeReadOnlyMap*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = key; + _tmp2_ = gee_map_has_key (_tmp0_, _tmp1_); + result = _tmp2_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_read_only_map_real_contains (GeeMap* base, gconstpointer key) { + GeeReadOnlyMap * self; + gboolean result = FALSE; + GeeMap* _tmp0_; + gconstpointer _tmp1_; + gboolean _tmp2_ = FALSE; + self = (GeeReadOnlyMap*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = key; + _tmp2_ = gee_map_has_key (_tmp0_, _tmp1_); + result = _tmp2_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_read_only_map_real_has (GeeMap* base, gconstpointer key, gconstpointer value) { + GeeReadOnlyMap * self; + gboolean result = FALSE; + GeeMap* _tmp0_; + gconstpointer _tmp1_; + gconstpointer _tmp2_; + gboolean _tmp3_ = FALSE; + self = (GeeReadOnlyMap*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = key; + _tmp2_ = value; + _tmp3_ = gee_map_has (_tmp0_, _tmp1_, _tmp2_); + result = _tmp3_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_read_only_map_real_get (GeeMap* base, gconstpointer key) { + GeeReadOnlyMap * self; + gpointer result = NULL; + GeeMap* _tmp0_; + gconstpointer _tmp1_; + gpointer _tmp2_ = NULL; + self = (GeeReadOnlyMap*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = key; + _tmp2_ = gee_map_get (_tmp0_, _tmp1_); + result = _tmp2_; + return result; +} + + +/** + * Unimplemented method (read only map). + */ +static void gee_read_only_map_real_set (GeeMap* base, gconstpointer key, gconstpointer value) { + GeeReadOnlyMap * self; + self = (GeeReadOnlyMap*) base; + g_assert_not_reached (); +} + + +/** + * Unimplemented method (read only map). + */ +static gboolean gee_read_only_map_real_unset (GeeMap* base, gconstpointer key, gpointer* value) { + GeeReadOnlyMap * self; + gpointer _vala_value = NULL; + gboolean result = FALSE; + self = (GeeReadOnlyMap*) base; + g_assert_not_reached (); + if (value) { + *value = _vala_value; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + } + return result; +} + + +/** + * Unimplemented method (read only map). + */ +static gboolean gee_read_only_map_real_remove (GeeMap* base, gconstpointer key, gpointer* value) { + GeeReadOnlyMap * self; + gpointer _vala_value = NULL; + gboolean result = FALSE; + self = (GeeReadOnlyMap*) base; + g_assert_not_reached (); + if (value) { + *value = _vala_value; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + } + return result; +} + + +/** + * Unimplemented method (read only map). + */ +static void gee_read_only_map_real_clear (GeeMap* base) { + GeeReadOnlyMap * self; + self = (GeeReadOnlyMap*) base; + g_assert_not_reached (); +} + + +/** + * {@inheritDoc} + */ +static GeeMapIterator* gee_read_only_map_real_map_iterator (GeeMap* base) { + GeeReadOnlyMap * self; + GeeMapIterator* result = NULL; + GeeMap* _tmp0_; + GeeMapIterator* _tmp1_ = NULL; + GeeMapIterator* _tmp2_; + GeeReadOnlyMapMapIterator* _tmp3_; + GeeMapIterator* _tmp4_; + self = (GeeReadOnlyMap*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_map_map_iterator (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = gee_read_only_map_map_iterator_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, _tmp2_); + _tmp4_ = (GeeMapIterator*) _tmp3_; + _g_object_unref0 (_tmp2_); + result = _tmp4_; + return result; +} + + +/** + * Unimplemented method (read only map). + */ +static void gee_read_only_map_real_set_all (GeeMap* base, GeeMap* map) { + GeeReadOnlyMap * self; + self = (GeeReadOnlyMap*) base; + g_return_if_fail (map != NULL); + g_assert_not_reached (); +} + + +/** + * Unimplemented method (read only map). + */ +static gboolean gee_read_only_map_real_unset_all (GeeMap* base, GeeMap* map) { + GeeReadOnlyMap * self; + gboolean result = FALSE; + self = (GeeReadOnlyMap*) base; + g_return_val_if_fail (map != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +/** + * Unimplemented method (read only map). + */ +static gboolean gee_read_only_map_real_remove_all (GeeMap* base, GeeMap* map) { + GeeReadOnlyMap * self; + gboolean result = FALSE; + self = (GeeReadOnlyMap*) base; + g_return_val_if_fail (map != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_read_only_map_real_has_all (GeeMap* base, GeeMap* map) { + GeeReadOnlyMap * self; + gboolean result = FALSE; + GeeMap* _tmp0_; + GeeMap* _tmp1_; + gboolean _tmp2_ = FALSE; + self = (GeeReadOnlyMap*) base; + g_return_val_if_fail (map != NULL, FALSE); + _tmp0_ = self->priv->_map; + _tmp1_ = map; + _tmp2_ = gee_map_has_all (_tmp0_, _tmp1_); + result = _tmp2_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_read_only_map_real_contains_all (GeeMap* base, GeeMap* map) { + GeeReadOnlyMap * self; + gboolean result = FALSE; + GeeMap* _tmp0_; + GeeMap* _tmp1_; + gboolean _tmp2_ = FALSE; + self = (GeeReadOnlyMap*) base; + g_return_val_if_fail (map != NULL, FALSE); + _tmp0_ = self->priv->_map; + _tmp1_ = map; + _tmp2_ = gee_map_has_all (_tmp0_, _tmp1_); + result = _tmp2_; + return result; +} + + +/** + * {@inheritDoc} + */ +static GeeIterator* gee_read_only_map_real_iterator (GeeIterable* base) { + GeeReadOnlyMap * self; + GeeIterator* result = NULL; + GeeSet* _tmp0_; + GeeSet* _tmp1_; + GeeSet* _tmp2_; + GeeIterator* _tmp3_ = NULL; + GeeIterator* _tmp4_; + self = (GeeReadOnlyMap*) base; + _tmp0_ = gee_map_get_entries ((GeeMap*) self); + _tmp1_ = _tmp0_; + _tmp2_ = _tmp1_; + _tmp3_ = gee_iterable_iterator ((GeeIterable*) _tmp2_); + _tmp4_ = _tmp3_; + _g_object_unref0 (_tmp2_); + result = _tmp4_; + return result; +} + + +static gint gee_read_only_map_real_get_size (GeeMap* base) { + gint result; + GeeReadOnlyMap* self; + GeeMap* _tmp0_; + gint _tmp1_; + gint _tmp2_; + self = (GeeReadOnlyMap*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_map_get_size (_tmp0_); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +static gboolean gee_read_only_map_real_get_is_empty (GeeMap* base) { + gboolean result; + GeeReadOnlyMap* self; + GeeMap* _tmp0_; + gboolean _tmp1_; + gboolean _tmp2_; + self = (GeeReadOnlyMap*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_map_get_is_empty (_tmp0_); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +static GeeSet* gee_read_only_map_real_get_keys (GeeMap* base) { + GeeSet* result; + GeeReadOnlyMap* self; + GeeMap* _tmp0_; + GeeSet* _tmp1_; + GeeSet* _tmp2_; + self = (GeeReadOnlyMap*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_map_get_keys (_tmp0_); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +static GeeCollection* gee_read_only_map_real_get_values (GeeMap* base) { + GeeCollection* result; + GeeReadOnlyMap* self; + GeeMap* _tmp0_; + GeeCollection* _tmp1_; + GeeCollection* _tmp2_; + self = (GeeReadOnlyMap*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_map_get_values (_tmp0_); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +static GeeSet* gee_read_only_map_real_get_entries (GeeMap* base) { + GeeSet* result; + GeeReadOnlyMap* self; + GeeMap* _tmp0_; + GeeSet* _tmp1_; + GeeSet* _tmp2_; + self = (GeeReadOnlyMap*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_map_get_entries (_tmp0_); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +GeeMap* gee_read_only_map_get_read_only_view (GeeReadOnlyMap* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_READ_ONLY_MAP_GET_CLASS (self)->get_read_only_view (self); +} + + +static GeeMap* gee_read_only_map_real_get_read_only_view (GeeReadOnlyMap* base) { + GeeMap* result; + GeeReadOnlyMap* self; + GeeMap* _tmp0_; + self = base; + _tmp0_ = _g_object_ref0 ((GeeMap*) self); + result = _tmp0_; + return result; +} + + +static GType gee_read_only_map_real_get_key_type (GeeMap* base) { + GType result; + GeeReadOnlyMap* self; + self = (GeeReadOnlyMap*) base; + result = self->priv->k_type; + return result; +} + + +static GType gee_read_only_map_real_get_value_type (GeeMap* base) { + GType result; + GeeReadOnlyMap* self; + self = (GeeReadOnlyMap*) base; + result = self->priv->v_type; + return result; +} + + +static GType gee_read_only_map_real_get_element_type (GeeIterable* base) { + GType result; + GeeReadOnlyMap* self; + self = (GeeReadOnlyMap*) base; + result = GEE_MAP_TYPE_ENTRY; + return result; +} + + +GeeReadOnlyMapMapIterator* gee_read_only_map_map_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeMapIterator* iterator) { + GeeReadOnlyMapMapIterator * self = NULL; + GeeMapIterator* _tmp0_; + GeeMapIterator* _tmp1_; + g_return_val_if_fail (iterator != NULL, NULL); + self = (GeeReadOnlyMapMapIterator*) g_object_new (object_type, NULL); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _tmp0_ = iterator; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->_iter); + self->_iter = _tmp1_; + return self; +} + + +GeeReadOnlyMapMapIterator* gee_read_only_map_map_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeMapIterator* iterator) { + return gee_read_only_map_map_iterator_construct (GEE_READ_ONLY_MAP_TYPE_MAP_ITERATOR, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, iterator); +} + + +static gboolean gee_read_only_map_map_iterator_real_next (GeeMapIterator* base) { + GeeReadOnlyMapMapIterator * self; + gboolean result = FALSE; + GeeMapIterator* _tmp0_; + gboolean _tmp1_ = FALSE; + self = (GeeReadOnlyMapMapIterator*) base; + _tmp0_ = self->_iter; + _tmp1_ = gee_map_iterator_next (_tmp0_); + result = _tmp1_; + return result; +} + + +static gboolean gee_read_only_map_map_iterator_real_has_next (GeeMapIterator* base) { + GeeReadOnlyMapMapIterator * self; + gboolean result = FALSE; + GeeMapIterator* _tmp0_; + gboolean _tmp1_ = FALSE; + self = (GeeReadOnlyMapMapIterator*) base; + _tmp0_ = self->_iter; + _tmp1_ = gee_map_iterator_has_next (_tmp0_); + result = _tmp1_; + return result; +} + + +static gboolean gee_read_only_map_map_iterator_real_first (GeeMapIterator* base) { + GeeReadOnlyMapMapIterator * self; + gboolean result = FALSE; + GeeMapIterator* _tmp0_; + gboolean _tmp1_ = FALSE; + self = (GeeReadOnlyMapMapIterator*) base; + _tmp0_ = self->_iter; + _tmp1_ = gee_map_iterator_first (_tmp0_); + result = _tmp1_; + return result; +} + + +static gpointer gee_read_only_map_map_iterator_real_get_key (GeeMapIterator* base) { + GeeReadOnlyMapMapIterator * self; + gpointer result = NULL; + GeeMapIterator* _tmp0_; + gpointer _tmp1_ = NULL; + self = (GeeReadOnlyMapMapIterator*) base; + _tmp0_ = self->_iter; + _tmp1_ = gee_map_iterator_get_key (_tmp0_); + result = _tmp1_; + return result; +} + + +static gpointer gee_read_only_map_map_iterator_real_get_value (GeeMapIterator* base) { + GeeReadOnlyMapMapIterator * self; + gpointer result = NULL; + GeeMapIterator* _tmp0_; + gpointer _tmp1_ = NULL; + self = (GeeReadOnlyMapMapIterator*) base; + _tmp0_ = self->_iter; + _tmp1_ = gee_map_iterator_get_value (_tmp0_); + result = _tmp1_; + return result; +} + + +static void gee_read_only_map_map_iterator_real_set_value (GeeMapIterator* base, gconstpointer value) { + GeeReadOnlyMapMapIterator * self; + self = (GeeReadOnlyMapMapIterator*) base; + g_assert_not_reached (); +} + + +static void gee_read_only_map_map_iterator_real_unset (GeeMapIterator* base) { + GeeReadOnlyMapMapIterator * self; + self = (GeeReadOnlyMapMapIterator*) base; + g_assert_not_reached (); +} + + +static void gee_read_only_map_map_iterator_class_init (GeeReadOnlyMapMapIteratorClass * klass) { + gee_read_only_map_map_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeReadOnlyMapMapIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_read_only_map_map_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_read_only_map_map_iterator_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_read_only_map_map_iterator_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_MAP_ITERATOR_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_MAP_ITERATOR_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_MAP_ITERATOR_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_MAP_ITERATOR_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_MAP_ITERATOR_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_MAP_ITERATOR_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_read_only_map_map_iterator_gee_map_iterator_interface_init (GeeMapIteratorIface * iface) { + gee_read_only_map_map_iterator_gee_map_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->next = (gboolean (*)(GeeMapIterator*)) gee_read_only_map_map_iterator_real_next; + iface->has_next = (gboolean (*)(GeeMapIterator*)) gee_read_only_map_map_iterator_real_has_next; + iface->first = (gboolean (*)(GeeMapIterator*)) gee_read_only_map_map_iterator_real_first; + iface->get_key = (gpointer (*)(GeeMapIterator*)) gee_read_only_map_map_iterator_real_get_key; + iface->get_value = (gpointer (*)(GeeMapIterator*)) gee_read_only_map_map_iterator_real_get_value; + iface->set_value = (void (*)(GeeMapIterator*, gconstpointer)) gee_read_only_map_map_iterator_real_set_value; + iface->unset = (void (*)(GeeMapIterator*)) gee_read_only_map_map_iterator_real_unset; +} + + +static void gee_read_only_map_map_iterator_instance_init (GeeReadOnlyMapMapIterator * self) { + self->priv = GEE_READ_ONLY_MAP_MAP_ITERATOR_GET_PRIVATE (self); +} + + +static void gee_read_only_map_map_iterator_finalize (GObject* obj) { + GeeReadOnlyMapMapIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_READ_ONLY_MAP_TYPE_MAP_ITERATOR, GeeReadOnlyMapMapIterator); + _g_object_unref0 (self->_iter); + G_OBJECT_CLASS (gee_read_only_map_map_iterator_parent_class)->finalize (obj); +} + + +GType gee_read_only_map_map_iterator_get_type (void) { + static volatile gsize gee_read_only_map_map_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_read_only_map_map_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeReadOnlyMapMapIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_read_only_map_map_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeReadOnlyMapMapIterator), 0, (GInstanceInitFunc) gee_read_only_map_map_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_map_iterator_info = { (GInterfaceInitFunc) gee_read_only_map_map_iterator_gee_map_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_read_only_map_map_iterator_type_id; + gee_read_only_map_map_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeReadOnlyMapMapIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_read_only_map_map_iterator_type_id, GEE_TYPE_MAP_ITERATOR, &gee_map_iterator_info); + g_once_init_leave (&gee_read_only_map_map_iterator_type_id__volatile, gee_read_only_map_map_iterator_type_id); + } + return gee_read_only_map_map_iterator_type_id__volatile; +} + + +static void _vala_gee_read_only_map_map_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeReadOnlyMapMapIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_READ_ONLY_MAP_TYPE_MAP_ITERATOR, GeeReadOnlyMapMapIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_read_only_map_map_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeReadOnlyMapMapIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_READ_ONLY_MAP_TYPE_MAP_ITERATOR, GeeReadOnlyMapMapIterator); + switch (property_id) { + case GEE_READ_ONLY_MAP_MAP_ITERATOR_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_READ_ONLY_MAP_MAP_ITERATOR_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_READ_ONLY_MAP_MAP_ITERATOR_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_READ_ONLY_MAP_MAP_ITERATOR_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_READ_ONLY_MAP_MAP_ITERATOR_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_READ_ONLY_MAP_MAP_ITERATOR_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void gee_read_only_map_class_init (GeeReadOnlyMapClass * klass) { + gee_read_only_map_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeReadOnlyMapPrivate)); + GEE_READ_ONLY_MAP_CLASS (klass)->get_read_only_view = gee_read_only_map_real_get_read_only_view; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_read_only_map_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_read_only_map_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_read_only_map_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_IS_EMPTY, g_param_spec_boolean ("is-empty", "is-empty", "is-empty", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_KEYS, g_param_spec_object ("keys", "keys", "keys", GEE_TYPE_SET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_VALUES, g_param_spec_object ("values", "values", "values", GEE_TYPE_COLLECTION, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_ENTRIES, g_param_spec_object ("entries", "entries", "entries", GEE_TYPE_SET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_READ_ONLY_VIEW, g_param_spec_object ("read-only-view", "read-only-view", "read-only-view", GEE_TYPE_MAP, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_KEY_TYPE, g_param_spec_gtype ("key-type", "key-type", "key-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_VALUE_TYPE, g_param_spec_gtype ("value-type", "value-type", "value-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_MAP_ELEMENT_TYPE, g_param_spec_gtype ("element-type", "element-type", "element-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_read_only_map_gee_iterable_interface_init (GeeIterableIface * iface) { + gee_read_only_map_gee_iterable_parent_iface = g_type_interface_peek_parent (iface); + iface->iterator = (GeeIterator* (*)(GeeIterable*)) gee_read_only_map_real_iterator; + iface->get_element_type = gee_read_only_map_real_get_element_type; +} + + +static void gee_read_only_map_gee_map_interface_init (GeeMapIface * iface) { + gee_read_only_map_gee_map_parent_iface = g_type_interface_peek_parent (iface); + iface->has_key = (gboolean (*)(GeeMap*, gconstpointer)) gee_read_only_map_real_has_key; + iface->contains = (gboolean (*)(GeeMap*, gconstpointer)) gee_read_only_map_real_contains; + iface->has = (gboolean (*)(GeeMap*, gconstpointer, gconstpointer)) gee_read_only_map_real_has; + iface->get = (gpointer (*)(GeeMap*, gconstpointer)) gee_read_only_map_real_get; + iface->set = (void (*)(GeeMap*, gconstpointer, gconstpointer)) gee_read_only_map_real_set; + iface->unset = (gboolean (*)(GeeMap*, gconstpointer, gpointer*)) gee_read_only_map_real_unset; + iface->remove = (gboolean (*)(GeeMap*, gconstpointer, gpointer*)) gee_read_only_map_real_remove; + iface->clear = (void (*)(GeeMap*)) gee_read_only_map_real_clear; + iface->map_iterator = (GeeMapIterator* (*)(GeeMap*)) gee_read_only_map_real_map_iterator; + iface->set_all = (void (*)(GeeMap*, GeeMap*)) gee_read_only_map_real_set_all; + iface->unset_all = (gboolean (*)(GeeMap*, GeeMap*)) gee_read_only_map_real_unset_all; + iface->remove_all = (gboolean (*)(GeeMap*, GeeMap*)) gee_read_only_map_real_remove_all; + iface->has_all = (gboolean (*)(GeeMap*, GeeMap*)) gee_read_only_map_real_has_all; + iface->contains_all = (gboolean (*)(GeeMap*, GeeMap*)) gee_read_only_map_real_contains_all; + iface->get_size = gee_read_only_map_real_get_size; + iface->get_is_empty = gee_read_only_map_real_get_is_empty; + iface->get_keys = gee_read_only_map_real_get_keys; + iface->get_values = gee_read_only_map_real_get_values; + iface->get_entries = gee_read_only_map_real_get_entries; + iface->get_read_only_view = (GeeMap* (*) (GeeMap *)) gee_read_only_map_get_read_only_view; + iface->get_key_type = gee_read_only_map_real_get_key_type; + iface->get_value_type = gee_read_only_map_real_get_value_type; +} + + +static void gee_read_only_map_instance_init (GeeReadOnlyMap * self) { + self->priv = GEE_READ_ONLY_MAP_GET_PRIVATE (self); +} + + +static void gee_read_only_map_finalize (GObject* obj) { + GeeReadOnlyMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_READ_ONLY_MAP, GeeReadOnlyMap); + _g_object_unref0 (self->priv->_map); + G_OBJECT_CLASS (gee_read_only_map_parent_class)->finalize (obj); +} + + +/** + * Read-only view for {@link Map} collections. + * + * This class decorates any class which implements the {@link Map} interface + * by making it read only. Any method which normally modify data will throw an + * error. + * + * @see Map + */ +GType gee_read_only_map_get_type (void) { + static volatile gsize gee_read_only_map_type_id__volatile = 0; + if (g_once_init_enter (&gee_read_only_map_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeReadOnlyMapClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_read_only_map_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeReadOnlyMap), 0, (GInstanceInitFunc) gee_read_only_map_instance_init, NULL }; + static const GInterfaceInfo gee_iterable_info = { (GInterfaceInitFunc) gee_read_only_map_gee_iterable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + static const GInterfaceInfo gee_map_info = { (GInterfaceInitFunc) gee_read_only_map_gee_map_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_read_only_map_type_id; + gee_read_only_map_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeReadOnlyMap", &g_define_type_info, 0); + g_type_add_interface_static (gee_read_only_map_type_id, GEE_TYPE_ITERABLE, &gee_iterable_info); + g_type_add_interface_static (gee_read_only_map_type_id, GEE_TYPE_MAP, &gee_map_info); + g_once_init_leave (&gee_read_only_map_type_id__volatile, gee_read_only_map_type_id); + } + return gee_read_only_map_type_id__volatile; +} + + +static void _vala_gee_read_only_map_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeReadOnlyMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_READ_ONLY_MAP, GeeReadOnlyMap); + switch (property_id) { + case GEE_READ_ONLY_MAP_SIZE: + g_value_set_int (value, gee_map_get_size ((GeeMap*) self)); + break; + case GEE_READ_ONLY_MAP_IS_EMPTY: + g_value_set_boolean (value, gee_map_get_is_empty ((GeeMap*) self)); + break; + case GEE_READ_ONLY_MAP_KEYS: + g_value_take_object (value, gee_map_get_keys ((GeeMap*) self)); + break; + case GEE_READ_ONLY_MAP_VALUES: + g_value_take_object (value, gee_map_get_values ((GeeMap*) self)); + break; + case GEE_READ_ONLY_MAP_ENTRIES: + g_value_take_object (value, gee_map_get_entries ((GeeMap*) self)); + break; + case GEE_READ_ONLY_MAP_READ_ONLY_VIEW: + g_value_take_object (value, gee_read_only_map_get_read_only_view (self)); + break; + case GEE_READ_ONLY_MAP_KEY_TYPE: + g_value_set_gtype (value, gee_map_get_key_type ((GeeMap*) self)); + break; + case GEE_READ_ONLY_MAP_VALUE_TYPE: + g_value_set_gtype (value, gee_map_get_value_type ((GeeMap*) self)); + break; + case GEE_READ_ONLY_MAP_ELEMENT_TYPE: + g_value_set_gtype (value, gee_iterable_get_element_type ((GeeIterable*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_read_only_map_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeReadOnlyMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_READ_ONLY_MAP, GeeReadOnlyMap); + switch (property_id) { + case GEE_READ_ONLY_MAP_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_READ_ONLY_MAP_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_READ_ONLY_MAP_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_READ_ONLY_MAP_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_READ_ONLY_MAP_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_READ_ONLY_MAP_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/gee/readonlymap.vala b/gee/readonlymap.vala new file mode 100644 index 0000000..87b0ffc --- /dev/null +++ b/gee/readonlymap.vala @@ -0,0 +1,254 @@ +/* readonlymap.vala + * + * Copyright (C) 2007-2008 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +using GLib; + +/** + * Read-only view for {@link Map} collections. + * + * This class decorates any class which implements the {@link Map} interface + * by making it read only. Any method which normally modify data will throw an + * error. + * + * @see Map + */ +internal class Gee.ReadOnlyMap : Object, Iterable>, Map { + + /** + * {@inheritDoc} + */ + public int size { + get { return _map.size; } + } + + /** + * {@inheritDoc} + */ + public bool is_empty { + get { return _map.is_empty; } + } + + /** + * {@inheritDoc} + */ + public Set keys { + owned get { + return _map.keys; + } + } + + /** + * {@inheritDoc} + */ + public Collection values { + owned get { + return _map.values; + } + } + + /** + * {@inheritDoc} + */ + public Set> entries { + owned get { + return _map.entries; + } + } + + private Map _map; + + /** + * Constructs a read-only map that mirrors the content of the specified map. + * + * @param map the map to decorate. + */ + public ReadOnlyMap (Map map) { + this._map = map; + } + + /** + * {@inheritDoc} + */ + public bool has_key (K key) { + return _map.has_key (key); + } + + /** + * {@inheritDoc} + */ + public bool contains (K key) { + return _map.has_key (key); + } + + /** + * {@inheritDoc} + */ + public bool has (K key, V value) { + return _map.has (key, value); + } + + /** + * {@inheritDoc} + */ + public new V? get (K key) { + return _map.get (key); + } + + /** + * Unimplemented method (read only map). + */ + public new void set (K key, V value) { + assert_not_reached (); + } + + /** + * Unimplemented method (read only map). + */ + public bool unset (K key, out V? value = null) { + assert_not_reached (); + } + + /** + * Unimplemented method (read only map). + */ + public bool remove (K key, out V? value = null) { + assert_not_reached (); + } + + /** + * Unimplemented method (read only map). + */ + public void clear () { + assert_not_reached (); + } + + /** + * {@inheritDoc} + */ + public Gee.MapIterator map_iterator () { + return new MapIterator (_map.map_iterator ()); + } + + /** + * Unimplemented method (read only map). + */ + public void set_all (Map map) { + assert_not_reached (); + } + + /** + * Unimplemented method (read only map). + */ + public bool unset_all (Map map) { + assert_not_reached (); + } + + /** + * Unimplemented method (read only map). + */ + public bool remove_all (Map map) { + assert_not_reached (); + } + + /** + * {@inheritDoc} + */ + public bool has_all (Map map) { + return _map.has_all (map); + } + + /** + * {@inheritDoc} + */ + public bool contains_all (Map map) { + return _map.has_all (map); + } + + public virtual Map read_only_view { + owned get { return this; } + } + + /** + * {@inheritDoc} + */ + public Type key_type { + get { return typeof (K); } + } + + /** + * {@inheritDoc} + */ + public Type value_type { + get { return typeof (V); } + } + + /** + * {@inheritDoc} + */ + public Type element_type { + get { return typeof (Map.Entry); } + } + + /** + * {@inheritDoc} + */ + public Iterator> iterator () { + return entries.iterator (); + } + + protected class MapIterator : Object, Gee.MapIterator { + protected Gee.MapIterator _iter; + + public MapIterator (Gee.MapIterator iterator) { + _iter = iterator; + } + + public bool next () { + return _iter.next (); + } + + public bool has_next () { + return _iter.has_next (); + } + + public bool first () { + return _iter.first (); + } + + public K get_key () { + return _iter.get_key (); + } + + public V get_value () { + return _iter.get_value (); + } + + public void set_value (V value) { + assert_not_reached (); + } + + public void unset () { + assert_not_reached (); + } + } +} + diff --git a/gee/readonlyset.c b/gee/readonlyset.c new file mode 100644 index 0000000..e6ab12a --- /dev/null +++ b/gee/readonlyset.c @@ -0,0 +1,300 @@ +/* readonlyset.c generated by valac 0.18.0, the Vala compiler + * generated from readonlyset.vala, do not modify */ + +/* readonlyset.vala + * + * Copyright (C) 2007-2008 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_READ_ONLY_COLLECTION (gee_read_only_collection_get_type ()) +#define GEE_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollection)) +#define GEE_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass)) +#define GEE_IS_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_READ_ONLY_COLLECTION)) +#define GEE_IS_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_READ_ONLY_COLLECTION)) +#define GEE_READ_ONLY_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass)) + +typedef struct _GeeReadOnlyCollection GeeReadOnlyCollection; +typedef struct _GeeReadOnlyCollectionClass GeeReadOnlyCollectionClass; +typedef struct _GeeReadOnlyCollectionPrivate GeeReadOnlyCollectionPrivate; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_TYPE_READ_ONLY_SET (gee_read_only_set_get_type ()) +#define GEE_READ_ONLY_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_READ_ONLY_SET, GeeReadOnlySet)) +#define GEE_READ_ONLY_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_READ_ONLY_SET, GeeReadOnlySetClass)) +#define GEE_IS_READ_ONLY_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_READ_ONLY_SET)) +#define GEE_IS_READ_ONLY_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_READ_ONLY_SET)) +#define GEE_READ_ONLY_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_READ_ONLY_SET, GeeReadOnlySetClass)) + +typedef struct _GeeReadOnlySet GeeReadOnlySet; +typedef struct _GeeReadOnlySetClass GeeReadOnlySetClass; +typedef struct _GeeReadOnlySetPrivate GeeReadOnlySetPrivate; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeReadOnlyCollection { + GObject parent_instance; + GeeReadOnlyCollectionPrivate * priv; + GeeCollection* _collection; +}; + +struct _GeeReadOnlyCollectionClass { + GObjectClass parent_class; + GeeCollection* (*get_read_only_view) (GeeReadOnlyCollection* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeReadOnlySet { + GeeReadOnlyCollection parent_instance; + GeeReadOnlySetPrivate * priv; +}; + +struct _GeeReadOnlySetClass { + GeeReadOnlyCollectionClass parent_class; + GeeSet* (*get_read_only_view) (GeeReadOnlySet* self); +}; + +struct _GeeReadOnlySetPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; +}; + + +static gpointer gee_read_only_set_parent_class = NULL; +static GeeSetIface* gee_read_only_set_gee_set_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_read_only_collection_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_read_only_set_get_type (void) G_GNUC_CONST; +#define GEE_READ_ONLY_SET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_READ_ONLY_SET, GeeReadOnlySetPrivate)) +enum { + GEE_READ_ONLY_SET_DUMMY_PROPERTY, + GEE_READ_ONLY_SET_G_TYPE, + GEE_READ_ONLY_SET_G_DUP_FUNC, + GEE_READ_ONLY_SET_G_DESTROY_FUNC, + GEE_READ_ONLY_SET_READ_ONLY_VIEW +}; +GeeReadOnlySet* gee_read_only_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeSet* set); +GeeReadOnlySet* gee_read_only_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeSet* set); +GeeReadOnlyCollection* gee_read_only_collection_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection); +GeeReadOnlyCollection* gee_read_only_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection); +GeeSet* gee_read_only_set_get_read_only_view (GeeReadOnlySet* self); +static void _vala_gee_read_only_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_read_only_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +/** + * Constructs a read-only set that mirrors the content of the specified set. + * + * @param set the set to decorate. + */ +GeeReadOnlySet* gee_read_only_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeSet* set) { + GeeReadOnlySet * self = NULL; + GeeSet* _tmp0_; + g_return_val_if_fail (set != NULL, NULL); + _tmp0_ = set; + self = (GeeReadOnlySet*) gee_read_only_collection_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, (GeeCollection*) _tmp0_); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + return self; +} + + +GeeReadOnlySet* gee_read_only_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeSet* set) { + return gee_read_only_set_construct (GEE_TYPE_READ_ONLY_SET, g_type, g_dup_func, g_destroy_func, set); +} + + +GeeSet* gee_read_only_set_get_read_only_view (GeeReadOnlySet* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_READ_ONLY_SET_GET_CLASS (self)->get_read_only_view (self); +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static GeeSet* gee_read_only_set_real_get_read_only_view (GeeReadOnlySet* base) { + GeeSet* result; + GeeReadOnlySet* self; + GeeSet* _tmp0_; + self = base; + _tmp0_ = _g_object_ref0 ((GeeSet*) self); + result = _tmp0_; + return result; +} + + +static void gee_read_only_set_class_init (GeeReadOnlySetClass * klass) { + gee_read_only_set_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeReadOnlySetPrivate)); + GEE_READ_ONLY_SET_CLASS (klass)->get_read_only_view = gee_read_only_set_real_get_read_only_view; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_read_only_set_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_read_only_set_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_SET_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_SET_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_SET_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_SET_READ_ONLY_VIEW, g_param_spec_object ("read-only-view", "read-only-view", "read-only-view", GEE_TYPE_SET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_read_only_set_gee_set_interface_init (GeeSetIface * iface) { + gee_read_only_set_gee_set_parent_iface = g_type_interface_peek_parent (iface); + iface->get_read_only_view = (GeeSet* (*) (GeeSet *)) gee_read_only_set_get_read_only_view; +} + + +static void gee_read_only_set_instance_init (GeeReadOnlySet * self) { + self->priv = GEE_READ_ONLY_SET_GET_PRIVATE (self); +} + + +/** + * Read-only view for {@link Set} collections. + * + * This class decorates any class which implements the {@link Set} interface + * by making it read only. Any method which normally modify data will throw an + * error. + * + * @see Set + */ +GType gee_read_only_set_get_type (void) { + static volatile gsize gee_read_only_set_type_id__volatile = 0; + if (g_once_init_enter (&gee_read_only_set_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeReadOnlySetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_read_only_set_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeReadOnlySet), 0, (GInstanceInitFunc) gee_read_only_set_instance_init, NULL }; + static const GInterfaceInfo gee_set_info = { (GInterfaceInitFunc) gee_read_only_set_gee_set_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_read_only_set_type_id; + gee_read_only_set_type_id = g_type_register_static (GEE_TYPE_READ_ONLY_COLLECTION, "GeeReadOnlySet", &g_define_type_info, 0); + g_type_add_interface_static (gee_read_only_set_type_id, GEE_TYPE_SET, &gee_set_info); + g_once_init_leave (&gee_read_only_set_type_id__volatile, gee_read_only_set_type_id); + } + return gee_read_only_set_type_id__volatile; +} + + +static void _vala_gee_read_only_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeReadOnlySet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_READ_ONLY_SET, GeeReadOnlySet); + switch (property_id) { + case GEE_READ_ONLY_SET_READ_ONLY_VIEW: + g_value_take_object (value, gee_read_only_set_get_read_only_view (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_read_only_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeReadOnlySet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_READ_ONLY_SET, GeeReadOnlySet); + switch (property_id) { + case GEE_READ_ONLY_SET_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_READ_ONLY_SET_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_READ_ONLY_SET_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/gee/readonlyset.vala b/gee/readonlyset.vala new file mode 100644 index 0000000..8988e6f --- /dev/null +++ b/gee/readonlyset.vala @@ -0,0 +1,50 @@ +/* readonlyset.vala + * + * Copyright (C) 2007-2008 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +using GLib; + +/** + * Read-only view for {@link Set} collections. + * + * This class decorates any class which implements the {@link Set} interface + * by making it read only. Any method which normally modify data will throw an + * error. + * + * @see Set + */ +internal class Gee.ReadOnlySet : Gee.ReadOnlyCollection, Set { + + /** + * Constructs a read-only set that mirrors the content of the specified set. + * + * @param set the set to decorate. + */ + public ReadOnlySet (Set set) { + base (set); + } + + public virtual new Set read_only_view { + owned get { return this; } + } + +} + diff --git a/gee/set.c b/gee/set.c new file mode 100644 index 0000000..266eb33 --- /dev/null +++ b/gee/set.c @@ -0,0 +1,202 @@ +/* set.c generated by valac 0.18.0, the Vala compiler + * generated from set.vala, do not modify */ + +/* set.vala + * + * Copyright (C) 2007 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; + +#define GEE_TYPE_ABSTRACT_SET (gee_abstract_set_get_type ()) +#define GEE_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSet)) +#define GEE_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) +#define GEE_IS_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_SET)) +#define GEE_IS_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_SET)) +#define GEE_ABSTRACT_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) + +typedef struct _GeeAbstractSet GeeAbstractSet; +typedef struct _GeeAbstractSetClass GeeAbstractSetClass; + +#define GEE_TYPE_HASH_SET (gee_hash_set_get_type ()) +#define GEE_HASH_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_HASH_SET, GeeHashSet)) +#define GEE_HASH_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_HASH_SET, GeeHashSetClass)) +#define GEE_IS_HASH_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_HASH_SET)) +#define GEE_IS_HASH_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_HASH_SET)) +#define GEE_HASH_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_HASH_SET, GeeHashSetClass)) + +typedef struct _GeeHashSet GeeHashSet; +typedef struct _GeeHashSetClass GeeHashSetClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + + + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GeeSet* gee_set_empty (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeHashSet* gee_hash_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func); +GeeHashSet* gee_hash_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GHashFunc hash_func, GEqualFunc equal_func); +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_set_get_type (void) G_GNUC_CONST; +GType gee_hash_set_get_type (void) G_GNUC_CONST; +GeeSet* gee_abstract_set_get_read_only_view (GeeAbstractSet* self); +GeeSet* gee_set_get_read_only_view (GeeSet* self); + + +/** + * Returns an immutable empty set. + * + * @return an immutable empty set + */ +GeeSet* gee_set_empty (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) { + GeeSet* result = NULL; + GeeHashSet* _tmp0_; + GeeHashSet* _tmp1_; + GeeSet* _tmp2_; + GeeSet* _tmp3_; + GeeSet* _tmp4_; + _tmp0_ = gee_hash_set_new (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, NULL, NULL); + _tmp1_ = _tmp0_; + _tmp2_ = gee_abstract_set_get_read_only_view ((GeeAbstractSet*) _tmp1_); + _tmp3_ = _tmp2_; + _tmp4_ = _tmp3_; + _g_object_unref0 (_tmp1_); + result = _tmp4_; + return result; +} + + +GeeSet* gee_set_get_read_only_view (GeeSet* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_SET_GET_INTERFACE (self)->get_read_only_view (self); +} + + +static void gee_set_base_init (GeeSetIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + /** + * The read-only view of this set. + */ + g_object_interface_install_property (iface, g_param_spec_object ("read-only-view", "read-only-view", "read-only-view", GEE_TYPE_SET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + } +} + + +/** + * A collection without duplicate elements. + */ +GType gee_set_get_type (void) { + static volatile gsize gee_set_type_id__volatile = 0; + if (g_once_init_enter (&gee_set_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeSetIface), (GBaseInitFunc) gee_set_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_set_type_id; + gee_set_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeSet", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_set_type_id, GEE_TYPE_COLLECTION); + g_once_init_leave (&gee_set_type_id__volatile, gee_set_type_id); + } + return gee_set_type_id__volatile; +} + + + diff --git a/gee/set.vala b/gee/set.vala new file mode 100644 index 0000000..eec4175 --- /dev/null +++ b/gee/set.vala @@ -0,0 +1,42 @@ +/* set.vala + * + * Copyright (C) 2007 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + */ + +/** + * A collection without duplicate elements. + */ +public interface Gee.Set : Collection { + + /** + * The read-only view of this set. + */ + public abstract new Set read_only_view { owned get; } + + /** + * Returns an immutable empty set. + * + * @return an immutable empty set + */ + public static Set empty () { + return new HashSet ().read_only_view; + } +} + diff --git a/gee/sortedset.c b/gee/sortedset.c new file mode 100644 index 0000000..92e0bc0 --- /dev/null +++ b/gee/sortedset.c @@ -0,0 +1,328 @@ +/* sortedset.c generated by valac 0.18.0, the Vala compiler + * generated from sortedset.vala, do not modify */ + +/* sortedset.vala + * + * Copyright (C) 2009 Didier Villevalois, Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Maciej Piechotka + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_TYPE_SORTED_SET (gee_sorted_set_get_type ()) +#define GEE_SORTED_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SORTED_SET, GeeSortedSet)) +#define GEE_IS_SORTED_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SORTED_SET)) +#define GEE_SORTED_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SORTED_SET, GeeSortedSetIface)) + +typedef struct _GeeSortedSet GeeSortedSet; +typedef struct _GeeSortedSetIface GeeSortedSetIface; + +#define GEE_TYPE_BIDIR_ITERATOR (gee_bidir_iterator_get_type ()) +#define GEE_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIterator)) +#define GEE_IS_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_ITERATOR)) +#define GEE_BIDIR_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIteratorIface)) + +typedef struct _GeeBidirIterator GeeBidirIterator; +typedef struct _GeeBidirIteratorIface GeeBidirIteratorIface; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeBidirIteratorIface { + GTypeInterface parent_iface; + gboolean (*previous) (GeeBidirIterator* self); + gboolean (*has_previous) (GeeBidirIterator* self); + gboolean (*last) (GeeBidirIterator* self); +}; + +struct _GeeSortedSetIface { + GTypeInterface parent_iface; + gpointer (*first) (GeeSortedSet* self); + gpointer (*last) (GeeSortedSet* self); + GeeBidirIterator* (*bidir_iterator) (GeeSortedSet* self); + GeeBidirIterator* (*iterator_at) (GeeSortedSet* self, gconstpointer element); + gpointer (*lower) (GeeSortedSet* self, gconstpointer element); + gpointer (*higher) (GeeSortedSet* self, gconstpointer element); + gpointer (*floor) (GeeSortedSet* self, gconstpointer element); + gpointer (*ceil) (GeeSortedSet* self, gconstpointer element); + GeeSortedSet* (*head_set) (GeeSortedSet* self, gconstpointer before); + GeeSortedSet* (*tail_set) (GeeSortedSet* self, gconstpointer after); + GeeSortedSet* (*sub_set) (GeeSortedSet* self, gconstpointer from, gconstpointer to); +}; + + + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_bidir_iterator_get_type (void) G_GNUC_CONST; +GType gee_sorted_set_get_type (void) G_GNUC_CONST; +gpointer gee_sorted_set_first (GeeSortedSet* self); +gpointer gee_sorted_set_last (GeeSortedSet* self); +GeeBidirIterator* gee_sorted_set_bidir_iterator (GeeSortedSet* self); +GeeBidirIterator* gee_sorted_set_iterator_at (GeeSortedSet* self, gconstpointer element); +gpointer gee_sorted_set_lower (GeeSortedSet* self, gconstpointer element); +gpointer gee_sorted_set_higher (GeeSortedSet* self, gconstpointer element); +gpointer gee_sorted_set_floor (GeeSortedSet* self, gconstpointer element); +gpointer gee_sorted_set_ceil (GeeSortedSet* self, gconstpointer element); +GeeSortedSet* gee_sorted_set_head_set (GeeSortedSet* self, gconstpointer before); +GeeSortedSet* gee_sorted_set_tail_set (GeeSortedSet* self, gconstpointer after); +GeeSortedSet* gee_sorted_set_sub_set (GeeSortedSet* self, gconstpointer from, gconstpointer to); + + +/** + * Returns the first element of the sorted set. Set must not be empty. + * + * @return the first element in the sorted set + */ +gpointer gee_sorted_set_first (GeeSortedSet* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_SORTED_SET_GET_INTERFACE (self)->first (self); +} + + +/** + * Returns the last element of the sorted set. Set must not be empty. + * + * @return the last element in the sorted set + */ +gpointer gee_sorted_set_last (GeeSortedSet* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_SORTED_SET_GET_INTERFACE (self)->last (self); +} + + +/** + * Returns a {@link BidirIterator} that can be used for bi-directional + * iteration over this sorted set. + * + * @return a {@link BidirIterator} over this sorted set + */ +GeeBidirIterator* gee_sorted_set_bidir_iterator (GeeSortedSet* self) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_SORTED_SET_GET_INTERFACE (self)->bidir_iterator (self); +} + + +/** + * Returns a {@link BidirIterator} initialy pointed at the specified + * element. + * + * @param element the element to point the iterator at + * + * @return a {@link BidirIterator} over this sorted set, or null if + * the specified element is not in this set + */ +GeeBidirIterator* gee_sorted_set_iterator_at (GeeSortedSet* self, gconstpointer element) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_SORTED_SET_GET_INTERFACE (self)->iterator_at (self, element); +} + + +/** + * Returns the element which is strictly lower than the specified element. + * + * @param element the element which you want the lower element for + * + * @return the corresponding element + */ +gpointer gee_sorted_set_lower (GeeSortedSet* self, gconstpointer element) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_SORTED_SET_GET_INTERFACE (self)->lower (self, element); +} + + +/** + * Returns the element which is strictly higher than the specified element. + * + * @param element the element which you want the strictly higher element + * for + * + * @return the corresponding element + */ +gpointer gee_sorted_set_higher (GeeSortedSet* self, gconstpointer element) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_SORTED_SET_GET_INTERFACE (self)->higher (self, element); +} + + +/** + * Returns the element which is lower or equal then the specified element. + * + * @param element the element which you want the lower or equal element for + * + * @return the corresponding element + */ +gpointer gee_sorted_set_floor (GeeSortedSet* self, gconstpointer element) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_SORTED_SET_GET_INTERFACE (self)->floor (self, element); +} + + +/** + * Returns the element which is higher or equal then the specified element. + * + * @param element the element which you want the higher or equal element + * for + * + * @return the corresponding element + */ +gpointer gee_sorted_set_ceil (GeeSortedSet* self, gconstpointer element) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_SORTED_SET_GET_INTERFACE (self)->ceil (self, element); +} + + +/** + * Returns the sub-set of this sorted set containing elements strictly + * lower than the specified element. + * + * @param before the lower inclusive bound for the sub-set + * + * @return the corresponding sub-set of this sorted set + */ +GeeSortedSet* gee_sorted_set_head_set (GeeSortedSet* self, gconstpointer before) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_SORTED_SET_GET_INTERFACE (self)->head_set (self, before); +} + + +/** + * Returns the sub-set of this sorted set containing elements equal or + * higher than the specified element. + * + * @param after the higher exclusive bound for the sub-set + * + * @return the corresponding sub-set of this sorted set + */ +GeeSortedSet* gee_sorted_set_tail_set (GeeSortedSet* self, gconstpointer after) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_SORTED_SET_GET_INTERFACE (self)->tail_set (self, after); +} + + +/** + * Returns the right-open sub-set of this sorted set, thus containing + * elements equal or higher than the specified ``from`` element, and stricly + * lower than the specified ``to`` element. + * + * @param from the lower inclusive bound for the sub-set + * @param to the higher exclusive bound for the sub-set + * + * @return the corresponding sub-set of this sorted set + */ +GeeSortedSet* gee_sorted_set_sub_set (GeeSortedSet* self, gconstpointer from, gconstpointer to) { + g_return_val_if_fail (self != NULL, NULL); + return GEE_SORTED_SET_GET_INTERFACE (self)->sub_set (self, from, to); +} + + +static void gee_sorted_set_base_init (GeeSortedSetIface * iface) { + static gboolean initialized = FALSE; + if (!initialized) { + initialized = TRUE; + } +} + + +/** + * A sorted set, which you can navigate over and get sub-sets of. + */ +GType gee_sorted_set_get_type (void) { + static volatile gsize gee_sorted_set_type_id__volatile = 0; + if (g_once_init_enter (&gee_sorted_set_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeSortedSetIface), (GBaseInitFunc) gee_sorted_set_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; + GType gee_sorted_set_type_id; + gee_sorted_set_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeSortedSet", &g_define_type_info, 0); + g_type_interface_add_prerequisite (gee_sorted_set_type_id, GEE_TYPE_SET); + g_once_init_leave (&gee_sorted_set_type_id__volatile, gee_sorted_set_type_id); + } + return gee_sorted_set_type_id__volatile; +} + + + diff --git a/gee/sortedset.vala b/gee/sortedset.vala new file mode 100644 index 0000000..cbec01c --- /dev/null +++ b/gee/sortedset.vala @@ -0,0 +1,129 @@ +/* sortedset.vala + * + * Copyright (C) 2009 Didier Villevalois, Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Maciej Piechotka + */ + +/** + * A sorted set, which you can navigate over and get sub-sets of. + */ +public interface Gee.SortedSet : Gee.Set { + /** + * Returns the first element of the sorted set. Set must not be empty. + * + * @return the first element in the sorted set + */ + public abstract G first (); + + /** + * Returns the last element of the sorted set. Set must not be empty. + * + * @return the last element in the sorted set + */ + public abstract G last (); + + /** + * Returns a {@link BidirIterator} that can be used for bi-directional + * iteration over this sorted set. + * + * @return a {@link BidirIterator} over this sorted set + */ + public abstract BidirIterator bidir_iterator (); + + /** + * Returns a {@link BidirIterator} initialy pointed at the specified + * element. + * + * @param element the element to point the iterator at + * + * @return a {@link BidirIterator} over this sorted set, or null if + * the specified element is not in this set + */ + public abstract BidirIterator? iterator_at (G element); + + /** + * Returns the element which is strictly lower than the specified element. + * + * @param element the element which you want the lower element for + * + * @return the corresponding element + */ + public abstract G? lower (G element); + + /** + * Returns the element which is strictly higher than the specified element. + * + * @param element the element which you want the strictly higher element + * for + * + * @return the corresponding element + */ + public abstract G? higher (G element); + + /** + * Returns the element which is lower or equal then the specified element. + * + * @param element the element which you want the lower or equal element for + * + * @return the corresponding element + */ + public abstract G? floor (G element); + + /** + * Returns the element which is higher or equal then the specified element. + * + * @param element the element which you want the higher or equal element + * for + * + * @return the corresponding element + */ + public abstract G? ceil (G element); + + /** + * Returns the sub-set of this sorted set containing elements strictly + * lower than the specified element. + * + * @param before the lower inclusive bound for the sub-set + * + * @return the corresponding sub-set of this sorted set + */ + public abstract SortedSet head_set (G before); + + /** + * Returns the sub-set of this sorted set containing elements equal or + * higher than the specified element. + * + * @param after the higher exclusive bound for the sub-set + * + * @return the corresponding sub-set of this sorted set + */ + public abstract SortedSet tail_set (G after); + + /** + * Returns the right-open sub-set of this sorted set, thus containing + * elements equal or higher than the specified ``from`` element, and stricly + * lower than the specified ``to`` element. + * + * @param from the lower inclusive bound for the sub-set + * @param to the higher exclusive bound for the sub-set + * + * @return the corresponding sub-set of this sorted set + */ + public abstract SortedSet sub_set (G from, G to); +} diff --git a/gee/timsort.c b/gee/timsort.c new file mode 100644 index 0000000..a237aa6 --- /dev/null +++ b/gee/timsort.c @@ -0,0 +1,3873 @@ +/* timsort.c generated by valac 0.18.0, the Vala compiler + * generated from timsort.vala, do not modify */ + +/* timsort.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +#include +#include +#include + + +#define GEE_TYPE_TIM_SORT (gee_tim_sort_get_type ()) +#define GEE_TIM_SORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TIM_SORT, GeeTimSort)) +#define GEE_TIM_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TIM_SORT, GeeTimSortClass)) +#define GEE_IS_TIM_SORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TIM_SORT)) +#define GEE_IS_TIM_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TIM_SORT)) +#define GEE_TIM_SORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TIM_SORT, GeeTimSortClass)) + +typedef struct _GeeTimSort GeeTimSort; +typedef struct _GeeTimSortClass GeeTimSortClass; +typedef struct _GeeTimSortPrivate GeeTimSortPrivate; + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_LIST (gee_list_get_type ()) +#define GEE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST, GeeList)) +#define GEE_IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST)) +#define GEE_LIST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST, GeeListIface)) + +typedef struct _GeeList GeeList; +typedef struct _GeeListIface GeeListIface; + +#define GEE_TYPE_BIDIR_ITERATOR (gee_bidir_iterator_get_type ()) +#define GEE_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIterator)) +#define GEE_IS_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_ITERATOR)) +#define GEE_BIDIR_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIteratorIface)) + +typedef struct _GeeBidirIterator GeeBidirIterator; +typedef struct _GeeBidirIteratorIface GeeBidirIteratorIface; + +#define GEE_TYPE_LIST_ITERATOR (gee_list_iterator_get_type ()) +#define GEE_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIterator)) +#define GEE_IS_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST_ITERATOR)) +#define GEE_LIST_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIteratorIface)) + +typedef struct _GeeListIterator GeeListIterator; +typedef struct _GeeListIteratorIface GeeListIteratorIface; +typedef struct _GeeTimSortSlice GeeTimSortSlice; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; + +#define GEE_TYPE_ABSTRACT_LIST (gee_abstract_list_get_type ()) +#define GEE_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractList)) +#define GEE_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass)) +#define GEE_IS_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_LIST)) +#define GEE_IS_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_LIST)) +#define GEE_ABSTRACT_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass)) + +typedef struct _GeeAbstractList GeeAbstractList; +typedef struct _GeeAbstractListClass GeeAbstractListClass; + +#define GEE_TYPE_ARRAY_LIST (gee_array_list_get_type ()) +#define GEE_ARRAY_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ARRAY_LIST, GeeArrayList)) +#define GEE_ARRAY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ARRAY_LIST, GeeArrayListClass)) +#define GEE_IS_ARRAY_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ARRAY_LIST)) +#define GEE_IS_ARRAY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ARRAY_LIST)) +#define GEE_ARRAY_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ARRAY_LIST, GeeArrayListClass)) + +typedef struct _GeeArrayList GeeArrayList; +typedef struct _GeeArrayListClass GeeArrayListClass; +#define _g_destroy_func0(var) (((var == NULL) || (g_destroy_func == NULL)) ? NULL : (var = (g_destroy_func (var), NULL))) +typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate; +typedef struct _GeeAbstractListPrivate GeeAbstractListPrivate; +typedef struct _GeeArrayListPrivate GeeArrayListPrivate; +#define _gee_tim_sort_slice_free0(var) ((var == NULL) ? NULL : (var = (gee_tim_sort_slice_free (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTimSort { + GObject parent_instance; + GeeTimSortPrivate * priv; +}; + +struct _GeeTimSortClass { + GObjectClass parent_class; +}; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeBidirIteratorIface { + GTypeInterface parent_iface; + gboolean (*previous) (GeeBidirIterator* self); + gboolean (*has_previous) (GeeBidirIterator* self); + gboolean (*last) (GeeBidirIterator* self); +}; + +struct _GeeListIteratorIface { + GTypeInterface parent_iface; + void (*set) (GeeListIterator* self, gconstpointer item); + void (*insert) (GeeListIterator* self, gconstpointer item); + void (*add) (GeeListIterator* self, gconstpointer item); + gint (*index) (GeeListIterator* self); +}; + +struct _GeeListIface { + GTypeInterface parent_iface; + GeeListIterator* (*list_iterator) (GeeList* self); + gpointer (*get) (GeeList* self, gint index); + void (*set) (GeeList* self, gint index, gconstpointer item); + gint (*index_of) (GeeList* self, gconstpointer item); + void (*insert) (GeeList* self, gint index, gconstpointer item); + gpointer (*remove_at) (GeeList* self, gint index); + GeeList* (*slice) (GeeList* self, gint start, gint stop); + gpointer (*first) (GeeList* self); + gpointer (*last) (GeeList* self); + void (*insert_all) (GeeList* self, gint index, GeeCollection* collection); + void (*sort) (GeeList* self, GCompareFunc compare_func); + GeeList* (*get_read_only_view) (GeeList* self); +}; + +struct _GeeTimSortPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GeeList* list_collection; + gpointer* array; + gint array_length1; + gint _array_size_; + void** list; + gint index; + gint size; + GeeTimSortSlice** pending; + gint pending_length1; + gint _pending_size_; + gint minimum_gallop; + GCompareFunc compare; + GCompareDataFunc compare_data; + gpointer compare_data_target; + GDestroyNotify compare_data_target_destroy_notify; +}; + +struct _GeeAbstractCollection { + GObject parent_instance; + GeeAbstractCollectionPrivate * priv; +}; + +struct _GeeAbstractCollectionClass { + GObjectClass parent_class; + gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*add) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item); + void (*clear) (GeeAbstractCollection* self); + gpointer* (*to_array) (GeeAbstractCollection* self, int* result_length1); + gboolean (*add_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeAbstractCollection* self, GeeCollection* collection); + GeeIterator* (*iterator) (GeeAbstractCollection* self); + gint (*get_size) (GeeAbstractCollection* self); + gboolean (*get_is_empty) (GeeAbstractCollection* self); + GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self); +}; + +struct _GeeAbstractList { + GeeAbstractCollection parent_instance; + GeeAbstractListPrivate * priv; +}; + +struct _GeeAbstractListClass { + GeeAbstractCollectionClass parent_class; + GeeListIterator* (*list_iterator) (GeeAbstractList* self); + gpointer (*get) (GeeAbstractList* self, gint index); + void (*set) (GeeAbstractList* self, gint index, gconstpointer item); + gint (*index_of) (GeeAbstractList* self, gconstpointer item); + void (*insert) (GeeAbstractList* self, gint index, gconstpointer item); + gpointer (*remove_at) (GeeAbstractList* self, gint index); + GeeList* (*slice) (GeeAbstractList* self, gint start, gint stop); + gpointer (*first) (GeeAbstractList* self); + gpointer (*last) (GeeAbstractList* self); + void (*insert_all) (GeeAbstractList* self, gint index, GeeCollection* collection); + GeeList* (*get_read_only_view) (GeeAbstractList* self); +}; + +struct _GeeArrayList { + GeeAbstractList parent_instance; + GeeArrayListPrivate * priv; + gpointer* _items; + gint _items_length1; + gint __items_size_; + gint _size; +}; + +struct _GeeArrayListClass { + GeeAbstractListClass parent_class; +}; + +struct _GeeTimSortSlice { + void** list; + void** new_list; + gint index; + gint length; +}; + +typedef gboolean (*GeeTimSortLowerFunc) (gconstpointer left, gconstpointer right, void* user_data); + +static gpointer gee_tim_sort_parent_class = NULL; + +GType gee_tim_sort_get_type (void) G_GNUC_CONST; +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_bidir_iterator_get_type (void) G_GNUC_CONST; +GType gee_list_iterator_get_type (void) G_GNUC_CONST; +GType gee_list_get_type (void) G_GNUC_CONST; +static void gee_tim_sort_slice_free (GeeTimSortSlice* self); +#define GEE_TIM_SORT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_TIM_SORT, GeeTimSortPrivate)) +enum { + GEE_TIM_SORT_DUMMY_PROPERTY, + GEE_TIM_SORT_G_TYPE, + GEE_TIM_SORT_G_DUP_FUNC, + GEE_TIM_SORT_G_DESTROY_FUNC +}; +#define GEE_TIM_SORT_MINIMUM_GALLOP 7 +void gee_tim_sort_sort (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareFunc compare); +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_list_get_type (void) G_GNUC_CONST; +GType gee_array_list_get_type (void) G_GNUC_CONST; +static void gee_tim_sort_sort_arraylist (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeArrayList* list, GCompareFunc compare, GCompareDataFunc compare_data, void* compare_data_target); +static void gee_tim_sort_sort_list (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareFunc compare, GCompareDataFunc compare_data, void* compare_data_target); +void gee_tim_sort_sort_with_data (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareDataFunc compare_data, void* compare_data_target); +GeeTimSort* gee_tim_sort_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GeeTimSort* gee_tim_sort_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +gpointer* gee_collection_to_array (GeeCollection* self, int* result_length1); +gint gee_collection_get_size (GeeCollection* self); +static void gee_tim_sort_do_sort (GeeTimSort* self); +void gee_collection_clear (GeeCollection* self); +gboolean gee_collection_add (GeeCollection* self, gconstpointer item); +static GeeTimSortSlice* gee_tim_sort_slice_new (void** list, gint index, gint length); +static GeeTimSortSlice* gee_tim_sort_slice_new (void** list, gint index, gint length); +static gint gee_tim_sort_compute_minimum_run_length (GeeTimSort* self, gint length); +static GeeTimSortSlice* gee_tim_sort_compute_longest_run (GeeTimSort* self, GeeTimSortSlice* a, gboolean* descending); +static void gee_tim_sort_slice_reverse (GeeTimSortSlice* self); +static void gee_tim_sort_insertion_sort (GeeTimSort* self, GeeTimSortSlice* a, gint offset); +static inline void gee_tim_sort_slice_shorten_start (GeeTimSortSlice* self, gint n); +static void _vala_array_add1 (GeeTimSortSlice*** array, int* length, int* size, GeeTimSortSlice* value); +static void gee_tim_sort_merge_collapse (GeeTimSort* self); +static void gee_tim_sort_merge_force_collapse (GeeTimSort* self); +static inline gboolean gee_tim_sort_lower_than (GeeTimSort* self, gconstpointer left, gconstpointer right); +static inline gboolean gee_tim_sort_lower_than_or_equal_to (GeeTimSort* self, gconstpointer left, gconstpointer right); +static void gee_tim_sort_merge_at (GeeTimSort* self, gint index); +static gint gee_tim_sort_gallop_rightmost (GeeTimSort* self, gconstpointer key, GeeTimSortSlice* a, gint hint); +static inline void* gee_tim_sort_slice_peek_first (GeeTimSortSlice* self); +static gint gee_tim_sort_gallop_leftmost (GeeTimSort* self, gconstpointer key, GeeTimSortSlice* a, gint hint); +static inline void* gee_tim_sort_slice_peek_last (GeeTimSortSlice* self); +static void gee_tim_sort_merge_low (GeeTimSort* self, GeeTimSortSlice* a, GeeTimSortSlice* b); +static void gee_tim_sort_merge_high (GeeTimSort* self, GeeTimSortSlice* a, GeeTimSortSlice* b); +static void gee_tim_sort_slice_copy (GeeTimSortSlice* self); +static inline void* gee_tim_sort_slice_pop_first (GeeTimSortSlice* self); +static inline void gee_tim_sort_slice_merge_in (GeeTimSortSlice* self, void** dest_array, gint index, gint dest_index, gint count); +static inline void* gee_tim_sort_slice_pop_last (GeeTimSortSlice* self); +static inline void gee_tim_sort_slice_merge_in_reversed (GeeTimSortSlice* self, void** dest_array, gint index, gint dest_index, gint count); +static inline void gee_tim_sort_slice_shorten_end (GeeTimSortSlice* self, gint n); +static void gee_tim_sort_slice_instance_init (GeeTimSortSlice * self); +static inline void gee_tim_sort_slice_swap (GeeTimSortSlice* self, gint i, gint j); +static void gee_tim_sort_finalize (GObject* obj); +static void _vala_gee_tim_sort_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_tim_sort_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_move (gpointer array, gsize element_size, gint src, gint dest, gint length); + + +void gee_tim_sort_sort (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareFunc compare) { + GeeList* _tmp0_; + g_return_if_fail (list != NULL); + _tmp0_ = list; + if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_ARRAY_LIST)) { + GeeList* _tmp1_; + GCompareFunc _tmp2_; + _tmp1_ = list; + _tmp2_ = compare; + gee_tim_sort_sort_arraylist (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GEE_TYPE_ARRAY_LIST, GeeArrayList), _tmp2_, NULL, NULL); + } else { + GeeList* _tmp3_; + GCompareFunc _tmp4_; + _tmp3_ = list; + _tmp4_ = compare; + gee_tim_sort_sort_list (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, _tmp3_, _tmp4_, NULL, NULL); + } +} + + +void gee_tim_sort_sort_with_data (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareDataFunc compare_data, void* compare_data_target) { + GeeList* _tmp0_; + g_return_if_fail (list != NULL); + _tmp0_ = list; + if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_ARRAY_LIST)) { + GeeList* _tmp1_; + GCompareDataFunc _tmp2_; + void* _tmp2__target; + _tmp1_ = list; + _tmp2_ = compare_data; + _tmp2__target = compare_data_target; + gee_tim_sort_sort_arraylist (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GEE_TYPE_ARRAY_LIST, GeeArrayList), NULL, _tmp2_, _tmp2__target); + } else { + GeeList* _tmp3_; + GCompareDataFunc _tmp4_; + void* _tmp4__target; + _tmp3_ = list; + _tmp4_ = compare_data; + _tmp4__target = compare_data_target; + gee_tim_sort_sort_list (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, _tmp3_, NULL, _tmp4_, _tmp4__target); + } +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void gee_tim_sort_sort_list (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareFunc compare, GCompareDataFunc compare_data, void* compare_data_target) { + gboolean _tmp0_ = FALSE; + GCompareFunc _tmp1_; + gboolean _tmp3_; + GeeTimSort* _tmp4_; + GeeTimSort* helper; + GeeTimSort* _tmp5_; + GeeList* _tmp6_; + GeeList* _tmp7_; + GeeTimSort* _tmp8_; + GeeList* _tmp9_; + gint _tmp10_ = 0; + gpointer* _tmp11_ = NULL; + GeeTimSort* _tmp12_; + GeeTimSort* _tmp13_; + gpointer* _tmp14_; + gint _tmp14__length1; + GeeTimSort* _tmp15_; + GeeTimSort* _tmp16_; + GeeList* _tmp17_; + gint _tmp18_; + gint _tmp19_; + GeeTimSort* _tmp20_; + GCompareFunc _tmp21_; + GeeTimSort* _tmp22_; + GCompareDataFunc _tmp23_; + void* _tmp23__target; + GeeTimSort* _tmp24_; + GeeList* _tmp25_; + GeeTimSort* _tmp26_; + gpointer* _tmp27_; + gint _tmp27__length1; + g_return_if_fail (list != NULL); + _tmp1_ = compare; + if (_tmp1_ != NULL) { + _tmp0_ = TRUE; + } else { + GCompareDataFunc _tmp2_; + void* _tmp2__target; + _tmp2_ = compare_data; + _tmp2__target = compare_data_target; + _tmp0_ = _tmp2_ != NULL; + } + _tmp3_ = _tmp0_; + _vala_assert (_tmp3_, "compare != null || compare_data != null"); + _tmp4_ = gee_tim_sort_new (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func); + helper = _tmp4_; + _tmp5_ = helper; + _tmp6_ = list; + _tmp7_ = _g_object_ref0 (_tmp6_); + _g_object_unref0 (_tmp5_->priv->list_collection); + _tmp5_->priv->list_collection = _tmp7_; + _tmp8_ = helper; + _tmp9_ = list; + _tmp11_ = gee_collection_to_array ((GeeCollection*) _tmp9_, &_tmp10_); + _tmp8_->priv->array = (_vala_array_free (_tmp8_->priv->array, _tmp8_->priv->array_length1, (GDestroyNotify) g_destroy_func), NULL); + _tmp8_->priv->array = _tmp11_; + _tmp8_->priv->array_length1 = _tmp10_; + _tmp8_->priv->_array_size_ = _tmp8_->priv->array_length1; + _tmp12_ = helper; + _tmp13_ = helper; + _tmp14_ = _tmp13_->priv->array; + _tmp14__length1 = _tmp13_->priv->array_length1; + _tmp12_->priv->list = _tmp14_; + _tmp15_ = helper; + _tmp15_->priv->index = 0; + _tmp16_ = helper; + _tmp17_ = list; + _tmp18_ = gee_collection_get_size ((GeeCollection*) _tmp17_); + _tmp19_ = _tmp18_; + _tmp16_->priv->size = _tmp19_; + _tmp20_ = helper; + _tmp21_ = compare; + _tmp20_->priv->compare = _tmp21_; + _tmp22_ = helper; + _tmp23_ = compare_data; + _tmp23__target = compare_data_target; + (_tmp22_->priv->compare_data_target_destroy_notify == NULL) ? NULL : (_tmp22_->priv->compare_data_target_destroy_notify (_tmp22_->priv->compare_data_target), NULL); + _tmp22_->priv->compare_data = NULL; + _tmp22_->priv->compare_data_target = NULL; + _tmp22_->priv->compare_data_target_destroy_notify = NULL; + _tmp22_->priv->compare_data = _tmp23_; + _tmp22_->priv->compare_data_target = _tmp23__target; + _tmp22_->priv->compare_data_target_destroy_notify = NULL; + _tmp24_ = helper; + gee_tim_sort_do_sort (_tmp24_); + _tmp25_ = list; + gee_collection_clear ((GeeCollection*) _tmp25_); + _tmp26_ = helper; + _tmp27_ = _tmp26_->priv->array; + _tmp27__length1 = _tmp26_->priv->array_length1; + { + gpointer* item_collection = NULL; + gint item_collection_length1 = 0; + gint _item_collection_size_ = 0; + gint item_it = 0; + item_collection = _tmp27_; + item_collection_length1 = _tmp27__length1; + for (item_it = 0; item_it < _tmp27__length1; item_it = item_it + 1) { + gpointer _tmp28_; + gpointer item = NULL; + _tmp28_ = ((item_collection[item_it] != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) item_collection[item_it]) : ((gpointer) item_collection[item_it]); + item = _tmp28_; + { + GeeList* _tmp29_; + gconstpointer _tmp30_; + _tmp29_ = list; + _tmp30_ = item; + gee_collection_add ((GeeCollection*) _tmp29_, _tmp30_); + _g_destroy_func0 (item); + } + } + } + _g_object_unref0 (helper); +} + + +static void gee_tim_sort_sort_arraylist (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeArrayList* list, GCompareFunc compare, GCompareDataFunc compare_data, void* compare_data_target) { + gboolean _tmp0_ = FALSE; + GCompareFunc _tmp1_; + gboolean _tmp3_; + GeeTimSort* _tmp4_; + GeeTimSort* helper; + GeeArrayList* _tmp5_; + GeeList* _tmp6_; + GeeArrayList* _tmp7_; + gpointer* _tmp8_; + gint _tmp8__length1; + GeeArrayList* _tmp9_; + gint _tmp10_; + GCompareFunc _tmp11_; + GCompareDataFunc _tmp12_; + void* _tmp12__target; + g_return_if_fail (list != NULL); + _tmp1_ = compare; + if (_tmp1_ != NULL) { + _tmp0_ = TRUE; + } else { + GCompareDataFunc _tmp2_; + void* _tmp2__target; + _tmp2_ = compare_data; + _tmp2__target = compare_data_target; + _tmp0_ = _tmp2_ != NULL; + } + _tmp3_ = _tmp0_; + _vala_assert (_tmp3_, "compare != null || compare_data != null"); + _tmp4_ = gee_tim_sort_new (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func); + helper = _tmp4_; + _tmp5_ = list; + _tmp6_ = _g_object_ref0 ((GeeList*) _tmp5_); + _g_object_unref0 (helper->priv->list_collection); + helper->priv->list_collection = _tmp6_; + _tmp7_ = list; + _tmp8_ = _tmp7_->_items; + _tmp8__length1 = _tmp7_->_items_length1; + helper->priv->list = _tmp8_; + helper->priv->index = 0; + _tmp9_ = list; + _tmp10_ = _tmp9_->_size; + helper->priv->size = _tmp10_; + _tmp11_ = compare; + helper->priv->compare = _tmp11_; + _tmp12_ = compare_data; + _tmp12__target = compare_data_target; + (helper->priv->compare_data_target_destroy_notify == NULL) ? NULL : (helper->priv->compare_data_target_destroy_notify (helper->priv->compare_data_target), NULL); + helper->priv->compare_data = NULL; + helper->priv->compare_data_target = NULL; + helper->priv->compare_data_target_destroy_notify = NULL; + helper->priv->compare_data = _tmp12_; + helper->priv->compare_data_target = _tmp12__target; + helper->priv->compare_data_target_destroy_notify = NULL; + gee_tim_sort_do_sort (helper); + _g_object_unref0 (helper); +} + + +static void _vala_array_add1 (GeeTimSortSlice*** array, int* length, int* size, GeeTimSortSlice* value) { + if ((*length) == (*size)) { + *size = (*size) ? (2 * (*size)) : 4; + *array = g_renew (GeeTimSortSlice*, *array, (*size) + 1); + } + (*array)[(*length)++] = value; + (*array)[*length] = NULL; +} + + +static void gee_tim_sort_do_sort (GeeTimSort* self) { + gint _tmp0_; + GeeTimSortSlice** _tmp1_ = NULL; + void** _tmp2_; + gint _tmp3_; + gint _tmp4_; + GeeTimSortSlice* _tmp5_; + GeeTimSortSlice* remaining; + GeeTimSortSlice* _tmp6_; + gint _tmp7_; + gint _tmp8_ = 0; + gint minimum_length; + GeeTimSortSlice* _tmp33_; + gint _tmp34_; + gint _tmp35_; + GeeTimSortSlice** _tmp36_; + gint _tmp36__length1; + GeeTimSortSlice** _tmp37_; + gint _tmp37__length1; + GeeTimSortSlice* _tmp38_; + gint _tmp39_; + GeeTimSortSlice** _tmp40_; + gint _tmp40__length1; + GeeTimSortSlice* _tmp41_; + gint _tmp42_; + gint _tmp43_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->size; + if (_tmp0_ < 2) { + return; + } + _tmp1_ = g_new0 (GeeTimSortSlice*, 0 + 1); + self->priv->pending = (_vala_array_free (self->priv->pending, self->priv->pending_length1, (GDestroyNotify) gee_tim_sort_slice_free), NULL); + self->priv->pending = _tmp1_; + self->priv->pending_length1 = 0; + self->priv->_pending_size_ = self->priv->pending_length1; + self->priv->minimum_gallop = GEE_TIM_SORT_MINIMUM_GALLOP; + _tmp2_ = self->priv->list; + _tmp3_ = self->priv->index; + _tmp4_ = self->priv->size; + _tmp5_ = gee_tim_sort_slice_new (_tmp2_, _tmp3_, _tmp4_); + remaining = _tmp5_; + _tmp6_ = remaining; + _tmp7_ = _tmp6_->length; + _tmp8_ = gee_tim_sort_compute_minimum_run_length (self, _tmp7_); + minimum_length = _tmp8_; + while (TRUE) { + GeeTimSortSlice* _tmp9_; + gint _tmp10_; + gboolean descending = FALSE; + GeeTimSortSlice* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeTimSortSlice* _tmp13_ = NULL; + GeeTimSortSlice* run; + gboolean _tmp14_; + GeeTimSortSlice* _tmp16_; + gint _tmp17_; + gint _tmp18_; + GeeTimSortSlice* _tmp28_; + GeeTimSortSlice* _tmp29_; + gint _tmp30_; + GeeTimSortSlice** _tmp31_; + gint _tmp31__length1; + GeeTimSortSlice* _tmp32_; + _tmp9_ = remaining; + _tmp10_ = _tmp9_->length; + if (!(_tmp10_ > 0)) { + break; + } + _tmp11_ = remaining; + _tmp13_ = gee_tim_sort_compute_longest_run (self, _tmp11_, &_tmp12_); + descending = _tmp12_; + run = _tmp13_; + _tmp14_ = descending; + if (_tmp14_) { + GeeTimSortSlice* _tmp15_; + _tmp15_ = run; + gee_tim_sort_slice_reverse (_tmp15_); + } + _tmp16_ = run; + _tmp17_ = _tmp16_->length; + _tmp18_ = minimum_length; + if (_tmp17_ < _tmp18_) { + GeeTimSortSlice* _tmp19_; + gint _tmp20_; + gint sorted_count; + GeeTimSortSlice* _tmp21_; + gint _tmp22_; + GeeTimSortSlice* _tmp23_; + gint _tmp24_; + gint _tmp25_ = 0; + GeeTimSortSlice* _tmp26_; + gint _tmp27_; + _tmp19_ = run; + _tmp20_ = _tmp19_->length; + sorted_count = _tmp20_; + _tmp21_ = run; + _tmp22_ = minimum_length; + _tmp23_ = remaining; + _tmp24_ = _tmp23_->length; + _tmp25_ = MIN (_tmp22_, _tmp24_); + _tmp21_->length = _tmp25_; + _tmp26_ = run; + _tmp27_ = sorted_count; + gee_tim_sort_insertion_sort (self, _tmp26_, _tmp27_); + } + _tmp28_ = remaining; + _tmp29_ = run; + _tmp30_ = _tmp29_->length; + gee_tim_sort_slice_shorten_start (_tmp28_, _tmp30_); + _tmp31_ = self->priv->pending; + _tmp31__length1 = self->priv->pending_length1; + _tmp32_ = run; + run = NULL; + _vala_array_add1 (&self->priv->pending, &self->priv->pending_length1, &self->priv->_pending_size_, _tmp32_); + gee_tim_sort_merge_collapse (self); + _gee_tim_sort_slice_free0 (run); + } + _tmp33_ = remaining; + _tmp34_ = _tmp33_->index; + _tmp35_ = self->priv->size; + _vala_assert (_tmp34_ == _tmp35_, "remaining.index == size"); + gee_tim_sort_merge_force_collapse (self); + _tmp36_ = self->priv->pending; + _tmp36__length1 = self->priv->pending_length1; + _vala_assert (_tmp36__length1 == 1, "pending.length == 1"); + _tmp37_ = self->priv->pending; + _tmp37__length1 = self->priv->pending_length1; + _tmp38_ = _tmp37_[0]; + _tmp39_ = _tmp38_->index; + _vala_assert (_tmp39_ == 0, "pending[0].index == 0"); + _tmp40_ = self->priv->pending; + _tmp40__length1 = self->priv->pending_length1; + _tmp41_ = _tmp40_[0]; + _tmp42_ = _tmp41_->length; + _tmp43_ = self->priv->size; + _vala_assert (_tmp42_ == _tmp43_, "pending[0].length == size"); + _gee_tim_sort_slice_free0 (remaining); +} + + +static inline gboolean gee_tim_sort_lower_than (GeeTimSort* self, gconstpointer left, gconstpointer right) { + gboolean result = FALSE; + GCompareFunc _tmp0_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = self->priv->compare; + if (_tmp0_ != NULL) { + GCompareFunc _tmp1_; + gconstpointer _tmp2_; + gconstpointer _tmp3_; + gint _tmp4_ = 0; + _tmp1_ = self->priv->compare; + _tmp2_ = left; + _tmp3_ = right; + _tmp4_ = _tmp1_ (_tmp2_, _tmp3_); + result = _tmp4_ < 0; + return result; + } else { + GCompareDataFunc _tmp5_; + void* _tmp5__target; + gconstpointer _tmp6_; + gconstpointer _tmp7_; + gint _tmp8_ = 0; + _tmp5_ = self->priv->compare_data; + _tmp5__target = self->priv->compare_data_target; + _tmp6_ = left; + _tmp7_ = right; + _tmp8_ = _tmp5_ (_tmp6_, _tmp7_, _tmp5__target); + result = _tmp8_ < 0; + return result; + } +} + + +static inline gboolean gee_tim_sort_lower_than_or_equal_to (GeeTimSort* self, gconstpointer left, gconstpointer right) { + gboolean result = FALSE; + GCompareFunc _tmp0_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = self->priv->compare; + if (_tmp0_ != NULL) { + GCompareFunc _tmp1_; + gconstpointer _tmp2_; + gconstpointer _tmp3_; + gint _tmp4_ = 0; + _tmp1_ = self->priv->compare; + _tmp2_ = left; + _tmp3_ = right; + _tmp4_ = _tmp1_ (_tmp2_, _tmp3_); + result = _tmp4_ <= 0; + return result; + } else { + GCompareDataFunc _tmp5_; + void* _tmp5__target; + gconstpointer _tmp6_; + gconstpointer _tmp7_; + gint _tmp8_ = 0; + _tmp5_ = self->priv->compare_data; + _tmp5__target = self->priv->compare_data_target; + _tmp6_ = left; + _tmp7_ = right; + _tmp8_ = _tmp5_ (_tmp6_, _tmp7_, _tmp5__target); + result = _tmp8_ <= 0; + return result; + } +} + + +static gint gee_tim_sort_compute_minimum_run_length (GeeTimSort* self, gint length) { + gint result = 0; + gint run_length; + gint _tmp4_; + gint _tmp5_; + g_return_val_if_fail (self != NULL, 0); + run_length = 0; + while (TRUE) { + gint _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint _tmp3_; + _tmp0_ = length; + if (!(_tmp0_ >= 64)) { + break; + } + _tmp1_ = run_length; + _tmp2_ = length; + run_length = _tmp1_ | (_tmp2_ & 1); + _tmp3_ = length; + length = _tmp3_ >> 1; + } + _tmp4_ = length; + _tmp5_ = run_length; + result = _tmp4_ + _tmp5_; + return result; +} + + +static GeeTimSortSlice* gee_tim_sort_compute_longest_run (GeeTimSort* self, GeeTimSortSlice* a, gboolean* descending) { + gboolean _vala_descending = FALSE; + GeeTimSortSlice* result = NULL; + gint run_length = 0; + GeeTimSortSlice* _tmp0_; + gint _tmp1_; + GeeTimSortSlice* _tmp55_; + void** _tmp56_; + GeeTimSortSlice* _tmp57_; + gint _tmp58_; + gint _tmp59_; + GeeTimSortSlice* _tmp60_; + g_return_val_if_fail (self != NULL, NULL); + g_return_val_if_fail (a != NULL, NULL); + _tmp0_ = a; + _tmp1_ = _tmp0_->length; + if (_tmp1_ <= 1) { + GeeTimSortSlice* _tmp2_; + gint _tmp3_; + _tmp2_ = a; + _tmp3_ = _tmp2_->length; + run_length = _tmp3_; + _vala_descending = FALSE; + } else { + GeeTimSortSlice* _tmp4_; + void** _tmp5_; + GeeTimSortSlice* _tmp6_; + gint _tmp7_; + void* _tmp8_; + GeeTimSortSlice* _tmp9_; + void** _tmp10_; + GeeTimSortSlice* _tmp11_; + gint _tmp12_; + void* _tmp13_; + gboolean _tmp14_ = FALSE; + run_length = 2; + _tmp4_ = a; + _tmp5_ = _tmp4_->list; + _tmp6_ = a; + _tmp7_ = _tmp6_->index; + _tmp8_ = _tmp5_[_tmp7_ + 1]; + _tmp9_ = a; + _tmp10_ = _tmp9_->list; + _tmp11_ = a; + _tmp12_ = _tmp11_->index; + _tmp13_ = _tmp10_[_tmp12_]; + _tmp14_ = gee_tim_sort_lower_than (self, _tmp8_, _tmp13_); + if (_tmp14_) { + _vala_descending = TRUE; + { + GeeTimSortSlice* _tmp15_; + gint _tmp16_; + gint i; + _tmp15_ = a; + _tmp16_ = _tmp15_->index; + i = _tmp16_ + 2; + { + gboolean _tmp17_; + _tmp17_ = TRUE; + while (TRUE) { + gboolean _tmp18_; + gint _tmp20_; + GeeTimSortSlice* _tmp21_; + gint _tmp22_; + GeeTimSortSlice* _tmp23_; + gint _tmp24_; + GeeTimSortSlice* _tmp25_; + void** _tmp26_; + gint _tmp27_; + void* _tmp28_; + GeeTimSortSlice* _tmp29_; + void** _tmp30_; + gint _tmp31_; + void* _tmp32_; + gboolean _tmp33_ = FALSE; + _tmp18_ = _tmp17_; + if (!_tmp18_) { + gint _tmp19_; + _tmp19_ = i; + i = _tmp19_ + 1; + } + _tmp17_ = FALSE; + _tmp20_ = i; + _tmp21_ = a; + _tmp22_ = _tmp21_->index; + _tmp23_ = a; + _tmp24_ = _tmp23_->length; + if (!(_tmp20_ < (_tmp22_ + _tmp24_))) { + break; + } + _tmp25_ = a; + _tmp26_ = _tmp25_->list; + _tmp27_ = i; + _tmp28_ = _tmp26_[_tmp27_]; + _tmp29_ = a; + _tmp30_ = _tmp29_->list; + _tmp31_ = i; + _tmp32_ = _tmp30_[_tmp31_ - 1]; + _tmp33_ = gee_tim_sort_lower_than (self, _tmp28_, _tmp32_); + if (_tmp33_) { + gint _tmp34_; + _tmp34_ = run_length; + run_length = _tmp34_ + 1; + } else { + break; + } + } + } + } + } else { + _vala_descending = FALSE; + { + GeeTimSortSlice* _tmp35_; + gint _tmp36_; + gint i; + _tmp35_ = a; + _tmp36_ = _tmp35_->index; + i = _tmp36_ + 2; + { + gboolean _tmp37_; + _tmp37_ = TRUE; + while (TRUE) { + gboolean _tmp38_; + gint _tmp40_; + GeeTimSortSlice* _tmp41_; + gint _tmp42_; + GeeTimSortSlice* _tmp43_; + gint _tmp44_; + GeeTimSortSlice* _tmp45_; + void** _tmp46_; + gint _tmp47_; + void* _tmp48_; + GeeTimSortSlice* _tmp49_; + void** _tmp50_; + gint _tmp51_; + void* _tmp52_; + gboolean _tmp53_ = FALSE; + _tmp38_ = _tmp37_; + if (!_tmp38_) { + gint _tmp39_; + _tmp39_ = i; + i = _tmp39_ + 1; + } + _tmp37_ = FALSE; + _tmp40_ = i; + _tmp41_ = a; + _tmp42_ = _tmp41_->index; + _tmp43_ = a; + _tmp44_ = _tmp43_->length; + if (!(_tmp40_ < (_tmp42_ + _tmp44_))) { + break; + } + _tmp45_ = a; + _tmp46_ = _tmp45_->list; + _tmp47_ = i; + _tmp48_ = _tmp46_[_tmp47_]; + _tmp49_ = a; + _tmp50_ = _tmp49_->list; + _tmp51_ = i; + _tmp52_ = _tmp50_[_tmp51_ - 1]; + _tmp53_ = gee_tim_sort_lower_than (self, _tmp48_, _tmp52_); + if (_tmp53_) { + break; + } else { + gint _tmp54_; + _tmp54_ = run_length; + run_length = _tmp54_ + 1; + } + } + } + } + } + } + _tmp55_ = a; + _tmp56_ = _tmp55_->list; + _tmp57_ = a; + _tmp58_ = _tmp57_->index; + _tmp59_ = run_length; + _tmp60_ = gee_tim_sort_slice_new (_tmp56_, _tmp58_, _tmp59_); + result = _tmp60_; + if (descending) { + *descending = _vala_descending; + } + return result; +} + + +static void gee_tim_sort_insertion_sort (GeeTimSort* self, GeeTimSortSlice* a, gint offset) { + g_return_if_fail (self != NULL); + g_return_if_fail (a != NULL); + { + GeeTimSortSlice* _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint start; + _tmp0_ = a; + _tmp1_ = _tmp0_->index; + _tmp2_ = offset; + start = _tmp1_ + _tmp2_; + { + gboolean _tmp3_; + _tmp3_ = TRUE; + while (TRUE) { + gboolean _tmp4_; + gint _tmp6_; + GeeTimSortSlice* _tmp7_; + gint _tmp8_; + GeeTimSortSlice* _tmp9_; + gint _tmp10_; + GeeTimSortSlice* _tmp11_; + gint _tmp12_; + gint left; + gint _tmp13_; + gint right; + GeeTimSortSlice* _tmp14_; + void** _tmp15_; + gint _tmp16_; + void* _tmp17_; + void* pivot; + gint _tmp31_; + gint _tmp32_; + GeeTimSortSlice* _tmp33_; + void** _tmp34_; + gint _tmp35_; + GeeTimSortSlice* _tmp36_; + void** _tmp37_; + gint _tmp38_; + gint _tmp39_; + gint _tmp40_; + GeeTimSortSlice* _tmp41_; + void** _tmp42_; + gint _tmp43_; + void* _tmp44_; + void* _tmp45_; + _tmp4_ = _tmp3_; + if (!_tmp4_) { + gint _tmp5_; + _tmp5_ = start; + start = _tmp5_ + 1; + } + _tmp3_ = FALSE; + _tmp6_ = start; + _tmp7_ = a; + _tmp8_ = _tmp7_->index; + _tmp9_ = a; + _tmp10_ = _tmp9_->length; + if (!(_tmp6_ < (_tmp8_ + _tmp10_))) { + break; + } + _tmp11_ = a; + _tmp12_ = _tmp11_->index; + left = _tmp12_; + _tmp13_ = start; + right = _tmp13_; + _tmp14_ = a; + _tmp15_ = _tmp14_->list; + _tmp16_ = right; + _tmp17_ = _tmp15_[_tmp16_]; + pivot = _tmp17_; + while (TRUE) { + gint _tmp18_; + gint _tmp19_; + gint _tmp20_; + gint _tmp21_; + gint _tmp22_; + gint p; + void* _tmp23_; + GeeTimSortSlice* _tmp24_; + void** _tmp25_; + gint _tmp26_; + void* _tmp27_; + gboolean _tmp28_ = FALSE; + _tmp18_ = left; + _tmp19_ = right; + if (!(_tmp18_ < _tmp19_)) { + break; + } + _tmp20_ = left; + _tmp21_ = right; + _tmp22_ = left; + p = _tmp20_ + ((_tmp21_ - _tmp22_) >> 1); + _tmp23_ = pivot; + _tmp24_ = a; + _tmp25_ = _tmp24_->list; + _tmp26_ = p; + _tmp27_ = _tmp25_[_tmp26_]; + _tmp28_ = gee_tim_sort_lower_than (self, _tmp23_, _tmp27_); + if (_tmp28_) { + gint _tmp29_; + _tmp29_ = p; + right = _tmp29_; + } else { + gint _tmp30_; + _tmp30_ = p; + left = _tmp30_ + 1; + } + } + _tmp31_ = left; + _tmp32_ = right; + _vala_assert (_tmp31_ == _tmp32_, "left == right"); + _tmp33_ = a; + _tmp34_ = _tmp33_->list; + _tmp35_ = left; + _tmp36_ = a; + _tmp37_ = _tmp36_->list; + _tmp38_ = left; + _tmp39_ = start; + _tmp40_ = left; + g_memmove (&_tmp34_[_tmp35_ + 1], &_tmp37_[_tmp38_], (gsize) (sizeof (gpointer) * (_tmp39_ - _tmp40_))); + _tmp41_ = a; + _tmp42_ = _tmp41_->list; + _tmp43_ = left; + _tmp44_ = pivot; + _tmp42_[_tmp43_] = _tmp44_; + _tmp45_ = _tmp42_[_tmp43_]; + } + } + } +} + + +static void gee_tim_sort_merge_collapse (GeeTimSort* self) { + GeeTimSortSlice** _tmp0_; + gint _tmp0__length1; + gint count; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->pending; + _tmp0__length1 = self->priv->pending_length1; + count = _tmp0__length1; + while (TRUE) { + gint _tmp1_; + gboolean _tmp2_ = FALSE; + gint _tmp3_; + gboolean _tmp16_; + GeeTimSortSlice** _tmp36_; + gint _tmp36__length1; + _tmp1_ = count; + if (!(_tmp1_ > 1)) { + break; + } + _tmp3_ = count; + if (_tmp3_ >= 3) { + GeeTimSortSlice** _tmp4_; + gint _tmp4__length1; + gint _tmp5_; + GeeTimSortSlice* _tmp6_; + gint _tmp7_; + GeeTimSortSlice** _tmp8_; + gint _tmp8__length1; + gint _tmp9_; + GeeTimSortSlice* _tmp10_; + gint _tmp11_; + GeeTimSortSlice** _tmp12_; + gint _tmp12__length1; + gint _tmp13_; + GeeTimSortSlice* _tmp14_; + gint _tmp15_; + _tmp4_ = self->priv->pending; + _tmp4__length1 = self->priv->pending_length1; + _tmp5_ = count; + _tmp6_ = _tmp4_[_tmp5_ - 3]; + _tmp7_ = _tmp6_->length; + _tmp8_ = self->priv->pending; + _tmp8__length1 = self->priv->pending_length1; + _tmp9_ = count; + _tmp10_ = _tmp8_[_tmp9_ - 2]; + _tmp11_ = _tmp10_->length; + _tmp12_ = self->priv->pending; + _tmp12__length1 = self->priv->pending_length1; + _tmp13_ = count; + _tmp14_ = _tmp12_[_tmp13_ - 1]; + _tmp15_ = _tmp14_->length; + _tmp2_ = _tmp7_ <= (_tmp11_ + _tmp15_); + } else { + _tmp2_ = FALSE; + } + _tmp16_ = _tmp2_; + if (_tmp16_) { + GeeTimSortSlice** _tmp17_; + gint _tmp17__length1; + gint _tmp18_; + GeeTimSortSlice* _tmp19_; + gint _tmp20_; + GeeTimSortSlice** _tmp21_; + gint _tmp21__length1; + gint _tmp22_; + GeeTimSortSlice* _tmp23_; + gint _tmp24_; + _tmp17_ = self->priv->pending; + _tmp17__length1 = self->priv->pending_length1; + _tmp18_ = count; + _tmp19_ = _tmp17_[_tmp18_ - 3]; + _tmp20_ = _tmp19_->length; + _tmp21_ = self->priv->pending; + _tmp21__length1 = self->priv->pending_length1; + _tmp22_ = count; + _tmp23_ = _tmp21_[_tmp22_ - 1]; + _tmp24_ = _tmp23_->length; + if (_tmp20_ < _tmp24_) { + gint _tmp25_; + _tmp25_ = count; + gee_tim_sort_merge_at (self, _tmp25_ - 3); + } else { + gint _tmp26_; + _tmp26_ = count; + gee_tim_sort_merge_at (self, _tmp26_ - 2); + } + } else { + GeeTimSortSlice** _tmp27_; + gint _tmp27__length1; + gint _tmp28_; + GeeTimSortSlice* _tmp29_; + gint _tmp30_; + GeeTimSortSlice** _tmp31_; + gint _tmp31__length1; + gint _tmp32_; + GeeTimSortSlice* _tmp33_; + gint _tmp34_; + _tmp27_ = self->priv->pending; + _tmp27__length1 = self->priv->pending_length1; + _tmp28_ = count; + _tmp29_ = _tmp27_[_tmp28_ - 2]; + _tmp30_ = _tmp29_->length; + _tmp31_ = self->priv->pending; + _tmp31__length1 = self->priv->pending_length1; + _tmp32_ = count; + _tmp33_ = _tmp31_[_tmp32_ - 1]; + _tmp34_ = _tmp33_->length; + if (_tmp30_ <= _tmp34_) { + gint _tmp35_; + _tmp35_ = count; + gee_tim_sort_merge_at (self, _tmp35_ - 2); + } else { + break; + } + } + _tmp36_ = self->priv->pending; + _tmp36__length1 = self->priv->pending_length1; + count = _tmp36__length1; + } +} + + +static void gee_tim_sort_merge_force_collapse (GeeTimSort* self) { + GeeTimSortSlice** _tmp0_; + gint _tmp0__length1; + gint count; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->pending; + _tmp0__length1 = self->priv->pending_length1; + count = _tmp0__length1; + while (TRUE) { + gint _tmp1_; + gboolean _tmp2_ = FALSE; + gint _tmp3_; + gboolean _tmp12_; + GeeTimSortSlice** _tmp15_; + gint _tmp15__length1; + _tmp1_ = count; + if (!(_tmp1_ > 1)) { + break; + } + _tmp3_ = count; + if (_tmp3_ >= 3) { + GeeTimSortSlice** _tmp4_; + gint _tmp4__length1; + gint _tmp5_; + GeeTimSortSlice* _tmp6_; + gint _tmp7_; + GeeTimSortSlice** _tmp8_; + gint _tmp8__length1; + gint _tmp9_; + GeeTimSortSlice* _tmp10_; + gint _tmp11_; + _tmp4_ = self->priv->pending; + _tmp4__length1 = self->priv->pending_length1; + _tmp5_ = count; + _tmp6_ = _tmp4_[_tmp5_ - 3]; + _tmp7_ = _tmp6_->length; + _tmp8_ = self->priv->pending; + _tmp8__length1 = self->priv->pending_length1; + _tmp9_ = count; + _tmp10_ = _tmp8_[_tmp9_ - 1]; + _tmp11_ = _tmp10_->length; + _tmp2_ = _tmp7_ < _tmp11_; + } else { + _tmp2_ = FALSE; + } + _tmp12_ = _tmp2_; + if (_tmp12_) { + gint _tmp13_; + _tmp13_ = count; + gee_tim_sort_merge_at (self, _tmp13_ - 3); + } else { + gint _tmp14_; + _tmp14_ = count; + gee_tim_sort_merge_at (self, _tmp14_ - 2); + } + _tmp15_ = self->priv->pending; + _tmp15__length1 = self->priv->pending_length1; + count = _tmp15__length1; + } +} + + +static void gee_tim_sort_merge_at (GeeTimSort* self, gint index) { + GeeTimSortSlice** _tmp0_; + gint _tmp0__length1; + gint _tmp1_; + GeeTimSortSlice* _tmp2_; + GeeTimSortSlice* a; + GeeTimSortSlice** _tmp3_; + gint _tmp3__length1; + gint _tmp4_; + GeeTimSortSlice* _tmp5_; + GeeTimSortSlice* b; + GeeTimSortSlice* _tmp6_; + gint _tmp7_; + GeeTimSortSlice* _tmp8_; + gint _tmp9_; + GeeTimSortSlice* _tmp10_; + gint _tmp11_; + GeeTimSortSlice* _tmp12_; + gint _tmp13_; + GeeTimSortSlice* _tmp14_; + gint _tmp15_; + GeeTimSortSlice** _tmp16_; + gint _tmp16__length1; + gint _tmp17_; + void** _tmp18_; + GeeTimSortSlice* _tmp19_; + gint _tmp20_; + GeeTimSortSlice* _tmp21_; + gint _tmp22_; + GeeTimSortSlice* _tmp23_; + gint _tmp24_; + GeeTimSortSlice* _tmp25_; + GeeTimSortSlice* _tmp26_; + gint _tmp27_; + gint _tmp28_; + GeeTimSortSlice** _tmp29_; + gint _tmp29__length1; + gint _tmp30_; + gint _tmp31_; + GeeTimSortSlice* _tmp32_; + void* _tmp33_ = NULL; + GeeTimSortSlice* _tmp34_; + gint _tmp35_ = 0; + gint sorted_count; + GeeTimSortSlice* _tmp36_; + gint _tmp37_; + GeeTimSortSlice* _tmp38_; + gint _tmp39_; + GeeTimSortSlice* _tmp40_; + GeeTimSortSlice* _tmp41_; + void* _tmp42_ = NULL; + GeeTimSortSlice* _tmp43_; + GeeTimSortSlice* _tmp44_; + gint _tmp45_; + gint _tmp46_ = 0; + GeeTimSortSlice* _tmp47_; + gint _tmp48_; + GeeTimSortSlice* _tmp49_; + gint _tmp50_; + GeeTimSortSlice* _tmp51_; + gint _tmp52_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->pending; + _tmp0__length1 = self->priv->pending_length1; + _tmp1_ = index; + _tmp2_ = _tmp0_[_tmp1_]; + _tmp0_[_tmp1_] = NULL; + a = _tmp2_; + _tmp3_ = self->priv->pending; + _tmp3__length1 = self->priv->pending_length1; + _tmp4_ = index; + _tmp5_ = _tmp3_[_tmp4_ + 1]; + _tmp3_[_tmp4_ + 1] = NULL; + b = _tmp5_; + _tmp6_ = a; + _tmp7_ = _tmp6_->length; + _vala_assert (_tmp7_ > 0, "a.length > 0"); + _tmp8_ = b; + _tmp9_ = _tmp8_->length; + _vala_assert (_tmp9_ > 0, "b.length > 0"); + _tmp10_ = a; + _tmp11_ = _tmp10_->index; + _tmp12_ = a; + _tmp13_ = _tmp12_->length; + _tmp14_ = b; + _tmp15_ = _tmp14_->index; + _vala_assert ((_tmp11_ + _tmp13_) == _tmp15_, "a.index + a.length == b.index"); + _tmp16_ = self->priv->pending; + _tmp16__length1 = self->priv->pending_length1; + _tmp17_ = index; + _tmp18_ = self->priv->list; + _tmp19_ = a; + _tmp20_ = _tmp19_->index; + _tmp21_ = a; + _tmp22_ = _tmp21_->length; + _tmp23_ = b; + _tmp24_ = _tmp23_->length; + _tmp25_ = gee_tim_sort_slice_new (_tmp18_, _tmp20_, _tmp22_ + _tmp24_); + _gee_tim_sort_slice_free0 (_tmp16_[_tmp17_]); + _tmp16_[_tmp17_] = _tmp25_; + _tmp26_ = _tmp16_[_tmp17_]; + _tmp27_ = index; + _tmp28_ = index; + _tmp29_ = self->priv->pending; + _tmp29__length1 = self->priv->pending_length1; + _tmp30_ = index; + _vala_array_move (self->priv->pending, sizeof (GeeTimSortSlice*), _tmp27_ + 2, _tmp28_ + 1, (_tmp29__length1 - _tmp30_) - 2); + self->priv->pending_length1 = self->priv->pending_length1 - 1; + _tmp31_ = self->priv->pending_length1; + _tmp32_ = b; + _tmp33_ = gee_tim_sort_slice_peek_first (_tmp32_); + _tmp34_ = a; + _tmp35_ = gee_tim_sort_gallop_rightmost (self, _tmp33_, _tmp34_, 0); + sorted_count = _tmp35_; + _tmp36_ = a; + _tmp37_ = sorted_count; + gee_tim_sort_slice_shorten_start (_tmp36_, _tmp37_); + _tmp38_ = a; + _tmp39_ = _tmp38_->length; + if (_tmp39_ == 0) { + _gee_tim_sort_slice_free0 (b); + _gee_tim_sort_slice_free0 (a); + return; + } + _tmp40_ = b; + _tmp41_ = a; + _tmp42_ = gee_tim_sort_slice_peek_last (_tmp41_); + _tmp43_ = b; + _tmp44_ = b; + _tmp45_ = _tmp44_->length; + _tmp46_ = gee_tim_sort_gallop_leftmost (self, _tmp42_, _tmp43_, _tmp45_ - 1); + _tmp40_->length = _tmp46_; + _tmp47_ = b; + _tmp48_ = _tmp47_->length; + if (_tmp48_ == 0) { + _gee_tim_sort_slice_free0 (b); + _gee_tim_sort_slice_free0 (a); + return; + } + _tmp49_ = a; + _tmp50_ = _tmp49_->length; + _tmp51_ = b; + _tmp52_ = _tmp51_->length; + if (_tmp50_ <= _tmp52_) { + GeeTimSortSlice* _tmp53_; + GeeTimSortSlice* _tmp54_; + _tmp53_ = a; + a = NULL; + _tmp54_ = b; + b = NULL; + gee_tim_sort_merge_low (self, _tmp53_, _tmp54_); + } else { + GeeTimSortSlice* _tmp55_; + GeeTimSortSlice* _tmp56_; + _tmp55_ = a; + a = NULL; + _tmp56_ = b; + b = NULL; + gee_tim_sort_merge_high (self, _tmp55_, _tmp56_); + } + _gee_tim_sort_slice_free0 (b); + _gee_tim_sort_slice_free0 (a); +} + + +static gint gee_tim_sort_gallop_leftmost (GeeTimSort* self, gconstpointer key, GeeTimSortSlice* a, gint hint) { + gint result = 0; + gint _tmp0_; + gint _tmp1_; + GeeTimSortSlice* _tmp2_; + gint _tmp3_; + GeeTimSortSlice* _tmp4_; + gint _tmp5_; + gint _tmp6_; + gint p; + gint last_offset; + gint offset; + GeeTimSortSlice* _tmp7_; + void** _tmp8_; + gint _tmp9_; + void* _tmp10_; + gconstpointer _tmp11_; + gboolean _tmp12_ = FALSE; + gint _tmp57_; + gint _tmp58_; + gint _tmp59_; + gint _tmp60_; + GeeTimSortSlice* _tmp61_; + gint _tmp62_; + gint _tmp63_; + gint _tmp79_; + gint _tmp80_; + g_return_val_if_fail (self != NULL, 0); + g_return_val_if_fail (a != NULL, 0); + _tmp0_ = hint; + _vala_assert (0 <= _tmp0_, "0 <= hint"); + _tmp1_ = hint; + _tmp2_ = a; + _tmp3_ = _tmp2_->length; + _vala_assert (_tmp1_ < _tmp3_, "hint < a.length"); + _tmp4_ = a; + _tmp5_ = _tmp4_->index; + _tmp6_ = hint; + p = _tmp5_ + _tmp6_; + last_offset = 0; + offset = 1; + _tmp7_ = a; + _tmp8_ = _tmp7_->list; + _tmp9_ = p; + _tmp10_ = _tmp8_[_tmp9_]; + _tmp11_ = key; + _tmp12_ = gee_tim_sort_lower_than (self, _tmp10_, _tmp11_); + if (_tmp12_) { + GeeTimSortSlice* _tmp13_; + gint _tmp14_; + gint _tmp15_; + gint max_offset; + gint _tmp28_; + gint _tmp29_; + gint _tmp31_; + gint _tmp32_; + gint _tmp33_; + gint _tmp34_; + _tmp13_ = a; + _tmp14_ = _tmp13_->length; + _tmp15_ = hint; + max_offset = _tmp14_ - _tmp15_; + while (TRUE) { + gint _tmp16_; + gint _tmp17_; + GeeTimSortSlice* _tmp18_; + void** _tmp19_; + gint _tmp20_; + gint _tmp21_; + void* _tmp22_; + gconstpointer _tmp23_; + gboolean _tmp24_ = FALSE; + _tmp16_ = offset; + _tmp17_ = max_offset; + if (!(_tmp16_ < _tmp17_)) { + break; + } + _tmp18_ = a; + _tmp19_ = _tmp18_->list; + _tmp20_ = p; + _tmp21_ = offset; + _tmp22_ = _tmp19_[_tmp20_ + _tmp21_]; + _tmp23_ = key; + _tmp24_ = gee_tim_sort_lower_than (self, _tmp22_, _tmp23_); + if (_tmp24_) { + gint _tmp25_; + gint _tmp26_; + gint _tmp27_; + _tmp25_ = offset; + last_offset = _tmp25_; + _tmp26_ = offset; + offset = _tmp26_ << 1; + _tmp27_ = offset; + offset = _tmp27_ + 1; + } else { + break; + } + } + _tmp28_ = offset; + _tmp29_ = max_offset; + if (_tmp28_ > _tmp29_) { + gint _tmp30_; + _tmp30_ = max_offset; + offset = _tmp30_; + } + _tmp31_ = hint; + _tmp32_ = last_offset; + last_offset = _tmp31_ + _tmp32_; + _tmp33_ = hint; + _tmp34_ = offset; + offset = _tmp33_ + _tmp34_; + } else { + gint _tmp35_; + gint max_offset; + gint _tmp48_; + gint _tmp49_; + gint _tmp51_; + gint temp_last_offset; + gint _tmp52_; + gint temp_offset; + gint _tmp53_; + gint _tmp54_; + gint _tmp55_; + gint _tmp56_; + _tmp35_ = hint; + max_offset = _tmp35_ + 1; + while (TRUE) { + gint _tmp36_; + gint _tmp37_; + GeeTimSortSlice* _tmp38_; + void** _tmp39_; + gint _tmp40_; + gint _tmp41_; + void* _tmp42_; + gconstpointer _tmp43_; + gboolean _tmp44_ = FALSE; + _tmp36_ = offset; + _tmp37_ = max_offset; + if (!(_tmp36_ < _tmp37_)) { + break; + } + _tmp38_ = a; + _tmp39_ = _tmp38_->list; + _tmp40_ = p; + _tmp41_ = offset; + _tmp42_ = _tmp39_[_tmp40_ - _tmp41_]; + _tmp43_ = key; + _tmp44_ = gee_tim_sort_lower_than (self, _tmp42_, _tmp43_); + if (_tmp44_) { + break; + } else { + gint _tmp45_; + gint _tmp46_; + gint _tmp47_; + _tmp45_ = offset; + last_offset = _tmp45_; + _tmp46_ = offset; + offset = _tmp46_ << 1; + _tmp47_ = offset; + offset = _tmp47_ + 1; + } + } + _tmp48_ = offset; + _tmp49_ = max_offset; + if (_tmp48_ > _tmp49_) { + gint _tmp50_; + _tmp50_ = max_offset; + offset = _tmp50_; + } + _tmp51_ = last_offset; + temp_last_offset = _tmp51_; + _tmp52_ = offset; + temp_offset = _tmp52_; + _tmp53_ = hint; + _tmp54_ = temp_offset; + last_offset = _tmp53_ - _tmp54_; + _tmp55_ = hint; + _tmp56_ = temp_last_offset; + offset = _tmp55_ - _tmp56_; + } + _tmp57_ = last_offset; + _vala_assert ((-1) <= _tmp57_, "-1 <= last_offset"); + _tmp58_ = last_offset; + _tmp59_ = offset; + _vala_assert (_tmp58_ < _tmp59_, "last_offset < offset"); + _tmp60_ = offset; + _tmp61_ = a; + _tmp62_ = _tmp61_->length; + _vala_assert (_tmp60_ <= _tmp62_, "offset <= a.length"); + _tmp63_ = last_offset; + last_offset = _tmp63_ + 1; + while (TRUE) { + gint _tmp64_; + gint _tmp65_; + gint _tmp66_; + gint _tmp67_; + gint _tmp68_; + gint m; + GeeTimSortSlice* _tmp69_; + void** _tmp70_; + GeeTimSortSlice* _tmp71_; + gint _tmp72_; + gint _tmp73_; + void* _tmp74_; + gconstpointer _tmp75_; + gboolean _tmp76_ = FALSE; + _tmp64_ = last_offset; + _tmp65_ = offset; + if (!(_tmp64_ < _tmp65_)) { + break; + } + _tmp66_ = last_offset; + _tmp67_ = offset; + _tmp68_ = last_offset; + m = _tmp66_ + ((_tmp67_ - _tmp68_) >> 1); + _tmp69_ = a; + _tmp70_ = _tmp69_->list; + _tmp71_ = a; + _tmp72_ = _tmp71_->index; + _tmp73_ = m; + _tmp74_ = _tmp70_[_tmp72_ + _tmp73_]; + _tmp75_ = key; + _tmp76_ = gee_tim_sort_lower_than (self, _tmp74_, _tmp75_); + if (_tmp76_) { + gint _tmp77_; + _tmp77_ = m; + last_offset = _tmp77_ + 1; + } else { + gint _tmp78_; + _tmp78_ = m; + offset = _tmp78_; + } + } + _tmp79_ = last_offset; + _tmp80_ = offset; + _vala_assert (_tmp79_ == _tmp80_, "last_offset == offset"); + result = offset; + return result; +} + + +static gint gee_tim_sort_gallop_rightmost (GeeTimSort* self, gconstpointer key, GeeTimSortSlice* a, gint hint) { + gint result = 0; + gint _tmp0_; + gint _tmp1_; + GeeTimSortSlice* _tmp2_; + gint _tmp3_; + GeeTimSortSlice* _tmp4_; + gint _tmp5_; + gint _tmp6_; + gint p; + gint last_offset; + gint offset; + GeeTimSortSlice* _tmp7_; + void** _tmp8_; + gint _tmp9_; + void* _tmp10_; + gconstpointer _tmp11_; + gboolean _tmp12_ = FALSE; + gint _tmp57_; + gint _tmp58_; + gint _tmp59_; + gint _tmp60_; + GeeTimSortSlice* _tmp61_; + gint _tmp62_; + gint _tmp63_; + gint _tmp79_; + gint _tmp80_; + g_return_val_if_fail (self != NULL, 0); + g_return_val_if_fail (a != NULL, 0); + _tmp0_ = hint; + _vala_assert (0 <= _tmp0_, "0 <= hint"); + _tmp1_ = hint; + _tmp2_ = a; + _tmp3_ = _tmp2_->length; + _vala_assert (_tmp1_ < _tmp3_, "hint < a.length"); + _tmp4_ = a; + _tmp5_ = _tmp4_->index; + _tmp6_ = hint; + p = _tmp5_ + _tmp6_; + last_offset = 0; + offset = 1; + _tmp7_ = a; + _tmp8_ = _tmp7_->list; + _tmp9_ = p; + _tmp10_ = _tmp8_[_tmp9_]; + _tmp11_ = key; + _tmp12_ = gee_tim_sort_lower_than_or_equal_to (self, _tmp10_, _tmp11_); + if (_tmp12_) { + GeeTimSortSlice* _tmp13_; + gint _tmp14_; + gint _tmp15_; + gint max_offset; + gint _tmp28_; + gint _tmp29_; + gint _tmp31_; + gint _tmp32_; + gint _tmp33_; + gint _tmp34_; + _tmp13_ = a; + _tmp14_ = _tmp13_->length; + _tmp15_ = hint; + max_offset = _tmp14_ - _tmp15_; + while (TRUE) { + gint _tmp16_; + gint _tmp17_; + GeeTimSortSlice* _tmp18_; + void** _tmp19_; + gint _tmp20_; + gint _tmp21_; + void* _tmp22_; + gconstpointer _tmp23_; + gboolean _tmp24_ = FALSE; + _tmp16_ = offset; + _tmp17_ = max_offset; + if (!(_tmp16_ < _tmp17_)) { + break; + } + _tmp18_ = a; + _tmp19_ = _tmp18_->list; + _tmp20_ = p; + _tmp21_ = offset; + _tmp22_ = _tmp19_[_tmp20_ + _tmp21_]; + _tmp23_ = key; + _tmp24_ = gee_tim_sort_lower_than_or_equal_to (self, _tmp22_, _tmp23_); + if (_tmp24_) { + gint _tmp25_; + gint _tmp26_; + gint _tmp27_; + _tmp25_ = offset; + last_offset = _tmp25_; + _tmp26_ = offset; + offset = _tmp26_ << 1; + _tmp27_ = offset; + offset = _tmp27_ + 1; + } else { + break; + } + } + _tmp28_ = offset; + _tmp29_ = max_offset; + if (_tmp28_ > _tmp29_) { + gint _tmp30_; + _tmp30_ = max_offset; + offset = _tmp30_; + } + _tmp31_ = hint; + _tmp32_ = last_offset; + last_offset = _tmp31_ + _tmp32_; + _tmp33_ = hint; + _tmp34_ = offset; + offset = _tmp33_ + _tmp34_; + } else { + gint _tmp35_; + gint max_offset; + gint _tmp48_; + gint _tmp49_; + gint _tmp51_; + gint temp_last_offset; + gint _tmp52_; + gint temp_offset; + gint _tmp53_; + gint _tmp54_; + gint _tmp55_; + gint _tmp56_; + _tmp35_ = hint; + max_offset = _tmp35_ + 1; + while (TRUE) { + gint _tmp36_; + gint _tmp37_; + GeeTimSortSlice* _tmp38_; + void** _tmp39_; + gint _tmp40_; + gint _tmp41_; + void* _tmp42_; + gconstpointer _tmp43_; + gboolean _tmp44_ = FALSE; + _tmp36_ = offset; + _tmp37_ = max_offset; + if (!(_tmp36_ < _tmp37_)) { + break; + } + _tmp38_ = a; + _tmp39_ = _tmp38_->list; + _tmp40_ = p; + _tmp41_ = offset; + _tmp42_ = _tmp39_[_tmp40_ - _tmp41_]; + _tmp43_ = key; + _tmp44_ = gee_tim_sort_lower_than_or_equal_to (self, _tmp42_, _tmp43_); + if (_tmp44_) { + break; + } else { + gint _tmp45_; + gint _tmp46_; + gint _tmp47_; + _tmp45_ = offset; + last_offset = _tmp45_; + _tmp46_ = offset; + offset = _tmp46_ << 1; + _tmp47_ = offset; + offset = _tmp47_ + 1; + } + } + _tmp48_ = offset; + _tmp49_ = max_offset; + if (_tmp48_ > _tmp49_) { + gint _tmp50_; + _tmp50_ = max_offset; + offset = _tmp50_; + } + _tmp51_ = last_offset; + temp_last_offset = _tmp51_; + _tmp52_ = offset; + temp_offset = _tmp52_; + _tmp53_ = hint; + _tmp54_ = temp_offset; + last_offset = _tmp53_ - _tmp54_; + _tmp55_ = hint; + _tmp56_ = temp_last_offset; + offset = _tmp55_ - _tmp56_; + } + _tmp57_ = last_offset; + _vala_assert ((-1) <= _tmp57_, "-1 <= last_offset"); + _tmp58_ = last_offset; + _tmp59_ = offset; + _vala_assert (_tmp58_ < _tmp59_, "last_offset < offset"); + _tmp60_ = offset; + _tmp61_ = a; + _tmp62_ = _tmp61_->length; + _vala_assert (_tmp60_ <= _tmp62_, "offset <= a.length"); + _tmp63_ = last_offset; + last_offset = _tmp63_ + 1; + while (TRUE) { + gint _tmp64_; + gint _tmp65_; + gint _tmp66_; + gint _tmp67_; + gint _tmp68_; + gint m; + GeeTimSortSlice* _tmp69_; + void** _tmp70_; + GeeTimSortSlice* _tmp71_; + gint _tmp72_; + gint _tmp73_; + void* _tmp74_; + gconstpointer _tmp75_; + gboolean _tmp76_ = FALSE; + _tmp64_ = last_offset; + _tmp65_ = offset; + if (!(_tmp64_ < _tmp65_)) { + break; + } + _tmp66_ = last_offset; + _tmp67_ = offset; + _tmp68_ = last_offset; + m = _tmp66_ + ((_tmp67_ - _tmp68_) >> 1); + _tmp69_ = a; + _tmp70_ = _tmp69_->list; + _tmp71_ = a; + _tmp72_ = _tmp71_->index; + _tmp73_ = m; + _tmp74_ = _tmp70_[_tmp72_ + _tmp73_]; + _tmp75_ = key; + _tmp76_ = gee_tim_sort_lower_than_or_equal_to (self, _tmp74_, _tmp75_); + if (_tmp76_) { + gint _tmp77_; + _tmp77_ = m; + last_offset = _tmp77_ + 1; + } else { + gint _tmp78_; + _tmp78_ = m; + offset = _tmp78_; + } + } + _tmp79_ = last_offset; + _tmp80_ = offset; + _vala_assert (_tmp79_ == _tmp80_, "last_offset == offset"); + result = offset; + return result; +} + + +static void gee_tim_sort_merge_low (GeeTimSort* self, GeeTimSortSlice* a, GeeTimSortSlice* b) { + GeeTimSortSlice* _tmp0_; + gint _tmp1_; + GeeTimSortSlice* _tmp2_; + gint _tmp3_; + GeeTimSortSlice* _tmp4_; + gint _tmp5_; + GeeTimSortSlice* _tmp6_; + gint _tmp7_; + GeeTimSortSlice* _tmp8_; + gint _tmp9_; + gint _tmp10_; + gint minimum_gallop; + GeeTimSortSlice* _tmp11_; + gint _tmp12_; + gint dest; + GeeTimSortSlice* _tmp13_; + GError * _inner_error_ = NULL; + g_return_if_fail (self != NULL); + g_return_if_fail (a != NULL); + g_return_if_fail (b != NULL); + _tmp0_ = a; + _tmp1_ = _tmp0_->length; + _vala_assert (_tmp1_ > 0, "a.length > 0"); + _tmp2_ = b; + _tmp3_ = _tmp2_->length; + _vala_assert (_tmp3_ > 0, "b.length > 0"); + _tmp4_ = a; + _tmp5_ = _tmp4_->index; + _tmp6_ = a; + _tmp7_ = _tmp6_->length; + _tmp8_ = b; + _tmp9_ = _tmp8_->index; + _vala_assert ((_tmp5_ + _tmp7_) == _tmp9_, "a.index + a.length == b.index"); + _tmp10_ = self->priv->minimum_gallop; + minimum_gallop = _tmp10_; + _tmp11_ = a; + _tmp12_ = _tmp11_->index; + dest = _tmp12_; + _tmp13_ = a; + gee_tim_sort_slice_copy (_tmp13_); + { + void** _tmp14_; + gint _tmp15_; + GeeTimSortSlice* _tmp16_; + void* _tmp17_ = NULL; + void* _tmp18_; + gboolean _tmp19_ = FALSE; + GeeTimSortSlice* _tmp20_; + gint _tmp21_; + gboolean _tmp24_; + _tmp14_ = self->priv->list; + _tmp15_ = dest; + dest = _tmp15_ + 1; + _tmp16_ = b; + _tmp17_ = gee_tim_sort_slice_pop_first (_tmp16_); + _tmp14_[_tmp15_] = _tmp17_; + _tmp18_ = _tmp14_[_tmp15_]; + _tmp20_ = a; + _tmp21_ = _tmp20_->length; + if (_tmp21_ == 1) { + _tmp19_ = TRUE; + } else { + GeeTimSortSlice* _tmp22_; + gint _tmp23_; + _tmp22_ = b; + _tmp23_ = _tmp22_->length; + _tmp19_ = _tmp23_ == 0; + } + _tmp24_ = _tmp19_; + if (_tmp24_) { + { + GeeTimSortSlice* _tmp25_; + gint _tmp26_; + GeeTimSortSlice* _tmp27_; + gint _tmp28_; + GeeTimSortSlice* _tmp29_; + void** _tmp30_; + GeeTimSortSlice* _tmp31_; + gint _tmp32_; + gint _tmp33_; + GeeTimSortSlice* _tmp34_; + gint _tmp35_; + GeeTimSortSlice* _tmp36_; + void** _tmp37_; + GeeTimSortSlice* _tmp38_; + gint _tmp39_; + gint _tmp40_; + GeeTimSortSlice* _tmp41_; + gint _tmp42_; + GeeTimSortSlice* _tmp43_; + gint _tmp44_; + _tmp25_ = a; + _tmp26_ = _tmp25_->length; + _vala_assert (_tmp26_ >= 0, "a.length >= 0"); + _tmp27_ = b; + _tmp28_ = _tmp27_->length; + _vala_assert (_tmp28_ >= 0, "b.length >= 0"); + _tmp29_ = b; + _tmp30_ = self->priv->list; + _tmp31_ = b; + _tmp32_ = _tmp31_->index; + _tmp33_ = dest; + _tmp34_ = b; + _tmp35_ = _tmp34_->length; + gee_tim_sort_slice_merge_in (_tmp29_, _tmp30_, _tmp32_, _tmp33_, _tmp35_); + _tmp36_ = a; + _tmp37_ = self->priv->list; + _tmp38_ = a; + _tmp39_ = _tmp38_->index; + _tmp40_ = dest; + _tmp41_ = b; + _tmp42_ = _tmp41_->length; + _tmp43_ = a; + _tmp44_ = _tmp43_->length; + gee_tim_sort_slice_merge_in (_tmp36_, _tmp37_, _tmp39_, _tmp40_ + _tmp42_, _tmp44_); + } + _gee_tim_sort_slice_free0 (a); + _gee_tim_sort_slice_free0 (b); + return; + } + while (TRUE) { + gint a_count; + gint b_count; + gint _tmp110_; + gint _tmp246_; + gint _tmp247_; + a_count = 0; + b_count = 0; + while (TRUE) { + GeeTimSortSlice* _tmp45_; + void* _tmp46_ = NULL; + GeeTimSortSlice* _tmp47_; + void* _tmp48_ = NULL; + gboolean _tmp49_ = FALSE; + _tmp45_ = b; + _tmp46_ = gee_tim_sort_slice_peek_first (_tmp45_); + _tmp47_ = a; + _tmp48_ = gee_tim_sort_slice_peek_first (_tmp47_); + _tmp49_ = gee_tim_sort_lower_than (self, _tmp46_, _tmp48_); + if (_tmp49_) { + void** _tmp50_; + gint _tmp51_; + GeeTimSortSlice* _tmp52_; + void* _tmp53_ = NULL; + void* _tmp54_; + GeeTimSortSlice* _tmp55_; + gint _tmp56_; + gint _tmp77_; + gint _tmp78_; + gint _tmp79_; + _tmp50_ = self->priv->list; + _tmp51_ = dest; + dest = _tmp51_ + 1; + _tmp52_ = b; + _tmp53_ = gee_tim_sort_slice_pop_first (_tmp52_); + _tmp50_[_tmp51_] = _tmp53_; + _tmp54_ = _tmp50_[_tmp51_]; + _tmp55_ = b; + _tmp56_ = _tmp55_->length; + if (_tmp56_ == 0) { + { + GeeTimSortSlice* _tmp57_; + gint _tmp58_; + GeeTimSortSlice* _tmp59_; + gint _tmp60_; + GeeTimSortSlice* _tmp61_; + void** _tmp62_; + GeeTimSortSlice* _tmp63_; + gint _tmp64_; + gint _tmp65_; + GeeTimSortSlice* _tmp66_; + gint _tmp67_; + GeeTimSortSlice* _tmp68_; + void** _tmp69_; + GeeTimSortSlice* _tmp70_; + gint _tmp71_; + gint _tmp72_; + GeeTimSortSlice* _tmp73_; + gint _tmp74_; + GeeTimSortSlice* _tmp75_; + gint _tmp76_; + _tmp57_ = a; + _tmp58_ = _tmp57_->length; + _vala_assert (_tmp58_ >= 0, "a.length >= 0"); + _tmp59_ = b; + _tmp60_ = _tmp59_->length; + _vala_assert (_tmp60_ >= 0, "b.length >= 0"); + _tmp61_ = b; + _tmp62_ = self->priv->list; + _tmp63_ = b; + _tmp64_ = _tmp63_->index; + _tmp65_ = dest; + _tmp66_ = b; + _tmp67_ = _tmp66_->length; + gee_tim_sort_slice_merge_in (_tmp61_, _tmp62_, _tmp64_, _tmp65_, _tmp67_); + _tmp68_ = a; + _tmp69_ = self->priv->list; + _tmp70_ = a; + _tmp71_ = _tmp70_->index; + _tmp72_ = dest; + _tmp73_ = b; + _tmp74_ = _tmp73_->length; + _tmp75_ = a; + _tmp76_ = _tmp75_->length; + gee_tim_sort_slice_merge_in (_tmp68_, _tmp69_, _tmp71_, _tmp72_ + _tmp74_, _tmp76_); + } + _gee_tim_sort_slice_free0 (a); + _gee_tim_sort_slice_free0 (b); + return; + } + _tmp77_ = b_count; + b_count = _tmp77_ + 1; + a_count = 0; + _tmp78_ = b_count; + _tmp79_ = minimum_gallop; + if (_tmp78_ >= _tmp79_) { + break; + } + } else { + void** _tmp80_; + gint _tmp81_; + GeeTimSortSlice* _tmp82_; + void* _tmp83_ = NULL; + void* _tmp84_; + GeeTimSortSlice* _tmp85_; + gint _tmp86_; + gint _tmp107_; + gint _tmp108_; + gint _tmp109_; + _tmp80_ = self->priv->list; + _tmp81_ = dest; + dest = _tmp81_ + 1; + _tmp82_ = a; + _tmp83_ = gee_tim_sort_slice_pop_first (_tmp82_); + _tmp80_[_tmp81_] = _tmp83_; + _tmp84_ = _tmp80_[_tmp81_]; + _tmp85_ = a; + _tmp86_ = _tmp85_->length; + if (_tmp86_ == 1) { + { + GeeTimSortSlice* _tmp87_; + gint _tmp88_; + GeeTimSortSlice* _tmp89_; + gint _tmp90_; + GeeTimSortSlice* _tmp91_; + void** _tmp92_; + GeeTimSortSlice* _tmp93_; + gint _tmp94_; + gint _tmp95_; + GeeTimSortSlice* _tmp96_; + gint _tmp97_; + GeeTimSortSlice* _tmp98_; + void** _tmp99_; + GeeTimSortSlice* _tmp100_; + gint _tmp101_; + gint _tmp102_; + GeeTimSortSlice* _tmp103_; + gint _tmp104_; + GeeTimSortSlice* _tmp105_; + gint _tmp106_; + _tmp87_ = a; + _tmp88_ = _tmp87_->length; + _vala_assert (_tmp88_ >= 0, "a.length >= 0"); + _tmp89_ = b; + _tmp90_ = _tmp89_->length; + _vala_assert (_tmp90_ >= 0, "b.length >= 0"); + _tmp91_ = b; + _tmp92_ = self->priv->list; + _tmp93_ = b; + _tmp94_ = _tmp93_->index; + _tmp95_ = dest; + _tmp96_ = b; + _tmp97_ = _tmp96_->length; + gee_tim_sort_slice_merge_in (_tmp91_, _tmp92_, _tmp94_, _tmp95_, _tmp97_); + _tmp98_ = a; + _tmp99_ = self->priv->list; + _tmp100_ = a; + _tmp101_ = _tmp100_->index; + _tmp102_ = dest; + _tmp103_ = b; + _tmp104_ = _tmp103_->length; + _tmp105_ = a; + _tmp106_ = _tmp105_->length; + gee_tim_sort_slice_merge_in (_tmp98_, _tmp99_, _tmp101_, _tmp102_ + _tmp104_, _tmp106_); + } + _gee_tim_sort_slice_free0 (a); + _gee_tim_sort_slice_free0 (b); + return; + } + _tmp107_ = a_count; + a_count = _tmp107_ + 1; + b_count = 0; + _tmp108_ = a_count; + _tmp109_ = minimum_gallop; + if (_tmp108_ >= _tmp109_) { + break; + } + } + } + _tmp110_ = minimum_gallop; + minimum_gallop = _tmp110_ + 1; + while (TRUE) { + gint _tmp111_ = 0; + gint _tmp112_; + gint _tmp113_; + gint _tmp114_; + gint _tmp115_; + GeeTimSortSlice* _tmp116_; + void* _tmp117_ = NULL; + GeeTimSortSlice* _tmp118_; + gint _tmp119_ = 0; + GeeTimSortSlice* _tmp120_; + void** _tmp121_; + GeeTimSortSlice* _tmp122_; + gint _tmp123_; + gint _tmp124_; + gint _tmp125_; + gint _tmp126_; + gint _tmp127_; + GeeTimSortSlice* _tmp128_; + gint _tmp129_; + GeeTimSortSlice* _tmp130_; + gint _tmp131_; + void** _tmp152_; + gint _tmp153_; + GeeTimSortSlice* _tmp154_; + void* _tmp155_ = NULL; + void* _tmp156_; + GeeTimSortSlice* _tmp157_; + gint _tmp158_; + GeeTimSortSlice* _tmp179_; + void* _tmp180_ = NULL; + GeeTimSortSlice* _tmp181_; + gint _tmp182_ = 0; + GeeTimSortSlice* _tmp183_; + void** _tmp184_; + GeeTimSortSlice* _tmp185_; + gint _tmp186_; + gint _tmp187_; + gint _tmp188_; + gint _tmp189_; + gint _tmp190_; + GeeTimSortSlice* _tmp191_; + gint _tmp192_; + GeeTimSortSlice* _tmp193_; + gint _tmp194_; + void** _tmp215_; + gint _tmp216_; + GeeTimSortSlice* _tmp217_; + void* _tmp218_ = NULL; + void* _tmp219_; + GeeTimSortSlice* _tmp220_; + gint _tmp221_; + gboolean _tmp242_ = FALSE; + gint _tmp243_; + gboolean _tmp245_; + _tmp112_ = minimum_gallop; + if (_tmp112_ > 1) { + _tmp111_ = 1; + } else { + _tmp111_ = 0; + } + _tmp113_ = minimum_gallop; + _tmp114_ = _tmp111_; + minimum_gallop = _tmp113_ - _tmp114_; + _tmp115_ = minimum_gallop; + self->priv->minimum_gallop = _tmp115_; + _tmp116_ = b; + _tmp117_ = gee_tim_sort_slice_peek_first (_tmp116_); + _tmp118_ = a; + _tmp119_ = gee_tim_sort_gallop_rightmost (self, _tmp117_, _tmp118_, 0); + a_count = _tmp119_; + _tmp120_ = a; + _tmp121_ = self->priv->list; + _tmp122_ = a; + _tmp123_ = _tmp122_->index; + _tmp124_ = dest; + _tmp125_ = a_count; + gee_tim_sort_slice_merge_in (_tmp120_, _tmp121_, _tmp123_, _tmp124_, _tmp125_); + _tmp126_ = dest; + _tmp127_ = a_count; + dest = _tmp126_ + _tmp127_; + _tmp128_ = a; + _tmp129_ = a_count; + gee_tim_sort_slice_shorten_start (_tmp128_, _tmp129_); + _tmp130_ = a; + _tmp131_ = _tmp130_->length; + if (_tmp131_ <= 1) { + { + GeeTimSortSlice* _tmp132_; + gint _tmp133_; + GeeTimSortSlice* _tmp134_; + gint _tmp135_; + GeeTimSortSlice* _tmp136_; + void** _tmp137_; + GeeTimSortSlice* _tmp138_; + gint _tmp139_; + gint _tmp140_; + GeeTimSortSlice* _tmp141_; + gint _tmp142_; + GeeTimSortSlice* _tmp143_; + void** _tmp144_; + GeeTimSortSlice* _tmp145_; + gint _tmp146_; + gint _tmp147_; + GeeTimSortSlice* _tmp148_; + gint _tmp149_; + GeeTimSortSlice* _tmp150_; + gint _tmp151_; + _tmp132_ = a; + _tmp133_ = _tmp132_->length; + _vala_assert (_tmp133_ >= 0, "a.length >= 0"); + _tmp134_ = b; + _tmp135_ = _tmp134_->length; + _vala_assert (_tmp135_ >= 0, "b.length >= 0"); + _tmp136_ = b; + _tmp137_ = self->priv->list; + _tmp138_ = b; + _tmp139_ = _tmp138_->index; + _tmp140_ = dest; + _tmp141_ = b; + _tmp142_ = _tmp141_->length; + gee_tim_sort_slice_merge_in (_tmp136_, _tmp137_, _tmp139_, _tmp140_, _tmp142_); + _tmp143_ = a; + _tmp144_ = self->priv->list; + _tmp145_ = a; + _tmp146_ = _tmp145_->index; + _tmp147_ = dest; + _tmp148_ = b; + _tmp149_ = _tmp148_->length; + _tmp150_ = a; + _tmp151_ = _tmp150_->length; + gee_tim_sort_slice_merge_in (_tmp143_, _tmp144_, _tmp146_, _tmp147_ + _tmp149_, _tmp151_); + } + _gee_tim_sort_slice_free0 (a); + _gee_tim_sort_slice_free0 (b); + return; + } + _tmp152_ = self->priv->list; + _tmp153_ = dest; + dest = _tmp153_ + 1; + _tmp154_ = b; + _tmp155_ = gee_tim_sort_slice_pop_first (_tmp154_); + _tmp152_[_tmp153_] = _tmp155_; + _tmp156_ = _tmp152_[_tmp153_]; + _tmp157_ = b; + _tmp158_ = _tmp157_->length; + if (_tmp158_ == 0) { + { + GeeTimSortSlice* _tmp159_; + gint _tmp160_; + GeeTimSortSlice* _tmp161_; + gint _tmp162_; + GeeTimSortSlice* _tmp163_; + void** _tmp164_; + GeeTimSortSlice* _tmp165_; + gint _tmp166_; + gint _tmp167_; + GeeTimSortSlice* _tmp168_; + gint _tmp169_; + GeeTimSortSlice* _tmp170_; + void** _tmp171_; + GeeTimSortSlice* _tmp172_; + gint _tmp173_; + gint _tmp174_; + GeeTimSortSlice* _tmp175_; + gint _tmp176_; + GeeTimSortSlice* _tmp177_; + gint _tmp178_; + _tmp159_ = a; + _tmp160_ = _tmp159_->length; + _vala_assert (_tmp160_ >= 0, "a.length >= 0"); + _tmp161_ = b; + _tmp162_ = _tmp161_->length; + _vala_assert (_tmp162_ >= 0, "b.length >= 0"); + _tmp163_ = b; + _tmp164_ = self->priv->list; + _tmp165_ = b; + _tmp166_ = _tmp165_->index; + _tmp167_ = dest; + _tmp168_ = b; + _tmp169_ = _tmp168_->length; + gee_tim_sort_slice_merge_in (_tmp163_, _tmp164_, _tmp166_, _tmp167_, _tmp169_); + _tmp170_ = a; + _tmp171_ = self->priv->list; + _tmp172_ = a; + _tmp173_ = _tmp172_->index; + _tmp174_ = dest; + _tmp175_ = b; + _tmp176_ = _tmp175_->length; + _tmp177_ = a; + _tmp178_ = _tmp177_->length; + gee_tim_sort_slice_merge_in (_tmp170_, _tmp171_, _tmp173_, _tmp174_ + _tmp176_, _tmp178_); + } + _gee_tim_sort_slice_free0 (a); + _gee_tim_sort_slice_free0 (b); + return; + } + _tmp179_ = a; + _tmp180_ = gee_tim_sort_slice_peek_first (_tmp179_); + _tmp181_ = b; + _tmp182_ = gee_tim_sort_gallop_leftmost (self, _tmp180_, _tmp181_, 0); + b_count = _tmp182_; + _tmp183_ = b; + _tmp184_ = self->priv->list; + _tmp185_ = b; + _tmp186_ = _tmp185_->index; + _tmp187_ = dest; + _tmp188_ = b_count; + gee_tim_sort_slice_merge_in (_tmp183_, _tmp184_, _tmp186_, _tmp187_, _tmp188_); + _tmp189_ = dest; + _tmp190_ = b_count; + dest = _tmp189_ + _tmp190_; + _tmp191_ = b; + _tmp192_ = b_count; + gee_tim_sort_slice_shorten_start (_tmp191_, _tmp192_); + _tmp193_ = b; + _tmp194_ = _tmp193_->length; + if (_tmp194_ == 0) { + { + GeeTimSortSlice* _tmp195_; + gint _tmp196_; + GeeTimSortSlice* _tmp197_; + gint _tmp198_; + GeeTimSortSlice* _tmp199_; + void** _tmp200_; + GeeTimSortSlice* _tmp201_; + gint _tmp202_; + gint _tmp203_; + GeeTimSortSlice* _tmp204_; + gint _tmp205_; + GeeTimSortSlice* _tmp206_; + void** _tmp207_; + GeeTimSortSlice* _tmp208_; + gint _tmp209_; + gint _tmp210_; + GeeTimSortSlice* _tmp211_; + gint _tmp212_; + GeeTimSortSlice* _tmp213_; + gint _tmp214_; + _tmp195_ = a; + _tmp196_ = _tmp195_->length; + _vala_assert (_tmp196_ >= 0, "a.length >= 0"); + _tmp197_ = b; + _tmp198_ = _tmp197_->length; + _vala_assert (_tmp198_ >= 0, "b.length >= 0"); + _tmp199_ = b; + _tmp200_ = self->priv->list; + _tmp201_ = b; + _tmp202_ = _tmp201_->index; + _tmp203_ = dest; + _tmp204_ = b; + _tmp205_ = _tmp204_->length; + gee_tim_sort_slice_merge_in (_tmp199_, _tmp200_, _tmp202_, _tmp203_, _tmp205_); + _tmp206_ = a; + _tmp207_ = self->priv->list; + _tmp208_ = a; + _tmp209_ = _tmp208_->index; + _tmp210_ = dest; + _tmp211_ = b; + _tmp212_ = _tmp211_->length; + _tmp213_ = a; + _tmp214_ = _tmp213_->length; + gee_tim_sort_slice_merge_in (_tmp206_, _tmp207_, _tmp209_, _tmp210_ + _tmp212_, _tmp214_); + } + _gee_tim_sort_slice_free0 (a); + _gee_tim_sort_slice_free0 (b); + return; + } + _tmp215_ = self->priv->list; + _tmp216_ = dest; + dest = _tmp216_ + 1; + _tmp217_ = a; + _tmp218_ = gee_tim_sort_slice_pop_first (_tmp217_); + _tmp215_[_tmp216_] = _tmp218_; + _tmp219_ = _tmp215_[_tmp216_]; + _tmp220_ = a; + _tmp221_ = _tmp220_->length; + if (_tmp221_ == 1) { + { + GeeTimSortSlice* _tmp222_; + gint _tmp223_; + GeeTimSortSlice* _tmp224_; + gint _tmp225_; + GeeTimSortSlice* _tmp226_; + void** _tmp227_; + GeeTimSortSlice* _tmp228_; + gint _tmp229_; + gint _tmp230_; + GeeTimSortSlice* _tmp231_; + gint _tmp232_; + GeeTimSortSlice* _tmp233_; + void** _tmp234_; + GeeTimSortSlice* _tmp235_; + gint _tmp236_; + gint _tmp237_; + GeeTimSortSlice* _tmp238_; + gint _tmp239_; + GeeTimSortSlice* _tmp240_; + gint _tmp241_; + _tmp222_ = a; + _tmp223_ = _tmp222_->length; + _vala_assert (_tmp223_ >= 0, "a.length >= 0"); + _tmp224_ = b; + _tmp225_ = _tmp224_->length; + _vala_assert (_tmp225_ >= 0, "b.length >= 0"); + _tmp226_ = b; + _tmp227_ = self->priv->list; + _tmp228_ = b; + _tmp229_ = _tmp228_->index; + _tmp230_ = dest; + _tmp231_ = b; + _tmp232_ = _tmp231_->length; + gee_tim_sort_slice_merge_in (_tmp226_, _tmp227_, _tmp229_, _tmp230_, _tmp232_); + _tmp233_ = a; + _tmp234_ = self->priv->list; + _tmp235_ = a; + _tmp236_ = _tmp235_->index; + _tmp237_ = dest; + _tmp238_ = b; + _tmp239_ = _tmp238_->length; + _tmp240_ = a; + _tmp241_ = _tmp240_->length; + gee_tim_sort_slice_merge_in (_tmp233_, _tmp234_, _tmp236_, _tmp237_ + _tmp239_, _tmp241_); + } + _gee_tim_sort_slice_free0 (a); + _gee_tim_sort_slice_free0 (b); + return; + } + _tmp243_ = a_count; + if (_tmp243_ < GEE_TIM_SORT_MINIMUM_GALLOP) { + gint _tmp244_; + _tmp244_ = b_count; + _tmp242_ = _tmp244_ < GEE_TIM_SORT_MINIMUM_GALLOP; + } else { + _tmp242_ = FALSE; + } + _tmp245_ = _tmp242_; + if (_tmp245_) { + break; + } + } + _tmp246_ = minimum_gallop; + minimum_gallop = _tmp246_ + 1; + _tmp247_ = minimum_gallop; + self->priv->minimum_gallop = _tmp247_; + } + } + __finally0: + { + GeeTimSortSlice* _tmp248_; + gint _tmp249_; + GeeTimSortSlice* _tmp250_; + gint _tmp251_; + GeeTimSortSlice* _tmp252_; + void** _tmp253_; + GeeTimSortSlice* _tmp254_; + gint _tmp255_; + gint _tmp256_; + GeeTimSortSlice* _tmp257_; + gint _tmp258_; + GeeTimSortSlice* _tmp259_; + void** _tmp260_; + GeeTimSortSlice* _tmp261_; + gint _tmp262_; + gint _tmp263_; + GeeTimSortSlice* _tmp264_; + gint _tmp265_; + GeeTimSortSlice* _tmp266_; + gint _tmp267_; + _tmp248_ = a; + _tmp249_ = _tmp248_->length; + _vala_assert (_tmp249_ >= 0, "a.length >= 0"); + _tmp250_ = b; + _tmp251_ = _tmp250_->length; + _vala_assert (_tmp251_ >= 0, "b.length >= 0"); + _tmp252_ = b; + _tmp253_ = self->priv->list; + _tmp254_ = b; + _tmp255_ = _tmp254_->index; + _tmp256_ = dest; + _tmp257_ = b; + _tmp258_ = _tmp257_->length; + gee_tim_sort_slice_merge_in (_tmp252_, _tmp253_, _tmp255_, _tmp256_, _tmp258_); + _tmp259_ = a; + _tmp260_ = self->priv->list; + _tmp261_ = a; + _tmp262_ = _tmp261_->index; + _tmp263_ = dest; + _tmp264_ = b; + _tmp265_ = _tmp264_->length; + _tmp266_ = a; + _tmp267_ = _tmp266_->length; + gee_tim_sort_slice_merge_in (_tmp259_, _tmp260_, _tmp262_, _tmp263_ + _tmp265_, _tmp267_); + } + _gee_tim_sort_slice_free0 (a); + _gee_tim_sort_slice_free0 (b); + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); + return; +} + + +static void gee_tim_sort_merge_high (GeeTimSort* self, GeeTimSortSlice* a, GeeTimSortSlice* b) { + GeeTimSortSlice* _tmp0_; + gint _tmp1_; + GeeTimSortSlice* _tmp2_; + gint _tmp3_; + GeeTimSortSlice* _tmp4_; + gint _tmp5_; + GeeTimSortSlice* _tmp6_; + gint _tmp7_; + GeeTimSortSlice* _tmp8_; + gint _tmp9_; + gint _tmp10_; + gint minimum_gallop; + GeeTimSortSlice* _tmp11_; + gint _tmp12_; + GeeTimSortSlice* _tmp13_; + gint _tmp14_; + gint dest; + GeeTimSortSlice* _tmp15_; + GError * _inner_error_ = NULL; + g_return_if_fail (self != NULL); + g_return_if_fail (a != NULL); + g_return_if_fail (b != NULL); + _tmp0_ = a; + _tmp1_ = _tmp0_->length; + _vala_assert (_tmp1_ > 0, "a.length > 0"); + _tmp2_ = b; + _tmp3_ = _tmp2_->length; + _vala_assert (_tmp3_ > 0, "b.length > 0"); + _tmp4_ = a; + _tmp5_ = _tmp4_->index; + _tmp6_ = a; + _tmp7_ = _tmp6_->length; + _tmp8_ = b; + _tmp9_ = _tmp8_->index; + _vala_assert ((_tmp5_ + _tmp7_) == _tmp9_, "a.index + a.length == b.index"); + _tmp10_ = self->priv->minimum_gallop; + minimum_gallop = _tmp10_; + _tmp11_ = b; + _tmp12_ = _tmp11_->index; + _tmp13_ = b; + _tmp14_ = _tmp13_->length; + dest = _tmp12_ + _tmp14_; + _tmp15_ = b; + gee_tim_sort_slice_copy (_tmp15_); + { + void** _tmp16_; + gint _tmp17_; + gint _tmp18_; + GeeTimSortSlice* _tmp19_; + void* _tmp20_ = NULL; + void* _tmp21_; + gboolean _tmp22_ = FALSE; + GeeTimSortSlice* _tmp23_; + gint _tmp24_; + gboolean _tmp27_; + _tmp16_ = self->priv->list; + _tmp17_ = dest; + dest = _tmp17_ - 1; + _tmp18_ = dest; + _tmp19_ = a; + _tmp20_ = gee_tim_sort_slice_pop_last (_tmp19_); + _tmp16_[_tmp18_] = _tmp20_; + _tmp21_ = _tmp16_[_tmp18_]; + _tmp23_ = a; + _tmp24_ = _tmp23_->length; + if (_tmp24_ == 0) { + _tmp22_ = TRUE; + } else { + GeeTimSortSlice* _tmp25_; + gint _tmp26_; + _tmp25_ = b; + _tmp26_ = _tmp25_->length; + _tmp22_ = _tmp26_ == 1; + } + _tmp27_ = _tmp22_; + if (_tmp27_) { + { + GeeTimSortSlice* _tmp28_; + gint _tmp29_; + GeeTimSortSlice* _tmp30_; + gint _tmp31_; + GeeTimSortSlice* _tmp32_; + void** _tmp33_; + GeeTimSortSlice* _tmp34_; + gint _tmp35_; + gint _tmp36_; + GeeTimSortSlice* _tmp37_; + gint _tmp38_; + GeeTimSortSlice* _tmp39_; + gint _tmp40_; + GeeTimSortSlice* _tmp41_; + void** _tmp42_; + GeeTimSortSlice* _tmp43_; + gint _tmp44_; + gint _tmp45_; + GeeTimSortSlice* _tmp46_; + gint _tmp47_; + GeeTimSortSlice* _tmp48_; + gint _tmp49_; + GeeTimSortSlice* _tmp50_; + gint _tmp51_; + _tmp28_ = a; + _tmp29_ = _tmp28_->length; + _vala_assert (_tmp29_ >= 0, "a.length >= 0"); + _tmp30_ = b; + _tmp31_ = _tmp30_->length; + _vala_assert (_tmp31_ >= 0, "b.length >= 0"); + _tmp32_ = a; + _tmp33_ = self->priv->list; + _tmp34_ = a; + _tmp35_ = _tmp34_->index; + _tmp36_ = dest; + _tmp37_ = a; + _tmp38_ = _tmp37_->length; + _tmp39_ = a; + _tmp40_ = _tmp39_->length; + gee_tim_sort_slice_merge_in_reversed (_tmp32_, _tmp33_, _tmp35_, _tmp36_ - _tmp38_, _tmp40_); + _tmp41_ = b; + _tmp42_ = self->priv->list; + _tmp43_ = b; + _tmp44_ = _tmp43_->index; + _tmp45_ = dest; + _tmp46_ = a; + _tmp47_ = _tmp46_->length; + _tmp48_ = b; + _tmp49_ = _tmp48_->length; + _tmp50_ = b; + _tmp51_ = _tmp50_->length; + gee_tim_sort_slice_merge_in_reversed (_tmp41_, _tmp42_, _tmp44_, (_tmp45_ - _tmp47_) - _tmp49_, _tmp51_); + } + _gee_tim_sort_slice_free0 (a); + _gee_tim_sort_slice_free0 (b); + return; + } + while (TRUE) { + gint a_count; + gint b_count; + gint _tmp127_; + gint _tmp295_; + gint _tmp296_; + a_count = 0; + b_count = 0; + while (TRUE) { + GeeTimSortSlice* _tmp52_; + void* _tmp53_ = NULL; + GeeTimSortSlice* _tmp54_; + void* _tmp55_ = NULL; + gboolean _tmp56_ = FALSE; + _tmp52_ = b; + _tmp53_ = gee_tim_sort_slice_peek_last (_tmp52_); + _tmp54_ = a; + _tmp55_ = gee_tim_sort_slice_peek_last (_tmp54_); + _tmp56_ = gee_tim_sort_lower_than (self, _tmp53_, _tmp55_); + if (_tmp56_) { + void** _tmp57_; + gint _tmp58_; + gint _tmp59_; + GeeTimSortSlice* _tmp60_; + void* _tmp61_ = NULL; + void* _tmp62_; + GeeTimSortSlice* _tmp63_; + gint _tmp64_; + gint _tmp89_; + gint _tmp90_; + gint _tmp91_; + _tmp57_ = self->priv->list; + _tmp58_ = dest; + dest = _tmp58_ - 1; + _tmp59_ = dest; + _tmp60_ = a; + _tmp61_ = gee_tim_sort_slice_pop_last (_tmp60_); + _tmp57_[_tmp59_] = _tmp61_; + _tmp62_ = _tmp57_[_tmp59_]; + _tmp63_ = a; + _tmp64_ = _tmp63_->length; + if (_tmp64_ == 0) { + { + GeeTimSortSlice* _tmp65_; + gint _tmp66_; + GeeTimSortSlice* _tmp67_; + gint _tmp68_; + GeeTimSortSlice* _tmp69_; + void** _tmp70_; + GeeTimSortSlice* _tmp71_; + gint _tmp72_; + gint _tmp73_; + GeeTimSortSlice* _tmp74_; + gint _tmp75_; + GeeTimSortSlice* _tmp76_; + gint _tmp77_; + GeeTimSortSlice* _tmp78_; + void** _tmp79_; + GeeTimSortSlice* _tmp80_; + gint _tmp81_; + gint _tmp82_; + GeeTimSortSlice* _tmp83_; + gint _tmp84_; + GeeTimSortSlice* _tmp85_; + gint _tmp86_; + GeeTimSortSlice* _tmp87_; + gint _tmp88_; + _tmp65_ = a; + _tmp66_ = _tmp65_->length; + _vala_assert (_tmp66_ >= 0, "a.length >= 0"); + _tmp67_ = b; + _tmp68_ = _tmp67_->length; + _vala_assert (_tmp68_ >= 0, "b.length >= 0"); + _tmp69_ = a; + _tmp70_ = self->priv->list; + _tmp71_ = a; + _tmp72_ = _tmp71_->index; + _tmp73_ = dest; + _tmp74_ = a; + _tmp75_ = _tmp74_->length; + _tmp76_ = a; + _tmp77_ = _tmp76_->length; + gee_tim_sort_slice_merge_in_reversed (_tmp69_, _tmp70_, _tmp72_, _tmp73_ - _tmp75_, _tmp77_); + _tmp78_ = b; + _tmp79_ = self->priv->list; + _tmp80_ = b; + _tmp81_ = _tmp80_->index; + _tmp82_ = dest; + _tmp83_ = a; + _tmp84_ = _tmp83_->length; + _tmp85_ = b; + _tmp86_ = _tmp85_->length; + _tmp87_ = b; + _tmp88_ = _tmp87_->length; + gee_tim_sort_slice_merge_in_reversed (_tmp78_, _tmp79_, _tmp81_, (_tmp82_ - _tmp84_) - _tmp86_, _tmp88_); + } + _gee_tim_sort_slice_free0 (a); + _gee_tim_sort_slice_free0 (b); + return; + } + _tmp89_ = a_count; + a_count = _tmp89_ + 1; + b_count = 0; + _tmp90_ = a_count; + _tmp91_ = minimum_gallop; + if (_tmp90_ >= _tmp91_) { + break; + } + } else { + void** _tmp92_; + gint _tmp93_; + gint _tmp94_; + GeeTimSortSlice* _tmp95_; + void* _tmp96_ = NULL; + void* _tmp97_; + GeeTimSortSlice* _tmp98_; + gint _tmp99_; + gint _tmp124_; + gint _tmp125_; + gint _tmp126_; + _tmp92_ = self->priv->list; + _tmp93_ = dest; + dest = _tmp93_ - 1; + _tmp94_ = dest; + _tmp95_ = b; + _tmp96_ = gee_tim_sort_slice_pop_last (_tmp95_); + _tmp92_[_tmp94_] = _tmp96_; + _tmp97_ = _tmp92_[_tmp94_]; + _tmp98_ = b; + _tmp99_ = _tmp98_->length; + if (_tmp99_ == 1) { + { + GeeTimSortSlice* _tmp100_; + gint _tmp101_; + GeeTimSortSlice* _tmp102_; + gint _tmp103_; + GeeTimSortSlice* _tmp104_; + void** _tmp105_; + GeeTimSortSlice* _tmp106_; + gint _tmp107_; + gint _tmp108_; + GeeTimSortSlice* _tmp109_; + gint _tmp110_; + GeeTimSortSlice* _tmp111_; + gint _tmp112_; + GeeTimSortSlice* _tmp113_; + void** _tmp114_; + GeeTimSortSlice* _tmp115_; + gint _tmp116_; + gint _tmp117_; + GeeTimSortSlice* _tmp118_; + gint _tmp119_; + GeeTimSortSlice* _tmp120_; + gint _tmp121_; + GeeTimSortSlice* _tmp122_; + gint _tmp123_; + _tmp100_ = a; + _tmp101_ = _tmp100_->length; + _vala_assert (_tmp101_ >= 0, "a.length >= 0"); + _tmp102_ = b; + _tmp103_ = _tmp102_->length; + _vala_assert (_tmp103_ >= 0, "b.length >= 0"); + _tmp104_ = a; + _tmp105_ = self->priv->list; + _tmp106_ = a; + _tmp107_ = _tmp106_->index; + _tmp108_ = dest; + _tmp109_ = a; + _tmp110_ = _tmp109_->length; + _tmp111_ = a; + _tmp112_ = _tmp111_->length; + gee_tim_sort_slice_merge_in_reversed (_tmp104_, _tmp105_, _tmp107_, _tmp108_ - _tmp110_, _tmp112_); + _tmp113_ = b; + _tmp114_ = self->priv->list; + _tmp115_ = b; + _tmp116_ = _tmp115_->index; + _tmp117_ = dest; + _tmp118_ = a; + _tmp119_ = _tmp118_->length; + _tmp120_ = b; + _tmp121_ = _tmp120_->length; + _tmp122_ = b; + _tmp123_ = _tmp122_->length; + gee_tim_sort_slice_merge_in_reversed (_tmp113_, _tmp114_, _tmp116_, (_tmp117_ - _tmp119_) - _tmp121_, _tmp123_); + } + _gee_tim_sort_slice_free0 (a); + _gee_tim_sort_slice_free0 (b); + return; + } + _tmp124_ = b_count; + b_count = _tmp124_ + 1; + a_count = 0; + _tmp125_ = b_count; + _tmp126_ = minimum_gallop; + if (_tmp125_ >= _tmp126_) { + break; + } + } + } + _tmp127_ = minimum_gallop; + minimum_gallop = _tmp127_ + 1; + while (TRUE) { + gint _tmp128_ = 0; + gint _tmp129_; + gint _tmp130_; + gint _tmp131_; + gint _tmp132_; + GeeTimSortSlice* _tmp133_; + void* _tmp134_ = NULL; + GeeTimSortSlice* _tmp135_; + GeeTimSortSlice* _tmp136_; + gint _tmp137_; + gint _tmp138_ = 0; + gint k; + GeeTimSortSlice* _tmp139_; + gint _tmp140_; + gint _tmp141_; + GeeTimSortSlice* _tmp142_; + void** _tmp143_; + GeeTimSortSlice* _tmp144_; + gint _tmp145_; + gint _tmp146_; + gint _tmp147_; + gint _tmp148_; + gint _tmp149_; + gint _tmp150_; + gint _tmp151_; + GeeTimSortSlice* _tmp152_; + gint _tmp153_; + GeeTimSortSlice* _tmp154_; + gint _tmp155_; + void** _tmp180_; + gint _tmp181_; + gint _tmp182_; + GeeTimSortSlice* _tmp183_; + void* _tmp184_ = NULL; + void* _tmp185_; + GeeTimSortSlice* _tmp186_; + gint _tmp187_; + GeeTimSortSlice* _tmp212_; + void* _tmp213_ = NULL; + GeeTimSortSlice* _tmp214_; + GeeTimSortSlice* _tmp215_; + gint _tmp216_; + gint _tmp217_ = 0; + GeeTimSortSlice* _tmp218_; + gint _tmp219_; + gint _tmp220_; + GeeTimSortSlice* _tmp221_; + void** _tmp222_; + GeeTimSortSlice* _tmp223_; + gint _tmp224_; + gint _tmp225_; + gint _tmp226_; + gint _tmp227_; + gint _tmp228_; + gint _tmp229_; + gint _tmp230_; + GeeTimSortSlice* _tmp231_; + gint _tmp232_; + GeeTimSortSlice* _tmp233_; + gint _tmp234_; + void** _tmp259_; + gint _tmp260_; + gint _tmp261_; + GeeTimSortSlice* _tmp262_; + void* _tmp263_ = NULL; + void* _tmp264_; + GeeTimSortSlice* _tmp265_; + gint _tmp266_; + gboolean _tmp291_ = FALSE; + gint _tmp292_; + gboolean _tmp294_; + _tmp129_ = minimum_gallop; + if (_tmp129_ > 1) { + _tmp128_ = 1; + } else { + _tmp128_ = 0; + } + _tmp130_ = minimum_gallop; + _tmp131_ = _tmp128_; + minimum_gallop = _tmp130_ - _tmp131_; + _tmp132_ = minimum_gallop; + self->priv->minimum_gallop = _tmp132_; + _tmp133_ = b; + _tmp134_ = gee_tim_sort_slice_peek_last (_tmp133_); + _tmp135_ = a; + _tmp136_ = a; + _tmp137_ = _tmp136_->length; + _tmp138_ = gee_tim_sort_gallop_rightmost (self, _tmp134_, _tmp135_, _tmp137_ - 1); + k = _tmp138_; + _tmp139_ = a; + _tmp140_ = _tmp139_->length; + _tmp141_ = k; + a_count = _tmp140_ - _tmp141_; + _tmp142_ = a; + _tmp143_ = self->priv->list; + _tmp144_ = a; + _tmp145_ = _tmp144_->index; + _tmp146_ = k; + _tmp147_ = dest; + _tmp148_ = a_count; + _tmp149_ = a_count; + gee_tim_sort_slice_merge_in_reversed (_tmp142_, _tmp143_, _tmp145_ + _tmp146_, _tmp147_ - _tmp148_, _tmp149_); + _tmp150_ = dest; + _tmp151_ = a_count; + dest = _tmp150_ - _tmp151_; + _tmp152_ = a; + _tmp153_ = a_count; + gee_tim_sort_slice_shorten_end (_tmp152_, _tmp153_); + _tmp154_ = a; + _tmp155_ = _tmp154_->length; + if (_tmp155_ == 0) { + { + GeeTimSortSlice* _tmp156_; + gint _tmp157_; + GeeTimSortSlice* _tmp158_; + gint _tmp159_; + GeeTimSortSlice* _tmp160_; + void** _tmp161_; + GeeTimSortSlice* _tmp162_; + gint _tmp163_; + gint _tmp164_; + GeeTimSortSlice* _tmp165_; + gint _tmp166_; + GeeTimSortSlice* _tmp167_; + gint _tmp168_; + GeeTimSortSlice* _tmp169_; + void** _tmp170_; + GeeTimSortSlice* _tmp171_; + gint _tmp172_; + gint _tmp173_; + GeeTimSortSlice* _tmp174_; + gint _tmp175_; + GeeTimSortSlice* _tmp176_; + gint _tmp177_; + GeeTimSortSlice* _tmp178_; + gint _tmp179_; + _tmp156_ = a; + _tmp157_ = _tmp156_->length; + _vala_assert (_tmp157_ >= 0, "a.length >= 0"); + _tmp158_ = b; + _tmp159_ = _tmp158_->length; + _vala_assert (_tmp159_ >= 0, "b.length >= 0"); + _tmp160_ = a; + _tmp161_ = self->priv->list; + _tmp162_ = a; + _tmp163_ = _tmp162_->index; + _tmp164_ = dest; + _tmp165_ = a; + _tmp166_ = _tmp165_->length; + _tmp167_ = a; + _tmp168_ = _tmp167_->length; + gee_tim_sort_slice_merge_in_reversed (_tmp160_, _tmp161_, _tmp163_, _tmp164_ - _tmp166_, _tmp168_); + _tmp169_ = b; + _tmp170_ = self->priv->list; + _tmp171_ = b; + _tmp172_ = _tmp171_->index; + _tmp173_ = dest; + _tmp174_ = a; + _tmp175_ = _tmp174_->length; + _tmp176_ = b; + _tmp177_ = _tmp176_->length; + _tmp178_ = b; + _tmp179_ = _tmp178_->length; + gee_tim_sort_slice_merge_in_reversed (_tmp169_, _tmp170_, _tmp172_, (_tmp173_ - _tmp175_) - _tmp177_, _tmp179_); + } + _gee_tim_sort_slice_free0 (a); + _gee_tim_sort_slice_free0 (b); + return; + } + _tmp180_ = self->priv->list; + _tmp181_ = dest; + dest = _tmp181_ - 1; + _tmp182_ = dest; + _tmp183_ = b; + _tmp184_ = gee_tim_sort_slice_pop_last (_tmp183_); + _tmp180_[_tmp182_] = _tmp184_; + _tmp185_ = _tmp180_[_tmp182_]; + _tmp186_ = b; + _tmp187_ = _tmp186_->length; + if (_tmp187_ == 1) { + { + GeeTimSortSlice* _tmp188_; + gint _tmp189_; + GeeTimSortSlice* _tmp190_; + gint _tmp191_; + GeeTimSortSlice* _tmp192_; + void** _tmp193_; + GeeTimSortSlice* _tmp194_; + gint _tmp195_; + gint _tmp196_; + GeeTimSortSlice* _tmp197_; + gint _tmp198_; + GeeTimSortSlice* _tmp199_; + gint _tmp200_; + GeeTimSortSlice* _tmp201_; + void** _tmp202_; + GeeTimSortSlice* _tmp203_; + gint _tmp204_; + gint _tmp205_; + GeeTimSortSlice* _tmp206_; + gint _tmp207_; + GeeTimSortSlice* _tmp208_; + gint _tmp209_; + GeeTimSortSlice* _tmp210_; + gint _tmp211_; + _tmp188_ = a; + _tmp189_ = _tmp188_->length; + _vala_assert (_tmp189_ >= 0, "a.length >= 0"); + _tmp190_ = b; + _tmp191_ = _tmp190_->length; + _vala_assert (_tmp191_ >= 0, "b.length >= 0"); + _tmp192_ = a; + _tmp193_ = self->priv->list; + _tmp194_ = a; + _tmp195_ = _tmp194_->index; + _tmp196_ = dest; + _tmp197_ = a; + _tmp198_ = _tmp197_->length; + _tmp199_ = a; + _tmp200_ = _tmp199_->length; + gee_tim_sort_slice_merge_in_reversed (_tmp192_, _tmp193_, _tmp195_, _tmp196_ - _tmp198_, _tmp200_); + _tmp201_ = b; + _tmp202_ = self->priv->list; + _tmp203_ = b; + _tmp204_ = _tmp203_->index; + _tmp205_ = dest; + _tmp206_ = a; + _tmp207_ = _tmp206_->length; + _tmp208_ = b; + _tmp209_ = _tmp208_->length; + _tmp210_ = b; + _tmp211_ = _tmp210_->length; + gee_tim_sort_slice_merge_in_reversed (_tmp201_, _tmp202_, _tmp204_, (_tmp205_ - _tmp207_) - _tmp209_, _tmp211_); + } + _gee_tim_sort_slice_free0 (a); + _gee_tim_sort_slice_free0 (b); + return; + } + _tmp212_ = a; + _tmp213_ = gee_tim_sort_slice_peek_last (_tmp212_); + _tmp214_ = b; + _tmp215_ = b; + _tmp216_ = _tmp215_->length; + _tmp217_ = gee_tim_sort_gallop_leftmost (self, _tmp213_, _tmp214_, _tmp216_ - 1); + k = _tmp217_; + _tmp218_ = b; + _tmp219_ = _tmp218_->length; + _tmp220_ = k; + b_count = _tmp219_ - _tmp220_; + _tmp221_ = b; + _tmp222_ = self->priv->list; + _tmp223_ = b; + _tmp224_ = _tmp223_->index; + _tmp225_ = k; + _tmp226_ = dest; + _tmp227_ = b_count; + _tmp228_ = b_count; + gee_tim_sort_slice_merge_in_reversed (_tmp221_, _tmp222_, _tmp224_ + _tmp225_, _tmp226_ - _tmp227_, _tmp228_); + _tmp229_ = dest; + _tmp230_ = b_count; + dest = _tmp229_ - _tmp230_; + _tmp231_ = b; + _tmp232_ = b_count; + gee_tim_sort_slice_shorten_end (_tmp231_, _tmp232_); + _tmp233_ = b; + _tmp234_ = _tmp233_->length; + if (_tmp234_ <= 1) { + { + GeeTimSortSlice* _tmp235_; + gint _tmp236_; + GeeTimSortSlice* _tmp237_; + gint _tmp238_; + GeeTimSortSlice* _tmp239_; + void** _tmp240_; + GeeTimSortSlice* _tmp241_; + gint _tmp242_; + gint _tmp243_; + GeeTimSortSlice* _tmp244_; + gint _tmp245_; + GeeTimSortSlice* _tmp246_; + gint _tmp247_; + GeeTimSortSlice* _tmp248_; + void** _tmp249_; + GeeTimSortSlice* _tmp250_; + gint _tmp251_; + gint _tmp252_; + GeeTimSortSlice* _tmp253_; + gint _tmp254_; + GeeTimSortSlice* _tmp255_; + gint _tmp256_; + GeeTimSortSlice* _tmp257_; + gint _tmp258_; + _tmp235_ = a; + _tmp236_ = _tmp235_->length; + _vala_assert (_tmp236_ >= 0, "a.length >= 0"); + _tmp237_ = b; + _tmp238_ = _tmp237_->length; + _vala_assert (_tmp238_ >= 0, "b.length >= 0"); + _tmp239_ = a; + _tmp240_ = self->priv->list; + _tmp241_ = a; + _tmp242_ = _tmp241_->index; + _tmp243_ = dest; + _tmp244_ = a; + _tmp245_ = _tmp244_->length; + _tmp246_ = a; + _tmp247_ = _tmp246_->length; + gee_tim_sort_slice_merge_in_reversed (_tmp239_, _tmp240_, _tmp242_, _tmp243_ - _tmp245_, _tmp247_); + _tmp248_ = b; + _tmp249_ = self->priv->list; + _tmp250_ = b; + _tmp251_ = _tmp250_->index; + _tmp252_ = dest; + _tmp253_ = a; + _tmp254_ = _tmp253_->length; + _tmp255_ = b; + _tmp256_ = _tmp255_->length; + _tmp257_ = b; + _tmp258_ = _tmp257_->length; + gee_tim_sort_slice_merge_in_reversed (_tmp248_, _tmp249_, _tmp251_, (_tmp252_ - _tmp254_) - _tmp256_, _tmp258_); + } + _gee_tim_sort_slice_free0 (a); + _gee_tim_sort_slice_free0 (b); + return; + } + _tmp259_ = self->priv->list; + _tmp260_ = dest; + dest = _tmp260_ - 1; + _tmp261_ = dest; + _tmp262_ = a; + _tmp263_ = gee_tim_sort_slice_pop_last (_tmp262_); + _tmp259_[_tmp261_] = _tmp263_; + _tmp264_ = _tmp259_[_tmp261_]; + _tmp265_ = a; + _tmp266_ = _tmp265_->length; + if (_tmp266_ == 0) { + { + GeeTimSortSlice* _tmp267_; + gint _tmp268_; + GeeTimSortSlice* _tmp269_; + gint _tmp270_; + GeeTimSortSlice* _tmp271_; + void** _tmp272_; + GeeTimSortSlice* _tmp273_; + gint _tmp274_; + gint _tmp275_; + GeeTimSortSlice* _tmp276_; + gint _tmp277_; + GeeTimSortSlice* _tmp278_; + gint _tmp279_; + GeeTimSortSlice* _tmp280_; + void** _tmp281_; + GeeTimSortSlice* _tmp282_; + gint _tmp283_; + gint _tmp284_; + GeeTimSortSlice* _tmp285_; + gint _tmp286_; + GeeTimSortSlice* _tmp287_; + gint _tmp288_; + GeeTimSortSlice* _tmp289_; + gint _tmp290_; + _tmp267_ = a; + _tmp268_ = _tmp267_->length; + _vala_assert (_tmp268_ >= 0, "a.length >= 0"); + _tmp269_ = b; + _tmp270_ = _tmp269_->length; + _vala_assert (_tmp270_ >= 0, "b.length >= 0"); + _tmp271_ = a; + _tmp272_ = self->priv->list; + _tmp273_ = a; + _tmp274_ = _tmp273_->index; + _tmp275_ = dest; + _tmp276_ = a; + _tmp277_ = _tmp276_->length; + _tmp278_ = a; + _tmp279_ = _tmp278_->length; + gee_tim_sort_slice_merge_in_reversed (_tmp271_, _tmp272_, _tmp274_, _tmp275_ - _tmp277_, _tmp279_); + _tmp280_ = b; + _tmp281_ = self->priv->list; + _tmp282_ = b; + _tmp283_ = _tmp282_->index; + _tmp284_ = dest; + _tmp285_ = a; + _tmp286_ = _tmp285_->length; + _tmp287_ = b; + _tmp288_ = _tmp287_->length; + _tmp289_ = b; + _tmp290_ = _tmp289_->length; + gee_tim_sort_slice_merge_in_reversed (_tmp280_, _tmp281_, _tmp283_, (_tmp284_ - _tmp286_) - _tmp288_, _tmp290_); + } + _gee_tim_sort_slice_free0 (a); + _gee_tim_sort_slice_free0 (b); + return; + } + _tmp292_ = a_count; + if (_tmp292_ < GEE_TIM_SORT_MINIMUM_GALLOP) { + gint _tmp293_; + _tmp293_ = b_count; + _tmp291_ = _tmp293_ < GEE_TIM_SORT_MINIMUM_GALLOP; + } else { + _tmp291_ = FALSE; + } + _tmp294_ = _tmp291_; + if (_tmp294_) { + break; + } + } + _tmp295_ = minimum_gallop; + minimum_gallop = _tmp295_ + 1; + _tmp296_ = minimum_gallop; + self->priv->minimum_gallop = _tmp296_; + } + } + __finally1: + { + GeeTimSortSlice* _tmp297_; + gint _tmp298_; + GeeTimSortSlice* _tmp299_; + gint _tmp300_; + GeeTimSortSlice* _tmp301_; + void** _tmp302_; + GeeTimSortSlice* _tmp303_; + gint _tmp304_; + gint _tmp305_; + GeeTimSortSlice* _tmp306_; + gint _tmp307_; + GeeTimSortSlice* _tmp308_; + gint _tmp309_; + GeeTimSortSlice* _tmp310_; + void** _tmp311_; + GeeTimSortSlice* _tmp312_; + gint _tmp313_; + gint _tmp314_; + GeeTimSortSlice* _tmp315_; + gint _tmp316_; + GeeTimSortSlice* _tmp317_; + gint _tmp318_; + GeeTimSortSlice* _tmp319_; + gint _tmp320_; + _tmp297_ = a; + _tmp298_ = _tmp297_->length; + _vala_assert (_tmp298_ >= 0, "a.length >= 0"); + _tmp299_ = b; + _tmp300_ = _tmp299_->length; + _vala_assert (_tmp300_ >= 0, "b.length >= 0"); + _tmp301_ = a; + _tmp302_ = self->priv->list; + _tmp303_ = a; + _tmp304_ = _tmp303_->index; + _tmp305_ = dest; + _tmp306_ = a; + _tmp307_ = _tmp306_->length; + _tmp308_ = a; + _tmp309_ = _tmp308_->length; + gee_tim_sort_slice_merge_in_reversed (_tmp301_, _tmp302_, _tmp304_, _tmp305_ - _tmp307_, _tmp309_); + _tmp310_ = b; + _tmp311_ = self->priv->list; + _tmp312_ = b; + _tmp313_ = _tmp312_->index; + _tmp314_ = dest; + _tmp315_ = a; + _tmp316_ = _tmp315_->length; + _tmp317_ = b; + _tmp318_ = _tmp317_->length; + _tmp319_ = b; + _tmp320_ = _tmp319_->length; + gee_tim_sort_slice_merge_in_reversed (_tmp310_, _tmp311_, _tmp313_, (_tmp314_ - _tmp316_) - _tmp318_, _tmp320_); + } + _gee_tim_sort_slice_free0 (a); + _gee_tim_sort_slice_free0 (b); + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); + return; +} + + +GeeTimSort* gee_tim_sort_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) { + GeeTimSort * self = NULL; + self = (GeeTimSort*) g_object_new (object_type, NULL); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + return self; +} + + +GeeTimSort* gee_tim_sort_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) { + return gee_tim_sort_construct (GEE_TYPE_TIM_SORT, g_type, g_dup_func, g_destroy_func); +} + + +static GeeTimSortSlice* gee_tim_sort_slice_new (void** list, gint index, gint length) { + GeeTimSortSlice* self; + void** _tmp0_; + gint _tmp1_; + gint _tmp2_; + self = g_slice_new0 (GeeTimSortSlice); + gee_tim_sort_slice_instance_init (self); + _tmp0_ = list; + self->list = _tmp0_; + _tmp1_ = index; + self->index = _tmp1_; + _tmp2_ = length; + self->length = _tmp2_; + return self; +} + + +static void gee_tim_sort_slice_copy (GeeTimSortSlice* self) { + void** _tmp0_; + gint _tmp1_; + gint _tmp2_; + void* _tmp3_ = NULL; + void** _tmp4_; + g_return_if_fail (self != NULL); + _tmp0_ = self->list; + _tmp1_ = self->index; + _tmp2_ = self->length; + _tmp3_ = g_memdup (&_tmp0_[_tmp1_], ((guint) sizeof (gpointer)) * _tmp2_); + self->new_list = _tmp3_; + _tmp4_ = self->new_list; + self->list = _tmp4_; + self->index = 0; +} + + +static inline void gee_tim_sort_slice_merge_in (GeeTimSortSlice* self, void** dest_array, gint index, gint dest_index, gint count) { + void** _tmp0_; + gint _tmp1_; + void** _tmp2_; + gint _tmp3_; + gint _tmp4_; + g_return_if_fail (self != NULL); + _tmp0_ = dest_array; + _tmp1_ = dest_index; + _tmp2_ = self->list; + _tmp3_ = index; + _tmp4_ = count; + g_memmove (&_tmp0_[_tmp1_], &_tmp2_[_tmp3_], (gsize) (sizeof (gpointer) * _tmp4_)); +} + + +static inline void gee_tim_sort_slice_merge_in_reversed (GeeTimSortSlice* self, void** dest_array, gint index, gint dest_index, gint count) { + void** _tmp0_; + gint _tmp1_; + void** _tmp2_; + gint _tmp3_; + gint _tmp4_; + g_return_if_fail (self != NULL); + _tmp0_ = dest_array; + _tmp1_ = dest_index; + _tmp2_ = self->list; + _tmp3_ = index; + _tmp4_ = count; + g_memmove (&_tmp0_[_tmp1_], &_tmp2_[_tmp3_], (gsize) (sizeof (gpointer) * _tmp4_)); +} + + +static inline void gee_tim_sort_slice_shorten_start (GeeTimSortSlice* self, gint n) { + gint _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint _tmp3_; + g_return_if_fail (self != NULL); + _tmp0_ = self->index; + _tmp1_ = n; + self->index = _tmp0_ + _tmp1_; + _tmp2_ = self->length; + _tmp3_ = n; + self->length = _tmp2_ - _tmp3_; +} + + +static inline void gee_tim_sort_slice_shorten_end (GeeTimSortSlice* self, gint n) { + gint _tmp0_; + gint _tmp1_; + g_return_if_fail (self != NULL); + _tmp0_ = self->length; + _tmp1_ = n; + self->length = _tmp0_ - _tmp1_; +} + + +static inline void* gee_tim_sort_slice_pop_first (GeeTimSortSlice* self) { + void* result = NULL; + gint _tmp0_; + void** _tmp1_; + gint _tmp2_; + void* _tmp3_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->length; + self->length = _tmp0_ - 1; + _tmp1_ = self->list; + _tmp2_ = self->index; + self->index = _tmp2_ + 1; + _tmp3_ = _tmp1_[_tmp2_]; + result = _tmp3_; + return result; +} + + +static inline void* gee_tim_sort_slice_pop_last (GeeTimSortSlice* self) { + void* result = NULL; + gint _tmp0_; + void** _tmp1_; + gint _tmp2_; + gint _tmp3_; + void* _tmp4_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->length; + self->length = _tmp0_ - 1; + _tmp1_ = self->list; + _tmp2_ = self->index; + _tmp3_ = self->length; + _tmp4_ = _tmp1_[_tmp2_ + _tmp3_]; + result = _tmp4_; + return result; +} + + +static inline void* gee_tim_sort_slice_peek_first (GeeTimSortSlice* self) { + void* result = NULL; + void** _tmp0_; + gint _tmp1_; + void* _tmp2_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->list; + _tmp1_ = self->index; + _tmp2_ = _tmp0_[_tmp1_]; + result = _tmp2_; + return result; +} + + +static inline void* gee_tim_sort_slice_peek_last (GeeTimSortSlice* self) { + void* result = NULL; + void** _tmp0_; + gint _tmp1_; + gint _tmp2_; + void* _tmp3_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->list; + _tmp1_ = self->index; + _tmp2_ = self->length; + _tmp3_ = _tmp0_[(_tmp1_ + _tmp2_) - 1]; + result = _tmp3_; + return result; +} + + +static void gee_tim_sort_slice_reverse (GeeTimSortSlice* self) { + gint _tmp0_; + gint low; + gint _tmp1_; + gint _tmp2_; + gint high; + g_return_if_fail (self != NULL); + _tmp0_ = self->index; + low = _tmp0_; + _tmp1_ = self->index; + _tmp2_ = self->length; + high = (_tmp1_ + _tmp2_) - 1; + while (TRUE) { + gint _tmp3_; + gint _tmp4_; + gint _tmp5_; + gint _tmp6_; + _tmp3_ = low; + _tmp4_ = high; + if (!(_tmp3_ < _tmp4_)) { + break; + } + _tmp5_ = low; + low = _tmp5_ + 1; + _tmp6_ = high; + high = _tmp6_ - 1; + gee_tim_sort_slice_swap (self, _tmp5_, _tmp6_); + } +} + + +static inline void gee_tim_sort_slice_swap (GeeTimSortSlice* self, gint i, gint j) { + void** _tmp0_; + gint _tmp1_; + void* _tmp2_; + void* temp; + void** _tmp3_; + gint _tmp4_; + void** _tmp5_; + gint _tmp6_; + void* _tmp7_; + void* _tmp8_; + void** _tmp9_; + gint _tmp10_; + void* _tmp11_; + g_return_if_fail (self != NULL); + _tmp0_ = self->list; + _tmp1_ = i; + _tmp2_ = _tmp0_[_tmp1_]; + temp = _tmp2_; + _tmp3_ = self->list; + _tmp4_ = i; + _tmp5_ = self->list; + _tmp6_ = j; + _tmp7_ = _tmp5_[_tmp6_]; + _tmp3_[_tmp4_] = _tmp7_; + _tmp8_ = _tmp3_[_tmp4_]; + _tmp9_ = self->list; + _tmp10_ = j; + _tmp9_[_tmp10_] = temp; + _tmp11_ = _tmp9_[_tmp10_]; +} + + +static void gee_tim_sort_slice_instance_init (GeeTimSortSlice * self) { +} + + +static void gee_tim_sort_slice_free (GeeTimSortSlice* self) { + void** _tmp0_; + _tmp0_ = self->new_list; + if (_tmp0_ != NULL) { + void** _tmp1_; + _tmp1_ = self->new_list; + g_free (_tmp1_); + } + g_slice_free (GeeTimSortSlice, self); +} + + +static void gee_tim_sort_class_init (GeeTimSortClass * klass) { + gee_tim_sort_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTimSortPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_tim_sort_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_tim_sort_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_tim_sort_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TIM_SORT_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TIM_SORT_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TIM_SORT_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_tim_sort_instance_init (GeeTimSort * self) { + self->priv = GEE_TIM_SORT_GET_PRIVATE (self); +} + + +static void gee_tim_sort_finalize (GObject* obj) { + GeeTimSort * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_TIM_SORT, GeeTimSort); + _g_object_unref0 (self->priv->list_collection); + self->priv->array = (_vala_array_free (self->priv->array, self->priv->array_length1, (GDestroyNotify) self->priv->g_destroy_func), NULL); + self->priv->pending = (_vala_array_free (self->priv->pending, self->priv->pending_length1, (GDestroyNotify) gee_tim_sort_slice_free), NULL); + (self->priv->compare_data_target_destroy_notify == NULL) ? NULL : (self->priv->compare_data_target_destroy_notify (self->priv->compare_data_target), NULL); + self->priv->compare_data = NULL; + self->priv->compare_data_target = NULL; + self->priv->compare_data_target_destroy_notify = NULL; + G_OBJECT_CLASS (gee_tim_sort_parent_class)->finalize (obj); +} + + +/** + * A stable, adaptive, iterative mergesort that requires far fewer than n*lg(n) + * comparisons when running on partially sorted arrays, while offering + * performance comparable to a traditional mergesort when run on random arrays. + * Like all proper mergesorts, this sort is stable and runs O(n*log(n)) time + * (worst case). In the worst case, this sort requires temporary storage space + * for n/2 object references; in the best case, it requires only a small + * constant amount of space. + * + * This implementation was adapted from Tim Peters's list sort for Python, + * which is described in detail here: + * [[http://svn.python.org/projects/python/trunk/Objects/listsort.txt]] + * + * Tim's C code may be found here: + * [[http://svn.python.org/projects/python/trunk/Objects/listobject.c]] + * + * The underlying techniques are described in this paper (and may have even + * earlier origins): + * + * "Optimistic Sorting and Information Theoretic Complexity" + * Peter McIlroy + * SODA (Fourth Annual ACM-SIAM Symposium on Discrete Algorithms), pp + * 467-474, Austin, Texas, 25-27 January 1993. + */ +GType gee_tim_sort_get_type (void) { + static volatile gsize gee_tim_sort_type_id__volatile = 0; + if (g_once_init_enter (&gee_tim_sort_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTimSortClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tim_sort_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTimSort), 0, (GInstanceInitFunc) gee_tim_sort_instance_init, NULL }; + GType gee_tim_sort_type_id; + gee_tim_sort_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeTimSort", &g_define_type_info, 0); + g_once_init_leave (&gee_tim_sort_type_id__volatile, gee_tim_sort_type_id); + } + return gee_tim_sort_type_id__volatile; +} + + +static void _vala_gee_tim_sort_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeTimSort * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_TIM_SORT, GeeTimSort); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_tim_sort_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeTimSort * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_TIM_SORT, GeeTimSort); + switch (property_id) { + case GEE_TIM_SORT_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_TIM_SORT_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_TIM_SORT_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + +static void _vala_array_move (gpointer array, gsize element_size, gint src, gint dest, gint length) { + g_memmove (((char*) array) + (dest * element_size), ((char*) array) + (src * element_size), length * element_size); + if ((src < dest) && ((src + length) > dest)) { + memset (((char*) array) + (src * element_size), 0, (dest - src) * element_size); + } else if ((src > dest) && (src < (dest + length))) { + memset (((char*) array) + ((dest + length) * element_size), 0, (src - dest) * element_size); + } else if (src != dest) { + memset (((char*) array) + (src * element_size), 0, length * element_size); + } +} + + + diff --git a/gee/timsort.vala b/gee/timsort.vala new file mode 100644 index 0000000..b1d8cc6 --- /dev/null +++ b/gee/timsort.vala @@ -0,0 +1,736 @@ +/* timsort.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +/** + * A stable, adaptive, iterative mergesort that requires far fewer than n*lg(n) + * comparisons when running on partially sorted arrays, while offering + * performance comparable to a traditional mergesort when run on random arrays. + * Like all proper mergesorts, this sort is stable and runs O(n*log(n)) time + * (worst case). In the worst case, this sort requires temporary storage space + * for n/2 object references; in the best case, it requires only a small + * constant amount of space. + * + * This implementation was adapted from Tim Peters's list sort for Python, + * which is described in detail here: + * [[http://svn.python.org/projects/python/trunk/Objects/listsort.txt]] + * + * Tim's C code may be found here: + * [[http://svn.python.org/projects/python/trunk/Objects/listobject.c]] + * + * The underlying techniques are described in this paper (and may have even + * earlier origins): + * + * "Optimistic Sorting and Information Theoretic Complexity" + * Peter McIlroy + * SODA (Fourth Annual ACM-SIAM Symposium on Discrete Algorithms), pp + * 467-474, Austin, Texas, 25-27 January 1993. + */ +internal class Gee.TimSort : Object { + + public static void sort (List list, CompareFunc compare) { + if (list is ArrayList) { + TimSort.sort_arraylist ((ArrayList) list, compare); + } else { + TimSort.sort_list (list, compare); + } + } + + public static void sort_with_data (List list, CompareDataFunc compare_data) { + if (list is ArrayList) { + TimSort.sort_arraylist ((ArrayList) list, null, compare_data); + } else { + TimSort.sort_list (list, null, compare_data); + } + } + + private static void sort_list (List list, CompareFunc? compare, CompareDataFunc? compare_data = null) { + assert (compare != null || compare_data != null); + + TimSort helper = new TimSort (); + + helper.list_collection = list; + helper.array = list.to_array (); + helper.list = helper.array; + helper.index = 0; + helper.size = list.size; + helper.compare = compare; + helper.compare_data = compare_data; + + helper.do_sort (); + + // TODO Use a list iterator and use iter.set (item) + list.clear (); + foreach (G item in helper.array) { + list.add (item); + } + } + + private static void sort_arraylist (ArrayList list, CompareFunc? compare, CompareDataFunc? compare_data = null) { + assert (compare != null || compare_data != null); + + TimSort helper = new TimSort (); + + helper.list_collection = list; + helper.list = list._items; + helper.index = 0; + helper.size = list._size; + helper.compare = compare; + helper.compare_data = compare_data; + + helper.do_sort (); + } + + private static const int MINIMUM_GALLOP = 7; + + private List list_collection; + private G[] array; + private void** list; + private int index; + private int size; + private Slice[] pending; + private int minimum_gallop; + private CompareFunc compare; + private CompareDataFunc compare_data; + + private void do_sort () { + if (size < 2) { + return; + } + + pending = new Slice[0]; + minimum_gallop = MINIMUM_GALLOP; + + Slice remaining = new Slice (list, index, size); + int minimum_length = compute_minimum_run_length (remaining.length); + + while (remaining.length > 0) { + // Get the next run + bool descending; + Slice run = compute_longest_run (remaining, out descending); + #if DEBUG + message ("New run (%d, %d) %s", run.index, run.length, + descending ? "descending" : "ascending"); + #endif + if (descending) { + run.reverse (); + } + + // Extend it to minimum_length, if needed + if (run.length < minimum_length) { + int sorted_count = run.length; + run.length = int.min (minimum_length, remaining.length); + insertion_sort (run, sorted_count); + #if DEBUG + message ("Extended to (%d, %d) and sorted from index %d", + run.index, run.length, sorted_count); + #endif + } + + // Move remaining after run + remaining.shorten_start (run.length); + + // Add run to pending runs and try to merge + pending += (owned) run; + merge_collapse (); + } + + assert (remaining.index == size); + + merge_force_collapse (); + + assert (pending.length == 1); + assert (pending[0].index == 0); + assert (pending[0].length == size); + } + + private delegate bool LowerFunc (G left, G right); + + private inline bool lower_than (G left, G right) { + if (compare != null) { + return compare (left, right) < 0; + } else { + return compare_data (left, right) < 0; + } + } + + private inline bool lower_than_or_equal_to (G left, G right) { + if (compare != null) { + return compare (left, right) <= 0; + } else { + return compare_data (left, right) <= 0; + } + } + + private int compute_minimum_run_length (int length) { + int run_length = 0; + while (length >= 64) { + run_length |= length & 1; + length >>= 1; + } + return length + run_length; + } + + private Slice compute_longest_run (Slice a, out bool descending) { + int run_length; + if (a.length <= 1) { + run_length = a.length; + descending = false; + } else { + run_length = 2; + if (lower_than (a.list[a.index + 1], a.list[a.index])) { + descending = true; + for (int i = a.index + 2; i < a.index + a.length; i++) { + if (lower_than (a.list[i], a.list[i-1])) { + run_length++; + } else { + break; + } + } + } else { + descending = false; + for (int i = a.index + 2; i < a.index + a.length; i++) { + if (lower_than (a.list[i], a.list[i-1])) { + break; + } else { + run_length++; + } + } + } + } + return new Slice (a.list, a.index, run_length); + } + + private void insertion_sort (Slice a, int offset) { + #if DEBUG + message ("Sorting (%d, %d) at %d", a.index, a.length, offset); + #endif + for (int start = a.index + offset; start < a.index + a.length; start++) { + int left = a.index; + int right = start; + void* pivot = a.list[right]; + + while (left < right) { + int p = left + ((right - left) >> 1); + if (lower_than (pivot, a.list[p])) { + right = p; + } else { + left = p + 1; + } + } + assert (left == right); + + Memory.move (&a.list[left + 1], &a.list[left], sizeof (G) * (start - left)); + a.list[left] = pivot; + } + } + + private void merge_collapse () { + #if DEBUG + message ("Merge Collapse"); + #endif + int count = pending.length; + while (count > 1) { + #if DEBUG + message ("Pending count: %d", count); + if (count >= 3) { + message ("pending[count-3]=%p; pending[count-2]=%p; pending[count-1]=%p", + pending[count-3], pending[count-2], pending[count-1]); + } + #endif + if (count >= 3 && pending[count-3].length <= pending[count-2].length + pending[count-1].length) { + if (pending[count-3].length < pending[count-1].length) { + merge_at (count-3); + } else { + merge_at (count-2); + } + } else if (pending[count-2].length <= pending[count-1].length) { + merge_at (count-2); + } else { + break; + } + count = pending.length; + #if DEBUG + message ("New pending count: %d", count); + #endif + } + } + + private void merge_force_collapse () { + #if DEBUG + message ("Merge Force Collapse"); + #endif + int count = pending.length; + #if DEBUG + message ("Pending count: %d", count); + #endif + while (count > 1) { + if (count >= 3 && pending[count-3].length < pending[count-1].length) { + merge_at (count-3); + } else { + merge_at (count-2); + } + count = pending.length; + #if DEBUG + message ("New pending count: %d", count); + #endif + } + } + + private void merge_at (int index) { + #if DEBUG + message ("Merge at %d", index); + #endif + Slice a = (owned) pending[index]; + Slice b = (owned) pending[index + 1]; + + assert (a.length > 0); + assert (b.length > 0); + assert (a.index + a.length == b.index); + + pending[index] = new Slice (list, a.index, a.length + b.length); + pending.move (index + 2, index + 1, pending.length - index - 2); + pending.length -= 1; + + int sorted_count = gallop_rightmost (b.peek_first (), a, 0); + a.shorten_start (sorted_count); + if (a.length == 0) { + return; + } + + b.length = gallop_leftmost (a.peek_last (), b, b.length - 1); + if (b.length == 0) { + return; + } + + if (a.length <= b.length) { + merge_low ((owned) a, (owned) b); + } else { + merge_high ((owned) a, (owned) b); + } + } + + private int gallop_leftmost (G key, Slice a, int hint) { + #if DEBUG + message ("Galop leftmost in (%d, %d), hint=%d", a.index, a.length, hint); + #endif + assert (0 <= hint); + assert (hint < a.length); + + int p = a.index + hint; + int last_offset = 0; + int offset = 1; + if (lower_than (a.list[p], key)) { + int max_offset = a.length - hint; + while (offset < max_offset) { + if (lower_than (a.list[p + offset], key)) { + last_offset = offset; + offset <<= 1; + offset++; + } else { + break; + } + } + + if (offset > max_offset) { + offset = max_offset; + } + + last_offset = hint + last_offset; + offset = hint + offset; + } else { + int max_offset = hint + 1; + while (offset < max_offset) { + if (lower_than (a.list[p - offset], key)) { + break; + } else { + last_offset = offset; + offset <<= 1; + offset++; + } + } + + if (offset > max_offset) { + offset = max_offset; + } + + int temp_last_offset = last_offset; + int temp_offset = offset; + last_offset = hint - temp_offset; + offset = hint - temp_last_offset; + } + + assert (-1 <= last_offset); + assert (last_offset < offset); + assert (offset <= a.length); + + last_offset += 1; + while (last_offset < offset) { + int m = last_offset + ((offset - last_offset) >> 1); + if (lower_than (a.list[a.index + m], key)) { + last_offset = m + 1; + } else { + offset = m; + } + } + + assert (last_offset == offset); + return offset; + } + + private int gallop_rightmost (G key, Slice a, int hint) { + #if DEBUG + message ("Galop rightmost in (%d, %d), hint=%d", a.index, a.length, hint); + #endif + assert (0 <= hint); + assert (hint < a.length); + + int p = a.index + hint; + int last_offset = 0; + int offset = 1; + if (lower_than_or_equal_to (a.list[p], key)) { + int max_offset = a.length - hint; + while (offset < max_offset) { + if (lower_than_or_equal_to (a.list[p + offset], key)) { + last_offset = offset; + offset <<= 1; + offset++; + } else { + break; + } + } + + if (offset > max_offset) { + offset = max_offset; + } + + last_offset = hint + last_offset; + offset = hint + offset; + } else { + int max_offset = hint + 1; + while (offset < max_offset) { + if (lower_than_or_equal_to (a.list[p - offset], key)) { + break; + } else { + last_offset = offset; + offset <<= 1; + offset++; + } + } + + if (offset > max_offset) { + offset = max_offset; + } + + int temp_last_offset = last_offset; + int temp_offset = offset; + last_offset = hint - temp_offset; + offset = hint - temp_last_offset; + } + + assert (-1 <= last_offset); + assert (last_offset < offset); + assert (offset <= a.length); + + last_offset += 1; + while (last_offset < offset) { + int m = last_offset + ((offset - last_offset) >> 1); + if (lower_than_or_equal_to (a.list[a.index + m], key)) { + last_offset = m + 1; + } else { + offset = m; + } + } + + assert (last_offset == offset); + return offset; + } + + private void merge_low (owned Slice a, owned Slice b) { + #if DEBUG + message ("Merge low (%d, %d) (%d, %d)", a.index, a.length, b.index, b.length); + #endif + assert (a.length > 0); + assert (b.length > 0); + assert (a.index + a.length == b.index); + + int minimum_gallop = this.minimum_gallop; + int dest = a.index; + a.copy (); + + try { + list[dest++] = b.pop_first (); + if (a.length == 1 || b.length == 0) { + return; + } + + while (true) { + int a_count = 0; + int b_count = 0; + + while (true) { + if (lower_than (b.peek_first (), a.peek_first ())) { + list[dest++] = b.pop_first (); + if (b.length == 0) { + return; + } + + b_count++; + a_count = 0; + if (b_count >= minimum_gallop) { + break; + } + } else { + list[dest++] = a.pop_first (); + if (a.length == 1) { + return; + } + + a_count++; + b_count = 0; + if (a_count >= minimum_gallop) { + break; + } + } + } + + minimum_gallop++; + + while (true) { + minimum_gallop -= (minimum_gallop > 1 ? 1 : 0); + this.minimum_gallop = minimum_gallop; + + a_count = gallop_rightmost (b.peek_first (), a, 0); + a.merge_in (list, a.index, dest, a_count); + dest += a_count; + a.shorten_start (a_count); + if (a.length <= 1) { + return; + } + + list[dest++] = b.pop_first (); + if (b.length == 0) { + return; + } + + b_count = gallop_leftmost (a.peek_first (), b, 0); + b.merge_in (list, b.index, dest, b_count); + dest += b_count; + b.shorten_start (b_count); + if (b.length == 0) { + return; + } + + list[dest++] = a.pop_first (); + if (a.length == 1) { + return; + } + + if (a_count < MINIMUM_GALLOP && b_count < MINIMUM_GALLOP) { + break; + } + } + + minimum_gallop++; + this.minimum_gallop = minimum_gallop; + } + } finally { + assert (a.length >= 0); + assert (b.length >= 0); + b.merge_in (list, b.index, dest, b.length); + a.merge_in (list, a.index, dest + b.length, a.length); + } + } + + private void merge_high (owned Slice a, owned Slice b) { + #if DEBUG + message ("Merge high (%d, %d) (%d, %d)", a.index, a.length, b.index, b.length); + #endif + assert (a.length > 0); + assert (b.length > 0); + assert (a.index + a.length == b.index); + + int minimum_gallop = this.minimum_gallop; + int dest = b.index + b.length; + b.copy (); + + try { + list[--dest] = a.pop_last (); + if (a.length == 0 || b.length == 1) { + return; + } + + while (true) { + int a_count = 0; + int b_count = 0; + + while (true) { + if (lower_than (b.peek_last (), a.peek_last ())) { + list[--dest] = a.pop_last (); + if (a.length == 0) { + return; + } + + a_count++; + b_count = 0; + if (a_count >= minimum_gallop) { + break; + } + } else { + list[--dest] = b.pop_last (); + if (b.length == 1) { + return; + } + + b_count++; + a_count = 0; + if (b_count >= minimum_gallop) { + break; + } + } + } + + minimum_gallop++; + + while (true) { + minimum_gallop -= (minimum_gallop > 1 ? 1 : 0); + this.minimum_gallop = minimum_gallop; + + int k = gallop_rightmost (b.peek_last (), a, a.length - 1); + a_count = a.length - k; + a.merge_in_reversed (list, a.index + k, dest - a_count, a_count); + dest -= a_count; + a.shorten_end (a_count); + if (a.length == 0) { + return; + } + + list[--dest] = b.pop_last (); + if (b.length == 1) { + return; + } + + k = gallop_leftmost (a.peek_last (), b, b.length - 1); + b_count = b.length - k; + b.merge_in_reversed (list, b.index + k, dest - b_count, b_count); + dest -= b_count; + b.shorten_end (b_count); + if (b.length <= 1) { + return; + } + + list[--dest] = a.pop_last (); + if (a.length == 0) { + return; + } + + if (a_count < MINIMUM_GALLOP && b_count < MINIMUM_GALLOP) { + break; + } + } + + minimum_gallop++; + this.minimum_gallop = minimum_gallop; + } + } finally { + assert (a.length >= 0); + assert (b.length >= 0); + a.merge_in_reversed (list, a.index, dest - a.length, a.length); + b.merge_in_reversed (list, b.index, dest - a.length - b.length, b.length); + } + } + + [Compact] + private class Slice { + + public void** list; + public void** new_list; + public int index; + public int length; + + public Slice (void** list, int index, int length) { + this.list = list; + this.index = index; + this.length = length; + } + + ~Slice () { + if (new_list != null) + free (new_list); + } + + public void copy () { + new_list = Memory.dup (&list[index], (uint) sizeof (G) * length); + list = new_list; + index = 0; + } + + public inline void merge_in (void** dest_array, int index, int dest_index, int count) { + Memory.move (&dest_array[dest_index], &list[index], sizeof (G) * count); + } + + public inline void merge_in_reversed (void** dest_array, int index, int dest_index, int count) { + Memory.move (&dest_array[dest_index], &list[index], sizeof (G) * count); + } + + public inline void shorten_start (int n) { + index += n; + length -= n; + } + + public inline void shorten_end (int n) { + length -= n; + } + + public inline void* pop_first () { + length--; + return list[index++]; + } + + public inline void* pop_last () { + length--; + return list[index + length]; + } + + public inline unowned void* peek_first () { + return list[index]; + } + + public inline unowned void* peek_last () { + return list[index + length - 1]; + } + + public void reverse () { + int low = index; + int high = index + length - 1; + while (low < high) { + swap (low++, high--); + } + } + + private inline void swap (int i, int j) { + void* temp = list[i]; + list[i] = list[j]; + list[j] = temp; + } + } +} + diff --git a/gee/treemap.c b/gee/treemap.c new file mode 100644 index 0000000..3836303 --- /dev/null +++ b/gee/treemap.c @@ -0,0 +1,4493 @@ +/* treemap.c generated by valac 0.18.0, the Vala compiler + * generated from treemap.vala, do not modify */ + +/* treemap.vala + * + * Copyright (C) 2009 Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Maciej Piechotka + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_MAP (gee_map_get_type ()) +#define GEE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP, GeeMap)) +#define GEE_IS_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP)) +#define GEE_MAP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP, GeeMapIface)) + +typedef struct _GeeMap GeeMap; +typedef struct _GeeMapIface GeeMapIface; + +#define GEE_TYPE_MAP_ITERATOR (gee_map_iterator_get_type ()) +#define GEE_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIterator)) +#define GEE_IS_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP_ITERATOR)) +#define GEE_MAP_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIteratorIface)) + +typedef struct _GeeMapIterator GeeMapIterator; +typedef struct _GeeMapIteratorIface GeeMapIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_MAP_TYPE_ENTRY (gee_map_entry_get_type ()) +#define GEE_MAP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntry)) +#define GEE_MAP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) +#define GEE_MAP_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) + +typedef struct _GeeMapEntry GeeMapEntry; +typedef struct _GeeMapEntryClass GeeMapEntryClass; + +#define GEE_TYPE_ABSTRACT_MAP (gee_abstract_map_get_type ()) +#define GEE_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap)) +#define GEE_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) +#define GEE_IS_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_IS_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_ABSTRACT_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) + +typedef struct _GeeAbstractMap GeeAbstractMap; +typedef struct _GeeAbstractMapClass GeeAbstractMapClass; +typedef struct _GeeAbstractMapPrivate GeeAbstractMapPrivate; + +#define GEE_TYPE_TREE_MAP (gee_tree_map_get_type ()) +#define GEE_TREE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TREE_MAP, GeeTreeMap)) +#define GEE_TREE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TREE_MAP, GeeTreeMapClass)) +#define GEE_IS_TREE_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TREE_MAP)) +#define GEE_IS_TREE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TREE_MAP)) +#define GEE_TREE_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TREE_MAP, GeeTreeMapClass)) + +typedef struct _GeeTreeMap GeeTreeMap; +typedef struct _GeeTreeMapClass GeeTreeMapClass; +typedef struct _GeeTreeMapPrivate GeeTreeMapPrivate; +typedef struct _GeeTreeMapNode GeeTreeMapNode; +#define _gee_tree_map_node_free0(var) ((var == NULL) ? NULL : (var = (gee_tree_map_node_free (var), NULL))) + +#define GEE_TREE_MAP_NODE_TYPE_COLOR (gee_tree_map_node_color_get_type ()) + +#define GEE_TREE_MAP_TYPE_NODE_ITERATOR (gee_tree_map_node_iterator_get_type ()) +#define GEE_TREE_MAP_NODE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TREE_MAP_TYPE_NODE_ITERATOR, GeeTreeMapNodeIterator)) +#define GEE_TREE_MAP_NODE_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TREE_MAP_TYPE_NODE_ITERATOR, GeeTreeMapNodeIteratorClass)) +#define GEE_TREE_MAP_IS_NODE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TREE_MAP_TYPE_NODE_ITERATOR)) +#define GEE_TREE_MAP_IS_NODE_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TREE_MAP_TYPE_NODE_ITERATOR)) +#define GEE_TREE_MAP_NODE_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TREE_MAP_TYPE_NODE_ITERATOR, GeeTreeMapNodeIteratorClass)) + +typedef struct _GeeTreeMapNodeIterator GeeTreeMapNodeIterator; +typedef struct _GeeTreeMapNodeIteratorClass GeeTreeMapNodeIteratorClass; + +#define GEE_TREE_MAP_TYPE_MAP_ITERATOR (gee_tree_map_map_iterator_get_type ()) +#define GEE_TREE_MAP_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TREE_MAP_TYPE_MAP_ITERATOR, GeeTreeMapMapIterator)) +#define GEE_TREE_MAP_MAP_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TREE_MAP_TYPE_MAP_ITERATOR, GeeTreeMapMapIteratorClass)) +#define GEE_TREE_MAP_IS_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TREE_MAP_TYPE_MAP_ITERATOR)) +#define GEE_TREE_MAP_IS_MAP_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TREE_MAP_TYPE_MAP_ITERATOR)) +#define GEE_TREE_MAP_MAP_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TREE_MAP_TYPE_MAP_ITERATOR, GeeTreeMapMapIteratorClass)) + +typedef struct _GeeTreeMapMapIterator GeeTreeMapMapIterator; +typedef struct _GeeTreeMapMapIteratorClass GeeTreeMapMapIteratorClass; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; + +#define GEE_TYPE_ABSTRACT_SET (gee_abstract_set_get_type ()) +#define GEE_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSet)) +#define GEE_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) +#define GEE_IS_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_SET)) +#define GEE_IS_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_SET)) +#define GEE_ABSTRACT_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) + +typedef struct _GeeAbstractSet GeeAbstractSet; +typedef struct _GeeAbstractSetClass GeeAbstractSetClass; + +#define GEE_TREE_MAP_TYPE_KEY_SET (gee_tree_map_key_set_get_type ()) +#define GEE_TREE_MAP_KEY_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TREE_MAP_TYPE_KEY_SET, GeeTreeMapKeySet)) +#define GEE_TREE_MAP_KEY_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TREE_MAP_TYPE_KEY_SET, GeeTreeMapKeySetClass)) +#define GEE_TREE_MAP_IS_KEY_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TREE_MAP_TYPE_KEY_SET)) +#define GEE_TREE_MAP_IS_KEY_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TREE_MAP_TYPE_KEY_SET)) +#define GEE_TREE_MAP_KEY_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TREE_MAP_TYPE_KEY_SET, GeeTreeMapKeySetClass)) + +typedef struct _GeeTreeMapKeySet GeeTreeMapKeySet; +typedef struct _GeeTreeMapKeySetClass GeeTreeMapKeySetClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define GEE_TREE_MAP_TYPE_VALUE_COLLECTION (gee_tree_map_value_collection_get_type ()) +#define GEE_TREE_MAP_VALUE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TREE_MAP_TYPE_VALUE_COLLECTION, GeeTreeMapValueCollection)) +#define GEE_TREE_MAP_VALUE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TREE_MAP_TYPE_VALUE_COLLECTION, GeeTreeMapValueCollectionClass)) +#define GEE_TREE_MAP_IS_VALUE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TREE_MAP_TYPE_VALUE_COLLECTION)) +#define GEE_TREE_MAP_IS_VALUE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TREE_MAP_TYPE_VALUE_COLLECTION)) +#define GEE_TREE_MAP_VALUE_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TREE_MAP_TYPE_VALUE_COLLECTION, GeeTreeMapValueCollectionClass)) + +typedef struct _GeeTreeMapValueCollection GeeTreeMapValueCollection; +typedef struct _GeeTreeMapValueCollectionClass GeeTreeMapValueCollectionClass; + +#define GEE_TREE_MAP_TYPE_ENTRY_SET (gee_tree_map_entry_set_get_type ()) +#define GEE_TREE_MAP_ENTRY_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TREE_MAP_TYPE_ENTRY_SET, GeeTreeMapEntrySet)) +#define GEE_TREE_MAP_ENTRY_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TREE_MAP_TYPE_ENTRY_SET, GeeTreeMapEntrySetClass)) +#define GEE_TREE_MAP_IS_ENTRY_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TREE_MAP_TYPE_ENTRY_SET)) +#define GEE_TREE_MAP_IS_ENTRY_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TREE_MAP_TYPE_ENTRY_SET)) +#define GEE_TREE_MAP_ENTRY_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TREE_MAP_TYPE_ENTRY_SET, GeeTreeMapEntrySetClass)) + +typedef struct _GeeTreeMapEntrySet GeeTreeMapEntrySet; +typedef struct _GeeTreeMapEntrySetClass GeeTreeMapEntrySetClass; +typedef struct _GeeMapEntryPrivate GeeMapEntryPrivate; + +#define GEE_TREE_MAP_TYPE_ENTRY (gee_tree_map_entry_get_type ()) +#define GEE_TREE_MAP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TREE_MAP_TYPE_ENTRY, GeeTreeMapEntry)) +#define GEE_TREE_MAP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TREE_MAP_TYPE_ENTRY, GeeTreeMapEntryClass)) +#define GEE_TREE_MAP_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TREE_MAP_TYPE_ENTRY)) +#define GEE_TREE_MAP_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TREE_MAP_TYPE_ENTRY)) +#define GEE_TREE_MAP_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TREE_MAP_TYPE_ENTRY, GeeTreeMapEntryClass)) + +typedef struct _GeeTreeMapEntry GeeTreeMapEntry; +typedef struct _GeeTreeMapEntryClass GeeTreeMapEntryClass; +typedef struct _GeeTreeMapEntryPrivate GeeTreeMapEntryPrivate; +typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate; +typedef struct _GeeAbstractSetPrivate GeeAbstractSetPrivate; +typedef struct _GeeTreeMapKeySetPrivate GeeTreeMapKeySetPrivate; + +#define GEE_TREE_MAP_TYPE_KEY_ITERATOR (gee_tree_map_key_iterator_get_type ()) +#define GEE_TREE_MAP_KEY_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TREE_MAP_TYPE_KEY_ITERATOR, GeeTreeMapKeyIterator)) +#define GEE_TREE_MAP_KEY_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TREE_MAP_TYPE_KEY_ITERATOR, GeeTreeMapKeyIteratorClass)) +#define GEE_TREE_MAP_IS_KEY_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TREE_MAP_TYPE_KEY_ITERATOR)) +#define GEE_TREE_MAP_IS_KEY_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TREE_MAP_TYPE_KEY_ITERATOR)) +#define GEE_TREE_MAP_KEY_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TREE_MAP_TYPE_KEY_ITERATOR, GeeTreeMapKeyIteratorClass)) + +typedef struct _GeeTreeMapKeyIterator GeeTreeMapKeyIterator; +typedef struct _GeeTreeMapKeyIteratorClass GeeTreeMapKeyIteratorClass; +typedef struct _GeeTreeMapValueCollectionPrivate GeeTreeMapValueCollectionPrivate; + +#define GEE_TREE_MAP_TYPE_VALUE_ITERATOR (gee_tree_map_value_iterator_get_type ()) +#define GEE_TREE_MAP_VALUE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TREE_MAP_TYPE_VALUE_ITERATOR, GeeTreeMapValueIterator)) +#define GEE_TREE_MAP_VALUE_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TREE_MAP_TYPE_VALUE_ITERATOR, GeeTreeMapValueIteratorClass)) +#define GEE_TREE_MAP_IS_VALUE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TREE_MAP_TYPE_VALUE_ITERATOR)) +#define GEE_TREE_MAP_IS_VALUE_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TREE_MAP_TYPE_VALUE_ITERATOR)) +#define GEE_TREE_MAP_VALUE_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TREE_MAP_TYPE_VALUE_ITERATOR, GeeTreeMapValueIteratorClass)) + +typedef struct _GeeTreeMapValueIterator GeeTreeMapValueIterator; +typedef struct _GeeTreeMapValueIteratorClass GeeTreeMapValueIteratorClass; +typedef struct _GeeTreeMapEntrySetPrivate GeeTreeMapEntrySetPrivate; + +#define GEE_TREE_MAP_TYPE_ENTRY_ITERATOR (gee_tree_map_entry_iterator_get_type ()) +#define GEE_TREE_MAP_ENTRY_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TREE_MAP_TYPE_ENTRY_ITERATOR, GeeTreeMapEntryIterator)) +#define GEE_TREE_MAP_ENTRY_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TREE_MAP_TYPE_ENTRY_ITERATOR, GeeTreeMapEntryIteratorClass)) +#define GEE_TREE_MAP_IS_ENTRY_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TREE_MAP_TYPE_ENTRY_ITERATOR)) +#define GEE_TREE_MAP_IS_ENTRY_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TREE_MAP_TYPE_ENTRY_ITERATOR)) +#define GEE_TREE_MAP_ENTRY_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TREE_MAP_TYPE_ENTRY_ITERATOR, GeeTreeMapEntryIteratorClass)) + +typedef struct _GeeTreeMapEntryIterator GeeTreeMapEntryIterator; +typedef struct _GeeTreeMapEntryIteratorClass GeeTreeMapEntryIteratorClass; +typedef struct _GeeTreeMapNodeIteratorPrivate GeeTreeMapNodeIteratorPrivate; + +#define GEE_TYPE_BIDIR_ITERATOR (gee_bidir_iterator_get_type ()) +#define GEE_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIterator)) +#define GEE_IS_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_ITERATOR)) +#define GEE_BIDIR_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIteratorIface)) + +typedef struct _GeeBidirIterator GeeBidirIterator; +typedef struct _GeeBidirIteratorIface GeeBidirIteratorIface; +typedef struct _GeeTreeMapKeyIteratorPrivate GeeTreeMapKeyIteratorPrivate; +typedef struct _GeeTreeMapValueIteratorPrivate GeeTreeMapValueIteratorPrivate; +typedef struct _GeeTreeMapEntryIteratorPrivate GeeTreeMapEntryIteratorPrivate; +typedef struct _GeeTreeMapMapIteratorPrivate GeeTreeMapMapIteratorPrivate; +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeMapIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeMapIterator* self); + gboolean (*has_next) (GeeMapIterator* self); + gboolean (*first) (GeeMapIterator* self); + gpointer (*get_key) (GeeMapIterator* self); + gpointer (*get_value) (GeeMapIterator* self); + void (*set_value) (GeeMapIterator* self, gconstpointer value); + void (*unset) (GeeMapIterator* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeMapIface { + GTypeInterface parent_iface; + gboolean (*has_key) (GeeMap* self, gconstpointer key); + gboolean (*contains) (GeeMap* self, gconstpointer key); + gboolean (*has) (GeeMap* self, gconstpointer key, gconstpointer value); + gpointer (*get) (GeeMap* self, gconstpointer key); + void (*set) (GeeMap* self, gconstpointer key, gconstpointer value); + gboolean (*unset) (GeeMap* self, gconstpointer key, gpointer* value); + gboolean (*remove) (GeeMap* self, gconstpointer key, gpointer* value); + void (*clear) (GeeMap* self); + GeeMapIterator* (*map_iterator) (GeeMap* self); + void (*set_all) (GeeMap* self, GeeMap* map); + gboolean (*unset_all) (GeeMap* self, GeeMap* map); + gboolean (*remove_all) (GeeMap* self, GeeMap* map); + gboolean (*has_all) (GeeMap* self, GeeMap* map); + gboolean (*contains_all) (GeeMap* self, GeeMap* map); + gint (*get_size) (GeeMap* self); + gboolean (*get_is_empty) (GeeMap* self); + GeeSet* (*get_keys) (GeeMap* self); + GeeCollection* (*get_values) (GeeMap* self); + GeeSet* (*get_entries) (GeeMap* self); + GeeMap* (*get_read_only_view) (GeeMap* self); + GType (*get_key_type) (GeeMap* self); + GType (*get_value_type) (GeeMap* self); +}; + +struct _GeeAbstractMap { + GObject parent_instance; + GeeAbstractMapPrivate * priv; +}; + +struct _GeeAbstractMapClass { + GObjectClass parent_class; + gboolean (*has_key) (GeeAbstractMap* self, gconstpointer key); + gboolean (*has) (GeeAbstractMap* self, gconstpointer key, gconstpointer value); + gpointer (*get) (GeeAbstractMap* self, gconstpointer key); + void (*set) (GeeAbstractMap* self, gconstpointer key, gconstpointer value); + gboolean (*unset) (GeeAbstractMap* self, gconstpointer key, gpointer* value); + GeeMapIterator* (*map_iterator) (GeeAbstractMap* self); + void (*clear) (GeeAbstractMap* self); + void (*set_all) (GeeAbstractMap* self, GeeMap* map); + gboolean (*unset_all) (GeeAbstractMap* self, GeeMap* map); + gboolean (*has_all) (GeeAbstractMap* self, GeeMap* map); + gint (*get_size) (GeeAbstractMap* self); + gboolean (*get_is_empty) (GeeAbstractMap* self); + GeeSet* (*get_keys) (GeeAbstractMap* self); + GeeCollection* (*get_values) (GeeAbstractMap* self); + GeeSet* (*get_entries) (GeeAbstractMap* self); + GeeMap* (*get_read_only_view) (GeeAbstractMap* self); +}; + +struct _GeeTreeMap { + GeeAbstractMap parent_instance; + GeeTreeMapPrivate * priv; +}; + +struct _GeeTreeMapClass { + GeeAbstractMapClass parent_class; +}; + +struct _GeeTreeMapPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + GCompareFunc _key_compare_func; + GEqualFunc _value_equal_func; + gint _size; + GeeSet* _keys; + GeeCollection* _values; + GeeSet* _entries; + GeeTreeMapNode* root; + GeeTreeMapNode* first; + GeeTreeMapNode* last; + gint stamp; +}; + +typedef enum { + GEE_TREE_MAP_NODE_COLOR_RED, + GEE_TREE_MAP_NODE_COLOR_BLACK +} GeeTreeMapNodeColor; + +struct _GeeTreeMapNode { + gpointer key; + gpointer value; + GeeTreeMapNodeColor color; + GeeTreeMapNode* left; + GeeTreeMapNode* right; + GeeTreeMapNode* prev; + GeeTreeMapNode* next; + GeeMapEntry* entry; +}; + +struct _GeeMapEntry { + GObject parent_instance; + GeeMapEntryPrivate * priv; +}; + +struct _GeeMapEntryClass { + GObjectClass parent_class; + gconstpointer (*get_key) (GeeMapEntry* self); + gconstpointer (*get_value) (GeeMapEntry* self); + void (*set_value) (GeeMapEntry* self, gconstpointer value); +}; + +struct _GeeTreeMapEntry { + GeeMapEntry parent_instance; + GeeTreeMapEntryPrivate * priv; +}; + +struct _GeeTreeMapEntryClass { + GeeMapEntryClass parent_class; +}; + +struct _GeeTreeMapEntryPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + GeeTreeMapNode* _node; +}; + +struct _GeeAbstractCollection { + GObject parent_instance; + GeeAbstractCollectionPrivate * priv; +}; + +struct _GeeAbstractCollectionClass { + GObjectClass parent_class; + gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*add) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item); + void (*clear) (GeeAbstractCollection* self); + gpointer* (*to_array) (GeeAbstractCollection* self, int* result_length1); + gboolean (*add_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeAbstractCollection* self, GeeCollection* collection); + GeeIterator* (*iterator) (GeeAbstractCollection* self); + gint (*get_size) (GeeAbstractCollection* self); + gboolean (*get_is_empty) (GeeAbstractCollection* self); + GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self); +}; + +struct _GeeAbstractSet { + GeeAbstractCollection parent_instance; + GeeAbstractSetPrivate * priv; +}; + +struct _GeeAbstractSetClass { + GeeAbstractCollectionClass parent_class; + GeeSet* (*get_read_only_view) (GeeAbstractSet* self); +}; + +struct _GeeTreeMapKeySet { + GeeAbstractSet parent_instance; + GeeTreeMapKeySetPrivate * priv; +}; + +struct _GeeTreeMapKeySetClass { + GeeAbstractSetClass parent_class; +}; + +struct _GeeTreeMapKeySetPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + GeeTreeMap* _map; +}; + +struct _GeeTreeMapValueCollection { + GeeAbstractCollection parent_instance; + GeeTreeMapValueCollectionPrivate * priv; +}; + +struct _GeeTreeMapValueCollectionClass { + GeeAbstractCollectionClass parent_class; +}; + +struct _GeeTreeMapValueCollectionPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + GeeTreeMap* _map; +}; + +struct _GeeTreeMapEntrySet { + GeeAbstractSet parent_instance; + GeeTreeMapEntrySetPrivate * priv; +}; + +struct _GeeTreeMapEntrySetClass { + GeeAbstractSetClass parent_class; +}; + +struct _GeeTreeMapEntrySetPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + GeeTreeMap* _map; +}; + +struct _GeeTreeMapNodeIterator { + GObject parent_instance; + GeeTreeMapNodeIteratorPrivate * priv; + GeeTreeMap* _map; + gint stamp; + GeeTreeMapNode* current; + GeeTreeMapNode* _next; + GeeTreeMapNode* _prev; +}; + +struct _GeeTreeMapNodeIteratorClass { + GObjectClass parent_class; +}; + +struct _GeeTreeMapNodeIteratorPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; +}; + +struct _GeeBidirIteratorIface { + GTypeInterface parent_iface; + gboolean (*previous) (GeeBidirIterator* self); + gboolean (*has_previous) (GeeBidirIterator* self); + gboolean (*last) (GeeBidirIterator* self); +}; + +struct _GeeTreeMapKeyIterator { + GeeTreeMapNodeIterator parent_instance; + GeeTreeMapKeyIteratorPrivate * priv; +}; + +struct _GeeTreeMapKeyIteratorClass { + GeeTreeMapNodeIteratorClass parent_class; +}; + +struct _GeeTreeMapKeyIteratorPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; +}; + +struct _GeeTreeMapValueIterator { + GeeTreeMapNodeIterator parent_instance; + GeeTreeMapValueIteratorPrivate * priv; +}; + +struct _GeeTreeMapValueIteratorClass { + GeeTreeMapNodeIteratorClass parent_class; +}; + +struct _GeeTreeMapValueIteratorPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; +}; + +struct _GeeTreeMapEntryIterator { + GeeTreeMapNodeIterator parent_instance; + GeeTreeMapEntryIteratorPrivate * priv; +}; + +struct _GeeTreeMapEntryIteratorClass { + GeeTreeMapNodeIteratorClass parent_class; +}; + +struct _GeeTreeMapEntryIteratorPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; +}; + +struct _GeeTreeMapMapIterator { + GeeTreeMapNodeIterator parent_instance; + GeeTreeMapMapIteratorPrivate * priv; +}; + +struct _GeeTreeMapMapIteratorClass { + GeeTreeMapNodeIteratorClass parent_class; +}; + +struct _GeeTreeMapMapIteratorPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; +}; + + +static gpointer gee_tree_map_parent_class = NULL; +static gpointer gee_tree_map_entry_parent_class = NULL; +static gpointer gee_tree_map_key_set_parent_class = NULL; +static gpointer gee_tree_map_value_collection_parent_class = NULL; +static gpointer gee_tree_map_entry_set_parent_class = NULL; +static gpointer gee_tree_map_node_iterator_parent_class = NULL; +static gpointer gee_tree_map_key_iterator_parent_class = NULL; +static GeeIteratorIface* gee_tree_map_key_iterator_gee_iterator_parent_iface = NULL; +static GeeBidirIteratorIface* gee_tree_map_key_iterator_gee_bidir_iterator_parent_iface = NULL; +static gpointer gee_tree_map_value_iterator_parent_class = NULL; +static GeeIteratorIface* gee_tree_map_value_iterator_gee_iterator_parent_iface = NULL; +static GeeBidirIteratorIface* gee_tree_map_value_iterator_gee_bidir_iterator_parent_iface = NULL; +static gpointer gee_tree_map_entry_iterator_parent_class = NULL; +static GeeIteratorIface* gee_tree_map_entry_iterator_gee_iterator_parent_iface = NULL; +static GeeBidirIteratorIface* gee_tree_map_entry_iterator_gee_bidir_iterator_parent_iface = NULL; +static gpointer gee_tree_map_map_iterator_parent_class = NULL; +static GeeMapIteratorIface* gee_tree_map_map_iterator_gee_map_iterator_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_map_iterator_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_map_entry_get_type (void) G_GNUC_CONST; +GType gee_map_get_type (void) G_GNUC_CONST; +GType gee_abstract_map_get_type (void) G_GNUC_CONST; +GType gee_tree_map_get_type (void) G_GNUC_CONST; +static void gee_tree_map_node_free (GeeTreeMapNode* self); +#define GEE_TREE_MAP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_TREE_MAP, GeeTreeMapPrivate)) +enum { + GEE_TREE_MAP_DUMMY_PROPERTY, + GEE_TREE_MAP_K_TYPE, + GEE_TREE_MAP_K_DUP_FUNC, + GEE_TREE_MAP_K_DESTROY_FUNC, + GEE_TREE_MAP_V_TYPE, + GEE_TREE_MAP_V_DUP_FUNC, + GEE_TREE_MAP_V_DESTROY_FUNC, + GEE_TREE_MAP_SIZE, + GEE_TREE_MAP_KEYS, + GEE_TREE_MAP_VALUES, + GEE_TREE_MAP_ENTRIES, + GEE_TREE_MAP_KEY_COMPARE_FUNC, + GEE_TREE_MAP_VALUE_EQUAL_FUNC +}; +GeeTreeMap* gee_tree_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GCompareFunc key_compare_func, GEqualFunc value_equal_func); +GeeTreeMap* gee_tree_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GCompareFunc key_compare_func, GEqualFunc value_equal_func); +GeeAbstractMap* gee_abstract_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func); +GCompareFunc gee_functions_get_compare_func_for (GType t); +GEqualFunc gee_functions_get_equal_func_for (GType t); +static void gee_tree_map_set_key_compare_func (GeeTreeMap* self, GCompareFunc value); +static void gee_tree_map_set_value_equal_func (GeeTreeMap* self, GEqualFunc value); +static void gee_tree_map_rotate_right (GeeTreeMap* self, GeeTreeMapNode** root); +GType gee_tree_map_node_color_get_type (void) G_GNUC_CONST; +static void gee_tree_map_rotate_left (GeeTreeMap* self, GeeTreeMapNode** root); +static gboolean gee_tree_map_is_red (GeeTreeMap* self, GeeTreeMapNode* n); +static gboolean gee_tree_map_is_black (GeeTreeMap* self, GeeTreeMapNode* n); +static gboolean gee_tree_map_real_has_key (GeeAbstractMap* base, gconstpointer key); +GCompareFunc gee_tree_map_get_key_compare_func (GeeTreeMap* self); +static gboolean gee_tree_map_real_has (GeeAbstractMap* base, gconstpointer key, gconstpointer value); +gpointer gee_abstract_map_get (GeeAbstractMap* self, gconstpointer key); +GEqualFunc gee_tree_map_get_value_equal_func (GeeTreeMap* self); +static gpointer gee_tree_map_real_get (GeeAbstractMap* base, gconstpointer key); +static void gee_tree_map_set_to_node (GeeTreeMap* self, GeeTreeMapNode** node, gconstpointer key, gconstpointer value, GeeTreeMapNode* prev, GeeTreeMapNode* next); +static GeeTreeMapNode* gee_tree_map_node_new (gpointer key, gpointer value, GeeTreeMapNode* prev, GeeTreeMapNode* next); +static GeeTreeMapNode* gee_tree_map_node_new (gpointer key, gpointer value, GeeTreeMapNode* prev, GeeTreeMapNode* next); +static void gee_tree_map_fix_up (GeeTreeMap* self, GeeTreeMapNode** node); +static void gee_tree_map_real_set (GeeAbstractMap* base, gconstpointer key, gconstpointer value); +static void gee_tree_map_move_red_left (GeeTreeMap* self, GeeTreeMapNode** root); +static void gee_tree_map_node_flip (GeeTreeMapNode* self); +static void gee_tree_map_move_red_right (GeeTreeMap* self, GeeTreeMapNode** root); +static void gee_tree_map_fix_removal (GeeTreeMap* self, GeeTreeMapNode** node, gpointer* key, gpointer* value); +static void gee_tree_map_remove_minimal (GeeTreeMap* self, GeeTreeMapNode** node, gpointer* key, gpointer* value); +static gboolean gee_tree_map_remove_from_node (GeeTreeMap* self, GeeTreeMapNode** node, gconstpointer key, gpointer* value, GeeTreeMapNode** prev, GeeTreeMapNode** next); +static gboolean gee_tree_map_real_unset (GeeAbstractMap* base, gconstpointer key, gpointer* value); +static inline void gee_tree_map_clear_subtree (GeeTreeMap* self, GeeTreeMapNode* node); +static void gee_tree_map_real_clear (GeeAbstractMap* base); +static GeeMapIterator* gee_tree_map_real_map_iterator (GeeAbstractMap* base); +static GeeTreeMapMapIterator* gee_tree_map_map_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map); +static GeeTreeMapMapIterator* gee_tree_map_map_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map); +static GType gee_tree_map_node_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static GType gee_tree_map_map_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static GeeTreeMapKeySet* gee_tree_map_key_set_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map); +static GeeTreeMapKeySet* gee_tree_map_key_set_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map); +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_set_get_type (void) G_GNUC_CONST; +static GType gee_tree_map_key_set_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static GeeTreeMapValueCollection* gee_tree_map_value_collection_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map); +static GeeTreeMapValueCollection* gee_tree_map_value_collection_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map); +static GType gee_tree_map_value_collection_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static GeeTreeMapEntrySet* gee_tree_map_entry_set_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map); +static GeeTreeMapEntrySet* gee_tree_map_entry_set_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map); +static GType gee_tree_map_entry_set_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static void gee_tree_map_node_instance_init (GeeTreeMapNode * self); +static GeeTreeMapNodeColor gee_tree_map_node_color_flip (GeeTreeMapNodeColor self); +static GType gee_tree_map_entry_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +#define GEE_TREE_MAP_ENTRY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TREE_MAP_TYPE_ENTRY, GeeTreeMapEntryPrivate)) +enum { + GEE_TREE_MAP_ENTRY_DUMMY_PROPERTY, + GEE_TREE_MAP_ENTRY_K_TYPE, + GEE_TREE_MAP_ENTRY_K_DUP_FUNC, + GEE_TREE_MAP_ENTRY_K_DESTROY_FUNC, + GEE_TREE_MAP_ENTRY_V_TYPE, + GEE_TREE_MAP_ENTRY_V_DUP_FUNC, + GEE_TREE_MAP_ENTRY_V_DESTROY_FUNC, + GEE_TREE_MAP_ENTRY_KEY, + GEE_TREE_MAP_ENTRY_VALUE +}; +static GeeMapEntry* gee_tree_map_entry_entry_for (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMapNode* node); +static GeeTreeMapEntry* gee_tree_map_entry_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMapNode* node); +static GeeTreeMapEntry* gee_tree_map_entry_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMapNode* node); +GeeMapEntry* gee_map_entry_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func); +static void gee_tree_map_entry_finalize (GObject* obj); +gconstpointer gee_map_entry_get_key (GeeMapEntry* self); +gconstpointer gee_map_entry_get_value (GeeMapEntry* self); +static void _vala_gee_tree_map_entry_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +void gee_map_entry_set_value (GeeMapEntry* self, gconstpointer value); +static void _vala_gee_tree_map_entry_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +#define GEE_TREE_MAP_KEY_SET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TREE_MAP_TYPE_KEY_SET, GeeTreeMapKeySetPrivate)) +enum { + GEE_TREE_MAP_KEY_SET_DUMMY_PROPERTY, + GEE_TREE_MAP_KEY_SET_K_TYPE, + GEE_TREE_MAP_KEY_SET_K_DUP_FUNC, + GEE_TREE_MAP_KEY_SET_K_DESTROY_FUNC, + GEE_TREE_MAP_KEY_SET_V_TYPE, + GEE_TREE_MAP_KEY_SET_V_DUP_FUNC, + GEE_TREE_MAP_KEY_SET_V_DESTROY_FUNC, + GEE_TREE_MAP_KEY_SET_SIZE +}; +GeeAbstractSet* gee_abstract_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +static GeeIterator* gee_tree_map_key_set_real_iterator (GeeAbstractCollection* base); +static GeeTreeMapKeyIterator* gee_tree_map_key_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map); +static GeeTreeMapKeyIterator* gee_tree_map_key_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map); +static GType gee_tree_map_key_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static gboolean gee_tree_map_key_set_real_add (GeeAbstractCollection* base, gconstpointer key); +static void gee_tree_map_key_set_real_clear (GeeAbstractCollection* base); +static gboolean gee_tree_map_key_set_real_remove (GeeAbstractCollection* base, gconstpointer key); +static gboolean gee_tree_map_key_set_real_contains (GeeAbstractCollection* base, gconstpointer key); +gboolean gee_abstract_map_has_key (GeeAbstractMap* self, gconstpointer key); +static gboolean gee_tree_map_key_set_real_add_all (GeeAbstractCollection* base, GeeCollection* collection); +static gboolean gee_tree_map_key_set_real_remove_all (GeeAbstractCollection* base, GeeCollection* collection); +static gboolean gee_tree_map_key_set_real_retain_all (GeeAbstractCollection* base, GeeCollection* collection); +gint gee_abstract_map_get_size (GeeAbstractMap* self); +static void gee_tree_map_key_set_finalize (GObject* obj); +gint gee_abstract_collection_get_size (GeeAbstractCollection* self); +static void _vala_gee_tree_map_key_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_tree_map_key_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +#define GEE_TREE_MAP_VALUE_COLLECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TREE_MAP_TYPE_VALUE_COLLECTION, GeeTreeMapValueCollectionPrivate)) +enum { + GEE_TREE_MAP_VALUE_COLLECTION_DUMMY_PROPERTY, + GEE_TREE_MAP_VALUE_COLLECTION_K_TYPE, + GEE_TREE_MAP_VALUE_COLLECTION_K_DUP_FUNC, + GEE_TREE_MAP_VALUE_COLLECTION_K_DESTROY_FUNC, + GEE_TREE_MAP_VALUE_COLLECTION_V_TYPE, + GEE_TREE_MAP_VALUE_COLLECTION_V_DUP_FUNC, + GEE_TREE_MAP_VALUE_COLLECTION_V_DESTROY_FUNC, + GEE_TREE_MAP_VALUE_COLLECTION_SIZE +}; +GeeAbstractCollection* gee_abstract_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +static GeeIterator* gee_tree_map_value_collection_real_iterator (GeeAbstractCollection* base); +static GeeTreeMapValueIterator* gee_tree_map_value_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map); +static GeeTreeMapValueIterator* gee_tree_map_value_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map); +static GType gee_tree_map_value_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static gboolean gee_tree_map_value_collection_real_add (GeeAbstractCollection* base, gconstpointer key); +static void gee_tree_map_value_collection_real_clear (GeeAbstractCollection* base); +static gboolean gee_tree_map_value_collection_real_remove (GeeAbstractCollection* base, gconstpointer key); +static gboolean gee_tree_map_value_collection_real_contains (GeeAbstractCollection* base, gconstpointer key); +GeeIterator* gee_abstract_collection_iterator (GeeAbstractCollection* self); +gboolean gee_iterator_next (GeeIterator* self); +gpointer gee_iterator_get (GeeIterator* self); +static gboolean gee_tree_map_value_collection_real_add_all (GeeAbstractCollection* base, GeeCollection* collection); +static gboolean gee_tree_map_value_collection_real_remove_all (GeeAbstractCollection* base, GeeCollection* collection); +static gboolean gee_tree_map_value_collection_real_retain_all (GeeAbstractCollection* base, GeeCollection* collection); +static void gee_tree_map_value_collection_finalize (GObject* obj); +static void _vala_gee_tree_map_value_collection_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_tree_map_value_collection_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +#define GEE_TREE_MAP_ENTRY_SET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TREE_MAP_TYPE_ENTRY_SET, GeeTreeMapEntrySetPrivate)) +enum { + GEE_TREE_MAP_ENTRY_SET_DUMMY_PROPERTY, + GEE_TREE_MAP_ENTRY_SET_K_TYPE, + GEE_TREE_MAP_ENTRY_SET_K_DUP_FUNC, + GEE_TREE_MAP_ENTRY_SET_K_DESTROY_FUNC, + GEE_TREE_MAP_ENTRY_SET_V_TYPE, + GEE_TREE_MAP_ENTRY_SET_V_DUP_FUNC, + GEE_TREE_MAP_ENTRY_SET_V_DESTROY_FUNC, + GEE_TREE_MAP_ENTRY_SET_SIZE +}; +static GeeIterator* gee_tree_map_entry_set_real_iterator (GeeAbstractCollection* base); +static GeeTreeMapEntryIterator* gee_tree_map_entry_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map); +static GeeTreeMapEntryIterator* gee_tree_map_entry_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map); +static GType gee_tree_map_entry_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static gboolean gee_tree_map_entry_set_real_add (GeeAbstractCollection* base, GeeMapEntry* entry); +static void gee_tree_map_entry_set_real_clear (GeeAbstractCollection* base); +static gboolean gee_tree_map_entry_set_real_remove (GeeAbstractCollection* base, GeeMapEntry* entry); +static gboolean gee_tree_map_entry_set_real_contains (GeeAbstractCollection* base, GeeMapEntry* entry); +gboolean gee_abstract_map_has (GeeAbstractMap* self, gconstpointer key, gconstpointer value); +static gboolean gee_tree_map_entry_set_real_add_all (GeeAbstractCollection* base, GeeCollection* entries); +static gboolean gee_tree_map_entry_set_real_remove_all (GeeAbstractCollection* base, GeeCollection* entries); +static gboolean gee_tree_map_entry_set_real_retain_all (GeeAbstractCollection* base, GeeCollection* entries); +static void gee_tree_map_entry_set_finalize (GObject* obj); +static void _vala_gee_tree_map_entry_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_tree_map_entry_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +#define GEE_TREE_MAP_NODE_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TREE_MAP_TYPE_NODE_ITERATOR, GeeTreeMapNodeIteratorPrivate)) +enum { + GEE_TREE_MAP_NODE_ITERATOR_DUMMY_PROPERTY, + GEE_TREE_MAP_NODE_ITERATOR_K_TYPE, + GEE_TREE_MAP_NODE_ITERATOR_K_DUP_FUNC, + GEE_TREE_MAP_NODE_ITERATOR_K_DESTROY_FUNC, + GEE_TREE_MAP_NODE_ITERATOR_V_TYPE, + GEE_TREE_MAP_NODE_ITERATOR_V_DUP_FUNC, + GEE_TREE_MAP_NODE_ITERATOR_V_DESTROY_FUNC +}; +static GeeTreeMapNodeIterator* gee_tree_map_node_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map); +static GeeTreeMapNodeIterator* gee_tree_map_node_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map); +static gboolean gee_tree_map_node_iterator_next (GeeTreeMapNodeIterator* self); +static gboolean gee_tree_map_node_iterator_has_next (GeeTreeMapNodeIterator* self); +static gboolean gee_tree_map_node_iterator_first (GeeTreeMapNodeIterator* self); +static gboolean gee_tree_map_node_iterator_previous (GeeTreeMapNodeIterator* self); +static gboolean gee_tree_map_node_iterator_has_previous (GeeTreeMapNodeIterator* self); +static gboolean gee_tree_map_node_iterator_last (GeeTreeMapNodeIterator* self); +static void gee_tree_map_node_iterator_remove (GeeTreeMapNodeIterator* self); +static void gee_tree_map_node_iterator_unset (GeeTreeMapNodeIterator* self); +static void gee_tree_map_node_iterator_finalize (GObject* obj); +static void _vala_gee_tree_map_node_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_tree_map_node_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +GType gee_bidir_iterator_get_type (void) G_GNUC_CONST; +#define GEE_TREE_MAP_KEY_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TREE_MAP_TYPE_KEY_ITERATOR, GeeTreeMapKeyIteratorPrivate)) +enum { + GEE_TREE_MAP_KEY_ITERATOR_DUMMY_PROPERTY, + GEE_TREE_MAP_KEY_ITERATOR_K_TYPE, + GEE_TREE_MAP_KEY_ITERATOR_K_DUP_FUNC, + GEE_TREE_MAP_KEY_ITERATOR_K_DESTROY_FUNC, + GEE_TREE_MAP_KEY_ITERATOR_V_TYPE, + GEE_TREE_MAP_KEY_ITERATOR_V_DUP_FUNC, + GEE_TREE_MAP_KEY_ITERATOR_V_DESTROY_FUNC +}; +static gpointer gee_tree_map_key_iterator_real_get (GeeIterator* base); +static void _vala_gee_tree_map_key_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_tree_map_key_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +#define GEE_TREE_MAP_VALUE_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TREE_MAP_TYPE_VALUE_ITERATOR, GeeTreeMapValueIteratorPrivate)) +enum { + GEE_TREE_MAP_VALUE_ITERATOR_DUMMY_PROPERTY, + GEE_TREE_MAP_VALUE_ITERATOR_K_TYPE, + GEE_TREE_MAP_VALUE_ITERATOR_K_DUP_FUNC, + GEE_TREE_MAP_VALUE_ITERATOR_K_DESTROY_FUNC, + GEE_TREE_MAP_VALUE_ITERATOR_V_TYPE, + GEE_TREE_MAP_VALUE_ITERATOR_V_DUP_FUNC, + GEE_TREE_MAP_VALUE_ITERATOR_V_DESTROY_FUNC +}; +static gpointer gee_tree_map_value_iterator_real_get (GeeIterator* base); +static void _vala_gee_tree_map_value_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_tree_map_value_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +#define GEE_TREE_MAP_ENTRY_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TREE_MAP_TYPE_ENTRY_ITERATOR, GeeTreeMapEntryIteratorPrivate)) +enum { + GEE_TREE_MAP_ENTRY_ITERATOR_DUMMY_PROPERTY, + GEE_TREE_MAP_ENTRY_ITERATOR_K_TYPE, + GEE_TREE_MAP_ENTRY_ITERATOR_K_DUP_FUNC, + GEE_TREE_MAP_ENTRY_ITERATOR_K_DESTROY_FUNC, + GEE_TREE_MAP_ENTRY_ITERATOR_V_TYPE, + GEE_TREE_MAP_ENTRY_ITERATOR_V_DUP_FUNC, + GEE_TREE_MAP_ENTRY_ITERATOR_V_DESTROY_FUNC +}; +static GeeMapEntry* gee_tree_map_entry_iterator_real_get (GeeIterator* base); +static void _vala_gee_tree_map_entry_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_tree_map_entry_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +#define GEE_TREE_MAP_MAP_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TREE_MAP_TYPE_MAP_ITERATOR, GeeTreeMapMapIteratorPrivate)) +enum { + GEE_TREE_MAP_MAP_ITERATOR_DUMMY_PROPERTY, + GEE_TREE_MAP_MAP_ITERATOR_K_TYPE, + GEE_TREE_MAP_MAP_ITERATOR_K_DUP_FUNC, + GEE_TREE_MAP_MAP_ITERATOR_K_DESTROY_FUNC, + GEE_TREE_MAP_MAP_ITERATOR_V_TYPE, + GEE_TREE_MAP_MAP_ITERATOR_V_DUP_FUNC, + GEE_TREE_MAP_MAP_ITERATOR_V_DESTROY_FUNC +}; +static gpointer gee_tree_map_map_iterator_real_get_key (GeeMapIterator* base); +static gpointer gee_tree_map_map_iterator_real_get_value (GeeMapIterator* base); +static void gee_tree_map_map_iterator_real_set_value (GeeMapIterator* base, gconstpointer value); +static void _vala_gee_tree_map_map_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_tree_map_map_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void gee_tree_map_finalize (GObject* obj); +GeeSet* gee_abstract_map_get_keys (GeeAbstractMap* self); +GeeCollection* gee_abstract_map_get_values (GeeAbstractMap* self); +GeeSet* gee_abstract_map_get_entries (GeeAbstractMap* self); +static void _vala_gee_tree_map_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_tree_map_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +/** + * Constructs a new, empty tree map sorted according to the specified + * comparator function. + * + * If not provided, the functions parameters are requested to the + * {@link Functions} function factory methods. + * + * @param key_compare_func an optional key comparator function + * @param value_equal_func an optional values equality testing function + */ +GeeTreeMap* gee_tree_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GCompareFunc key_compare_func, GEqualFunc value_equal_func) { + GeeTreeMap * self = NULL; + GCompareFunc _tmp0_; + GEqualFunc _tmp2_; + GCompareFunc _tmp4_; + GEqualFunc _tmp5_; + self = (GeeTreeMap*) gee_abstract_map_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _tmp0_ = key_compare_func; + if (_tmp0_ == NULL) { + GCompareFunc _tmp1_ = NULL; + _tmp1_ = gee_functions_get_compare_func_for (k_type); + key_compare_func = _tmp1_; + } + _tmp2_ = value_equal_func; + if (_tmp2_ == NULL) { + GEqualFunc _tmp3_ = NULL; + _tmp3_ = gee_functions_get_equal_func_for (v_type); + value_equal_func = _tmp3_; + } + _tmp4_ = key_compare_func; + gee_tree_map_set_key_compare_func (self, _tmp4_); + _tmp5_ = value_equal_func; + gee_tree_map_set_value_equal_func (self, _tmp5_); + return self; +} + + +GeeTreeMap* gee_tree_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GCompareFunc key_compare_func, GEqualFunc value_equal_func) { + return gee_tree_map_construct (GEE_TYPE_TREE_MAP, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, key_compare_func, value_equal_func); +} + + +static void gee_tree_map_rotate_right (GeeTreeMap* self, GeeTreeMapNode** root) { + GeeTreeMapNode* _tmp0_; + GeeTreeMapNode* _tmp1_; + GeeTreeMapNode* pivot; + GeeTreeMapNode* _tmp2_; + GeeTreeMapNode* _tmp3_; + GeeTreeMapNodeColor _tmp4_; + GeeTreeMapNode* _tmp5_; + GeeTreeMapNode* _tmp6_; + GeeTreeMapNode* _tmp7_; + GeeTreeMapNode* _tmp8_; + GeeTreeMapNode* _tmp9_; + GeeTreeMapNode* _tmp10_; + GeeTreeMapNode* _tmp11_; + g_return_if_fail (self != NULL); + g_return_if_fail (*root != NULL); + _tmp0_ = *root; + _tmp1_ = _tmp0_->left; + _tmp0_->left = NULL; + pivot = _tmp1_; + _tmp2_ = pivot; + _tmp3_ = *root; + _tmp4_ = _tmp3_->color; + _tmp2_->color = _tmp4_; + _tmp5_ = *root; + _tmp5_->color = GEE_TREE_MAP_NODE_COLOR_RED; + _tmp6_ = *root; + _tmp7_ = pivot; + _tmp8_ = _tmp7_->right; + _tmp7_->right = NULL; + _gee_tree_map_node_free0 (_tmp6_->left); + _tmp6_->left = _tmp8_; + _tmp9_ = pivot; + _tmp10_ = *root; + *root = NULL; + _gee_tree_map_node_free0 (_tmp9_->right); + _tmp9_->right = _tmp10_; + _tmp11_ = pivot; + pivot = NULL; + _gee_tree_map_node_free0 (*root); + *root = _tmp11_; + _gee_tree_map_node_free0 (pivot); +} + + +static void gee_tree_map_rotate_left (GeeTreeMap* self, GeeTreeMapNode** root) { + GeeTreeMapNode* _tmp0_; + GeeTreeMapNode* _tmp1_; + GeeTreeMapNode* pivot; + GeeTreeMapNode* _tmp2_; + GeeTreeMapNode* _tmp3_; + GeeTreeMapNodeColor _tmp4_; + GeeTreeMapNode* _tmp5_; + GeeTreeMapNode* _tmp6_; + GeeTreeMapNode* _tmp7_; + GeeTreeMapNode* _tmp8_; + GeeTreeMapNode* _tmp9_; + GeeTreeMapNode* _tmp10_; + GeeTreeMapNode* _tmp11_; + g_return_if_fail (self != NULL); + g_return_if_fail (*root != NULL); + _tmp0_ = *root; + _tmp1_ = _tmp0_->right; + _tmp0_->right = NULL; + pivot = _tmp1_; + _tmp2_ = pivot; + _tmp3_ = *root; + _tmp4_ = _tmp3_->color; + _tmp2_->color = _tmp4_; + _tmp5_ = *root; + _tmp5_->color = GEE_TREE_MAP_NODE_COLOR_RED; + _tmp6_ = *root; + _tmp7_ = pivot; + _tmp8_ = _tmp7_->left; + _tmp7_->left = NULL; + _gee_tree_map_node_free0 (_tmp6_->right); + _tmp6_->right = _tmp8_; + _tmp9_ = pivot; + _tmp10_ = *root; + *root = NULL; + _gee_tree_map_node_free0 (_tmp9_->left); + _tmp9_->left = _tmp10_; + _tmp11_ = pivot; + pivot = NULL; + _gee_tree_map_node_free0 (*root); + *root = _tmp11_; + _gee_tree_map_node_free0 (pivot); +} + + +static gboolean gee_tree_map_is_red (GeeTreeMap* self, GeeTreeMapNode* n) { + gboolean result = FALSE; + gboolean _tmp0_ = FALSE; + GeeTreeMapNode* _tmp1_; + gboolean _tmp4_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp1_ = n; + if (_tmp1_ != NULL) { + GeeTreeMapNode* _tmp2_; + GeeTreeMapNodeColor _tmp3_; + _tmp2_ = n; + _tmp3_ = _tmp2_->color; + _tmp0_ = _tmp3_ == GEE_TREE_MAP_NODE_COLOR_RED; + } else { + _tmp0_ = FALSE; + } + _tmp4_ = _tmp0_; + result = _tmp4_; + return result; +} + + +static gboolean gee_tree_map_is_black (GeeTreeMap* self, GeeTreeMapNode* n) { + gboolean result = FALSE; + gboolean _tmp0_ = FALSE; + GeeTreeMapNode* _tmp1_; + gboolean _tmp4_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp1_ = n; + if (_tmp1_ == NULL) { + _tmp0_ = TRUE; + } else { + GeeTreeMapNode* _tmp2_; + GeeTreeMapNodeColor _tmp3_; + _tmp2_ = n; + _tmp3_ = _tmp2_->color; + _tmp0_ = _tmp3_ == GEE_TREE_MAP_NODE_COLOR_BLACK; + } + _tmp4_ = _tmp0_; + result = _tmp4_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_tree_map_real_has_key (GeeAbstractMap* base, gconstpointer key) { + GeeTreeMap * self; + gboolean result = FALSE; + GeeTreeMapNode* _tmp0_; + GeeTreeMapNode* cur; + self = (GeeTreeMap*) base; + _tmp0_ = self->priv->root; + cur = _tmp0_; + while (TRUE) { + GeeTreeMapNode* _tmp1_; + GCompareFunc _tmp2_; + GCompareFunc _tmp3_; + gconstpointer _tmp4_; + GeeTreeMapNode* _tmp5_; + gconstpointer _tmp6_; + gint _tmp7_ = 0; + gint res; + gint _tmp8_; + _tmp1_ = cur; + if (!(_tmp1_ != NULL)) { + break; + } + _tmp2_ = gee_tree_map_get_key_compare_func (self); + _tmp3_ = _tmp2_; + _tmp4_ = key; + _tmp5_ = cur; + _tmp6_ = _tmp5_->key; + _tmp7_ = _tmp3_ (_tmp4_, _tmp6_); + res = _tmp7_; + _tmp8_ = res; + if (_tmp8_ == 0) { + result = TRUE; + return result; + } else { + gint _tmp9_; + _tmp9_ = res; + if (_tmp9_ < 0) { + GeeTreeMapNode* _tmp10_; + GeeTreeMapNode* _tmp11_; + _tmp10_ = cur; + _tmp11_ = _tmp10_->left; + cur = _tmp11_; + } else { + GeeTreeMapNode* _tmp12_; + GeeTreeMapNode* _tmp13_; + _tmp12_ = cur; + _tmp13_ = _tmp12_->right; + cur = _tmp13_; + } + } + } + result = FALSE; + return result; +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_tree_map_real_has (GeeAbstractMap* base, gconstpointer key, gconstpointer value) { + GeeTreeMap * self; + gboolean result = FALSE; + gconstpointer _tmp0_; + gpointer _tmp1_ = NULL; + gpointer own_value; + gboolean _tmp2_ = FALSE; + gconstpointer _tmp3_; + gboolean _tmp9_; + self = (GeeTreeMap*) base; + _tmp0_ = key; + _tmp1_ = gee_abstract_map_get ((GeeAbstractMap*) self, _tmp0_); + own_value = _tmp1_; + _tmp3_ = own_value; + if (_tmp3_ != NULL) { + GEqualFunc _tmp4_; + GEqualFunc _tmp5_; + gconstpointer _tmp6_; + gconstpointer _tmp7_; + gboolean _tmp8_ = FALSE; + _tmp4_ = gee_tree_map_get_value_equal_func (self); + _tmp5_ = _tmp4_; + _tmp6_ = own_value; + _tmp7_ = value; + _tmp8_ = _tmp5_ (_tmp6_, _tmp7_); + _tmp2_ = _tmp8_; + } else { + _tmp2_ = FALSE; + } + _tmp9_ = _tmp2_; + result = _tmp9_; + ((own_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (own_value = (self->priv->v_destroy_func (own_value), NULL)); + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_tree_map_real_get (GeeAbstractMap* base, gconstpointer key) { + GeeTreeMap * self; + gpointer result = NULL; + GeeTreeMapNode* _tmp0_; + GeeTreeMapNode* cur; + self = (GeeTreeMap*) base; + _tmp0_ = self->priv->root; + cur = _tmp0_; + while (TRUE) { + GeeTreeMapNode* _tmp1_; + GCompareFunc _tmp2_; + GCompareFunc _tmp3_; + gconstpointer _tmp4_; + GeeTreeMapNode* _tmp5_; + gconstpointer _tmp6_; + gint _tmp7_ = 0; + gint res; + gint _tmp8_; + _tmp1_ = cur; + if (!(_tmp1_ != NULL)) { + break; + } + _tmp2_ = gee_tree_map_get_key_compare_func (self); + _tmp3_ = _tmp2_; + _tmp4_ = key; + _tmp5_ = cur; + _tmp6_ = _tmp5_->key; + _tmp7_ = _tmp3_ (_tmp4_, _tmp6_); + res = _tmp7_; + _tmp8_ = res; + if (_tmp8_ == 0) { + GeeTreeMapNode* _tmp9_; + gconstpointer _tmp10_; + gpointer _tmp11_; + _tmp9_ = cur; + _tmp10_ = _tmp9_->value; + _tmp11_ = ((_tmp10_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp10_) : ((gpointer) _tmp10_); + result = _tmp11_; + return result; + } else { + gint _tmp12_; + _tmp12_ = res; + if (_tmp12_ < 0) { + GeeTreeMapNode* _tmp13_; + GeeTreeMapNode* _tmp14_; + _tmp13_ = cur; + _tmp14_ = _tmp13_->left; + cur = _tmp14_; + } else { + GeeTreeMapNode* _tmp15_; + GeeTreeMapNode* _tmp16_; + _tmp15_ = cur; + _tmp16_ = _tmp15_->right; + cur = _tmp16_; + } + } + } + result = NULL; + return result; +} + + +static void gee_tree_map_set_to_node (GeeTreeMap* self, GeeTreeMapNode** node, gconstpointer key, gconstpointer value, GeeTreeMapNode* prev, GeeTreeMapNode* next) { + GeeTreeMapNode* _tmp0_; + GCompareFunc _tmp13_; + GCompareFunc _tmp14_; + gconstpointer _tmp15_; + GeeTreeMapNode* _tmp16_; + gconstpointer _tmp17_; + gint _tmp18_ = 0; + gint cmp; + gint _tmp19_; + g_return_if_fail (self != NULL); + _tmp0_ = *node; + if (_tmp0_ == NULL) { + gconstpointer _tmp1_; + gpointer _tmp2_; + gconstpointer _tmp3_; + gpointer _tmp4_; + GeeTreeMapNode* _tmp5_; + GeeTreeMapNode* _tmp6_; + GeeTreeMapNode* _tmp7_; + GeeTreeMapNode* _tmp8_; + GeeTreeMapNode* _tmp10_; + gint _tmp12_; + _tmp1_ = key; + _tmp2_ = ((_tmp1_ != NULL) && (self->priv->k_dup_func != NULL)) ? self->priv->k_dup_func ((gpointer) _tmp1_) : ((gpointer) _tmp1_); + _tmp3_ = value; + _tmp4_ = ((_tmp3_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp3_) : ((gpointer) _tmp3_); + _tmp5_ = prev; + _tmp6_ = next; + _tmp7_ = gee_tree_map_node_new (_tmp2_, _tmp4_, _tmp5_, _tmp6_); + _gee_tree_map_node_free0 (*node); + *node = _tmp7_; + _tmp8_ = prev; + if (_tmp8_ == NULL) { + GeeTreeMapNode* _tmp9_; + _tmp9_ = *node; + self->priv->first = _tmp9_; + } + _tmp10_ = next; + if (_tmp10_ == NULL) { + GeeTreeMapNode* _tmp11_; + _tmp11_ = *node; + self->priv->last = _tmp11_; + } + _tmp12_ = self->priv->_size; + self->priv->_size = _tmp12_ + 1; + } + _tmp13_ = gee_tree_map_get_key_compare_func (self); + _tmp14_ = _tmp13_; + _tmp15_ = key; + _tmp16_ = *node; + _tmp17_ = _tmp16_->key; + _tmp18_ = _tmp14_ (_tmp15_, _tmp17_); + cmp = _tmp18_; + _tmp19_ = cmp; + if (_tmp19_ == 0) { + GeeTreeMapNode* _tmp20_; + gconstpointer _tmp21_; + gpointer _tmp22_; + _tmp20_ = *node; + _tmp21_ = value; + _tmp22_ = ((_tmp21_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp21_) : ((gpointer) _tmp21_); + ((_tmp20_->value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_tmp20_->value = (self->priv->v_destroy_func (_tmp20_->value), NULL)); + _tmp20_->value = _tmp22_; + } else { + gint _tmp23_; + _tmp23_ = cmp; + if (_tmp23_ < 0) { + GeeTreeMapNode* _tmp24_; + gconstpointer _tmp25_; + gconstpointer _tmp26_; + GeeTreeMapNode* _tmp27_; + GeeTreeMapNode* _tmp28_; + GeeTreeMapNode* _tmp29_; + _tmp24_ = *node; + _tmp25_ = key; + _tmp26_ = value; + _tmp27_ = *node; + _tmp28_ = _tmp27_->prev; + _tmp29_ = *node; + gee_tree_map_set_to_node (self, &_tmp24_->left, _tmp25_, _tmp26_, _tmp28_, _tmp29_); + } else { + GeeTreeMapNode* _tmp30_; + gconstpointer _tmp31_; + gconstpointer _tmp32_; + GeeTreeMapNode* _tmp33_; + GeeTreeMapNode* _tmp34_; + GeeTreeMapNode* _tmp35_; + _tmp30_ = *node; + _tmp31_ = key; + _tmp32_ = value; + _tmp33_ = *node; + _tmp34_ = *node; + _tmp35_ = _tmp34_->next; + gee_tree_map_set_to_node (self, &_tmp30_->right, _tmp31_, _tmp32_, _tmp33_, _tmp35_); + } + } + gee_tree_map_fix_up (self, node); +} + + +/** + * {@inheritDoc} + */ +static void gee_tree_map_real_set (GeeAbstractMap* base, gconstpointer key, gconstpointer value) { + GeeTreeMap * self; + gconstpointer _tmp0_; + gconstpointer _tmp1_; + GeeTreeMapNode* _tmp2_; + gint _tmp3_; + self = (GeeTreeMap*) base; + _tmp0_ = key; + _tmp1_ = value; + gee_tree_map_set_to_node (self, &self->priv->root, _tmp0_, _tmp1_, NULL, NULL); + _tmp2_ = self->priv->root; + _tmp2_->color = GEE_TREE_MAP_NODE_COLOR_BLACK; + _tmp3_ = self->priv->stamp; + self->priv->stamp = _tmp3_ + 1; +} + + +static void gee_tree_map_move_red_left (GeeTreeMap* self, GeeTreeMapNode** root) { + GeeTreeMapNode* _tmp0_; + GeeTreeMapNode* _tmp1_; + GeeTreeMapNode* _tmp2_; + GeeTreeMapNode* _tmp3_; + gboolean _tmp4_ = FALSE; + g_return_if_fail (self != NULL); + g_return_if_fail (*root != NULL); + _tmp0_ = *root; + gee_tree_map_node_flip (_tmp0_); + _tmp1_ = *root; + _tmp2_ = _tmp1_->right; + _tmp3_ = _tmp2_->left; + _tmp4_ = gee_tree_map_is_red (self, _tmp3_); + if (_tmp4_) { + GeeTreeMapNode* _tmp5_; + GeeTreeMapNode* _tmp6_; + _tmp5_ = *root; + gee_tree_map_rotate_right (self, &_tmp5_->right); + gee_tree_map_rotate_left (self, root); + _tmp6_ = *root; + gee_tree_map_node_flip (_tmp6_); + } +} + + +static void gee_tree_map_move_red_right (GeeTreeMap* self, GeeTreeMapNode** root) { + GeeTreeMapNode* _tmp0_; + GeeTreeMapNode* _tmp1_; + GeeTreeMapNode* _tmp2_; + GeeTreeMapNode* _tmp3_; + gboolean _tmp4_ = FALSE; + g_return_if_fail (self != NULL); + g_return_if_fail (*root != NULL); + _tmp0_ = *root; + gee_tree_map_node_flip (_tmp0_); + _tmp1_ = *root; + _tmp2_ = _tmp1_->left; + _tmp3_ = _tmp2_->left; + _tmp4_ = gee_tree_map_is_red (self, _tmp3_); + if (_tmp4_) { + GeeTreeMapNode* _tmp5_; + gee_tree_map_rotate_right (self, root); + _tmp5_ = *root; + gee_tree_map_node_flip (_tmp5_); + } +} + + +static void gee_tree_map_fix_removal (GeeTreeMap* self, GeeTreeMapNode** node, gpointer* key, gpointer* value) { + gpointer _vala_key = NULL; + gpointer _vala_value = NULL; + GeeTreeMapNode* _tmp0_; + GeeTreeMapNode* n; + GeeTreeMapNode* _tmp6_; + GeeTreeMapNode* _tmp7_; + GeeTreeMapNode* _tmp14_; + GeeTreeMapNode* _tmp15_; + GeeTreeMapNode* _tmp22_; + gint _tmp23_; + g_return_if_fail (self != NULL); + g_return_if_fail (*node != NULL); + _tmp0_ = *node; + *node = NULL; + n = _tmp0_; + if ((&_vala_key) != NULL) { + GeeTreeMapNode* _tmp1_; + gpointer _tmp2_; + _tmp1_ = n; + _tmp2_ = _tmp1_->key; + _tmp1_->key = NULL; + ((_vala_key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (_vala_key = (self->priv->k_destroy_func (_vala_key), NULL)); + _vala_key = _tmp2_; + } else { + GeeTreeMapNode* _tmp3_; + _tmp3_ = n; + ((_tmp3_->key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (_tmp3_->key = (self->priv->k_destroy_func (_tmp3_->key), NULL)); + _tmp3_->key = NULL; + } + if ((&_vala_value) != NULL) { + GeeTreeMapNode* _tmp4_; + gpointer _tmp5_; + _tmp4_ = n; + _tmp5_ = _tmp4_->value; + _tmp4_->value = NULL; + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + _vala_value = _tmp5_; + } + _tmp6_ = n; + _tmp7_ = _tmp6_->prev; + if (_tmp7_ != NULL) { + GeeTreeMapNode* _tmp8_; + GeeTreeMapNode* _tmp9_; + GeeTreeMapNode* _tmp10_; + GeeTreeMapNode* _tmp11_; + _tmp8_ = n; + _tmp9_ = _tmp8_->prev; + _tmp10_ = n; + _tmp11_ = _tmp10_->next; + _tmp9_->next = _tmp11_; + } else { + GeeTreeMapNode* _tmp12_; + GeeTreeMapNode* _tmp13_; + _tmp12_ = n; + _tmp13_ = _tmp12_->next; + self->priv->first = _tmp13_; + } + _tmp14_ = n; + _tmp15_ = _tmp14_->next; + if (_tmp15_ != NULL) { + GeeTreeMapNode* _tmp16_; + GeeTreeMapNode* _tmp17_; + GeeTreeMapNode* _tmp18_; + GeeTreeMapNode* _tmp19_; + _tmp16_ = n; + _tmp17_ = _tmp16_->next; + _tmp18_ = n; + _tmp19_ = _tmp18_->prev; + _tmp17_->prev = _tmp19_; + } else { + GeeTreeMapNode* _tmp20_; + GeeTreeMapNode* _tmp21_; + _tmp20_ = n; + _tmp21_ = _tmp20_->next; + self->priv->last = _tmp21_; + } + _tmp22_ = n; + ((_tmp22_->value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_tmp22_->value = (self->priv->v_destroy_func (_tmp22_->value), NULL)); + _tmp22_->value = NULL; + _gee_tree_map_node_free0 (*node); + *node = NULL; + _tmp23_ = self->priv->_size; + self->priv->_size = _tmp23_ - 1; + _gee_tree_map_node_free0 (n); + if (key) { + *key = _vala_key; + } else { + ((_vala_key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (_vala_key = (self->priv->k_destroy_func (_vala_key), NULL)); + } + if (value) { + *value = _vala_value; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + } +} + + +static void gee_tree_map_remove_minimal (GeeTreeMap* self, GeeTreeMapNode** node, gpointer* key, gpointer* value) { + gpointer _vala_key = NULL; + gpointer _vala_value = NULL; + GeeTreeMapNode* _tmp0_; + GeeTreeMapNode* _tmp1_; + gboolean _tmp4_ = FALSE; + GeeTreeMapNode* _tmp5_; + GeeTreeMapNode* _tmp6_; + gboolean _tmp7_ = FALSE; + gboolean _tmp12_; + GeeTreeMapNode* _tmp13_; + gpointer _tmp14_ = NULL; + gpointer _tmp15_ = NULL; + g_return_if_fail (self != NULL); + g_return_if_fail (*node != NULL); + _tmp0_ = *node; + _tmp1_ = _tmp0_->left; + if (_tmp1_ == NULL) { + gpointer _tmp2_ = NULL; + gpointer _tmp3_ = NULL; + gee_tree_map_fix_removal (self, node, &_tmp2_, &_tmp3_); + ((_vala_key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (_vala_key = (self->priv->k_destroy_func (_vala_key), NULL)); + _vala_key = _tmp2_; + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + _vala_value = _tmp3_; + if (key) { + *key = _vala_key; + } else { + ((_vala_key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (_vala_key = (self->priv->k_destroy_func (_vala_key), NULL)); + } + if (value) { + *value = _vala_value; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + } + return; + } + _tmp5_ = *node; + _tmp6_ = _tmp5_->left; + _tmp7_ = gee_tree_map_is_black (self, _tmp6_); + if (_tmp7_) { + GeeTreeMapNode* _tmp8_; + GeeTreeMapNode* _tmp9_; + GeeTreeMapNode* _tmp10_; + gboolean _tmp11_ = FALSE; + _tmp8_ = *node; + _tmp9_ = _tmp8_->left; + _tmp10_ = _tmp9_->left; + _tmp11_ = gee_tree_map_is_black (self, _tmp10_); + _tmp4_ = _tmp11_; + } else { + _tmp4_ = FALSE; + } + _tmp12_ = _tmp4_; + if (_tmp12_) { + gee_tree_map_move_red_left (self, node); + } + _tmp13_ = *node; + gee_tree_map_remove_minimal (self, &_tmp13_->left, &_tmp14_, &_tmp15_); + ((_vala_key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (_vala_key = (self->priv->k_destroy_func (_vala_key), NULL)); + _vala_key = _tmp14_; + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + _vala_value = _tmp15_; + gee_tree_map_fix_up (self, node); + if (key) { + *key = _vala_key; + } else { + ((_vala_key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (_vala_key = (self->priv->k_destroy_func (_vala_key), NULL)); + } + if (value) { + *value = _vala_value; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + } +} + + +static gboolean gee_tree_map_remove_from_node (GeeTreeMap* self, GeeTreeMapNode** node, gconstpointer key, gpointer* value, GeeTreeMapNode** prev, GeeTreeMapNode** next) { + gpointer _vala_value = NULL; + GeeTreeMapNode* _vala_prev = NULL; + GeeTreeMapNode* _vala_next = NULL; + gboolean result = FALSE; + GeeTreeMapNode* _tmp0_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = *node; + if (_tmp0_ == NULL) { + result = FALSE; + if (value) { + *value = _vala_value; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + } + if (prev) { + *prev = _vala_prev; + } + if (next) { + *next = _vala_next; + } + return result; + } else { + GCompareFunc _tmp1_; + GCompareFunc _tmp2_; + gconstpointer _tmp3_; + GeeTreeMapNode* _tmp4_; + gconstpointer _tmp5_; + gint _tmp6_ = 0; + _tmp1_ = gee_tree_map_get_key_compare_func (self); + _tmp2_ = _tmp1_; + _tmp3_ = key; + _tmp4_ = *node; + _tmp5_ = _tmp4_->key; + _tmp6_ = _tmp2_ (_tmp3_, _tmp5_); + if (_tmp6_ < 0) { + GeeTreeMapNode* _tmp7_; + GeeTreeMapNode* _tmp8_; + GeeTreeMapNode* left; + GeeTreeMapNode* _tmp9_; + gboolean _tmp10_ = FALSE; + gboolean _tmp11_ = FALSE; + GeeTreeMapNode* _tmp12_; + GeeTreeMapNode* _tmp13_; + gboolean _tmp16_; + gboolean _tmp20_; + GeeTreeMapNode* _tmp21_; + gconstpointer _tmp22_; + gpointer _tmp23_ = NULL; + GeeTreeMapNode* _tmp24_ = NULL; + GeeTreeMapNode* _tmp25_ = NULL; + gboolean _tmp26_ = FALSE; + gboolean r; + _tmp7_ = *node; + _tmp8_ = _tmp7_->left; + left = _tmp8_; + _tmp9_ = left; + if (_tmp9_ == NULL) { + result = FALSE; + if (value) { + *value = _vala_value; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + } + if (prev) { + *prev = _vala_prev; + } + if (next) { + *next = _vala_next; + } + return result; + } + _tmp12_ = *node; + _tmp13_ = _tmp12_->left; + if (_tmp13_ != NULL) { + GeeTreeMapNode* _tmp14_; + gboolean _tmp15_ = FALSE; + _tmp14_ = left; + _tmp15_ = gee_tree_map_is_black (self, _tmp14_); + _tmp11_ = _tmp15_; + } else { + _tmp11_ = FALSE; + } + _tmp16_ = _tmp11_; + if (_tmp16_) { + GeeTreeMapNode* _tmp17_; + GeeTreeMapNode* _tmp18_; + gboolean _tmp19_ = FALSE; + _tmp17_ = left; + _tmp18_ = _tmp17_->left; + _tmp19_ = gee_tree_map_is_black (self, _tmp18_); + _tmp10_ = _tmp19_; + } else { + _tmp10_ = FALSE; + } + _tmp20_ = _tmp10_; + if (_tmp20_) { + gee_tree_map_move_red_left (self, node); + } + _tmp21_ = *node; + _tmp22_ = key; + _tmp26_ = gee_tree_map_remove_from_node (self, &_tmp21_->left, _tmp22_, &_tmp23_, &_tmp24_, &_tmp25_); + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + _vala_value = _tmp23_; + _vala_prev = _tmp24_; + _vala_next = _tmp25_; + r = _tmp26_; + gee_tree_map_fix_up (self, node); + result = r; + if (value) { + *value = _vala_value; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + } + if (prev) { + *prev = _vala_prev; + } + if (next) { + *next = _vala_next; + } + return result; + } else { + GeeTreeMapNode* _tmp27_; + GeeTreeMapNode* _tmp28_; + gboolean _tmp29_ = FALSE; + GeeTreeMapNode* _tmp30_; + GeeTreeMapNode* _tmp31_; + GeeTreeMapNode* r; + gboolean _tmp32_ = FALSE; + GCompareFunc _tmp33_; + GCompareFunc _tmp34_; + gconstpointer _tmp35_; + GeeTreeMapNode* _tmp36_; + gconstpointer _tmp37_; + gint _tmp38_ = 0; + gboolean _tmp40_; + gboolean _tmp46_ = FALSE; + gboolean _tmp47_ = FALSE; + GeeTreeMapNode* _tmp48_; + gboolean _tmp49_ = FALSE; + gboolean _tmp51_; + gboolean _tmp55_; + GCompareFunc _tmp56_; + GCompareFunc _tmp57_; + gconstpointer _tmp58_; + GeeTreeMapNode* _tmp59_; + gconstpointer _tmp60_; + gint _tmp61_ = 0; + _tmp27_ = *node; + _tmp28_ = _tmp27_->left; + _tmp29_ = gee_tree_map_is_red (self, _tmp28_); + if (_tmp29_) { + gee_tree_map_rotate_right (self, node); + } + _tmp30_ = *node; + _tmp31_ = _tmp30_->right; + r = _tmp31_; + _tmp33_ = gee_tree_map_get_key_compare_func (self); + _tmp34_ = _tmp33_; + _tmp35_ = key; + _tmp36_ = *node; + _tmp37_ = _tmp36_->key; + _tmp38_ = _tmp34_ (_tmp35_, _tmp37_); + if (_tmp38_ == 0) { + GeeTreeMapNode* _tmp39_; + _tmp39_ = r; + _tmp32_ = _tmp39_ == NULL; + } else { + _tmp32_ = FALSE; + } + _tmp40_ = _tmp32_; + if (_tmp40_) { + gpointer _tmp45_ = NULL; + if ((&_vala_prev) != NULL) { + GeeTreeMapNode* _tmp41_; + GeeTreeMapNode* _tmp42_; + _tmp41_ = *node; + _tmp42_ = _tmp41_->prev; + _vala_prev = _tmp42_; + } + if ((&_vala_next) != NULL) { + GeeTreeMapNode* _tmp43_; + GeeTreeMapNode* _tmp44_; + _tmp43_ = *node; + _tmp44_ = _tmp43_->next; + _vala_next = _tmp44_; + } + gee_tree_map_fix_removal (self, node, NULL, &_tmp45_); + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + _vala_value = _tmp45_; + result = TRUE; + if (value) { + *value = _vala_value; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + } + if (prev) { + *prev = _vala_prev; + } + if (next) { + *next = _vala_next; + } + return result; + } + _tmp48_ = r; + _tmp49_ = gee_tree_map_is_black (self, _tmp48_); + if (_tmp49_) { + GeeTreeMapNode* _tmp50_; + _tmp50_ = r; + _tmp47_ = _tmp50_ != NULL; + } else { + _tmp47_ = FALSE; + } + _tmp51_ = _tmp47_; + if (_tmp51_) { + GeeTreeMapNode* _tmp52_; + GeeTreeMapNode* _tmp53_; + gboolean _tmp54_ = FALSE; + _tmp52_ = r; + _tmp53_ = _tmp52_->left; + _tmp54_ = gee_tree_map_is_black (self, _tmp53_); + _tmp46_ = _tmp54_; + } else { + _tmp46_ = FALSE; + } + _tmp55_ = _tmp46_; + if (_tmp55_) { + gee_tree_map_move_red_right (self, node); + } + _tmp56_ = gee_tree_map_get_key_compare_func (self); + _tmp57_ = _tmp56_; + _tmp58_ = key; + _tmp59_ = *node; + _tmp60_ = _tmp59_->key; + _tmp61_ = _tmp57_ (_tmp58_, _tmp60_); + if (_tmp61_ == 0) { + GeeTreeMapNode* _tmp62_; + gpointer _tmp63_; + GeeTreeMapNode* _tmp67_; + GeeTreeMapNode* _tmp68_; + GeeTreeMapNode* _tmp69_; + gpointer _tmp70_ = NULL; + gpointer _tmp71_ = NULL; + _tmp62_ = *node; + _tmp63_ = _tmp62_->value; + _tmp62_->value = NULL; + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + _vala_value = _tmp63_; + if ((&_vala_prev) != NULL) { + GeeTreeMapNode* _tmp64_; + GeeTreeMapNode* _tmp65_; + _tmp64_ = *node; + _tmp65_ = _tmp64_->prev; + _vala_prev = _tmp65_; + } + if ((&_vala_next) != NULL) { + GeeTreeMapNode* _tmp66_; + _tmp66_ = *node; + _vala_next = _tmp66_; + } + _tmp67_ = *node; + _tmp68_ = *node; + _tmp69_ = *node; + gee_tree_map_remove_minimal (self, &_tmp67_->right, &_tmp70_, &_tmp71_); + ((_tmp68_->key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (_tmp68_->key = (self->priv->k_destroy_func (_tmp68_->key), NULL)); + _tmp68_->key = _tmp70_; + ((_tmp69_->value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_tmp69_->value = (self->priv->v_destroy_func (_tmp69_->value), NULL)); + _tmp69_->value = _tmp71_; + gee_tree_map_fix_up (self, node); + result = TRUE; + if (value) { + *value = _vala_value; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + } + if (prev) { + *prev = _vala_prev; + } + if (next) { + *next = _vala_next; + } + return result; + } else { + GeeTreeMapNode* _tmp72_; + gconstpointer _tmp73_; + gpointer _tmp74_ = NULL; + GeeTreeMapNode* _tmp75_ = NULL; + GeeTreeMapNode* _tmp76_ = NULL; + gboolean _tmp77_ = FALSE; + gboolean re; + _tmp72_ = *node; + _tmp73_ = key; + _tmp77_ = gee_tree_map_remove_from_node (self, &_tmp72_->right, _tmp73_, &_tmp74_, &_tmp75_, &_tmp76_); + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + _vala_value = _tmp74_; + _vala_prev = _tmp75_; + _vala_next = _tmp76_; + re = _tmp77_; + gee_tree_map_fix_up (self, node); + result = re; + if (value) { + *value = _vala_value; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + } + if (prev) { + *prev = _vala_prev; + } + if (next) { + *next = _vala_next; + } + return result; + } + } + } + if (value) { + *value = _vala_value; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + } + if (prev) { + *prev = _vala_prev; + } + if (next) { + *next = _vala_next; + } +} + + +static void gee_tree_map_fix_up (GeeTreeMap* self, GeeTreeMapNode** node) { + gboolean _tmp0_ = FALSE; + GeeTreeMapNode* _tmp1_; + GeeTreeMapNode* _tmp2_; + gboolean _tmp3_ = FALSE; + gboolean _tmp7_; + gboolean _tmp8_ = FALSE; + GeeTreeMapNode* _tmp9_; + GeeTreeMapNode* _tmp10_; + gboolean _tmp11_ = FALSE; + gboolean _tmp16_; + gboolean _tmp17_ = FALSE; + GeeTreeMapNode* _tmp18_; + GeeTreeMapNode* _tmp19_; + gboolean _tmp20_ = FALSE; + gboolean _tmp24_; + g_return_if_fail (self != NULL); + g_return_if_fail (*node != NULL); + _tmp1_ = *node; + _tmp2_ = _tmp1_->left; + _tmp3_ = gee_tree_map_is_black (self, _tmp2_); + if (_tmp3_) { + GeeTreeMapNode* _tmp4_; + GeeTreeMapNode* _tmp5_; + gboolean _tmp6_ = FALSE; + _tmp4_ = *node; + _tmp5_ = _tmp4_->right; + _tmp6_ = gee_tree_map_is_red (self, _tmp5_); + _tmp0_ = _tmp6_; + } else { + _tmp0_ = FALSE; + } + _tmp7_ = _tmp0_; + if (_tmp7_) { + gee_tree_map_rotate_left (self, node); + } + _tmp9_ = *node; + _tmp10_ = _tmp9_->left; + _tmp11_ = gee_tree_map_is_red (self, _tmp10_); + if (_tmp11_) { + GeeTreeMapNode* _tmp12_; + GeeTreeMapNode* _tmp13_; + GeeTreeMapNode* _tmp14_; + gboolean _tmp15_ = FALSE; + _tmp12_ = *node; + _tmp13_ = _tmp12_->left; + _tmp14_ = _tmp13_->left; + _tmp15_ = gee_tree_map_is_red (self, _tmp14_); + _tmp8_ = _tmp15_; + } else { + _tmp8_ = FALSE; + } + _tmp16_ = _tmp8_; + if (_tmp16_) { + gee_tree_map_rotate_right (self, node); + } + _tmp18_ = *node; + _tmp19_ = _tmp18_->left; + _tmp20_ = gee_tree_map_is_red (self, _tmp19_); + if (_tmp20_) { + GeeTreeMapNode* _tmp21_; + GeeTreeMapNode* _tmp22_; + gboolean _tmp23_ = FALSE; + _tmp21_ = *node; + _tmp22_ = _tmp21_->right; + _tmp23_ = gee_tree_map_is_red (self, _tmp22_); + _tmp17_ = _tmp23_; + } else { + _tmp17_ = FALSE; + } + _tmp24_ = _tmp17_; + if (_tmp24_) { + GeeTreeMapNode* _tmp25_; + _tmp25_ = *node; + gee_tree_map_node_flip (_tmp25_); + } +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_tree_map_real_unset (GeeAbstractMap* base, gconstpointer key, gpointer* value) { + GeeTreeMap * self; + gpointer _vala_value = NULL; + gboolean result = FALSE; + gpointer node_value = NULL; + gconstpointer _tmp0_; + gpointer _tmp1_ = NULL; + gboolean _tmp2_ = FALSE; + gboolean b; + GeeTreeMapNode* _tmp4_; + gint _tmp6_; + self = (GeeTreeMap*) base; + _tmp0_ = key; + _tmp2_ = gee_tree_map_remove_from_node (self, &self->priv->root, _tmp0_, &_tmp1_, NULL, NULL); + ((node_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (node_value = (self->priv->v_destroy_func (node_value), NULL)); + node_value = _tmp1_; + b = _tmp2_; + if ((&_vala_value) != NULL) { + gpointer _tmp3_; + _tmp3_ = node_value; + node_value = NULL; + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + _vala_value = _tmp3_; + } + _tmp4_ = self->priv->root; + if (_tmp4_ != NULL) { + GeeTreeMapNode* _tmp5_; + _tmp5_ = self->priv->root; + _tmp5_->color = GEE_TREE_MAP_NODE_COLOR_BLACK; + } + _tmp6_ = self->priv->stamp; + self->priv->stamp = _tmp6_ + 1; + result = b; + ((node_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (node_value = (self->priv->v_destroy_func (node_value), NULL)); + if (value) { + *value = _vala_value; + } else { + ((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL)); + } + return result; +} + + +static inline void gee_tree_map_clear_subtree (GeeTreeMap* self, GeeTreeMapNode* node) { + GeeTreeMapNode* _tmp0_; + GeeTreeMapNode* _tmp1_; + GeeTreeMapNode* _tmp2_; + GeeTreeMapNode* _tmp3_; + GeeTreeMapNode* _tmp6_; + GeeTreeMapNode* _tmp7_; + g_return_if_fail (self != NULL); + g_return_if_fail (node != NULL); + _tmp0_ = node; + ((_tmp0_->key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (_tmp0_->key = (self->priv->k_destroy_func (_tmp0_->key), NULL)); + _tmp0_->key = NULL; + _tmp1_ = node; + ((_tmp1_->value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_tmp1_->value = (self->priv->v_destroy_func (_tmp1_->value), NULL)); + _tmp1_->value = NULL; + _tmp2_ = node; + _tmp3_ = _tmp2_->left; + if (_tmp3_ != NULL) { + GeeTreeMapNode* _tmp4_; + GeeTreeMapNode* _tmp5_; + _tmp4_ = node; + _tmp5_ = _tmp4_->left; + _tmp4_->left = NULL; + gee_tree_map_clear_subtree (self, _tmp5_); + } + _tmp6_ = node; + _tmp7_ = _tmp6_->right; + if (_tmp7_ != NULL) { + GeeTreeMapNode* _tmp8_; + GeeTreeMapNode* _tmp9_; + _tmp8_ = node; + _tmp9_ = _tmp8_->right; + _tmp8_->right = NULL; + gee_tree_map_clear_subtree (self, _tmp9_); + } + _gee_tree_map_node_free0 (node); +} + + +/** + * {@inheritDoc} + */ +static void gee_tree_map_real_clear (GeeAbstractMap* base) { + GeeTreeMap * self; + GeeTreeMapNode* _tmp0_; + gint _tmp3_; + self = (GeeTreeMap*) base; + _tmp0_ = self->priv->root; + if (_tmp0_ != NULL) { + GeeTreeMapNode* _tmp1_; + GeeTreeMapNode* _tmp2_; + _tmp1_ = self->priv->root; + self->priv->root = NULL; + gee_tree_map_clear_subtree (self, _tmp1_); + self->priv->last = NULL; + _tmp2_ = self->priv->last; + self->priv->first = _tmp2_; + } + self->priv->_size = 0; + _tmp3_ = self->priv->stamp; + self->priv->stamp = _tmp3_ + 1; +} + + +/** + * {@inheritDoc} + */ +static GeeMapIterator* gee_tree_map_real_map_iterator (GeeAbstractMap* base) { + GeeTreeMap * self; + GeeMapIterator* result = NULL; + GeeTreeMapMapIterator* _tmp0_; + self = (GeeTreeMap*) base; + _tmp0_ = gee_tree_map_map_iterator_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, self); + result = (GeeMapIterator*) _tmp0_; + return result; +} + + +static gint gee_tree_map_real_get_size (GeeAbstractMap* base) { + gint result; + GeeTreeMap* self; + gint _tmp0_; + self = (GeeTreeMap*) base; + _tmp0_ = self->priv->_size; + result = _tmp0_; + return result; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static GeeSet* gee_tree_map_real_get_keys (GeeAbstractMap* base) { + GeeSet* result; + GeeTreeMap* self; + GeeSet* _tmp0_; + GeeSet* _tmp1_; + GeeSet* keys; + GeeSet* _tmp2_; + self = (GeeTreeMap*) base; + _tmp0_ = self->priv->_keys; + _tmp1_ = _g_object_ref0 (_tmp0_); + keys = _tmp1_; + _tmp2_ = self->priv->_keys; + if (_tmp2_ == NULL) { + GeeTreeMapKeySet* _tmp3_; + GeeSet* _tmp4_; + GeeSet* _tmp5_; + _tmp3_ = gee_tree_map_key_set_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, self); + _g_object_unref0 (keys); + keys = (GeeSet*) _tmp3_; + _tmp4_ = keys; + self->priv->_keys = _tmp4_; + _tmp5_ = keys; + g_object_add_weak_pointer ((GObject*) _tmp5_, (void**) (&self->priv->_keys)); + } + result = keys; + return result; +} + + +static GeeCollection* gee_tree_map_real_get_values (GeeAbstractMap* base) { + GeeCollection* result; + GeeTreeMap* self; + GeeCollection* _tmp0_; + GeeCollection* _tmp1_; + GeeCollection* values; + GeeCollection* _tmp2_; + self = (GeeTreeMap*) base; + _tmp0_ = self->priv->_values; + _tmp1_ = _g_object_ref0 (_tmp0_); + values = _tmp1_; + _tmp2_ = self->priv->_values; + if (_tmp2_ == NULL) { + GeeTreeMapValueCollection* _tmp3_; + GeeCollection* _tmp4_; + GeeCollection* _tmp5_; + _tmp3_ = gee_tree_map_value_collection_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, self); + _g_object_unref0 (values); + values = (GeeCollection*) _tmp3_; + _tmp4_ = values; + self->priv->_values = _tmp4_; + _tmp5_ = values; + g_object_add_weak_pointer ((GObject*) _tmp5_, (void**) (&self->priv->_values)); + } + result = values; + return result; +} + + +static GeeSet* gee_tree_map_real_get_entries (GeeAbstractMap* base) { + GeeSet* result; + GeeTreeMap* self; + GeeSet* _tmp0_; + GeeSet* _tmp1_; + GeeSet* entries; + GeeSet* _tmp2_; + self = (GeeTreeMap*) base; + _tmp0_ = self->priv->_entries; + _tmp1_ = _g_object_ref0 (_tmp0_); + entries = _tmp1_; + _tmp2_ = self->priv->_entries; + if (_tmp2_ == NULL) { + GeeTreeMapEntrySet* _tmp3_; + GeeSet* _tmp4_; + GeeSet* _tmp5_; + _tmp3_ = gee_tree_map_entry_set_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, self); + _g_object_unref0 (entries); + entries = (GeeSet*) _tmp3_; + _tmp4_ = entries; + self->priv->_entries = _tmp4_; + _tmp5_ = entries; + g_object_add_weak_pointer ((GObject*) _tmp5_, (void**) (&self->priv->_entries)); + } + result = entries; + return result; +} + + +GCompareFunc gee_tree_map_get_key_compare_func (GeeTreeMap* self) { + GCompareFunc result; + GCompareFunc _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->_key_compare_func; + result = _tmp0_; + return result; +} + + +static void gee_tree_map_set_key_compare_func (GeeTreeMap* self, GCompareFunc value) { + GCompareFunc _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = value; + self->priv->_key_compare_func = _tmp0_; + g_object_notify ((GObject *) self, "key-compare-func"); +} + + +GEqualFunc gee_tree_map_get_value_equal_func (GeeTreeMap* self) { + GEqualFunc result; + GEqualFunc _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->_value_equal_func; + result = _tmp0_; + return result; +} + + +static void gee_tree_map_set_value_equal_func (GeeTreeMap* self, GEqualFunc value) { + GEqualFunc _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = value; + self->priv->_value_equal_func = _tmp0_; + g_object_notify ((GObject *) self, "value-equal-func"); +} + + +static GeeTreeMapNodeColor gee_tree_map_node_color_flip (GeeTreeMapNodeColor self) { + GeeTreeMapNodeColor result = 0; + if (self == GEE_TREE_MAP_NODE_COLOR_RED) { + result = GEE_TREE_MAP_NODE_COLOR_BLACK; + return result; + } else { + result = GEE_TREE_MAP_NODE_COLOR_RED; + return result; + } +} + + +GType gee_tree_map_node_color_get_type (void) { + static volatile gsize gee_tree_map_node_color_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_map_node_color_type_id__volatile)) { + static const GEnumValue values[] = {{GEE_TREE_MAP_NODE_COLOR_RED, "GEE_TREE_MAP_NODE_COLOR_RED", "red"}, {GEE_TREE_MAP_NODE_COLOR_BLACK, "GEE_TREE_MAP_NODE_COLOR_BLACK", "black"}, {0, NULL, NULL}}; + GType gee_tree_map_node_color_type_id; + gee_tree_map_node_color_type_id = g_enum_register_static ("GeeTreeMapNodeColor", values); + g_once_init_leave (&gee_tree_map_node_color_type_id__volatile, gee_tree_map_node_color_type_id); + } + return gee_tree_map_node_color_type_id__volatile; +} + + +static GeeTreeMapNode* gee_tree_map_node_new (gpointer key, gpointer value, GeeTreeMapNode* prev, GeeTreeMapNode* next) { + GeeTreeMapNode* self; + gpointer _tmp0_; + gpointer _tmp1_; + GeeTreeMapNode* _tmp2_; + GeeTreeMapNode* _tmp3_; + GeeTreeMapNode* _tmp4_; + GeeTreeMapNode* _tmp6_; + self = g_slice_new0 (GeeTreeMapNode); + gee_tree_map_node_instance_init (self); + _tmp0_ = key; + key = NULL; + self->key = _tmp0_; + _tmp1_ = value; + value = NULL; + self->value = _tmp1_; + self->color = GEE_TREE_MAP_NODE_COLOR_RED; + _tmp2_ = prev; + self->prev = _tmp2_; + _tmp3_ = next; + self->next = _tmp3_; + _tmp4_ = prev; + if (_tmp4_ != NULL) { + GeeTreeMapNode* _tmp5_; + _tmp5_ = prev; + _tmp5_->next = self; + } + _tmp6_ = next; + if (_tmp6_ != NULL) { + GeeTreeMapNode* _tmp7_; + _tmp7_ = next; + _tmp7_->prev = self; + } + return self; +} + + +static void gee_tree_map_node_flip (GeeTreeMapNode* self) { + GeeTreeMapNodeColor _tmp0_; + GeeTreeMapNodeColor _tmp1_ = 0; + GeeTreeMapNode* _tmp2_; + GeeTreeMapNode* _tmp7_; + g_return_if_fail (self != NULL); + _tmp0_ = self->color; + _tmp1_ = gee_tree_map_node_color_flip (_tmp0_); + self->color = _tmp1_; + _tmp2_ = self->left; + if (_tmp2_ != NULL) { + GeeTreeMapNode* _tmp3_; + GeeTreeMapNode* _tmp4_; + GeeTreeMapNodeColor _tmp5_; + GeeTreeMapNodeColor _tmp6_ = 0; + _tmp3_ = self->left; + _tmp4_ = self->left; + _tmp5_ = _tmp4_->color; + _tmp6_ = gee_tree_map_node_color_flip (_tmp5_); + _tmp3_->color = _tmp6_; + } + _tmp7_ = self->right; + if (_tmp7_ != NULL) { + GeeTreeMapNode* _tmp8_; + GeeTreeMapNode* _tmp9_; + GeeTreeMapNodeColor _tmp10_; + GeeTreeMapNodeColor _tmp11_ = 0; + _tmp8_ = self->right; + _tmp9_ = self->right; + _tmp10_ = _tmp9_->color; + _tmp11_ = gee_tree_map_node_color_flip (_tmp10_); + _tmp8_->color = _tmp11_; + } +} + + +static void gee_tree_map_node_instance_init (GeeTreeMapNode * self) { +} + + +static void gee_tree_map_node_free (GeeTreeMapNode* self) { + _gee_tree_map_node_free0 (self->left); + _gee_tree_map_node_free0 (self->right); + g_slice_free (GeeTreeMapNode, self); +} + + +static GeeMapEntry* gee_tree_map_entry_entry_for (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMapNode* node) { + GeeMapEntry* result = NULL; + GeeTreeMapNode* _tmp0_; + GeeMapEntry* _tmp1_; + GeeMapEntry* _tmp2_; + GeeMapEntry* _result_; + GeeTreeMapNode* _tmp3_; + GeeMapEntry* _tmp4_; + g_return_val_if_fail (node != NULL, NULL); + _tmp0_ = node; + _tmp1_ = _tmp0_->entry; + _tmp2_ = _g_object_ref0 (_tmp1_); + _result_ = _tmp2_; + _tmp3_ = node; + _tmp4_ = _tmp3_->entry; + if (_tmp4_ == NULL) { + GeeTreeMapNode* _tmp5_; + GeeTreeMapEntry* _tmp6_; + GeeTreeMapNode* _tmp7_; + GeeMapEntry* _tmp8_; + GeeMapEntry* _tmp9_; + GeeTreeMapNode* _tmp10_; + _tmp5_ = node; + _tmp6_ = gee_tree_map_entry_new (k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func, _tmp5_); + _g_object_unref0 (_result_); + _result_ = (GeeMapEntry*) _tmp6_; + _tmp7_ = node; + _tmp8_ = _result_; + _tmp7_->entry = _tmp8_; + _tmp9_ = _result_; + _tmp10_ = node; + g_object_add_weak_pointer ((GObject*) _tmp9_, (void**) (&_tmp10_->entry)); + } + result = _result_; + return result; +} + + +static GeeTreeMapEntry* gee_tree_map_entry_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMapNode* node) { + GeeTreeMapEntry * self = NULL; + GeeTreeMapNode* _tmp0_; + g_return_val_if_fail (node != NULL, NULL); + self = (GeeTreeMapEntry*) gee_map_entry_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _tmp0_ = node; + self->priv->_node = _tmp0_; + return self; +} + + +static GeeTreeMapEntry* gee_tree_map_entry_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMapNode* node) { + return gee_tree_map_entry_construct (GEE_TREE_MAP_TYPE_ENTRY, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, node); +} + + +static gconstpointer gee_tree_map_entry_real_get_key (GeeMapEntry* base) { + gconstpointer result; + GeeTreeMapEntry* self; + GeeTreeMapNode* _tmp0_; + gconstpointer _tmp1_; + self = (GeeTreeMapEntry*) base; + _tmp0_ = self->priv->_node; + _tmp1_ = _tmp0_->key; + result = _tmp1_; + return result; +} + + +static gconstpointer gee_tree_map_entry_real_get_value (GeeMapEntry* base) { + gconstpointer result; + GeeTreeMapEntry* self; + GeeTreeMapNode* _tmp0_; + gconstpointer _tmp1_; + self = (GeeTreeMapEntry*) base; + _tmp0_ = self->priv->_node; + _tmp1_ = _tmp0_->value; + result = _tmp1_; + return result; +} + + +static void gee_tree_map_entry_real_set_value (GeeMapEntry* base, gconstpointer value) { + GeeTreeMapEntry* self; + GeeTreeMapNode* _tmp0_; + gconstpointer _tmp1_; + gpointer _tmp2_; + self = (GeeTreeMapEntry*) base; + _tmp0_ = self->priv->_node; + _tmp1_ = value; + _tmp2_ = ((_tmp1_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp1_) : ((gpointer) _tmp1_); + ((_tmp0_->value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_tmp0_->value = (self->priv->v_destroy_func (_tmp0_->value), NULL)); + _tmp0_->value = _tmp2_; + g_object_notify ((GObject *) self, "value"); +} + + +static void gee_tree_map_entry_class_init (GeeTreeMapEntryClass * klass) { + gee_tree_map_entry_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTreeMapEntryPrivate)); + GEE_MAP_ENTRY_CLASS (klass)->get_key = gee_tree_map_entry_real_get_key; + GEE_MAP_ENTRY_CLASS (klass)->get_value = gee_tree_map_entry_real_get_value; + GEE_MAP_ENTRY_CLASS (klass)->set_value = gee_tree_map_entry_real_set_value; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_tree_map_entry_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_tree_map_entry_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_tree_map_entry_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_KEY, g_param_spec_pointer ("key", "key", "key", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_VALUE, g_param_spec_pointer ("value", "value", "value", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +static void gee_tree_map_entry_instance_init (GeeTreeMapEntry * self) { + self->priv = GEE_TREE_MAP_ENTRY_GET_PRIVATE (self); +} + + +static void gee_tree_map_entry_finalize (GObject* obj) { + GeeTreeMapEntry * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TREE_MAP_TYPE_ENTRY, GeeTreeMapEntry); + G_OBJECT_CLASS (gee_tree_map_entry_parent_class)->finalize (obj); +} + + +static GType gee_tree_map_entry_get_type (void) { + static volatile gsize gee_tree_map_entry_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_map_entry_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTreeMapEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tree_map_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTreeMapEntry), 0, (GInstanceInitFunc) gee_tree_map_entry_instance_init, NULL }; + GType gee_tree_map_entry_type_id; + gee_tree_map_entry_type_id = g_type_register_static (GEE_MAP_TYPE_ENTRY, "GeeTreeMapEntry", &g_define_type_info, 0); + g_once_init_leave (&gee_tree_map_entry_type_id__volatile, gee_tree_map_entry_type_id); + } + return gee_tree_map_entry_type_id__volatile; +} + + +static void _vala_gee_tree_map_entry_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeTreeMapEntry * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_ENTRY, GeeTreeMapEntry); + switch (property_id) { + case GEE_TREE_MAP_ENTRY_KEY: + g_value_set_pointer (value, gee_map_entry_get_key ((GeeMapEntry*) self)); + break; + case GEE_TREE_MAP_ENTRY_VALUE: + g_value_set_pointer (value, gee_map_entry_get_value ((GeeMapEntry*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_tree_map_entry_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeTreeMapEntry * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_ENTRY, GeeTreeMapEntry); + switch (property_id) { + case GEE_TREE_MAP_ENTRY_VALUE: + gee_map_entry_set_value ((GeeMapEntry*) self, g_value_get_pointer (value)); + break; + case GEE_TREE_MAP_ENTRY_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_ENTRY_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_ENTRY_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_ENTRY_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_ENTRY_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_ENTRY_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeTreeMapKeySet* gee_tree_map_key_set_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map) { + GeeTreeMapKeySet * self = NULL; + GeeTreeMap* _tmp0_; + GeeTreeMap* _tmp1_; + g_return_val_if_fail (map != NULL, NULL); + self = (GeeTreeMapKeySet*) gee_abstract_set_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _tmp0_ = map; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->_map); + self->priv->_map = _tmp1_; + return self; +} + + +static GeeTreeMapKeySet* gee_tree_map_key_set_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map) { + return gee_tree_map_key_set_construct (GEE_TREE_MAP_TYPE_KEY_SET, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, map); +} + + +static GeeIterator* gee_tree_map_key_set_real_iterator (GeeAbstractCollection* base) { + GeeTreeMapKeySet * self; + GeeIterator* result = NULL; + GeeTreeMap* _tmp0_; + GeeTreeMapKeyIterator* _tmp1_; + self = (GeeTreeMapKeySet*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_tree_map_key_iterator_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, _tmp0_); + result = (GeeIterator*) _tmp1_; + return result; +} + + +static gboolean gee_tree_map_key_set_real_add (GeeAbstractCollection* base, gconstpointer key) { + GeeTreeMapKeySet * self; + gboolean result = FALSE; + self = (GeeTreeMapKeySet*) base; + g_assert_not_reached (); + return result; +} + + +static void gee_tree_map_key_set_real_clear (GeeAbstractCollection* base) { + GeeTreeMapKeySet * self; + self = (GeeTreeMapKeySet*) base; + g_assert_not_reached (); +} + + +static gboolean gee_tree_map_key_set_real_remove (GeeAbstractCollection* base, gconstpointer key) { + GeeTreeMapKeySet * self; + gboolean result = FALSE; + self = (GeeTreeMapKeySet*) base; + g_assert_not_reached (); + return result; +} + + +static gboolean gee_tree_map_key_set_real_contains (GeeAbstractCollection* base, gconstpointer key) { + GeeTreeMapKeySet * self; + gboolean result = FALSE; + GeeTreeMap* _tmp0_; + gconstpointer _tmp1_; + gboolean _tmp2_ = FALSE; + self = (GeeTreeMapKeySet*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = key; + _tmp2_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, _tmp1_); + result = _tmp2_; + return result; +} + + +static gboolean gee_tree_map_key_set_real_add_all (GeeAbstractCollection* base, GeeCollection* collection) { + GeeTreeMapKeySet * self; + gboolean result = FALSE; + self = (GeeTreeMapKeySet*) base; + g_return_val_if_fail (collection != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gboolean gee_tree_map_key_set_real_remove_all (GeeAbstractCollection* base, GeeCollection* collection) { + GeeTreeMapKeySet * self; + gboolean result = FALSE; + self = (GeeTreeMapKeySet*) base; + g_return_val_if_fail (collection != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gboolean gee_tree_map_key_set_real_retain_all (GeeAbstractCollection* base, GeeCollection* collection) { + GeeTreeMapKeySet * self; + gboolean result = FALSE; + self = (GeeTreeMapKeySet*) base; + g_return_val_if_fail (collection != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gint gee_tree_map_key_set_real_get_size (GeeAbstractCollection* base) { + gint result; + GeeTreeMapKeySet* self; + GeeTreeMap* _tmp0_; + gint _tmp1_; + gint _tmp2_; + self = (GeeTreeMapKeySet*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_abstract_map_get_size ((GeeMap*) _tmp0_); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +static void gee_tree_map_key_set_class_init (GeeTreeMapKeySetClass * klass) { + gee_tree_map_key_set_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTreeMapKeySetPrivate)); + GEE_ABSTRACT_COLLECTION_CLASS (klass)->iterator = gee_tree_map_key_set_real_iterator; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add = gee_tree_map_key_set_real_add; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->clear = gee_tree_map_key_set_real_clear; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove = gee_tree_map_key_set_real_remove; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains = gee_tree_map_key_set_real_contains; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add_all = gee_tree_map_key_set_real_add_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove_all = gee_tree_map_key_set_real_remove_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->retain_all = gee_tree_map_key_set_real_retain_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_size = gee_tree_map_key_set_real_get_size; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_tree_map_key_set_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_tree_map_key_set_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_tree_map_key_set_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_KEY_SET_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_KEY_SET_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_KEY_SET_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_KEY_SET_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_KEY_SET_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_KEY_SET_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_KEY_SET_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_tree_map_key_set_instance_init (GeeTreeMapKeySet * self) { + self->priv = GEE_TREE_MAP_KEY_SET_GET_PRIVATE (self); +} + + +static void gee_tree_map_key_set_finalize (GObject* obj) { + GeeTreeMapKeySet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TREE_MAP_TYPE_KEY_SET, GeeTreeMapKeySet); + _g_object_unref0 (self->priv->_map); + G_OBJECT_CLASS (gee_tree_map_key_set_parent_class)->finalize (obj); +} + + +static GType gee_tree_map_key_set_get_type (void) { + static volatile gsize gee_tree_map_key_set_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_map_key_set_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTreeMapKeySetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tree_map_key_set_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTreeMapKeySet), 0, (GInstanceInitFunc) gee_tree_map_key_set_instance_init, NULL }; + GType gee_tree_map_key_set_type_id; + gee_tree_map_key_set_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_SET, "GeeTreeMapKeySet", &g_define_type_info, 0); + g_once_init_leave (&gee_tree_map_key_set_type_id__volatile, gee_tree_map_key_set_type_id); + } + return gee_tree_map_key_set_type_id__volatile; +} + + +static void _vala_gee_tree_map_key_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeTreeMapKeySet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_KEY_SET, GeeTreeMapKeySet); + switch (property_id) { + case GEE_TREE_MAP_KEY_SET_SIZE: + g_value_set_int (value, gee_abstract_collection_get_size ((GeeAbstractCollection*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_tree_map_key_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeTreeMapKeySet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_KEY_SET, GeeTreeMapKeySet); + switch (property_id) { + case GEE_TREE_MAP_KEY_SET_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_KEY_SET_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_KEY_SET_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_KEY_SET_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_KEY_SET_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_KEY_SET_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeTreeMapValueCollection* gee_tree_map_value_collection_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map) { + GeeTreeMapValueCollection * self = NULL; + GeeTreeMap* _tmp0_; + GeeTreeMap* _tmp1_; + g_return_val_if_fail (map != NULL, NULL); + self = (GeeTreeMapValueCollection*) gee_abstract_collection_construct (object_type, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _tmp0_ = map; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->_map); + self->priv->_map = _tmp1_; + return self; +} + + +static GeeTreeMapValueCollection* gee_tree_map_value_collection_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map) { + return gee_tree_map_value_collection_construct (GEE_TREE_MAP_TYPE_VALUE_COLLECTION, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, map); +} + + +static GeeIterator* gee_tree_map_value_collection_real_iterator (GeeAbstractCollection* base) { + GeeTreeMapValueCollection * self; + GeeIterator* result = NULL; + GeeTreeMap* _tmp0_; + GeeTreeMapValueIterator* _tmp1_; + self = (GeeTreeMapValueCollection*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_tree_map_value_iterator_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, _tmp0_); + result = (GeeIterator*) _tmp1_; + return result; +} + + +static gboolean gee_tree_map_value_collection_real_add (GeeAbstractCollection* base, gconstpointer key) { + GeeTreeMapValueCollection * self; + gboolean result = FALSE; + self = (GeeTreeMapValueCollection*) base; + g_assert_not_reached (); + return result; +} + + +static void gee_tree_map_value_collection_real_clear (GeeAbstractCollection* base) { + GeeTreeMapValueCollection * self; + self = (GeeTreeMapValueCollection*) base; + g_assert_not_reached (); +} + + +static gboolean gee_tree_map_value_collection_real_remove (GeeAbstractCollection* base, gconstpointer key) { + GeeTreeMapValueCollection * self; + gboolean result = FALSE; + self = (GeeTreeMapValueCollection*) base; + g_assert_not_reached (); + return result; +} + + +static gboolean gee_tree_map_value_collection_real_contains (GeeAbstractCollection* base, gconstpointer key) { + GeeTreeMapValueCollection * self; + gboolean result = FALSE; + GeeIterator* _tmp0_ = NULL; + GeeIterator* it; + self = (GeeTreeMapValueCollection*) base; + _tmp0_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self); + it = _tmp0_; + while (TRUE) { + GeeIterator* _tmp1_; + gboolean _tmp2_ = FALSE; + GeeTreeMap* _tmp3_; + GEqualFunc _tmp4_; + GEqualFunc _tmp5_; + gconstpointer _tmp6_; + GeeIterator* _tmp7_; + gpointer _tmp8_ = NULL; + gpointer _tmp9_; + gboolean _tmp10_ = FALSE; + gboolean _tmp11_; + _tmp1_ = it; + _tmp2_ = gee_iterator_next (_tmp1_); + if (!_tmp2_) { + break; + } + _tmp3_ = self->priv->_map; + _tmp4_ = gee_tree_map_get_value_equal_func (_tmp3_); + _tmp5_ = _tmp4_; + _tmp6_ = key; + _tmp7_ = it; + _tmp8_ = gee_iterator_get (_tmp7_); + _tmp9_ = _tmp8_; + _tmp10_ = _tmp5_ (_tmp6_, _tmp9_); + _tmp11_ = _tmp10_; + ((_tmp9_ == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_tmp9_ = (self->priv->v_destroy_func (_tmp9_), NULL)); + if (_tmp11_) { + result = TRUE; + _g_object_unref0 (it); + return result; + } + } + result = FALSE; + _g_object_unref0 (it); + return result; +} + + +static gboolean gee_tree_map_value_collection_real_add_all (GeeAbstractCollection* base, GeeCollection* collection) { + GeeTreeMapValueCollection * self; + gboolean result = FALSE; + self = (GeeTreeMapValueCollection*) base; + g_return_val_if_fail (collection != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gboolean gee_tree_map_value_collection_real_remove_all (GeeAbstractCollection* base, GeeCollection* collection) { + GeeTreeMapValueCollection * self; + gboolean result = FALSE; + self = (GeeTreeMapValueCollection*) base; + g_return_val_if_fail (collection != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gboolean gee_tree_map_value_collection_real_retain_all (GeeAbstractCollection* base, GeeCollection* collection) { + GeeTreeMapValueCollection * self; + gboolean result = FALSE; + self = (GeeTreeMapValueCollection*) base; + g_return_val_if_fail (collection != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gint gee_tree_map_value_collection_real_get_size (GeeAbstractCollection* base) { + gint result; + GeeTreeMapValueCollection* self; + GeeTreeMap* _tmp0_; + gint _tmp1_; + gint _tmp2_; + self = (GeeTreeMapValueCollection*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_abstract_map_get_size ((GeeMap*) _tmp0_); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +static void gee_tree_map_value_collection_class_init (GeeTreeMapValueCollectionClass * klass) { + gee_tree_map_value_collection_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTreeMapValueCollectionPrivate)); + GEE_ABSTRACT_COLLECTION_CLASS (klass)->iterator = gee_tree_map_value_collection_real_iterator; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add = gee_tree_map_value_collection_real_add; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->clear = gee_tree_map_value_collection_real_clear; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove = gee_tree_map_value_collection_real_remove; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains = gee_tree_map_value_collection_real_contains; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add_all = gee_tree_map_value_collection_real_add_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove_all = gee_tree_map_value_collection_real_remove_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->retain_all = gee_tree_map_value_collection_real_retain_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_size = gee_tree_map_value_collection_real_get_size; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_tree_map_value_collection_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_tree_map_value_collection_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_tree_map_value_collection_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_VALUE_COLLECTION_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_VALUE_COLLECTION_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_VALUE_COLLECTION_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_VALUE_COLLECTION_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_VALUE_COLLECTION_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_VALUE_COLLECTION_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_VALUE_COLLECTION_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_tree_map_value_collection_instance_init (GeeTreeMapValueCollection * self) { + self->priv = GEE_TREE_MAP_VALUE_COLLECTION_GET_PRIVATE (self); +} + + +static void gee_tree_map_value_collection_finalize (GObject* obj) { + GeeTreeMapValueCollection * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TREE_MAP_TYPE_VALUE_COLLECTION, GeeTreeMapValueCollection); + _g_object_unref0 (self->priv->_map); + G_OBJECT_CLASS (gee_tree_map_value_collection_parent_class)->finalize (obj); +} + + +static GType gee_tree_map_value_collection_get_type (void) { + static volatile gsize gee_tree_map_value_collection_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_map_value_collection_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTreeMapValueCollectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tree_map_value_collection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTreeMapValueCollection), 0, (GInstanceInitFunc) gee_tree_map_value_collection_instance_init, NULL }; + GType gee_tree_map_value_collection_type_id; + gee_tree_map_value_collection_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_COLLECTION, "GeeTreeMapValueCollection", &g_define_type_info, 0); + g_once_init_leave (&gee_tree_map_value_collection_type_id__volatile, gee_tree_map_value_collection_type_id); + } + return gee_tree_map_value_collection_type_id__volatile; +} + + +static void _vala_gee_tree_map_value_collection_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeTreeMapValueCollection * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_VALUE_COLLECTION, GeeTreeMapValueCollection); + switch (property_id) { + case GEE_TREE_MAP_VALUE_COLLECTION_SIZE: + g_value_set_int (value, gee_abstract_collection_get_size ((GeeAbstractCollection*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_tree_map_value_collection_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeTreeMapValueCollection * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_VALUE_COLLECTION, GeeTreeMapValueCollection); + switch (property_id) { + case GEE_TREE_MAP_VALUE_COLLECTION_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_VALUE_COLLECTION_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_VALUE_COLLECTION_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_VALUE_COLLECTION_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_VALUE_COLLECTION_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_VALUE_COLLECTION_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeTreeMapEntrySet* gee_tree_map_entry_set_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map) { + GeeTreeMapEntrySet * self = NULL; + GeeTreeMap* _tmp0_; + GeeTreeMap* _tmp1_; + g_return_val_if_fail (map != NULL, NULL); + self = (GeeTreeMapEntrySet*) gee_abstract_set_construct (object_type, GEE_MAP_TYPE_ENTRY, (GBoxedCopyFunc) g_object_ref, g_object_unref); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _tmp0_ = map; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->_map); + self->priv->_map = _tmp1_; + return self; +} + + +static GeeTreeMapEntrySet* gee_tree_map_entry_set_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map) { + return gee_tree_map_entry_set_construct (GEE_TREE_MAP_TYPE_ENTRY_SET, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, map); +} + + +static GeeIterator* gee_tree_map_entry_set_real_iterator (GeeAbstractCollection* base) { + GeeTreeMapEntrySet * self; + GeeIterator* result = NULL; + GeeTreeMap* _tmp0_; + GeeTreeMapEntryIterator* _tmp1_; + self = (GeeTreeMapEntrySet*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_tree_map_entry_iterator_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, _tmp0_); + result = (GeeIterator*) _tmp1_; + return result; +} + + +static gboolean gee_tree_map_entry_set_real_add (GeeAbstractCollection* base, GeeMapEntry* entry) { + GeeTreeMapEntrySet * self; + gboolean result = FALSE; + self = (GeeTreeMapEntrySet*) base; + g_return_val_if_fail (entry != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static void gee_tree_map_entry_set_real_clear (GeeAbstractCollection* base) { + GeeTreeMapEntrySet * self; + self = (GeeTreeMapEntrySet*) base; + g_assert_not_reached (); +} + + +static gboolean gee_tree_map_entry_set_real_remove (GeeAbstractCollection* base, GeeMapEntry* entry) { + GeeTreeMapEntrySet * self; + gboolean result = FALSE; + self = (GeeTreeMapEntrySet*) base; + g_return_val_if_fail (entry != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gboolean gee_tree_map_entry_set_real_contains (GeeAbstractCollection* base, GeeMapEntry* entry) { + GeeTreeMapEntrySet * self; + gboolean result = FALSE; + GeeTreeMap* _tmp0_; + GeeMapEntry* _tmp1_; + gconstpointer _tmp2_; + gconstpointer _tmp3_; + GeeMapEntry* _tmp4_; + gconstpointer _tmp5_; + gconstpointer _tmp6_; + gboolean _tmp7_ = FALSE; + self = (GeeTreeMapEntrySet*) base; + g_return_val_if_fail (entry != NULL, FALSE); + _tmp0_ = self->priv->_map; + _tmp1_ = entry; + _tmp2_ = gee_map_entry_get_key (_tmp1_); + _tmp3_ = _tmp2_; + _tmp4_ = entry; + _tmp5_ = gee_map_entry_get_value (_tmp4_); + _tmp6_ = _tmp5_; + _tmp7_ = gee_abstract_map_has ((GeeAbstractMap*) _tmp0_, _tmp3_, _tmp6_); + result = _tmp7_; + return result; +} + + +static gboolean gee_tree_map_entry_set_real_add_all (GeeAbstractCollection* base, GeeCollection* entries) { + GeeTreeMapEntrySet * self; + gboolean result = FALSE; + self = (GeeTreeMapEntrySet*) base; + g_return_val_if_fail (entries != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gboolean gee_tree_map_entry_set_real_remove_all (GeeAbstractCollection* base, GeeCollection* entries) { + GeeTreeMapEntrySet * self; + gboolean result = FALSE; + self = (GeeTreeMapEntrySet*) base; + g_return_val_if_fail (entries != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gboolean gee_tree_map_entry_set_real_retain_all (GeeAbstractCollection* base, GeeCollection* entries) { + GeeTreeMapEntrySet * self; + gboolean result = FALSE; + self = (GeeTreeMapEntrySet*) base; + g_return_val_if_fail (entries != NULL, FALSE); + g_assert_not_reached (); + return result; +} + + +static gint gee_tree_map_entry_set_real_get_size (GeeAbstractCollection* base) { + gint result; + GeeTreeMapEntrySet* self; + GeeTreeMap* _tmp0_; + gint _tmp1_; + gint _tmp2_; + self = (GeeTreeMapEntrySet*) base; + _tmp0_ = self->priv->_map; + _tmp1_ = gee_abstract_map_get_size ((GeeMap*) _tmp0_); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +static void gee_tree_map_entry_set_class_init (GeeTreeMapEntrySetClass * klass) { + gee_tree_map_entry_set_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTreeMapEntrySetPrivate)); + GEE_ABSTRACT_COLLECTION_CLASS (klass)->iterator = gee_tree_map_entry_set_real_iterator; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add = gee_tree_map_entry_set_real_add; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->clear = gee_tree_map_entry_set_real_clear; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove = gee_tree_map_entry_set_real_remove; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains = gee_tree_map_entry_set_real_contains; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add_all = gee_tree_map_entry_set_real_add_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove_all = gee_tree_map_entry_set_real_remove_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->retain_all = gee_tree_map_entry_set_real_retain_all; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_size = gee_tree_map_entry_set_real_get_size; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_tree_map_entry_set_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_tree_map_entry_set_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_tree_map_entry_set_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_SET_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_SET_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_SET_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_SET_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_SET_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_SET_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_SET_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_tree_map_entry_set_instance_init (GeeTreeMapEntrySet * self) { + self->priv = GEE_TREE_MAP_ENTRY_SET_GET_PRIVATE (self); +} + + +static void gee_tree_map_entry_set_finalize (GObject* obj) { + GeeTreeMapEntrySet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TREE_MAP_TYPE_ENTRY_SET, GeeTreeMapEntrySet); + _g_object_unref0 (self->priv->_map); + G_OBJECT_CLASS (gee_tree_map_entry_set_parent_class)->finalize (obj); +} + + +static GType gee_tree_map_entry_set_get_type (void) { + static volatile gsize gee_tree_map_entry_set_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_map_entry_set_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTreeMapEntrySetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tree_map_entry_set_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTreeMapEntrySet), 0, (GInstanceInitFunc) gee_tree_map_entry_set_instance_init, NULL }; + GType gee_tree_map_entry_set_type_id; + gee_tree_map_entry_set_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_SET, "GeeTreeMapEntrySet", &g_define_type_info, 0); + g_once_init_leave (&gee_tree_map_entry_set_type_id__volatile, gee_tree_map_entry_set_type_id); + } + return gee_tree_map_entry_set_type_id__volatile; +} + + +static void _vala_gee_tree_map_entry_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeTreeMapEntrySet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_ENTRY_SET, GeeTreeMapEntrySet); + switch (property_id) { + case GEE_TREE_MAP_ENTRY_SET_SIZE: + g_value_set_int (value, gee_abstract_collection_get_size ((GeeAbstractCollection*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_tree_map_entry_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeTreeMapEntrySet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_ENTRY_SET, GeeTreeMapEntrySet); + switch (property_id) { + case GEE_TREE_MAP_ENTRY_SET_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_ENTRY_SET_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_ENTRY_SET_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_ENTRY_SET_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_ENTRY_SET_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_ENTRY_SET_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeTreeMapNodeIterator* gee_tree_map_node_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map) { + GeeTreeMapNodeIterator * self = NULL; + GeeTreeMap* _tmp0_; + GeeTreeMap* _tmp1_; + GeeTreeMap* _tmp2_; + gint _tmp3_; + g_return_val_if_fail (map != NULL, NULL); + self = (GeeTreeMapNodeIterator*) g_object_new (object_type, NULL); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _tmp0_ = map; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->_map); + self->_map = _tmp1_; + _tmp2_ = self->_map; + _tmp3_ = _tmp2_->priv->stamp; + self->stamp = _tmp3_; + return self; +} + + +static GeeTreeMapNodeIterator* gee_tree_map_node_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map) { + return gee_tree_map_node_iterator_construct (GEE_TREE_MAP_TYPE_NODE_ITERATOR, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, map); +} + + +static gboolean gee_tree_map_node_iterator_next (GeeTreeMapNodeIterator* self) { + gboolean result = FALSE; + gint _tmp0_; + GeeTreeMap* _tmp1_; + gint _tmp2_; + GeeTreeMapNode* _tmp3_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = self->stamp; + _tmp1_ = self->_map; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _map.stamp"); + _tmp3_ = self->current; + if (_tmp3_ != NULL) { + GeeTreeMapNode* _tmp4_; + GeeTreeMapNode* _tmp5_; + _tmp4_ = self->current; + _tmp5_ = _tmp4_->next; + if (_tmp5_ != NULL) { + GeeTreeMapNode* _tmp6_; + GeeTreeMapNode* _tmp7_; + _tmp6_ = self->current; + _tmp7_ = _tmp6_->next; + self->current = _tmp7_; + result = TRUE; + return result; + } else { + result = FALSE; + return result; + } + } else { + gboolean _tmp8_ = FALSE; + GeeTreeMapNode* _tmp9_; + gboolean _tmp11_; + _tmp9_ = self->_next; + if (_tmp9_ == NULL) { + GeeTreeMapNode* _tmp10_; + _tmp10_ = self->_prev; + _tmp8_ = _tmp10_ == NULL; + } else { + _tmp8_ = FALSE; + } + _tmp11_ = _tmp8_; + if (_tmp11_) { + GeeTreeMap* _tmp12_; + GeeTreeMapNode* _tmp13_; + GeeTreeMapNode* _tmp14_; + _tmp12_ = self->_map; + _tmp13_ = _tmp12_->priv->first; + self->current = _tmp13_; + _tmp14_ = self->current; + result = _tmp14_ != NULL; + return result; + } else { + GeeTreeMapNode* _tmp15_; + GeeTreeMapNode* _tmp16_; + GeeTreeMapNode* _tmp17_; + _tmp15_ = self->_next; + self->current = _tmp15_; + _tmp16_ = self->current; + if (_tmp16_ != NULL) { + self->_next = NULL; + self->_prev = NULL; + } + _tmp17_ = self->current; + result = _tmp17_ != NULL; + return result; + } + } +} + + +static gboolean gee_tree_map_node_iterator_has_next (GeeTreeMapNodeIterator* self) { + gboolean result = FALSE; + gint _tmp0_; + GeeTreeMap* _tmp1_; + gint _tmp2_; + gboolean _tmp3_ = FALSE; + gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + GeeTreeMapNode* _tmp8_; + gboolean _tmp10_; + gboolean _tmp12_; + gboolean _tmp15_; + gboolean _tmp20_; + gboolean _tmp26_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = self->stamp; + _tmp1_ = self->_map; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _map.stamp"); + _tmp8_ = self->current; + if (_tmp8_ == NULL) { + GeeTreeMapNode* _tmp9_; + _tmp9_ = self->_next; + _tmp7_ = _tmp9_ == NULL; + } else { + _tmp7_ = FALSE; + } + _tmp10_ = _tmp7_; + if (_tmp10_) { + GeeTreeMapNode* _tmp11_; + _tmp11_ = self->_prev; + _tmp6_ = _tmp11_ == NULL; + } else { + _tmp6_ = FALSE; + } + _tmp12_ = _tmp6_; + if (_tmp12_) { + GeeTreeMap* _tmp13_; + GeeTreeMapNode* _tmp14_; + _tmp13_ = self->_map; + _tmp14_ = _tmp13_->priv->first; + _tmp5_ = _tmp14_ != NULL; + } else { + _tmp5_ = FALSE; + } + _tmp15_ = _tmp5_; + if (_tmp15_) { + _tmp4_ = TRUE; + } else { + gboolean _tmp16_ = FALSE; + GeeTreeMapNode* _tmp17_; + gboolean _tmp19_; + _tmp17_ = self->current; + if (_tmp17_ == NULL) { + GeeTreeMapNode* _tmp18_; + _tmp18_ = self->_next; + _tmp16_ = _tmp18_ != NULL; + } else { + _tmp16_ = FALSE; + } + _tmp19_ = _tmp16_; + _tmp4_ = _tmp19_; + } + _tmp20_ = _tmp4_; + if (_tmp20_) { + _tmp3_ = TRUE; + } else { + gboolean _tmp21_ = FALSE; + GeeTreeMapNode* _tmp22_; + gboolean _tmp25_; + _tmp22_ = self->current; + if (_tmp22_ != NULL) { + GeeTreeMapNode* _tmp23_; + GeeTreeMapNode* _tmp24_; + _tmp23_ = self->current; + _tmp24_ = _tmp23_->next; + _tmp21_ = _tmp24_ != NULL; + } else { + _tmp21_ = FALSE; + } + _tmp25_ = _tmp21_; + _tmp3_ = _tmp25_; + } + _tmp26_ = _tmp3_; + result = _tmp26_; + return result; +} + + +static gboolean gee_tree_map_node_iterator_first (GeeTreeMapNodeIterator* self) { + gboolean result = FALSE; + gint _tmp0_; + GeeTreeMap* _tmp1_; + gint _tmp2_; + GeeTreeMap* _tmp3_; + GeeTreeMapNode* _tmp4_; + GeeTreeMapNode* _tmp5_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = self->stamp; + _tmp1_ = self->_map; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _map.stamp"); + _tmp3_ = self->_map; + _tmp4_ = _tmp3_->priv->first; + self->current = _tmp4_; + self->_next = NULL; + self->_prev = NULL; + _tmp5_ = self->current; + result = _tmp5_ != NULL; + return result; +} + + +static gboolean gee_tree_map_node_iterator_previous (GeeTreeMapNodeIterator* self) { + gboolean result = FALSE; + gint _tmp0_; + GeeTreeMap* _tmp1_; + gint _tmp2_; + GeeTreeMapNode* _tmp3_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = self->stamp; + _tmp1_ = self->_map; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _map.stamp"); + _tmp3_ = self->current; + if (_tmp3_ != NULL) { + GeeTreeMapNode* _tmp4_; + GeeTreeMapNode* _tmp5_; + _tmp4_ = self->current; + _tmp5_ = _tmp4_->prev; + if (_tmp5_ != NULL) { + GeeTreeMapNode* _tmp6_; + GeeTreeMapNode* _tmp7_; + _tmp6_ = self->current; + _tmp7_ = _tmp6_->prev; + self->current = _tmp7_; + result = TRUE; + return result; + } else { + result = FALSE; + return result; + } + } else { + GeeTreeMapNode* _tmp8_; + _tmp8_ = self->_prev; + if (_tmp8_ != NULL) { + GeeTreeMapNode* _tmp9_; + _tmp9_ = self->_prev; + self->current = _tmp9_; + self->_next = NULL; + self->_prev = NULL; + result = TRUE; + return result; + } else { + result = FALSE; + return result; + } + } +} + + +static gboolean gee_tree_map_node_iterator_has_previous (GeeTreeMapNodeIterator* self) { + gboolean result = FALSE; + gint _tmp0_; + GeeTreeMap* _tmp1_; + gint _tmp2_; + gboolean _tmp3_ = FALSE; + gboolean _tmp4_ = FALSE; + GeeTreeMapNode* _tmp5_; + gboolean _tmp7_; + gboolean _tmp13_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = self->stamp; + _tmp1_ = self->_map; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _map.stamp"); + _tmp5_ = self->current; + if (_tmp5_ == NULL) { + GeeTreeMapNode* _tmp6_; + _tmp6_ = self->_prev; + _tmp4_ = _tmp6_ != NULL; + } else { + _tmp4_ = FALSE; + } + _tmp7_ = _tmp4_; + if (_tmp7_) { + _tmp3_ = TRUE; + } else { + gboolean _tmp8_ = FALSE; + GeeTreeMapNode* _tmp9_; + gboolean _tmp12_; + _tmp9_ = self->current; + if (_tmp9_ != NULL) { + GeeTreeMapNode* _tmp10_; + GeeTreeMapNode* _tmp11_; + _tmp10_ = self->current; + _tmp11_ = _tmp10_->prev; + _tmp8_ = _tmp11_ != NULL; + } else { + _tmp8_ = FALSE; + } + _tmp12_ = _tmp8_; + _tmp3_ = _tmp12_; + } + _tmp13_ = _tmp3_; + result = _tmp13_; + return result; +} + + +static gboolean gee_tree_map_node_iterator_last (GeeTreeMapNodeIterator* self) { + gboolean result = FALSE; + gint _tmp0_; + GeeTreeMap* _tmp1_; + gint _tmp2_; + GeeTreeMap* _tmp3_; + GeeTreeMapNode* _tmp4_; + GeeTreeMapNode* _tmp5_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = self->stamp; + _tmp1_ = self->_map; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _map.stamp"); + _tmp3_ = self->_map; + _tmp4_ = _tmp3_->priv->last; + self->current = _tmp4_; + self->_next = NULL; + self->_prev = NULL; + _tmp5_ = self->current; + result = _tmp5_ != NULL; + return result; +} + + +static void gee_tree_map_node_iterator_remove (GeeTreeMapNodeIterator* self) { + g_return_if_fail (self != NULL); + g_assert_not_reached (); +} + + +static void gee_tree_map_node_iterator_unset (GeeTreeMapNodeIterator* self) { + gint _tmp0_; + GeeTreeMap* _tmp1_; + gint _tmp2_; + GeeTreeMapNode* _tmp3_; + gpointer value = NULL; + GeeTreeMap* _tmp4_; + GeeTreeMap* _tmp5_; + GeeTreeMapNode* _tmp6_; + gconstpointer _tmp7_; + gpointer _tmp8_ = NULL; + GeeTreeMapNode* _tmp9_ = NULL; + GeeTreeMapNode* _tmp10_ = NULL; + gboolean _tmp11_ = FALSE; + gboolean success; + gboolean _tmp12_; + GeeTreeMap* _tmp13_; + GeeTreeMapNode* _tmp14_; + gint _tmp17_; + GeeTreeMap* _tmp18_; + gint _tmp19_; + gint _tmp20_; + GeeTreeMap* _tmp21_; + gint _tmp22_; + g_return_if_fail (self != NULL); + _tmp0_ = self->stamp; + _tmp1_ = self->_map; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _map.stamp"); + _tmp3_ = self->current; + _vala_assert (_tmp3_ != NULL, "current != null"); + _tmp4_ = self->_map; + _tmp5_ = self->_map; + _tmp6_ = self->current; + _tmp7_ = _tmp6_->key; + _tmp11_ = gee_tree_map_remove_from_node (_tmp4_, &_tmp5_->priv->root, _tmp7_, &_tmp8_, &_tmp9_, &_tmp10_); + ((value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (value = (self->priv->v_destroy_func (value), NULL)); + value = _tmp8_; + self->_prev = _tmp9_; + self->_next = _tmp10_; + success = _tmp11_; + _tmp12_ = success; + _vala_assert (_tmp12_, "success"); + _tmp13_ = self->_map; + _tmp14_ = _tmp13_->priv->root; + if (_tmp14_ != NULL) { + GeeTreeMap* _tmp15_; + GeeTreeMapNode* _tmp16_; + _tmp15_ = self->_map; + _tmp16_ = _tmp15_->priv->root; + _tmp16_->color = GEE_TREE_MAP_NODE_COLOR_BLACK; + } + self->current = NULL; + _tmp17_ = self->stamp; + self->stamp = _tmp17_ + 1; + _tmp18_ = self->_map; + _tmp19_ = _tmp18_->priv->stamp; + _tmp18_->priv->stamp = _tmp19_ + 1; + _tmp20_ = self->stamp; + _tmp21_ = self->_map; + _tmp22_ = _tmp21_->priv->stamp; + _vala_assert (_tmp20_ == _tmp22_, "stamp == _map.stamp"); + ((value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (value = (self->priv->v_destroy_func (value), NULL)); +} + + +static void gee_tree_map_node_iterator_class_init (GeeTreeMapNodeIteratorClass * klass) { + gee_tree_map_node_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTreeMapNodeIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_tree_map_node_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_tree_map_node_iterator_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_tree_map_node_iterator_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_NODE_ITERATOR_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_NODE_ITERATOR_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_NODE_ITERATOR_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_NODE_ITERATOR_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_NODE_ITERATOR_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_NODE_ITERATOR_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_tree_map_node_iterator_instance_init (GeeTreeMapNodeIterator * self) { + self->priv = GEE_TREE_MAP_NODE_ITERATOR_GET_PRIVATE (self); +} + + +static void gee_tree_map_node_iterator_finalize (GObject* obj) { + GeeTreeMapNodeIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TREE_MAP_TYPE_NODE_ITERATOR, GeeTreeMapNodeIterator); + _g_object_unref0 (self->_map); + G_OBJECT_CLASS (gee_tree_map_node_iterator_parent_class)->finalize (obj); +} + + +static GType gee_tree_map_node_iterator_get_type (void) { + static volatile gsize gee_tree_map_node_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_map_node_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTreeMapNodeIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tree_map_node_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTreeMapNodeIterator), 0, (GInstanceInitFunc) gee_tree_map_node_iterator_instance_init, NULL }; + GType gee_tree_map_node_iterator_type_id; + gee_tree_map_node_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeTreeMapNodeIterator", &g_define_type_info, 0); + g_once_init_leave (&gee_tree_map_node_iterator_type_id__volatile, gee_tree_map_node_iterator_type_id); + } + return gee_tree_map_node_iterator_type_id__volatile; +} + + +static void _vala_gee_tree_map_node_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeTreeMapNodeIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_NODE_ITERATOR, GeeTreeMapNodeIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_tree_map_node_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeTreeMapNodeIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_NODE_ITERATOR, GeeTreeMapNodeIterator); + switch (property_id) { + case GEE_TREE_MAP_NODE_ITERATOR_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_NODE_ITERATOR_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_NODE_ITERATOR_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_NODE_ITERATOR_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_NODE_ITERATOR_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_NODE_ITERATOR_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeTreeMapKeyIterator* gee_tree_map_key_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map) { + GeeTreeMapKeyIterator * self = NULL; + GeeTreeMap* _tmp0_; + g_return_val_if_fail (map != NULL, NULL); + _tmp0_ = map; + self = (GeeTreeMapKeyIterator*) gee_tree_map_node_iterator_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func, _tmp0_); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + return self; +} + + +static GeeTreeMapKeyIterator* gee_tree_map_key_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map) { + return gee_tree_map_key_iterator_construct (GEE_TREE_MAP_TYPE_KEY_ITERATOR, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, map); +} + + +static gpointer gee_tree_map_key_iterator_real_get (GeeIterator* base) { + GeeTreeMapKeyIterator * self; + gpointer result = NULL; + gint _tmp0_; + GeeTreeMap* _tmp1_; + gint _tmp2_; + GeeTreeMapNode* _tmp3_; + GeeTreeMapNode* _tmp4_; + gconstpointer _tmp5_; + gpointer _tmp6_; + self = (GeeTreeMapKeyIterator*) base; + _tmp0_ = ((GeeTreeMapNodeIterator*) self)->stamp; + _tmp1_ = ((GeeTreeMapNodeIterator*) self)->_map; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _map.stamp"); + _tmp3_ = ((GeeTreeMapNodeIterator*) self)->current; + _vala_assert (_tmp3_ != NULL, "current != null"); + _tmp4_ = ((GeeTreeMapNodeIterator*) self)->current; + _tmp5_ = _tmp4_->key; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->k_dup_func != NULL)) ? self->priv->k_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + result = _tmp6_; + return result; +} + + +static void gee_tree_map_key_iterator_class_init (GeeTreeMapKeyIteratorClass * klass) { + gee_tree_map_key_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTreeMapKeyIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_tree_map_key_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_tree_map_key_iterator_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_KEY_ITERATOR_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_KEY_ITERATOR_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_KEY_ITERATOR_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_KEY_ITERATOR_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_KEY_ITERATOR_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_KEY_ITERATOR_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_tree_map_key_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) { + gee_tree_map_key_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->get = (gpointer (*)(GeeIterator*)) gee_tree_map_key_iterator_real_get; + iface->next = (gboolean (*)(GeeIterator*)) gee_tree_map_node_iterator_next; + iface->has_next = (gboolean (*)(GeeIterator*)) gee_tree_map_node_iterator_has_next; + iface->first = (gboolean (*)(GeeIterator*)) gee_tree_map_node_iterator_first; + iface->remove = (void (*)(GeeIterator*)) gee_tree_map_node_iterator_remove; +} + + +static void gee_tree_map_key_iterator_gee_bidir_iterator_interface_init (GeeBidirIteratorIface * iface) { + gee_tree_map_key_iterator_gee_bidir_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->previous = (gboolean (*)(GeeBidirIterator*)) gee_tree_map_node_iterator_previous; + iface->has_previous = (gboolean (*)(GeeBidirIterator*)) gee_tree_map_node_iterator_has_previous; + iface->last = (gboolean (*)(GeeBidirIterator*)) gee_tree_map_node_iterator_last; +} + + +static void gee_tree_map_key_iterator_instance_init (GeeTreeMapKeyIterator * self) { + self->priv = GEE_TREE_MAP_KEY_ITERATOR_GET_PRIVATE (self); +} + + +static GType gee_tree_map_key_iterator_get_type (void) { + static volatile gsize gee_tree_map_key_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_map_key_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTreeMapKeyIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tree_map_key_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTreeMapKeyIterator), 0, (GInstanceInitFunc) gee_tree_map_key_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_tree_map_key_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + static const GInterfaceInfo gee_bidir_iterator_info = { (GInterfaceInitFunc) gee_tree_map_key_iterator_gee_bidir_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_tree_map_key_iterator_type_id; + gee_tree_map_key_iterator_type_id = g_type_register_static (GEE_TREE_MAP_TYPE_NODE_ITERATOR, "GeeTreeMapKeyIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_tree_map_key_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info); + g_type_add_interface_static (gee_tree_map_key_iterator_type_id, GEE_TYPE_BIDIR_ITERATOR, &gee_bidir_iterator_info); + g_once_init_leave (&gee_tree_map_key_iterator_type_id__volatile, gee_tree_map_key_iterator_type_id); + } + return gee_tree_map_key_iterator_type_id__volatile; +} + + +static void _vala_gee_tree_map_key_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeTreeMapKeyIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_KEY_ITERATOR, GeeTreeMapKeyIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_tree_map_key_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeTreeMapKeyIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_KEY_ITERATOR, GeeTreeMapKeyIterator); + switch (property_id) { + case GEE_TREE_MAP_KEY_ITERATOR_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_KEY_ITERATOR_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_KEY_ITERATOR_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_KEY_ITERATOR_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_KEY_ITERATOR_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_KEY_ITERATOR_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeTreeMapValueIterator* gee_tree_map_value_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map) { + GeeTreeMapValueIterator * self = NULL; + GeeTreeMap* _tmp0_; + g_return_val_if_fail (map != NULL, NULL); + _tmp0_ = map; + self = (GeeTreeMapValueIterator*) gee_tree_map_node_iterator_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func, _tmp0_); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + return self; +} + + +static GeeTreeMapValueIterator* gee_tree_map_value_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map) { + return gee_tree_map_value_iterator_construct (GEE_TREE_MAP_TYPE_VALUE_ITERATOR, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, map); +} + + +static gpointer gee_tree_map_value_iterator_real_get (GeeIterator* base) { + GeeTreeMapValueIterator * self; + gpointer result = NULL; + gint _tmp0_; + GeeTreeMap* _tmp1_; + gint _tmp2_; + GeeTreeMapNode* _tmp3_; + GeeTreeMapNode* _tmp4_; + gconstpointer _tmp5_; + gpointer _tmp6_; + self = (GeeTreeMapValueIterator*) base; + _tmp0_ = ((GeeTreeMapNodeIterator*) self)->stamp; + _tmp1_ = ((GeeTreeMapNodeIterator*) self)->_map; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _map.stamp"); + _tmp3_ = ((GeeTreeMapNodeIterator*) self)->current; + _vala_assert (_tmp3_ != NULL, "current != null"); + _tmp4_ = ((GeeTreeMapNodeIterator*) self)->current; + _tmp5_ = _tmp4_->value; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + result = _tmp6_; + return result; +} + + +static void gee_tree_map_value_iterator_class_init (GeeTreeMapValueIteratorClass * klass) { + gee_tree_map_value_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTreeMapValueIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_tree_map_value_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_tree_map_value_iterator_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_VALUE_ITERATOR_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_VALUE_ITERATOR_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_VALUE_ITERATOR_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_VALUE_ITERATOR_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_VALUE_ITERATOR_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_VALUE_ITERATOR_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_tree_map_value_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) { + gee_tree_map_value_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->get = (gpointer (*)(GeeIterator*)) gee_tree_map_value_iterator_real_get; + iface->next = (gboolean (*)(GeeIterator*)) gee_tree_map_node_iterator_next; + iface->has_next = (gboolean (*)(GeeIterator*)) gee_tree_map_node_iterator_has_next; + iface->first = (gboolean (*)(GeeIterator*)) gee_tree_map_node_iterator_first; + iface->remove = (void (*)(GeeIterator*)) gee_tree_map_node_iterator_remove; +} + + +static void gee_tree_map_value_iterator_gee_bidir_iterator_interface_init (GeeBidirIteratorIface * iface) { + gee_tree_map_value_iterator_gee_bidir_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->previous = (gboolean (*)(GeeBidirIterator*)) gee_tree_map_node_iterator_previous; + iface->has_previous = (gboolean (*)(GeeBidirIterator*)) gee_tree_map_node_iterator_has_previous; + iface->last = (gboolean (*)(GeeBidirIterator*)) gee_tree_map_node_iterator_last; +} + + +static void gee_tree_map_value_iterator_instance_init (GeeTreeMapValueIterator * self) { + self->priv = GEE_TREE_MAP_VALUE_ITERATOR_GET_PRIVATE (self); +} + + +static GType gee_tree_map_value_iterator_get_type (void) { + static volatile gsize gee_tree_map_value_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_map_value_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTreeMapValueIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tree_map_value_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTreeMapValueIterator), 0, (GInstanceInitFunc) gee_tree_map_value_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_tree_map_value_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + static const GInterfaceInfo gee_bidir_iterator_info = { (GInterfaceInitFunc) gee_tree_map_value_iterator_gee_bidir_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_tree_map_value_iterator_type_id; + gee_tree_map_value_iterator_type_id = g_type_register_static (GEE_TREE_MAP_TYPE_NODE_ITERATOR, "GeeTreeMapValueIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_tree_map_value_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info); + g_type_add_interface_static (gee_tree_map_value_iterator_type_id, GEE_TYPE_BIDIR_ITERATOR, &gee_bidir_iterator_info); + g_once_init_leave (&gee_tree_map_value_iterator_type_id__volatile, gee_tree_map_value_iterator_type_id); + } + return gee_tree_map_value_iterator_type_id__volatile; +} + + +static void _vala_gee_tree_map_value_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeTreeMapValueIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_VALUE_ITERATOR, GeeTreeMapValueIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_tree_map_value_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeTreeMapValueIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_VALUE_ITERATOR, GeeTreeMapValueIterator); + switch (property_id) { + case GEE_TREE_MAP_VALUE_ITERATOR_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_VALUE_ITERATOR_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_VALUE_ITERATOR_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_VALUE_ITERATOR_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_VALUE_ITERATOR_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_VALUE_ITERATOR_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeTreeMapEntryIterator* gee_tree_map_entry_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map) { + GeeTreeMapEntryIterator * self = NULL; + GeeTreeMap* _tmp0_; + g_return_val_if_fail (map != NULL, NULL); + _tmp0_ = map; + self = (GeeTreeMapEntryIterator*) gee_tree_map_node_iterator_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func, _tmp0_); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + return self; +} + + +static GeeTreeMapEntryIterator* gee_tree_map_entry_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map) { + return gee_tree_map_entry_iterator_construct (GEE_TREE_MAP_TYPE_ENTRY_ITERATOR, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, map); +} + + +static GeeMapEntry* gee_tree_map_entry_iterator_real_get (GeeIterator* base) { + GeeTreeMapEntryIterator * self; + GeeMapEntry* result = NULL; + gint _tmp0_; + GeeTreeMap* _tmp1_; + gint _tmp2_; + GeeTreeMapNode* _tmp3_; + GeeTreeMapNode* _tmp4_; + GeeMapEntry* _tmp5_ = NULL; + self = (GeeTreeMapEntryIterator*) base; + _tmp0_ = ((GeeTreeMapNodeIterator*) self)->stamp; + _tmp1_ = ((GeeTreeMapNodeIterator*) self)->_map; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _map.stamp"); + _tmp3_ = ((GeeTreeMapNodeIterator*) self)->current; + _vala_assert (_tmp3_ != NULL, "current != null"); + _tmp4_ = ((GeeTreeMapNodeIterator*) self)->current; + _tmp5_ = gee_tree_map_entry_entry_for (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, _tmp4_); + result = _tmp5_; + return result; +} + + +static void gee_tree_map_entry_iterator_class_init (GeeTreeMapEntryIteratorClass * klass) { + gee_tree_map_entry_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTreeMapEntryIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_tree_map_entry_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_tree_map_entry_iterator_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_ITERATOR_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_ITERATOR_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_ITERATOR_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_ITERATOR_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_ITERATOR_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRY_ITERATOR_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_tree_map_entry_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) { + gee_tree_map_entry_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->get = (gpointer (*)(GeeIterator*)) gee_tree_map_entry_iterator_real_get; + iface->next = (gboolean (*)(GeeIterator*)) gee_tree_map_node_iterator_next; + iface->has_next = (gboolean (*)(GeeIterator*)) gee_tree_map_node_iterator_has_next; + iface->first = (gboolean (*)(GeeIterator*)) gee_tree_map_node_iterator_first; + iface->remove = (void (*)(GeeIterator*)) gee_tree_map_node_iterator_remove; +} + + +static void gee_tree_map_entry_iterator_gee_bidir_iterator_interface_init (GeeBidirIteratorIface * iface) { + gee_tree_map_entry_iterator_gee_bidir_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->previous = (gboolean (*)(GeeBidirIterator*)) gee_tree_map_node_iterator_previous; + iface->has_previous = (gboolean (*)(GeeBidirIterator*)) gee_tree_map_node_iterator_has_previous; + iface->last = (gboolean (*)(GeeBidirIterator*)) gee_tree_map_node_iterator_last; +} + + +static void gee_tree_map_entry_iterator_instance_init (GeeTreeMapEntryIterator * self) { + self->priv = GEE_TREE_MAP_ENTRY_ITERATOR_GET_PRIVATE (self); +} + + +static GType gee_tree_map_entry_iterator_get_type (void) { + static volatile gsize gee_tree_map_entry_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_map_entry_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTreeMapEntryIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tree_map_entry_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTreeMapEntryIterator), 0, (GInstanceInitFunc) gee_tree_map_entry_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_tree_map_entry_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + static const GInterfaceInfo gee_bidir_iterator_info = { (GInterfaceInitFunc) gee_tree_map_entry_iterator_gee_bidir_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_tree_map_entry_iterator_type_id; + gee_tree_map_entry_iterator_type_id = g_type_register_static (GEE_TREE_MAP_TYPE_NODE_ITERATOR, "GeeTreeMapEntryIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_tree_map_entry_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info); + g_type_add_interface_static (gee_tree_map_entry_iterator_type_id, GEE_TYPE_BIDIR_ITERATOR, &gee_bidir_iterator_info); + g_once_init_leave (&gee_tree_map_entry_iterator_type_id__volatile, gee_tree_map_entry_iterator_type_id); + } + return gee_tree_map_entry_iterator_type_id__volatile; +} + + +static void _vala_gee_tree_map_entry_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeTreeMapEntryIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_ENTRY_ITERATOR, GeeTreeMapEntryIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_tree_map_entry_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeTreeMapEntryIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_ENTRY_ITERATOR, GeeTreeMapEntryIterator); + switch (property_id) { + case GEE_TREE_MAP_ENTRY_ITERATOR_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_ENTRY_ITERATOR_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_ENTRY_ITERATOR_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_ENTRY_ITERATOR_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_ENTRY_ITERATOR_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_ENTRY_ITERATOR_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeTreeMapMapIterator* gee_tree_map_map_iterator_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map) { + GeeTreeMapMapIterator * self = NULL; + GeeTreeMap* _tmp0_; + g_return_val_if_fail (map != NULL, NULL); + _tmp0_ = map; + self = (GeeTreeMapMapIterator*) gee_tree_map_node_iterator_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func, _tmp0_); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + return self; +} + + +static GeeTreeMapMapIterator* gee_tree_map_map_iterator_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeTreeMap* map) { + return gee_tree_map_map_iterator_construct (GEE_TREE_MAP_TYPE_MAP_ITERATOR, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, map); +} + + +static gpointer gee_tree_map_map_iterator_real_get_key (GeeMapIterator* base) { + GeeTreeMapMapIterator * self; + gpointer result = NULL; + gint _tmp0_; + GeeTreeMap* _tmp1_; + gint _tmp2_; + GeeTreeMapNode* _tmp3_; + GeeTreeMapNode* _tmp4_; + gconstpointer _tmp5_; + gpointer _tmp6_; + self = (GeeTreeMapMapIterator*) base; + _tmp0_ = ((GeeTreeMapNodeIterator*) self)->stamp; + _tmp1_ = ((GeeTreeMapNodeIterator*) self)->_map; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _map.stamp"); + _tmp3_ = ((GeeTreeMapNodeIterator*) self)->current; + _vala_assert (_tmp3_ != NULL, "current != null"); + _tmp4_ = ((GeeTreeMapNodeIterator*) self)->current; + _tmp5_ = _tmp4_->key; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->k_dup_func != NULL)) ? self->priv->k_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + result = _tmp6_; + return result; +} + + +static gpointer gee_tree_map_map_iterator_real_get_value (GeeMapIterator* base) { + GeeTreeMapMapIterator * self; + gpointer result = NULL; + gint _tmp0_; + GeeTreeMap* _tmp1_; + gint _tmp2_; + GeeTreeMapNode* _tmp3_; + GeeTreeMapNode* _tmp4_; + gconstpointer _tmp5_; + gpointer _tmp6_; + self = (GeeTreeMapMapIterator*) base; + _tmp0_ = ((GeeTreeMapNodeIterator*) self)->stamp; + _tmp1_ = ((GeeTreeMapNodeIterator*) self)->_map; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _map.stamp"); + _tmp3_ = ((GeeTreeMapNodeIterator*) self)->current; + _vala_assert (_tmp3_ != NULL, "current != null"); + _tmp4_ = ((GeeTreeMapNodeIterator*) self)->current; + _tmp5_ = _tmp4_->value; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + result = _tmp6_; + return result; +} + + +static void gee_tree_map_map_iterator_real_set_value (GeeMapIterator* base, gconstpointer value) { + GeeTreeMapMapIterator * self; + gint _tmp0_; + GeeTreeMap* _tmp1_; + gint _tmp2_; + GeeTreeMapNode* _tmp3_; + GeeTreeMapNode* _tmp4_; + gconstpointer _tmp5_; + gpointer _tmp6_; + self = (GeeTreeMapMapIterator*) base; + _tmp0_ = ((GeeTreeMapNodeIterator*) self)->stamp; + _tmp1_ = ((GeeTreeMapNodeIterator*) self)->_map; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _map.stamp"); + _tmp3_ = ((GeeTreeMapNodeIterator*) self)->current; + _vala_assert (_tmp3_ != NULL, "current != null"); + _tmp4_ = ((GeeTreeMapNodeIterator*) self)->current; + _tmp5_ = value; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + ((_tmp4_->value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_tmp4_->value = (self->priv->v_destroy_func (_tmp4_->value), NULL)); + _tmp4_->value = _tmp6_; +} + + +static void gee_tree_map_map_iterator_class_init (GeeTreeMapMapIteratorClass * klass) { + gee_tree_map_map_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTreeMapMapIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_tree_map_map_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_tree_map_map_iterator_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_MAP_ITERATOR_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_MAP_ITERATOR_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_MAP_ITERATOR_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_MAP_ITERATOR_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_MAP_ITERATOR_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_MAP_ITERATOR_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_tree_map_map_iterator_gee_map_iterator_interface_init (GeeMapIteratorIface * iface) { + gee_tree_map_map_iterator_gee_map_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->get_key = (gpointer (*)(GeeMapIterator*)) gee_tree_map_map_iterator_real_get_key; + iface->get_value = (gpointer (*)(GeeMapIterator*)) gee_tree_map_map_iterator_real_get_value; + iface->set_value = (void (*)(GeeMapIterator*, gconstpointer)) gee_tree_map_map_iterator_real_set_value; + iface->next = (gboolean (*)(GeeMapIterator*)) gee_tree_map_node_iterator_next; + iface->has_next = (gboolean (*)(GeeMapIterator*)) gee_tree_map_node_iterator_has_next; + iface->first = (gboolean (*)(GeeMapIterator*)) gee_tree_map_node_iterator_first; + iface->unset = (void (*)(GeeMapIterator*)) gee_tree_map_node_iterator_unset; +} + + +static void gee_tree_map_map_iterator_instance_init (GeeTreeMapMapIterator * self) { + self->priv = GEE_TREE_MAP_MAP_ITERATOR_GET_PRIVATE (self); +} + + +static GType gee_tree_map_map_iterator_get_type (void) { + static volatile gsize gee_tree_map_map_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_map_map_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTreeMapMapIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tree_map_map_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTreeMapMapIterator), 0, (GInstanceInitFunc) gee_tree_map_map_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_map_iterator_info = { (GInterfaceInitFunc) gee_tree_map_map_iterator_gee_map_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_tree_map_map_iterator_type_id; + gee_tree_map_map_iterator_type_id = g_type_register_static (GEE_TREE_MAP_TYPE_NODE_ITERATOR, "GeeTreeMapMapIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_tree_map_map_iterator_type_id, GEE_TYPE_MAP_ITERATOR, &gee_map_iterator_info); + g_once_init_leave (&gee_tree_map_map_iterator_type_id__volatile, gee_tree_map_map_iterator_type_id); + } + return gee_tree_map_map_iterator_type_id__volatile; +} + + +static void _vala_gee_tree_map_map_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeTreeMapMapIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_MAP_ITERATOR, GeeTreeMapMapIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_tree_map_map_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeTreeMapMapIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_MAP_TYPE_MAP_ITERATOR, GeeTreeMapMapIterator); + switch (property_id) { + case GEE_TREE_MAP_MAP_ITERATOR_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_MAP_ITERATOR_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_MAP_ITERATOR_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_MAP_ITERATOR_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_MAP_ITERATOR_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_MAP_ITERATOR_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void gee_tree_map_class_init (GeeTreeMapClass * klass) { + gee_tree_map_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTreeMapPrivate)); + GEE_ABSTRACT_MAP_CLASS (klass)->has_key = gee_tree_map_real_has_key; + GEE_ABSTRACT_MAP_CLASS (klass)->has = gee_tree_map_real_has; + GEE_ABSTRACT_MAP_CLASS (klass)->get = gee_tree_map_real_get; + GEE_ABSTRACT_MAP_CLASS (klass)->set = gee_tree_map_real_set; + GEE_ABSTRACT_MAP_CLASS (klass)->unset = gee_tree_map_real_unset; + GEE_ABSTRACT_MAP_CLASS (klass)->clear = gee_tree_map_real_clear; + GEE_ABSTRACT_MAP_CLASS (klass)->map_iterator = gee_tree_map_real_map_iterator; + GEE_ABSTRACT_MAP_CLASS (klass)->get_size = gee_tree_map_real_get_size; + GEE_ABSTRACT_MAP_CLASS (klass)->get_keys = gee_tree_map_real_get_keys; + GEE_ABSTRACT_MAP_CLASS (klass)->get_values = gee_tree_map_real_get_values; + GEE_ABSTRACT_MAP_CLASS (klass)->get_entries = gee_tree_map_real_get_entries; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_tree_map_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_tree_map_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_tree_map_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_KEYS, g_param_spec_object ("keys", "keys", "keys", GEE_TYPE_SET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_VALUES, g_param_spec_object ("values", "values", "values", GEE_TYPE_COLLECTION, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_ENTRIES, g_param_spec_object ("entries", "entries", "entries", GEE_TYPE_SET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The keys' comparator function. + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_KEY_COMPARE_FUNC, g_param_spec_pointer ("key-compare-func", "key-compare-func", "key-compare-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The values' equality testing function. + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MAP_VALUE_EQUAL_FUNC, g_param_spec_pointer ("value-equal-func", "value-equal-func", "value-equal-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_tree_map_instance_init (GeeTreeMap * self) { + self->priv = GEE_TREE_MAP_GET_PRIVATE (self); + self->priv->_size = 0; + self->priv->root = NULL; + self->priv->first = NULL; + self->priv->last = NULL; + self->priv->stamp = 0; +} + + +static void gee_tree_map_finalize (GObject* obj) { + GeeTreeMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_TREE_MAP, GeeTreeMap); + _gee_tree_map_node_free0 (self->priv->root); + G_OBJECT_CLASS (gee_tree_map_parent_class)->finalize (obj); +} + + +/** + * Left-leaning red-black tree implementation of the {@link Map} interface. + * + * This implementation is especially well designed for large quantity of + * data. The (balanced) tree implementation insure that the set and get + * methods are in logarithmic complexity. + * + * @see HashMap + */ +GType gee_tree_map_get_type (void) { + static volatile gsize gee_tree_map_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_map_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTreeMapClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tree_map_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTreeMap), 0, (GInstanceInitFunc) gee_tree_map_instance_init, NULL }; + GType gee_tree_map_type_id; + gee_tree_map_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_MAP, "GeeTreeMap", &g_define_type_info, 0); + g_once_init_leave (&gee_tree_map_type_id__volatile, gee_tree_map_type_id); + } + return gee_tree_map_type_id__volatile; +} + + +static void _vala_gee_tree_map_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeTreeMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_TREE_MAP, GeeTreeMap); + switch (property_id) { + case GEE_TREE_MAP_SIZE: + g_value_set_int (value, gee_abstract_map_get_size ((GeeAbstractMap*) self)); + break; + case GEE_TREE_MAP_KEYS: + g_value_take_object (value, gee_abstract_map_get_keys ((GeeAbstractMap*) self)); + break; + case GEE_TREE_MAP_VALUES: + g_value_take_object (value, gee_abstract_map_get_values ((GeeAbstractMap*) self)); + break; + case GEE_TREE_MAP_ENTRIES: + g_value_take_object (value, gee_abstract_map_get_entries ((GeeAbstractMap*) self)); + break; + case GEE_TREE_MAP_KEY_COMPARE_FUNC: + g_value_set_pointer (value, gee_tree_map_get_key_compare_func (self)); + break; + case GEE_TREE_MAP_VALUE_EQUAL_FUNC: + g_value_set_pointer (value, gee_tree_map_get_value_equal_func (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_tree_map_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeTreeMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_TREE_MAP, GeeTreeMap); + switch (property_id) { + case GEE_TREE_MAP_KEY_COMPARE_FUNC: + gee_tree_map_set_key_compare_func (self, g_value_get_pointer (value)); + break; + case GEE_TREE_MAP_VALUE_EQUAL_FUNC: + gee_tree_map_set_value_equal_func (self, g_value_get_pointer (value)); + break; + case GEE_TREE_MAP_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_TREE_MAP_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MAP_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/gee/treemap.vala b/gee/treemap.vala new file mode 100644 index 0000000..8b3917e --- /dev/null +++ b/gee/treemap.vala @@ -0,0 +1,770 @@ +/* treemap.vala + * + * Copyright (C) 2009 Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Maciej Piechotka + */ + +using GLib; + +/** + * Left-leaning red-black tree implementation of the {@link Map} interface. + * + * This implementation is especially well designed for large quantity of + * data. The (balanced) tree implementation insure that the set and get + * methods are in logarithmic complexity. + * + * @see HashMap + */ +public class Gee.TreeMap : Gee.AbstractMap { + /** + * {@inheritDoc} + */ + public override int size { + get { return _size; } + } + + /** + * {@inheritDoc} + */ + public override Set keys { + owned get { + Set keys = _keys; + if (_keys == null) { + keys = new KeySet (this); + _keys = keys; + keys.add_weak_pointer ((void**) (&_keys)); + } + return keys; + } + } + + /** + * {@inheritDoc} + */ + public override Collection values { + owned get { + Collection values = _values; + if (_values == null) { + values = new ValueCollection (this); + _values = values; + values.add_weak_pointer ((void**) (&_values)); + } + return values; + } + } + + /** + * {@inheritDoc} + */ + public override Set> entries { + owned get { + Set> entries = _entries; + if (_entries == null) { + entries = new EntrySet (this); + _entries = entries; + entries.add_weak_pointer ((void**) (&_entries)); + } + return entries; + } + } + + /** + * The keys' comparator function. + */ + public CompareFunc key_compare_func { private set; get; } + + /** + * The values' equality testing function. + */ + public EqualFunc value_equal_func { private set; get; } + + private int _size = 0; + + private weak Set _keys; + private weak Collection _values; + private weak Set> _entries; + + /** + * Constructs a new, empty tree map sorted according to the specified + * comparator function. + * + * If not provided, the functions parameters are requested to the + * {@link Functions} function factory methods. + * + * @param key_compare_func an optional key comparator function + * @param value_equal_func an optional values equality testing function + */ + public TreeMap (CompareFunc? key_compare_func = null, EqualFunc? value_equal_func = null) { + if (key_compare_func == null) { + key_compare_func = Functions.get_compare_func_for (typeof (K)); + } + if (value_equal_func == null) { + value_equal_func = Functions.get_equal_func_for (typeof (V)); + } + this.key_compare_func = key_compare_func; + this.value_equal_func = value_equal_func; + } + + private void rotate_right (ref Node root) { + Node pivot = (owned) root.left; + pivot.color = root.color; + root.color = Node.Color.RED; + root.left = (owned) pivot.right; + pivot.right = (owned) root; + root = (owned) pivot; + } + + private void rotate_left (ref Node root) { + Node pivot = (owned) root.right; + pivot.color = root.color; + root.color = Node.Color.RED; + root.right = (owned) pivot.left; + pivot.left = (owned) root; + root = (owned) pivot; + } + + private bool is_red (Node? n) { + return n != null && n.color == Node.Color.RED; + } + + private bool is_black (Node? n) { + return n == null || n.color == Node.Color.BLACK; + } + + /** + * {@inheritDoc} + */ + public override bool has_key (K key) { + weak Node? cur = root; + while (cur != null) { + int res = key_compare_func (key, cur.key); + if (res == 0) { + return true; + } else if (res < 0) { + cur = cur.left; + } else { + cur = cur.right; + } + } + return false; + } + + /** + * {@inheritDoc} + */ + public override bool has (K key, V value) { + V? own_value = get (key); + return (own_value != null && value_equal_func (own_value, value)); + } + + /** + * {@inheritDoc} + */ + public override V? get (K key) { + weak Node? cur = root; + while (cur != null) { + int res = key_compare_func (key, cur.key); + if (res == 0) { + return cur.value; + } else if (res < 0) { + cur = cur.left; + } else { + cur = cur.right; + } + } + return null; + } + + private void set_to_node (ref Node? node, K key, V value, Node? prev, Node? next) { + if (node == null) { + node = new Node (key, value, prev, next); + if (prev == null) { + first = node; + } + if (next == null) { + last = node; + } + _size++; + } + + int cmp = key_compare_func (key, node.key); + if (cmp == 0) { + node.value = value; + } else if (cmp < 0) { + set_to_node (ref node.left, key, value, node.prev, node); + } else { + set_to_node (ref node.right, key, value, node, node.next); + } + + fix_up (ref node); + } + + /** + * {@inheritDoc} + */ + public override void set (K key, V value) { + set_to_node (ref root, key, value, null, null); + root.color = Node.Color.BLACK; + stamp++; + } + + private void move_red_left (ref Node root) { + root.flip (); + if (is_red (root.right.left)) { + rotate_right (ref root.right); + rotate_left (ref root); + root.flip (); + } + } + + private void move_red_right (ref Node root) { + root.flip (); + if (is_red (root.left.left)) { + rotate_right (ref root); + root.flip (); + } + } + + private void fix_removal (ref Node node, out K? key = null, out V? value) { + Node n = (owned) node; + if (&key != null) + key = (owned) n.key; + else + n.key = null; + if (&value != null) + value = (owned) n.value; + if (n.prev != null) { + n.prev.next = n.next; + } else { + first = n.next; + } + if (n.next != null) { + n.next.prev = n.prev; + } else { + last = n.next; + } + n.value = null; + node = null; + _size--; + } + + private void remove_minimal (ref Node node, out K key, out V value) { + if (node.left == null) { + fix_removal (ref node, out key, out value); + return; + } + + if (is_black (node.left) && is_black (node.left.left)) { + move_red_left (ref node); + } + + remove_minimal (ref node.left, out key, out value); + + fix_up (ref node); + } + + private bool remove_from_node (ref Node? node, K key, out V value, out unowned Node? prev = null, out unowned Node? next = null) { + if (node == null) { + return false; + } else if (key_compare_func (key, node.key) < 0) { + weak Node left = node.left; + if (left == null) { + return false; + } + if (node.left != null && is_black (left) && is_black (left.left)) { + move_red_left (ref node); + } + bool r = remove_from_node (ref node.left, key, out value, out prev, out next); + fix_up (ref node); + return r; + } else { + if (is_red (node.left)) { + rotate_right (ref node); + } + + weak Node? r = node.right; + if (key_compare_func (key, node.key) == 0 && r == null) { + if (&prev != null) + prev = node.prev; + if (&next != null) + next = node.next; + fix_removal (ref node, null, out value); + return true; + } + if (is_black (r) && r != null && is_black (r.left)) { + move_red_right (ref node); + } + if (key_compare_func (key, node.key) == 0) { + value = (owned) node.value; + if (&prev != null) + prev = node.prev; + if (&next != null) + next = node; + remove_minimal (ref node.right, out node.key, out node.value); + fix_up (ref node); + return true; + } else { + bool re = remove_from_node (ref node.right, key, out value, out prev, out next); + fix_up (ref node); + return re; + } + } + } + + private void fix_up (ref Node node) { + if (is_black (node.left) && is_red (node.right)) { + rotate_left (ref node); + } + if (is_red (node.left) && is_red (node.left.left)) { + rotate_right (ref node); + } + if (is_red (node.left) && is_red (node.right)) { + node.flip (); + } + } + + /** + * {@inheritDoc} + */ + public override bool unset (K key, out V? value = null) { + V node_value; + bool b = remove_from_node (ref root, key, out node_value); + + if (&value != null) { + value = (owned) node_value; + } + + if (root != null) { + root.color = Node.Color.BLACK; + } + stamp++; + return b; + } + + private inline void clear_subtree (owned Node node) { + node.key = null; + node.value = null; + if (node.left != null) + clear_subtree ((owned) node.left); + if (node.right != null) + clear_subtree ((owned) node.right); + } + + /** + * {@inheritDoc} + */ + public override void clear () { + if (root != null) { + clear_subtree ((owned) root); + first = last = null; + } + _size = 0; + stamp++; + } + + /** + * {@inheritDoc} + */ + public override Gee.MapIterator map_iterator () { + return new MapIterator (this); + } + + [Compact] + private class Node { + public enum Color { + RED, + BLACK; + + public Color flip () { + if (this == RED) { + return BLACK; + } else { + return RED; + } + } + } + + public Node (owned K key, owned V value, Node? prev, Node? next) { + this.key = (owned) key; + this.value = (owned) value; + this.color = Color.RED; + this.prev = prev; + this.next = next; + if (prev != null) { + prev.next = this; + } + if (next != null) { + next.prev = this; + } + } + + public void flip () { + color = color.flip (); + if (left != null) { + left.color = left.color.flip (); + } + if (right != null) { + right.color = right.color.flip (); + } + } + + public K key; + public V value; + public Color color; + public Node? left; + public Node? right; + public weak Node? prev; + public weak Node? next; + public unowned Map.Entry? entry; + } + + private Node? root = null; + private weak Node? first = null; + private weak Node? last = null; + private int stamp = 0; + + private class Entry : Map.Entry { + private unowned Node _node; + + public static Map.Entry entry_for (Node node) { + Map.Entry result = node.entry; + if (node.entry == null) { + result = new Entry (node); + node.entry = result; + result.add_weak_pointer ((void**) (&node.entry)); + } + return result; + } + + public Entry (Node node) { + _node = node; + } + + public override K key { get { return _node.key; } } + + public override V value { + get { return _node.value; } + set { _node.value = value; } + } + } + + private class KeySet : AbstractSet { + private TreeMap _map; + + public KeySet (TreeMap map) { + _map = map; + } + + public override Iterator iterator () { + return new KeyIterator (_map); + } + + public override int size { + get { return _map.size; } + } + + public override bool add (K key) { + assert_not_reached (); + } + + public override void clear () { + assert_not_reached (); + } + + public override bool remove (K key) { + assert_not_reached (); + } + + public override bool contains (K key) { + return _map.has_key (key); + } + + public override bool add_all (Collection collection) { + assert_not_reached (); + } + + public override bool remove_all (Collection collection) { + assert_not_reached (); + } + + public override bool retain_all (Collection collection) { + assert_not_reached (); + } + } + + private class ValueCollection : AbstractCollection { + private TreeMap _map; + + public ValueCollection (TreeMap map) { + _map = map; + } + + public override Iterator iterator () { + return new ValueIterator (_map); + } + + public override int size { + get { return _map.size; } + } + + public override bool add (V key) { + assert_not_reached (); + } + + public override void clear () { + assert_not_reached (); + } + + public override bool remove (V key) { + assert_not_reached (); + } + + public override bool contains (V key) { + Iterator it = iterator (); + while (it.next ()) { + if (_map.value_equal_func (key, it.get ())) { + return true; + } + } + return false; + } + + public override bool add_all (Collection collection) { + assert_not_reached (); + } + + public override bool remove_all (Collection collection) { + assert_not_reached (); + } + + public override bool retain_all (Collection collection) { + assert_not_reached (); + } + } + + private class EntrySet : AbstractSet> { + private TreeMap _map; + + public EntrySet (TreeMap map) { + _map = map; + } + + public override Iterator> iterator () { + return new EntryIterator (_map); + } + + public override int size { + get { return _map.size; } + } + + public override bool add (Map.Entry entry) { + assert_not_reached (); + } + + public override void clear () { + assert_not_reached (); + } + + public override bool remove (Map.Entry entry) { + assert_not_reached (); + } + + public override bool contains (Map.Entry entry) { + return _map.has (entry.key, entry.value); + } + + public override bool add_all (Collection> entries) { + assert_not_reached (); + } + + public override bool remove_all (Collection> entries) { + assert_not_reached (); + } + + public override bool retain_all (Collection> entries) { + assert_not_reached (); + } + } + + private class NodeIterator : Object { + protected TreeMap _map; + + // concurrent modification protection + protected int stamp; + + protected weak Node? current; + protected weak Node? _next; + protected weak Node? _prev; + + public NodeIterator (TreeMap map) { + _map = map; + stamp = _map.stamp; + } + + public bool next () { + assert (stamp == _map.stamp); + if (current != null) { + if (current.next != null) { + current = current.next; + return true; + } else { + return false; + } + } else if (_next == null && _prev == null) { + current = _map.first; + return current != null; + } else { + current = _next; + if (current != null) { + _next = null; + _prev = null; + } + return current != null; + } + } + + public bool has_next () { + assert (stamp == _map.stamp); + return (current == null && _next == null && _prev == null && _map.first != null) || + (current == null && _next != null) || + (current != null && current.next != null); + } + + public bool first () { + assert (stamp == _map.stamp); + current = _map.first; + _next = null; + _prev = null; + return current != null; // on false it is null anyway + } + + public bool previous () { + assert (stamp == _map.stamp); + if (current != null) { + if (current.prev != null) { + current = current.prev; + return true; + } else { + return false; + } + } else { + if (_prev != null) { + current = _prev; + _next = null; + _prev = null; + return true; + } else { + return false; + } + } + } + + public bool has_previous () { + assert (stamp == _map.stamp); + return (current == null && _prev != null) || + (current != null && current.prev != null); + } + + public bool last () { + assert (stamp == _map.stamp); + current = _map.last; + _next = null; + _prev = null; + return current != null; // on false it is null anyway + } + + public void remove () { + assert_not_reached (); + } + + public void unset () { + assert (stamp == _map.stamp); + assert (current != null); + V value; + bool success = _map.remove_from_node (ref _map.root, current.key, out value, out _prev, out _next); + assert (success); + if (_map.root != null) + _map.root.color = Node.Color.BLACK; + current = null; + stamp++; + _map.stamp++; + assert (stamp == _map.stamp); + } + } + + private class KeyIterator : NodeIterator, Gee.Iterator, BidirIterator { + public KeyIterator (TreeMap map) { + base (map); + } + + public new K get () { + assert (stamp == _map.stamp); + assert (current != null); + return current.key; + } + } + + private class ValueIterator : NodeIterator, Gee.Iterator, Gee.BidirIterator { + public ValueIterator (TreeMap map) { + base (map); + } + + public new V get () { + assert (stamp == _map.stamp); + assert (current != null); + return current.value; + } + } + + private class EntryIterator : NodeIterator, Gee.Iterator>, Gee.BidirIterator> { + public EntryIterator (TreeMap map) { + base (map); + } + + public new Map.Entry get () { + assert (stamp == _map.stamp); + assert (current != null); + return Entry.entry_for (current); + } + } + + private class MapIterator : NodeIterator, Gee.MapIterator { + public MapIterator (TreeMap map) { + base (map); + } + + public K get_key () { + assert (stamp == _map.stamp); + assert (current != null); + return current.key; + } + + public V get_value () { + assert (stamp == _map.stamp); + assert (current != null); + return current.value; + } + + public void set_value (V value) { + assert (stamp == _map.stamp); + assert (current != null); + current.value = value; + } + } +} diff --git a/gee/treemultimap.c b/gee/treemultimap.c new file mode 100644 index 0000000..7fe5cd7 --- /dev/null +++ b/gee/treemultimap.c @@ -0,0 +1,592 @@ +/* treemultimap.c generated by valac 0.18.0, the Vala compiler + * generated from treemultimap.vala, do not modify */ + +/* treemultimap.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +#include +#include + + +#define GEE_TYPE_MULTI_MAP (gee_multi_map_get_type ()) +#define GEE_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MULTI_MAP, GeeMultiMap)) +#define GEE_IS_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MULTI_MAP)) +#define GEE_MULTI_MAP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MULTI_MAP, GeeMultiMapIface)) + +typedef struct _GeeMultiMap GeeMultiMap; +typedef struct _GeeMultiMapIface GeeMultiMapIface; + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_TYPE_MULTI_SET (gee_multi_set_get_type ()) +#define GEE_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MULTI_SET, GeeMultiSet)) +#define GEE_IS_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MULTI_SET)) +#define GEE_MULTI_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MULTI_SET, GeeMultiSetIface)) + +typedef struct _GeeMultiSet GeeMultiSet; +typedef struct _GeeMultiSetIface GeeMultiSetIface; + +#define GEE_TYPE_ABSTRACT_MULTI_MAP (gee_abstract_multi_map_get_type ()) +#define GEE_ABSTRACT_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MULTI_MAP, GeeAbstractMultiMap)) +#define GEE_ABSTRACT_MULTI_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MULTI_MAP, GeeAbstractMultiMapClass)) +#define GEE_IS_ABSTRACT_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MULTI_MAP)) +#define GEE_IS_ABSTRACT_MULTI_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MULTI_MAP)) +#define GEE_ABSTRACT_MULTI_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MULTI_MAP, GeeAbstractMultiMapClass)) + +typedef struct _GeeAbstractMultiMap GeeAbstractMultiMap; +typedef struct _GeeAbstractMultiMapClass GeeAbstractMultiMapClass; +typedef struct _GeeAbstractMultiMapPrivate GeeAbstractMultiMapPrivate; + +#define GEE_TYPE_MAP (gee_map_get_type ()) +#define GEE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP, GeeMap)) +#define GEE_IS_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP)) +#define GEE_MAP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP, GeeMapIface)) + +typedef struct _GeeMap GeeMap; +typedef struct _GeeMapIface GeeMapIface; + +#define GEE_TYPE_MAP_ITERATOR (gee_map_iterator_get_type ()) +#define GEE_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIterator)) +#define GEE_IS_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP_ITERATOR)) +#define GEE_MAP_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIteratorIface)) + +typedef struct _GeeMapIterator GeeMapIterator; +typedef struct _GeeMapIteratorIface GeeMapIteratorIface; + +#define GEE_MAP_TYPE_ENTRY (gee_map_entry_get_type ()) +#define GEE_MAP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntry)) +#define GEE_MAP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) +#define GEE_MAP_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) + +typedef struct _GeeMapEntry GeeMapEntry; +typedef struct _GeeMapEntryClass GeeMapEntryClass; + +#define GEE_TYPE_TREE_MULTI_MAP (gee_tree_multi_map_get_type ()) +#define GEE_TREE_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TREE_MULTI_MAP, GeeTreeMultiMap)) +#define GEE_TREE_MULTI_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TREE_MULTI_MAP, GeeTreeMultiMapClass)) +#define GEE_IS_TREE_MULTI_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TREE_MULTI_MAP)) +#define GEE_IS_TREE_MULTI_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TREE_MULTI_MAP)) +#define GEE_TREE_MULTI_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TREE_MULTI_MAP, GeeTreeMultiMapClass)) + +typedef struct _GeeTreeMultiMap GeeTreeMultiMap; +typedef struct _GeeTreeMultiMapClass GeeTreeMultiMapClass; +typedef struct _GeeTreeMultiMapPrivate GeeTreeMultiMapPrivate; + +#define GEE_TYPE_ABSTRACT_MAP (gee_abstract_map_get_type ()) +#define GEE_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap)) +#define GEE_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) +#define GEE_IS_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_IS_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_ABSTRACT_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) + +typedef struct _GeeAbstractMap GeeAbstractMap; +typedef struct _GeeAbstractMapClass GeeAbstractMapClass; + +#define GEE_TYPE_TREE_MAP (gee_tree_map_get_type ()) +#define GEE_TREE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TREE_MAP, GeeTreeMap)) +#define GEE_TREE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TREE_MAP, GeeTreeMapClass)) +#define GEE_IS_TREE_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TREE_MAP)) +#define GEE_IS_TREE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TREE_MAP)) +#define GEE_TREE_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TREE_MAP, GeeTreeMapClass)) + +typedef struct _GeeTreeMap GeeTreeMap; +typedef struct _GeeTreeMapClass GeeTreeMapClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; + +#define GEE_TYPE_ABSTRACT_SET (gee_abstract_set_get_type ()) +#define GEE_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSet)) +#define GEE_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) +#define GEE_IS_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_SET)) +#define GEE_IS_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_SET)) +#define GEE_ABSTRACT_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) + +typedef struct _GeeAbstractSet GeeAbstractSet; +typedef struct _GeeAbstractSetClass GeeAbstractSetClass; + +#define GEE_TYPE_TREE_SET (gee_tree_set_get_type ()) +#define GEE_TREE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TREE_SET, GeeTreeSet)) +#define GEE_TREE_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TREE_SET, GeeTreeSetClass)) +#define GEE_IS_TREE_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TREE_SET)) +#define GEE_IS_TREE_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TREE_SET)) +#define GEE_TREE_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TREE_SET, GeeTreeSetClass)) + +typedef struct _GeeTreeSet GeeTreeSet; +typedef struct _GeeTreeSetClass GeeTreeSetClass; + +#define GEE_TYPE_ABSTRACT_MULTI_SET (gee_abstract_multi_set_get_type ()) +#define GEE_ABSTRACT_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSet)) +#define GEE_ABSTRACT_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSetClass)) +#define GEE_IS_ABSTRACT_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MULTI_SET)) +#define GEE_IS_ABSTRACT_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MULTI_SET)) +#define GEE_ABSTRACT_MULTI_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSetClass)) + +typedef struct _GeeAbstractMultiSet GeeAbstractMultiSet; +typedef struct _GeeAbstractMultiSetClass GeeAbstractMultiSetClass; + +#define GEE_TYPE_TREE_MULTI_SET (gee_tree_multi_set_get_type ()) +#define GEE_TREE_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TREE_MULTI_SET, GeeTreeMultiSet)) +#define GEE_TREE_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TREE_MULTI_SET, GeeTreeMultiSetClass)) +#define GEE_IS_TREE_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TREE_MULTI_SET)) +#define GEE_IS_TREE_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TREE_MULTI_SET)) +#define GEE_TREE_MULTI_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TREE_MULTI_SET, GeeTreeMultiSetClass)) + +typedef struct _GeeTreeMultiSet GeeTreeMultiSet; +typedef struct _GeeTreeMultiSetClass GeeTreeMultiSetClass; + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeMultiSetIface { + GTypeInterface parent_iface; + gint (*count) (GeeMultiSet* self, gconstpointer item); +}; + +struct _GeeMultiMapIface { + GTypeInterface parent_iface; + GeeSet* (*get_keys) (GeeMultiMap* self); + GeeMultiSet* (*get_all_keys) (GeeMultiMap* self); + GeeCollection* (*get_values) (GeeMultiMap* self); + gboolean (*contains) (GeeMultiMap* self, gconstpointer key); + GeeCollection* (*get) (GeeMultiMap* self, gconstpointer key); + void (*set) (GeeMultiMap* self, gconstpointer key, gconstpointer value); + gboolean (*remove) (GeeMultiMap* self, gconstpointer key, gconstpointer value); + gboolean (*remove_all) (GeeMultiMap* self, gconstpointer key); + void (*clear) (GeeMultiMap* self); + gint (*get_size) (GeeMultiMap* self); +}; + +struct _GeeMapIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeMapIterator* self); + gboolean (*has_next) (GeeMapIterator* self); + gboolean (*first) (GeeMapIterator* self); + gpointer (*get_key) (GeeMapIterator* self); + gpointer (*get_value) (GeeMapIterator* self); + void (*set_value) (GeeMapIterator* self, gconstpointer value); + void (*unset) (GeeMapIterator* self); +}; + +struct _GeeMapIface { + GTypeInterface parent_iface; + gboolean (*has_key) (GeeMap* self, gconstpointer key); + gboolean (*contains) (GeeMap* self, gconstpointer key); + gboolean (*has) (GeeMap* self, gconstpointer key, gconstpointer value); + gpointer (*get) (GeeMap* self, gconstpointer key); + void (*set) (GeeMap* self, gconstpointer key, gconstpointer value); + gboolean (*unset) (GeeMap* self, gconstpointer key, gpointer* value); + gboolean (*remove) (GeeMap* self, gconstpointer key, gpointer* value); + void (*clear) (GeeMap* self); + GeeMapIterator* (*map_iterator) (GeeMap* self); + void (*set_all) (GeeMap* self, GeeMap* map); + gboolean (*unset_all) (GeeMap* self, GeeMap* map); + gboolean (*remove_all) (GeeMap* self, GeeMap* map); + gboolean (*has_all) (GeeMap* self, GeeMap* map); + gboolean (*contains_all) (GeeMap* self, GeeMap* map); + gint (*get_size) (GeeMap* self); + gboolean (*get_is_empty) (GeeMap* self); + GeeSet* (*get_keys) (GeeMap* self); + GeeCollection* (*get_values) (GeeMap* self); + GeeSet* (*get_entries) (GeeMap* self); + GeeMap* (*get_read_only_view) (GeeMap* self); + GType (*get_key_type) (GeeMap* self); + GType (*get_value_type) (GeeMap* self); +}; + +struct _GeeAbstractMultiMap { + GObject parent_instance; + GeeAbstractMultiMapPrivate * priv; + GeeMap* _storage_map; +}; + +struct _GeeAbstractMultiMapClass { + GObjectClass parent_class; + GeeCollection* (*create_value_storage) (GeeAbstractMultiMap* self); + GeeMultiSet* (*create_multi_key_set) (GeeAbstractMultiMap* self); + GEqualFunc (*get_value_equal_func) (GeeAbstractMultiMap* self); +}; + +struct _GeeTreeMultiMap { + GeeAbstractMultiMap parent_instance; + GeeTreeMultiMapPrivate * priv; +}; + +struct _GeeTreeMultiMapClass { + GeeAbstractMultiMapClass parent_class; +}; + +struct _GeeTreeMultiMapPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + GCompareFunc _value_compare_func; +}; + + +static gpointer gee_tree_multi_map_parent_class = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_multi_set_get_type (void) G_GNUC_CONST; +GType gee_multi_map_get_type (void) G_GNUC_CONST; +GType gee_abstract_multi_map_get_type (void) G_GNUC_CONST; +GType gee_map_iterator_get_type (void) G_GNUC_CONST; +GType gee_map_entry_get_type (void) G_GNUC_CONST; +GType gee_map_get_type (void) G_GNUC_CONST; +GType gee_tree_multi_map_get_type (void) G_GNUC_CONST; +#define GEE_TREE_MULTI_MAP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_TREE_MULTI_MAP, GeeTreeMultiMapPrivate)) +enum { + GEE_TREE_MULTI_MAP_DUMMY_PROPERTY, + GEE_TREE_MULTI_MAP_K_TYPE, + GEE_TREE_MULTI_MAP_K_DUP_FUNC, + GEE_TREE_MULTI_MAP_K_DESTROY_FUNC, + GEE_TREE_MULTI_MAP_V_TYPE, + GEE_TREE_MULTI_MAP_V_DUP_FUNC, + GEE_TREE_MULTI_MAP_V_DESTROY_FUNC, + GEE_TREE_MULTI_MAP_KEY_COMPARE_FUNC, + GEE_TREE_MULTI_MAP_VALUE_COMPARE_FUNC +}; +GeeTreeMultiMap* gee_tree_multi_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GCompareFunc key_compare_func, GCompareFunc value_compare_func); +GeeTreeMultiMap* gee_tree_multi_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GCompareFunc key_compare_func, GCompareFunc value_compare_func); +GeeTreeMap* gee_tree_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GCompareFunc key_compare_func, GEqualFunc value_equal_func); +GeeTreeMap* gee_tree_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GCompareFunc key_compare_func, GEqualFunc value_equal_func); +GType gee_abstract_map_get_type (void) G_GNUC_CONST; +GType gee_tree_map_get_type (void) G_GNUC_CONST; +GeeAbstractMultiMap* gee_abstract_multi_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GeeMap* storage_map); +GCompareFunc gee_functions_get_compare_func_for (GType t); +static void gee_tree_multi_map_set_value_compare_func (GeeTreeMultiMap* self, GCompareFunc value); +static GeeCollection* gee_tree_multi_map_real_create_value_storage (GeeAbstractMultiMap* base); +GeeTreeSet* gee_tree_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func); +GeeTreeSet* gee_tree_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func); +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_set_get_type (void) G_GNUC_CONST; +GType gee_tree_set_get_type (void) G_GNUC_CONST; +static GeeMultiSet* gee_tree_multi_map_real_create_multi_key_set (GeeAbstractMultiMap* base); +GCompareFunc gee_tree_multi_map_get_key_compare_func (GeeTreeMultiMap* self); +GeeTreeMultiSet* gee_tree_multi_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func); +GeeTreeMultiSet* gee_tree_multi_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func); +GType gee_abstract_multi_set_get_type (void) G_GNUC_CONST; +GType gee_tree_multi_set_get_type (void) G_GNUC_CONST; +static GEqualFunc gee_tree_multi_map_real_get_value_equal_func (GeeAbstractMultiMap* base); +GEqualFunc gee_functions_get_equal_func_for (GType t); +GCompareFunc gee_tree_map_get_key_compare_func (GeeTreeMap* self); +GCompareFunc gee_tree_multi_map_get_value_compare_func (GeeTreeMultiMap* self); +static void gee_tree_multi_map_finalize (GObject* obj); +static void _vala_gee_tree_multi_map_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_tree_multi_map_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +/** + * Constructs a new, empty tree multimap. + * + * If not provided, the functions parameters are requested to the + * {@link Functions} function factory methods. + * + * @param key_compare_func an optional key comparator function + * @param value_compare_func an optional value comparator function + */ +GeeTreeMultiMap* gee_tree_multi_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GCompareFunc key_compare_func, GCompareFunc value_compare_func) { + GeeTreeMultiMap * self = NULL; + GCompareFunc _tmp0_; + GEqualFunc _tmp1_; + GeeTreeMap* _tmp2_; + GeeTreeMap* _tmp3_; + GCompareFunc _tmp4_; + GCompareFunc _tmp6_; + _tmp0_ = key_compare_func; + _tmp1_ = g_direct_equal; + _tmp2_ = gee_tree_map_new (k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, GEE_TYPE_SET, (GBoxedCopyFunc) g_object_ref, g_object_unref, _tmp0_, _tmp1_); + _tmp3_ = _tmp2_; + self = (GeeTreeMultiMap*) gee_abstract_multi_map_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func, (GeeMap*) _tmp3_); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _g_object_unref0 (_tmp3_); + _tmp4_ = value_compare_func; + if (_tmp4_ == NULL) { + GCompareFunc _tmp5_ = NULL; + _tmp5_ = gee_functions_get_compare_func_for (v_type); + value_compare_func = _tmp5_; + } + _tmp6_ = value_compare_func; + gee_tree_multi_map_set_value_compare_func (self, _tmp6_); + return self; +} + + +GeeTreeMultiMap* gee_tree_multi_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GCompareFunc key_compare_func, GCompareFunc value_compare_func) { + return gee_tree_multi_map_construct (GEE_TYPE_TREE_MULTI_MAP, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, key_compare_func, value_compare_func); +} + + +static GeeCollection* gee_tree_multi_map_real_create_value_storage (GeeAbstractMultiMap* base) { + GeeTreeMultiMap * self; + GeeCollection* result = NULL; + GCompareFunc _tmp0_; + GeeTreeSet* _tmp1_; + self = (GeeTreeMultiMap*) base; + _tmp0_ = self->priv->_value_compare_func; + _tmp1_ = gee_tree_set_new (self->priv->v_type, (GBoxedCopyFunc) self->priv->v_dup_func, self->priv->v_destroy_func, _tmp0_); + result = (GeeCollection*) _tmp1_; + return result; +} + + +static GeeMultiSet* gee_tree_multi_map_real_create_multi_key_set (GeeAbstractMultiMap* base) { + GeeTreeMultiMap * self; + GeeMultiSet* result = NULL; + GCompareFunc _tmp0_; + GCompareFunc _tmp1_; + GeeTreeMultiSet* _tmp2_; + self = (GeeTreeMultiMap*) base; + _tmp0_ = gee_tree_multi_map_get_key_compare_func (self); + _tmp1_ = _tmp0_; + _tmp2_ = gee_tree_multi_set_new (self->priv->k_type, (GBoxedCopyFunc) self->priv->k_dup_func, self->priv->k_destroy_func, _tmp1_); + result = (GeeMultiSet*) _tmp2_; + return result; +} + + +static GEqualFunc gee_tree_multi_map_real_get_value_equal_func (GeeAbstractMultiMap* base) { + GeeTreeMultiMap * self; + GEqualFunc result = NULL; + GEqualFunc _tmp0_ = NULL; + self = (GeeTreeMultiMap*) base; + _tmp0_ = gee_functions_get_equal_func_for (self->priv->v_type); + result = _tmp0_; + return result; +} + + +GCompareFunc gee_tree_multi_map_get_key_compare_func (GeeTreeMultiMap* self) { + GCompareFunc result; + GeeMap* _tmp0_; + GCompareFunc _tmp1_; + GCompareFunc _tmp2_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = ((GeeAbstractMultiMap*) self)->_storage_map; + _tmp1_ = gee_tree_map_get_key_compare_func (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_TREE_MAP, GeeTreeMap)); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +GCompareFunc gee_tree_multi_map_get_value_compare_func (GeeTreeMultiMap* self) { + GCompareFunc result; + GCompareFunc _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->_value_compare_func; + result = _tmp0_; + return result; +} + + +static void gee_tree_multi_map_set_value_compare_func (GeeTreeMultiMap* self, GCompareFunc value) { + GCompareFunc _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = value; + self->priv->_value_compare_func = _tmp0_; + g_object_notify ((GObject *) self, "value-compare-func"); +} + + +static void gee_tree_multi_map_class_init (GeeTreeMultiMapClass * klass) { + gee_tree_multi_map_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTreeMultiMapPrivate)); + GEE_ABSTRACT_MULTI_MAP_CLASS (klass)->create_value_storage = gee_tree_multi_map_real_create_value_storage; + GEE_ABSTRACT_MULTI_MAP_CLASS (klass)->create_multi_key_set = gee_tree_multi_map_real_create_multi_key_set; + GEE_ABSTRACT_MULTI_MAP_CLASS (klass)->get_value_equal_func = gee_tree_multi_map_real_get_value_equal_func; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_tree_multi_map_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_tree_multi_map_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_tree_multi_map_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MULTI_MAP_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MULTI_MAP_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MULTI_MAP_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MULTI_MAP_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MULTI_MAP_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MULTI_MAP_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MULTI_MAP_KEY_COMPARE_FUNC, g_param_spec_pointer ("key-compare-func", "key-compare-func", "key-compare-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MULTI_MAP_VALUE_COMPARE_FUNC, g_param_spec_pointer ("value-compare-func", "value-compare-func", "value-compare-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_tree_multi_map_instance_init (GeeTreeMultiMap * self) { + self->priv = GEE_TREE_MULTI_MAP_GET_PRIVATE (self); +} + + +static void gee_tree_multi_map_finalize (GObject* obj) { + GeeTreeMultiMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_TREE_MULTI_MAP, GeeTreeMultiMap); + G_OBJECT_CLASS (gee_tree_multi_map_parent_class)->finalize (obj); +} + + +/** + * Left-leaning red-black tree implementation of the {@link MultiMap} + * interface. + */ +GType gee_tree_multi_map_get_type (void) { + static volatile gsize gee_tree_multi_map_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_multi_map_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTreeMultiMapClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tree_multi_map_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTreeMultiMap), 0, (GInstanceInitFunc) gee_tree_multi_map_instance_init, NULL }; + GType gee_tree_multi_map_type_id; + gee_tree_multi_map_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_MULTI_MAP, "GeeTreeMultiMap", &g_define_type_info, 0); + g_once_init_leave (&gee_tree_multi_map_type_id__volatile, gee_tree_multi_map_type_id); + } + return gee_tree_multi_map_type_id__volatile; +} + + +static void _vala_gee_tree_multi_map_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeTreeMultiMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_TREE_MULTI_MAP, GeeTreeMultiMap); + switch (property_id) { + case GEE_TREE_MULTI_MAP_KEY_COMPARE_FUNC: + g_value_set_pointer (value, gee_tree_multi_map_get_key_compare_func (self)); + break; + case GEE_TREE_MULTI_MAP_VALUE_COMPARE_FUNC: + g_value_set_pointer (value, gee_tree_multi_map_get_value_compare_func (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_tree_multi_map_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeTreeMultiMap * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_TREE_MULTI_MAP, GeeTreeMultiMap); + switch (property_id) { + case GEE_TREE_MULTI_MAP_VALUE_COMPARE_FUNC: + gee_tree_multi_map_set_value_compare_func (self, g_value_get_pointer (value)); + break; + case GEE_TREE_MULTI_MAP_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case GEE_TREE_MULTI_MAP_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MULTI_MAP_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case GEE_TREE_MULTI_MAP_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case GEE_TREE_MULTI_MAP_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MULTI_MAP_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/gee/treemultimap.vala b/gee/treemultimap.vala new file mode 100644 index 0000000..c26729e --- /dev/null +++ b/gee/treemultimap.vala @@ -0,0 +1,62 @@ +/* treemultimap.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +/** + * Left-leaning red-black tree implementation of the {@link MultiMap} + * interface. + */ +public class Gee.TreeMultiMap : AbstractMultiMap { + public CompareFunc key_compare_func { + get { return ((TreeMap>) _storage_map).key_compare_func; } + } + + public CompareFunc value_compare_func { private set; get; } + + /** + * Constructs a new, empty tree multimap. + * + * If not provided, the functions parameters are requested to the + * {@link Functions} function factory methods. + * + * @param key_compare_func an optional key comparator function + * @param value_compare_func an optional value comparator function + */ + public TreeMultiMap (CompareFunc? key_compare_func = null, CompareFunc? value_compare_func = null) { + base (new TreeMap> (key_compare_func, direct_equal)); + if (value_compare_func == null) { + value_compare_func = Functions.get_compare_func_for (typeof (V)); + } + this.value_compare_func = value_compare_func; + } + + protected override Collection create_value_storage () { + return new TreeSet (_value_compare_func); + } + + protected override MultiSet create_multi_key_set () { + return new TreeMultiSet (key_compare_func); + } + + protected override EqualFunc get_value_equal_func () { + return Functions.get_equal_func_for (typeof (V)); + } +} diff --git a/gee/treemultiset.c b/gee/treemultiset.c new file mode 100644 index 0000000..0a65cf5 --- /dev/null +++ b/gee/treemultiset.c @@ -0,0 +1,421 @@ +/* treemultiset.c generated by valac 0.18.0, the Vala compiler + * generated from treemultiset.vala, do not modify */ + +/* treemultiset.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; +typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate; + +#define GEE_TYPE_MULTI_SET (gee_multi_set_get_type ()) +#define GEE_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MULTI_SET, GeeMultiSet)) +#define GEE_IS_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MULTI_SET)) +#define GEE_MULTI_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MULTI_SET, GeeMultiSetIface)) + +typedef struct _GeeMultiSet GeeMultiSet; +typedef struct _GeeMultiSetIface GeeMultiSetIface; + +#define GEE_TYPE_ABSTRACT_MULTI_SET (gee_abstract_multi_set_get_type ()) +#define GEE_ABSTRACT_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSet)) +#define GEE_ABSTRACT_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSetClass)) +#define GEE_IS_ABSTRACT_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MULTI_SET)) +#define GEE_IS_ABSTRACT_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MULTI_SET)) +#define GEE_ABSTRACT_MULTI_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MULTI_SET, GeeAbstractMultiSetClass)) + +typedef struct _GeeAbstractMultiSet GeeAbstractMultiSet; +typedef struct _GeeAbstractMultiSetClass GeeAbstractMultiSetClass; +typedef struct _GeeAbstractMultiSetPrivate GeeAbstractMultiSetPrivate; + +#define GEE_TYPE_MAP (gee_map_get_type ()) +#define GEE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP, GeeMap)) +#define GEE_IS_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP)) +#define GEE_MAP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP, GeeMapIface)) + +typedef struct _GeeMap GeeMap; +typedef struct _GeeMapIface GeeMapIface; + +#define GEE_TYPE_MAP_ITERATOR (gee_map_iterator_get_type ()) +#define GEE_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIterator)) +#define GEE_IS_MAP_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MAP_ITERATOR)) +#define GEE_MAP_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_MAP_ITERATOR, GeeMapIteratorIface)) + +typedef struct _GeeMapIterator GeeMapIterator; +typedef struct _GeeMapIteratorIface GeeMapIteratorIface; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_MAP_TYPE_ENTRY (gee_map_entry_get_type ()) +#define GEE_MAP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntry)) +#define GEE_MAP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) +#define GEE_MAP_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_MAP_TYPE_ENTRY)) +#define GEE_MAP_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_MAP_TYPE_ENTRY, GeeMapEntryClass)) + +typedef struct _GeeMapEntry GeeMapEntry; +typedef struct _GeeMapEntryClass GeeMapEntryClass; + +#define GEE_TYPE_TREE_MULTI_SET (gee_tree_multi_set_get_type ()) +#define GEE_TREE_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TREE_MULTI_SET, GeeTreeMultiSet)) +#define GEE_TREE_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TREE_MULTI_SET, GeeTreeMultiSetClass)) +#define GEE_IS_TREE_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TREE_MULTI_SET)) +#define GEE_IS_TREE_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TREE_MULTI_SET)) +#define GEE_TREE_MULTI_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TREE_MULTI_SET, GeeTreeMultiSetClass)) + +typedef struct _GeeTreeMultiSet GeeTreeMultiSet; +typedef struct _GeeTreeMultiSetClass GeeTreeMultiSetClass; +typedef struct _GeeTreeMultiSetPrivate GeeTreeMultiSetPrivate; + +#define GEE_TYPE_ABSTRACT_MAP (gee_abstract_map_get_type ()) +#define GEE_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap)) +#define GEE_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) +#define GEE_IS_ABSTRACT_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_IS_ABSTRACT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_MAP)) +#define GEE_ABSTRACT_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_MAP, GeeAbstractMapClass)) + +typedef struct _GeeAbstractMap GeeAbstractMap; +typedef struct _GeeAbstractMapClass GeeAbstractMapClass; + +#define GEE_TYPE_TREE_MAP (gee_tree_map_get_type ()) +#define GEE_TREE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TREE_MAP, GeeTreeMap)) +#define GEE_TREE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TREE_MAP, GeeTreeMapClass)) +#define GEE_IS_TREE_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TREE_MAP)) +#define GEE_IS_TREE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TREE_MAP)) +#define GEE_TREE_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TREE_MAP, GeeTreeMapClass)) + +typedef struct _GeeTreeMap GeeTreeMap; +typedef struct _GeeTreeMapClass GeeTreeMapClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeAbstractCollection { + GObject parent_instance; + GeeAbstractCollectionPrivate * priv; +}; + +struct _GeeAbstractCollectionClass { + GObjectClass parent_class; + gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*add) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item); + void (*clear) (GeeAbstractCollection* self); + gpointer* (*to_array) (GeeAbstractCollection* self, int* result_length1); + gboolean (*add_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeAbstractCollection* self, GeeCollection* collection); + GeeIterator* (*iterator) (GeeAbstractCollection* self); + gint (*get_size) (GeeAbstractCollection* self); + gboolean (*get_is_empty) (GeeAbstractCollection* self); + GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self); +}; + +struct _GeeMultiSetIface { + GTypeInterface parent_iface; + gint (*count) (GeeMultiSet* self, gconstpointer item); +}; + +struct _GeeMapIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeMapIterator* self); + gboolean (*has_next) (GeeMapIterator* self); + gboolean (*first) (GeeMapIterator* self); + gpointer (*get_key) (GeeMapIterator* self); + gpointer (*get_value) (GeeMapIterator* self); + void (*set_value) (GeeMapIterator* self, gconstpointer value); + void (*unset) (GeeMapIterator* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeMapIface { + GTypeInterface parent_iface; + gboolean (*has_key) (GeeMap* self, gconstpointer key); + gboolean (*contains) (GeeMap* self, gconstpointer key); + gboolean (*has) (GeeMap* self, gconstpointer key, gconstpointer value); + gpointer (*get) (GeeMap* self, gconstpointer key); + void (*set) (GeeMap* self, gconstpointer key, gconstpointer value); + gboolean (*unset) (GeeMap* self, gconstpointer key, gpointer* value); + gboolean (*remove) (GeeMap* self, gconstpointer key, gpointer* value); + void (*clear) (GeeMap* self); + GeeMapIterator* (*map_iterator) (GeeMap* self); + void (*set_all) (GeeMap* self, GeeMap* map); + gboolean (*unset_all) (GeeMap* self, GeeMap* map); + gboolean (*remove_all) (GeeMap* self, GeeMap* map); + gboolean (*has_all) (GeeMap* self, GeeMap* map); + gboolean (*contains_all) (GeeMap* self, GeeMap* map); + gint (*get_size) (GeeMap* self); + gboolean (*get_is_empty) (GeeMap* self); + GeeSet* (*get_keys) (GeeMap* self); + GeeCollection* (*get_values) (GeeMap* self); + GeeSet* (*get_entries) (GeeMap* self); + GeeMap* (*get_read_only_view) (GeeMap* self); + GType (*get_key_type) (GeeMap* self); + GType (*get_value_type) (GeeMap* self); +}; + +struct _GeeAbstractMultiSet { + GeeAbstractCollection parent_instance; + GeeAbstractMultiSetPrivate * priv; + GeeMap* _storage_map; +}; + +struct _GeeAbstractMultiSetClass { + GeeAbstractCollectionClass parent_class; +}; + +struct _GeeTreeMultiSet { + GeeAbstractMultiSet parent_instance; + GeeTreeMultiSetPrivate * priv; +}; + +struct _GeeTreeMultiSetClass { + GeeAbstractMultiSetClass parent_class; +}; + +struct _GeeTreeMultiSetPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; +}; + + +static gpointer gee_tree_multi_set_parent_class = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_multi_set_get_type (void) G_GNUC_CONST; +GType gee_abstract_multi_set_get_type (void) G_GNUC_CONST; +GType gee_map_iterator_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_map_entry_get_type (void) G_GNUC_CONST; +GType gee_map_get_type (void) G_GNUC_CONST; +GType gee_tree_multi_set_get_type (void) G_GNUC_CONST; +#define GEE_TREE_MULTI_SET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_TREE_MULTI_SET, GeeTreeMultiSetPrivate)) +enum { + GEE_TREE_MULTI_SET_DUMMY_PROPERTY, + GEE_TREE_MULTI_SET_G_TYPE, + GEE_TREE_MULTI_SET_G_DUP_FUNC, + GEE_TREE_MULTI_SET_G_DESTROY_FUNC, + GEE_TREE_MULTI_SET_COMPARE_FUNC +}; +GeeTreeMultiSet* gee_tree_multi_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func); +GeeTreeMultiSet* gee_tree_multi_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func); +GeeTreeMap* gee_tree_map_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GCompareFunc key_compare_func, GEqualFunc value_equal_func); +GeeTreeMap* gee_tree_map_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, GCompareFunc key_compare_func, GEqualFunc value_equal_func); +GType gee_abstract_map_get_type (void) G_GNUC_CONST; +GType gee_tree_map_get_type (void) G_GNUC_CONST; +GeeAbstractMultiSet* gee_abstract_multi_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeMap* storage_map); +GCompareFunc gee_tree_multi_set_get_compare_func (GeeTreeMultiSet* self); +GCompareFunc gee_tree_map_get_key_compare_func (GeeTreeMap* self); +static void _vala_gee_tree_multi_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_tree_multi_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +/** + * Constructs a new, empty tree multi set. + * + * If not provided, the function parameter is requested to the + * {@link Functions} function factory methods. + * + * @param compare_func an optional element comparator function + */ +GeeTreeMultiSet* gee_tree_multi_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func) { + GeeTreeMultiSet * self = NULL; + GCompareFunc _tmp0_; + GeeTreeMap* _tmp1_; + GeeTreeMap* _tmp2_; + _tmp0_ = compare_func; + _tmp1_ = gee_tree_map_new (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, G_TYPE_INT, NULL, NULL, _tmp0_, NULL); + _tmp2_ = _tmp1_; + self = (GeeTreeMultiSet*) gee_abstract_multi_set_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, (GeeMap*) _tmp2_); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _g_object_unref0 (_tmp2_); + return self; +} + + +GeeTreeMultiSet* gee_tree_multi_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func) { + return gee_tree_multi_set_construct (GEE_TYPE_TREE_MULTI_SET, g_type, g_dup_func, g_destroy_func, compare_func); +} + + +GCompareFunc gee_tree_multi_set_get_compare_func (GeeTreeMultiSet* self) { + GCompareFunc result; + GeeMap* _tmp0_; + GCompareFunc _tmp1_; + GCompareFunc _tmp2_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = ((GeeAbstractMultiSet*) self)->_storage_map; + _tmp1_ = gee_tree_map_get_key_compare_func (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_TREE_MAP, GeeTreeMap)); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +static void gee_tree_multi_set_class_init (GeeTreeMultiSetClass * klass) { + gee_tree_multi_set_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTreeMultiSetPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_tree_multi_set_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_tree_multi_set_set_property; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MULTI_SET_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MULTI_SET_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MULTI_SET_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_MULTI_SET_COMPARE_FUNC, g_param_spec_pointer ("compare-func", "compare-func", "compare-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_tree_multi_set_instance_init (GeeTreeMultiSet * self) { + self->priv = GEE_TREE_MULTI_SET_GET_PRIVATE (self); +} + + +/** + * Left-leaning red-black tree implementation of the {@link MultiSet} + * interface. + */ +GType gee_tree_multi_set_get_type (void) { + static volatile gsize gee_tree_multi_set_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_multi_set_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTreeMultiSetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tree_multi_set_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTreeMultiSet), 0, (GInstanceInitFunc) gee_tree_multi_set_instance_init, NULL }; + GType gee_tree_multi_set_type_id; + gee_tree_multi_set_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_MULTI_SET, "GeeTreeMultiSet", &g_define_type_info, 0); + g_once_init_leave (&gee_tree_multi_set_type_id__volatile, gee_tree_multi_set_type_id); + } + return gee_tree_multi_set_type_id__volatile; +} + + +static void _vala_gee_tree_multi_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeTreeMultiSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_TREE_MULTI_SET, GeeTreeMultiSet); + switch (property_id) { + case GEE_TREE_MULTI_SET_COMPARE_FUNC: + g_value_set_pointer (value, gee_tree_multi_set_get_compare_func (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_tree_multi_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeTreeMultiSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_TREE_MULTI_SET, GeeTreeMultiSet); + switch (property_id) { + case GEE_TREE_MULTI_SET_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_TREE_MULTI_SET_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_MULTI_SET_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/gee/treemultiset.vala b/gee/treemultiset.vala new file mode 100644 index 0000000..0471608 --- /dev/null +++ b/gee/treemultiset.vala @@ -0,0 +1,43 @@ +/* treemultiset.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +/** + * Left-leaning red-black tree implementation of the {@link MultiSet} + * interface. + */ +public class Gee.TreeMultiSet : AbstractMultiSet { + public CompareFunc compare_func { + get { return ((TreeMap) _storage_map).key_compare_func; } + } + + /** + * Constructs a new, empty tree multi set. + * + * If not provided, the function parameter is requested to the + * {@link Functions} function factory methods. + * + * @param compare_func an optional element comparator function + */ + public TreeMultiSet (CompareFunc? compare_func = null) { + base (new TreeMap (compare_func)); + } +} diff --git a/gee/treeset.c b/gee/treeset.c new file mode 100644 index 0000000..4fe99e9 --- /dev/null +++ b/gee/treeset.c @@ -0,0 +1,5153 @@ +/* treeset.c generated by valac 0.18.0, the Vala compiler + * generated from treeset.vala, do not modify */ + +/* treeset.vala + * + * Copyright (C) 2009 Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Maciej Piechotka + */ + +#include +#include +#include + + +#define GEE_TYPE_ITERABLE (gee_iterable_get_type ()) +#define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable)) +#define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE)) +#define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface)) + +typedef struct _GeeIterable GeeIterable; +typedef struct _GeeIterableIface GeeIterableIface; + +#define GEE_TYPE_ITERATOR (gee_iterator_get_type ()) +#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator)) +#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR)) +#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface)) + +typedef struct _GeeIterator GeeIterator; +typedef struct _GeeIteratorIface GeeIteratorIface; + +#define GEE_TYPE_COLLECTION (gee_collection_get_type ()) +#define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection)) +#define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION)) +#define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface)) + +typedef struct _GeeCollection GeeCollection; +typedef struct _GeeCollectionIface GeeCollectionIface; + +#define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ()) +#define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection)) +#define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) +#define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION)) +#define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass)) + +typedef struct _GeeAbstractCollection GeeAbstractCollection; +typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass; +typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate; + +#define GEE_TYPE_SET (gee_set_get_type ()) +#define GEE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SET, GeeSet)) +#define GEE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SET)) +#define GEE_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SET, GeeSetIface)) + +typedef struct _GeeSet GeeSet; +typedef struct _GeeSetIface GeeSetIface; + +#define GEE_TYPE_ABSTRACT_SET (gee_abstract_set_get_type ()) +#define GEE_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSet)) +#define GEE_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) +#define GEE_IS_ABSTRACT_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_SET)) +#define GEE_IS_ABSTRACT_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_SET)) +#define GEE_ABSTRACT_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_SET, GeeAbstractSetClass)) + +typedef struct _GeeAbstractSet GeeAbstractSet; +typedef struct _GeeAbstractSetClass GeeAbstractSetClass; +typedef struct _GeeAbstractSetPrivate GeeAbstractSetPrivate; + +#define GEE_TYPE_SORTED_SET (gee_sorted_set_get_type ()) +#define GEE_SORTED_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_SORTED_SET, GeeSortedSet)) +#define GEE_IS_SORTED_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_SORTED_SET)) +#define GEE_SORTED_SET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_SORTED_SET, GeeSortedSetIface)) + +typedef struct _GeeSortedSet GeeSortedSet; +typedef struct _GeeSortedSetIface GeeSortedSetIface; + +#define GEE_TYPE_BIDIR_ITERATOR (gee_bidir_iterator_get_type ()) +#define GEE_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIterator)) +#define GEE_IS_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_ITERATOR)) +#define GEE_BIDIR_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIteratorIface)) + +typedef struct _GeeBidirIterator GeeBidirIterator; +typedef struct _GeeBidirIteratorIface GeeBidirIteratorIface; + +#define GEE_TYPE_TREE_SET (gee_tree_set_get_type ()) +#define GEE_TREE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TREE_SET, GeeTreeSet)) +#define GEE_TREE_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TREE_SET, GeeTreeSetClass)) +#define GEE_IS_TREE_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TREE_SET)) +#define GEE_IS_TREE_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TREE_SET)) +#define GEE_TREE_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TREE_SET, GeeTreeSetClass)) + +typedef struct _GeeTreeSet GeeTreeSet; +typedef struct _GeeTreeSetClass GeeTreeSetClass; +typedef struct _GeeTreeSetPrivate GeeTreeSetPrivate; +typedef struct _GeeTreeSetNode GeeTreeSetNode; + +#define GEE_TREE_SET_TYPE_RANGE_TYPE (gee_tree_set_range_type_get_type ()) +#define _gee_tree_set_node_free0(var) ((var == NULL) ? NULL : (var = (gee_tree_set_node_free (var), NULL))) + +#define GEE_TREE_SET_NODE_TYPE_COLOR (gee_tree_set_node_color_get_type ()) + +#define GEE_TREE_SET_TYPE_ITERATOR (gee_tree_set_iterator_get_type ()) +#define GEE_TREE_SET_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TREE_SET_TYPE_ITERATOR, GeeTreeSetIterator)) +#define GEE_TREE_SET_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TREE_SET_TYPE_ITERATOR, GeeTreeSetIteratorClass)) +#define GEE_TREE_SET_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TREE_SET_TYPE_ITERATOR)) +#define GEE_TREE_SET_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TREE_SET_TYPE_ITERATOR)) +#define GEE_TREE_SET_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TREE_SET_TYPE_ITERATOR, GeeTreeSetIteratorClass)) + +typedef struct _GeeTreeSetIterator GeeTreeSetIterator; +typedef struct _GeeTreeSetIteratorClass GeeTreeSetIteratorClass; + +#define GEE_TREE_SET_TYPE_SUB_SET (gee_tree_set_sub_set_get_type ()) +#define GEE_TREE_SET_SUB_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TREE_SET_TYPE_SUB_SET, GeeTreeSetSubSet)) +#define GEE_TREE_SET_SUB_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TREE_SET_TYPE_SUB_SET, GeeTreeSetSubSetClass)) +#define GEE_TREE_SET_IS_SUB_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TREE_SET_TYPE_SUB_SET)) +#define GEE_TREE_SET_IS_SUB_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TREE_SET_TYPE_SUB_SET)) +#define GEE_TREE_SET_SUB_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TREE_SET_TYPE_SUB_SET, GeeTreeSetSubSetClass)) + +typedef struct _GeeTreeSetSubSet GeeTreeSetSubSet; +typedef struct _GeeTreeSetSubSetClass GeeTreeSetSubSetClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +typedef struct _GeeTreeSetIteratorPrivate GeeTreeSetIteratorPrivate; + +#define GEE_TREE_SET_TYPE_RANGE (gee_tree_set_range_get_type ()) +#define GEE_TREE_SET_RANGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TREE_SET_TYPE_RANGE, GeeTreeSetRange)) +#define GEE_TREE_SET_RANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TREE_SET_TYPE_RANGE, GeeTreeSetRangeClass)) +#define GEE_TREE_SET_IS_RANGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TREE_SET_TYPE_RANGE)) +#define GEE_TREE_SET_IS_RANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TREE_SET_TYPE_RANGE)) +#define GEE_TREE_SET_RANGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TREE_SET_TYPE_RANGE, GeeTreeSetRangeClass)) + +typedef struct _GeeTreeSetRange GeeTreeSetRange; +typedef struct _GeeTreeSetRangeClass GeeTreeSetRangeClass; +typedef struct _GeeTreeSetRangePrivate GeeTreeSetRangePrivate; +#define _g_destroy_func0(var) (((var == NULL) || (g_destroy_func == NULL)) ? NULL : (var = (g_destroy_func (var), NULL))) +typedef struct _GeeTreeSetParamSpecRange GeeTreeSetParamSpecRange; +typedef struct _GeeTreeSetSubSetPrivate GeeTreeSetSubSetPrivate; +#define _gee_tree_set_range_unref0(var) ((var == NULL) ? NULL : (var = (gee_tree_set_range_unref (var), NULL))) + +#define GEE_TREE_SET_TYPE_SUB_ITERATOR (gee_tree_set_sub_iterator_get_type ()) +#define GEE_TREE_SET_SUB_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TREE_SET_TYPE_SUB_ITERATOR, GeeTreeSetSubIterator)) +#define GEE_TREE_SET_SUB_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TREE_SET_TYPE_SUB_ITERATOR, GeeTreeSetSubIteratorClass)) +#define GEE_TREE_SET_IS_SUB_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TREE_SET_TYPE_SUB_ITERATOR)) +#define GEE_TREE_SET_IS_SUB_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TREE_SET_TYPE_SUB_ITERATOR)) +#define GEE_TREE_SET_SUB_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TREE_SET_TYPE_SUB_ITERATOR, GeeTreeSetSubIteratorClass)) + +typedef struct _GeeTreeSetSubIterator GeeTreeSetSubIterator; +typedef struct _GeeTreeSetSubIteratorClass GeeTreeSetSubIteratorClass; +typedef struct _GeeTreeSetSubIteratorPrivate GeeTreeSetSubIteratorPrivate; +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeIteratorIface { + GTypeInterface parent_iface; + gboolean (*next) (GeeIterator* self); + gboolean (*has_next) (GeeIterator* self); + gboolean (*first) (GeeIterator* self); + gpointer (*get) (GeeIterator* self); + void (*remove) (GeeIterator* self); +}; + +struct _GeeIterableIface { + GTypeInterface parent_iface; + GeeIterator* (*iterator) (GeeIterable* self); + GType (*get_element_type) (GeeIterable* self); +}; + +struct _GeeCollectionIface { + GTypeInterface parent_iface; + gboolean (*contains) (GeeCollection* self, gconstpointer item); + gboolean (*add) (GeeCollection* self, gconstpointer item); + gboolean (*remove) (GeeCollection* self, gconstpointer item); + void (*clear) (GeeCollection* self); + gboolean (*add_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection); + gpointer* (*to_array) (GeeCollection* self, int* result_length1); + gint (*get_size) (GeeCollection* self); + gboolean (*get_is_empty) (GeeCollection* self); + GeeCollection* (*get_read_only_view) (GeeCollection* self); +}; + +struct _GeeAbstractCollection { + GObject parent_instance; + GeeAbstractCollectionPrivate * priv; +}; + +struct _GeeAbstractCollectionClass { + GObjectClass parent_class; + gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*add) (GeeAbstractCollection* self, gconstpointer item); + gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item); + void (*clear) (GeeAbstractCollection* self); + gpointer* (*to_array) (GeeAbstractCollection* self, int* result_length1); + gboolean (*add_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*contains_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*remove_all) (GeeAbstractCollection* self, GeeCollection* collection); + gboolean (*retain_all) (GeeAbstractCollection* self, GeeCollection* collection); + GeeIterator* (*iterator) (GeeAbstractCollection* self); + gint (*get_size) (GeeAbstractCollection* self); + gboolean (*get_is_empty) (GeeAbstractCollection* self); + GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self); +}; + +struct _GeeSetIface { + GTypeInterface parent_iface; + GeeSet* (*get_read_only_view) (GeeSet* self); +}; + +struct _GeeAbstractSet { + GeeAbstractCollection parent_instance; + GeeAbstractSetPrivate * priv; +}; + +struct _GeeAbstractSetClass { + GeeAbstractCollectionClass parent_class; + GeeSet* (*get_read_only_view) (GeeAbstractSet* self); +}; + +struct _GeeBidirIteratorIface { + GTypeInterface parent_iface; + gboolean (*previous) (GeeBidirIterator* self); + gboolean (*has_previous) (GeeBidirIterator* self); + gboolean (*last) (GeeBidirIterator* self); +}; + +struct _GeeSortedSetIface { + GTypeInterface parent_iface; + gpointer (*first) (GeeSortedSet* self); + gpointer (*last) (GeeSortedSet* self); + GeeBidirIterator* (*bidir_iterator) (GeeSortedSet* self); + GeeBidirIterator* (*iterator_at) (GeeSortedSet* self, gconstpointer element); + gpointer (*lower) (GeeSortedSet* self, gconstpointer element); + gpointer (*higher) (GeeSortedSet* self, gconstpointer element); + gpointer (*floor) (GeeSortedSet* self, gconstpointer element); + gpointer (*ceil) (GeeSortedSet* self, gconstpointer element); + GeeSortedSet* (*head_set) (GeeSortedSet* self, gconstpointer before); + GeeSortedSet* (*tail_set) (GeeSortedSet* self, gconstpointer after); + GeeSortedSet* (*sub_set) (GeeSortedSet* self, gconstpointer from, gconstpointer to); +}; + +struct _GeeTreeSet { + GeeAbstractSet parent_instance; + GeeTreeSetPrivate * priv; +}; + +struct _GeeTreeSetClass { + GeeAbstractSetClass parent_class; +}; + +struct _GeeTreeSetPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GCompareFunc _compare_func; + gint _size; + GeeTreeSetNode* root; + GeeTreeSetNode* _first; + GeeTreeSetNode* _last; + gint stamp; +}; + +typedef enum { + GEE_TREE_SET_RANGE_TYPE_HEAD, + GEE_TREE_SET_RANGE_TYPE_TAIL, + GEE_TREE_SET_RANGE_TYPE_EMPTY, + GEE_TREE_SET_RANGE_TYPE_BOUNDED +} GeeTreeSetRangeType; + +typedef enum { + GEE_TREE_SET_NODE_COLOR_RED, + GEE_TREE_SET_NODE_COLOR_BLACK +} GeeTreeSetNodeColor; + +struct _GeeTreeSetNode { + gpointer key; + GeeTreeSetNodeColor color; + GeeTreeSetNode* left; + GeeTreeSetNode* right; + GeeTreeSetNode* prev; + GeeTreeSetNode* next; +}; + +struct _GeeTreeSetIterator { + GObject parent_instance; + GeeTreeSetIteratorPrivate * priv; +}; + +struct _GeeTreeSetIteratorClass { + GObjectClass parent_class; +}; + +struct _GeeTreeSetIteratorPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GeeTreeSet* _set; + gint stamp; + GeeTreeSetNode* current; + GeeTreeSetNode* _next; + GeeTreeSetNode* _prev; + gboolean started; +}; + +struct _GeeTreeSetRange { + GTypeInstance parent_instance; + volatile int ref_count; + GeeTreeSetRangePrivate * priv; +}; + +struct _GeeTreeSetRangeClass { + GTypeClass parent_class; + void (*finalize) (GeeTreeSetRange *self); +}; + +struct _GeeTreeSetRangePrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GeeTreeSet* set; + gpointer after; + gpointer before; + GeeTreeSetRangeType type; +}; + +struct _GeeTreeSetParamSpecRange { + GParamSpec parent_instance; +}; + +struct _GeeTreeSetSubSet { + GeeAbstractSet parent_instance; + GeeTreeSetSubSetPrivate * priv; +}; + +struct _GeeTreeSetSubSetClass { + GeeAbstractSetClass parent_class; +}; + +struct _GeeTreeSetSubSetPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GeeTreeSet* set; + GeeTreeSetRange* range; +}; + +struct _GeeTreeSetSubIterator { + GObject parent_instance; + GeeTreeSetSubIteratorPrivate * priv; +}; + +struct _GeeTreeSetSubIteratorClass { + GObjectClass parent_class; +}; + +struct _GeeTreeSetSubIteratorPrivate { + GType g_type; + GBoxedCopyFunc g_dup_func; + GDestroyNotify g_destroy_func; + GeeTreeSet* set; + GeeTreeSetRange* range; + GeeTreeSetIterator* iterator; +}; + + +static gpointer gee_tree_set_parent_class = NULL; +static gpointer gee_tree_set_iterator_parent_class = NULL; +static GeeIteratorIface* gee_tree_set_iterator_gee_iterator_parent_iface = NULL; +static GeeBidirIteratorIface* gee_tree_set_iterator_gee_bidir_iterator_parent_iface = NULL; +static gpointer gee_tree_set_range_parent_class = NULL; +static gpointer gee_tree_set_sub_set_parent_class = NULL; +static GeeSortedSetIface* gee_tree_set_sub_set_gee_sorted_set_parent_iface = NULL; +static gpointer gee_tree_set_sub_iterator_parent_class = NULL; +static GeeIteratorIface* gee_tree_set_sub_iterator_gee_iterator_parent_iface = NULL; +static GeeBidirIteratorIface* gee_tree_set_sub_iterator_gee_bidir_iterator_parent_iface = NULL; +static GeeSortedSetIface* gee_tree_set_gee_sorted_set_parent_iface = NULL; + +GType gee_iterator_get_type (void) G_GNUC_CONST; +GType gee_iterable_get_type (void) G_GNUC_CONST; +GType gee_collection_get_type (void) G_GNUC_CONST; +GType gee_abstract_collection_get_type (void) G_GNUC_CONST; +GType gee_set_get_type (void) G_GNUC_CONST; +GType gee_abstract_set_get_type (void) G_GNUC_CONST; +GType gee_bidir_iterator_get_type (void) G_GNUC_CONST; +GType gee_sorted_set_get_type (void) G_GNUC_CONST; +GType gee_tree_set_get_type (void) G_GNUC_CONST; +static void gee_tree_set_node_free (GeeTreeSetNode* self); +#define GEE_TREE_SET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_TREE_SET, GeeTreeSetPrivate)) +enum { + GEE_TREE_SET_DUMMY_PROPERTY, + GEE_TREE_SET_G_TYPE, + GEE_TREE_SET_G_DUP_FUNC, + GEE_TREE_SET_G_DESTROY_FUNC, + GEE_TREE_SET_SIZE, + GEE_TREE_SET_COMPARE_FUNC +}; +static GType gee_tree_set_range_type_get_type (void) G_GNUC_UNUSED; +GeeTreeSet* gee_tree_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func); +GeeTreeSet* gee_tree_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func); +GeeAbstractSet* gee_abstract_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func); +GCompareFunc gee_functions_get_compare_func_for (GType t); +static void gee_tree_set_set_compare_func (GeeTreeSet* self, GCompareFunc value); +static gboolean gee_tree_set_real_contains (GeeAbstractCollection* base, gconstpointer item); +GCompareFunc gee_tree_set_get_compare_func (GeeTreeSet* self); +GType gee_tree_set_node_color_get_type (void) G_GNUC_CONST; +static inline void gee_tree_set_rotate_right (GeeTreeSet* self, GeeTreeSetNode** root); +static inline void gee_tree_set_rotate_left (GeeTreeSet* self, GeeTreeSetNode** root); +static inline gboolean gee_tree_set_is_red (GeeTreeSet* self, GeeTreeSetNode* n); +static inline gboolean gee_tree_set_is_black (GeeTreeSet* self, GeeTreeSetNode* n); +static inline void gee_tree_set_fix_up (GeeTreeSet* self, GeeTreeSetNode** node); +static void gee_tree_set_node_flip (GeeTreeSetNode* self); +static gboolean gee_tree_set_add_to_node (GeeTreeSet* self, GeeTreeSetNode** node, gpointer item, GeeTreeSetNode* prev, GeeTreeSetNode* next); +static GeeTreeSetNode* gee_tree_set_node_new (gpointer node, GeeTreeSetNode* prev, GeeTreeSetNode* next); +static GeeTreeSetNode* gee_tree_set_node_new (gpointer node, GeeTreeSetNode* prev, GeeTreeSetNode* next); +static gboolean gee_tree_set_real_add (GeeAbstractCollection* base, gconstpointer item); +static inline void gee_tree_set_move_red_left (GeeTreeSet* self, GeeTreeSetNode** root); +static inline void gee_tree_set_move_red_right (GeeTreeSet* self, GeeTreeSetNode** root); +static inline void gee_tree_set_fix_removal (GeeTreeSet* self, GeeTreeSetNode** node, gpointer* key); +static void gee_tree_set_remove_minimal (GeeTreeSet* self, GeeTreeSetNode** node, gpointer* key); +static gboolean gee_tree_set_remove_from_node (GeeTreeSet* self, GeeTreeSetNode** node, gconstpointer item, GeeTreeSetNode** prev, GeeTreeSetNode** next); +static gboolean gee_tree_set_real_remove (GeeAbstractCollection* base, gconstpointer item); +static inline void gee_tree_set_clear_subtree (GeeTreeSet* self, GeeTreeSetNode* node); +static void gee_tree_set_real_clear (GeeAbstractCollection* base); +static GeeIterator* gee_tree_set_real_iterator (GeeAbstractCollection* base); +static GeeTreeSetIterator* gee_tree_set_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set); +static GeeTreeSetIterator* gee_tree_set_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set); +static GType gee_tree_set_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static GeeBidirIterator* gee_tree_set_real_bidir_iterator (GeeSortedSet* base); +static inline gpointer gee_tree_set_lift_null_get (GeeTreeSet* self, GeeTreeSetNode* node); +static gpointer gee_tree_set_real_first (GeeSortedSet* base); +static gpointer gee_tree_set_real_last (GeeSortedSet* base); +static GeeSortedSet* gee_tree_set_real_head_set (GeeSortedSet* base, gconstpointer before); +static GeeTreeSetSubSet* gee_tree_set_sub_set_new_head (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer before); +static GeeTreeSetSubSet* gee_tree_set_sub_set_construct_head (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer before); +static GType gee_tree_set_sub_set_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static GeeSortedSet* gee_tree_set_real_tail_set (GeeSortedSet* base, gconstpointer after); +static GeeTreeSetSubSet* gee_tree_set_sub_set_new_tail (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer after); +static GeeTreeSetSubSet* gee_tree_set_sub_set_construct_tail (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer after); +static GeeSortedSet* gee_tree_set_real_sub_set (GeeSortedSet* base, gconstpointer after, gconstpointer before); +static GeeTreeSetSubSet* gee_tree_set_sub_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer after, gconstpointer before); +static GeeTreeSetSubSet* gee_tree_set_sub_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer after, gconstpointer before); +static inline GeeTreeSetNode* gee_tree_set_find_node (GeeTreeSet* self, gconstpointer item); +static GeeBidirIterator* gee_tree_set_real_iterator_at (GeeSortedSet* base, gconstpointer item); +static GeeTreeSetIterator* gee_tree_set_iterator_new_pointing (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, GeeTreeSetNode* current); +static GeeTreeSetIterator* gee_tree_set_iterator_construct_pointing (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, GeeTreeSetNode* current); +static inline GeeTreeSetNode* gee_tree_set_find_nearest (GeeTreeSet* self, gconstpointer item); +static inline GeeTreeSetNode* gee_tree_set_find_lower (GeeTreeSet* self, gconstpointer item); +static inline GeeTreeSetNode* gee_tree_set_find_higher (GeeTreeSet* self, gconstpointer item); +static inline GeeTreeSetNode* gee_tree_set_find_floor (GeeTreeSet* self, gconstpointer item); +static inline GeeTreeSetNode* gee_tree_set_find_ceil (GeeTreeSet* self, gconstpointer item); +static gpointer gee_tree_set_real_lower (GeeSortedSet* base, gconstpointer item); +static gpointer gee_tree_set_real_higher (GeeSortedSet* base, gconstpointer item); +static gpointer gee_tree_set_real_floor (GeeSortedSet* base, gconstpointer item); +static gpointer gee_tree_set_real_ceil (GeeSortedSet* base, gconstpointer item); +static inline gpointer gee_tree_set_min (GeeTreeSet* self, gconstpointer a, gconstpointer b); +static inline gpointer gee_tree_set_max (GeeTreeSet* self, gconstpointer a, gconstpointer b); +static void gee_tree_set_node_instance_init (GeeTreeSetNode * self); +static GeeTreeSetNodeColor gee_tree_set_node_color_flip (GeeTreeSetNodeColor self); +#define GEE_TREE_SET_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TREE_SET_TYPE_ITERATOR, GeeTreeSetIteratorPrivate)) +enum { + GEE_TREE_SET_ITERATOR_DUMMY_PROPERTY, + GEE_TREE_SET_ITERATOR_G_TYPE, + GEE_TREE_SET_ITERATOR_G_DUP_FUNC, + GEE_TREE_SET_ITERATOR_G_DESTROY_FUNC +}; +static gboolean gee_tree_set_iterator_real_next (GeeIterator* base); +static gboolean gee_tree_set_iterator_real_has_next (GeeIterator* base); +static gboolean gee_tree_set_iterator_real_first (GeeIterator* base); +static gboolean gee_tree_set_iterator_real_previous (GeeBidirIterator* base); +static gboolean gee_tree_set_iterator_real_has_previous (GeeBidirIterator* base); +static gboolean gee_tree_set_iterator_real_last (GeeBidirIterator* base); +static gpointer gee_tree_set_iterator_real_get (GeeIterator* base); +static void gee_tree_set_iterator_real_remove (GeeIterator* base); +static gboolean gee_tree_set_iterator_safe_next_get (GeeTreeSetIterator* self, gpointer* val); +static gboolean gee_tree_set_iterator_safe_previous_get (GeeTreeSetIterator* self, gpointer* val); +static void gee_tree_set_iterator_finalize (GObject* obj); +static void _vala_gee_tree_set_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_tree_set_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static gpointer gee_tree_set_range_ref (gpointer instance); +static void gee_tree_set_range_unref (gpointer instance); +static GParamSpec* gee_tree_set_param_spec_range (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) G_GNUC_UNUSED; +static void gee_tree_set_value_set_range (GValue* value, gpointer v_object) G_GNUC_UNUSED; +static void gee_tree_set_value_take_range (GValue* value, gpointer v_object) G_GNUC_UNUSED; +static gpointer gee_tree_set_value_get_range (const GValue* value) G_GNUC_UNUSED; +static GType gee_tree_set_range_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +#define GEE_TREE_SET_RANGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TREE_SET_TYPE_RANGE, GeeTreeSetRangePrivate)) +enum { + GEE_TREE_SET_RANGE_DUMMY_PROPERTY +}; +static GeeTreeSetRange* gee_tree_set_range_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer after, gconstpointer before); +static GeeTreeSetRange* gee_tree_set_range_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer after, gconstpointer before); +static GeeTreeSetRange* gee_tree_set_range_new_head (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer before); +static GeeTreeSetRange* gee_tree_set_range_construct_head (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer before); +static GeeTreeSetRange* gee_tree_set_range_new_tail (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer after); +static GeeTreeSetRange* gee_tree_set_range_construct_tail (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer after); +static GeeTreeSetRange* gee_tree_set_range_cut_head (GeeTreeSetRange* self, gconstpointer after); +static GeeTreeSetRange* gee_tree_set_range_cut_tail (GeeTreeSetRange* self, gconstpointer before); +static GeeTreeSetRange* gee_tree_set_range_cut (GeeTreeSetRange* self, gconstpointer after, gconstpointer before); +static gboolean gee_tree_set_range_in_range (GeeTreeSetRange* self, gconstpointer item); +static gint gee_tree_set_range_compare_range (GeeTreeSetRange* self, gconstpointer item); +static gboolean gee_tree_set_range_empty_subset (GeeTreeSetRange* self); +static GeeTreeSetNode* gee_tree_set_range_first (GeeTreeSetRange* self); +static GeeTreeSetNode* gee_tree_set_range_last (GeeTreeSetRange* self); +static void gee_tree_set_range_finalize (GeeTreeSetRange* obj); +#define GEE_TREE_SET_SUB_SET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TREE_SET_TYPE_SUB_SET, GeeTreeSetSubSetPrivate)) +enum { + GEE_TREE_SET_SUB_SET_DUMMY_PROPERTY, + GEE_TREE_SET_SUB_SET_G_TYPE, + GEE_TREE_SET_SUB_SET_G_DUP_FUNC, + GEE_TREE_SET_SUB_SET_G_DESTROY_FUNC, + GEE_TREE_SET_SUB_SET_SIZE, + GEE_TREE_SET_SUB_SET_IS_EMPTY +}; +static GeeTreeSetSubSet* gee_tree_set_sub_set_new_from_range (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, GeeTreeSetRange* range); +static GeeTreeSetSubSet* gee_tree_set_sub_set_construct_from_range (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, GeeTreeSetRange* range); +static gboolean gee_tree_set_sub_set_real_contains (GeeAbstractCollection* base, gconstpointer item); +gboolean gee_abstract_collection_contains (GeeAbstractCollection* self, gconstpointer item); +static gboolean gee_tree_set_sub_set_real_add (GeeAbstractCollection* base, gconstpointer item); +gboolean gee_abstract_collection_add (GeeAbstractCollection* self, gconstpointer item); +static gboolean gee_tree_set_sub_set_real_remove (GeeAbstractCollection* base, gconstpointer item); +gboolean gee_abstract_collection_remove (GeeAbstractCollection* self, gconstpointer item); +static void gee_tree_set_sub_set_real_clear (GeeAbstractCollection* base); +GeeIterator* gee_abstract_collection_iterator (GeeAbstractCollection* self); +gboolean gee_iterator_next (GeeIterator* self); +void gee_iterator_remove (GeeIterator* self); +static GeeIterator* gee_tree_set_sub_set_real_iterator (GeeAbstractCollection* base); +static GeeTreeSetSubIterator* gee_tree_set_sub_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, GeeTreeSetRange* range); +static GeeTreeSetSubIterator* gee_tree_set_sub_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, GeeTreeSetRange* range); +static GType gee_tree_set_sub_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +static GeeBidirIterator* gee_tree_set_sub_set_real_bidir_iterator (GeeSortedSet* base); +static gpointer gee_tree_set_sub_set_real_first (GeeSortedSet* base); +static gpointer gee_tree_set_sub_set_real_last (GeeSortedSet* base); +static GeeSortedSet* gee_tree_set_sub_set_real_head_set (GeeSortedSet* base, gconstpointer before); +static GeeSortedSet* gee_tree_set_sub_set_real_tail_set (GeeSortedSet* base, gconstpointer after); +static GeeSortedSet* gee_tree_set_sub_set_real_sub_set (GeeSortedSet* base, gconstpointer after, gconstpointer before); +static GeeBidirIterator* gee_tree_set_sub_set_real_iterator_at (GeeSortedSet* base, gconstpointer item); +static GeeTreeSetSubIterator* gee_tree_set_sub_iterator_new_pointing (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, GeeTreeSetRange* range, GeeTreeSetNode* node); +static GeeTreeSetSubIterator* gee_tree_set_sub_iterator_construct_pointing (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, GeeTreeSetRange* range, GeeTreeSetNode* node); +static gpointer gee_tree_set_sub_set_real_lower (GeeSortedSet* base, gconstpointer item); +gpointer gee_sorted_set_last (GeeSortedSet* self); +gpointer gee_sorted_set_lower (GeeSortedSet* self, gconstpointer element); +static gpointer gee_tree_set_sub_set_real_higher (GeeSortedSet* base, gconstpointer item); +gpointer gee_sorted_set_first (GeeSortedSet* self); +gpointer gee_sorted_set_higher (GeeSortedSet* self, gconstpointer element); +static gpointer gee_tree_set_sub_set_real_floor (GeeSortedSet* base, gconstpointer item); +gpointer gee_sorted_set_floor (GeeSortedSet* self, gconstpointer element); +static gpointer gee_tree_set_sub_set_real_ceil (GeeSortedSet* base, gconstpointer item); +gpointer gee_sorted_set_ceil (GeeSortedSet* self, gconstpointer element); +static void gee_tree_set_sub_set_finalize (GObject* obj); +gint gee_abstract_collection_get_size (GeeAbstractCollection* self); +gboolean gee_abstract_collection_get_is_empty (GeeAbstractCollection* self); +static void _vala_gee_tree_set_sub_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_tree_set_sub_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +#define GEE_TREE_SET_SUB_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TREE_SET_TYPE_SUB_ITERATOR, GeeTreeSetSubIteratorPrivate)) +enum { + GEE_TREE_SET_SUB_ITERATOR_DUMMY_PROPERTY, + GEE_TREE_SET_SUB_ITERATOR_G_TYPE, + GEE_TREE_SET_SUB_ITERATOR_G_DUP_FUNC, + GEE_TREE_SET_SUB_ITERATOR_G_DESTROY_FUNC +}; +static gboolean gee_tree_set_sub_iterator_real_next (GeeIterator* base); +gboolean gee_iterator_first (GeeIterator* self); +static gboolean gee_tree_set_sub_iterator_real_has_next (GeeIterator* base); +static gboolean gee_tree_set_sub_iterator_real_first (GeeIterator* base); +static gboolean gee_tree_set_sub_iterator_real_previous (GeeBidirIterator* base); +gboolean gee_bidir_iterator_previous (GeeBidirIterator* self); +static gboolean gee_tree_set_sub_iterator_real_has_previous (GeeBidirIterator* base); +static gboolean gee_tree_set_sub_iterator_real_last (GeeBidirIterator* base); +static gpointer gee_tree_set_sub_iterator_real_get (GeeIterator* base); +gpointer gee_iterator_get (GeeIterator* self); +static void gee_tree_set_sub_iterator_real_remove (GeeIterator* base); +static void gee_tree_set_sub_iterator_finalize (GObject* obj); +static void _vala_gee_tree_set_sub_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_tree_set_sub_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void gee_tree_set_finalize (GObject* obj); +static void _vala_gee_tree_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_gee_tree_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +static GType gee_tree_set_range_type_get_type (void) { + static volatile gsize gee_tree_set_range_type_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_set_range_type_type_id__volatile)) { + static const GEnumValue values[] = {{GEE_TREE_SET_RANGE_TYPE_HEAD, "GEE_TREE_SET_RANGE_TYPE_HEAD", "head"}, {GEE_TREE_SET_RANGE_TYPE_TAIL, "GEE_TREE_SET_RANGE_TYPE_TAIL", "tail"}, {GEE_TREE_SET_RANGE_TYPE_EMPTY, "GEE_TREE_SET_RANGE_TYPE_EMPTY", "empty"}, {GEE_TREE_SET_RANGE_TYPE_BOUNDED, "GEE_TREE_SET_RANGE_TYPE_BOUNDED", "bounded"}, {0, NULL, NULL}}; + GType gee_tree_set_range_type_type_id; + gee_tree_set_range_type_type_id = g_enum_register_static ("GeeTreeSetRangeType", values); + g_once_init_leave (&gee_tree_set_range_type_type_id__volatile, gee_tree_set_range_type_type_id); + } + return gee_tree_set_range_type_type_id__volatile; +} + + +/** + * Constructs a new, empty tree set sorted according to the specified + * comparator function. + * + * If not provided, the function parameter is requested to the + * {@link Functions} function factory methods. + * + * @param compare_func an optional element comparator function + */ +GeeTreeSet* gee_tree_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func) { + GeeTreeSet * self = NULL; + GCompareFunc _tmp0_; + GCompareFunc _tmp2_; + self = (GeeTreeSet*) gee_abstract_set_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = compare_func; + if (_tmp0_ == NULL) { + GCompareFunc _tmp1_ = NULL; + _tmp1_ = gee_functions_get_compare_func_for (g_type); + compare_func = _tmp1_; + } + _tmp2_ = compare_func; + gee_tree_set_set_compare_func (self, _tmp2_); + return self; +} + + +GeeTreeSet* gee_tree_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GCompareFunc compare_func) { + return gee_tree_set_construct (GEE_TYPE_TREE_SET, g_type, g_dup_func, g_destroy_func, compare_func); +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_tree_set_real_contains (GeeAbstractCollection* base, gconstpointer item) { + GeeTreeSet * self; + gboolean result = FALSE; + GeeTreeSetNode* _tmp0_; + GeeTreeSetNode* cur; + self = (GeeTreeSet*) base; + _tmp0_ = self->priv->root; + cur = _tmp0_; + while (TRUE) { + GeeTreeSetNode* _tmp1_; + GCompareFunc _tmp2_; + GCompareFunc _tmp3_; + gconstpointer _tmp4_; + GeeTreeSetNode* _tmp5_; + gconstpointer _tmp6_; + gint _tmp7_ = 0; + gint res; + gint _tmp8_; + _tmp1_ = cur; + if (!(_tmp1_ != NULL)) { + break; + } + _tmp2_ = gee_tree_set_get_compare_func (self); + _tmp3_ = _tmp2_; + _tmp4_ = item; + _tmp5_ = cur; + _tmp6_ = _tmp5_->key; + _tmp7_ = _tmp3_ (_tmp4_, _tmp6_); + res = _tmp7_; + _tmp8_ = res; + if (_tmp8_ == 0) { + result = TRUE; + return result; + } else { + gint _tmp9_; + _tmp9_ = res; + if (_tmp9_ < 0) { + GeeTreeSetNode* _tmp10_; + GeeTreeSetNode* _tmp11_; + _tmp10_ = cur; + _tmp11_ = _tmp10_->left; + cur = _tmp11_; + } else { + GeeTreeSetNode* _tmp12_; + GeeTreeSetNode* _tmp13_; + _tmp12_ = cur; + _tmp13_ = _tmp12_->right; + cur = _tmp13_; + } + } + } + result = FALSE; + return result; +} + + +static inline void gee_tree_set_rotate_right (GeeTreeSet* self, GeeTreeSetNode** root) { + GeeTreeSetNode* _tmp0_; + GeeTreeSetNode* _tmp1_; + GeeTreeSetNode* pivot; + GeeTreeSetNode* _tmp2_; + GeeTreeSetNode* _tmp3_; + GeeTreeSetNodeColor _tmp4_; + GeeTreeSetNode* _tmp5_; + GeeTreeSetNode* _tmp6_; + GeeTreeSetNode* _tmp7_; + GeeTreeSetNode* _tmp8_; + GeeTreeSetNode* _tmp9_; + GeeTreeSetNode* _tmp10_; + GeeTreeSetNode* _tmp11_; + g_return_if_fail (self != NULL); + g_return_if_fail (*root != NULL); + _tmp0_ = *root; + _tmp1_ = _tmp0_->left; + _tmp0_->left = NULL; + pivot = _tmp1_; + _tmp2_ = pivot; + _tmp3_ = *root; + _tmp4_ = _tmp3_->color; + _tmp2_->color = _tmp4_; + _tmp5_ = *root; + _tmp5_->color = GEE_TREE_SET_NODE_COLOR_RED; + _tmp6_ = *root; + _tmp7_ = pivot; + _tmp8_ = _tmp7_->right; + _tmp7_->right = NULL; + _gee_tree_set_node_free0 (_tmp6_->left); + _tmp6_->left = _tmp8_; + _tmp9_ = pivot; + _tmp10_ = *root; + *root = NULL; + _gee_tree_set_node_free0 (_tmp9_->right); + _tmp9_->right = _tmp10_; + _tmp11_ = pivot; + pivot = NULL; + _gee_tree_set_node_free0 (*root); + *root = _tmp11_; + _gee_tree_set_node_free0 (pivot); +} + + +static inline void gee_tree_set_rotate_left (GeeTreeSet* self, GeeTreeSetNode** root) { + GeeTreeSetNode* _tmp0_; + GeeTreeSetNode* _tmp1_; + GeeTreeSetNode* pivot; + GeeTreeSetNode* _tmp2_; + GeeTreeSetNode* _tmp3_; + GeeTreeSetNodeColor _tmp4_; + GeeTreeSetNode* _tmp5_; + GeeTreeSetNode* _tmp6_; + GeeTreeSetNode* _tmp7_; + GeeTreeSetNode* _tmp8_; + GeeTreeSetNode* _tmp9_; + GeeTreeSetNode* _tmp10_; + GeeTreeSetNode* _tmp11_; + g_return_if_fail (self != NULL); + g_return_if_fail (*root != NULL); + _tmp0_ = *root; + _tmp1_ = _tmp0_->right; + _tmp0_->right = NULL; + pivot = _tmp1_; + _tmp2_ = pivot; + _tmp3_ = *root; + _tmp4_ = _tmp3_->color; + _tmp2_->color = _tmp4_; + _tmp5_ = *root; + _tmp5_->color = GEE_TREE_SET_NODE_COLOR_RED; + _tmp6_ = *root; + _tmp7_ = pivot; + _tmp8_ = _tmp7_->left; + _tmp7_->left = NULL; + _gee_tree_set_node_free0 (_tmp6_->right); + _tmp6_->right = _tmp8_; + _tmp9_ = pivot; + _tmp10_ = *root; + *root = NULL; + _gee_tree_set_node_free0 (_tmp9_->left); + _tmp9_->left = _tmp10_; + _tmp11_ = pivot; + pivot = NULL; + _gee_tree_set_node_free0 (*root); + *root = _tmp11_; + _gee_tree_set_node_free0 (pivot); +} + + +static inline gboolean gee_tree_set_is_red (GeeTreeSet* self, GeeTreeSetNode* n) { + gboolean result = FALSE; + gboolean _tmp0_ = FALSE; + GeeTreeSetNode* _tmp1_; + gboolean _tmp4_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp1_ = n; + if (_tmp1_ != NULL) { + GeeTreeSetNode* _tmp2_; + GeeTreeSetNodeColor _tmp3_; + _tmp2_ = n; + _tmp3_ = _tmp2_->color; + _tmp0_ = _tmp3_ == GEE_TREE_SET_NODE_COLOR_RED; + } else { + _tmp0_ = FALSE; + } + _tmp4_ = _tmp0_; + result = _tmp4_; + return result; +} + + +static inline gboolean gee_tree_set_is_black (GeeTreeSet* self, GeeTreeSetNode* n) { + gboolean result = FALSE; + gboolean _tmp0_ = FALSE; + GeeTreeSetNode* _tmp1_; + gboolean _tmp4_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp1_ = n; + if (_tmp1_ == NULL) { + _tmp0_ = TRUE; + } else { + GeeTreeSetNode* _tmp2_; + GeeTreeSetNodeColor _tmp3_; + _tmp2_ = n; + _tmp3_ = _tmp2_->color; + _tmp0_ = _tmp3_ == GEE_TREE_SET_NODE_COLOR_BLACK; + } + _tmp4_ = _tmp0_; + result = _tmp4_; + return result; +} + + +static inline void gee_tree_set_fix_up (GeeTreeSet* self, GeeTreeSetNode** node) { + gboolean _tmp0_ = FALSE; + GeeTreeSetNode* _tmp1_; + GeeTreeSetNode* _tmp2_; + gboolean _tmp3_ = FALSE; + gboolean _tmp7_; + gboolean _tmp8_ = FALSE; + GeeTreeSetNode* _tmp9_; + GeeTreeSetNode* _tmp10_; + gboolean _tmp11_ = FALSE; + gboolean _tmp16_; + gboolean _tmp17_ = FALSE; + GeeTreeSetNode* _tmp18_; + GeeTreeSetNode* _tmp19_; + gboolean _tmp20_ = FALSE; + gboolean _tmp24_; + g_return_if_fail (self != NULL); + g_return_if_fail (*node != NULL); + _tmp1_ = *node; + _tmp2_ = _tmp1_->left; + _tmp3_ = gee_tree_set_is_black (self, _tmp2_); + if (_tmp3_) { + GeeTreeSetNode* _tmp4_; + GeeTreeSetNode* _tmp5_; + gboolean _tmp6_ = FALSE; + _tmp4_ = *node; + _tmp5_ = _tmp4_->right; + _tmp6_ = gee_tree_set_is_red (self, _tmp5_); + _tmp0_ = _tmp6_; + } else { + _tmp0_ = FALSE; + } + _tmp7_ = _tmp0_; + if (_tmp7_) { + gee_tree_set_rotate_left (self, node); + } + _tmp9_ = *node; + _tmp10_ = _tmp9_->left; + _tmp11_ = gee_tree_set_is_red (self, _tmp10_); + if (_tmp11_) { + GeeTreeSetNode* _tmp12_; + GeeTreeSetNode* _tmp13_; + GeeTreeSetNode* _tmp14_; + gboolean _tmp15_ = FALSE; + _tmp12_ = *node; + _tmp13_ = _tmp12_->left; + _tmp14_ = _tmp13_->left; + _tmp15_ = gee_tree_set_is_red (self, _tmp14_); + _tmp8_ = _tmp15_; + } else { + _tmp8_ = FALSE; + } + _tmp16_ = _tmp8_; + if (_tmp16_) { + gee_tree_set_rotate_right (self, node); + } + _tmp18_ = *node; + _tmp19_ = _tmp18_->left; + _tmp20_ = gee_tree_set_is_red (self, _tmp19_); + if (_tmp20_) { + GeeTreeSetNode* _tmp21_; + GeeTreeSetNode* _tmp22_; + gboolean _tmp23_ = FALSE; + _tmp21_ = *node; + _tmp22_ = _tmp21_->right; + _tmp23_ = gee_tree_set_is_red (self, _tmp22_); + _tmp17_ = _tmp23_; + } else { + _tmp17_ = FALSE; + } + _tmp24_ = _tmp17_; + if (_tmp24_) { + GeeTreeSetNode* _tmp25_; + _tmp25_ = *node; + gee_tree_set_node_flip (_tmp25_); + } +} + + +static gboolean gee_tree_set_add_to_node (GeeTreeSet* self, GeeTreeSetNode** node, gpointer item, GeeTreeSetNode* prev, GeeTreeSetNode* next) { + gboolean result = FALSE; + GeeTreeSetNode* _tmp0_; + GCompareFunc _tmp10_; + GCompareFunc _tmp11_; + gconstpointer _tmp12_; + GeeTreeSetNode* _tmp13_; + gconstpointer _tmp14_; + gint _tmp15_ = 0; + gint cmp; + gint _tmp16_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = *node; + if (_tmp0_ == NULL) { + gpointer _tmp1_; + GeeTreeSetNode* _tmp2_; + GeeTreeSetNode* _tmp3_; + GeeTreeSetNode* _tmp4_; + GeeTreeSetNode* _tmp5_; + GeeTreeSetNode* _tmp7_; + gint _tmp9_; + _tmp1_ = item; + item = NULL; + _tmp2_ = prev; + _tmp3_ = next; + _tmp4_ = gee_tree_set_node_new (_tmp1_, _tmp2_, _tmp3_); + _gee_tree_set_node_free0 (*node); + *node = _tmp4_; + _tmp5_ = prev; + if (_tmp5_ == NULL) { + GeeTreeSetNode* _tmp6_; + _tmp6_ = *node; + self->priv->_first = _tmp6_; + } + _tmp7_ = next; + if (_tmp7_ == NULL) { + GeeTreeSetNode* _tmp8_; + _tmp8_ = *node; + self->priv->_last = _tmp8_; + } + _tmp9_ = self->priv->_size; + self->priv->_size = _tmp9_ + 1; + result = TRUE; + ((item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (item = (self->priv->g_destroy_func (item), NULL)); + return result; + } + _tmp10_ = gee_tree_set_get_compare_func (self); + _tmp11_ = _tmp10_; + _tmp12_ = item; + _tmp13_ = *node; + _tmp14_ = _tmp13_->key; + _tmp15_ = _tmp11_ (_tmp12_, _tmp14_); + cmp = _tmp15_; + _tmp16_ = cmp; + if (_tmp16_ == 0) { + gee_tree_set_fix_up (self, node); + result = FALSE; + ((item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (item = (self->priv->g_destroy_func (item), NULL)); + return result; + } else { + gint _tmp17_; + _tmp17_ = cmp; + if (_tmp17_ < 0) { + GeeTreeSetNode* _tmp18_; + gconstpointer _tmp19_; + gpointer _tmp20_; + GeeTreeSetNode* _tmp21_; + GeeTreeSetNode* _tmp22_; + GeeTreeSetNode* _tmp23_; + gboolean _tmp24_ = FALSE; + gboolean r; + _tmp18_ = *node; + _tmp19_ = item; + _tmp20_ = ((_tmp19_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp19_) : ((gpointer) _tmp19_); + _tmp21_ = *node; + _tmp22_ = _tmp21_->prev; + _tmp23_ = *node; + _tmp24_ = gee_tree_set_add_to_node (self, &_tmp18_->left, _tmp20_, _tmp22_, _tmp23_); + r = _tmp24_; + gee_tree_set_fix_up (self, node); + result = r; + ((item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (item = (self->priv->g_destroy_func (item), NULL)); + return result; + } else { + GeeTreeSetNode* _tmp25_; + gconstpointer _tmp26_; + gpointer _tmp27_; + GeeTreeSetNode* _tmp28_; + GeeTreeSetNode* _tmp29_; + GeeTreeSetNode* _tmp30_; + gboolean _tmp31_ = FALSE; + gboolean r; + _tmp25_ = *node; + _tmp26_ = item; + _tmp27_ = ((_tmp26_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp26_) : ((gpointer) _tmp26_); + _tmp28_ = *node; + _tmp29_ = *node; + _tmp30_ = _tmp29_->next; + _tmp31_ = gee_tree_set_add_to_node (self, &_tmp25_->right, _tmp27_, _tmp28_, _tmp30_); + r = _tmp31_; + gee_tree_set_fix_up (self, node); + result = r; + ((item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (item = (self->priv->g_destroy_func (item), NULL)); + return result; + } + } + ((item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (item = (self->priv->g_destroy_func (item), NULL)); +} + + +/** + * {@inheritDoc} + * + * If the element already exists in the set it will not be added twice. + */ +static gboolean gee_tree_set_real_add (GeeAbstractCollection* base, gconstpointer item) { + GeeTreeSet * self; + gboolean result = FALSE; + gconstpointer _tmp0_; + gpointer _tmp1_; + gboolean _tmp2_ = FALSE; + gboolean r; + GeeTreeSetNode* _tmp3_; + gint _tmp4_; + self = (GeeTreeSet*) base; + _tmp0_ = item; + _tmp1_ = ((_tmp0_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp0_) : ((gpointer) _tmp0_); + _tmp2_ = gee_tree_set_add_to_node (self, &self->priv->root, _tmp1_, NULL, NULL); + r = _tmp2_; + _tmp3_ = self->priv->root; + _tmp3_->color = GEE_TREE_SET_NODE_COLOR_BLACK; + _tmp4_ = self->priv->stamp; + self->priv->stamp = _tmp4_ + 1; + result = r; + return result; +} + + +static inline void gee_tree_set_move_red_left (GeeTreeSet* self, GeeTreeSetNode** root) { + GeeTreeSetNode* _tmp0_; + GeeTreeSetNode* _tmp1_; + GeeTreeSetNode* _tmp2_; + GeeTreeSetNode* _tmp3_; + gboolean _tmp4_ = FALSE; + g_return_if_fail (self != NULL); + g_return_if_fail (*root != NULL); + _tmp0_ = *root; + gee_tree_set_node_flip (_tmp0_); + _tmp1_ = *root; + _tmp2_ = _tmp1_->right; + _tmp3_ = _tmp2_->left; + _tmp4_ = gee_tree_set_is_red (self, _tmp3_); + if (_tmp4_) { + GeeTreeSetNode* _tmp5_; + GeeTreeSetNode* _tmp6_; + _tmp5_ = *root; + gee_tree_set_rotate_right (self, &_tmp5_->right); + gee_tree_set_rotate_left (self, root); + _tmp6_ = *root; + gee_tree_set_node_flip (_tmp6_); + } +} + + +static inline void gee_tree_set_move_red_right (GeeTreeSet* self, GeeTreeSetNode** root) { + GeeTreeSetNode* _tmp0_; + GeeTreeSetNode* _tmp1_; + GeeTreeSetNode* _tmp2_; + GeeTreeSetNode* _tmp3_; + gboolean _tmp4_ = FALSE; + g_return_if_fail (self != NULL); + g_return_if_fail (*root != NULL); + _tmp0_ = *root; + gee_tree_set_node_flip (_tmp0_); + _tmp1_ = *root; + _tmp2_ = _tmp1_->left; + _tmp3_ = _tmp2_->left; + _tmp4_ = gee_tree_set_is_red (self, _tmp3_); + if (_tmp4_) { + GeeTreeSetNode* _tmp5_; + gee_tree_set_rotate_right (self, root); + _tmp5_ = *root; + gee_tree_set_node_flip (_tmp5_); + } +} + + +static inline void gee_tree_set_fix_removal (GeeTreeSet* self, GeeTreeSetNode** node, gpointer* key) { + gpointer _vala_key = NULL; + GeeTreeSetNode* _tmp0_; + GeeTreeSetNode* n; + GeeTreeSetNode* _tmp4_; + GeeTreeSetNode* _tmp5_; + GeeTreeSetNode* _tmp12_; + GeeTreeSetNode* _tmp13_; + gint _tmp20_; + g_return_if_fail (self != NULL); + g_return_if_fail (*node != NULL); + _tmp0_ = *node; + *node = NULL; + n = _tmp0_; + if ((&_vala_key) != NULL) { + GeeTreeSetNode* _tmp1_; + gpointer _tmp2_; + _tmp1_ = n; + _tmp2_ = _tmp1_->key; + _tmp1_->key = NULL; + ((_vala_key == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_vala_key = (self->priv->g_destroy_func (_vala_key), NULL)); + _vala_key = _tmp2_; + } else { + GeeTreeSetNode* _tmp3_; + _tmp3_ = n; + ((_tmp3_->key == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp3_->key = (self->priv->g_destroy_func (_tmp3_->key), NULL)); + _tmp3_->key = NULL; + } + _tmp4_ = n; + _tmp5_ = _tmp4_->prev; + if (_tmp5_ != NULL) { + GeeTreeSetNode* _tmp6_; + GeeTreeSetNode* _tmp7_; + GeeTreeSetNode* _tmp8_; + GeeTreeSetNode* _tmp9_; + _tmp6_ = n; + _tmp7_ = _tmp6_->prev; + _tmp8_ = n; + _tmp9_ = _tmp8_->next; + _tmp7_->next = _tmp9_; + } else { + GeeTreeSetNode* _tmp10_; + GeeTreeSetNode* _tmp11_; + _tmp10_ = n; + _tmp11_ = _tmp10_->next; + self->priv->_first = _tmp11_; + } + _tmp12_ = n; + _tmp13_ = _tmp12_->next; + if (_tmp13_ != NULL) { + GeeTreeSetNode* _tmp14_; + GeeTreeSetNode* _tmp15_; + GeeTreeSetNode* _tmp16_; + GeeTreeSetNode* _tmp17_; + _tmp14_ = n; + _tmp15_ = _tmp14_->next; + _tmp16_ = n; + _tmp17_ = _tmp16_->prev; + _tmp15_->prev = _tmp17_; + } else { + GeeTreeSetNode* _tmp18_; + GeeTreeSetNode* _tmp19_; + _tmp18_ = n; + _tmp19_ = _tmp18_->prev; + self->priv->_last = _tmp19_; + } + _gee_tree_set_node_free0 (*node); + *node = NULL; + _tmp20_ = self->priv->_size; + self->priv->_size = _tmp20_ - 1; + _gee_tree_set_node_free0 (n); + if (key) { + *key = _vala_key; + } else { + ((_vala_key == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_vala_key = (self->priv->g_destroy_func (_vala_key), NULL)); + } +} + + +static void gee_tree_set_remove_minimal (GeeTreeSet* self, GeeTreeSetNode** node, gpointer* key) { + gpointer _vala_key = NULL; + GeeTreeSetNode* _tmp0_; + GeeTreeSetNode* _tmp1_; + gboolean _tmp3_ = FALSE; + GeeTreeSetNode* _tmp4_; + GeeTreeSetNode* _tmp5_; + gboolean _tmp6_ = FALSE; + gboolean _tmp11_; + GeeTreeSetNode* _tmp12_; + gpointer _tmp13_ = NULL; + g_return_if_fail (self != NULL); + g_return_if_fail (*node != NULL); + _tmp0_ = *node; + _tmp1_ = _tmp0_->left; + if (_tmp1_ == NULL) { + gpointer _tmp2_ = NULL; + gee_tree_set_fix_removal (self, node, &_tmp2_); + ((_vala_key == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_vala_key = (self->priv->g_destroy_func (_vala_key), NULL)); + _vala_key = _tmp2_; + if (key) { + *key = _vala_key; + } else { + ((_vala_key == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_vala_key = (self->priv->g_destroy_func (_vala_key), NULL)); + } + return; + } + _tmp4_ = *node; + _tmp5_ = _tmp4_->left; + _tmp6_ = gee_tree_set_is_black (self, _tmp5_); + if (_tmp6_) { + GeeTreeSetNode* _tmp7_; + GeeTreeSetNode* _tmp8_; + GeeTreeSetNode* _tmp9_; + gboolean _tmp10_ = FALSE; + _tmp7_ = *node; + _tmp8_ = _tmp7_->left; + _tmp9_ = _tmp8_->left; + _tmp10_ = gee_tree_set_is_black (self, _tmp9_); + _tmp3_ = _tmp10_; + } else { + _tmp3_ = FALSE; + } + _tmp11_ = _tmp3_; + if (_tmp11_) { + gee_tree_set_move_red_left (self, node); + } + _tmp12_ = *node; + gee_tree_set_remove_minimal (self, &_tmp12_->left, &_tmp13_); + ((_vala_key == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_vala_key = (self->priv->g_destroy_func (_vala_key), NULL)); + _vala_key = _tmp13_; + gee_tree_set_fix_up (self, node); + if (key) { + *key = _vala_key; + } else { + ((_vala_key == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_vala_key = (self->priv->g_destroy_func (_vala_key), NULL)); + } +} + + +static gboolean gee_tree_set_remove_from_node (GeeTreeSet* self, GeeTreeSetNode** node, gconstpointer item, GeeTreeSetNode** prev, GeeTreeSetNode** next) { + GeeTreeSetNode* _vala_prev = NULL; + GeeTreeSetNode* _vala_next = NULL; + gboolean result = FALSE; + GeeTreeSetNode* _tmp0_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = *node; + if (_tmp0_ == NULL) { + result = FALSE; + if (prev) { + *prev = _vala_prev; + } + if (next) { + *next = _vala_next; + } + return result; + } else { + GCompareFunc _tmp1_; + GCompareFunc _tmp2_; + gconstpointer _tmp3_; + GeeTreeSetNode* _tmp4_; + gconstpointer _tmp5_; + gint _tmp6_ = 0; + _tmp1_ = gee_tree_set_get_compare_func (self); + _tmp2_ = _tmp1_; + _tmp3_ = item; + _tmp4_ = *node; + _tmp5_ = _tmp4_->key; + _tmp6_ = _tmp2_ (_tmp3_, _tmp5_); + if (_tmp6_ < 0) { + GeeTreeSetNode* _tmp7_; + GeeTreeSetNode* _tmp8_; + GeeTreeSetNode* left; + GeeTreeSetNode* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeTreeSetNode* _tmp11_; + gboolean _tmp12_ = FALSE; + gboolean _tmp16_; + GeeTreeSetNode* _tmp17_; + gconstpointer _tmp18_; + GeeTreeSetNode* _tmp19_ = NULL; + GeeTreeSetNode* _tmp20_ = NULL; + gboolean _tmp21_ = FALSE; + gboolean r; + _tmp7_ = *node; + _tmp8_ = _tmp7_->left; + left = _tmp8_; + _tmp9_ = left; + if (_tmp9_ == NULL) { + result = FALSE; + if (prev) { + *prev = _vala_prev; + } + if (next) { + *next = _vala_next; + } + return result; + } + _tmp11_ = left; + _tmp12_ = gee_tree_set_is_black (self, _tmp11_); + if (_tmp12_) { + GeeTreeSetNode* _tmp13_; + GeeTreeSetNode* _tmp14_; + gboolean _tmp15_ = FALSE; + _tmp13_ = left; + _tmp14_ = _tmp13_->left; + _tmp15_ = gee_tree_set_is_black (self, _tmp14_); + _tmp10_ = _tmp15_; + } else { + _tmp10_ = FALSE; + } + _tmp16_ = _tmp10_; + if (_tmp16_) { + gee_tree_set_move_red_left (self, node); + } + _tmp17_ = *node; + _tmp18_ = item; + _tmp21_ = gee_tree_set_remove_from_node (self, &_tmp17_->left, _tmp18_, &_tmp19_, &_tmp20_); + _vala_prev = _tmp19_; + _vala_next = _tmp20_; + r = _tmp21_; + gee_tree_set_fix_up (self, node); + result = r; + if (prev) { + *prev = _vala_prev; + } + if (next) { + *next = _vala_next; + } + return result; + } else { + GeeTreeSetNode* _tmp22_; + GeeTreeSetNode* _tmp23_; + gboolean _tmp24_ = FALSE; + GeeTreeSetNode* _tmp25_; + GeeTreeSetNode* _tmp26_; + GeeTreeSetNode* r; + gboolean _tmp27_ = FALSE; + GCompareFunc _tmp28_; + GCompareFunc _tmp29_; + gconstpointer _tmp30_; + GeeTreeSetNode* _tmp31_; + gconstpointer _tmp32_; + gint _tmp33_ = 0; + gboolean _tmp35_; + gboolean _tmp40_ = FALSE; + gboolean _tmp41_ = FALSE; + GeeTreeSetNode* _tmp42_; + gboolean _tmp43_ = FALSE; + gboolean _tmp45_; + gboolean _tmp49_; + GCompareFunc _tmp50_; + GCompareFunc _tmp51_; + gconstpointer _tmp52_; + GeeTreeSetNode* _tmp53_; + gconstpointer _tmp54_; + gint _tmp55_ = 0; + _tmp22_ = *node; + _tmp23_ = _tmp22_->left; + _tmp24_ = gee_tree_set_is_red (self, _tmp23_); + if (_tmp24_) { + gee_tree_set_rotate_right (self, node); + } + _tmp25_ = *node; + _tmp26_ = _tmp25_->right; + r = _tmp26_; + _tmp28_ = gee_tree_set_get_compare_func (self); + _tmp29_ = _tmp28_; + _tmp30_ = item; + _tmp31_ = *node; + _tmp32_ = _tmp31_->key; + _tmp33_ = _tmp29_ (_tmp30_, _tmp32_); + if (_tmp33_ == 0) { + GeeTreeSetNode* _tmp34_; + _tmp34_ = r; + _tmp27_ = _tmp34_ == NULL; + } else { + _tmp27_ = FALSE; + } + _tmp35_ = _tmp27_; + if (_tmp35_) { + if ((&_vala_prev) != NULL) { + GeeTreeSetNode* _tmp36_; + GeeTreeSetNode* _tmp37_; + _tmp36_ = *node; + _tmp37_ = _tmp36_->prev; + _vala_prev = _tmp37_; + } + if ((&_vala_next) != NULL) { + GeeTreeSetNode* _tmp38_; + GeeTreeSetNode* _tmp39_; + _tmp38_ = *node; + _tmp39_ = _tmp38_->next; + _vala_next = _tmp39_; + } + gee_tree_set_fix_removal (self, node, NULL); + result = TRUE; + if (prev) { + *prev = _vala_prev; + } + if (next) { + *next = _vala_next; + } + return result; + } + _tmp42_ = r; + _tmp43_ = gee_tree_set_is_black (self, _tmp42_); + if (_tmp43_) { + GeeTreeSetNode* _tmp44_; + _tmp44_ = r; + _tmp41_ = _tmp44_ != NULL; + } else { + _tmp41_ = FALSE; + } + _tmp45_ = _tmp41_; + if (_tmp45_) { + GeeTreeSetNode* _tmp46_; + GeeTreeSetNode* _tmp47_; + gboolean _tmp48_ = FALSE; + _tmp46_ = r; + _tmp47_ = _tmp46_->left; + _tmp48_ = gee_tree_set_is_black (self, _tmp47_); + _tmp40_ = _tmp48_; + } else { + _tmp40_ = FALSE; + } + _tmp49_ = _tmp40_; + if (_tmp49_) { + gee_tree_set_move_red_right (self, node); + } + _tmp50_ = gee_tree_set_get_compare_func (self); + _tmp51_ = _tmp50_; + _tmp52_ = item; + _tmp53_ = *node; + _tmp54_ = _tmp53_->key; + _tmp55_ = _tmp51_ (_tmp52_, _tmp54_); + if (_tmp55_ == 0) { + GeeTreeSetNode* _tmp59_; + GeeTreeSetNode* _tmp60_; + gpointer _tmp61_ = NULL; + if ((&_vala_prev) != NULL) { + GeeTreeSetNode* _tmp56_; + GeeTreeSetNode* _tmp57_; + _tmp56_ = *node; + _tmp57_ = _tmp56_->prev; + _vala_prev = _tmp57_; + } + if ((&_vala_next) != NULL) { + GeeTreeSetNode* _tmp58_; + _tmp58_ = *node; + _vala_next = _tmp58_; + } + _tmp59_ = *node; + _tmp60_ = *node; + gee_tree_set_remove_minimal (self, &_tmp59_->right, &_tmp61_); + ((_tmp60_->key == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp60_->key = (self->priv->g_destroy_func (_tmp60_->key), NULL)); + _tmp60_->key = _tmp61_; + gee_tree_set_fix_up (self, node); + result = TRUE; + if (prev) { + *prev = _vala_prev; + } + if (next) { + *next = _vala_next; + } + return result; + } else { + GeeTreeSetNode* _tmp62_; + gconstpointer _tmp63_; + GeeTreeSetNode* _tmp64_ = NULL; + GeeTreeSetNode* _tmp65_ = NULL; + gboolean _tmp66_ = FALSE; + gboolean re; + _tmp62_ = *node; + _tmp63_ = item; + _tmp66_ = gee_tree_set_remove_from_node (self, &_tmp62_->right, _tmp63_, &_tmp64_, &_tmp65_); + _vala_prev = _tmp64_; + _vala_next = _tmp65_; + re = _tmp66_; + gee_tree_set_fix_up (self, node); + result = re; + if (prev) { + *prev = _vala_prev; + } + if (next) { + *next = _vala_next; + } + return result; + } + } + } + if (prev) { + *prev = _vala_prev; + } + if (next) { + *next = _vala_next; + } +} + + +/** + * {@inheritDoc} + */ +static gboolean gee_tree_set_real_remove (GeeAbstractCollection* base, gconstpointer item) { + GeeTreeSet * self; + gboolean result = FALSE; + gconstpointer _tmp0_; + gboolean _tmp1_ = FALSE; + gboolean b; + GeeTreeSetNode* _tmp2_; + gint _tmp4_; + self = (GeeTreeSet*) base; + _tmp0_ = item; + _tmp1_ = gee_tree_set_remove_from_node (self, &self->priv->root, _tmp0_, NULL, NULL); + b = _tmp1_; + _tmp2_ = self->priv->root; + if (_tmp2_ != NULL) { + GeeTreeSetNode* _tmp3_; + _tmp3_ = self->priv->root; + _tmp3_->color = GEE_TREE_SET_NODE_COLOR_BLACK; + } + _tmp4_ = self->priv->stamp; + self->priv->stamp = _tmp4_ + 1; + result = b; + return result; +} + + +static inline void gee_tree_set_clear_subtree (GeeTreeSet* self, GeeTreeSetNode* node) { + GeeTreeSetNode* _tmp0_; + GeeTreeSetNode* _tmp1_; + GeeTreeSetNode* _tmp2_; + GeeTreeSetNode* _tmp5_; + GeeTreeSetNode* _tmp6_; + g_return_if_fail (self != NULL); + g_return_if_fail (node != NULL); + _tmp0_ = node; + ((_tmp0_->key == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp0_->key = (self->priv->g_destroy_func (_tmp0_->key), NULL)); + _tmp0_->key = NULL; + _tmp1_ = node; + _tmp2_ = _tmp1_->left; + if (_tmp2_ != NULL) { + GeeTreeSetNode* _tmp3_; + GeeTreeSetNode* _tmp4_; + _tmp3_ = node; + _tmp4_ = _tmp3_->left; + _tmp3_->left = NULL; + gee_tree_set_clear_subtree (self, _tmp4_); + } + _tmp5_ = node; + _tmp6_ = _tmp5_->right; + if (_tmp6_ != NULL) { + GeeTreeSetNode* _tmp7_; + GeeTreeSetNode* _tmp8_; + _tmp7_ = node; + _tmp8_ = _tmp7_->right; + _tmp7_->right = NULL; + gee_tree_set_clear_subtree (self, _tmp8_); + } + _gee_tree_set_node_free0 (node); +} + + +/** + * {@inheritDoc} + */ +static void gee_tree_set_real_clear (GeeAbstractCollection* base) { + GeeTreeSet * self; + GeeTreeSetNode* _tmp0_; + gint _tmp3_; + self = (GeeTreeSet*) base; + _tmp0_ = self->priv->root; + if (_tmp0_ != NULL) { + GeeTreeSetNode* _tmp1_; + GeeTreeSetNode* _tmp2_; + _tmp1_ = self->priv->root; + self->priv->root = NULL; + gee_tree_set_clear_subtree (self, _tmp1_); + self->priv->_last = NULL; + _tmp2_ = self->priv->_last; + self->priv->_first = _tmp2_; + } + self->priv->_size = 0; + _tmp3_ = self->priv->stamp; + self->priv->stamp = _tmp3_ + 1; +} + + +/** + * {@inheritDoc} + */ +static GeeIterator* gee_tree_set_real_iterator (GeeAbstractCollection* base) { + GeeTreeSet * self; + GeeIterator* result = NULL; + GeeTreeSetIterator* _tmp0_; + self = (GeeTreeSet*) base; + _tmp0_ = gee_tree_set_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, self); + result = (GeeIterator*) _tmp0_; + return result; +} + + +/** + * {@inheritDoc} + */ +static GeeBidirIterator* gee_tree_set_real_bidir_iterator (GeeSortedSet* base) { + GeeTreeSet * self; + GeeBidirIterator* result = NULL; + GeeTreeSetIterator* _tmp0_; + self = (GeeTreeSet*) base; + _tmp0_ = gee_tree_set_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, self); + result = (GeeBidirIterator*) _tmp0_; + return result; +} + + +static inline gpointer gee_tree_set_lift_null_get (GeeTreeSet* self, GeeTreeSetNode* node) { + gpointer result = NULL; + gconstpointer _tmp0_ = NULL; + GeeTreeSetNode* _tmp1_; + gconstpointer _tmp4_; + gpointer _tmp5_; + g_return_val_if_fail (self != NULL, NULL); + _tmp1_ = node; + if (_tmp1_ != NULL) { + GeeTreeSetNode* _tmp2_; + gconstpointer _tmp3_; + _tmp2_ = node; + _tmp3_ = _tmp2_->key; + _tmp0_ = _tmp3_; + } else { + _tmp0_ = NULL; + } + _tmp4_ = _tmp0_; + _tmp5_ = ((_tmp4_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp4_) : ((gpointer) _tmp4_); + result = _tmp5_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_tree_set_real_first (GeeSortedSet* base) { + GeeTreeSet * self; + gpointer result = NULL; + GeeTreeSetNode* _tmp0_; + GeeTreeSetNode* _tmp1_; + gconstpointer _tmp2_; + gpointer _tmp3_; + self = (GeeTreeSet*) base; + _tmp0_ = self->priv->_first; + _vala_assert (_tmp0_ != NULL, "_first != null"); + _tmp1_ = self->priv->_first; + _tmp2_ = _tmp1_->key; + _tmp3_ = ((_tmp2_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp2_) : ((gpointer) _tmp2_); + result = _tmp3_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_tree_set_real_last (GeeSortedSet* base) { + GeeTreeSet * self; + gpointer result = NULL; + GeeTreeSetNode* _tmp0_; + GeeTreeSetNode* _tmp1_; + gconstpointer _tmp2_; + gpointer _tmp3_; + self = (GeeTreeSet*) base; + _tmp0_ = self->priv->_last; + _vala_assert (_tmp0_ != NULL, "_last != null"); + _tmp1_ = self->priv->_last; + _tmp2_ = _tmp1_->key; + _tmp3_ = ((_tmp2_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp2_) : ((gpointer) _tmp2_); + result = _tmp3_; + return result; +} + + +/** + * {@inheritDoc} + */ +static GeeSortedSet* gee_tree_set_real_head_set (GeeSortedSet* base, gconstpointer before) { + GeeTreeSet * self; + GeeSortedSet* result = NULL; + gconstpointer _tmp0_; + GeeTreeSetSubSet* _tmp1_; + self = (GeeTreeSet*) base; + _tmp0_ = before; + _tmp1_ = gee_tree_set_sub_set_new_head (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, self, _tmp0_); + result = (GeeSortedSet*) _tmp1_; + return result; +} + + +/** + * {@inheritDoc} + */ +static GeeSortedSet* gee_tree_set_real_tail_set (GeeSortedSet* base, gconstpointer after) { + GeeTreeSet * self; + GeeSortedSet* result = NULL; + gconstpointer _tmp0_; + GeeTreeSetSubSet* _tmp1_; + self = (GeeTreeSet*) base; + _tmp0_ = after; + _tmp1_ = gee_tree_set_sub_set_new_tail (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, self, _tmp0_); + result = (GeeSortedSet*) _tmp1_; + return result; +} + + +/** + * {@inheritDoc} + */ +static GeeSortedSet* gee_tree_set_real_sub_set (GeeSortedSet* base, gconstpointer after, gconstpointer before) { + GeeTreeSet * self; + GeeSortedSet* result = NULL; + gconstpointer _tmp0_; + gconstpointer _tmp1_; + GeeTreeSetSubSet* _tmp2_; + self = (GeeTreeSet*) base; + _tmp0_ = after; + _tmp1_ = before; + _tmp2_ = gee_tree_set_sub_set_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, self, _tmp0_, _tmp1_); + result = (GeeSortedSet*) _tmp2_; + return result; +} + + +static inline GeeTreeSetNode* gee_tree_set_find_node (GeeTreeSet* self, gconstpointer item) { + GeeTreeSetNode* result = NULL; + GeeTreeSetNode* _tmp0_; + GeeTreeSetNode* cur; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->root; + cur = _tmp0_; + while (TRUE) { + GeeTreeSetNode* _tmp1_; + GCompareFunc _tmp2_; + GCompareFunc _tmp3_; + gconstpointer _tmp4_; + GeeTreeSetNode* _tmp5_; + gconstpointer _tmp6_; + gint _tmp7_ = 0; + gint res; + gint _tmp8_; + _tmp1_ = cur; + if (!(_tmp1_ != NULL)) { + break; + } + _tmp2_ = gee_tree_set_get_compare_func (self); + _tmp3_ = _tmp2_; + _tmp4_ = item; + _tmp5_ = cur; + _tmp6_ = _tmp5_->key; + _tmp7_ = _tmp3_ (_tmp4_, _tmp6_); + res = _tmp7_; + _tmp8_ = res; + if (_tmp8_ == 0) { + GeeTreeSetNode* _tmp9_; + _tmp9_ = cur; + result = _tmp9_; + return result; + } else { + gint _tmp10_; + _tmp10_ = res; + if (_tmp10_ < 0) { + GeeTreeSetNode* _tmp11_; + GeeTreeSetNode* _tmp12_; + _tmp11_ = cur; + _tmp12_ = _tmp11_->left; + cur = _tmp12_; + } else { + GeeTreeSetNode* _tmp13_; + GeeTreeSetNode* _tmp14_; + _tmp13_ = cur; + _tmp14_ = _tmp13_->right; + cur = _tmp14_; + } + } + } + result = NULL; + return result; +} + + +/** + * {@inheritDoc} + */ +static GeeBidirIterator* gee_tree_set_real_iterator_at (GeeSortedSet* base, gconstpointer item) { + GeeTreeSet * self; + GeeBidirIterator* result = NULL; + gconstpointer _tmp0_; + GeeTreeSetNode* _tmp1_ = NULL; + GeeTreeSetNode* node; + GeeTreeSetIterator* _tmp2_ = NULL; + GeeTreeSetNode* _tmp3_; + self = (GeeTreeSet*) base; + _tmp0_ = item; + _tmp1_ = gee_tree_set_find_node (self, _tmp0_); + node = _tmp1_; + _tmp3_ = node; + if (_tmp3_ != NULL) { + GeeTreeSetNode* _tmp4_; + GeeTreeSetIterator* _tmp5_; + _tmp4_ = node; + _tmp5_ = gee_tree_set_iterator_new_pointing (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, self, _tmp4_); + _g_object_unref0 (_tmp2_); + _tmp2_ = _tmp5_; + } else { + _g_object_unref0 (_tmp2_); + _tmp2_ = NULL; + } + result = (GeeBidirIterator*) _tmp2_; + return result; +} + + +static inline GeeTreeSetNode* gee_tree_set_find_nearest (GeeTreeSet* self, gconstpointer item) { + GeeTreeSetNode* result = NULL; + GeeTreeSetNode* _tmp0_; + GeeTreeSetNode* cur; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->root; + cur = _tmp0_; + while (TRUE) { + GeeTreeSetNode* _tmp1_; + GCompareFunc _tmp2_; + GCompareFunc _tmp3_; + gconstpointer _tmp4_; + GeeTreeSetNode* _tmp5_; + gconstpointer _tmp6_; + gint _tmp7_ = 0; + gint res; + gint _tmp8_; + _tmp1_ = cur; + if (!(_tmp1_ != NULL)) { + break; + } + _tmp2_ = gee_tree_set_get_compare_func (self); + _tmp3_ = _tmp2_; + _tmp4_ = item; + _tmp5_ = cur; + _tmp6_ = _tmp5_->key; + _tmp7_ = _tmp3_ (_tmp4_, _tmp6_); + res = _tmp7_; + _tmp8_ = res; + if (_tmp8_ == 0) { + GeeTreeSetNode* _tmp9_; + _tmp9_ = cur; + result = _tmp9_; + return result; + } else { + gint _tmp10_; + _tmp10_ = res; + if (_tmp10_ < 0) { + GeeTreeSetNode* _tmp11_; + GeeTreeSetNode* _tmp12_; + GeeTreeSetNode* _tmp14_; + GeeTreeSetNode* _tmp15_; + _tmp11_ = cur; + _tmp12_ = _tmp11_->left; + if (_tmp12_ == NULL) { + GeeTreeSetNode* _tmp13_; + _tmp13_ = cur; + result = _tmp13_; + return result; + } + _tmp14_ = cur; + _tmp15_ = _tmp14_->left; + cur = _tmp15_; + } else { + GeeTreeSetNode* _tmp16_; + GeeTreeSetNode* _tmp17_; + GeeTreeSetNode* _tmp19_; + GeeTreeSetNode* _tmp20_; + _tmp16_ = cur; + _tmp17_ = _tmp16_->right; + if (_tmp17_ == NULL) { + GeeTreeSetNode* _tmp18_; + _tmp18_ = cur; + result = _tmp18_; + return result; + } + _tmp19_ = cur; + _tmp20_ = _tmp19_->right; + cur = _tmp20_; + } + } + } + result = NULL; + return result; +} + + +static inline GeeTreeSetNode* gee_tree_set_find_lower (GeeTreeSet* self, gconstpointer item) { + GeeTreeSetNode* result = NULL; + gconstpointer _tmp0_; + GeeTreeSetNode* _tmp1_ = NULL; + GeeTreeSetNode* node; + GeeTreeSetNode* _tmp2_; + GeeTreeSetNode* _tmp3_ = NULL; + GCompareFunc _tmp4_; + GCompareFunc _tmp5_; + gconstpointer _tmp6_; + GeeTreeSetNode* _tmp7_; + gconstpointer _tmp8_; + gint _tmp9_ = 0; + GeeTreeSetNode* _tmp13_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = item; + _tmp1_ = gee_tree_set_find_nearest (self, _tmp0_); + node = _tmp1_; + _tmp2_ = node; + if (_tmp2_ == NULL) { + result = NULL; + return result; + } + _tmp4_ = gee_tree_set_get_compare_func (self); + _tmp5_ = _tmp4_; + _tmp6_ = item; + _tmp7_ = node; + _tmp8_ = _tmp7_->key; + _tmp9_ = _tmp5_ (_tmp6_, _tmp8_); + if (_tmp9_ <= 0) { + GeeTreeSetNode* _tmp10_; + GeeTreeSetNode* _tmp11_; + _tmp10_ = node; + _tmp11_ = _tmp10_->prev; + _tmp3_ = _tmp11_; + } else { + GeeTreeSetNode* _tmp12_; + _tmp12_ = node; + _tmp3_ = _tmp12_; + } + _tmp13_ = _tmp3_; + result = _tmp13_; + return result; +} + + +static inline GeeTreeSetNode* gee_tree_set_find_higher (GeeTreeSet* self, gconstpointer item) { + GeeTreeSetNode* result = NULL; + gconstpointer _tmp0_; + GeeTreeSetNode* _tmp1_ = NULL; + GeeTreeSetNode* node; + GeeTreeSetNode* _tmp2_; + GeeTreeSetNode* _tmp3_ = NULL; + GCompareFunc _tmp4_; + GCompareFunc _tmp5_; + gconstpointer _tmp6_; + GeeTreeSetNode* _tmp7_; + gconstpointer _tmp8_; + gint _tmp9_ = 0; + GeeTreeSetNode* _tmp13_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = item; + _tmp1_ = gee_tree_set_find_nearest (self, _tmp0_); + node = _tmp1_; + _tmp2_ = node; + if (_tmp2_ == NULL) { + result = NULL; + return result; + } + _tmp4_ = gee_tree_set_get_compare_func (self); + _tmp5_ = _tmp4_; + _tmp6_ = item; + _tmp7_ = node; + _tmp8_ = _tmp7_->key; + _tmp9_ = _tmp5_ (_tmp6_, _tmp8_); + if (_tmp9_ >= 0) { + GeeTreeSetNode* _tmp10_; + GeeTreeSetNode* _tmp11_; + _tmp10_ = node; + _tmp11_ = _tmp10_->next; + _tmp3_ = _tmp11_; + } else { + GeeTreeSetNode* _tmp12_; + _tmp12_ = node; + _tmp3_ = _tmp12_; + } + _tmp13_ = _tmp3_; + result = _tmp13_; + return result; +} + + +static inline GeeTreeSetNode* gee_tree_set_find_floor (GeeTreeSet* self, gconstpointer item) { + GeeTreeSetNode* result = NULL; + gconstpointer _tmp0_; + GeeTreeSetNode* _tmp1_ = NULL; + GeeTreeSetNode* node; + GeeTreeSetNode* _tmp2_; + GeeTreeSetNode* _tmp3_ = NULL; + GCompareFunc _tmp4_; + GCompareFunc _tmp5_; + gconstpointer _tmp6_; + GeeTreeSetNode* _tmp7_; + gconstpointer _tmp8_; + gint _tmp9_ = 0; + GeeTreeSetNode* _tmp13_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = item; + _tmp1_ = gee_tree_set_find_nearest (self, _tmp0_); + node = _tmp1_; + _tmp2_ = node; + if (_tmp2_ == NULL) { + result = NULL; + return result; + } + _tmp4_ = gee_tree_set_get_compare_func (self); + _tmp5_ = _tmp4_; + _tmp6_ = item; + _tmp7_ = node; + _tmp8_ = _tmp7_->key; + _tmp9_ = _tmp5_ (_tmp6_, _tmp8_); + if (_tmp9_ < 0) { + GeeTreeSetNode* _tmp10_; + GeeTreeSetNode* _tmp11_; + _tmp10_ = node; + _tmp11_ = _tmp10_->prev; + _tmp3_ = _tmp11_; + } else { + GeeTreeSetNode* _tmp12_; + _tmp12_ = node; + _tmp3_ = _tmp12_; + } + _tmp13_ = _tmp3_; + result = _tmp13_; + return result; +} + + +static inline GeeTreeSetNode* gee_tree_set_find_ceil (GeeTreeSet* self, gconstpointer item) { + GeeTreeSetNode* result = NULL; + gconstpointer _tmp0_; + GeeTreeSetNode* _tmp1_ = NULL; + GeeTreeSetNode* node; + GeeTreeSetNode* _tmp2_; + GeeTreeSetNode* _tmp3_ = NULL; + GCompareFunc _tmp4_; + GCompareFunc _tmp5_; + gconstpointer _tmp6_; + GeeTreeSetNode* _tmp7_; + gconstpointer _tmp8_; + gint _tmp9_ = 0; + GeeTreeSetNode* _tmp13_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = item; + _tmp1_ = gee_tree_set_find_nearest (self, _tmp0_); + node = _tmp1_; + _tmp2_ = node; + if (_tmp2_ == NULL) { + result = NULL; + return result; + } + _tmp4_ = gee_tree_set_get_compare_func (self); + _tmp5_ = _tmp4_; + _tmp6_ = item; + _tmp7_ = node; + _tmp8_ = _tmp7_->key; + _tmp9_ = _tmp5_ (_tmp6_, _tmp8_); + if (_tmp9_ > 0) { + GeeTreeSetNode* _tmp10_; + GeeTreeSetNode* _tmp11_; + _tmp10_ = node; + _tmp11_ = _tmp10_->next; + _tmp3_ = _tmp11_; + } else { + GeeTreeSetNode* _tmp12_; + _tmp12_ = node; + _tmp3_ = _tmp12_; + } + _tmp13_ = _tmp3_; + result = _tmp13_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_tree_set_real_lower (GeeSortedSet* base, gconstpointer item) { + GeeTreeSet * self; + gpointer result = NULL; + gconstpointer _tmp0_; + GeeTreeSetNode* _tmp1_ = NULL; + gpointer _tmp2_ = NULL; + self = (GeeTreeSet*) base; + _tmp0_ = item; + _tmp1_ = gee_tree_set_find_lower (self, _tmp0_); + _tmp2_ = gee_tree_set_lift_null_get (self, _tmp1_); + result = _tmp2_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_tree_set_real_higher (GeeSortedSet* base, gconstpointer item) { + GeeTreeSet * self; + gpointer result = NULL; + gconstpointer _tmp0_; + GeeTreeSetNode* _tmp1_ = NULL; + gpointer _tmp2_ = NULL; + self = (GeeTreeSet*) base; + _tmp0_ = item; + _tmp1_ = gee_tree_set_find_higher (self, _tmp0_); + _tmp2_ = gee_tree_set_lift_null_get (self, _tmp1_); + result = _tmp2_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_tree_set_real_floor (GeeSortedSet* base, gconstpointer item) { + GeeTreeSet * self; + gpointer result = NULL; + gconstpointer _tmp0_; + GeeTreeSetNode* _tmp1_ = NULL; + gpointer _tmp2_ = NULL; + self = (GeeTreeSet*) base; + _tmp0_ = item; + _tmp1_ = gee_tree_set_find_floor (self, _tmp0_); + _tmp2_ = gee_tree_set_lift_null_get (self, _tmp1_); + result = _tmp2_; + return result; +} + + +/** + * {@inheritDoc} + */ +static gpointer gee_tree_set_real_ceil (GeeSortedSet* base, gconstpointer item) { + GeeTreeSet * self; + gpointer result = NULL; + gconstpointer _tmp0_; + GeeTreeSetNode* _tmp1_ = NULL; + gpointer _tmp2_ = NULL; + self = (GeeTreeSet*) base; + _tmp0_ = item; + _tmp1_ = gee_tree_set_find_ceil (self, _tmp0_); + _tmp2_ = gee_tree_set_lift_null_get (self, _tmp1_); + result = _tmp2_; + return result; +} + + +static inline gpointer gee_tree_set_min (GeeTreeSet* self, gconstpointer a, gconstpointer b) { + gpointer result = NULL; + gconstpointer _tmp0_ = NULL; + GCompareFunc _tmp1_; + GCompareFunc _tmp2_; + gconstpointer _tmp3_; + gconstpointer _tmp4_; + gint _tmp5_ = 0; + gconstpointer _tmp8_; + gpointer _tmp9_; + g_return_val_if_fail (self != NULL, NULL); + _tmp1_ = gee_tree_set_get_compare_func (self); + _tmp2_ = _tmp1_; + _tmp3_ = a; + _tmp4_ = b; + _tmp5_ = _tmp2_ (_tmp3_, _tmp4_); + if (_tmp5_ <= 0) { + gconstpointer _tmp6_; + _tmp6_ = a; + _tmp0_ = _tmp6_; + } else { + gconstpointer _tmp7_; + _tmp7_ = b; + _tmp0_ = _tmp7_; + } + _tmp8_ = _tmp0_; + _tmp9_ = ((_tmp8_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp8_) : ((gpointer) _tmp8_); + result = _tmp9_; + return result; +} + + +static inline gpointer gee_tree_set_max (GeeTreeSet* self, gconstpointer a, gconstpointer b) { + gpointer result = NULL; + gconstpointer _tmp0_ = NULL; + GCompareFunc _tmp1_; + GCompareFunc _tmp2_; + gconstpointer _tmp3_; + gconstpointer _tmp4_; + gint _tmp5_ = 0; + gconstpointer _tmp8_; + gpointer _tmp9_; + g_return_val_if_fail (self != NULL, NULL); + _tmp1_ = gee_tree_set_get_compare_func (self); + _tmp2_ = _tmp1_; + _tmp3_ = a; + _tmp4_ = b; + _tmp5_ = _tmp2_ (_tmp3_, _tmp4_); + if (_tmp5_ > 0) { + gconstpointer _tmp6_; + _tmp6_ = a; + _tmp0_ = _tmp6_; + } else { + gconstpointer _tmp7_; + _tmp7_ = b; + _tmp0_ = _tmp7_; + } + _tmp8_ = _tmp0_; + _tmp9_ = ((_tmp8_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp8_) : ((gpointer) _tmp8_); + result = _tmp9_; + return result; +} + + +static gint gee_tree_set_real_get_size (GeeAbstractCollection* base) { + gint result; + GeeTreeSet* self; + gint _tmp0_; + self = (GeeTreeSet*) base; + _tmp0_ = self->priv->_size; + result = _tmp0_; + return result; +} + + +GCompareFunc gee_tree_set_get_compare_func (GeeTreeSet* self) { + GCompareFunc result; + GCompareFunc _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->_compare_func; + result = _tmp0_; + return result; +} + + +static void gee_tree_set_set_compare_func (GeeTreeSet* self, GCompareFunc value) { + GCompareFunc _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = value; + self->priv->_compare_func = _tmp0_; + g_object_notify ((GObject *) self, "compare-func"); +} + + +static GeeTreeSetNodeColor gee_tree_set_node_color_flip (GeeTreeSetNodeColor self) { + GeeTreeSetNodeColor result = 0; + if (self == GEE_TREE_SET_NODE_COLOR_RED) { + result = GEE_TREE_SET_NODE_COLOR_BLACK; + return result; + } else { + result = GEE_TREE_SET_NODE_COLOR_RED; + return result; + } +} + + +GType gee_tree_set_node_color_get_type (void) { + static volatile gsize gee_tree_set_node_color_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_set_node_color_type_id__volatile)) { + static const GEnumValue values[] = {{GEE_TREE_SET_NODE_COLOR_RED, "GEE_TREE_SET_NODE_COLOR_RED", "red"}, {GEE_TREE_SET_NODE_COLOR_BLACK, "GEE_TREE_SET_NODE_COLOR_BLACK", "black"}, {0, NULL, NULL}}; + GType gee_tree_set_node_color_type_id; + gee_tree_set_node_color_type_id = g_enum_register_static ("GeeTreeSetNodeColor", values); + g_once_init_leave (&gee_tree_set_node_color_type_id__volatile, gee_tree_set_node_color_type_id); + } + return gee_tree_set_node_color_type_id__volatile; +} + + +static GeeTreeSetNode* gee_tree_set_node_new (gpointer node, GeeTreeSetNode* prev, GeeTreeSetNode* next) { + GeeTreeSetNode* self; + gpointer _tmp0_; + GeeTreeSetNode* _tmp1_; + GeeTreeSetNode* _tmp2_; + GeeTreeSetNode* _tmp3_; + GeeTreeSetNode* _tmp5_; + self = g_slice_new0 (GeeTreeSetNode); + gee_tree_set_node_instance_init (self); + _tmp0_ = node; + node = NULL; + self->key = _tmp0_; + self->color = GEE_TREE_SET_NODE_COLOR_RED; + _tmp1_ = prev; + self->prev = _tmp1_; + _tmp2_ = next; + self->next = _tmp2_; + _tmp3_ = prev; + if (_tmp3_ != NULL) { + GeeTreeSetNode* _tmp4_; + _tmp4_ = prev; + _tmp4_->next = self; + } + _tmp5_ = next; + if (_tmp5_ != NULL) { + GeeTreeSetNode* _tmp6_; + _tmp6_ = next; + _tmp6_->prev = self; + } + return self; +} + + +static void gee_tree_set_node_flip (GeeTreeSetNode* self) { + GeeTreeSetNodeColor _tmp0_; + GeeTreeSetNodeColor _tmp1_ = 0; + GeeTreeSetNode* _tmp2_; + GeeTreeSetNode* _tmp7_; + g_return_if_fail (self != NULL); + _tmp0_ = self->color; + _tmp1_ = gee_tree_set_node_color_flip (_tmp0_); + self->color = _tmp1_; + _tmp2_ = self->left; + if (_tmp2_ != NULL) { + GeeTreeSetNode* _tmp3_; + GeeTreeSetNode* _tmp4_; + GeeTreeSetNodeColor _tmp5_; + GeeTreeSetNodeColor _tmp6_ = 0; + _tmp3_ = self->left; + _tmp4_ = self->left; + _tmp5_ = _tmp4_->color; + _tmp6_ = gee_tree_set_node_color_flip (_tmp5_); + _tmp3_->color = _tmp6_; + } + _tmp7_ = self->right; + if (_tmp7_ != NULL) { + GeeTreeSetNode* _tmp8_; + GeeTreeSetNode* _tmp9_; + GeeTreeSetNodeColor _tmp10_; + GeeTreeSetNodeColor _tmp11_ = 0; + _tmp8_ = self->right; + _tmp9_ = self->right; + _tmp10_ = _tmp9_->color; + _tmp11_ = gee_tree_set_node_color_flip (_tmp10_); + _tmp8_->color = _tmp11_; + } +} + + +static void gee_tree_set_node_instance_init (GeeTreeSetNode * self) { +} + + +static void gee_tree_set_node_free (GeeTreeSetNode* self) { + _gee_tree_set_node_free0 (self->left); + _gee_tree_set_node_free0 (self->right); + g_slice_free (GeeTreeSetNode, self); +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static GeeTreeSetIterator* gee_tree_set_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set) { + GeeTreeSetIterator * self = NULL; + GeeTreeSet* _tmp0_; + GeeTreeSet* _tmp1_; + GeeTreeSet* _tmp2_; + gint _tmp3_; + g_return_val_if_fail (set != NULL, NULL); + self = (GeeTreeSetIterator*) g_object_new (object_type, NULL); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = set; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->_set); + self->priv->_set = _tmp1_; + _tmp2_ = self->priv->_set; + _tmp3_ = _tmp2_->priv->stamp; + self->priv->stamp = _tmp3_; + return self; +} + + +static GeeTreeSetIterator* gee_tree_set_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set) { + return gee_tree_set_iterator_construct (GEE_TREE_SET_TYPE_ITERATOR, g_type, g_dup_func, g_destroy_func, set); +} + + +static GeeTreeSetIterator* gee_tree_set_iterator_construct_pointing (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, GeeTreeSetNode* current) { + GeeTreeSetIterator * self = NULL; + GeeTreeSet* _tmp0_; + GeeTreeSet* _tmp1_; + GeeTreeSetNode* _tmp2_; + GeeTreeSet* _tmp3_; + gint _tmp4_; + g_return_val_if_fail (set != NULL, NULL); + g_return_val_if_fail (current != NULL, NULL); + self = (GeeTreeSetIterator*) g_object_new (object_type, NULL); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = set; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->_set); + self->priv->_set = _tmp1_; + _tmp2_ = current; + self->priv->current = _tmp2_; + _tmp3_ = set; + _tmp4_ = _tmp3_->priv->stamp; + self->priv->stamp = _tmp4_; + self->priv->started = TRUE; + return self; +} + + +static GeeTreeSetIterator* gee_tree_set_iterator_new_pointing (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, GeeTreeSetNode* current) { + return gee_tree_set_iterator_construct_pointing (GEE_TREE_SET_TYPE_ITERATOR, g_type, g_dup_func, g_destroy_func, set, current); +} + + +static gboolean gee_tree_set_iterator_real_next (GeeIterator* base) { + GeeTreeSetIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeTreeSet* _tmp1_; + gint _tmp2_; + GeeTreeSetNode* _tmp3_; + self = (GeeTreeSetIterator*) base; + _tmp0_ = self->priv->stamp; + _tmp1_ = self->priv->_set; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _set.stamp"); + _tmp3_ = self->priv->current; + if (_tmp3_ != NULL) { + GeeTreeSetNode* _tmp4_; + GeeTreeSetNode* _tmp5_; + _tmp4_ = self->priv->current; + _tmp5_ = _tmp4_->next; + if (_tmp5_ != NULL) { + GeeTreeSetNode* _tmp6_; + GeeTreeSetNode* _tmp7_; + _tmp6_ = self->priv->current; + _tmp7_ = _tmp6_->next; + self->priv->current = _tmp7_; + result = TRUE; + return result; + } else { + result = FALSE; + return result; + } + } else { + gboolean _tmp8_; + _tmp8_ = self->priv->started; + if (!_tmp8_) { + GeeTreeSet* _tmp9_; + GeeTreeSetNode* _tmp10_; + GeeTreeSetNode* _tmp11_; + _tmp9_ = self->priv->_set; + _tmp10_ = _tmp9_->priv->_first; + self->priv->current = _tmp10_; + self->priv->started = TRUE; + _tmp11_ = self->priv->current; + result = _tmp11_ != NULL; + return result; + } else { + GeeTreeSetNode* _tmp12_; + GeeTreeSetNode* _tmp13_; + GeeTreeSetNode* _tmp14_; + _tmp12_ = self->priv->_next; + self->priv->current = _tmp12_; + _tmp13_ = self->priv->current; + if (_tmp13_ != NULL) { + self->priv->_next = NULL; + self->priv->_prev = NULL; + } + _tmp14_ = self->priv->current; + result = _tmp14_ != NULL; + return result; + } + } +} + + +static gboolean gee_tree_set_iterator_real_has_next (GeeIterator* base) { + GeeTreeSetIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeTreeSet* _tmp1_; + gint _tmp2_; + gboolean _tmp3_ = FALSE; + gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_; + gboolean _tmp9_; + gboolean _tmp14_; + gboolean _tmp20_; + self = (GeeTreeSetIterator*) base; + _tmp0_ = self->priv->stamp; + _tmp1_ = self->priv->_set; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _set.stamp"); + _tmp6_ = self->priv->started; + if (!_tmp6_) { + GeeTreeSet* _tmp7_; + GeeTreeSetNode* _tmp8_; + _tmp7_ = self->priv->_set; + _tmp8_ = _tmp7_->priv->_first; + _tmp5_ = _tmp8_ != NULL; + } else { + _tmp5_ = FALSE; + } + _tmp9_ = _tmp5_; + if (_tmp9_) { + _tmp4_ = TRUE; + } else { + gboolean _tmp10_ = FALSE; + GeeTreeSetNode* _tmp11_; + gboolean _tmp13_; + _tmp11_ = self->priv->current; + if (_tmp11_ == NULL) { + GeeTreeSetNode* _tmp12_; + _tmp12_ = self->priv->_next; + _tmp10_ = _tmp12_ != NULL; + } else { + _tmp10_ = FALSE; + } + _tmp13_ = _tmp10_; + _tmp4_ = _tmp13_; + } + _tmp14_ = _tmp4_; + if (_tmp14_) { + _tmp3_ = TRUE; + } else { + gboolean _tmp15_ = FALSE; + GeeTreeSetNode* _tmp16_; + gboolean _tmp19_; + _tmp16_ = self->priv->current; + if (_tmp16_ != NULL) { + GeeTreeSetNode* _tmp17_; + GeeTreeSetNode* _tmp18_; + _tmp17_ = self->priv->current; + _tmp18_ = _tmp17_->next; + _tmp15_ = _tmp18_ != NULL; + } else { + _tmp15_ = FALSE; + } + _tmp19_ = _tmp15_; + _tmp3_ = _tmp19_; + } + _tmp20_ = _tmp3_; + result = _tmp20_; + return result; +} + + +static gboolean gee_tree_set_iterator_real_first (GeeIterator* base) { + GeeTreeSetIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeTreeSet* _tmp1_; + gint _tmp2_; + GeeTreeSet* _tmp3_; + GeeTreeSetNode* _tmp4_; + GeeTreeSetNode* _tmp5_; + self = (GeeTreeSetIterator*) base; + _tmp0_ = self->priv->stamp; + _tmp1_ = self->priv->_set; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _set.stamp"); + _tmp3_ = self->priv->_set; + _tmp4_ = _tmp3_->priv->_first; + self->priv->current = _tmp4_; + self->priv->_next = NULL; + self->priv->_prev = NULL; + self->priv->started = TRUE; + _tmp5_ = self->priv->current; + result = _tmp5_ != NULL; + return result; +} + + +static gboolean gee_tree_set_iterator_real_previous (GeeBidirIterator* base) { + GeeTreeSetIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeTreeSet* _tmp1_; + gint _tmp2_; + GeeTreeSetNode* _tmp3_; + self = (GeeTreeSetIterator*) base; + _tmp0_ = self->priv->stamp; + _tmp1_ = self->priv->_set; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _set.stamp"); + _tmp3_ = self->priv->current; + if (_tmp3_ != NULL) { + GeeTreeSetNode* _tmp4_; + GeeTreeSetNode* _tmp5_; + _tmp4_ = self->priv->current; + _tmp5_ = _tmp4_->prev; + if (_tmp5_ != NULL) { + GeeTreeSetNode* _tmp6_; + GeeTreeSetNode* _tmp7_; + _tmp6_ = self->priv->current; + _tmp7_ = _tmp6_->prev; + self->priv->current = _tmp7_; + result = TRUE; + return result; + } else { + result = FALSE; + return result; + } + } else { + GeeTreeSetNode* _tmp8_; + _tmp8_ = self->priv->_prev; + if (_tmp8_ != NULL) { + GeeTreeSetNode* _tmp9_; + _tmp9_ = self->priv->_prev; + self->priv->current = _tmp9_; + self->priv->_next = NULL; + self->priv->_prev = NULL; + result = TRUE; + return result; + } else { + result = FALSE; + return result; + } + } +} + + +static gboolean gee_tree_set_iterator_real_has_previous (GeeBidirIterator* base) { + GeeTreeSetIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeTreeSet* _tmp1_; + gint _tmp2_; + gboolean _tmp3_ = FALSE; + gboolean _tmp4_ = FALSE; + GeeTreeSetNode* _tmp5_; + gboolean _tmp7_; + gboolean _tmp13_; + self = (GeeTreeSetIterator*) base; + _tmp0_ = self->priv->stamp; + _tmp1_ = self->priv->_set; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _set.stamp"); + _tmp5_ = self->priv->current; + if (_tmp5_ == NULL) { + GeeTreeSetNode* _tmp6_; + _tmp6_ = self->priv->_prev; + _tmp4_ = _tmp6_ != NULL; + } else { + _tmp4_ = FALSE; + } + _tmp7_ = _tmp4_; + if (_tmp7_) { + _tmp3_ = TRUE; + } else { + gboolean _tmp8_ = FALSE; + GeeTreeSetNode* _tmp9_; + gboolean _tmp12_; + _tmp9_ = self->priv->current; + if (_tmp9_ != NULL) { + GeeTreeSetNode* _tmp10_; + GeeTreeSetNode* _tmp11_; + _tmp10_ = self->priv->current; + _tmp11_ = _tmp10_->prev; + _tmp8_ = _tmp11_ != NULL; + } else { + _tmp8_ = FALSE; + } + _tmp12_ = _tmp8_; + _tmp3_ = _tmp12_; + } + _tmp13_ = _tmp3_; + result = _tmp13_; + return result; +} + + +static gboolean gee_tree_set_iterator_real_last (GeeBidirIterator* base) { + GeeTreeSetIterator * self; + gboolean result = FALSE; + gint _tmp0_; + GeeTreeSet* _tmp1_; + gint _tmp2_; + GeeTreeSet* _tmp3_; + GeeTreeSetNode* _tmp4_; + GeeTreeSetNode* _tmp5_; + self = (GeeTreeSetIterator*) base; + _tmp0_ = self->priv->stamp; + _tmp1_ = self->priv->_set; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _set.stamp"); + _tmp3_ = self->priv->_set; + _tmp4_ = _tmp3_->priv->_last; + self->priv->current = _tmp4_; + self->priv->_next = NULL; + self->priv->_prev = NULL; + self->priv->started = TRUE; + _tmp5_ = self->priv->current; + result = _tmp5_ != NULL; + return result; +} + + +static gpointer gee_tree_set_iterator_real_get (GeeIterator* base) { + GeeTreeSetIterator * self; + gpointer result = NULL; + gint _tmp0_; + GeeTreeSet* _tmp1_; + gint _tmp2_; + GeeTreeSetNode* _tmp3_; + GeeTreeSetNode* _tmp4_; + gconstpointer _tmp5_; + gpointer _tmp6_; + self = (GeeTreeSetIterator*) base; + _tmp0_ = self->priv->stamp; + _tmp1_ = self->priv->_set; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _set.stamp"); + _tmp3_ = self->priv->current; + _vala_assert (_tmp3_ != NULL, "current != null"); + _tmp4_ = self->priv->current; + _tmp5_ = _tmp4_->key; + _tmp6_ = ((_tmp5_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_); + result = _tmp6_; + return result; +} + + +static void gee_tree_set_iterator_real_remove (GeeIterator* base) { + GeeTreeSetIterator * self; + gint _tmp0_; + GeeTreeSet* _tmp1_; + gint _tmp2_; + GeeTreeSetNode* _tmp3_; + GeeTreeSet* _tmp4_; + GeeTreeSet* _tmp5_; + GeeTreeSetNode* _tmp6_; + gconstpointer _tmp7_; + GeeTreeSetNode* _tmp8_ = NULL; + GeeTreeSetNode* _tmp9_ = NULL; + gboolean _tmp10_ = FALSE; + gboolean success; + gboolean _tmp11_; + GeeTreeSet* _tmp12_; + GeeTreeSetNode* _tmp13_; + gint _tmp16_; + GeeTreeSet* _tmp17_; + gint _tmp18_; + self = (GeeTreeSetIterator*) base; + _tmp0_ = self->priv->stamp; + _tmp1_ = self->priv->_set; + _tmp2_ = _tmp1_->priv->stamp; + _vala_assert (_tmp0_ == _tmp2_, "stamp == _set.stamp"); + _tmp3_ = self->priv->current; + _vala_assert (_tmp3_ != NULL, "current != null"); + _tmp4_ = self->priv->_set; + _tmp5_ = self->priv->_set; + _tmp6_ = self->priv->current; + _tmp7_ = _tmp6_->key; + _tmp10_ = gee_tree_set_remove_from_node (_tmp4_, &_tmp5_->priv->root, _tmp7_, &_tmp8_, &_tmp9_); + self->priv->_prev = _tmp8_; + self->priv->_next = _tmp9_; + success = _tmp10_; + _tmp11_ = success; + _vala_assert (_tmp11_, "success"); + _tmp12_ = self->priv->_set; + _tmp13_ = _tmp12_->priv->root; + if (_tmp13_ != NULL) { + GeeTreeSet* _tmp14_; + GeeTreeSetNode* _tmp15_; + _tmp14_ = self->priv->_set; + _tmp15_ = _tmp14_->priv->root; + _tmp15_->color = GEE_TREE_SET_NODE_COLOR_BLACK; + } + self->priv->current = NULL; + _tmp16_ = self->priv->stamp; + self->priv->stamp = _tmp16_ + 1; + _tmp17_ = self->priv->_set; + _tmp18_ = _tmp17_->priv->stamp; + _tmp17_->priv->stamp = _tmp18_ + 1; + _vala_assert (_tmp16_ == _tmp18_, "stamp++ == _set.stamp++"); +} + + +static gboolean gee_tree_set_iterator_safe_next_get (GeeTreeSetIterator* self, gpointer* val) { + gpointer _vala_val = NULL; + gboolean result = FALSE; + GeeTreeSetNode* _tmp0_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = self->priv->current; + if (_tmp0_ != NULL) { + GeeTreeSet* _tmp1_; + GeeTreeSetNode* _tmp2_; + GeeTreeSetNode* _tmp3_; + gpointer _tmp4_ = NULL; + GeeTreeSetNode* _tmp5_; + GeeTreeSetNode* _tmp6_; + _tmp1_ = self->priv->_set; + _tmp2_ = self->priv->current; + _tmp3_ = _tmp2_->next; + _tmp4_ = gee_tree_set_lift_null_get (_tmp1_, _tmp3_); + ((_vala_val == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_vala_val = (self->priv->g_destroy_func (_vala_val), NULL)); + _vala_val = _tmp4_; + _tmp5_ = self->priv->current; + _tmp6_ = _tmp5_->next; + result = _tmp6_ != NULL; + if (val) { + *val = _vala_val; + } else { + ((_vala_val == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_vala_val = (self->priv->g_destroy_func (_vala_val), NULL)); + } + return result; + } else { + GeeTreeSet* _tmp7_; + GeeTreeSetNode* _tmp8_; + gpointer _tmp9_ = NULL; + GeeTreeSetNode* _tmp10_; + _tmp7_ = self->priv->_set; + _tmp8_ = self->priv->_next; + _tmp9_ = gee_tree_set_lift_null_get (_tmp7_, _tmp8_); + ((_vala_val == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_vala_val = (self->priv->g_destroy_func (_vala_val), NULL)); + _vala_val = _tmp9_; + _tmp10_ = self->priv->_next; + result = _tmp10_ != NULL; + if (val) { + *val = _vala_val; + } else { + ((_vala_val == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_vala_val = (self->priv->g_destroy_func (_vala_val), NULL)); + } + return result; + } + if (val) { + *val = _vala_val; + } else { + ((_vala_val == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_vala_val = (self->priv->g_destroy_func (_vala_val), NULL)); + } +} + + +static gboolean gee_tree_set_iterator_safe_previous_get (GeeTreeSetIterator* self, gpointer* val) { + gpointer _vala_val = NULL; + gboolean result = FALSE; + GeeTreeSetNode* _tmp0_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = self->priv->current; + if (_tmp0_ != NULL) { + GeeTreeSet* _tmp1_; + GeeTreeSetNode* _tmp2_; + GeeTreeSetNode* _tmp3_; + gpointer _tmp4_ = NULL; + GeeTreeSetNode* _tmp5_; + GeeTreeSetNode* _tmp6_; + _tmp1_ = self->priv->_set; + _tmp2_ = self->priv->current; + _tmp3_ = _tmp2_->prev; + _tmp4_ = gee_tree_set_lift_null_get (_tmp1_, _tmp3_); + ((_vala_val == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_vala_val = (self->priv->g_destroy_func (_vala_val), NULL)); + _vala_val = _tmp4_; + _tmp5_ = self->priv->current; + _tmp6_ = _tmp5_->prev; + result = _tmp6_ != NULL; + if (val) { + *val = _vala_val; + } else { + ((_vala_val == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_vala_val = (self->priv->g_destroy_func (_vala_val), NULL)); + } + return result; + } else { + GeeTreeSet* _tmp7_; + GeeTreeSetNode* _tmp8_; + gpointer _tmp9_ = NULL; + GeeTreeSetNode* _tmp10_; + _tmp7_ = self->priv->_set; + _tmp8_ = self->priv->_prev; + _tmp9_ = gee_tree_set_lift_null_get (_tmp7_, _tmp8_); + ((_vala_val == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_vala_val = (self->priv->g_destroy_func (_vala_val), NULL)); + _vala_val = _tmp9_; + _tmp10_ = self->priv->_next; + result = _tmp10_ != NULL; + if (val) { + *val = _vala_val; + } else { + ((_vala_val == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_vala_val = (self->priv->g_destroy_func (_vala_val), NULL)); + } + return result; + } + if (val) { + *val = _vala_val; + } else { + ((_vala_val == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_vala_val = (self->priv->g_destroy_func (_vala_val), NULL)); + } +} + + +static void gee_tree_set_iterator_class_init (GeeTreeSetIteratorClass * klass) { + gee_tree_set_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTreeSetIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_tree_set_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_tree_set_iterator_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_tree_set_iterator_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_SET_ITERATOR_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_SET_ITERATOR_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_SET_ITERATOR_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_tree_set_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) { + gee_tree_set_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->next = (gboolean (*)(GeeIterator*)) gee_tree_set_iterator_real_next; + iface->has_next = (gboolean (*)(GeeIterator*)) gee_tree_set_iterator_real_has_next; + iface->first = (gboolean (*)(GeeIterator*)) gee_tree_set_iterator_real_first; + iface->get = (gpointer (*)(GeeIterator*)) gee_tree_set_iterator_real_get; + iface->remove = (void (*)(GeeIterator*)) gee_tree_set_iterator_real_remove; +} + + +static void gee_tree_set_iterator_gee_bidir_iterator_interface_init (GeeBidirIteratorIface * iface) { + gee_tree_set_iterator_gee_bidir_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->previous = (gboolean (*)(GeeBidirIterator*)) gee_tree_set_iterator_real_previous; + iface->has_previous = (gboolean (*)(GeeBidirIterator*)) gee_tree_set_iterator_real_has_previous; + iface->last = (gboolean (*)(GeeBidirIterator*)) gee_tree_set_iterator_real_last; +} + + +static void gee_tree_set_iterator_instance_init (GeeTreeSetIterator * self) { + self->priv = GEE_TREE_SET_ITERATOR_GET_PRIVATE (self); + self->priv->current = NULL; + self->priv->_next = NULL; + self->priv->_prev = NULL; + self->priv->started = FALSE; +} + + +static void gee_tree_set_iterator_finalize (GObject* obj) { + GeeTreeSetIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TREE_SET_TYPE_ITERATOR, GeeTreeSetIterator); + _g_object_unref0 (self->priv->_set); + G_OBJECT_CLASS (gee_tree_set_iterator_parent_class)->finalize (obj); +} + + +static GType gee_tree_set_iterator_get_type (void) { + static volatile gsize gee_tree_set_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_set_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTreeSetIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tree_set_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTreeSetIterator), 0, (GInstanceInitFunc) gee_tree_set_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_tree_set_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + static const GInterfaceInfo gee_bidir_iterator_info = { (GInterfaceInitFunc) gee_tree_set_iterator_gee_bidir_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_tree_set_iterator_type_id; + gee_tree_set_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeTreeSetIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_tree_set_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info); + g_type_add_interface_static (gee_tree_set_iterator_type_id, GEE_TYPE_BIDIR_ITERATOR, &gee_bidir_iterator_info); + g_once_init_leave (&gee_tree_set_iterator_type_id__volatile, gee_tree_set_iterator_type_id); + } + return gee_tree_set_iterator_type_id__volatile; +} + + +static void _vala_gee_tree_set_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeTreeSetIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_SET_TYPE_ITERATOR, GeeTreeSetIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_tree_set_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeTreeSetIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_SET_TYPE_ITERATOR, GeeTreeSetIterator); + switch (property_id) { + case GEE_TREE_SET_ITERATOR_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_TREE_SET_ITERATOR_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_SET_ITERATOR_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeTreeSetRange* gee_tree_set_range_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer after, gconstpointer before) { + GeeTreeSetRange* self = NULL; + GeeTreeSet* _tmp0_; + GeeTreeSet* _tmp1_; + GeeTreeSet* _tmp2_; + GCompareFunc _tmp3_; + GCompareFunc _tmp4_; + gconstpointer _tmp5_; + gconstpointer _tmp6_; + gint _tmp7_ = 0; + g_return_val_if_fail (set != NULL, NULL); + self = (GeeTreeSetRange*) g_type_create_instance (object_type); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = set; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->set); + self->priv->set = _tmp1_; + _tmp2_ = set; + _tmp3_ = gee_tree_set_get_compare_func (_tmp2_); + _tmp4_ = _tmp3_; + _tmp5_ = after; + _tmp6_ = before; + _tmp7_ = _tmp4_ (_tmp5_, _tmp6_); + if (_tmp7_ < 0) { + gconstpointer _tmp8_; + gpointer _tmp9_; + gconstpointer _tmp10_; + gpointer _tmp11_; + _tmp8_ = after; + _tmp9_ = ((_tmp8_ != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) _tmp8_) : ((gpointer) _tmp8_); + _g_destroy_func0 (self->priv->after); + self->priv->after = _tmp9_; + _tmp10_ = before; + _tmp11_ = ((_tmp10_ != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) _tmp10_) : ((gpointer) _tmp10_); + _g_destroy_func0 (self->priv->before); + self->priv->before = _tmp11_; + self->priv->type = GEE_TREE_SET_RANGE_TYPE_BOUNDED; + } else { + self->priv->type = GEE_TREE_SET_RANGE_TYPE_EMPTY; + } + return self; +} + + +static GeeTreeSetRange* gee_tree_set_range_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer after, gconstpointer before) { + return gee_tree_set_range_construct (GEE_TREE_SET_TYPE_RANGE, g_type, g_dup_func, g_destroy_func, set, after, before); +} + + +static GeeTreeSetRange* gee_tree_set_range_construct_head (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer before) { + GeeTreeSetRange* self = NULL; + GeeTreeSet* _tmp0_; + GeeTreeSet* _tmp1_; + gconstpointer _tmp2_; + gpointer _tmp3_; + g_return_val_if_fail (set != NULL, NULL); + self = (GeeTreeSetRange*) g_type_create_instance (object_type); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = set; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->set); + self->priv->set = _tmp1_; + _tmp2_ = before; + _tmp3_ = ((_tmp2_ != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) _tmp2_) : ((gpointer) _tmp2_); + _g_destroy_func0 (self->priv->before); + self->priv->before = _tmp3_; + self->priv->type = GEE_TREE_SET_RANGE_TYPE_HEAD; + return self; +} + + +static GeeTreeSetRange* gee_tree_set_range_new_head (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer before) { + return gee_tree_set_range_construct_head (GEE_TREE_SET_TYPE_RANGE, g_type, g_dup_func, g_destroy_func, set, before); +} + + +static GeeTreeSetRange* gee_tree_set_range_construct_tail (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer after) { + GeeTreeSetRange* self = NULL; + GeeTreeSet* _tmp0_; + GeeTreeSet* _tmp1_; + gconstpointer _tmp2_; + gpointer _tmp3_; + g_return_val_if_fail (set != NULL, NULL); + self = (GeeTreeSetRange*) g_type_create_instance (object_type); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = set; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->set); + self->priv->set = _tmp1_; + _tmp2_ = after; + _tmp3_ = ((_tmp2_ != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) _tmp2_) : ((gpointer) _tmp2_); + _g_destroy_func0 (self->priv->after); + self->priv->after = _tmp3_; + self->priv->type = GEE_TREE_SET_RANGE_TYPE_TAIL; + return self; +} + + +static GeeTreeSetRange* gee_tree_set_range_new_tail (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer after) { + return gee_tree_set_range_construct_tail (GEE_TREE_SET_TYPE_RANGE, g_type, g_dup_func, g_destroy_func, set, after); +} + + +static gpointer _gee_tree_set_range_ref0 (gpointer self) { + return self ? gee_tree_set_range_ref (self) : NULL; +} + + +static GeeTreeSetRange* gee_tree_set_range_cut_head (GeeTreeSetRange* self, gconstpointer after) { + GeeTreeSetRange* result = NULL; + GeeTreeSetRangeType _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->type; + switch (_tmp0_) { + case GEE_TREE_SET_RANGE_TYPE_HEAD: + { + GeeTreeSet* _tmp1_; + gconstpointer _tmp2_; + gconstpointer _tmp3_; + GeeTreeSetRange* _tmp4_; + _tmp1_ = self->priv->set; + _tmp2_ = after; + _tmp3_ = self->priv->before; + _tmp4_ = gee_tree_set_range_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp1_, _tmp2_, _tmp3_); + result = _tmp4_; + return result; + } + case GEE_TREE_SET_RANGE_TYPE_TAIL: + { + GeeTreeSet* _tmp5_; + GeeTreeSet* _tmp6_; + gconstpointer _tmp7_; + gconstpointer _tmp8_; + gpointer _tmp9_ = NULL; + gpointer _tmp10_; + GeeTreeSetRange* _tmp11_; + GeeTreeSetRange* _tmp12_; + _tmp5_ = self->priv->set; + _tmp6_ = self->priv->set; + _tmp7_ = after; + _tmp8_ = self->priv->after; + _tmp9_ = gee_tree_set_max (_tmp6_, _tmp7_, _tmp8_); + _tmp10_ = _tmp9_; + _tmp11_ = gee_tree_set_range_new_tail (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp5_, _tmp10_); + _tmp12_ = _tmp11_; + ((_tmp10_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp10_ = (self->priv->g_destroy_func (_tmp10_), NULL)); + result = _tmp12_; + return result; + } + case GEE_TREE_SET_RANGE_TYPE_EMPTY: + { + GeeTreeSetRange* _tmp13_; + _tmp13_ = _gee_tree_set_range_ref0 (self); + result = _tmp13_; + return result; + } + case GEE_TREE_SET_RANGE_TYPE_BOUNDED: + { + GeeTreeSet* _tmp14_; + gconstpointer _tmp15_; + gconstpointer _tmp16_; + gpointer _tmp17_ = NULL; + gpointer _after; + GeeTreeSet* _tmp18_; + gconstpointer _tmp19_; + gconstpointer _tmp20_; + GeeTreeSetRange* _tmp21_; + _tmp14_ = self->priv->set; + _tmp15_ = after; + _tmp16_ = self->priv->after; + _tmp17_ = gee_tree_set_max (_tmp14_, _tmp15_, _tmp16_); + _after = _tmp17_; + _tmp18_ = self->priv->set; + _tmp19_ = _after; + _tmp20_ = self->priv->before; + _tmp21_ = gee_tree_set_range_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp18_, _tmp19_, _tmp20_); + result = _tmp21_; + ((_after == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_after = (self->priv->g_destroy_func (_after), NULL)); + return result; + } + default: + { + g_assert_not_reached (); + } + } +} + + +static GeeTreeSetRange* gee_tree_set_range_cut_tail (GeeTreeSetRange* self, gconstpointer before) { + GeeTreeSetRange* result = NULL; + GeeTreeSetRangeType _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->type; + switch (_tmp0_) { + case GEE_TREE_SET_RANGE_TYPE_HEAD: + { + GeeTreeSet* _tmp1_; + GeeTreeSet* _tmp2_; + gconstpointer _tmp3_; + gconstpointer _tmp4_; + gpointer _tmp5_ = NULL; + gpointer _tmp6_; + GeeTreeSetRange* _tmp7_; + GeeTreeSetRange* _tmp8_; + _tmp1_ = self->priv->set; + _tmp2_ = self->priv->set; + _tmp3_ = before; + _tmp4_ = self->priv->before; + _tmp5_ = gee_tree_set_min (_tmp2_, _tmp3_, _tmp4_); + _tmp6_ = _tmp5_; + _tmp7_ = gee_tree_set_range_new_head (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp1_, _tmp6_); + _tmp8_ = _tmp7_; + ((_tmp6_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp6_ = (self->priv->g_destroy_func (_tmp6_), NULL)); + result = _tmp8_; + return result; + } + case GEE_TREE_SET_RANGE_TYPE_TAIL: + { + GeeTreeSet* _tmp9_; + gconstpointer _tmp10_; + gconstpointer _tmp11_; + GeeTreeSetRange* _tmp12_; + _tmp9_ = self->priv->set; + _tmp10_ = self->priv->after; + _tmp11_ = before; + _tmp12_ = gee_tree_set_range_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp9_, _tmp10_, _tmp11_); + result = _tmp12_; + return result; + } + case GEE_TREE_SET_RANGE_TYPE_EMPTY: + { + GeeTreeSetRange* _tmp13_; + _tmp13_ = _gee_tree_set_range_ref0 (self); + result = _tmp13_; + return result; + } + case GEE_TREE_SET_RANGE_TYPE_BOUNDED: + { + GeeTreeSet* _tmp14_; + gconstpointer _tmp15_; + gconstpointer _tmp16_; + gpointer _tmp17_ = NULL; + gpointer _before; + GeeTreeSet* _tmp18_; + gconstpointer _tmp19_; + gconstpointer _tmp20_; + GeeTreeSetRange* _tmp21_; + _tmp14_ = self->priv->set; + _tmp15_ = before; + _tmp16_ = self->priv->before; + _tmp17_ = gee_tree_set_min (_tmp14_, _tmp15_, _tmp16_); + _before = _tmp17_; + _tmp18_ = self->priv->set; + _tmp19_ = self->priv->after; + _tmp20_ = _before; + _tmp21_ = gee_tree_set_range_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp18_, _tmp19_, _tmp20_); + result = _tmp21_; + ((_before == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_before = (self->priv->g_destroy_func (_before), NULL)); + return result; + } + default: + { + g_assert_not_reached (); + } + } +} + + +static GeeTreeSetRange* gee_tree_set_range_cut (GeeTreeSetRange* self, gconstpointer after, gconstpointer before) { + GeeTreeSetRange* result = NULL; + GeeTreeSetRangeType _tmp0_; + gpointer _tmp2_ = NULL; + GeeTreeSetRangeType _tmp3_; + gconstpointer _tmp10_; + gpointer _tmp11_; + gpointer _before; + gpointer _tmp12_ = NULL; + GeeTreeSetRangeType _tmp13_; + gconstpointer _tmp20_; + gpointer _tmp21_; + gpointer _after; + GeeTreeSet* _tmp22_; + gconstpointer _tmp23_; + gconstpointer _tmp24_; + GeeTreeSetRange* _tmp25_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->type; + if (_tmp0_ == GEE_TREE_SET_RANGE_TYPE_EMPTY) { + GeeTreeSetRange* _tmp1_; + _tmp1_ = _gee_tree_set_range_ref0 (self); + result = _tmp1_; + return result; + } + _tmp3_ = self->priv->type; + if (_tmp3_ != GEE_TREE_SET_RANGE_TYPE_TAIL) { + GeeTreeSet* _tmp4_; + gconstpointer _tmp5_; + gconstpointer _tmp6_; + gpointer _tmp7_ = NULL; + _tmp4_ = self->priv->set; + _tmp5_ = before; + _tmp6_ = self->priv->before; + _tmp7_ = gee_tree_set_min (_tmp4_, _tmp5_, _tmp6_); + ((_tmp2_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp2_ = (self->priv->g_destroy_func (_tmp2_), NULL)); + _tmp2_ = _tmp7_; + } else { + gconstpointer _tmp8_; + gpointer _tmp9_; + _tmp8_ = before; + _tmp9_ = ((_tmp8_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp8_) : ((gpointer) _tmp8_); + ((_tmp2_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp2_ = (self->priv->g_destroy_func (_tmp2_), NULL)); + _tmp2_ = _tmp9_; + } + _tmp10_ = _tmp2_; + _tmp11_ = ((_tmp10_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp10_) : ((gpointer) _tmp10_); + _before = _tmp11_; + _tmp13_ = self->priv->type; + if (_tmp13_ != GEE_TREE_SET_RANGE_TYPE_HEAD) { + GeeTreeSet* _tmp14_; + gconstpointer _tmp15_; + gconstpointer _tmp16_; + gpointer _tmp17_ = NULL; + _tmp14_ = self->priv->set; + _tmp15_ = after; + _tmp16_ = self->priv->after; + _tmp17_ = gee_tree_set_max (_tmp14_, _tmp15_, _tmp16_); + ((_tmp12_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp12_ = (self->priv->g_destroy_func (_tmp12_), NULL)); + _tmp12_ = _tmp17_; + } else { + gconstpointer _tmp18_; + gpointer _tmp19_; + _tmp18_ = after; + _tmp19_ = ((_tmp18_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp18_) : ((gpointer) _tmp18_); + ((_tmp12_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp12_ = (self->priv->g_destroy_func (_tmp12_), NULL)); + _tmp12_ = _tmp19_; + } + _tmp20_ = _tmp12_; + _tmp21_ = ((_tmp20_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp20_) : ((gpointer) _tmp20_); + _after = _tmp21_; + _tmp22_ = self->priv->set; + _tmp23_ = _after; + _tmp24_ = _before; + _tmp25_ = gee_tree_set_range_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp22_, _tmp23_, _tmp24_); + result = _tmp25_; + ((_after == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_after = (self->priv->g_destroy_func (_after), NULL)); + ((_tmp12_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp12_ = (self->priv->g_destroy_func (_tmp12_), NULL)); + ((_before == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_before = (self->priv->g_destroy_func (_before), NULL)); + ((_tmp2_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp2_ = (self->priv->g_destroy_func (_tmp2_), NULL)); + return result; +} + + +static gboolean gee_tree_set_range_in_range (GeeTreeSetRange* self, gconstpointer item) { + gboolean result = FALSE; + gboolean _tmp0_ = FALSE; + GeeTreeSetRangeType _tmp1_; + gboolean _tmp4_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp1_ = self->priv->type; + if (_tmp1_ == GEE_TREE_SET_RANGE_TYPE_EMPTY) { + _tmp0_ = FALSE; + } else { + gconstpointer _tmp2_; + gint _tmp3_ = 0; + _tmp2_ = item; + _tmp3_ = gee_tree_set_range_compare_range (self, _tmp2_); + _tmp0_ = _tmp3_ == 0; + } + _tmp4_ = _tmp0_; + result = _tmp4_; + return result; +} + + +static gint gee_tree_set_range_compare_range (GeeTreeSetRange* self, gconstpointer item) { + gint result = 0; + GeeTreeSetRangeType _tmp0_; + g_return_val_if_fail (self != NULL, 0); + _tmp0_ = self->priv->type; + switch (_tmp0_) { + case GEE_TREE_SET_RANGE_TYPE_HEAD: + { + gint _tmp1_ = 0; + GeeTreeSet* _tmp2_; + GCompareFunc _tmp3_; + GCompareFunc _tmp4_; + gconstpointer _tmp5_; + gconstpointer _tmp6_; + gint _tmp7_ = 0; + gint _tmp8_; + _tmp2_ = self->priv->set; + _tmp3_ = gee_tree_set_get_compare_func (_tmp2_); + _tmp4_ = _tmp3_; + _tmp5_ = item; + _tmp6_ = self->priv->before; + _tmp7_ = _tmp4_ (_tmp5_, _tmp6_); + if (_tmp7_ < 0) { + _tmp1_ = 0; + } else { + _tmp1_ = 1; + } + _tmp8_ = _tmp1_; + result = _tmp8_; + return result; + } + case GEE_TREE_SET_RANGE_TYPE_TAIL: + { + gint _tmp9_ = 0; + GeeTreeSet* _tmp10_; + GCompareFunc _tmp11_; + GCompareFunc _tmp12_; + gconstpointer _tmp13_; + gconstpointer _tmp14_; + gint _tmp15_ = 0; + gint _tmp16_; + _tmp10_ = self->priv->set; + _tmp11_ = gee_tree_set_get_compare_func (_tmp10_); + _tmp12_ = _tmp11_; + _tmp13_ = item; + _tmp14_ = self->priv->after; + _tmp15_ = _tmp12_ (_tmp13_, _tmp14_); + if (_tmp15_ >= 0) { + _tmp9_ = 0; + } else { + _tmp9_ = -1; + } + _tmp16_ = _tmp9_; + result = _tmp16_; + return result; + } + case GEE_TREE_SET_RANGE_TYPE_EMPTY: + { + result = 0; + return result; + } + case GEE_TREE_SET_RANGE_TYPE_BOUNDED: + { + gint _tmp17_ = 0; + GeeTreeSet* _tmp18_; + GCompareFunc _tmp19_; + GCompareFunc _tmp20_; + gconstpointer _tmp21_; + gconstpointer _tmp22_; + gint _tmp23_ = 0; + gint _tmp32_; + _tmp18_ = self->priv->set; + _tmp19_ = gee_tree_set_get_compare_func (_tmp18_); + _tmp20_ = _tmp19_; + _tmp21_ = item; + _tmp22_ = self->priv->after; + _tmp23_ = _tmp20_ (_tmp21_, _tmp22_); + if (_tmp23_ >= 0) { + gint _tmp24_ = 0; + GeeTreeSet* _tmp25_; + GCompareFunc _tmp26_; + GCompareFunc _tmp27_; + gconstpointer _tmp28_; + gconstpointer _tmp29_; + gint _tmp30_ = 0; + gint _tmp31_; + _tmp25_ = self->priv->set; + _tmp26_ = gee_tree_set_get_compare_func (_tmp25_); + _tmp27_ = _tmp26_; + _tmp28_ = item; + _tmp29_ = self->priv->before; + _tmp30_ = _tmp27_ (_tmp28_, _tmp29_); + if (_tmp30_ < 0) { + _tmp24_ = 0; + } else { + _tmp24_ = 1; + } + _tmp31_ = _tmp24_; + _tmp17_ = _tmp31_; + } else { + _tmp17_ = -1; + } + _tmp32_ = _tmp17_; + result = _tmp32_; + return result; + } + default: + { + g_assert_not_reached (); + } + } +} + + +static gboolean gee_tree_set_range_empty_subset (GeeTreeSetRange* self) { + gboolean result = FALSE; + GeeTreeSetRangeType _tmp0_; + g_return_val_if_fail (self != NULL, FALSE); + _tmp0_ = self->priv->type; + switch (_tmp0_) { + case GEE_TREE_SET_RANGE_TYPE_HEAD: + { + gboolean _tmp1_ = FALSE; + GeeTreeSet* _tmp2_; + GeeTreeSetNode* _tmp3_; + gboolean _tmp8_; + _tmp2_ = self->priv->set; + _tmp3_ = _tmp2_->priv->_first; + if (_tmp3_ == NULL) { + _tmp1_ = TRUE; + } else { + GeeTreeSet* _tmp4_; + GeeTreeSetNode* _tmp5_; + gconstpointer _tmp6_; + gboolean _tmp7_ = FALSE; + _tmp4_ = self->priv->set; + _tmp5_ = _tmp4_->priv->_first; + _tmp6_ = _tmp5_->key; + _tmp7_ = gee_tree_set_range_in_range (self, _tmp6_); + _tmp1_ = !_tmp7_; + } + _tmp8_ = _tmp1_; + result = _tmp8_; + return result; + } + case GEE_TREE_SET_RANGE_TYPE_TAIL: + { + gboolean _tmp9_ = FALSE; + GeeTreeSet* _tmp10_; + GeeTreeSetNode* _tmp11_; + gboolean _tmp16_; + _tmp10_ = self->priv->set; + _tmp11_ = _tmp10_->priv->_last; + if (_tmp11_ == NULL) { + _tmp9_ = TRUE; + } else { + GeeTreeSet* _tmp12_; + GeeTreeSetNode* _tmp13_; + gconstpointer _tmp14_; + gboolean _tmp15_ = FALSE; + _tmp12_ = self->priv->set; + _tmp13_ = _tmp12_->priv->_last; + _tmp14_ = _tmp13_->key; + _tmp15_ = gee_tree_set_range_in_range (self, _tmp14_); + _tmp9_ = !_tmp15_; + } + _tmp16_ = _tmp9_; + result = _tmp16_; + return result; + } + case GEE_TREE_SET_RANGE_TYPE_EMPTY: + { + result = TRUE; + return result; + } + case GEE_TREE_SET_RANGE_TYPE_BOUNDED: + { + GeeTreeSetNode* _tmp17_ = NULL; + _tmp17_ = gee_tree_set_range_first (self); + result = _tmp17_ == NULL; + return result; + } + default: + { + g_assert_not_reached (); + } + } +} + + +static GeeTreeSetNode* gee_tree_set_range_first (GeeTreeSetRange* self) { + GeeTreeSetNode* result = NULL; + GeeTreeSetRangeType _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->type; + switch (_tmp0_) { + case GEE_TREE_SET_RANGE_TYPE_EMPTY: + { + result = NULL; + return result; + } + case GEE_TREE_SET_RANGE_TYPE_HEAD: + { + GeeTreeSet* _tmp1_; + GeeTreeSetNode* _tmp2_; + _tmp1_ = self->priv->set; + _tmp2_ = _tmp1_->priv->_first; + result = _tmp2_; + return result; + } + default: + { + GeeTreeSet* _tmp3_; + gconstpointer _tmp4_; + GeeTreeSetNode* _tmp5_ = NULL; + _tmp3_ = self->priv->set; + _tmp4_ = self->priv->after; + _tmp5_ = gee_tree_set_find_floor (_tmp3_, _tmp4_); + result = _tmp5_; + return result; + } + } +} + + +static GeeTreeSetNode* gee_tree_set_range_last (GeeTreeSetRange* self) { + GeeTreeSetNode* result = NULL; + GeeTreeSetRangeType _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->type; + switch (_tmp0_) { + case GEE_TREE_SET_RANGE_TYPE_EMPTY: + { + result = NULL; + return result; + } + case GEE_TREE_SET_RANGE_TYPE_TAIL: + { + GeeTreeSet* _tmp1_; + GeeTreeSetNode* _tmp2_; + _tmp1_ = self->priv->set; + _tmp2_ = _tmp1_->priv->_last; + result = _tmp2_; + return result; + } + default: + { + GeeTreeSet* _tmp3_; + gconstpointer _tmp4_; + GeeTreeSetNode* _tmp5_ = NULL; + _tmp3_ = self->priv->set; + _tmp4_ = self->priv->before; + _tmp5_ = gee_tree_set_find_lower (_tmp3_, _tmp4_); + result = _tmp5_; + return result; + } + } +} + + +static void gee_tree_set_value_range_init (GValue* value) { + value->data[0].v_pointer = NULL; +} + + +static void gee_tree_set_value_range_free_value (GValue* value) { + if (value->data[0].v_pointer) { + gee_tree_set_range_unref (value->data[0].v_pointer); + } +} + + +static void gee_tree_set_value_range_copy_value (const GValue* src_value, GValue* dest_value) { + if (src_value->data[0].v_pointer) { + dest_value->data[0].v_pointer = gee_tree_set_range_ref (src_value->data[0].v_pointer); + } else { + dest_value->data[0].v_pointer = NULL; + } +} + + +static gpointer gee_tree_set_value_range_peek_pointer (const GValue* value) { + return value->data[0].v_pointer; +} + + +static gchar* gee_tree_set_value_range_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + if (collect_values[0].v_pointer) { + GeeTreeSetRange* object; + object = collect_values[0].v_pointer; + if (object->parent_instance.g_class == NULL) { + return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); + } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { + return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); + } + value->data[0].v_pointer = gee_tree_set_range_ref (object); + } else { + value->data[0].v_pointer = NULL; + } + return NULL; +} + + +static gchar* gee_tree_set_value_range_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + GeeTreeSetRange** object_p; + object_p = collect_values[0].v_pointer; + if (!object_p) { + return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); + } + if (!value->data[0].v_pointer) { + *object_p = NULL; + } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { + *object_p = value->data[0].v_pointer; + } else { + *object_p = gee_tree_set_range_ref (value->data[0].v_pointer); + } + return NULL; +} + + +static GParamSpec* gee_tree_set_param_spec_range (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { + GeeTreeSetParamSpecRange* spec; + g_return_val_if_fail (g_type_is_a (object_type, GEE_TREE_SET_TYPE_RANGE), NULL); + spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); + G_PARAM_SPEC (spec)->value_type = object_type; + return G_PARAM_SPEC (spec); +} + + +static gpointer gee_tree_set_value_get_range (const GValue* value) { + g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TREE_SET_TYPE_RANGE), NULL); + return value->data[0].v_pointer; +} + + +static void gee_tree_set_value_set_range (GValue* value, gpointer v_object) { + GeeTreeSetRange* old; + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TREE_SET_TYPE_RANGE)); + old = value->data[0].v_pointer; + if (v_object) { + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_TREE_SET_TYPE_RANGE)); + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); + value->data[0].v_pointer = v_object; + gee_tree_set_range_ref (value->data[0].v_pointer); + } else { + value->data[0].v_pointer = NULL; + } + if (old) { + gee_tree_set_range_unref (old); + } +} + + +static void gee_tree_set_value_take_range (GValue* value, gpointer v_object) { + GeeTreeSetRange* old; + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TREE_SET_TYPE_RANGE)); + old = value->data[0].v_pointer; + if (v_object) { + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_TREE_SET_TYPE_RANGE)); + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); + value->data[0].v_pointer = v_object; + } else { + value->data[0].v_pointer = NULL; + } + if (old) { + gee_tree_set_range_unref (old); + } +} + + +static void gee_tree_set_range_class_init (GeeTreeSetRangeClass * klass) { + gee_tree_set_range_parent_class = g_type_class_peek_parent (klass); + GEE_TREE_SET_RANGE_CLASS (klass)->finalize = gee_tree_set_range_finalize; + g_type_class_add_private (klass, sizeof (GeeTreeSetRangePrivate)); +} + + +static void gee_tree_set_range_instance_init (GeeTreeSetRange * self) { + self->priv = GEE_TREE_SET_RANGE_GET_PRIVATE (self); + self->ref_count = 1; +} + + +static void gee_tree_set_range_finalize (GeeTreeSetRange* obj) { + GeeTreeSetRange * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TREE_SET_TYPE_RANGE, GeeTreeSetRange); + _g_object_unref0 (self->priv->set); + ((self->priv->after == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (self->priv->after = (self->priv->g_destroy_func (self->priv->after), NULL)); + ((self->priv->before == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (self->priv->before = (self->priv->g_destroy_func (self->priv->before), NULL)); +} + + +static GType gee_tree_set_range_get_type (void) { + static volatile gsize gee_tree_set_range_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_set_range_type_id__volatile)) { + static const GTypeValueTable g_define_type_value_table = { gee_tree_set_value_range_init, gee_tree_set_value_range_free_value, gee_tree_set_value_range_copy_value, gee_tree_set_value_range_peek_pointer, "p", gee_tree_set_value_range_collect_value, "p", gee_tree_set_value_range_lcopy_value }; + static const GTypeInfo g_define_type_info = { sizeof (GeeTreeSetRangeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tree_set_range_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTreeSetRange), 0, (GInstanceInitFunc) gee_tree_set_range_instance_init, &g_define_type_value_table }; + static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; + GType gee_tree_set_range_type_id; + gee_tree_set_range_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GeeTreeSetRange", &g_define_type_info, &g_define_type_fundamental_info, 0); + g_once_init_leave (&gee_tree_set_range_type_id__volatile, gee_tree_set_range_type_id); + } + return gee_tree_set_range_type_id__volatile; +} + + +static gpointer gee_tree_set_range_ref (gpointer instance) { + GeeTreeSetRange* self; + self = instance; + g_atomic_int_inc (&self->ref_count); + return instance; +} + + +static void gee_tree_set_range_unref (gpointer instance) { + GeeTreeSetRange* self; + self = instance; + if (g_atomic_int_dec_and_test (&self->ref_count)) { + GEE_TREE_SET_RANGE_GET_CLASS (self)->finalize (self); + g_type_free_instance ((GTypeInstance *) self); + } +} + + +static GeeTreeSetSubSet* gee_tree_set_sub_set_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer after, gconstpointer before) { + GeeTreeSetSubSet * self = NULL; + GeeTreeSet* _tmp0_; + GeeTreeSet* _tmp1_; + GeeTreeSet* _tmp2_; + gconstpointer _tmp3_; + gconstpointer _tmp4_; + GeeTreeSetRange* _tmp5_; + g_return_val_if_fail (set != NULL, NULL); + self = (GeeTreeSetSubSet*) gee_abstract_set_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = set; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->set); + self->priv->set = _tmp1_; + _tmp2_ = set; + _tmp3_ = after; + _tmp4_ = before; + _tmp5_ = gee_tree_set_range_new (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, _tmp2_, _tmp3_, _tmp4_); + _gee_tree_set_range_unref0 (self->priv->range); + self->priv->range = _tmp5_; + return self; +} + + +static GeeTreeSetSubSet* gee_tree_set_sub_set_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer after, gconstpointer before) { + return gee_tree_set_sub_set_construct (GEE_TREE_SET_TYPE_SUB_SET, g_type, g_dup_func, g_destroy_func, set, after, before); +} + + +static GeeTreeSetSubSet* gee_tree_set_sub_set_construct_head (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer before) { + GeeTreeSetSubSet * self = NULL; + GeeTreeSet* _tmp0_; + GeeTreeSet* _tmp1_; + GeeTreeSet* _tmp2_; + gconstpointer _tmp3_; + GeeTreeSetRange* _tmp4_; + g_return_val_if_fail (set != NULL, NULL); + self = (GeeTreeSetSubSet*) gee_abstract_set_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = set; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->set); + self->priv->set = _tmp1_; + _tmp2_ = set; + _tmp3_ = before; + _tmp4_ = gee_tree_set_range_new_head (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, _tmp2_, _tmp3_); + _gee_tree_set_range_unref0 (self->priv->range); + self->priv->range = _tmp4_; + return self; +} + + +static GeeTreeSetSubSet* gee_tree_set_sub_set_new_head (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer before) { + return gee_tree_set_sub_set_construct_head (GEE_TREE_SET_TYPE_SUB_SET, g_type, g_dup_func, g_destroy_func, set, before); +} + + +static GeeTreeSetSubSet* gee_tree_set_sub_set_construct_tail (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer after) { + GeeTreeSetSubSet * self = NULL; + GeeTreeSet* _tmp0_; + GeeTreeSet* _tmp1_; + GeeTreeSet* _tmp2_; + gconstpointer _tmp3_; + GeeTreeSetRange* _tmp4_; + g_return_val_if_fail (set != NULL, NULL); + self = (GeeTreeSetSubSet*) gee_abstract_set_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = set; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->set); + self->priv->set = _tmp1_; + _tmp2_ = set; + _tmp3_ = after; + _tmp4_ = gee_tree_set_range_new_tail (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, _tmp2_, _tmp3_); + _gee_tree_set_range_unref0 (self->priv->range); + self->priv->range = _tmp4_; + return self; +} + + +static GeeTreeSetSubSet* gee_tree_set_sub_set_new_tail (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, gconstpointer after) { + return gee_tree_set_sub_set_construct_tail (GEE_TREE_SET_TYPE_SUB_SET, g_type, g_dup_func, g_destroy_func, set, after); +} + + +static GeeTreeSetSubSet* gee_tree_set_sub_set_construct_from_range (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, GeeTreeSetRange* range) { + GeeTreeSetSubSet * self = NULL; + GeeTreeSet* _tmp0_; + GeeTreeSet* _tmp1_; + GeeTreeSetRange* _tmp2_; + GeeTreeSetRange* _tmp3_; + g_return_val_if_fail (set != NULL, NULL); + g_return_val_if_fail (range != NULL, NULL); + self = (GeeTreeSetSubSet*) gee_abstract_set_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = set; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->set); + self->priv->set = _tmp1_; + _tmp2_ = range; + _tmp3_ = _gee_tree_set_range_ref0 (_tmp2_); + _gee_tree_set_range_unref0 (self->priv->range); + self->priv->range = _tmp3_; + return self; +} + + +static GeeTreeSetSubSet* gee_tree_set_sub_set_new_from_range (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, GeeTreeSetRange* range) { + return gee_tree_set_sub_set_construct_from_range (GEE_TREE_SET_TYPE_SUB_SET, g_type, g_dup_func, g_destroy_func, set, range); +} + + +static gboolean gee_tree_set_sub_set_real_contains (GeeAbstractCollection* base, gconstpointer item) { + GeeTreeSetSubSet * self; + gboolean result = FALSE; + gboolean _tmp0_ = FALSE; + GeeTreeSetRange* _tmp1_; + gconstpointer _tmp2_; + gboolean _tmp3_ = FALSE; + gboolean _tmp7_; + self = (GeeTreeSetSubSet*) base; + _tmp1_ = self->priv->range; + _tmp2_ = item; + _tmp3_ = gee_tree_set_range_in_range (_tmp1_, _tmp2_); + if (_tmp3_) { + GeeTreeSet* _tmp4_; + gconstpointer _tmp5_; + gboolean _tmp6_ = FALSE; + _tmp4_ = self->priv->set; + _tmp5_ = item; + _tmp6_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp4_, _tmp5_); + _tmp0_ = _tmp6_; + } else { + _tmp0_ = FALSE; + } + _tmp7_ = _tmp0_; + result = _tmp7_; + return result; +} + + +static gboolean gee_tree_set_sub_set_real_add (GeeAbstractCollection* base, gconstpointer item) { + GeeTreeSetSubSet * self; + gboolean result = FALSE; + gboolean _tmp0_ = FALSE; + GeeTreeSetRange* _tmp1_; + gconstpointer _tmp2_; + gboolean _tmp3_ = FALSE; + gboolean _tmp7_; + self = (GeeTreeSetSubSet*) base; + _tmp1_ = self->priv->range; + _tmp2_ = item; + _tmp3_ = gee_tree_set_range_in_range (_tmp1_, _tmp2_); + if (_tmp3_) { + GeeTreeSet* _tmp4_; + gconstpointer _tmp5_; + gboolean _tmp6_ = FALSE; + _tmp4_ = self->priv->set; + _tmp5_ = item; + _tmp6_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp4_, _tmp5_); + _tmp0_ = _tmp6_; + } else { + _tmp0_ = FALSE; + } + _tmp7_ = _tmp0_; + result = _tmp7_; + return result; +} + + +static gboolean gee_tree_set_sub_set_real_remove (GeeAbstractCollection* base, gconstpointer item) { + GeeTreeSetSubSet * self; + gboolean result = FALSE; + gboolean _tmp0_ = FALSE; + GeeTreeSetRange* _tmp1_; + gconstpointer _tmp2_; + gboolean _tmp3_ = FALSE; + gboolean _tmp7_; + self = (GeeTreeSetSubSet*) base; + _tmp1_ = self->priv->range; + _tmp2_ = item; + _tmp3_ = gee_tree_set_range_in_range (_tmp1_, _tmp2_); + if (_tmp3_) { + GeeTreeSet* _tmp4_; + gconstpointer _tmp5_; + gboolean _tmp6_ = FALSE; + _tmp4_ = self->priv->set; + _tmp5_ = item; + _tmp6_ = gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp4_, _tmp5_); + _tmp0_ = _tmp6_; + } else { + _tmp0_ = FALSE; + } + _tmp7_ = _tmp0_; + result = _tmp7_; + return result; +} + + +static void gee_tree_set_sub_set_real_clear (GeeAbstractCollection* base) { + GeeTreeSetSubSet * self; + GeeIterator* _tmp0_ = NULL; + GeeIterator* iter; + self = (GeeTreeSetSubSet*) base; + _tmp0_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self); + iter = _tmp0_; + while (TRUE) { + GeeIterator* _tmp1_; + gboolean _tmp2_ = FALSE; + GeeIterator* _tmp3_; + _tmp1_ = iter; + _tmp2_ = gee_iterator_next (_tmp1_); + if (!_tmp2_) { + break; + } + _tmp3_ = iter; + gee_iterator_remove (_tmp3_); + } + _g_object_unref0 (iter); +} + + +static GeeIterator* gee_tree_set_sub_set_real_iterator (GeeAbstractCollection* base) { + GeeTreeSetSubSet * self; + GeeIterator* result = NULL; + GeeTreeSet* _tmp0_; + GeeTreeSetRange* _tmp1_; + GeeTreeSetSubIterator* _tmp2_; + self = (GeeTreeSetSubSet*) base; + _tmp0_ = self->priv->set; + _tmp1_ = self->priv->range; + _tmp2_ = gee_tree_set_sub_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp0_, _tmp1_); + result = (GeeIterator*) _tmp2_; + return result; +} + + +static GeeBidirIterator* gee_tree_set_sub_set_real_bidir_iterator (GeeSortedSet* base) { + GeeTreeSetSubSet * self; + GeeBidirIterator* result = NULL; + GeeTreeSet* _tmp0_; + GeeTreeSetRange* _tmp1_; + GeeTreeSetSubIterator* _tmp2_; + self = (GeeTreeSetSubSet*) base; + _tmp0_ = self->priv->set; + _tmp1_ = self->priv->range; + _tmp2_ = gee_tree_set_sub_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp0_, _tmp1_); + result = (GeeBidirIterator*) _tmp2_; + return result; +} + + +static gpointer gee_tree_set_sub_set_real_first (GeeSortedSet* base) { + GeeTreeSetSubSet * self; + gpointer result = NULL; + GeeTreeSetRange* _tmp0_; + GeeTreeSetNode* _tmp1_ = NULL; + GeeTreeSetNode* _first; + gconstpointer _tmp2_; + gpointer _tmp3_; + self = (GeeTreeSetSubSet*) base; + _tmp0_ = self->priv->range; + _tmp1_ = gee_tree_set_range_first (_tmp0_); + _first = _tmp1_; + _vala_assert (_first != NULL, "_first != null"); + _tmp2_ = _first->key; + _tmp3_ = ((_tmp2_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp2_) : ((gpointer) _tmp2_); + result = _tmp3_; + return result; +} + + +static gpointer gee_tree_set_sub_set_real_last (GeeSortedSet* base) { + GeeTreeSetSubSet * self; + gpointer result = NULL; + GeeTreeSetRange* _tmp0_; + GeeTreeSetNode* _tmp1_ = NULL; + GeeTreeSetNode* _last; + gconstpointer _tmp2_; + gpointer _tmp3_; + self = (GeeTreeSetSubSet*) base; + _tmp0_ = self->priv->range; + _tmp1_ = gee_tree_set_range_last (_tmp0_); + _last = _tmp1_; + _vala_assert (_last != NULL, "_last != null"); + _tmp2_ = _last->key; + _tmp3_ = ((_tmp2_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp2_) : ((gpointer) _tmp2_); + result = _tmp3_; + return result; +} + + +static GeeSortedSet* gee_tree_set_sub_set_real_head_set (GeeSortedSet* base, gconstpointer before) { + GeeTreeSetSubSet * self; + GeeSortedSet* result = NULL; + GeeTreeSet* _tmp0_; + GeeTreeSetRange* _tmp1_; + gconstpointer _tmp2_; + GeeTreeSetRange* _tmp3_ = NULL; + GeeTreeSetRange* _tmp4_; + GeeTreeSetSubSet* _tmp5_; + GeeSortedSet* _tmp6_; + self = (GeeTreeSetSubSet*) base; + _tmp0_ = self->priv->set; + _tmp1_ = self->priv->range; + _tmp2_ = before; + _tmp3_ = gee_tree_set_range_cut_tail (_tmp1_, _tmp2_); + _tmp4_ = _tmp3_; + _tmp5_ = gee_tree_set_sub_set_new_from_range (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp0_, _tmp4_); + _tmp6_ = (GeeSortedSet*) _tmp5_; + _gee_tree_set_range_unref0 (_tmp4_); + result = _tmp6_; + return result; +} + + +static GeeSortedSet* gee_tree_set_sub_set_real_tail_set (GeeSortedSet* base, gconstpointer after) { + GeeTreeSetSubSet * self; + GeeSortedSet* result = NULL; + GeeTreeSet* _tmp0_; + GeeTreeSetRange* _tmp1_; + gconstpointer _tmp2_; + GeeTreeSetRange* _tmp3_ = NULL; + GeeTreeSetRange* _tmp4_; + GeeTreeSetSubSet* _tmp5_; + GeeSortedSet* _tmp6_; + self = (GeeTreeSetSubSet*) base; + _tmp0_ = self->priv->set; + _tmp1_ = self->priv->range; + _tmp2_ = after; + _tmp3_ = gee_tree_set_range_cut_head (_tmp1_, _tmp2_); + _tmp4_ = _tmp3_; + _tmp5_ = gee_tree_set_sub_set_new_from_range (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp0_, _tmp4_); + _tmp6_ = (GeeSortedSet*) _tmp5_; + _gee_tree_set_range_unref0 (_tmp4_); + result = _tmp6_; + return result; +} + + +static GeeSortedSet* gee_tree_set_sub_set_real_sub_set (GeeSortedSet* base, gconstpointer after, gconstpointer before) { + GeeTreeSetSubSet * self; + GeeSortedSet* result = NULL; + GeeTreeSet* _tmp0_; + GeeTreeSetRange* _tmp1_; + gconstpointer _tmp2_; + gconstpointer _tmp3_; + GeeTreeSetRange* _tmp4_ = NULL; + GeeTreeSetRange* _tmp5_; + GeeTreeSetSubSet* _tmp6_; + GeeSortedSet* _tmp7_; + self = (GeeTreeSetSubSet*) base; + _tmp0_ = self->priv->set; + _tmp1_ = self->priv->range; + _tmp2_ = after; + _tmp3_ = before; + _tmp4_ = gee_tree_set_range_cut (_tmp1_, _tmp2_, _tmp3_); + _tmp5_ = _tmp4_; + _tmp6_ = gee_tree_set_sub_set_new_from_range (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp0_, _tmp5_); + _tmp7_ = (GeeSortedSet*) _tmp6_; + _gee_tree_set_range_unref0 (_tmp5_); + result = _tmp7_; + return result; +} + + +static GeeBidirIterator* gee_tree_set_sub_set_real_iterator_at (GeeSortedSet* base, gconstpointer item) { + GeeTreeSetSubSet * self; + GeeBidirIterator* result = NULL; + GeeTreeSetRange* _tmp0_; + gconstpointer _tmp1_; + gboolean _tmp2_ = FALSE; + GeeTreeSet* _tmp3_; + gconstpointer _tmp4_; + GeeTreeSetNode* _tmp5_ = NULL; + GeeTreeSetNode* n; + GeeTreeSetNode* _tmp6_; + GeeTreeSet* _tmp7_; + GeeTreeSetRange* _tmp8_; + GeeTreeSetNode* _tmp9_; + GeeTreeSetSubIterator* _tmp10_; + self = (GeeTreeSetSubSet*) base; + _tmp0_ = self->priv->range; + _tmp1_ = item; + _tmp2_ = gee_tree_set_range_in_range (_tmp0_, _tmp1_); + if (!_tmp2_) { + result = NULL; + return result; + } + _tmp3_ = self->priv->set; + _tmp4_ = item; + _tmp5_ = gee_tree_set_find_node (_tmp3_, _tmp4_); + n = _tmp5_; + _tmp6_ = n; + if (_tmp6_ == NULL) { + result = NULL; + return result; + } + _tmp7_ = self->priv->set; + _tmp8_ = self->priv->range; + _tmp9_ = n; + _tmp10_ = gee_tree_set_sub_iterator_new_pointing (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp7_, _tmp8_, _tmp9_); + result = (GeeBidirIterator*) _tmp10_; + return result; +} + + +static gpointer gee_tree_set_sub_set_real_lower (GeeSortedSet* base, gconstpointer item) { + GeeTreeSetSubSet * self; + gpointer result = NULL; + GeeTreeSetRange* _tmp0_; + gconstpointer _tmp1_; + gint _tmp2_ = 0; + gint res; + gint _tmp3_; + GeeTreeSet* _tmp5_; + gconstpointer _tmp6_; + gpointer _tmp7_ = NULL; + gpointer l; + gconstpointer _tmp8_ = NULL; + gboolean _tmp9_ = FALSE; + gconstpointer _tmp10_; + gboolean _tmp14_; + gconstpointer _tmp16_; + gpointer _tmp17_; + self = (GeeTreeSetSubSet*) base; + _tmp0_ = self->priv->range; + _tmp1_ = item; + _tmp2_ = gee_tree_set_range_compare_range (_tmp0_, _tmp1_); + res = _tmp2_; + _tmp3_ = res; + if (_tmp3_ > 0) { + gpointer _tmp4_ = NULL; + _tmp4_ = gee_sorted_set_last ((GeeSortedSet*) self); + result = _tmp4_; + return result; + } + _tmp5_ = self->priv->set; + _tmp6_ = item; + _tmp7_ = gee_sorted_set_lower ((GeeSortedSet*) _tmp5_, _tmp6_); + l = _tmp7_; + _tmp10_ = l; + if (_tmp10_ != NULL) { + GeeTreeSetRange* _tmp11_; + gconstpointer _tmp12_; + gboolean _tmp13_ = FALSE; + _tmp11_ = self->priv->range; + _tmp12_ = l; + _tmp13_ = gee_tree_set_range_in_range (_tmp11_, _tmp12_); + _tmp9_ = _tmp13_; + } else { + _tmp9_ = FALSE; + } + _tmp14_ = _tmp9_; + if (_tmp14_) { + gconstpointer _tmp15_; + _tmp15_ = l; + _tmp8_ = _tmp15_; + } else { + _tmp8_ = NULL; + } + _tmp16_ = _tmp8_; + _tmp17_ = ((_tmp16_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp16_) : ((gpointer) _tmp16_); + result = _tmp17_; + ((l == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (l = (self->priv->g_destroy_func (l), NULL)); + return result; +} + + +static gpointer gee_tree_set_sub_set_real_higher (GeeSortedSet* base, gconstpointer item) { + GeeTreeSetSubSet * self; + gpointer result = NULL; + GeeTreeSetRange* _tmp0_; + gconstpointer _tmp1_; + gint _tmp2_ = 0; + gint res; + gint _tmp3_; + GeeTreeSet* _tmp5_; + gconstpointer _tmp6_; + gpointer _tmp7_ = NULL; + gpointer h; + gconstpointer _tmp8_ = NULL; + gboolean _tmp9_ = FALSE; + gconstpointer _tmp10_; + gboolean _tmp14_; + gconstpointer _tmp16_; + gpointer _tmp17_; + self = (GeeTreeSetSubSet*) base; + _tmp0_ = self->priv->range; + _tmp1_ = item; + _tmp2_ = gee_tree_set_range_compare_range (_tmp0_, _tmp1_); + res = _tmp2_; + _tmp3_ = res; + if (_tmp3_ < 0) { + gpointer _tmp4_ = NULL; + _tmp4_ = gee_sorted_set_first ((GeeSortedSet*) self); + result = _tmp4_; + return result; + } + _tmp5_ = self->priv->set; + _tmp6_ = item; + _tmp7_ = gee_sorted_set_higher ((GeeSortedSet*) _tmp5_, _tmp6_); + h = _tmp7_; + _tmp10_ = h; + if (_tmp10_ != NULL) { + GeeTreeSetRange* _tmp11_; + gconstpointer _tmp12_; + gboolean _tmp13_ = FALSE; + _tmp11_ = self->priv->range; + _tmp12_ = h; + _tmp13_ = gee_tree_set_range_in_range (_tmp11_, _tmp12_); + _tmp9_ = _tmp13_; + } else { + _tmp9_ = FALSE; + } + _tmp14_ = _tmp9_; + if (_tmp14_) { + gconstpointer _tmp15_; + _tmp15_ = h; + _tmp8_ = _tmp15_; + } else { + _tmp8_ = NULL; + } + _tmp16_ = _tmp8_; + _tmp17_ = ((_tmp16_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp16_) : ((gpointer) _tmp16_); + result = _tmp17_; + ((h == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (h = (self->priv->g_destroy_func (h), NULL)); + return result; +} + + +static gpointer gee_tree_set_sub_set_real_floor (GeeSortedSet* base, gconstpointer item) { + GeeTreeSetSubSet * self; + gpointer result = NULL; + GeeTreeSetRange* _tmp0_; + gconstpointer _tmp1_; + gint _tmp2_ = 0; + gint res; + gint _tmp3_; + GeeTreeSet* _tmp5_; + gconstpointer _tmp6_; + gpointer _tmp7_ = NULL; + gpointer l; + gconstpointer _tmp8_ = NULL; + gboolean _tmp9_ = FALSE; + gconstpointer _tmp10_; + gboolean _tmp14_; + gconstpointer _tmp16_; + gpointer _tmp17_; + self = (GeeTreeSetSubSet*) base; + _tmp0_ = self->priv->range; + _tmp1_ = item; + _tmp2_ = gee_tree_set_range_compare_range (_tmp0_, _tmp1_); + res = _tmp2_; + _tmp3_ = res; + if (_tmp3_ > 0) { + gpointer _tmp4_ = NULL; + _tmp4_ = gee_sorted_set_last ((GeeSortedSet*) self); + result = _tmp4_; + return result; + } + _tmp5_ = self->priv->set; + _tmp6_ = item; + _tmp7_ = gee_sorted_set_floor ((GeeSortedSet*) _tmp5_, _tmp6_); + l = _tmp7_; + _tmp10_ = l; + if (_tmp10_ != NULL) { + GeeTreeSetRange* _tmp11_; + gconstpointer _tmp12_; + gboolean _tmp13_ = FALSE; + _tmp11_ = self->priv->range; + _tmp12_ = l; + _tmp13_ = gee_tree_set_range_in_range (_tmp11_, _tmp12_); + _tmp9_ = _tmp13_; + } else { + _tmp9_ = FALSE; + } + _tmp14_ = _tmp9_; + if (_tmp14_) { + gconstpointer _tmp15_; + _tmp15_ = l; + _tmp8_ = _tmp15_; + } else { + _tmp8_ = NULL; + } + _tmp16_ = _tmp8_; + _tmp17_ = ((_tmp16_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp16_) : ((gpointer) _tmp16_); + result = _tmp17_; + ((l == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (l = (self->priv->g_destroy_func (l), NULL)); + return result; +} + + +static gpointer gee_tree_set_sub_set_real_ceil (GeeSortedSet* base, gconstpointer item) { + GeeTreeSetSubSet * self; + gpointer result = NULL; + GeeTreeSetRange* _tmp0_; + gconstpointer _tmp1_; + gint _tmp2_ = 0; + gint res; + gint _tmp3_; + GeeTreeSet* _tmp5_; + gconstpointer _tmp6_; + gpointer _tmp7_ = NULL; + gpointer h; + gconstpointer _tmp8_ = NULL; + gboolean _tmp9_ = FALSE; + gconstpointer _tmp10_; + gboolean _tmp14_; + gconstpointer _tmp16_; + gpointer _tmp17_; + self = (GeeTreeSetSubSet*) base; + _tmp0_ = self->priv->range; + _tmp1_ = item; + _tmp2_ = gee_tree_set_range_compare_range (_tmp0_, _tmp1_); + res = _tmp2_; + _tmp3_ = res; + if (_tmp3_ < 0) { + gpointer _tmp4_ = NULL; + _tmp4_ = gee_sorted_set_first ((GeeSortedSet*) self); + result = _tmp4_; + return result; + } + _tmp5_ = self->priv->set; + _tmp6_ = item; + _tmp7_ = gee_sorted_set_ceil ((GeeSortedSet*) _tmp5_, _tmp6_); + h = _tmp7_; + _tmp10_ = h; + if (_tmp10_ != NULL) { + GeeTreeSetRange* _tmp11_; + gconstpointer _tmp12_; + gboolean _tmp13_ = FALSE; + _tmp11_ = self->priv->range; + _tmp12_ = h; + _tmp13_ = gee_tree_set_range_in_range (_tmp11_, _tmp12_); + _tmp9_ = _tmp13_; + } else { + _tmp9_ = FALSE; + } + _tmp14_ = _tmp9_; + if (_tmp14_) { + gconstpointer _tmp15_; + _tmp15_ = h; + _tmp8_ = _tmp15_; + } else { + _tmp8_ = NULL; + } + _tmp16_ = _tmp8_; + _tmp17_ = ((_tmp16_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp16_) : ((gpointer) _tmp16_); + result = _tmp17_; + ((h == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (h = (self->priv->g_destroy_func (h), NULL)); + return result; +} + + +static gint gee_tree_set_sub_set_real_get_size (GeeAbstractCollection* base) { + gint result; + GeeTreeSetSubSet* self; + gint i; + GeeIterator* _tmp0_ = NULL; + GeeIterator* iterator; + gint _tmp4_; + self = (GeeTreeSetSubSet*) base; + i = 0; + _tmp0_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self); + iterator = _tmp0_; + while (TRUE) { + GeeIterator* _tmp1_; + gboolean _tmp2_ = FALSE; + gint _tmp3_; + _tmp1_ = iterator; + _tmp2_ = gee_iterator_next (_tmp1_); + if (!_tmp2_) { + break; + } + _tmp3_ = i; + i = _tmp3_ + 1; + } + _tmp4_ = i; + result = _tmp4_; + _g_object_unref0 (iterator); + return result; +} + + +static gboolean gee_tree_set_sub_set_real_get_is_empty (GeeAbstractCollection* base) { + gboolean result; + GeeTreeSetSubSet* self; + GeeTreeSetRange* _tmp0_; + gboolean _tmp1_ = FALSE; + self = (GeeTreeSetSubSet*) base; + _tmp0_ = self->priv->range; + _tmp1_ = gee_tree_set_range_empty_subset (_tmp0_); + result = _tmp1_; + return result; +} + + +static void gee_tree_set_sub_set_class_init (GeeTreeSetSubSetClass * klass) { + gee_tree_set_sub_set_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTreeSetSubSetPrivate)); + GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains = gee_tree_set_sub_set_real_contains; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add = gee_tree_set_sub_set_real_add; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove = gee_tree_set_sub_set_real_remove; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->clear = gee_tree_set_sub_set_real_clear; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->iterator = gee_tree_set_sub_set_real_iterator; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_size = gee_tree_set_sub_set_real_get_size; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_is_empty = gee_tree_set_sub_set_real_get_is_empty; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_tree_set_sub_set_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_tree_set_sub_set_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_tree_set_sub_set_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_SET_SUB_SET_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_SET_SUB_SET_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_SET_SUB_SET_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_SET_SUB_SET_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_SET_SUB_SET_IS_EMPTY, g_param_spec_boolean ("is-empty", "is-empty", "is-empty", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_tree_set_sub_set_gee_sorted_set_interface_init (GeeSortedSetIface * iface) { + gee_tree_set_sub_set_gee_sorted_set_parent_iface = g_type_interface_peek_parent (iface); + iface->bidir_iterator = (GeeBidirIterator* (*)(GeeSortedSet*)) gee_tree_set_sub_set_real_bidir_iterator; + iface->first = (gpointer (*)(GeeSortedSet*)) gee_tree_set_sub_set_real_first; + iface->last = (gpointer (*)(GeeSortedSet*)) gee_tree_set_sub_set_real_last; + iface->head_set = (GeeSortedSet* (*)(GeeSortedSet*, gconstpointer)) gee_tree_set_sub_set_real_head_set; + iface->tail_set = (GeeSortedSet* (*)(GeeSortedSet*, gconstpointer)) gee_tree_set_sub_set_real_tail_set; + iface->sub_set = (GeeSortedSet* (*)(GeeSortedSet*, gconstpointer, gconstpointer)) gee_tree_set_sub_set_real_sub_set; + iface->iterator_at = (GeeBidirIterator* (*)(GeeSortedSet*, gconstpointer)) gee_tree_set_sub_set_real_iterator_at; + iface->lower = (gpointer (*)(GeeSortedSet*, gconstpointer)) gee_tree_set_sub_set_real_lower; + iface->higher = (gpointer (*)(GeeSortedSet*, gconstpointer)) gee_tree_set_sub_set_real_higher; + iface->floor = (gpointer (*)(GeeSortedSet*, gconstpointer)) gee_tree_set_sub_set_real_floor; + iface->ceil = (gpointer (*)(GeeSortedSet*, gconstpointer)) gee_tree_set_sub_set_real_ceil; +} + + +static void gee_tree_set_sub_set_instance_init (GeeTreeSetSubSet * self) { + self->priv = GEE_TREE_SET_SUB_SET_GET_PRIVATE (self); +} + + +static void gee_tree_set_sub_set_finalize (GObject* obj) { + GeeTreeSetSubSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TREE_SET_TYPE_SUB_SET, GeeTreeSetSubSet); + _g_object_unref0 (self->priv->set); + _gee_tree_set_range_unref0 (self->priv->range); + G_OBJECT_CLASS (gee_tree_set_sub_set_parent_class)->finalize (obj); +} + + +static GType gee_tree_set_sub_set_get_type (void) { + static volatile gsize gee_tree_set_sub_set_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_set_sub_set_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTreeSetSubSetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tree_set_sub_set_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTreeSetSubSet), 0, (GInstanceInitFunc) gee_tree_set_sub_set_instance_init, NULL }; + static const GInterfaceInfo gee_sorted_set_info = { (GInterfaceInitFunc) gee_tree_set_sub_set_gee_sorted_set_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_tree_set_sub_set_type_id; + gee_tree_set_sub_set_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_SET, "GeeTreeSetSubSet", &g_define_type_info, 0); + g_type_add_interface_static (gee_tree_set_sub_set_type_id, GEE_TYPE_SORTED_SET, &gee_sorted_set_info); + g_once_init_leave (&gee_tree_set_sub_set_type_id__volatile, gee_tree_set_sub_set_type_id); + } + return gee_tree_set_sub_set_type_id__volatile; +} + + +static void _vala_gee_tree_set_sub_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeTreeSetSubSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_SET_TYPE_SUB_SET, GeeTreeSetSubSet); + switch (property_id) { + case GEE_TREE_SET_SUB_SET_SIZE: + g_value_set_int (value, gee_abstract_collection_get_size ((GeeAbstractCollection*) self)); + break; + case GEE_TREE_SET_SUB_SET_IS_EMPTY: + g_value_set_boolean (value, gee_abstract_collection_get_is_empty ((GeeAbstractCollection*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_tree_set_sub_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeTreeSetSubSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_SET_TYPE_SUB_SET, GeeTreeSetSubSet); + switch (property_id) { + case GEE_TREE_SET_SUB_SET_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_TREE_SET_SUB_SET_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_SET_SUB_SET_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static GeeTreeSetSubIterator* gee_tree_set_sub_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, GeeTreeSetRange* range) { + GeeTreeSetSubIterator * self = NULL; + GeeTreeSet* _tmp0_; + GeeTreeSet* _tmp1_; + GeeTreeSetRange* _tmp2_; + GeeTreeSetRange* _tmp3_; + g_return_val_if_fail (set != NULL, NULL); + g_return_val_if_fail (range != NULL, NULL); + self = (GeeTreeSetSubIterator*) g_object_new (object_type, NULL); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = set; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->set); + self->priv->set = _tmp1_; + _tmp2_ = range; + _tmp3_ = _gee_tree_set_range_ref0 (_tmp2_); + _gee_tree_set_range_unref0 (self->priv->range); + self->priv->range = _tmp3_; + return self; +} + + +static GeeTreeSetSubIterator* gee_tree_set_sub_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, GeeTreeSetRange* range) { + return gee_tree_set_sub_iterator_construct (GEE_TREE_SET_TYPE_SUB_ITERATOR, g_type, g_dup_func, g_destroy_func, set, range); +} + + +static GeeTreeSetSubIterator* gee_tree_set_sub_iterator_construct_pointing (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, GeeTreeSetRange* range, GeeTreeSetNode* node) { + GeeTreeSetSubIterator * self = NULL; + GeeTreeSet* _tmp0_; + GeeTreeSet* _tmp1_; + GeeTreeSetRange* _tmp2_; + GeeTreeSetRange* _tmp3_; + GeeTreeSet* _tmp4_; + GeeTreeSetNode* _tmp5_; + GeeTreeSetIterator* _tmp6_; + g_return_val_if_fail (set != NULL, NULL); + g_return_val_if_fail (range != NULL, NULL); + g_return_val_if_fail (node != NULL, NULL); + self = (GeeTreeSetSubIterator*) g_object_new (object_type, NULL); + self->priv->g_type = g_type; + self->priv->g_dup_func = g_dup_func; + self->priv->g_destroy_func = g_destroy_func; + _tmp0_ = set; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->set); + self->priv->set = _tmp1_; + _tmp2_ = range; + _tmp3_ = _gee_tree_set_range_ref0 (_tmp2_); + _gee_tree_set_range_unref0 (self->priv->range); + self->priv->range = _tmp3_; + _tmp4_ = set; + _tmp5_ = node; + _tmp6_ = gee_tree_set_iterator_new_pointing (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, _tmp4_, _tmp5_); + _g_object_unref0 (self->priv->iterator); + self->priv->iterator = _tmp6_; + return self; +} + + +static GeeTreeSetSubIterator* gee_tree_set_sub_iterator_new_pointing (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeTreeSet* set, GeeTreeSetRange* range, GeeTreeSetNode* node) { + return gee_tree_set_sub_iterator_construct_pointing (GEE_TREE_SET_TYPE_SUB_ITERATOR, g_type, g_dup_func, g_destroy_func, set, range, node); +} + + +static gboolean gee_tree_set_sub_iterator_real_next (GeeIterator* base) { + GeeTreeSetSubIterator * self; + gboolean result = FALSE; + GeeTreeSetIterator* _tmp0_; + self = (GeeTreeSetSubIterator*) base; + _tmp0_ = self->priv->iterator; + if (_tmp0_ != NULL) { + gpointer next = NULL; + gboolean _tmp1_ = FALSE; + GeeTreeSetIterator* _tmp2_; + gpointer _tmp3_ = NULL; + gboolean _tmp4_ = FALSE; + gboolean _tmp8_; + _tmp2_ = self->priv->iterator; + _tmp4_ = gee_tree_set_iterator_safe_next_get (_tmp2_, &_tmp3_); + ((next == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (next = (self->priv->g_destroy_func (next), NULL)); + next = _tmp3_; + if (_tmp4_) { + GeeTreeSetRange* _tmp5_; + gconstpointer _tmp6_; + gboolean _tmp7_ = FALSE; + _tmp5_ = self->priv->range; + _tmp6_ = next; + _tmp7_ = gee_tree_set_range_in_range (_tmp5_, _tmp6_); + _tmp1_ = _tmp7_; + } else { + _tmp1_ = FALSE; + } + _tmp8_ = _tmp1_; + if (_tmp8_) { + GeeTreeSetIterator* _tmp9_; + gboolean _tmp10_ = FALSE; + _tmp9_ = self->priv->iterator; + _tmp10_ = gee_iterator_next ((GeeIterator*) _tmp9_); + _vala_assert (_tmp10_, "iterator.next ()"); + result = TRUE; + ((next == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (next = (self->priv->g_destroy_func (next), NULL)); + return result; + } else { + result = FALSE; + ((next == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (next = (self->priv->g_destroy_func (next), NULL)); + return result; + } + ((next == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (next = (self->priv->g_destroy_func (next), NULL)); + } else { + gboolean _tmp11_ = FALSE; + _tmp11_ = gee_iterator_first ((GeeIterator*) self); + result = _tmp11_; + return result; + } +} + + +static gboolean gee_tree_set_sub_iterator_real_has_next (GeeIterator* base) { + GeeTreeSetSubIterator * self; + gboolean result = FALSE; + GeeTreeSetIterator* _tmp0_; + self = (GeeTreeSetSubIterator*) base; + _tmp0_ = self->priv->iterator; + if (_tmp0_ != NULL) { + gpointer next = NULL; + gboolean _tmp1_ = FALSE; + GeeTreeSetIterator* _tmp2_; + gpointer _tmp3_ = NULL; + gboolean _tmp4_ = FALSE; + gboolean _tmp8_; + _tmp2_ = self->priv->iterator; + _tmp4_ = gee_tree_set_iterator_safe_next_get (_tmp2_, &_tmp3_); + ((next == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (next = (self->priv->g_destroy_func (next), NULL)); + next = _tmp3_; + if (_tmp4_) { + GeeTreeSetRange* _tmp5_; + gconstpointer _tmp6_; + gboolean _tmp7_ = FALSE; + _tmp5_ = self->priv->range; + _tmp6_ = next; + _tmp7_ = gee_tree_set_range_in_range (_tmp5_, _tmp6_); + _tmp1_ = _tmp7_; + } else { + _tmp1_ = FALSE; + } + _tmp8_ = _tmp1_; + result = _tmp8_; + ((next == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (next = (self->priv->g_destroy_func (next), NULL)); + return result; + } else { + GeeTreeSetRange* _tmp9_; + GeeTreeSetNode* _tmp10_ = NULL; + _tmp9_ = self->priv->range; + _tmp10_ = gee_tree_set_range_first (_tmp9_); + result = _tmp10_ != NULL; + return result; + } +} + + +static gboolean gee_tree_set_sub_iterator_real_first (GeeIterator* base) { + GeeTreeSetSubIterator * self; + gboolean result = FALSE; + GeeTreeSetRange* _tmp0_; + GeeTreeSetNode* _tmp1_ = NULL; + GeeTreeSetNode* node; + GeeTreeSetNode* _tmp2_; + GeeTreeSet* _tmp3_; + GeeTreeSetNode* _tmp4_; + GeeTreeSetIterator* _tmp5_; + self = (GeeTreeSetSubIterator*) base; + _tmp0_ = self->priv->range; + _tmp1_ = gee_tree_set_range_first (_tmp0_); + node = _tmp1_; + _tmp2_ = node; + if (_tmp2_ == NULL) { + result = FALSE; + return result; + } + _tmp3_ = self->priv->set; + _tmp4_ = node; + _tmp5_ = gee_tree_set_iterator_new_pointing (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp3_, _tmp4_); + _g_object_unref0 (self->priv->iterator); + self->priv->iterator = _tmp5_; + result = TRUE; + return result; +} + + +static gboolean gee_tree_set_sub_iterator_real_previous (GeeBidirIterator* base) { + GeeTreeSetSubIterator * self; + gboolean result = FALSE; + GeeTreeSetIterator* _tmp0_; + gpointer prev = NULL; + gboolean _tmp1_ = FALSE; + GeeTreeSetIterator* _tmp2_; + gpointer _tmp3_ = NULL; + gboolean _tmp4_ = FALSE; + gboolean _tmp8_; + self = (GeeTreeSetSubIterator*) base; + _tmp0_ = self->priv->iterator; + if (_tmp0_ == NULL) { + result = FALSE; + return result; + } + _tmp2_ = self->priv->iterator; + _tmp4_ = gee_tree_set_iterator_safe_previous_get (_tmp2_, &_tmp3_); + ((prev == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (prev = (self->priv->g_destroy_func (prev), NULL)); + prev = _tmp3_; + if (_tmp4_) { + GeeTreeSetRange* _tmp5_; + gconstpointer _tmp6_; + gboolean _tmp7_ = FALSE; + _tmp5_ = self->priv->range; + _tmp6_ = prev; + _tmp7_ = gee_tree_set_range_in_range (_tmp5_, _tmp6_); + _tmp1_ = _tmp7_; + } else { + _tmp1_ = FALSE; + } + _tmp8_ = _tmp1_; + if (_tmp8_) { + GeeTreeSetIterator* _tmp9_; + gboolean _tmp10_ = FALSE; + _tmp9_ = self->priv->iterator; + _tmp10_ = gee_bidir_iterator_previous ((GeeBidirIterator*) _tmp9_); + _vala_assert (_tmp10_, "iterator.previous ()"); + result = TRUE; + ((prev == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (prev = (self->priv->g_destroy_func (prev), NULL)); + return result; + } else { + result = FALSE; + ((prev == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (prev = (self->priv->g_destroy_func (prev), NULL)); + return result; + } + ((prev == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (prev = (self->priv->g_destroy_func (prev), NULL)); +} + + +static gboolean gee_tree_set_sub_iterator_real_has_previous (GeeBidirIterator* base) { + GeeTreeSetSubIterator * self; + gboolean result = FALSE; + GeeTreeSetIterator* _tmp0_; + gpointer prev = NULL; + gboolean _tmp1_ = FALSE; + GeeTreeSetIterator* _tmp2_; + gpointer _tmp3_ = NULL; + gboolean _tmp4_ = FALSE; + gboolean _tmp8_; + self = (GeeTreeSetSubIterator*) base; + _tmp0_ = self->priv->iterator; + if (_tmp0_ == NULL) { + result = FALSE; + return result; + } + _tmp2_ = self->priv->iterator; + _tmp4_ = gee_tree_set_iterator_safe_previous_get (_tmp2_, &_tmp3_); + ((prev == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (prev = (self->priv->g_destroy_func (prev), NULL)); + prev = _tmp3_; + if (_tmp4_) { + GeeTreeSetRange* _tmp5_; + gconstpointer _tmp6_; + gboolean _tmp7_ = FALSE; + _tmp5_ = self->priv->range; + _tmp6_ = prev; + _tmp7_ = gee_tree_set_range_in_range (_tmp5_, _tmp6_); + _tmp1_ = _tmp7_; + } else { + _tmp1_ = FALSE; + } + _tmp8_ = _tmp1_; + result = _tmp8_; + ((prev == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (prev = (self->priv->g_destroy_func (prev), NULL)); + return result; +} + + +static gboolean gee_tree_set_sub_iterator_real_last (GeeBidirIterator* base) { + GeeTreeSetSubIterator * self; + gboolean result = FALSE; + GeeTreeSetRange* _tmp0_; + GeeTreeSetNode* _tmp1_ = NULL; + GeeTreeSetNode* node; + GeeTreeSetNode* _tmp2_; + GeeTreeSet* _tmp3_; + GeeTreeSetNode* _tmp4_; + GeeTreeSetIterator* _tmp5_; + self = (GeeTreeSetSubIterator*) base; + _tmp0_ = self->priv->range; + _tmp1_ = gee_tree_set_range_last (_tmp0_); + node = _tmp1_; + _tmp2_ = node; + if (_tmp2_ == NULL) { + result = FALSE; + return result; + } + _tmp3_ = self->priv->set; + _tmp4_ = node; + _tmp5_ = gee_tree_set_iterator_new_pointing (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp3_, _tmp4_); + _g_object_unref0 (self->priv->iterator); + self->priv->iterator = _tmp5_; + result = TRUE; + return result; +} + + +static gpointer gee_tree_set_sub_iterator_real_get (GeeIterator* base) { + GeeTreeSetSubIterator * self; + gpointer result = NULL; + GeeTreeSetIterator* _tmp0_; + GeeTreeSetIterator* _tmp1_; + gpointer _tmp2_ = NULL; + self = (GeeTreeSetSubIterator*) base; + _tmp0_ = self->priv->iterator; + _vala_assert (_tmp0_ != NULL, "iterator != null"); + _tmp1_ = self->priv->iterator; + _tmp2_ = gee_iterator_get ((GeeIterator*) _tmp1_); + result = _tmp2_; + return result; +} + + +static void gee_tree_set_sub_iterator_real_remove (GeeIterator* base) { + GeeTreeSetSubIterator * self; + GeeTreeSetIterator* _tmp0_; + GeeTreeSetIterator* _tmp1_; + self = (GeeTreeSetSubIterator*) base; + _tmp0_ = self->priv->iterator; + _vala_assert (_tmp0_ != NULL, "iterator != null"); + _tmp1_ = self->priv->iterator; + gee_iterator_remove ((GeeIterator*) _tmp1_); +} + + +static void gee_tree_set_sub_iterator_class_init (GeeTreeSetSubIteratorClass * klass) { + gee_tree_set_sub_iterator_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTreeSetSubIteratorPrivate)); + G_OBJECT_CLASS (klass)->get_property = _vala_gee_tree_set_sub_iterator_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_tree_set_sub_iterator_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_tree_set_sub_iterator_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_SET_SUB_ITERATOR_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_SET_SUB_ITERATOR_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_SET_SUB_ITERATOR_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); +} + + +static void gee_tree_set_sub_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) { + gee_tree_set_sub_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->next = (gboolean (*)(GeeIterator*)) gee_tree_set_sub_iterator_real_next; + iface->has_next = (gboolean (*)(GeeIterator*)) gee_tree_set_sub_iterator_real_has_next; + iface->first = (gboolean (*)(GeeIterator*)) gee_tree_set_sub_iterator_real_first; + iface->get = (gpointer (*)(GeeIterator*)) gee_tree_set_sub_iterator_real_get; + iface->remove = (void (*)(GeeIterator*)) gee_tree_set_sub_iterator_real_remove; +} + + +static void gee_tree_set_sub_iterator_gee_bidir_iterator_interface_init (GeeBidirIteratorIface * iface) { + gee_tree_set_sub_iterator_gee_bidir_iterator_parent_iface = g_type_interface_peek_parent (iface); + iface->previous = (gboolean (*)(GeeBidirIterator*)) gee_tree_set_sub_iterator_real_previous; + iface->has_previous = (gboolean (*)(GeeBidirIterator*)) gee_tree_set_sub_iterator_real_has_previous; + iface->last = (gboolean (*)(GeeBidirIterator*)) gee_tree_set_sub_iterator_real_last; +} + + +static void gee_tree_set_sub_iterator_instance_init (GeeTreeSetSubIterator * self) { + self->priv = GEE_TREE_SET_SUB_ITERATOR_GET_PRIVATE (self); + self->priv->iterator = NULL; +} + + +static void gee_tree_set_sub_iterator_finalize (GObject* obj) { + GeeTreeSetSubIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TREE_SET_TYPE_SUB_ITERATOR, GeeTreeSetSubIterator); + _g_object_unref0 (self->priv->set); + _gee_tree_set_range_unref0 (self->priv->range); + _g_object_unref0 (self->priv->iterator); + G_OBJECT_CLASS (gee_tree_set_sub_iterator_parent_class)->finalize (obj); +} + + +static GType gee_tree_set_sub_iterator_get_type (void) { + static volatile gsize gee_tree_set_sub_iterator_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_set_sub_iterator_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTreeSetSubIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tree_set_sub_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTreeSetSubIterator), 0, (GInstanceInitFunc) gee_tree_set_sub_iterator_instance_init, NULL }; + static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_tree_set_sub_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + static const GInterfaceInfo gee_bidir_iterator_info = { (GInterfaceInitFunc) gee_tree_set_sub_iterator_gee_bidir_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_tree_set_sub_iterator_type_id; + gee_tree_set_sub_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeTreeSetSubIterator", &g_define_type_info, 0); + g_type_add_interface_static (gee_tree_set_sub_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info); + g_type_add_interface_static (gee_tree_set_sub_iterator_type_id, GEE_TYPE_BIDIR_ITERATOR, &gee_bidir_iterator_info); + g_once_init_leave (&gee_tree_set_sub_iterator_type_id__volatile, gee_tree_set_sub_iterator_type_id); + } + return gee_tree_set_sub_iterator_type_id__volatile; +} + + +static void _vala_gee_tree_set_sub_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeTreeSetSubIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_SET_TYPE_SUB_ITERATOR, GeeTreeSetSubIterator); + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_tree_set_sub_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeTreeSetSubIterator * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TREE_SET_TYPE_SUB_ITERATOR, GeeTreeSetSubIterator); + switch (property_id) { + case GEE_TREE_SET_SUB_ITERATOR_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_TREE_SET_SUB_ITERATOR_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_SET_SUB_ITERATOR_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void gee_tree_set_class_init (GeeTreeSetClass * klass) { + gee_tree_set_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTreeSetPrivate)); + GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains = gee_tree_set_real_contains; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->add = gee_tree_set_real_add; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove = gee_tree_set_real_remove; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->clear = gee_tree_set_real_clear; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->iterator = gee_tree_set_real_iterator; + GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_size = gee_tree_set_real_get_size; + G_OBJECT_CLASS (klass)->get_property = _vala_gee_tree_set_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_gee_tree_set_set_property; + G_OBJECT_CLASS (klass)->finalize = gee_tree_set_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_SET_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_SET_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_SET_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + /** + * {@inheritDoc} + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_SET_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + /** + * The elements' comparator function. + */ + g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_TREE_SET_COMPARE_FUNC, g_param_spec_pointer ("compare-func", "compare-func", "compare-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +} + + +static void gee_tree_set_gee_sorted_set_interface_init (GeeSortedSetIface * iface) { + gee_tree_set_gee_sorted_set_parent_iface = g_type_interface_peek_parent (iface); + iface->bidir_iterator = (GeeBidirIterator* (*)(GeeSortedSet*)) gee_tree_set_real_bidir_iterator; + iface->first = (gpointer (*)(GeeSortedSet*)) gee_tree_set_real_first; + iface->last = (gpointer (*)(GeeSortedSet*)) gee_tree_set_real_last; + iface->head_set = (GeeSortedSet* (*)(GeeSortedSet*, gconstpointer)) gee_tree_set_real_head_set; + iface->tail_set = (GeeSortedSet* (*)(GeeSortedSet*, gconstpointer)) gee_tree_set_real_tail_set; + iface->sub_set = (GeeSortedSet* (*)(GeeSortedSet*, gconstpointer, gconstpointer)) gee_tree_set_real_sub_set; + iface->iterator_at = (GeeBidirIterator* (*)(GeeSortedSet*, gconstpointer)) gee_tree_set_real_iterator_at; + iface->lower = (gpointer (*)(GeeSortedSet*, gconstpointer)) gee_tree_set_real_lower; + iface->higher = (gpointer (*)(GeeSortedSet*, gconstpointer)) gee_tree_set_real_higher; + iface->floor = (gpointer (*)(GeeSortedSet*, gconstpointer)) gee_tree_set_real_floor; + iface->ceil = (gpointer (*)(GeeSortedSet*, gconstpointer)) gee_tree_set_real_ceil; +} + + +static void gee_tree_set_instance_init (GeeTreeSet * self) { + self->priv = GEE_TREE_SET_GET_PRIVATE (self); + self->priv->_size = 0; + self->priv->root = NULL; + self->priv->_first = NULL; + self->priv->_last = NULL; + self->priv->stamp = 0; +} + + +static void gee_tree_set_finalize (GObject* obj) { + GeeTreeSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_TREE_SET, GeeTreeSet); + _gee_tree_set_node_free0 (self->priv->root); + G_OBJECT_CLASS (gee_tree_set_parent_class)->finalize (obj); +} + + +/** + * Left-leaning red-black tree implementation of the {@link Set} interface. + * + * This implementation is especially well designed for large quantity of + * data. The (balanced) tree implementation insure that the set and get + * methods are in logarithmic complexity. For a linear implementation see + * {@link HashSet}. + * + * @see HashSet + */ +GType gee_tree_set_get_type (void) { + static volatile gsize gee_tree_set_type_id__volatile = 0; + if (g_once_init_enter (&gee_tree_set_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTreeSetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_tree_set_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTreeSet), 0, (GInstanceInitFunc) gee_tree_set_instance_init, NULL }; + static const GInterfaceInfo gee_sorted_set_info = { (GInterfaceInitFunc) gee_tree_set_gee_sorted_set_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType gee_tree_set_type_id; + gee_tree_set_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_SET, "GeeTreeSet", &g_define_type_info, 0); + g_type_add_interface_static (gee_tree_set_type_id, GEE_TYPE_SORTED_SET, &gee_sorted_set_info); + g_once_init_leave (&gee_tree_set_type_id__volatile, gee_tree_set_type_id); + } + return gee_tree_set_type_id__volatile; +} + + +static void _vala_gee_tree_set_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GeeTreeSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_TREE_SET, GeeTreeSet); + switch (property_id) { + case GEE_TREE_SET_SIZE: + g_value_set_int (value, gee_abstract_collection_get_size ((GeeAbstractCollection*) self)); + break; + case GEE_TREE_SET_COMPARE_FUNC: + g_value_set_pointer (value, gee_tree_set_get_compare_func (self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_gee_tree_set_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GeeTreeSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_TREE_SET, GeeTreeSet); + switch (property_id) { + case GEE_TREE_SET_COMPARE_FUNC: + gee_tree_set_set_compare_func (self, g_value_get_pointer (value)); + break; + case GEE_TREE_SET_G_TYPE: + self->priv->g_type = g_value_get_gtype (value); + break; + case GEE_TREE_SET_G_DUP_FUNC: + self->priv->g_dup_func = g_value_get_pointer (value); + break; + case GEE_TREE_SET_G_DESTROY_FUNC: + self->priv->g_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + diff --git a/gee/treeset.vala b/gee/treeset.vala new file mode 100644 index 0000000..3548cf1 --- /dev/null +++ b/gee/treeset.vala @@ -0,0 +1,1078 @@ +/* treeset.vala + * + * Copyright (C) 2009 Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Maciej Piechotka + */ + +using GLib; + +/** + * Left-leaning red-black tree implementation of the {@link Set} interface. + * + * This implementation is especially well designed for large quantity of + * data. The (balanced) tree implementation insure that the set and get + * methods are in logarithmic complexity. For a linear implementation see + * {@link HashSet}. + * + * @see HashSet + */ +public class Gee.TreeSet : AbstractSet, SortedSet { + /** + * {@inheritDoc} + */ + public override int size { + get {return _size;} + } + + /** + * The elements' comparator function. + */ + public CompareFunc compare_func { private set; get; } + + private int _size = 0; + + /** + * Constructs a new, empty tree set sorted according to the specified + * comparator function. + * + * If not provided, the function parameter is requested to the + * {@link Functions} function factory methods. + * + * @param compare_func an optional element comparator function + */ + public TreeSet (CompareFunc? compare_func = null) { + if (compare_func == null) { + compare_func = Functions.get_compare_func_for (typeof (G)); + } + this.compare_func = compare_func; + } + + /** + * {@inheritDoc} + */ + public override bool contains (G item) { + weak Node? cur = root; + while (cur != null) { + int res = compare_func (item, cur.key); + if (res == 0) { + return true; + } else if (res < 0) { + cur = cur.left; + } else { + cur = cur.right; + } + } + return false; + } + + private inline void rotate_right (ref Node root) { + Node pivot = (owned) root.left; + pivot.color = root.color; + root.color = Node.Color.RED; + root.left = (owned) pivot.right; + pivot.right = (owned) root; + root = (owned) pivot; +#if DEBUG + stdout.printf (dump ("after rotate right on %s".printf ((string)root.right.key))); +#endif + } + + private inline void rotate_left (ref Node root) { + Node pivot = (owned) root.right; + pivot.color = root.color; + root.color = Node.Color.RED; + root.right = (owned) pivot.left; + pivot.left = (owned) root; + root = (owned) pivot; +#if DEBUG + stdout.printf (dump ("after rotate left on %s".printf ((string)root.left.key))); +#endif + } + + private inline bool is_red (Node? n) { + return n != null && n.color == Node.Color.RED; + } + + private inline bool is_black (Node? n) { + return n == null || n.color == Node.Color.BLACK; + } + + private inline void fix_up (ref Node node) { +#if DEBUG + var n = (string)node.key; +#endif + if (is_black (node.left) && is_red (node.right)) { + rotate_left (ref node); + } + if (is_red (node.left) && is_red (node.left.left)) { + rotate_right (ref node); + } + if (is_red (node.left) && is_red (node.right)) { + node.flip (); + } +#if DEBUG + stdout.printf (dump ("after fix up on %s".printf (n))); +#endif + } + + private bool add_to_node (ref Node? node, owned G item, Node? prev, Node? next) { +#if DEBUG + if (node != null) + stdout.printf ("Adding %s to %s\n".printf ((string) item, (string) node.key)); +#endif + if (node == null) { + node = new Node ((owned) item, prev, next); + if (prev == null) { + _first = node; + } + if (next == null) { + _last = node; + } + _size++; + return true; + } + + int cmp = compare_func (item, node.key); + if (cmp == 0) { + fix_up (ref node); + return false; + } else if (cmp < 0) { + bool r = add_to_node (ref node.left, item, node.prev, node); + fix_up (ref node); + return r; + } else { + bool r = add_to_node (ref node.right, item, node, node.next); + fix_up (ref node); + return r; + } + } + + /** + * {@inheritDoc} + * + * If the element already exists in the set it will not be added twice. + */ + public override bool add (G item) { +#if CONSISTENCY_CHECKS + check (); +#endif + bool r = add_to_node (ref root, item, null, null); + root.color = Node.Color.BLACK; +#if CONSISTENCY_CHECKS + check (); +#endif + stamp++; + return r; + } + + private inline void move_red_left (ref Node root) { +#if DEBUG + var n = (string)root.key; +#endif + root.flip (); + if (is_red (root.right.left)) { + rotate_right (ref root.right); + rotate_left (ref root); + root.flip (); + } +#if DEBUG + stdout.printf (dump ("after red left on %s".printf (n))); +#endif + } + + private inline void move_red_right (ref Node root) { +#if DEBUG + var n = (string)root.key; +#endif + root.flip (); + if (is_red (root.left.left)) { + rotate_right (ref root); + root.flip (); + } +#if DEBUG + stdout.printf (dump ("after red right on %s".printf (n))); +#endif + } + + private inline void fix_removal (ref Node node, out G? key = null) { + Node n = (owned)node; + if (&key != null) + key = (owned) n.key; + else + n.key = null; + if (n.prev != null) { + n.prev.next = n.next; + } else { + _first = n.next; + } + if (n.next != null) { + n.next.prev = n.prev; + } else { + _last = n.prev; + } + node = null; + _size--; + } + + private void remove_minimal (ref Node node, out G key) { + if (node.left == null) { + fix_removal (ref node, out key); + return; + } + + if (is_black (node.left) && is_black (node.left.left)) { + move_red_left (ref node); + } + + remove_minimal (ref node.left, out key); + + fix_up (ref node); + } + + private bool remove_from_node (ref Node? node, G item, out unowned Node? prev = null, out unowned Node? next = null) { +#if DEBUG + stdout.printf ("Removing %s from %s\n", (string)item, node != null ? (string)node.key : null); +#endif + if (node == null) { + return false; + } else if (compare_func (item, node.key) < 0) { + weak Node left = node.left; + if (left == null) { + return false; + } + if (is_black (left) && is_black (left.left)) { + move_red_left (ref node); + } + bool r = remove_from_node (ref node.left, item, out prev, out next); + fix_up (ref node); + return r; + } else { + if (is_red (node.left)) { + rotate_right (ref node); + } + + weak Node? r = node.right; + if (compare_func (item, node.key) == 0 && r == null) { + if (&prev != null) + prev = node.prev; + if (&next != null) + next = node.next; + fix_removal (ref node, null); + return true; + } + if (is_black (r) && r != null && is_black (r.left)) { + move_red_right (ref node); + } + if (compare_func (item, node.key) == 0) { + if (&prev != null) + prev = node.prev; + if (&next != null) + next = node; + remove_minimal (ref node.right, out node.key); + fix_up (ref node); + return true; + } else { + bool re = remove_from_node (ref node.right, item, out prev, out next); + fix_up (ref node); + return re; + } + } + } + + /** + * {@inheritDoc} + */ + public override bool remove (G item) { +#if CONSISTENCY_CHECKS + check (); +#endif + bool b = remove_from_node (ref root, item); + if (root != null) { + root.color = Node.Color.BLACK; + } +#if CONSISTENCY_CHECKS + check (); +#endif + stamp++; + return b; + } + + private inline void clear_subtree (owned Node node) { + node.key = null; + if (node.left != null) + clear_subtree ((owned) node.left); + if (node.right != null) + clear_subtree ((owned) node.right); + } + + /** + * {@inheritDoc} + */ + public override void clear () { + if (root != null) { + clear_subtree ((owned) root); + _first = _last = null; + } + _size = 0; + stamp++; + } + + /** + * {@inheritDoc} + */ + public override Gee.Iterator iterator () { + return new Iterator (this); + } + + /** + * {@inheritDoc} + */ + public BidirIterator bidir_iterator () { + return new Iterator (this); + } + + private inline G? lift_null_get (Node? node) { + return node != null ? node.key : null; + } + + /** + * {@inheritDoc} + */ + public G first () { + assert (_first != null); + return _first.key; + } + + /** + * {@inheritDoc} + */ + public G last () { + assert (_last != null); + return _last.key; + } + + /** + * {@inheritDoc} + */ + public SortedSet head_set (G before) { + return new SubSet.head (this, before); + } + + /** + * {@inheritDoc} + */ + public SortedSet tail_set (G after) { + return new SubSet.tail (this, after); + } + + /** + * {@inheritDoc} + */ + public SortedSet sub_set (G after, G before) { + return new SubSet (this, after, before); + } + + private inline unowned Node? find_node (G item) { + weak Node? cur = root; + while (cur != null) { + int res = compare_func (item, cur.key); + if (res == 0) { + return cur; + } else if (res < 0) { + cur = cur.left; + } else { + cur = cur.right; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + public BidirIterator? iterator_at (G item) { + weak Node? node = find_node (item); + return node != null ? new Iterator.pointing (this, node) : null; + } + + private inline unowned Node? find_nearest (G item) { + weak Node? cur = root; + while (cur != null) { + int res = compare_func (item, cur.key); + if (res == 0) { + return cur; + } else if (res < 0) { + if (cur.left == null) + return cur; + cur = cur.left; + } else { + if (cur.right == null) + return cur; + cur = cur.right; + } + } + return null; + } + + private inline unowned Node? find_lower (G item) { + weak Node? node = find_nearest (item); + if (node == null) + return null; + return compare_func (item, node.key) <= 0 ? node.prev : node; + } + + private inline unowned Node? find_higher (G item) { + weak Node? node = find_nearest (item); + if (node == null) + return null; + return compare_func (item, node.key) >= 0 ? node.next : node; + } + + private inline unowned Node? find_floor (G item) { + weak Node? node = find_nearest (item); + if (node == null) + return null; + return compare_func (item, node.key) < 0 ? node.prev : node; + } + + private inline unowned Node? find_ceil (G item) { + weak Node? node = find_nearest (item); + if (node == null) + return null; + return compare_func (item, node.key) > 0 ? node.next : node; + } + + /** + * {@inheritDoc} + */ + public G? lower (G item) { + return lift_null_get (find_lower (item)); + } + + /** + * {@inheritDoc} + */ + public G? higher (G item) { + return lift_null_get (find_higher (item)); + } + + /** + * {@inheritDoc} + */ + public G? floor (G item) { + return lift_null_get (find_floor (item)); + } + + /** + * {@inheritDoc} + */ + public G? ceil (G item) { + return lift_null_get (find_ceil (item)); + } + +#if CONSISTENCY_CHECKS + public inline void check () { + check_subtree (root); + assert (root == null || root.color == Node.Color.BLACK); +#if DEBUG + stdout.printf ("%s\n", dump ()); +#endif + } + + private inline uint check_subtree (Node? node) { + if (node == null) + return 0; + assert (! (is_black (node.left) && is_red (node.right))); // Check left-leaning + assert (! (is_red (node) && is_red (node.left))); // Check red property + uint l = check_subtree (node.left); + uint r = check_subtree (node.right); + assert (l == r); + return l + (node.color == Node.Color.BLACK ? 1 : 0); + } +#endif +#if DEBUG + public string dump (string? when = null) { + return "TreeSet dump%s:\n%s".printf (when == null ? "" : (" " + when), dump_node (root)); + } + + private inline string dump_node (Node? node, uint depth = 0) { + if (node != null) + return dump_node (node.left, depth + 1) + + "%s%s%p(%s)\033[0m\n".printf (string.nfill (depth, ' '), + node.color == Node.Color.RED ? "\033[0;31m" : "", + node, (string)node.key) + + dump_node (node.right, depth + 1); + return ""; + } +#endif + + [Compact] + private class Node { + public enum Color { + RED, + BLACK; + + public Color flip () { + if (this == RED) { + return BLACK; + } else { + return RED; + } + } + } + + public Node (owned G node, Node? prev, Node? next) { + this.key = (owned) node; + this.color = Color.RED; + this.prev = prev; + this.next = next; + if (prev != null) { + prev.next = this; + } + if (next != null) { + next.prev = this; + } + } + + public void flip () { + color = color.flip (); + if (left != null) { + left.color = left.color.flip (); + } + if (right != null) { + right.color = right.color.flip (); + } + } + + public G key; + public Color color; + public Node? left; + public Node? right; + public weak Node? prev; + public weak Node? next; + } + + private class Iterator : Object, Gee.Iterator, BidirIterator { + private TreeSet _set; + + // concurrent modification protection + private int stamp; + + public Iterator (TreeSet set) { + _set = set; + stamp = _set.stamp; + } + + public Iterator.pointing (TreeSet set, Node current) { + this._set = set; + this.current = current; + this.stamp = set.stamp; + this.started = true; + } + + public bool next () { + assert (stamp == _set.stamp); + if (current != null) { + if (current.next != null) { + current = current.next; + return true; + } else { + return false; + } + } else if (!started) { + current = _set._first; + started = true; + return current != null; + } else { + current = _next; + if (current != null) { + _next = null; + _prev = null; + } + return current != null; + } + } + + public bool has_next () { + assert (stamp == _set.stamp); + return (!started && _set._first != null) || + (current == null && _next != null) || + (current != null && current.next != null); + } + + public bool first () { + assert (stamp == _set.stamp); + current = _set._first; + _next = null; + _prev = null; + started = true; + return current != null; // on false it is null anyway + } + + public bool previous () { + assert (stamp == _set.stamp); + if (current != null) { + if (current.prev != null) { + current = current.prev; + return true; + } else { + return false; + } + } else { + if (_prev != null) { + current = _prev; + _next = null; + _prev = null; + return true; + } else { + return false; + } + } + } + + public bool has_previous () { + assert (stamp == _set.stamp); + return (current == null && _prev != null) || + (current != null && current.prev != null); + } + + public bool last () { + assert (stamp == _set.stamp); + current = _set._last; + _next = null; + _prev = null; + started = true; + return current != null; // on false it is null anyway + } + + public new G get () { + assert (stamp == _set.stamp); + assert (current != null); + return current.key; + } + + public void remove () { + assert (stamp == _set.stamp); + assert (current != null); + bool success = _set.remove_from_node (ref _set.root, current.key, out _prev, out _next); + assert (success); + if (_set.root != null) + _set.root.color = Node.Color.BLACK; + current = null; + assert (stamp++ == _set.stamp++); + } + + internal bool safe_next_get (out G val) { + if (current != null) { + val = _set.lift_null_get (current.next); + return current.next != null; + } else { + val = _set.lift_null_get (_next); + return _next != null; + } + } + + internal bool safe_previous_get (out G val) { + if (current != null) { + val = _set.lift_null_get (current.prev); + return current.prev != null; + } else { + val = _set.lift_null_get (_prev); + return _next != null; + } + } + + private weak Node? current = null; + private weak Node? _next = null; + private weak Node? _prev = null; + private bool started = false; + } + + private inline G min (G a, G b) { + return compare_func (a, b) <= 0 ? a : b; + } + + private inline G max (G a, G b) { + return compare_func (a, b) > 0 ? a : b; + } + + private class Range { + public Range (TreeSet set, G after, G before) { + this.set = set; + if (set.compare_func (after, before) < 0) { + this.after = after; + this.before = before; + type = RangeType.BOUNDED; + } else { + type = RangeType.EMPTY; + } + } + + public Range.head (TreeSet set, G before) { + this.set = set; + this.before = before; + type = RangeType.HEAD; + } + + public Range.tail (TreeSet set, G after) { + this.set = set; + this.after = after; + type = RangeType.TAIL; + } + +#if false + public Range.empty (TreeSet set) { + this.set = set; + type = RangeType.EMPTY; + } +#endif + + public Range cut_head (G after) { + switch (type) { + case RangeType.HEAD: + return new Range (set, after, before); + case RangeType.TAIL: + return new Range.tail (set, set.max (after, this.after)); + case RangeType.EMPTY: + return this; + case RangeType.BOUNDED: + var _after = set.max (after, this.after); + return new Range (set, _after, before); + default: + assert_not_reached (); + } + } + + public Range cut_tail (G before) { + switch (type) { + case RangeType.HEAD: + return new Range.head (set, set.min (before, this.before)); + case RangeType.TAIL: + return new Range (set, after, before); + case RangeType.EMPTY: + return this; + case RangeType.BOUNDED: + var _before = set.min (before, this.before); + return new Range (set, after, _before); + default: + assert_not_reached (); + } + } + + public Range cut (G after, G before) { + if (type == RangeType.EMPTY) + return this; + var _before = type != RangeType.TAIL ? set.min (before, this.before) : before; + var _after = type != RangeType.HEAD ? set.max (after, this.after) : after; + return new Range (set, _after, _before); + } + + public bool in_range (G item) { + return type == RangeType.EMPTY ? false : compare_range (item) == 0; + } + + public int compare_range (G item) { + switch (type) { + case RangeType.HEAD: + return set.compare_func (item, before) < 0 ? 0 : 1; + case RangeType.TAIL: + return set.compare_func (item, after) >= 0 ? 0 : -1; + case RangeType.EMPTY: + return 0; // For simplicity - please make sure it does not break anything + case RangeType.BOUNDED: + return set.compare_func (item, after) >= 0 ? + (set.compare_func (item, before) < 0 ? 0 : 1) : -1; + default: + assert_not_reached (); + } + } + + public bool empty_subset () { + switch (type) { + case RangeType.HEAD: + return set._first == null || !in_range (set._first.key); + case RangeType.TAIL: + return set._last == null || !in_range (set._last.key); + case RangeType.EMPTY: + return true; + case RangeType.BOUNDED: + return first () == null; + default: + assert_not_reached (); + } + } + + public unowned Node? first () { + switch (type) { + case RangeType.EMPTY: + return null; + case RangeType.HEAD: + return set._first; + default: + return set.find_floor (after); + } + } + + public unowned Node? last () { + switch (type) { + case RangeType.EMPTY: + return null; + case RangeType.TAIL: + return set._last; + default: + return set.find_lower (before); + } + } + + private new TreeSet set; + private G after; + private G before; + private RangeType type; + } + + private enum RangeType { + HEAD, + TAIL, + EMPTY, + BOUNDED + } + + private class SubSet : AbstractSet, SortedSet { + public SubSet (TreeSet set, G after, G before) { + this.set = set; + this.range = new Range (set, after, before); + } + + public SubSet.head (TreeSet set, G before) { + this.set = set; + this.range = new Range.head (set, before); + } + + public SubSet.tail (TreeSet set, G after) { + this.set = set; + this.range = new Range.tail (set, after); + } + + public SubSet.from_range (TreeSet set, Range range) { + this.set = set; + this.range = range; + } + + public override int size { + get { + var i = 0; + Gee.Iterator iterator = iterator (); + while (iterator.next ()) + i++; + return i; + } + } + + public override bool is_empty { + get { + return range.empty_subset (); + } + } + + public override bool contains (G item) { + return range.in_range (item) && set.contains (item); + } + + public override bool add (G item) { + return range.in_range (item) && set.add (item); + } + + public override bool remove (G item) { + return range.in_range (item) && set.remove (item); + } + + public override void clear () { + var iter = iterator (); + while (iter.next ()) { + iter.remove (); + } + } + + public override Gee.Iterator iterator () { + return new SubIterator (set, range); + } + + public BidirIterator bidir_iterator () { + return new SubIterator (set, range); + } + + public G first () { + weak Node? _first = range.first (); + assert (_first != null); + return _first.key; + } + + public G last () { + weak Node? _last = range.last (); + assert (_last != null); + return _last.key; + } + + public SortedSet head_set (G before) { + return new SubSet.from_range (set, range.cut_tail (before)); + } + + public SortedSet tail_set (G after) { + return new SubSet.from_range (set, range.cut_head (after)); + } + + public SortedSet sub_set (G after, G before) { + return new SubSet.from_range (set, range.cut (after, before)); + } + + public BidirIterator? iterator_at (G item) { + if (!range.in_range (item)) + return null; + weak Node? n = set.find_node (item); + if (n == null) + return null; + return new SubIterator.pointing (set, range, n); + } + + public G? lower (G item) { + var res = range.compare_range (item); + if (res > 0) + return last (); + var l = set.lower (item); + return l != null && range.in_range (l) ? l : null; + } + + public G? higher (G item) { + var res = range.compare_range (item); + if (res < 0) + return first (); + var h = set.higher (item); + return h != null && range.in_range (h) ? h : null; + } + + public G? floor (G item) { + var res = range.compare_range (item); + if (res > 0) + return last (); + var l = set.floor (item); + return l != null && range.in_range (l) ? l : null; + } + + public G? ceil (G item) { + var res = range.compare_range (item); + if (res < 0) + return first (); + var h = set.ceil (item); + return h != null && range.in_range (h) ? h : null; + } + + private new TreeSet set; + private Range range; + } + + private class SubIterator : Object, Gee.Iterator, BidirIterator { + public SubIterator (TreeSet set, Range range) { + this.set = set; + this.range = range; + } + + public SubIterator.pointing (TreeSet set, Range range, Node node) { + this.set = set; + this.range = range; + this.iterator = new Iterator.pointing (set, node); + } + + public bool next () { + if (iterator != null) { + G next; + if (iterator.safe_next_get (out next) && range.in_range (next)) { + assert (iterator.next ()); + return true; + } else { + return false; + } + } else { + return first (); + } + } + + public bool has_next () { + if (iterator != null) { + G next; + return (iterator.safe_next_get (out next) && range.in_range (next)); + } else { + return range.first () != null; + } + } + + public bool first () { + weak Node? node = range.first (); + if (node == null) + return false; + iterator = new Iterator.pointing (set, node); + return true; + } + + public bool previous () { + if (iterator == null) + return false; + G prev; + if (iterator.safe_previous_get (out prev) && range.in_range (prev)) { + assert (iterator.previous ()); + return true; + } else { + return false; + } + } + + public bool has_previous () { + if (iterator == null) + return false; + G prev; + return iterator.safe_previous_get (out prev) && range.in_range (prev); + } + + public bool last () { + weak Node? node = range.last (); + if (node == null) + return false; + iterator = new Iterator.pointing (set, node); + return true; + } + + public new G get () { + assert (iterator != null); + return iterator.get (); + } + + public void remove () { + assert (iterator != null); + iterator.remove (); + } + + private new TreeSet set; + private Range range; + private Iterator? iterator = null; + } + + private Node? root = null; + private weak Node? _first = null; + private weak Node? _last = null; + private int stamp = 0; +} diff --git a/gitlog-to-changelog b/gitlog-to-changelog new file mode 100755 index 0000000..0a94b9e --- /dev/null +++ b/gitlog-to-changelog @@ -0,0 +1,175 @@ +#!/usr/bin/perl +# Convert git log output to ChangeLog format. + +my $VERSION = '2008-12-21 12:07'; # UTC +# The definition above must lie within the first 8 lines in order +# for the Emacs time-stamp write hook (at end) to update it. +# If you change this file with Emacs, please let the write hook +# do its job. Otherwise, update this string manually. + +# Copyright (C) 2008 Free Software Foundation, Inc. + +# 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 3 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, see . + +# Written by Jim Meyering + +use strict; +use warnings; +use Getopt::Long; +use POSIX qw(strftime); + +(my $ME = $0) =~ s|.*/||; + +# use File::Coda; # http://meyering.net/code/Coda/ +END { + defined fileno STDOUT or return; + close STDOUT and return; + warn "$ME: failed to close standard output: $!\n"; + $? ||= 1; +} + +sub usage ($) +{ + my ($exit_code) = @_; + my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR); + if ($exit_code != 0) + { + print $STREAM "Try `$ME --help' for more information.\n"; + } + else + { + print $STREAM < ChangeLog + $ME -- -n 5 foo > last-5-commits-to-branch-foo + +EOF + } + exit $exit_code; +} + +# If the string $S is a well-behaved file name, simply return it. +# If it contains white space, quotes, etc., quote it, and return the new string. +sub shell_quote($) +{ + my ($s) = @_; + if ($s =~ m![^\w+/.,-]!) + { + # Convert each single quote to '\'' + $s =~ s/\'/\'\\\'\'/g; + # Then single quote the string. + $s = "'$s'"; + } + return $s; +} + +sub quoted_cmd(@) +{ + return join (' ', map {shell_quote $_} @_); +} + +{ + my $since_date = '1970-01-01 UTC'; + GetOptions + ( + help => sub { usage 0 }, + version => sub { print "$ME version $VERSION\n"; exit }, + 'since=s' => \$since_date, + ) or usage 1; + + my @cmd = (qw (git log --log-size), "--since=$since_date", + '--pretty=format:%ct %an <%ae>%n%n%s%n%b%n', @ARGV); + open PIPE, '-|', @cmd + or die ("$ME: failed to run `". quoted_cmd (@cmd) ."': $!\n" + . "(Is your Git too old? Version 1.5.1 or later is required.)\n"); + + my $prev_date_line = ''; + while (1) + { + defined (my $in = ) + or last; + $in =~ /^log size (\d+)$/ + or die "$ME:$.: Invalid line (expected log size):\n$in"; + my $log_nbytes = $1; + + my $log; + my $n_read = read PIPE, $log, $log_nbytes; + $n_read == $log_nbytes + or die "$ME:$.: unexpected EOF\n"; + + my @line = split "\n", $log; + my $author_line = shift @line; + defined $author_line + or die "$ME:$.: unexpected EOF\n"; + $author_line =~ /^(\d+) (.*>)$/ + or die "$ME:$.: Invalid line " + . "(expected date/author/email):\n$author_line\n"; + + my $date_line = sprintf "%s $2\n", strftime ("%F", localtime ($1)); + # If this line would be the same as the previous date/name/email + # line, then arrange not to print it. + if ($date_line ne $prev_date_line) + { + $prev_date_line eq '' + or print "\n"; + print $date_line; + } + $prev_date_line = $date_line; + + # Omit "Signed-off-by..." lines. + @line = grep !/^Signed-off-by: .*>$/, @line; + + # Remove leading and trailing blank lines. + while ($line[0] =~ /^\s*$/) { shift @line; } + while ($line[$#line] =~ /^\s*$/) { pop @line; } + + # Prefix each non-empty line with a TAB. + @line = map { length $_ ? "\t$_" : '' } @line; + + print "\n", join ("\n", @line), "\n"; + + defined ($in = ) + or last; + $in ne "\n" + and die "$ME:$.: unexpected line:\n$in"; + } + + close PIPE + or die "$ME: error closing pipe from " . quoted_cmd (@cmd) . "\n"; + # FIXME-someday: include $PROCESS_STATUS in the diagnostic +} + +# Local Variables: +# indent-tabs-mode: nil +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "my $VERSION = '" +# time-stamp-format: "%:y-%02m-%02d %02H:%02M" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "'; # UTC" +# End: diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..a9244eb --- /dev/null +++ b/install-sh @@ -0,0 +1,527 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2011-01-19.21; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + # Protect names problematic for `test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for `test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for `test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/ltmain.sh b/ltmain.sh new file mode 100644 index 0000000..0096fe6 --- /dev/null +++ b/ltmain.sh @@ -0,0 +1,9661 @@ + +# libtool (GNU libtool) 2.4.2 +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool 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. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Usage: $progname [OPTION]... [MODE-ARG]... +# +# Provide generalized library-building support services. +# +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --no-quiet, --no-silent +# print informational messages (default) +# --no-warn don't display warning messages +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print more informational messages than default +# --no-verbose don't print the extra informational messages +# --version print version information +# -h, --help, --help-all print short, long, or detailed help message +# +# MODE must be one of the following: +# +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory +# +# MODE-ARGS vary depending on the MODE. When passed as first option, +# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. +# +# When reporting a bug, please describe a test case to reproduce it and +# include the following information: +# +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu2 +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to . +# GNU libtool home page: . +# General help using GNU software: . + +PROGRAM=libtool +PACKAGE=libtool +VERSION="2.4.2 Debian-2.4.2-1ubuntu2" +TIMESTAMP="" +package_revision=1.3337 + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# NLS nuisances: We save the old values to restore during execute mode. +lt_user_locale= +lt_safe_locale= +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" + fi" +done +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL + +$lt_unset CDPATH + + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + + + +: ${CP="cp -f"} +test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} +: ${Xsed="$SED -e 1s/^X//"} + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +exit_status=$EXIT_SUCCESS + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +dirname="s,/[^/]*$,," +basename="s,^.*/,," + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} # func_dirname may be replaced by extended shell implementation + + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "${1}" | $SED "$basename"` +} # func_basename may be replaced by extended shell implementation + + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` +} # func_dirname_and_basename may be replaced by extended shell implementation + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname may be replaced by extended shell implementation + + +# These SED scripts presuppose an absolute path with a trailing slash. +pathcar='s,^/\([^/]*\).*$,\1,' +pathcdr='s,^/[^/]*,,' +removedotparts=':dotsl + s@/\./@/@g + t dotsl + s,/\.$,/,' +collapseslashes='s@/\{1,\}@/@g' +finalslash='s,/*$,/,' + +# func_normal_abspath PATH +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +# value returned in "$func_normal_abspath_result" +func_normal_abspath () +{ + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` + while :; do + # Processed it all yet? + if test "$func_normal_abspath_tpath" = / ; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result" ; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + +# func_relative_path SRCDIR DSTDIR +# generates a relative path from SRCDIR to DSTDIR, with a trailing +# slash if non-empty, suitable for immediately appending a filename +# without needing to append a separator. +# value returned in "$func_relative_path_result" +func_relative_path () +{ + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=${func_dirname_result} + if test "x$func_relative_path_tlibdir" = x ; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test "x$func_stripname_result" != x ; then + func_relative_path_result=${func_relative_path_result}/${func_stripname_result} + fi + + # Normalisation. If bindir is libdir, return empty string, + # else relative path ending with a slash; either way, target + # file name can be directly appended. + if test ! -z "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result/" + func_relative_path_result=$func_stripname_result + fi +} + +# The name of this program: +func_dirname_and_basename "$progpath" +progname=$func_basename_result + +# Make sure we have an absolute path for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=$func_dirname_result + progdir=`cd "$progdir" && pwd` + progpath="$progdir/$progname" + ;; + *) + save_IFS="$IFS" + IFS=${PATH_SEPARATOR-:} + for progdir in $PATH; do + IFS="$save_IFS" + test -x "$progdir/$progname" && break + done + IFS="$save_IFS" + test -n "$progdir" || progdir=`pwd` + progpath="$progdir/$progname" + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed="${SED}"' -e 1s/^X//' +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' + +# Sed substitution that converts a w32 file name or path +# which contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-`\' parameter expansions in output of double_quote_subst that were +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' +# in input to double_quote_subst, that '$' was protected from expansion. +# Since each input `\' is now two `\'s, look for any number of runs of +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. +bs='\\' +bs2='\\\\' +bs4='\\\\\\\\' +dollar='\$' +sed_double_backslash="\ + s/$bs4/&\\ +/g + s/^$bs2$dollar/$bs&/ + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g + s/\n//g" + +# Standard options: +opt_dry_run=false +opt_help=false +opt_quiet=false +opt_verbose=false +opt_warning=: + +# func_echo arg... +# Echo program name prefixed message, along with the current mode +# name if it has been set yet. +func_echo () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }$*" +} + +# func_verbose arg... +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $opt_verbose && func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +# func_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 +} + +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +} + +# func_fatal_error arg... +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + +# func_fatal_help arg... +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + func_error ${1+"$@"} + func_fatal_error "$help" +} +help="Try \`$progname --help' for more information." ## default + + +# func_grep expression filename +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_mkdir_p directory-path +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + my_directory_path="$1" + my_dir_list= + + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + + # Protect directory names starting with `-' + case $my_directory_path in + -*) my_directory_path="./$my_directory_path" ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$my_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + my_dir_list="$my_directory_path:$my_dir_list" + + # If the last portion added has no slash in it, the list is done + case $my_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` + done + my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` + + save_mkdir_p_IFS="$IFS"; IFS=':' + for my_dir in $my_dir_list; do + IFS="$save_mkdir_p_IFS" + # mkdir can fail with a `File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$my_dir" 2>/dev/null || : + done + IFS="$save_mkdir_p_IFS" + + # Bail out if we (or some other process) failed to create a directory. + test -d "$my_directory_path" || \ + func_fatal_error "Failed to create \`$1'" + fi +} + + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$opt_dry_run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || \ + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" + fi + + $ECHO "$my_tmpdir" +} + + +# func_quote_for_eval arg +# Aesthetically quote ARG to be evaled later. +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT +# is double-quoted, suitable for a subsequent eval, whereas +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters +# which are still active within double quotes backslashified. +func_quote_for_eval () +{ + case $1 in + *[\\\`\"\$]*) + func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; + *) + func_quote_for_eval_unquoted_result="$1" ;; + esac + + case $func_quote_for_eval_unquoted_result in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and and variable + # expansion for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + ;; + *) + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + esac +} + + +# func_quote_for_expand arg +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + case $1 in + *[\\\`\"]*) + my_arg=`$ECHO "$1" | $SED \ + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; + *) + my_arg="$1" ;; + esac + + case $my_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + my_arg="\"$my_arg\"" + ;; + esac + + func_quote_for_expand_result="$my_arg" +} + + +# func_show_eval cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$my_cmd" + my_status=$? + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + +# func_show_eval_locale cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$lt_user_locale + $my_cmd" + my_status=$? + eval "$lt_safe_locale" + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + +# func_tr_sh +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} + + +# func_version +# Echo version message to standard output and exit. +func_version () +{ + $opt_debug + + $SED -n '/(C)/!b go + :more + /\./!{ + N + s/\n# / / + b more + } + :go + /^# '$PROGRAM' (GNU /,/# warranty; / { + s/^# // + s/^# *$// + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ + p + }' < "$progpath" + exit $? +} + +# func_usage +# Echo short help message to standard output and exit. +func_usage () +{ + $opt_debug + + $SED -n '/^# Usage:/,/^# *.*--help/ { + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p + }' < "$progpath" + echo + $ECHO "run \`$progname --help | more' for full usage" + exit $? +} + +# func_help [NOEXIT] +# Echo long help message to standard output and exit, +# unless 'noexit' is passed as argument. +func_help () +{ + $opt_debug + + $SED -n '/^# Usage:/,/# Report bugs to/ { + :print + s/^# // + s/^# *$// + s*\$progname*'$progname'* + s*\$host*'"$host"'* + s*\$SHELL*'"$SHELL"'* + s*\$LTCC*'"$LTCC"'* + s*\$LTCFLAGS*'"$LTCFLAGS"'* + s*\$LD*'"$LD"'* + s/\$with_gnu_ld/'"$with_gnu_ld"'/ + s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ + p + d + } + /^# .* home page:/b print + /^# General help using/b print + ' < "$progpath" + ret=$? + if test -z "$1"; then + exit $ret + fi +} + +# func_missing_arg argname +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $opt_debug + + func_error "missing argument for $1." + exit_cmd=exit +} + + +# func_split_short_opt shortopt +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +func_split_short_opt () +{ + my_sed_short_opt='1s/^\(..\).*$/\1/;q' + my_sed_short_rest='1s/^..\(.*\)$/\1/;q' + + func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` + func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` +} # func_split_short_opt may be replaced by extended shell implementation + + +# func_split_long_opt longopt +# Set func_split_long_opt_name and func_split_long_opt_arg shell +# variables after splitting LONGOPT at the `=' sign. +func_split_long_opt () +{ + my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' + my_sed_long_arg='1s/^--[^=]*=//' + + func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` + func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` +} # func_split_long_opt may be replaced by extended shell implementation + +exit_cmd=: + + + + + +magic="%%%MAGIC variable%%%" +magic_exe="%%%MAGIC EXE variable%%%" + +# Global variables. +nonopt= +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "${1}=\$${1}\${2}" +} # func_append may be replaced by extended shell implementation + +# func_append_quoted var value +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +func_append_quoted () +{ + func_quote_for_eval "${2}" + eval "${1}=\$${1}\\ \$func_quote_for_eval_result" +} # func_append_quoted may be replaced by extended shell implementation + + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "${@}"` +} # func_arith may be replaced by extended shell implementation + + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` +} # func_len may be replaced by extended shell implementation + + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` +} # func_lo2o may be replaced by extended shell implementation + + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` +} # func_xform may be replaced by extended shell implementation + + +# func_fatal_configuration arg... +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func_error ${1+"$@"} + func_error "See the $PACKAGE documentation for more information." + func_fatal_error "Fatal configuration error." +} + + +# func_config +# Display the configuration for all the tags in this script. +func_config () +{ + re_begincf='^# ### BEGIN LIBTOOL' + re_endcf='^# ### END LIBTOOL' + + # Default configuration. + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" + + # Now print the configurations for the tags. + for tagname in $taglist; do + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" + done + + exit $? +} + +# func_features +# Display the features supported by this script. +func_features () +{ + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + + exit $? +} + +# func_enable_tag tagname +# Verify that TAGNAME is valid, and either flag an error and exit, or +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist +# variable here. +func_enable_tag () +{ + # Global variable: + tagname="$1" + + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf="/$re_begincf/,/$re_endcf/p" + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac + + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; + *) + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +# Shorthand for --mode=foo, only valid as the first argument +case $1 in +clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; +compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; +execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; +finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; +install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; +link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; +uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; +esac + + + +# Option defaults: +opt_debug=: +opt_dry_run=false +opt_config=false +opt_preserve_dup_deps=false +opt_features=false +opt_finish=false +opt_help=false +opt_help_all=false +opt_silent=: +opt_warning=: +opt_verbose=: +opt_silent=false +opt_verbose=false + + +# Parse options once, thoroughly. This comes as soon as possible in the +# script to make things like `--version' happen as quickly as we can. +{ + # this just eases exit handling + while test $# -gt 0; do + opt="$1" + shift + case $opt in + --debug|-x) opt_debug='set -x' + func_echo "enabling shell trace mode" + $opt_debug + ;; + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + --config) + opt_config=: +func_config + ;; + --dlopen|-dlopen) + optarg="$1" + opt_dlopen="${opt_dlopen+$opt_dlopen +}$optarg" + shift + ;; + --preserve-dup-deps) + opt_preserve_dup_deps=: + ;; + --features) + opt_features=: +func_features + ;; + --finish) + opt_finish=: +set dummy --mode finish ${1+"$@"}; shift + ;; + --help) + opt_help=: + ;; + --help-all) + opt_help_all=: +opt_help=': help-all' + ;; + --mode) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_mode="$optarg" +case $optarg in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; +esac + shift + ;; + --no-silent|--no-quiet) + opt_silent=false +func_append preserve_args " $opt" + ;; + --no-warning|--no-warn) + opt_warning=false +func_append preserve_args " $opt" + ;; + --no-verbose) + opt_verbose=false +func_append preserve_args " $opt" + ;; + --silent|--quiet) + opt_silent=: +func_append preserve_args " $opt" + opt_verbose=false + ;; + --verbose|-v) + opt_verbose=: +func_append preserve_args " $opt" +opt_silent=false + ;; + --tag) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_tag="$optarg" +func_append preserve_args " $opt $optarg" +func_enable_tag "$optarg" + shift + ;; + + -\?|-h) func_usage ;; + --help) func_help ;; + --version) func_version ;; + + # Separate optargs to long options: + --*=*) + func_split_long_opt "$opt" + set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-n*|-v*) + func_split_short_opt "$opt" + set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognized option \`$opt'" ;; + *) set dummy "$opt" ${1+"$@"}; shift; break ;; + esac + done + + # Validate options: + + # save first non-option argument + if test "$#" -gt 0; then + nonopt="$opt" + shift + fi + + # preserve --debug + test "$opt_debug" = : || func_append preserve_args " --debug" + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test "$opt_mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$opt_mode' for more information." + } + + + # Bail if the options were screwed + $exit_cmd $EXIT_FAILURE +} + + + + +## ----------- ## +## Main. ## +## ----------- ## + +# func_lalib_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null \ + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if `file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case "$lalib_p_line" in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test "$lalib_p" = yes +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + func_lalib_p "$1" +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $opt_debug + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$save_ifs + eval cmd=\"$cmd\" + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# `FILE.' does not work on cygwin managed mounts. +func_source () +{ + $opt_debug + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case "$lt_sysroot:$1" in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result="=$func_stripname_result" + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $opt_debug + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case "$@ " in + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with \`--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=${1} + if test "$build_libtool_libs" = yes; then + write_lobj=\'${2}\' + else + write_lobj=none + fi + + if test "$build_old_libs" = yes; then + write_oldobj=\'${3}\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T </dev/null` + if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$lt_sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $opt_debug + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result="" + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result" ; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $opt_debug + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $opt_debug + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $opt_debug + if test -z "$2" && test -n "$1" ; then + func_error "Could not determine host file name corresponding to" + func_error " \`$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result="$1" + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $opt_debug + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " \`$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result="$3" + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $opt_debug + case $4 in + $1 ) func_to_host_path_result="$3$func_to_host_path_result" + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via `$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $opt_debug + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $opt_debug + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result="$1" +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result="$func_convert_core_msys_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via `$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $opt_debug + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd="func_convert_path_${func_stripname_result}" + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $opt_debug + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result="$1" +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_msys_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + +# func_mode_compile arg... +func_mode_compile () +{ + $opt_debug + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + pie_flag= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + test -n "$libobj" && \ + func_fatal_error "you cannot specify \`-o' more than once" + arg_mode=target + continue + ;; + + -pie | -fpie | -fPIE) + func_append pie_flag " $arg" + continue + ;; + + -shared | -static | -prefer-pic | -prefer-non-pic) + func_append later " $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + func_append_quoted lastarg "$arg" + done + IFS="$save_ifs" + func_stripname ' ' '' "$lastarg" + lastarg=$func_stripname_result + + # Add the arguments to base_compile. + func_append base_compile " $lastarg" + continue + ;; + + *) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + func_append_quoted base_compile "$lastarg" + done # for arg + + case $arg_mode in + arg) + func_fatal_error "you must specify an argument for -Xcompile" + ;; + target) + func_fatal_error "you must specify a target with \`-o'" + ;; + *) + # Get the name of the library object. + test -z "$libobj" && { + func_basename "$srcfile" + libobj="$func_basename_result" + } + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + case $libobj in + *.[cCFSifmso] | \ + *.ada | *.adb | *.ads | *.asm | \ + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ + *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) + func_xform "$libobj" + libobj=$func_xform_result + ;; + esac + + case $libobj in + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; + *) + func_fatal_error "cannot determine name of library object from \`$libobj'" + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + continue + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + func_quote_for_eval "$libobj" + test "X$libobj" != "X$func_quote_for_eval_result" \ + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && func_warning "libobj name \`$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname="$func_basename_result" + xdir="$func_dirname_result" + lobj=${xdir}$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + func_append removelist " $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + func_append removelist " $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + func_append command " -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test "$compiler_c_o" = yes; then + func_append command " -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + func_append command "$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { + test "$opt_mode" = compile && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $opt_mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only + -shared do not build a \`.o' file suitable for static linking + -static only build a \`.o' file suitable for static linking + -Wc,FLAG pass FLAG directly to the compiler + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode \`$opt_mode'" + ;; + esac + + echo + $ECHO "Try \`$progname --help' for more information about other modes." +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test "$opt_help" = :; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | sed -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + sed '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi + + +# func_mode_execute arg... +func_mode_execute () +{ + $opt_debug + # The first argument is the command name. + cmd="$nonopt" + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $opt_dlopen; do + test -f "$file" \ + || func_fatal_help "\`$file' is not a file" + + dir= + case $file in + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "\`$file' was not linked with \`-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir="$func_dirname_result" + + if test -f "$dir/$objdir/$dlname"; then + func_append dir "/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir="$func_dirname_result" + ;; + + *) + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -* | *.la | *.lo ) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file="$progdir/$program" + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_append_quoted args "$file" + done + + if test "X$opt_dry_run" = Xfalse; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + echo "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + fi +} + +test "$opt_mode" = execute && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $opt_debug + libs= + libdirs= + admincmds= + + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "\`$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument \`$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and \`=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || func_append admincmds " + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_silent && exit $EXIT_SUCCESS + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi + exit $EXIT_SUCCESS +} + +test "$opt_mode" = finish && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $opt_debug + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + case $nonopt in *shtool*) :;; *) false;; esac; then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + func_append install_prog "$func_quote_for_eval_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + no_mode=: + for arg + do + arg2= + if test -n "$dest"; then + func_append files " $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + if $install_cp; then :; else + prev=$arg + fi + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + if test "x$prev" = x-m && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + func_append install_prog " $func_quote_for_eval_result" + if test -n "$arg2"; then + func_quote_for_eval "$arg2" + fi + func_append install_shared_prog " $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the \`$prev' option requires an argument" + + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" + fi + fi + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir="$func_dirname_result" + destname="$func_basename_result" + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "\`$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "\`$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + func_append staticlibs " $file" + ;; + + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) func_append current_libdirs " $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) func_append future_libdirs " $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir="$func_dirname_result" + func_append dir "$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking \`$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname="$1" + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme="$stripme" + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme="" + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name="$func_basename_result" + instname="$dir/$name"i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && func_append staticlibs " $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to \`$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script \`$wrapper'" + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "\`$lib' has not been installed in \`$libdir'" + finalize=no + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + $opt_dry_run || { + if test "$finalize" = yes; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file="$func_basename_result" + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_silent || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink \`$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file="$outputname" + else + func_warning "cannot relink \`$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name="$func_basename_result" + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $tool_oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run \`$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test "$opt_mode" = install && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $opt_debug + my_outputname="$1" + my_originator="$2" + my_pic_p="${3-no}" + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms="${my_outputname}S.c" + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${my_outputname}.nm" + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + func_verbose "generating symbol list for \`$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $opt_dry_run || { + $RM $export_symbols + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from \`$dlprefile'" + func_basename "$dlprefile" + name="$func_basename_result" + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename="" + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname" ; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename="$func_basename_result" + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename" ; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + echo >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +extern LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[]; +LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{\ + { \"$my_originator\", (void *) 0 }," + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + echo >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + if test "X$my_pic_p" != Xno; then + pic_flag_for_symtable=" $pic_flag" + fi + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) func_append symtab_cflags " $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' + + # Transform the symbol file into the correct name. + symfileobj="$output_objdir/${my_outputname}S.$objext" + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for \`$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` + fi +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. +func_win32_libid () +{ + $opt_debug + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' + 1,100{ + / I /{ + s,.*,import, + p + q + } + }'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $opt_debug + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $opt_debug + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive which possess that section. Heuristic: eliminate + # all those which have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $opt_debug + if func_cygming_gnu_implib_p "$1" ; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1" ; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result="" + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $opt_debug + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + if test "$lock_old_archive_extraction" = yes; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test "$lock_old_archive_extraction" = yes; then + $opt_dry_run || rm -f "$lockfile" + fi + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $opt_debug + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib="$func_basename_result" + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`basename "$darwin_archive"` + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=\"$qECHO\" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ which is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options which match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + case \" \$* \" in + *\\ --lt-*) + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done ;; + esac + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${1+\"\$@\"} + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} + + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +#else +# include +# include +# ifdef __CYGWIN__ +# include +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +/* declarations of non-ANSI functions */ +#if defined(__MINGW32__) +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined(__CYGWIN__) +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined (other platforms) ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined(_MSC_VER) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +# ifndef _INTPTR_T_DEFINED +# define _INTPTR_T_DEFINED +# define intptr_t int +# endif +#elif defined(__MINGW32__) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined(__CYGWIN__) +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined (other platforms) ... */ +#endif + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +/* path handling portability macros */ +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +#if defined(LT_DEBUGWRAPPER) +static int lt_debug = 1; +#else +static int lt_debug = 0; +#endif + +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); +EOF + + cat <= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char *concat_name; + + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp (str, pat) == 0) + *str = '\0'; + } + return str; +} + +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + +static void +lt_error_core (int exit_status, const char *file, + int line, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *file, int line, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); + va_end (ap); +} + +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + +void +lt_setenv (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + int len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + int orig_value_len = strlen (orig_value); + int add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + int len = strlen (new_value); + while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[len-1] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -n -e ' +s/^\(.\{79\}\)\(..*\)/\1\ +\2/ +h +s/\([\\"]\)/\\\1/g +s/$/\\n/ +s/\([^\n]*\).*/ fputs ("\1", f);/p +g +D' + cat <<"EOF" +} +EOF +} +# end: func_emit_cwrapperexe_src + +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $opt_debug + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + +# func_mode_link arg... +func_mode_link () +{ + $opt_debug + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + bindir= + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module="${wl}-single_module" + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + bindir) + bindir="$arg" + prev= + continue + ;; + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + func_append dlfiles " $arg" + else + func_append dlprefiles " $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + test -f "$arg" \ + || func_fatal_error "symbol file \`$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) func_append deplibs " $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# func_append moreargs " $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file \`$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) func_append rpath " $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) func_append xrpath " $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + weak) + func_append weak_libs " $arg" + prev= + continue + ;; + xcclinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "\`-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -bindir) + prev=bindir + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between \`-L' and \`$1'" + else + func_fatal_error "need path for \`-L' option" + fi + fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of \`$dir'" + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; + *) + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) func_append dllsearchpath ":$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + func_append deplibs " System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + func_append deplibs " $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + continue + ;; + + -multi_module) + single_module="${wl}-multi_module" + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "\`-no-install' is ignored for $host" + func_warning "assuming \`-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-flto*|-fwhopr*|-fuse-linker-plugin) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" + func_append finalize_command " $arg" + func_append compiler_flags " $arg" + continue + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + *.$objext) + # A standard object. + func_append objs " $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + func_append deplibs " $arg" + func_append old_deplibs " $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + func_resolve_sysroot "$arg" + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + func_append dlfiles " $func_resolve_sysroot_result" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + func_append dlprefiles " $func_resolve_sysroot_result" + prev= + else + func_append deplibs " $func_resolve_sysroot_result" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the \`$prevarg' option requires an argument" + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname="$func_basename_result" + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + func_dirname "$output" "/" "" + output_objdir="$func_dirname_result$objdir" + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_preserve_dup_deps ; then + case "$libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append libs " $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; + esac + func_append pre_post_deps " $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test "$linkmode,$pass" = "lib,link"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs="$tmp_deplibs" + fi + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) + libs="$deplibs %DEPLIBS%" + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" + ;; + esac + fi + if test "$linkmode,$pass" = "lib,dlpreopen"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + func_resolve_sysroot "$lib" + case $lib in + *.la) func_source "$func_resolve_sysroot_result" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + func_basename "$deplib" + deplib_base=$func_basename_result + case " $weak_libs " in + *" $deplib_base "*) ;; + *) func_append deplibs " $deplib" ;; + esac + done + done + libs="$dlprefiles" + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append compiler_flags " $deplib" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + func_warning "\`-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test "$linkmode" = lib; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + *.ltframework) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + *) + func_warning "\`-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + func_stripname '-R' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + echo + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." + else + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + ;; + esac + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + func_append newdlprefiles " $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append newdlfiles " $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + + if test "$found" = yes || test -f "$lib"; then : + else + func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" + fi + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "\`$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + # It is a libtool convenience library, so add in its objects. + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + func_fatal_error "\`$lib' is not a convenience library" + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + if test -n "$old_library" && + { test "$prefer_static_libs" = yes || + test "$prefer_static_libs,$installed" = "built,no"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib="$l" + done + fi + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + func_fatal_error "cannot -dlopen a convenience library: \`$lib'" + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + func_append dlprefiles " $lib $dependency_libs" + else + func_append newdlfiles " $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of \`$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir="$ladir" + fi + ;; + esac + func_basename "$lib" + laname="$func_basename_result" + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library \`$lib' was moved." + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$lt_sysroot$libdir" + absdir="$lt_sysroot$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + func_append notinst_path " $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + func_append notinst_path " $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir" && test "$linkmode" = prog; then + func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" + fi + case "$host" in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + func_append newlib_search_path " $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath:" in + *"$absdir:"*) ;; + *) func_append temp_rpath "$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc*) + # No point in relinking DLLs because paths are not encoded + func_append notinst_deplibs " $lib" + need_relink=no + ;; + *) + if test "$installed" = no; then + func_append notinst_deplibs " $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule="" + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule="$dlpremoduletest" + break + fi + done + if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then + echo + if test "$linkmode" = prog; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname="$1" + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc*) + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + func_basename "$soroot" + soname="$func_basename_result" + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from \`$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for \`$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$opt_mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we can not + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null ; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + elif test -n "$old_library"; then + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$absdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && + test "$hardcode_minus_L" != yes && + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$opt_mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + $ECHO "*** Warning: This system can not link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) func_append xrpath " $temp_xrpath";; + esac;; + *) func_append temp_deplibs " $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + func_append newlib_search_path " $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; + esac + fi + func_append tmp_libs " $func_resolve_sysroot_result" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path="$deplib" ;; + *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result + func_dirname "$deplib" "" "." + dir=$func_dirname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of \`$dir'" + absdir="$dir" + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl" ; then + depdepl="$absdir/$objdir/$depdepl" + darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" + path= + fi + fi + ;; + *) + path="-L$absdir/$objdir" + ;; + esac + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "\`$deplib' seems to be moved" + + path="-L$absdir" + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = link; then + if test "$linkmode" = "prog"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) func_append lib_search_path " $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) func_append tmp_libs " $deplib" ;; + esac + ;; + *) func_append tmp_libs " $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + func_append tmp_libs " $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + fi + if test "$linkmode" = prog || test "$linkmode" = lib; then + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "\`-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "\`-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + func_append objs "$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test "$module" = no && \ + func_fatal_help "libtool library \`$output' must begin with \`lib'" + + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" + else + echo + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + func_append libobjs " $objs" + fi + fi + + test "$dlself" != no && \ + func_warning "\`-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test "$#" -gt 1 && \ + func_warning "ignoring multiple \`-rpath's for a libtool library" + + install_libdir="$1" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "\`-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + shift + IFS="$save_ifs" + + test -n "$7" && \ + func_fatal_help "too many parameters to \`-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$1" + number_minor="$2" + number_revision="$3" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + # correct linux to gnu/linux during the next big refactor + darwin|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|qnx|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_minor" + lt_irix_increment=no + ;; + *) + func_fatal_configuration "$modename: unknown library version type \`$version_type'" + ;; + esac + ;; + no) + current="$1" + revision="$2" + age="$3" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT \`$current' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION \`$revision' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE \`$age' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE \`$age' is greater than the current interface number \`$current'" + func_fatal_error "\`$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current" + ;; + + irix | nonstopux) + if test "X$lt_irix_increment" = "Xno"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) # correct to gnu/linux during the next big refactor + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + func_append verstring ":${current}.0" + ;; + + qnx) + major=".$current" + versuffix=".$current" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + + *) + func_fatal_configuration "unknown library version type \`$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + func_warning "undefined symbols not allowed in $host shared libraries" + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + fi + + func_generate_dlsyms "$libname" "$libname" "yes" + func_append libobjs " $symfileobj" + test "X$libobjs" = "X " && libobjs= + + if test "$opt_mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + func_append removelist " $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + func_append oldlibs " $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) func_append dlfiles " $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) func_append dlprefiles " $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + func_append deplibs " System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + func_append deplibs " -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + func_append newdeplibs " $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` + done + fi + case $tmp_deplibs in + *[!\ \ ]*) + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + ;; + esac + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + deplibs="$new_libs" + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + # Remove ${wl} instances when linking with ld. + # FIXME: should test the right _cmds variable. + case $archive_cmds in + *\$LD\ *) wl= ;; + esac + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$opt_mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append dep_rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname="$1" + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + func_append linknames " $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols="$output_objdir/$libname.uexp" + func_append delfiles " $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + if test "x`$SED 1q $export_symbols`" != xEXPORTS; then + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols="$export_symbols" + export_symbols= + always_export_symbols=yes + fi + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd1 in $cmds; do + IFS="$save_ifs" + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test "$try_normal_branch" = yes \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=${output_objdir}/${output_la}.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + func_append tmp_deplibs " $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test "$compiler_needs_object" = yes && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + func_append linker_flags " $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + func_basename "$output" + output_la=$func_basename_result + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then + output=${output_objdir}/${output_la}.lnkscript + func_verbose "creating GNU ld script: $output" + echo 'INPUT (' > $output + for obj in $save_libobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result + elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then + output=${output_objdir}/${output_la}.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test "$compiler_needs_object" = yes; then + firstobj="$1 " + shift + fi + for obj + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-${k}.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test "X$objlist" = X || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" + else + # All subsequent reloadable object files will link in + # the last one created. + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-${k}.$objext + objlist=" $obj" + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\${concat_cmds}$reload_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" + fi + func_append delfiles " $output" + + else + output= + fi + + if ${skipped_export-false}; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + fi + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + if ${skipped_export-false}; then + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + fi + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "\`-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object \`$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + else + gentop="$output_objdir/${obj}x" + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # If we're not building shared, we need to use non_pic_objs + test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "\`-release' is ignored for programs" + + test "$preload" = yes \ + && test "$dlopen_support" = unknown \ + && test "$dlopen_self" = unknown \ + && test "$dlopen_self_static" = unknown && \ + func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test "$tagname" = CXX ; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + func_append compile_command " ${wl}-bind_at_load" + func_append finalize_command " ${wl}-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) func_append dllsearchpath ":$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) func_append finalize_perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" "no" + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=yes + case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=no + ;; + *cygwin* | *mingw* ) + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + *) + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + esac + if test "$wrappers_required" = no; then + # Replace the output file specification. + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.${objext}"; then + func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' + fi + + exit $exit_status + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + func_append rpath "$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "\`$output' will be relinked during installation" + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host" ; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save $symfileobj" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + if test "$preload" = yes && test -f "$symfileobj"; then + func_append oldobjs " $symfileobj" + fi + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $addlibs + func_append oldobjs " $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append oldobjs " $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + echo "copying selected object files to avoid basename conflicts..." + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase="$func_basename_result" + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" + ;; + *) func_append oldobjs " $obj" ;; + esac + done + fi + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name="$func_basename_result" + func_resolve_sysroot "$deplib" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" + ;; + *) func_append newdlfiles " $lib" ;; + esac + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" + ;; + esac + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlfiles " $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlprefiles " $abs" + done + dlprefiles="$newdlprefiles" + fi + $RM $output + # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test "x$bindir" != x ; + then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +{ test "$opt_mode" = link || test "$opt_mode" = relink; } && + func_mode_link ${1+"$@"} + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $opt_debug + RM="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) func_append RM " $arg"; rmforce=yes ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + for file in $files; do + func_dirname "$file" "" "." + dir="$func_dirname_result" + if test "X$dir" = X.; then + odir="$objdir" + else + odir="$dir/$objdir" + fi + func_basename "$file" + name="$func_basename_result" + test "$opt_mode" = uninstall && odir="$dir" + + # Remember odir for removal later, being careful to avoid duplicates + if test "$opt_mode" = clean; then + case " $rmdirs " in + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + func_append rmfiles " $odir/$n" + done + test -n "$old_library" && func_append rmfiles " $odir/$old_library" + + case "$opt_mode" in + clean) + case " $library_names " in + *" $dlname "*) ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; + esac + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && + test "$pic_object" != none; then + func_append rmfiles " $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && + test "$non_pic_object" != none; then + func_append rmfiles " $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$opt_mode" = clean ; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + func_append rmfiles " $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + func_append rmfiles " $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + func_append rmfiles " $odir/$name $odir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + func_append rmfiles " $odir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + func_append rmfiles " $odir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && + func_mode_uninstall ${1+"$@"} + +test -z "$opt_mode" && { + help="$generic_help" + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode \`$opt_mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: +# vi:sw=2 + diff --git a/m4/libtool.m4 b/m4/libtool.m4 new file mode 100644 index 0000000..828104c --- /dev/null +++ b/m4/libtool.m4 @@ -0,0 +1,8001 @@ +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +m4_define([_LT_COPYING], [dnl +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool 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. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +]) + +# serial 57 LT_INIT + + +# LT_PREREQ(VERSION) +# ------------------ +# Complain and exit if this libtool version is less that VERSION. +m4_defun([LT_PREREQ], +[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, + [m4_default([$3], + [m4_fatal([Libtool version $1 or higher is required], + 63)])], + [$2])]) + + +# _LT_CHECK_BUILDDIR +# ------------------ +# Complain if the absolute build directory name contains unusual characters +m4_defun([_LT_CHECK_BUILDDIR], +[case `pwd` in + *\ * | *\ *) + AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; +esac +]) + + +# LT_INIT([OPTIONS]) +# ------------------ +AC_DEFUN([LT_INIT], +[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +])# LT_INIT + +# Old names: +AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) +AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PROG_LIBTOOL], []) +dnl AC_DEFUN([AM_PROG_LIBTOOL], []) + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +m4_defun([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +]) + + +# _LT_FILEUTILS_DEFAULTS +# ---------------------- +# It is okay to use these file commands and assume they have been set +# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. +m4_defun([_LT_FILEUTILS_DEFAULTS], +[: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +])# _LT_FILEUTILS_DEFAULTS + + +# _LT_SETUP +# --------- +m4_defun([_LT_SETUP], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + +_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl +dnl +_LT_DECL([], [host_alias], [0], [The host system])dnl +_LT_DECL([], [host], [0])dnl +_LT_DECL([], [host_os], [0])dnl +dnl +_LT_DECL([], [build_alias], [0], [The build system])dnl +_LT_DECL([], [build], [0])dnl +_LT_DECL([], [build_os], [0])dnl +dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +test -z "$LN_S" && LN_S="ln -s" +_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl +dnl +AC_REQUIRE([LT_CMD_MAX_LEN])dnl +_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl +_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl +m4_require([_LT_CMD_RELOAD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi +]) +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +_LT_CHECK_OBJDIR + +m4_require([_LT_TAG_COMPILER])dnl + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from `configure', and `config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# `config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain="$ac_aux_dir/ltmain.sh" +])# _LT_PROG_LTMAIN + + +## ------------------------------------- ## +## Accumulate code for creating libtool. ## +## ------------------------------------- ## + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the `libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + +## ------------------------ ## +## FIXME: Eliminate VARNAME ## +## ------------------------ ## + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to `config.status' so that its +# declaration there will have the same value as in `configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags="_LT_TAGS"dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into `config.status', and then the shell code to quote escape them in +# for loops in `config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_dquote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +_LT_OUTPUT_LIBTOOL_INIT +]) + +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# `#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test $lt_write_fail = 0 && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +\`$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2011 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test $[#] != 0 +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try \`$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try \`$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test "$silent" = yes && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) +])# LT_OUTPUT + + +# _LT_CONFIG(TAG) +# --------------- +# If TAG is the built-in tag, create an initial libtool script with a +# default configuration from the untagged config vars. Otherwise add code +# to config.status for appending the configuration named by TAG from the +# matching tagged config vars. +m4_defun([_LT_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_CONFIG_SAVE_COMMANDS([ + m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl + m4_if(_LT_TAG, [C], [ + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +_LT_COPYING +_LT_LIBTOOL_TAGS + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + _LT_PROG_LTMAIN + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + _LT_PROG_REPLACE_SHELLFNS + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +], +[cat <<_LT_EOF >> "$ofile" + +dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded +dnl in a comment (ie after a #). +# ### BEGIN LIBTOOL TAG CONFIG: $1 +_LT_LIBTOOL_TAG_VARS(_LT_TAG) +# ### END LIBTOOL TAG CONFIG: $1 +_LT_EOF +])dnl /m4_if +], +[m4_if([$1], [], [ + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile'], []) +])dnl /_LT_CONFIG_SAVE_COMMANDS +])# _LT_CONFIG + + +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + +# C support is built-in for now +m4_define([_LT_LANG_C_enabled], []) +m4_define([_LT_TAGS], []) + + +# LT_LANG(LANG) +# ------------- +# Enable libtool support for the given language if not already enabled. +AC_DEFUN([LT_LANG], +[AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Go], [_LT_LANG(GO)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +])# LT_LANG + + +# _LT_LANG(LANGNAME) +# ------------------ +m4_defun([_LT_LANG], +[m4_ifdef([_LT_LANG_]$1[_enabled], [], + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl + m4_define([_LT_LANG_]$1[_enabled], [])dnl + _LT_LANG_$1_CONFIG($1)])dnl +])# _LT_LANG + + +m4_ifndef([AC_PROG_GO], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_GO. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +m4_defun([AC_PROG_GO], +[AC_LANG_PUSH(Go)dnl +AC_ARG_VAR([GOC], [Go compiler command])dnl +AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +AC_CHECK_TOOL(GOC, gccgo) +if test -z "$GOC"; then + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) + fi +fi +if test -z "$GOC"; then + AC_CHECK_PROG(GOC, gccgo, gccgo, false) +fi +])#m4_defun +])#m4_ifndef + + +# _LT_LANG_DEFAULT_CONFIG +# ----------------------- +m4_defun([_LT_LANG_DEFAULT_CONFIG], +[AC_PROVIDE_IFELSE([AC_PROG_CXX], + [LT_LANG(CXX)], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) + +AC_PROVIDE_IFELSE([AC_PROG_F77], + [LT_LANG(F77)], + [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) + +AC_PROVIDE_IFELSE([AC_PROG_FC], + [LT_LANG(FC)], + [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) + +dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal +dnl pulling things in needlessly. +AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([LT_PROG_GCJ], + [LT_LANG(GCJ)], + [m4_ifdef([AC_PROG_GCJ], + [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([A][M_PROG_GCJ], + [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([LT_PROG_GCJ], + [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) + +AC_PROVIDE_IFELSE([AC_PROG_GO], + [LT_LANG(GO)], + [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) + +AC_PROVIDE_IFELSE([LT_PROG_RC], + [LT_LANG(RC)], + [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) +])# _LT_LANG_DEFAULT_CONFIG + +# Obsolete macros: +AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_CXX], []) +dnl AC_DEFUN([AC_LIBTOOL_F77], []) +dnl AC_DEFUN([AC_LIBTOOL_FC], []) +dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) + + +# _LT_TAG_COMPILER +# ---------------- +m4_defun([_LT_TAG_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl +_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_TAG_COMPILER + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +m4_defun([_LT_COMPILER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +m4_defun([_LT_LINKER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# ------------------------- +m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + AC_CHECK_TOOL([LIPO], [lipo], [:]) + AC_CHECK_TOOL([OTOOL], [otool], [:]) + AC_CHECK_TOOL([OTOOL64], [otool64], [:]) + _LT_DECL([], [DSYMUTIL], [1], + [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) + _LT_DECL([], [NMEDIT], [1], + [Tool to change global to local symbols on Mac OS X]) + _LT_DECL([], [LIPO], [1], + [Tool to manipulate fat objects and archives on Mac OS X]) + _LT_DECL([], [OTOOL], [1], + [ldd/readelf like tool for Mach-O binaries on Mac OS X]) + _LT_DECL([], [OTOOL64], [1], + [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi]) + + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS="$save_LDFLAGS" + ]) + + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) + case $host_os in + rhapsody* | darwin1.[[012]]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[[012]]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES([TAG]) +# --------------------------------- +# Checks for linker and compiler features on darwin +m4_defun([_LT_DARWIN_LINKER_FEATURES], +[ + m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_automatic, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], + [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + m4_if([$1], [CXX], +[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi +],[]) + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi +]) + +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script which will find a shell with a builtin +# printf (which we can use as an echo command). +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +case "$ECHO" in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; +esac + +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) + +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[ --with-sysroot[=DIR] Search for dependent libraries within DIR + (or the compiler's sysroot if not specified).], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([${with_sysroot}]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and in which our libraries should be installed.])]) + +# _LT_ENABLE_LOCK +# --------------- +m4_defun([_LT_ENABLE_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" +])# _LT_ENABLE_LOCK + + +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + +# _LT_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[_LT_PROG_AR + +AC_CHECK_TOOL(STRIP, strip, :) +test -z "$STRIP" && STRIP=: +_LT_DECL([], [STRIP], [1], [A symbol stripping program]) + +AC_CHECK_TOOL(RANLIB, ranlib, :) +test -z "$RANLIB" && RANLIB=: +_LT_DECL([], [RANLIB], [1], + [Commands used to install an old-style archive]) + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac +_LT_DECL([], [old_postinstall_cmds], [2]) +_LT_DECL([], [old_postuninstall_cmds], [2]) +_LT_TAGDECL([], [old_archive_cmds], [2], + [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) +])# _LT_CMD_OLD_ARCHIVE + + +# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([_LT_COMPILER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test x"[$]$2" = xyes; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +])# _LT_COMPILER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) + + +# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------- +# Check whether the given linker option works +AC_DEFUN([_LT_LINKER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +])# _LT_LINKER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) + + +# LT_CMD_MAX_LEN +#--------------- +AC_DEFUN([LT_CMD_MAX_LEN], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +])# LT_CMD_MAX_LEN + +# Old name: +AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) + + +# _LT_HEADER_DLFCN +# ---------------- +m4_defun([_LT_HEADER_DLFCN], +[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl +])# _LT_HEADER_DLFCN + + +# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ---------------------------------------------------------------- +m4_defun([_LT_TRY_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_TRY_DLOPEN_SELF + + +# LT_SYS_DLOPEN_SELF +# ------------------ +AC_DEFUN([LT_SYS_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +])# LT_SYS_DLOPEN_SELF + +# Old name: +AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) + + +# _LT_COMPILER_C_O([TAGNAME]) +# --------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler. +# This macro does not hard code the compiler like AC_PROG_CC_C_O. +m4_defun([_LT_COMPILER_C_O], +[m4_require([_LT_DECL_SED])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* +]) +_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], + [Does compiler simultaneously support -c and -o options?]) +])# _LT_COMPILER_C_O + + +# _LT_COMPILER_FILE_LOCKS([TAGNAME]) +# ---------------------------------- +# Check to see if we can do hard links to lock some files if needed +m4_defun([_LT_COMPILER_FILE_LOCKS], +[m4_require([_LT_ENABLE_LOCK])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_COMPILER_C_O([$1]) + +hard_links="nottested" +if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) +])# _LT_COMPILER_FILE_LOCKS + + +# _LT_CHECK_OBJDIR +# ---------------- +m4_defun([_LT_CHECK_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +_LT_DECL([], [objdir], [0], + [The name of the directory that contains temporary libtool files])dnl +m4_pattern_allow([LT_OBJDIR])dnl +AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", + [Define to the sub-directory in which libtool stores uninstalled libraries.]) +])# _LT_CHECK_OBJDIR + + +# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) +# -------------------------------------- +# Check hardcoding attributes. +m4_defun([_LT_LINKER_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || + test -n "$_LT_TAGVAR(runpath_var, $1)" || + test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || + test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +_LT_TAGDECL([], [hardcode_action], [0], + [How to hardcode a shared library path into an executable]) +])# _LT_LINKER_HARDCODE_LIBPATH + + +# _LT_CMD_STRIPLIB +# ---------------- +m4_defun([_LT_CMD_STRIPLIB], +[m4_require([_LT_DECL_EGREP]) +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) +_LT_DECL([], [striplib], [1]) +])# _LT_CMD_STRIPLIB + + +# _LT_SYS_DYNAMIC_LINKER([TAG]) +# ----------------------------- +# PORTME Fill in your ld.so characteristics +m4_defun([_LT_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_OBJDUMP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[[4-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[23]].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[[3-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + +_LT_DECL([], [variables_saved_for_relink], [1], + [Variables whose values should be saved in libtool wrapper scripts and + restored at link time]) +_LT_DECL([], [need_lib_prefix], [0], + [Do we need the "lib" prefix for modules?]) +_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) +_LT_DECL([], [version_type], [0], [Library versioning type]) +_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) +_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) +_LT_DECL([], [shlibpath_overrides_runpath], [0], + [Is shlibpath searched before the hard-coded library search path?]) +_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [library_names_spec], [1], + [[List of archive names. First name is the real one, the rest are links. + The last name is the one that the linker finds with -lNAME]]) +_LT_DECL([], [soname_spec], [1], + [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) +_LT_DECL([], [postinstall_cmds], [2], + [Command to use after installation of a shared archive]) +_LT_DECL([], [postuninstall_cmds], [2], + [Command to use after uninstallation of a shared archive]) +_LT_DECL([], [finish_cmds], [2], + [Commands used to finish a libtool library installation in a directory]) +_LT_DECL([], [finish_eval], [1], + [[As "finish_cmds", except a single script fragment to be evaled but + not shown]]) +_LT_DECL([], [hardcode_into_libs], [0], + [Whether we should hardcode library paths into libraries]) +_LT_DECL([], [sys_lib_search_path_spec], [2], + [Compile-time system search path for libraries]) +_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], + [Run-time system search path for libraries]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program which can recognize shared library +AC_DEFUN([_LT_PATH_TOOL_PREFIX], +[m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +])# _LT_PATH_TOOL_PREFIX + +# Old name: +AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) + + +# _LT_PATH_MAGIC +# -------------- +# find a file program which can recognize a shared library +m4_defun([_LT_PATH_MAGIC], +[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# _LT_PATH_MAGIC + + +# LT_PATH_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([LT_PATH_LD], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +_LT_DECL([], [deplibs_check_method], [1], + [Method to check whether dependent libraries are shared objects]) +_LT_DECL([], [file_magic_cmd], [1], + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) +])# _LT_CHECK_MAGIC_METHOD + + +# LT_PATH_NM +# ---------- +# find the pathname to a BSD- or MS-compatible name lister +AC_DEFUN([LT_PATH_NM], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi]) +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + AC_SUBST([DUMPBIN]) + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +])# LT_PATH_NM + +# Old names: +AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) +AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_NM], []) +dnl AC_DEFUN([AC_PROG_NM], []) + +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + + +# LT_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +AC_SUBST([LIBM]) +])# LT_LIB_M + +# Old name: +AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_CHECK_LIBM], []) + + +# _LT_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------- +m4_defun([_LT_COMPILER_NO_RTTI], +[m4_require([_LT_TAG_COMPILER])dnl + +_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac + + _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], + [Compiler flag to turn off builtin functions]) +])# _LT_COMPILER_NO_RTTI + + +# _LT_CMD_GLOBAL_SYMBOLS +# ---------------------- +m4_defun([_LT_CMD_GLOBAL_SYMBOLS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([LT_PATH_NM])dnl +AC_REQUIRE([LT_PATH_LD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_TAG_COMPILER])dnl + +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK ['"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx]" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t@_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT@&t@_DLSYM_CONST +#else +# define LT@&t@_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT@&t@_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[[]] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + +_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], + [Take the output of nm and produce a listing of raw symbols and C names]) +_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], + [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_c_name_address], + [lt_cv_sys_global_symbol_to_c_name_address], [1], + [Transform the output of nm in a C name address pair]) +_LT_DECL([global_symbol_to_c_name_address_lib_prefix], + [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], + [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) +]) # _LT_CMD_GLOBAL_SYMBOLS + + +# _LT_COMPILER_PIC([TAGNAME]) +# --------------------------- +m4_defun([_LT_COMPILER_PIC], +[m4_require([_LT_TAG_COMPILER])dnl +_LT_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_TAGVAR(lt_prog_compiler_static, $1)= + +m4_if([$1], [CXX], [ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64 which still supported -KPIC. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + hpux9* | hpux10* | hpux11*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' + _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' + ;; + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + *Sun\ F* | *Sun*Fortran*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Intel*\ [[CF]]*Compiler*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + *Portland\ Group*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], + [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], + [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], + [Additional compiler flags for building library objects]) + +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) +# +# Check to make sure the static flag actually works. +# +wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" +_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) +_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], + [Compiler flag to prevent dynamic linking]) +])# _LT_COMPILER_PIC + + +# _LT_LINKER_SHLIBS([TAGNAME]) +# ---------------------------- +# See if the linker supports building shared libraries. +m4_defun([_LT_LINKER_SHLIBS], +[AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +m4_if([$1], [CXX], [ + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global defined + # symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl*) + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +], [ + runpath_var= + _LT_TAGVAR(allow_undefined_flag, $1)= + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(archive_cmds, $1)= + _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(hardcode_automatic, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_separator, $1)= + _LT_TAGVAR(hardcode_minus_L, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(inherit_rpath, $1)=no + _LT_TAGVAR(link_all_deplibs, $1)=unknown + _LT_TAGVAR(module_cmds, $1)= + _LT_TAGVAR(module_expsym_cmds, $1)= + _LT_TAGVAR(old_archive_from_new_cmds, $1)= + _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_TAGVAR(thread_safe_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + _LT_TAGVAR(link_all_deplibs, $1)=no + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac + ;; + + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) + ;; + esac + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS="$save_LDFLAGS"]) + if test "$lt_cv_irix_exported_symbol" = yes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' + ;; + esac + fi + fi +]) +AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) +test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld + +_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl +_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl +_LT_DECL([], [extract_expsyms_cmds], [2], + [The commands to extract the exported symbol list from a shared archive]) + +# +# Do we need to explicitly link libc? +# +case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) + ;; + esac + fi + ;; +esac + +_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], + [Whether or not to add -lc for building shared libraries]) +_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], + [enable_shared_with_static_runtimes], [0], + [Whether or not to disallow shared libs when runtime libs are static]) +_LT_TAGDECL([], [export_dynamic_flag_spec], [1], + [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([], [whole_archive_flag_spec], [1], + [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) +_LT_TAGDECL([], [old_archive_from_new_cmds], [2], + [Create an old-style archive from a shared archive]) +_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], + [Create a temporary old-style archive to link instead of a shared archive]) +_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) +_LT_TAGDECL([], [archive_expsym_cmds], [2]) +_LT_TAGDECL([], [module_cmds], [2], + [Commands used to build a loadable module if different from building + a shared archive.]) +_LT_TAGDECL([], [module_expsym_cmds], [2]) +_LT_TAGDECL([], [with_gnu_ld], [1], + [Whether we are building with GNU ld or not]) +_LT_TAGDECL([], [allow_undefined_flag], [1], + [Flag that allows shared libraries with undefined symbols to be built]) +_LT_TAGDECL([], [no_undefined_flag], [1], + [Flag that enforces no undefined symbols]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], + [Flag to hardcode $libdir into a binary during linking. + This must work even if $libdir does not exist]) +_LT_TAGDECL([], [hardcode_libdir_separator], [1], + [Whether we need a single "-rpath" flag with a separated argument]) +_LT_TAGDECL([], [hardcode_direct], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary]) +_LT_TAGDECL([], [hardcode_direct_absolute], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary and the resulting library dependency is + "absolute", i.e impossible to change by setting ${shlibpath_var} if the + library is relocated]) +_LT_TAGDECL([], [hardcode_minus_L], [0], + [Set to "yes" if using the -LDIR flag during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_shlibpath_var], [0], + [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_automatic], [0], + [Set to "yes" if building a shared library automatically hardcodes DIR + into the library and all subsequent libraries and executables linked + against it]) +_LT_TAGDECL([], [inherit_rpath], [0], + [Set to yes if linker adds runtime paths of dependent libraries + to runtime path list]) +_LT_TAGDECL([], [link_all_deplibs], [0], + [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [always_export_symbols], [0], + [Set to "yes" if exported symbols are required]) +_LT_TAGDECL([], [export_symbols_cmds], [2], + [The commands to list exported symbols]) +_LT_TAGDECL([], [exclude_expsyms], [1], + [Symbols that should not be listed in the preloaded symbols]) +_LT_TAGDECL([], [include_expsyms], [1], + [Symbols that must always be exported]) +_LT_TAGDECL([], [prelink_cmds], [2], + [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) +_LT_TAGDECL([], [file_list_spec], [1], + [Specify filename containing input files]) +dnl FIXME: Not yet implemented +dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], +dnl [Compiler flag to generate thread safe objects]) +])# _LT_LINKER_SHLIBS + + +# _LT_LANG_C_CONFIG([TAG]) +# ------------------------ +# Ensure that the configuration variables for a C compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_C_CONFIG], +[m4_require([_LT_DECL_EGREP])dnl +lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_TAG_COMPILER +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + LT_SYS_DLOPEN_SELF + _LT_CMD_STRIPLIB + + # Report which library types will actually be built + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_CONFIG($1) +fi +AC_LANG_POP +CC="$lt_save_CC" +])# _LT_LANG_C_CONFIG + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi + +AC_LANG_PUSH(C++) +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_caught_CXX_error" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + else + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + fi + + if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + LT_PATH_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty + # executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared + # libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + freebsd-elf*) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + gnu*) + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + hpux9*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' + fi + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) + _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + openbsd2*) + # C++ shared libraries are fairly broken + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + case $host in + osf3*) + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + ;; + *) + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ + $RM $lib.exp' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + case $host in + osf3*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) + test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + + _LT_TAGVAR(GCC, $1)="$GXX" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test "$_lt_caught_CXX_error" != yes + +AC_LANG_POP +])# _LT_LANG_CXX_CONFIG + + +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + +# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) +# --------------------------------- +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +m4_defun([_LT_SYS_HIDDEN_LIBDEPS], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl +# Dependencies to place before and after the object being linked: +_LT_TAGVAR(predep_objects, $1)= +_LT_TAGVAR(postdep_objects, $1)= +_LT_TAGVAR(predeps, $1)= +_LT_TAGVAR(postdeps, $1)= +_LT_TAGVAR(compiler_lib_search_path, $1)= + +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF +int a; +void foo (void) { a = 0; } +_LT_EOF +], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF +], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +_LT_EOF +], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer a + a=0 + return + end +_LT_EOF +], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +_LT_EOF +], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF +package foo +func foo() { +} +_LT_EOF +]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case ${prev}${p} in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" || + test $p = "-R"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test "$pre_test_object_deps_done" = no; then + case ${prev} in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" + else + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_TAGVAR(postdeps, $1)"; then + _LT_TAGVAR(postdeps, $1)="${prev}${p}" + else + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$_LT_TAGVAR(predep_objects, $1)"; then + _LT_TAGVAR(predep_objects, $1)="$p" + else + _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then + _LT_TAGVAR(postdep_objects, $1)="$p" + else + _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +m4_if([$1], [CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_TAGVAR(predep_objects,$1)= + _LT_TAGVAR(postdep_objects,$1)= + _LT_TAGVAR(postdeps,$1)= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC* | sunCC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac +]) + +case " $_LT_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac + _LT_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi +_LT_TAGDECL([], [compiler_lib_search_dirs], [1], + [The directories searched by this compiler when creating a shared library]) +_LT_TAGDECL([], [predep_objects], [1], + [Dependencies to place before and after the objects being linked to + create a shared library]) +_LT_TAGDECL([], [postdep_objects], [1]) +_LT_TAGDECL([], [predeps], [1]) +_LT_TAGDECL([], [postdeps], [1]) +_LT_TAGDECL([], [compiler_lib_search_path], [1], + [The library search path used internally by the compiler when linking + a shared library]) +])# _LT_SYS_HIDDEN_LIBDEPS + + +# _LT_LANG_F77_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a Fortran 77 compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_F77_CONFIG], +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test "X$F77" = "Xno"; then + _lt_disable_F77=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the F77 compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_F77" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${F77-"f77"} + CFLAGS=$FFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + GCC=$G77 + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$G77" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC="$lt_save_CC" + CFLAGS="$lt_save_CFLAGS" +fi # test "$_lt_disable_F77" != yes + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_LANG_FC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for a Fortran compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_FC_CONFIG], +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test "X$FC" = "Xno"; then + _lt_disable_FC=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for fc test sources. +ac_ext=${ac_fc_srcext-f} + +# Object file extension for compiled fc test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the FC compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_FC" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${FC-"f95"} + CFLAGS=$FCFLAGS + compiler=$CC + GCC=$ac_cv_fc_compiler_gnu + + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test "$_lt_disable_FC" != yes + +AC_LANG_POP +])# _LT_LANG_FC_CONFIG + + +# _LT_LANG_GCJ_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Java Compiler compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GCJ_CONFIG], +[AC_REQUIRE([LT_PROG_GCJ])dnl +AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GCJ_CONFIG + + +# _LT_LANG_GO_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Go compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GO_CONFIG], +[AC_REQUIRE([LT_PROG_GO])dnl +AC_LANG_SAVE + +# Source file extension for Go test sources. +ac_ext=go + +# Object file extension for compiled Go test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="package main; func main() { }" + +# Code to be used in simple link tests +lt_simple_link_test_code='package main; func main() { }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GOC-"gccgo"} +CFLAGS=$GOFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# Go did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GO_CONFIG + + +# _LT_LANG_RC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for the Windows resource compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_RC_CONFIG], +[AC_REQUIRE([LT_PROG_RC])dnl +AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +CFLAGS= +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +if test -n "$compiler"; then + : + _LT_CONFIG($1) +fi + +GCC=$lt_save_GCC +AC_LANG_RESTORE +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_RC_CONFIG + + +# LT_PROG_GCJ +# ----------- +AC_DEFUN([LT_PROG_GCJ], +[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_GCJ], []) + + +# LT_PROG_GO +# ---------- +AC_DEFUN([LT_PROG_GO], +[AC_CHECK_TOOL(GOC, gccgo,) +]) + + +# LT_PROG_RC +# ---------- +AC_DEFUN([LT_PROG_RC], +[AC_CHECK_TOOL(RC, windres,) +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_RC], []) + + +# _LT_DECL_EGREP +# -------------- +# If we don't have a new enough Autoconf to choose the best grep +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_EGREP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +test -z "$GREP" && GREP=grep +_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) +_LT_DECL([], [EGREP], [1], [An ERE matcher]) +_LT_DECL([], [FGREP], [1], [A literal string matcher]) +dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too +AC_SUBST([GREP]) +]) + + +# _LT_DECL_OBJDUMP +# -------------- +# If we don't have a new enough Autoconf to choose the best objdump +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_OBJDUMP], +[AC_CHECK_TOOL(OBJDUMP, objdump, false) +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +AC_SUBST([OBJDUMP]) +]) + +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) + +# _LT_DECL_SED +# ------------ +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +m4_defun([_LT_DECL_SED], +[AC_PROG_SED +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" +_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) +_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], + [Sed that helps us avoid accidentally triggering echo(1) options like -n]) +])# _LT_DECL_SED + +m4_ifndef([AC_PROG_SED], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ + +m4_defun([AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +])#AC_PROG_SED +])#m4_ifndef + +# Old name: +AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_SED], []) + + +# _LT_CHECK_SHELL_FEATURES +# ------------------------ +# Find out whether the shell is Bourne or XSI compatible, +# or has some other useful features. +m4_defun([_LT_CHECK_SHELL_FEATURES], +[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +AC_MSG_RESULT([$xsi_shell]) +_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) + +AC_MSG_CHECKING([whether the shell understands "+="]) +lt_shell_append=no +( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +AC_MSG_RESULT([$lt_shell_append]) +_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac +_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl +_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +])# _LT_CHECK_SHELL_FEATURES + + +# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) +# ------------------------------------------------------ +# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and +# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. +m4_defun([_LT_PROG_FUNCTION_REPLACE], +[dnl { +sed -e '/^$1 ()$/,/^} # $1 /c\ +$1 ()\ +{\ +m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) +} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: +]) + + +# _LT_PROG_REPLACE_SHELLFNS +# ------------------------- +# Replace existing portable implementations of several shell functions with +# equivalent extended shell implementations where those features are available.. +m4_defun([_LT_PROG_REPLACE_SHELLFNS], +[if test x"$xsi_shell" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl + func_split_long_opt_name=${1%%=*} + func_split_long_opt_arg=${1#*=}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) + + _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) + + _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) + + _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) +fi + +if test x"$lt_shell_append" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) + + _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl + func_quote_for_eval "${2}" +dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ + eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) +fi +]) + +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine which file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac +]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4 new file mode 100644 index 0000000..5d9acd8 --- /dev/null +++ b/m4/ltoptions.m4 @@ -0,0 +1,384 @@ +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 7 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option `$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl `shared' nor `disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + ]) +])# _LT_SET_OPTIONS + + +## --------------------------------- ## +## Macros to handle LT_INIT options. ## +## --------------------------------- ## + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [1], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the `shared' and +# `disable-shared' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the `static' and +# `disable-static' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the `fast-install' +# and `disable-fast-install' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the `pic-only' and `no-pic' +# LT_INIT options. +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [pic_mode=default]) + +test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + +## ----------------- ## +## LTDL_INIT Options ## +## ----------------- ## + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4 new file mode 100644 index 0000000..9000a05 --- /dev/null +++ b/m4/ltsugar.m4 @@ -0,0 +1,123 @@ +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59 which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) diff --git a/m4/ltversion.m4 b/m4/ltversion.m4 new file mode 100644 index 0000000..07a8602 --- /dev/null +++ b/m4/ltversion.m4 @@ -0,0 +1,23 @@ +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# @configure_input@ + +# serial 3337 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.4.2]) +m4_define([LT_PACKAGE_REVISION], [1.3337]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.4.2' +macro_revision='1.3337' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4 new file mode 100644 index 0000000..c573da9 --- /dev/null +++ b/m4/lt~obsolete.m4 @@ -0,0 +1,98 @@ +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 5 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/missing b/missing new file mode 100755 index 0000000..86a8fc3 --- /dev/null +++ b/missing @@ -0,0 +1,331 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2012-01-06.13; # UTC + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# 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, 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, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and +\`g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) + # Not GNU programs, they don't have --version. + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $program in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te*) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison*|yacc*) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG=\${$#} + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex*|flex*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG=\${$#} + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit $? + fi + ;; + + makeinfo*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/packaging/libgee.changes b/packaging/libgee.changes new file mode 100644 index 0000000..15b2ea7 --- /dev/null +++ b/packaging/libgee.changes @@ -0,0 +1,2 @@ +* Wed Nov 14 13:39:56 CET 2012 - Mark Ryan +- Submit version 0.6.6.1 ( 38af23e ) of libgee \ No newline at end of file diff --git a/packaging/libgee.spec b/packaging/libgee.spec new file mode 100644 index 0000000..83a5d1f --- /dev/null +++ b/packaging/libgee.spec @@ -0,0 +1,92 @@ +# +# Do NOT Edit the Auto-generated Part! +# Generated by: spectacle version 0.22 +# +# >> macros +# << macros + +Name: libgee +Summary: GObject collection library +Version: 0.6.6 +Release: 1 +Group: System/Libraries +License: LGPLv2+ +URL: http://live.gnome.org/Libgee +Source0: http://download.gnome.org/sources/%{name}/0.6/%{name}-%{version}.tar.bz2 +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(gobject-2.0) + + +%description +libgee is a collection library providing GObject-based interfaces and +classes for commonly used data structures. + + + +%package devel +Summary: Development files for %{name} +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: pkgconfig + +%description devel +The %{name}-devel package contains libraries and header files for +developing applications that use %{name}. + + + +%prep +%setup -q -n %{name}-%{version} + +# >> setup +# << setup + +%build +# >> build pre +# << build pre + +%configure --disable-static +make %{?jobs:-j%jobs} + +# >> build post +# << build post +%install +rm -rf %{buildroot} +# >> install pre +# << install pre +%make_install + +# >> install post +find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' + + +# << install post + + + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + + + + + +%files +%defattr(-,root,root,-) +# >> files +%doc COPYING +%{_libdir}/*.so.* +# << files + + +%files devel +%defattr(-,root,root,-) +# >> files devel +%{_includedir}/* +%{_libdir}/*.so +%{_libdir}/pkgconfig/gee-1.0.pc +%{_datadir}/vala/vapi/gee-1.0.vapi +# << files devel diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..b4bfffd --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,87 @@ +include $(top_srcdir)/Makefile.decl + +NULL = + +AM_CPPFLAGS = \ + -I$(top_srcdir)/gee \ + $(GLIB_CFLAGS) \ + $(NULL) + +noinst_PROGRAMS = $(TEST_PROGS) + +progs_ldadd = $(GLIB_LIBS) ../gee/libgee.la + +BUILT_SOURCES = tests.vala.stamp + +TEST_PROGS += tests +tests_VALASOURCES = \ + testarraylist.vala \ + testcase.vala \ + testcollection.vala \ + testcomparable.vala \ + testdeque.vala \ + testhashmap.vala \ + testhashmultimap.vala \ + testhashmultiset.vala \ + testhashset.vala \ + testlinkedlist.vala \ + testlinkedlistasdeque.vala \ + testlist.vala \ + testmain.vala \ + testmap.vala \ + testmultimap.vala \ + testmultiset.vala \ + testpriorityqueue.vala \ + testqueue.vala \ + testreadonlycollection.vala \ + testreadonlylist.vala \ + testreadonlymap.vala \ + testreadonlyset.vala \ + testset.vala \ + testsortedset.vala \ + testtreemap.vala \ + testtreemultimap.vala \ + testtreemultiset.vala \ + testtreeset.vala \ + $(NULL) + +tests_DEPENDENCIES = $(top_srcdir)/gee/gee-1.0.vapi + +tests_SOURCES = tests.vala.stamp $(tests_VALASOURCES:.vala=.c) +tests.vala.stamp: $(tests_VALASOURCES) + $(VALAC) -C --basedir $(top_srcdir) --vapidir $(top_srcdir)/gee --pkg gee-1.0 --pkg posix $^ + touch $@ +tests_LDADD = $(progs_ldadd) +EXTRA_DIST += $(tests_VALASOURCES) + +coverage-reset: + lcov --base-directory=@top_srcdir@ --directory @top_srcdir@/gee --zerocounters + +coverage-report: + lcov --directory @top_srcdir@/gee \ + --capture \ + --output-file @top_builddir@/lcov.info + + lcov --directory @top_srcdir@/gee \ + --output-file @top_builddir@/lcov.info \ + --remove @top_builddir@/lcov.info \ + "/usr/include/*" "*.c" "*.h" "*.vapi" + + $(mkdir_p) @top_builddir@/tests/coverage + git_commit=`GIT_DIR=@top_srcdir@/.git git log -1 --pretty=format:%h 2>/dev/null`;\ + genhtml --title "@PACKAGE_STRING@ $$git_commit" \ + --output-directory @top_builddir@/tests/coverage @top_builddir@/lcov.info + @echo + @echo 'lcov report can be found in:' + @echo 'file://@abs_top_builddir@/tests/coverage/index.html' + @echo + +MAINTAINERCLEANFILES = \ + $(tests_VALASOURCES:.vala=.c) \ + tests.vala.stamp \ + $(NULL) + +clean-local: + -rm -rf coverage + +.PHONY: coverage-report diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..405ce55 --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,720 @@ +# Makefile.in generated by automake 1.11.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# GLIB - Library of useful C routines + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/Makefile.decl +noinst_PROGRAMS = $(am__EXEEXT_1) +subdir = tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__EXEEXT_1 = tests$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +am__objects_1 = +am__objects_2 = testarraylist.$(OBJEXT) testcase.$(OBJEXT) \ + testcollection.$(OBJEXT) testcomparable.$(OBJEXT) \ + testdeque.$(OBJEXT) testhashmap.$(OBJEXT) \ + testhashmultimap.$(OBJEXT) testhashmultiset.$(OBJEXT) \ + testhashset.$(OBJEXT) testlinkedlist.$(OBJEXT) \ + testlinkedlistasdeque.$(OBJEXT) testlist.$(OBJEXT) \ + testmain.$(OBJEXT) testmap.$(OBJEXT) testmultimap.$(OBJEXT) \ + testmultiset.$(OBJEXT) testpriorityqueue.$(OBJEXT) \ + testqueue.$(OBJEXT) testreadonlycollection.$(OBJEXT) \ + testreadonlylist.$(OBJEXT) testreadonlymap.$(OBJEXT) \ + testreadonlyset.$(OBJEXT) testset.$(OBJEXT) \ + testsortedset.$(OBJEXT) testtreemap.$(OBJEXT) \ + testtreemultimap.$(OBJEXT) testtreemultiset.$(OBJEXT) \ + testtreeset.$(OBJEXT) $(am__objects_1) +am_tests_OBJECTS = $(am__objects_2) +tests_OBJECTS = $(am_tests_OBJECTS) +am__DEPENDENCIES_1 = +am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) ../gee/libgee.la +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(tests_SOURCES) +DIST_SOURCES = $(tests_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COVERAGE_CFLAGS = @COVERAGE_CFLAGS@ +COVERAGE_LIBS = @COVERAGE_LIBS@ +COVERAGE_VALAFLAGS = @COVERAGE_VALAFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LCOV = @LCOV@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGEE_LT_VERSION = @LIBGEE_LT_VERSION@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VALAC = @VALAC@ +VALADOC = @VALADOC@ +VALAFLAGS = @VALAFLAGS@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +GTESTER = gtester +GTESTER_REPORT = gtester-report + +# initialize variables for unconditional += appending +EXTRA_DIST = $(tests_VALASOURCES) +TEST_PROGS = tests +NULL = +AM_CPPFLAGS = \ + -I$(top_srcdir)/gee \ + $(GLIB_CFLAGS) \ + $(NULL) + +progs_ldadd = $(GLIB_LIBS) ../gee/libgee.la +BUILT_SOURCES = tests.vala.stamp +tests_VALASOURCES = \ + testarraylist.vala \ + testcase.vala \ + testcollection.vala \ + testcomparable.vala \ + testdeque.vala \ + testhashmap.vala \ + testhashmultimap.vala \ + testhashmultiset.vala \ + testhashset.vala \ + testlinkedlist.vala \ + testlinkedlistasdeque.vala \ + testlist.vala \ + testmain.vala \ + testmap.vala \ + testmultimap.vala \ + testmultiset.vala \ + testpriorityqueue.vala \ + testqueue.vala \ + testreadonlycollection.vala \ + testreadonlylist.vala \ + testreadonlymap.vala \ + testreadonlyset.vala \ + testset.vala \ + testsortedset.vala \ + testtreemap.vala \ + testtreemultimap.vala \ + testtreemultiset.vala \ + testtreeset.vala \ + $(NULL) + +tests_DEPENDENCIES = $(top_srcdir)/gee/gee-1.0.vapi +tests_SOURCES = tests.vala.stamp $(tests_VALASOURCES:.vala=.c) +tests_LDADD = $(progs_ldadd) +MAINTAINERCLEANFILES = \ + $(tests_VALASOURCES:.vala=.c) \ + tests.vala.stamp \ + $(NULL) + +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.decl $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/Makefile.decl: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +tests$(EXEEXT): $(tests_OBJECTS) $(tests_DEPENDENCIES) $(EXTRA_tests_DEPENDENCIES) + @rm -f tests$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tests_OBJECTS) $(tests_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testarraylist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcase.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcollection.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcomparable.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testdeque.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testhashmap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testhashmultimap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testhashmultiset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testhashset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testlinkedlist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testlinkedlistasdeque.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testlist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testmain.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testmap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testmultimap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testmultiset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testpriorityqueue.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testqueue.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testreadonlycollection.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testreadonlylist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testreadonlymap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testreadonlyset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testsortedset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testtreemap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testtreemultimap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testtreemultiset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testtreeset.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-local +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: all check check-am install install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \ + clean-generic clean-libtool clean-local clean-noinstPROGRAMS \ + ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +### testing rules + +# test: run all tests in cwd and subdirs +test: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} + @ for subdir in $(SUBDIRS) . ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done +# test-report: run tests in subdirs and generate report +# perf-report: run tests in subdirs with -m perf and generate report +# full-report: like test-report: with -m perf and -m slow +test-report perf-report full-report: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || { \ + case $@ in \ + test-report) test_options="-k";; \ + perf-report) test_options="-k -m=perf";; \ + full-report) test_options="-k -m=perf -m=slow";; \ + esac ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \ + elif test -n "${TEST_PROGS}" ; then \ + ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \ + fi ; \ + } + @ ignore_logdir=true ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \ + ignore_logdir=false ; \ + fi ; \ + for subdir in $(SUBDIRS) . ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done ; \ + $$ignore_logdir || { \ + echo '' > $@.xml ; \ + echo '' >> $@.xml ; \ + for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \ + sed '1,1s/^?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \ + done ; \ + echo >> $@.xml ; \ + echo '' >> $@.xml ; \ + rm -rf "$$GTESTER_LOGDIR"/ ; \ + ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \ + } +.PHONY: test test-report perf-report full-report +# run make test as part of make check +check-local: test +tests.vala.stamp: $(tests_VALASOURCES) + $(VALAC) -C --basedir $(top_srcdir) --vapidir $(top_srcdir)/gee --pkg gee-1.0 --pkg posix $^ + touch $@ + +coverage-reset: + lcov --base-directory=@top_srcdir@ --directory @top_srcdir@/gee --zerocounters + +coverage-report: + lcov --directory @top_srcdir@/gee \ + --capture \ + --output-file @top_builddir@/lcov.info + + lcov --directory @top_srcdir@/gee \ + --output-file @top_builddir@/lcov.info \ + --remove @top_builddir@/lcov.info \ + "/usr/include/*" "*.c" "*.h" "*.vapi" + + $(mkdir_p) @top_builddir@/tests/coverage + git_commit=`GIT_DIR=@top_srcdir@/.git git log -1 --pretty=format:%h 2>/dev/null`;\ + genhtml --title "@PACKAGE_STRING@ $$git_commit" \ + --output-directory @top_builddir@/tests/coverage @top_builddir@/lcov.info + @echo + @echo 'lcov report can be found in:' + @echo 'file://@abs_top_builddir@/tests/coverage/index.html' + @echo + +clean-local: + -rm -rf coverage + +.PHONY: coverage-report + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/testarraylist.c b/tests/testarraylist.c new file mode 100644 index 0000000..423396e --- /dev/null +++ b/tests/testarraylist.c @@ -0,0 +1,766 @@ +/* testarraylist.c generated by valac 0.18.0, the Vala compiler + * generated from testarraylist.vala, do not modify */ + +/* testarraylist.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes Villevalois + * Julien Peeters + */ + +#include +#include +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_LIST_TESTS (list_tests_get_type ()) +#define LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LIST_TESTS, ListTests)) +#define LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LIST_TESTS, ListTestsClass)) +#define IS_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LIST_TESTS)) +#define IS_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LIST_TESTS)) +#define LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LIST_TESTS, ListTestsClass)) + +typedef struct _ListTests ListTests; +typedef struct _ListTestsClass ListTestsClass; +typedef struct _ListTestsPrivate ListTestsPrivate; + +#define TYPE_ARRAY_LIST_TESTS (array_list_tests_get_type ()) +#define ARRAY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ARRAY_LIST_TESTS, ArrayListTests)) +#define ARRAY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ARRAY_LIST_TESTS, ArrayListTestsClass)) +#define IS_ARRAY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ARRAY_LIST_TESTS)) +#define IS_ARRAY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ARRAY_LIST_TESTS)) +#define ARRAY_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ARRAY_LIST_TESTS, ArrayListTestsClass)) + +typedef struct _ArrayListTests ArrayListTests; +typedef struct _ArrayListTestsClass ArrayListTestsClass; +typedef struct _ArrayListTestsPrivate ArrayListTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _ListTests { + CollectionTests parent_instance; + ListTestsPrivate * priv; +}; + +struct _ListTestsClass { + CollectionTestsClass parent_class; + void (*test_duplicates_are_retained) (ListTests* self); +}; + +struct _ArrayListTests { + ListTests parent_instance; + ArrayListTestsPrivate * priv; +}; + +struct _ArrayListTestsClass { + ListTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer array_list_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType list_tests_get_type (void) G_GNUC_CONST; +GType array_list_tests_get_type (void) G_GNUC_CONST; +enum { + ARRAY_LIST_TESTS_DUMMY_PROPERTY +}; +#define ARRAY_LIST_TESTS_BIG_SORT_SIZE 1000000 +ArrayListTests* array_list_tests_new (void); +ArrayListTests* array_list_tests_construct (GType object_type); +ListTests* list_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void array_list_tests_test_selected_functions (ArrayListTests* self); +static void _array_list_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +void array_list_tests_test_gobject_properties (ArrayListTests* self); +static void _array_list_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +static void array_list_tests_test_small_sort (ArrayListTests* self); +static void _array_list_tests_test_small_sort_gee_test_case_test_method (gpointer self); +static void array_list_tests_test_big_sort (ArrayListTests* self); +static void _array_list_tests_test_big_sort_gee_test_case_test_method (gpointer self); +static void array_list_tests_test_typed_to_array (ArrayListTests* self); +static void _array_list_tests_test_typed_to_array_gee_test_case_test_method (gpointer self); +static void array_list_tests_real_set_up (GeeTestCase* base); +static void array_list_tests_real_tear_down (GeeTestCase* base); +static gdouble* _double_dup (gdouble* self); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); + + +static void _array_list_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + array_list_tests_test_selected_functions (self); +} + + +static void _array_list_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + array_list_tests_test_gobject_properties (self); +} + + +static void _array_list_tests_test_small_sort_gee_test_case_test_method (gpointer self) { + array_list_tests_test_small_sort (self); +} + + +static void _array_list_tests_test_big_sort_gee_test_case_test_method (gpointer self) { + array_list_tests_test_big_sort (self); +} + + +static void _array_list_tests_test_typed_to_array_gee_test_case_test_method (gpointer self) { + array_list_tests_test_typed_to_array (self); +} + + +ArrayListTests* array_list_tests_construct (GType object_type) { + ArrayListTests * self = NULL; + self = (ArrayListTests*) list_tests_construct (object_type, "ArrayList"); + gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] selected functions", _array_list_tests_test_selected_functions_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] GObject properties", _array_list_tests_test_gobject_properties_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] small sort (insertion)", _array_list_tests_test_small_sort_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] big sort (timsort)", _array_list_tests_test_big_sort_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] typed to_array calls", _array_list_tests_test_typed_to_array_gee_test_case_test_method, self); + return self; +} + + +ArrayListTests* array_list_tests_new (void) { + return array_list_tests_construct (TYPE_ARRAY_LIST_TESTS); +} + + +static void array_list_tests_real_set_up (GeeTestCase* base) { + ArrayListTests * self; + GeeArrayList* _tmp0_; + self = (ArrayListTests*) base; + _tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; +} + + +static void array_list_tests_real_tear_down (GeeTestCase* base) { + ArrayListTests * self; + self = (ArrayListTests*) base; + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void array_list_tests_test_selected_functions (ArrayListTests* self) { + GeeCollection* _tmp0_; + GeeArrayList* _tmp1_; + GeeArrayList* test_list; + GEqualFunc _tmp2_; + GEqualFunc _tmp3_; + GEqualFunc _tmp4_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_ARRAY_LIST) ? ((GeeArrayList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + _tmp2_ = gee_array_list_get_equal_func (test_list); + _tmp3_ = _tmp2_; + _tmp4_ = g_str_equal; + _vala_assert (_tmp3_ == _tmp4_, "test_list.equal_func == str_equal"); + _g_object_unref0 (test_list); +} + + +void array_list_tests_test_gobject_properties (ArrayListTests* self) { + GeeCollection* _tmp0_; + GeeArrayList* _tmp1_; + GeeArrayList* test_list; + GValue value = {0}; + GValue _tmp2_ = {0}; + GValue _tmp3_; + void* _tmp4_ = NULL; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_ARRAY_LIST) ? ((GeeArrayList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + g_value_init (&_tmp2_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp2_; + _tmp3_ = value; + g_object_get_property ((GObject*) test_list, "equal-func", &value); + _tmp4_ = g_value_get_pointer (&value); + _tmp5_ = gee_array_list_get_equal_func (test_list); + _tmp6_ = _tmp5_; + _vala_assert (_tmp4_ == ((void*) _tmp6_), "value.get_pointer () == (void*) test_list.equal_func"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + _g_object_unref0 (test_list); +} + + +static void array_list_tests_test_small_sort (ArrayListTests* self) { + GeeCollection* _tmp0_; + GeeArrayList* _tmp1_; + GeeArrayList* test_list; + gpointer _tmp2_ = NULL; + gchar* _tmp3_; + gpointer _tmp4_ = NULL; + gchar* _tmp5_; + gpointer _tmp6_ = NULL; + gchar* _tmp7_; + gpointer _tmp8_ = NULL; + gchar* _tmp9_; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gpointer _tmp12_ = NULL; + gchar* _tmp13_; + gpointer _tmp14_ = NULL; + gchar* _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_ARRAY_LIST) ? ((GeeArrayList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "one"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "two"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "three"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "four"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "five"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "six"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "seven"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "eight"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "nine"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "ten"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "eleven"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "twelve"); + gee_list_sort ((GeeList*) test_list, NULL); + _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 0); + _tmp3_ = (gchar*) _tmp2_; + _vala_assert (g_strcmp0 (_tmp3_, "eight") == 0, "test_list.get (0) == \"eight\""); + _g_free0 (_tmp3_); + _tmp4_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 1); + _tmp5_ = (gchar*) _tmp4_; + _vala_assert (g_strcmp0 (_tmp5_, "eleven") == 0, "test_list.get (1) == \"eleven\""); + _g_free0 (_tmp5_); + _tmp6_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 2); + _tmp7_ = (gchar*) _tmp6_; + _vala_assert (g_strcmp0 (_tmp7_, "five") == 0, "test_list.get (2) == \"five\""); + _g_free0 (_tmp7_); + _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 3); + _tmp9_ = (gchar*) _tmp8_; + _vala_assert (g_strcmp0 (_tmp9_, "four") == 0, "test_list.get (3) == \"four\""); + _g_free0 (_tmp9_); + _tmp10_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 4); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "nine") == 0, "test_list.get (4) == \"nine\""); + _g_free0 (_tmp11_); + _tmp12_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 5); + _tmp13_ = (gchar*) _tmp12_; + _vala_assert (g_strcmp0 (_tmp13_, "one") == 0, "test_list.get (5) == \"one\""); + _g_free0 (_tmp13_); + _tmp14_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 6); + _tmp15_ = (gchar*) _tmp14_; + _vala_assert (g_strcmp0 (_tmp15_, "seven") == 0, "test_list.get (6) == \"seven\""); + _g_free0 (_tmp15_); + _tmp16_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 7); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (g_strcmp0 (_tmp17_, "six") == 0, "test_list.get (7) == \"six\""); + _g_free0 (_tmp17_); + _tmp18_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 8); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (g_strcmp0 (_tmp19_, "ten") == 0, "test_list.get (8) == \"ten\""); + _g_free0 (_tmp19_); + _tmp20_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 9); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "three") == 0, "test_list.get (9) == \"three\""); + _g_free0 (_tmp21_); + _tmp22_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 10); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (g_strcmp0 (_tmp23_, "twelve") == 0, "test_list.get (10) == \"twelve\""); + _g_free0 (_tmp23_); + _tmp24_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 11); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "two") == 0, "test_list.get (11) == \"two\""); + _g_free0 (_tmp25_); + _g_object_unref0 (test_list); +} + + +static void array_list_tests_test_big_sort (ArrayListTests* self) { + GeeArrayList* _tmp0_; + GeeList* big_test_list; + GeeList* _tmp7_; + g_return_if_fail (self != NULL); + _tmp0_ = gee_array_list_new (G_TYPE_INT, NULL, NULL, NULL); + big_test_list = (GeeList*) _tmp0_; + { + gint i; + i = 0; + { + gboolean _tmp1_; + _tmp1_ = TRUE; + while (TRUE) { + gboolean _tmp2_; + gint _tmp4_; + GeeList* _tmp5_; + gint32 _tmp6_ = 0; + _tmp2_ = _tmp1_; + if (!_tmp2_) { + gint _tmp3_; + _tmp3_ = i; + i = _tmp3_ + 1; + } + _tmp1_ = FALSE; + _tmp4_ = i; + if (!(_tmp4_ < ARRAY_LIST_TESTS_BIG_SORT_SIZE)) { + break; + } + _tmp5_ = big_test_list; + _tmp6_ = g_random_int_range ((gint32) 1, (gint32) (ARRAY_LIST_TESTS_BIG_SORT_SIZE - 1)); + gee_collection_add ((GeeCollection*) _tmp5_, (gpointer) ((gintptr) _tmp6_)); + } + } + } + _tmp7_ = big_test_list; + gee_list_sort (_tmp7_, NULL); + { + gint i; + i = 1; + { + gboolean _tmp8_; + _tmp8_ = TRUE; + while (TRUE) { + gboolean _tmp9_; + gint _tmp11_; + GeeList* _tmp12_; + gint _tmp13_; + gpointer _tmp14_ = NULL; + GeeList* _tmp15_; + gint _tmp16_; + gpointer _tmp17_ = NULL; + _tmp9_ = _tmp8_; + if (!_tmp9_) { + gint _tmp10_; + _tmp10_ = i; + i = _tmp10_ + 1; + } + _tmp8_ = FALSE; + _tmp11_ = i; + if (!(_tmp11_ < ARRAY_LIST_TESTS_BIG_SORT_SIZE)) { + break; + } + _tmp12_ = big_test_list; + _tmp13_ = i; + _tmp14_ = gee_list_get (_tmp12_, _tmp13_ - 1); + _tmp15_ = big_test_list; + _tmp16_ = i; + _tmp17_ = gee_list_get (_tmp15_, _tmp16_); + _vala_assert (((gint32) ((gintptr) _tmp14_)) <= ((gint32) ((gintptr) _tmp17_)), "big_test_list[i - 1] <= big_test_list[i]"); + } + } + } + _g_object_unref0 (big_test_list); +} + + +static gdouble* _double_dup (gdouble* self) { + gdouble* dup; + dup = g_new0 (gdouble, 1); + memcpy (dup, self, sizeof (gdouble)); + return dup; +} + + +static void array_list_tests_test_typed_to_array (ArrayListTests* self) { + GeeArrayList* _tmp0_; + GeeList* bool_list; + GeeList* _tmp1_; + gboolean _tmp2_ = FALSE; + GeeList* _tmp3_; + gboolean _tmp4_ = FALSE; + GeeList* _tmp5_; + gboolean _tmp6_ = FALSE; + GeeList* _tmp7_; + gint _tmp8_ = 0; + gpointer* _tmp9_ = NULL; + gboolean* bool_array; + gint bool_array_length1; + gint _bool_array_size_; + gint index; + GeeArrayList* _tmp25_; + GeeList* int_list; + GeeList* _tmp26_; + gboolean _tmp27_ = FALSE; + GeeList* _tmp28_; + gboolean _tmp29_ = FALSE; + GeeList* _tmp30_; + gboolean _tmp31_ = FALSE; + GeeList* _tmp32_; + gint _tmp33_ = 0; + gpointer* _tmp34_ = NULL; + gint* int_array; + gint int_array_length1; + gint _int_array_size_; + GeeArrayList* _tmp50_; + GeeList* double_list; + GeeList* _tmp51_; + gdouble _tmp52_; + gboolean _tmp53_ = FALSE; + GeeList* _tmp54_; + gdouble _tmp55_; + gboolean _tmp56_ = FALSE; + GeeList* _tmp57_; + gdouble _tmp58_; + gboolean _tmp59_ = FALSE; + GeeList* _tmp60_; + gint _tmp61_ = 0; + gpointer* _tmp62_ = NULL; + gdouble** double_array; + gint double_array_length1; + gint _double_array_size_; + g_return_if_fail (self != NULL); + _tmp0_ = gee_array_list_new (G_TYPE_BOOLEAN, NULL, NULL, NULL); + bool_list = (GeeList*) _tmp0_; + _tmp1_ = bool_list; + _tmp2_ = gee_collection_add ((GeeCollection*) _tmp1_, (gpointer) ((gintptr) TRUE)); + _vala_assert (_tmp2_, "bool_list.add (true)"); + _tmp3_ = bool_list; + _tmp4_ = gee_collection_add ((GeeCollection*) _tmp3_, (gpointer) ((gintptr) TRUE)); + _vala_assert (_tmp4_, "bool_list.add (true)"); + _tmp5_ = bool_list; + _tmp6_ = gee_collection_add ((GeeCollection*) _tmp5_, (gpointer) ((gintptr) FALSE)); + _vala_assert (_tmp6_, "bool_list.add (false)"); + _tmp7_ = bool_list; + _tmp9_ = gee_collection_to_array ((GeeCollection*) _tmp7_, &_tmp8_); + bool_array = _tmp9_; + bool_array_length1 = _tmp8_; + _bool_array_size_ = bool_array_length1; + index = 0; + { + GeeList* _tmp10_; + GeeList* _tmp11_; + GeeList* _element_list; + GeeList* _tmp12_; + gint _tmp13_; + gint _tmp14_; + gint _element_size; + gint _element_index; + _tmp10_ = bool_list; + _tmp11_ = _g_object_ref0 (_tmp10_); + _element_list = _tmp11_; + _tmp12_ = _element_list; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _element_size = _tmp14_; + _element_index = -1; + while (TRUE) { + gint _tmp15_; + gint _tmp16_; + gint _tmp17_; + GeeList* _tmp18_; + gint _tmp19_; + gpointer _tmp20_ = NULL; + gboolean element; + gboolean _tmp21_; + gboolean* _tmp22_; + gint _tmp22__length1; + gint _tmp23_; + gboolean _tmp24_; + _tmp15_ = _element_index; + _element_index = _tmp15_ + 1; + _tmp16_ = _element_index; + _tmp17_ = _element_size; + if (!(_tmp16_ < _tmp17_)) { + break; + } + _tmp18_ = _element_list; + _tmp19_ = _element_index; + _tmp20_ = gee_list_get (_tmp18_, _tmp19_); + element = (gboolean) ((gintptr) _tmp20_); + _tmp21_ = element; + _tmp22_ = bool_array; + _tmp22__length1 = bool_array_length1; + _tmp23_ = index; + index = _tmp23_ + 1; + _tmp24_ = _tmp22_[_tmp23_]; + _vala_assert (_tmp21_ == _tmp24_, "element == bool_array[index++]"); + } + _g_object_unref0 (_element_list); + } + _tmp25_ = gee_array_list_new (G_TYPE_INT, NULL, NULL, NULL); + int_list = (GeeList*) _tmp25_; + _tmp26_ = int_list; + _tmp27_ = gee_collection_add ((GeeCollection*) _tmp26_, (gpointer) ((gintptr) 1)); + _vala_assert (_tmp27_, "int_list.add (1)"); + _tmp28_ = int_list; + _tmp29_ = gee_collection_add ((GeeCollection*) _tmp28_, (gpointer) ((gintptr) 2)); + _vala_assert (_tmp29_, "int_list.add (2)"); + _tmp30_ = int_list; + _tmp31_ = gee_collection_add ((GeeCollection*) _tmp30_, (gpointer) ((gintptr) 3)); + _vala_assert (_tmp31_, "int_list.add (3)"); + _tmp32_ = int_list; + _tmp34_ = gee_collection_to_array ((GeeCollection*) _tmp32_, &_tmp33_); + int_array = _tmp34_; + int_array_length1 = _tmp33_; + _int_array_size_ = int_array_length1; + index = 0; + { + GeeList* _tmp35_; + GeeList* _tmp36_; + GeeList* _element_list; + GeeList* _tmp37_; + gint _tmp38_; + gint _tmp39_; + gint _element_size; + gint _element_index; + _tmp35_ = int_list; + _tmp36_ = _g_object_ref0 (_tmp35_); + _element_list = _tmp36_; + _tmp37_ = _element_list; + _tmp38_ = gee_collection_get_size ((GeeCollection*) _tmp37_); + _tmp39_ = _tmp38_; + _element_size = _tmp39_; + _element_index = -1; + while (TRUE) { + gint _tmp40_; + gint _tmp41_; + gint _tmp42_; + GeeList* _tmp43_; + gint _tmp44_; + gpointer _tmp45_ = NULL; + gint element; + gint _tmp46_; + gint* _tmp47_; + gint _tmp47__length1; + gint _tmp48_; + gint _tmp49_; + _tmp40_ = _element_index; + _element_index = _tmp40_ + 1; + _tmp41_ = _element_index; + _tmp42_ = _element_size; + if (!(_tmp41_ < _tmp42_)) { + break; + } + _tmp43_ = _element_list; + _tmp44_ = _element_index; + _tmp45_ = gee_list_get (_tmp43_, _tmp44_); + element = (gint) ((gintptr) _tmp45_); + _tmp46_ = element; + _tmp47_ = int_array; + _tmp47__length1 = int_array_length1; + _tmp48_ = index; + index = _tmp48_ + 1; + _tmp49_ = _tmp47_[_tmp48_]; + _vala_assert (_tmp46_ == _tmp49_, "element == int_array[index++]"); + } + _g_object_unref0 (_element_list); + } + _tmp50_ = gee_array_list_new (G_TYPE_DOUBLE, (GBoxedCopyFunc) _double_dup, g_free, NULL); + double_list = (GeeList*) _tmp50_; + _tmp51_ = double_list; + _tmp52_ = 1.0; + _tmp53_ = gee_collection_add ((GeeCollection*) _tmp51_, &_tmp52_); + _vala_assert (_tmp53_, "double_list.add (1.0d)"); + _tmp54_ = double_list; + _tmp55_ = 1.5; + _tmp56_ = gee_collection_add ((GeeCollection*) _tmp54_, &_tmp55_); + _vala_assert (_tmp56_, "double_list.add (1.5d)"); + _tmp57_ = double_list; + _tmp58_ = 2.0; + _tmp59_ = gee_collection_add ((GeeCollection*) _tmp57_, &_tmp58_); + _vala_assert (_tmp59_, "double_list.add (2.0d)"); + _tmp60_ = double_list; + _tmp62_ = gee_collection_to_array ((GeeCollection*) _tmp60_, &_tmp61_); + double_array = _tmp62_; + double_array_length1 = _tmp61_; + _double_array_size_ = double_array_length1; + index = 0; + { + GeeList* _tmp63_; + GeeList* _tmp64_; + GeeList* _element_list; + GeeList* _tmp65_; + gint _tmp66_; + gint _tmp67_; + gint _element_size; + gint _element_index; + _tmp63_ = double_list; + _tmp64_ = _g_object_ref0 (_tmp63_); + _element_list = _tmp64_; + _tmp65_ = _element_list; + _tmp66_ = gee_collection_get_size ((GeeCollection*) _tmp65_); + _tmp67_ = _tmp66_; + _element_size = _tmp67_; + _element_index = -1; + while (TRUE) { + gint _tmp68_; + gint _tmp69_; + gint _tmp70_; + GeeList* _tmp71_; + gint _tmp72_; + gpointer _tmp73_ = NULL; + gdouble* _tmp74_; + gdouble _tmp75_; + gdouble element; + gdouble _tmp76_; + gdouble** _tmp77_; + gint _tmp77__length1; + gint _tmp78_; + gdouble* _tmp79_; + _tmp68_ = _element_index; + _element_index = _tmp68_ + 1; + _tmp69_ = _element_index; + _tmp70_ = _element_size; + if (!(_tmp69_ < _tmp70_)) { + break; + } + _tmp71_ = _element_list; + _tmp72_ = _element_index; + _tmp73_ = gee_list_get (_tmp71_, _tmp72_); + _tmp74_ = (gdouble*) _tmp73_; + _tmp75_ = *_tmp74_; + _g_free0 (_tmp74_); + element = _tmp75_; + _tmp76_ = element; + _tmp77_ = double_array; + _tmp77__length1 = double_array_length1; + _tmp78_ = index; + index = _tmp78_ + 1; + _tmp79_ = _tmp77_[_tmp78_]; + _vala_assert ((_tmp76_) == (*_tmp79_), "element == double_array[index++]"); + } + _g_object_unref0 (_element_list); + } + double_array = (_vala_array_free (double_array, double_array_length1, (GDestroyNotify) g_free), NULL); + _g_object_unref0 (double_list); + int_array = (g_free (int_array), NULL); + _g_object_unref0 (int_list); + bool_array = (g_free (bool_array), NULL); + _g_object_unref0 (bool_list); +} + + +static void array_list_tests_class_init (ArrayListTestsClass * klass) { + array_list_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = array_list_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = array_list_tests_real_tear_down; +} + + +static void array_list_tests_instance_init (ArrayListTests * self) { +} + + +GType array_list_tests_get_type (void) { + static volatile gsize array_list_tests_type_id__volatile = 0; + if (g_once_init_enter (&array_list_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (ArrayListTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) array_list_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ArrayListTests), 0, (GInstanceInitFunc) array_list_tests_instance_init, NULL }; + GType array_list_tests_type_id; + array_list_tests_type_id = g_type_register_static (TYPE_LIST_TESTS, "ArrayListTests", &g_define_type_info, 0); + g_once_init_leave (&array_list_tests_type_id__volatile, array_list_tests_type_id); + } + return array_list_tests_type_id__volatile; +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + + diff --git a/tests/testarraylist.vala b/tests/testarraylist.vala new file mode 100644 index 0000000..9537f79 --- /dev/null +++ b/tests/testarraylist.vala @@ -0,0 +1,161 @@ +/* testarraylist.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes Villevalois + * Julien Peeters + */ + +using Gee; + +public class ArrayListTests : ListTests { + + public ArrayListTests () { + base ("ArrayList"); + add_test ("[ArrayList] selected functions", test_selected_functions); + add_test ("[ArrayList] GObject properties", test_gobject_properties); + add_test ("[ArrayList] small sort (insertion)", test_small_sort); + add_test ("[ArrayList] big sort (timsort)", test_big_sort); + add_test ("[ArrayList] typed to_array calls", test_typed_to_array); + } + + private static const int BIG_SORT_SIZE = 1000000; + + public override void set_up () { + test_collection = new ArrayList (); + } + + public override void tear_down () { + test_collection = null; + } + + public void test_selected_functions () { + var test_list = test_collection as ArrayList; + + // Check the collection exists + assert (test_list != null); + + // Check the selected equal function + assert (test_list.equal_func == str_equal); + } + + public new void test_gobject_properties () { + var test_list = test_collection as ArrayList; + + // Check the list exists + assert (test_list != null); + Value value; + + value = Value (typeof (EqualFunc)); + test_list.get_property ("equal-func", ref value); + assert (value.get_pointer () == (void*) test_list.equal_func); + value.unset (); + } + + private void test_small_sort () { + var test_list = test_collection as ArrayList; + + // Check the collection exists + assert (test_list != null); + + test_list.add ("one"); + test_list.add ("two"); + test_list.add ("three"); + test_list.add ("four"); + test_list.add ("five"); + test_list.add ("six"); + test_list.add ("seven"); + test_list.add ("eight"); + test_list.add ("nine"); + test_list.add ("ten"); + test_list.add ("eleven"); + test_list.add ("twelve"); + + test_list.sort (); + + assert (test_list.get (0) == "eight"); + assert (test_list.get (1) == "eleven"); + assert (test_list.get (2) == "five"); + assert (test_list.get (3) == "four"); + assert (test_list.get (4) == "nine"); + assert (test_list.get (5) == "one"); + assert (test_list.get (6) == "seven"); + assert (test_list.get (7) == "six"); + assert (test_list.get (8) == "ten"); + assert (test_list.get (9) == "three"); + assert (test_list.get (10) == "twelve"); + assert (test_list.get (11) == "two"); + } + + private void test_big_sort () { + Gee.List big_test_list = new ArrayList (); + for (int i = 0; i < BIG_SORT_SIZE; i++) { + big_test_list.add (GLib.Random.int_range (1, BIG_SORT_SIZE - 1)); + } + + big_test_list.sort (); + + for (int i = 1; i < BIG_SORT_SIZE; i++) { + assert (big_test_list[i - 1] <= big_test_list[i]); + } + } + + private void test_typed_to_array () { + // Test with a bool collection + Gee.List bool_list = new ArrayList (); + assert (bool_list.add (true)); + assert (bool_list.add (true)); + assert (bool_list.add (false)); + + bool[] bool_array = bool_list.to_array (); + int index = 0; + foreach (bool element in bool_list) { + assert (element == bool_array[index++]); + } + + // Test with an int collection + Gee.List int_list = new ArrayList (); + assert (int_list.add (1)); + assert (int_list.add (2)); + assert (int_list.add (3)); + + int[] int_array = int_list.to_array (); + index = 0; + foreach (int element in int_list) { + assert (element == int_array[index++]); + } + + // Test with a double collection + Gee.List double_list = new ArrayList (); + assert (double_list.add (1.0d)); + assert (double_list.add (1.5d)); + assert (double_list.add (2.0d)); + +#if VALA_0_16 + double?[] double_array = double_list.to_array (); +#else + double[] double_array = double_list.to_array (); +#endif + index = 0; + foreach (double element in double_list) { + assert (element == double_array[index++]); + } + } +} diff --git a/tests/testcase.c b/tests/testcase.c new file mode 100644 index 0000000..2418301 --- /dev/null +++ b/tests/testcase.c @@ -0,0 +1,561 @@ +/* testcase.c generated by valac 0.18.0, the Vala compiler + * generated from testcase.vala, do not modify */ + +/* testcase.vala + * + * Copyright (C) 2009 Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Julien Peeters + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define GEE_TEST_CASE_TYPE_ADAPTOR (gee_test_case_adaptor_get_type ()) +#define GEE_TEST_CASE_ADAPTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TEST_CASE_TYPE_ADAPTOR, GeeTestCaseAdaptor)) +#define GEE_TEST_CASE_ADAPTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TEST_CASE_TYPE_ADAPTOR, GeeTestCaseAdaptorClass)) +#define GEE_TEST_CASE_IS_ADAPTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TEST_CASE_TYPE_ADAPTOR)) +#define GEE_TEST_CASE_IS_ADAPTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TEST_CASE_TYPE_ADAPTOR)) +#define GEE_TEST_CASE_ADAPTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TEST_CASE_TYPE_ADAPTOR, GeeTestCaseAdaptorClass)) + +typedef struct _GeeTestCaseAdaptor GeeTestCaseAdaptor; +typedef struct _GeeTestCaseAdaptorClass GeeTestCaseAdaptorClass; +#define _gee_test_case_adaptor_unref0(var) ((var == NULL) ? NULL : (var = (gee_test_case_adaptor_unref (var), NULL))) +typedef struct _GeeTestCaseAdaptorPrivate GeeTestCaseAdaptorPrivate; +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +typedef struct _GeeTestCaseParamSpecAdaptor GeeTestCaseParamSpecAdaptor; + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _GeeTestCasePrivate { + GTestSuite* suite; + GeeTestCaseAdaptor** adaptors; + gint adaptors_length1; + gint _adaptors_size_; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); +struct _GeeTestCaseAdaptor { + GTypeInstance parent_instance; + volatile int ref_count; + GeeTestCaseAdaptorPrivate * priv; +}; + +struct _GeeTestCaseAdaptorClass { + GTypeClass parent_class; + void (*finalize) (GeeTestCaseAdaptor *self); +}; + +struct _GeeTestCaseAdaptorPrivate { + gchar* _name; + GeeTestCaseTestMethod test; + gpointer test_target; + GDestroyNotify test_target_destroy_notify; + GeeTestCase* test_case; +}; + +struct _GeeTestCaseParamSpecAdaptor { + GParamSpec parent_instance; +}; + + +static gpointer gee_test_case_parent_class = NULL; +static gpointer gee_test_case_adaptor_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +static gpointer gee_test_case_adaptor_ref (gpointer instance); +static void gee_test_case_adaptor_unref (gpointer instance); +static GParamSpec* gee_test_case_param_spec_adaptor (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) G_GNUC_UNUSED; +static void gee_test_case_value_set_adaptor (GValue* value, gpointer v_object) G_GNUC_UNUSED; +static void gee_test_case_value_take_adaptor (GValue* value, gpointer v_object) G_GNUC_UNUSED; +static gpointer gee_test_case_value_get_adaptor (const GValue* value) G_GNUC_UNUSED; +static GType gee_test_case_adaptor_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +#define GEE_TEST_CASE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_TEST_CASE, GeeTestCasePrivate)) +enum { + GEE_TEST_CASE_DUMMY_PROPERTY +}; +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static GeeTestCaseAdaptor* gee_test_case_adaptor_new (const gchar* name, GeeTestCaseTestMethod test, void* test_target, GeeTestCase* test_case); +static GeeTestCaseAdaptor* gee_test_case_adaptor_construct (GType object_type, const gchar* name, GeeTestCaseTestMethod test, void* test_target, GeeTestCase* test_case); +static void _vala_array_add1 (GeeTestCaseAdaptor*** array, int* length, int* size, GeeTestCaseAdaptor* value); +static const gchar* gee_test_case_adaptor_get_name (GeeTestCaseAdaptor* self); +static void gee_test_case_adaptor_set_up (GeeTestCaseAdaptor* self, void* fixture); +static void _gee_test_case_adaptor_set_up_gtest_func (void* fixture, gpointer self); +static void gee_test_case_adaptor_run (GeeTestCaseAdaptor* self, void* fixture); +static void _gee_test_case_adaptor_run_gtest_func (void* fixture, gpointer self); +static void gee_test_case_adaptor_tear_down (GeeTestCaseAdaptor* self, void* fixture); +static void _gee_test_case_adaptor_tear_down_gtest_func (void* fixture, gpointer self); +void gee_test_case_set_up (GeeTestCase* self); +static void gee_test_case_real_set_up (GeeTestCase* self); +void gee_test_case_tear_down (GeeTestCase* self); +static void gee_test_case_real_tear_down (GeeTestCase* self); +GTestSuite* gee_test_case_get_suite (GeeTestCase* self); +#define GEE_TEST_CASE_ADAPTOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TEST_CASE_TYPE_ADAPTOR, GeeTestCaseAdaptorPrivate)) +enum { + GEE_TEST_CASE_ADAPTOR_DUMMY_PROPERTY +}; +static void gee_test_case_adaptor_set_name (GeeTestCaseAdaptor* self, const gchar* value); +static void gee_test_case_adaptor_finalize (GeeTestCaseAdaptor* obj); +static void gee_test_case_finalize (GObject* obj); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); + + +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name) { + GeeTestCase * self = NULL; + const gchar* _tmp0_; + GTestSuite* _tmp1_; + g_return_val_if_fail (name != NULL, NULL); + self = (GeeTestCase*) g_object_new (object_type, NULL); + _tmp0_ = name; + _tmp1_ = g_test_create_suite (_tmp0_); + self->priv->suite = _tmp1_; + return self; +} + + +static gpointer _gee_test_case_adaptor_ref0 (gpointer self) { + return self ? gee_test_case_adaptor_ref (self) : NULL; +} + + +static void _vala_array_add1 (GeeTestCaseAdaptor*** array, int* length, int* size, GeeTestCaseAdaptor* value) { + if ((*length) == (*size)) { + *size = (*size) ? (2 * (*size)) : 4; + *array = g_renew (GeeTestCaseAdaptor*, *array, (*size) + 1); + } + (*array)[(*length)++] = value; + (*array)[*length] = NULL; +} + + +static void _gee_test_case_adaptor_set_up_gtest_func (void* fixture, gpointer self) { + gee_test_case_adaptor_set_up (self, fixture); +} + + +static void _gee_test_case_adaptor_run_gtest_func (void* fixture, gpointer self) { + gee_test_case_adaptor_run (self, fixture); +} + + +static void _gee_test_case_adaptor_tear_down_gtest_func (void* fixture, gpointer self) { + gee_test_case_adaptor_tear_down (self, fixture); +} + + +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target) { + const gchar* _tmp0_; + GeeTestCaseTestMethod _tmp1_; + void* _tmp1__target; + GeeTestCaseAdaptor* _tmp2_; + GeeTestCaseAdaptor* adaptor; + GeeTestCaseAdaptor** _tmp3_; + gint _tmp3__length1; + GeeTestCaseAdaptor* _tmp4_; + GTestSuite* _tmp5_; + const gchar* _tmp6_; + const gchar* _tmp7_; + GTestCase* _tmp8_; + g_return_if_fail (self != NULL); + g_return_if_fail (name != NULL); + _tmp0_ = name; + _tmp1_ = test; + _tmp1__target = test_target; + _tmp2_ = gee_test_case_adaptor_new (_tmp0_, _tmp1_, _tmp1__target, self); + adaptor = _tmp2_; + _tmp3_ = self->priv->adaptors; + _tmp3__length1 = self->priv->adaptors_length1; + _tmp4_ = _gee_test_case_adaptor_ref0 (adaptor); + _vala_array_add1 (&self->priv->adaptors, &self->priv->adaptors_length1, &self->priv->_adaptors_size_, _tmp4_); + _tmp5_ = self->priv->suite; + _tmp6_ = gee_test_case_adaptor_get_name (adaptor); + _tmp7_ = _tmp6_; + _tmp8_ = g_test_create_case (_tmp7_, (gsize) 0, adaptor, (void (*) (void)) _gee_test_case_adaptor_set_up_gtest_func, (void (*) (void)) _gee_test_case_adaptor_run_gtest_func, (void (*) (void)) _gee_test_case_adaptor_tear_down_gtest_func); + g_test_suite_add (_tmp5_, _tmp8_); + _gee_test_case_adaptor_unref0 (adaptor); +} + + +static void gee_test_case_real_set_up (GeeTestCase* self) { +} + + +void gee_test_case_set_up (GeeTestCase* self) { + g_return_if_fail (self != NULL); + GEE_TEST_CASE_GET_CLASS (self)->set_up (self); +} + + +static void gee_test_case_real_tear_down (GeeTestCase* self) { +} + + +void gee_test_case_tear_down (GeeTestCase* self) { + g_return_if_fail (self != NULL); + GEE_TEST_CASE_GET_CLASS (self)->tear_down (self); +} + + +GTestSuite* gee_test_case_get_suite (GeeTestCase* self) { + GTestSuite* result = NULL; + GTestSuite* _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->suite; + result = _tmp0_; + return result; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static GeeTestCaseAdaptor* gee_test_case_adaptor_construct (GType object_type, const gchar* name, GeeTestCaseTestMethod test, void* test_target, GeeTestCase* test_case) { + GeeTestCaseAdaptor* self = NULL; + const gchar* _tmp0_; + GeeTestCaseTestMethod _tmp1_; + void* _tmp1__target; + GeeTestCase* _tmp2_; + GeeTestCase* _tmp3_; + g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (test_case != NULL, NULL); + self = (GeeTestCaseAdaptor*) g_type_create_instance (object_type); + _tmp0_ = name; + gee_test_case_adaptor_set_name (self, _tmp0_); + _tmp1_ = test; + _tmp1__target = test_target; + (self->priv->test_target_destroy_notify == NULL) ? NULL : (self->priv->test_target_destroy_notify (self->priv->test_target), NULL); + self->priv->test = NULL; + self->priv->test_target = NULL; + self->priv->test_target_destroy_notify = NULL; + self->priv->test = _tmp1_; + self->priv->test_target = _tmp1__target; + self->priv->test_target_destroy_notify = NULL; + _tmp2_ = test_case; + _tmp3_ = _g_object_ref0 (_tmp2_); + _g_object_unref0 (self->priv->test_case); + self->priv->test_case = _tmp3_; + return self; +} + + +static GeeTestCaseAdaptor* gee_test_case_adaptor_new (const gchar* name, GeeTestCaseTestMethod test, void* test_target, GeeTestCase* test_case) { + return gee_test_case_adaptor_construct (GEE_TEST_CASE_TYPE_ADAPTOR, name, test, test_target, test_case); +} + + +static void gee_test_case_adaptor_set_up (GeeTestCaseAdaptor* self, void* fixture) { + GeeTestCase* _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->test_case; + gee_test_case_set_up (_tmp0_); +} + + +static void gee_test_case_adaptor_run (GeeTestCaseAdaptor* self, void* fixture) { + GeeTestCaseTestMethod _tmp0_; + void* _tmp0__target; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->test; + _tmp0__target = self->priv->test_target; + _tmp0_ (_tmp0__target); +} + + +static void gee_test_case_adaptor_tear_down (GeeTestCaseAdaptor* self, void* fixture) { + GeeTestCase* _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->test_case; + gee_test_case_tear_down (_tmp0_); +} + + +static const gchar* gee_test_case_adaptor_get_name (GeeTestCaseAdaptor* self) { + const gchar* result; + const gchar* _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->_name; + result = _tmp0_; + return result; +} + + +static void gee_test_case_adaptor_set_name (GeeTestCaseAdaptor* self, const gchar* value) { + const gchar* _tmp0_; + gchar* _tmp1_; + g_return_if_fail (self != NULL); + _tmp0_ = value; + _tmp1_ = g_strdup (_tmp0_); + _g_free0 (self->priv->_name); + self->priv->_name = _tmp1_; +} + + +static void gee_test_case_value_adaptor_init (GValue* value) { + value->data[0].v_pointer = NULL; +} + + +static void gee_test_case_value_adaptor_free_value (GValue* value) { + if (value->data[0].v_pointer) { + gee_test_case_adaptor_unref (value->data[0].v_pointer); + } +} + + +static void gee_test_case_value_adaptor_copy_value (const GValue* src_value, GValue* dest_value) { + if (src_value->data[0].v_pointer) { + dest_value->data[0].v_pointer = gee_test_case_adaptor_ref (src_value->data[0].v_pointer); + } else { + dest_value->data[0].v_pointer = NULL; + } +} + + +static gpointer gee_test_case_value_adaptor_peek_pointer (const GValue* value) { + return value->data[0].v_pointer; +} + + +static gchar* gee_test_case_value_adaptor_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + if (collect_values[0].v_pointer) { + GeeTestCaseAdaptor* object; + object = collect_values[0].v_pointer; + if (object->parent_instance.g_class == NULL) { + return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); + } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { + return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); + } + value->data[0].v_pointer = gee_test_case_adaptor_ref (object); + } else { + value->data[0].v_pointer = NULL; + } + return NULL; +} + + +static gchar* gee_test_case_value_adaptor_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + GeeTestCaseAdaptor** object_p; + object_p = collect_values[0].v_pointer; + if (!object_p) { + return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); + } + if (!value->data[0].v_pointer) { + *object_p = NULL; + } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { + *object_p = value->data[0].v_pointer; + } else { + *object_p = gee_test_case_adaptor_ref (value->data[0].v_pointer); + } + return NULL; +} + + +static GParamSpec* gee_test_case_param_spec_adaptor (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { + GeeTestCaseParamSpecAdaptor* spec; + g_return_val_if_fail (g_type_is_a (object_type, GEE_TEST_CASE_TYPE_ADAPTOR), NULL); + spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); + G_PARAM_SPEC (spec)->value_type = object_type; + return G_PARAM_SPEC (spec); +} + + +static gpointer gee_test_case_value_get_adaptor (const GValue* value) { + g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TEST_CASE_TYPE_ADAPTOR), NULL); + return value->data[0].v_pointer; +} + + +static void gee_test_case_value_set_adaptor (GValue* value, gpointer v_object) { + GeeTestCaseAdaptor* old; + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TEST_CASE_TYPE_ADAPTOR)); + old = value->data[0].v_pointer; + if (v_object) { + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_TEST_CASE_TYPE_ADAPTOR)); + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); + value->data[0].v_pointer = v_object; + gee_test_case_adaptor_ref (value->data[0].v_pointer); + } else { + value->data[0].v_pointer = NULL; + } + if (old) { + gee_test_case_adaptor_unref (old); + } +} + + +static void gee_test_case_value_take_adaptor (GValue* value, gpointer v_object) { + GeeTestCaseAdaptor* old; + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TEST_CASE_TYPE_ADAPTOR)); + old = value->data[0].v_pointer; + if (v_object) { + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_TEST_CASE_TYPE_ADAPTOR)); + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); + value->data[0].v_pointer = v_object; + } else { + value->data[0].v_pointer = NULL; + } + if (old) { + gee_test_case_adaptor_unref (old); + } +} + + +static void gee_test_case_adaptor_class_init (GeeTestCaseAdaptorClass * klass) { + gee_test_case_adaptor_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_ADAPTOR_CLASS (klass)->finalize = gee_test_case_adaptor_finalize; + g_type_class_add_private (klass, sizeof (GeeTestCaseAdaptorPrivate)); +} + + +static void gee_test_case_adaptor_instance_init (GeeTestCaseAdaptor * self) { + self->priv = GEE_TEST_CASE_ADAPTOR_GET_PRIVATE (self); + self->ref_count = 1; +} + + +static void gee_test_case_adaptor_finalize (GeeTestCaseAdaptor* obj) { + GeeTestCaseAdaptor * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TEST_CASE_TYPE_ADAPTOR, GeeTestCaseAdaptor); + _g_free0 (self->priv->_name); + (self->priv->test_target_destroy_notify == NULL) ? NULL : (self->priv->test_target_destroy_notify (self->priv->test_target), NULL); + self->priv->test = NULL; + self->priv->test_target = NULL; + self->priv->test_target_destroy_notify = NULL; + _g_object_unref0 (self->priv->test_case); +} + + +static GType gee_test_case_adaptor_get_type (void) { + static volatile gsize gee_test_case_adaptor_type_id__volatile = 0; + if (g_once_init_enter (&gee_test_case_adaptor_type_id__volatile)) { + static const GTypeValueTable g_define_type_value_table = { gee_test_case_value_adaptor_init, gee_test_case_value_adaptor_free_value, gee_test_case_value_adaptor_copy_value, gee_test_case_value_adaptor_peek_pointer, "p", gee_test_case_value_adaptor_collect_value, "p", gee_test_case_value_adaptor_lcopy_value }; + static const GTypeInfo g_define_type_info = { sizeof (GeeTestCaseAdaptorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_test_case_adaptor_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTestCaseAdaptor), 0, (GInstanceInitFunc) gee_test_case_adaptor_instance_init, &g_define_type_value_table }; + static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; + GType gee_test_case_adaptor_type_id; + gee_test_case_adaptor_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GeeTestCaseAdaptor", &g_define_type_info, &g_define_type_fundamental_info, 0); + g_once_init_leave (&gee_test_case_adaptor_type_id__volatile, gee_test_case_adaptor_type_id); + } + return gee_test_case_adaptor_type_id__volatile; +} + + +static gpointer gee_test_case_adaptor_ref (gpointer instance) { + GeeTestCaseAdaptor* self; + self = instance; + g_atomic_int_inc (&self->ref_count); + return instance; +} + + +static void gee_test_case_adaptor_unref (gpointer instance) { + GeeTestCaseAdaptor* self; + self = instance; + if (g_atomic_int_dec_and_test (&self->ref_count)) { + GEE_TEST_CASE_ADAPTOR_GET_CLASS (self)->finalize (self); + g_type_free_instance ((GTypeInstance *) self); + } +} + + +static void gee_test_case_class_init (GeeTestCaseClass * klass) { + gee_test_case_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTestCasePrivate)); + GEE_TEST_CASE_CLASS (klass)->set_up = gee_test_case_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = gee_test_case_real_tear_down; + G_OBJECT_CLASS (klass)->finalize = gee_test_case_finalize; +} + + +static void gee_test_case_instance_init (GeeTestCase * self) { + GeeTestCaseAdaptor** _tmp0_ = NULL; + self->priv = GEE_TEST_CASE_GET_PRIVATE (self); + _tmp0_ = g_new0 (GeeTestCaseAdaptor*, 0 + 1); + self->priv->adaptors = _tmp0_; + self->priv->adaptors_length1 = 0; + self->priv->_adaptors_size_ = self->priv->adaptors_length1; +} + + +static void gee_test_case_finalize (GObject* obj) { + GeeTestCase * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_TEST_CASE, GeeTestCase); + self->priv->adaptors = (_vala_array_free (self->priv->adaptors, self->priv->adaptors_length1, (GDestroyNotify) gee_test_case_adaptor_unref), NULL); + G_OBJECT_CLASS (gee_test_case_parent_class)->finalize (obj); +} + + +GType gee_test_case_get_type (void) { + static volatile gsize gee_test_case_type_id__volatile = 0; + if (g_once_init_enter (&gee_test_case_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTestCaseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_test_case_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTestCase), 0, (GInstanceInitFunc) gee_test_case_instance_init, NULL }; + GType gee_test_case_type_id; + gee_test_case_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeTestCase", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&gee_test_case_type_id__volatile, gee_test_case_type_id); + } + return gee_test_case_type_id__volatile; +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + + diff --git a/tests/testcase.vala b/tests/testcase.vala new file mode 100644 index 0000000..edcbe04 --- /dev/null +++ b/tests/testcase.vala @@ -0,0 +1,80 @@ +/* testcase.vala + * + * Copyright (C) 2009 Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Julien Peeters + */ + +public abstract class Gee.TestCase : Object { + + private GLib.TestSuite suite; + private Adaptor[] adaptors = new Adaptor[0]; + + public delegate void TestMethod (); + + public TestCase (string name) { + this.suite = new GLib.TestSuite (name); + } + + public void add_test (string name, TestMethod test) { + var adaptor = new Adaptor (name, test, this); + this.adaptors += adaptor; + + this.suite.add (new GLib.TestCase (adaptor.name, + adaptor.set_up, + adaptor.run, + adaptor.tear_down )); + } + + public virtual void set_up () { + } + + public virtual void tear_down () { + } + + public GLib.TestSuite get_suite () { + return this.suite; + } + + private class Adaptor { + + public string name { get; private set; } + private TestMethod test; + private TestCase test_case; + + public Adaptor (string name, + TestMethod test, + TestCase test_case) { + this.name = name; + this.test = test; + this.test_case = test_case; + } + + public void set_up (void* fixture) { + this.test_case.set_up (); + } + + public void run (void* fixture) { + this.test (); + } + + public void tear_down (void* fixture) { + this.test_case.tear_down (); + } + } +} diff --git a/tests/testcollection.c b/tests/testcollection.c new file mode 100644 index 0000000..80c1a98 --- /dev/null +++ b/tests/testcollection.c @@ -0,0 +1,2455 @@ +/* testcollection.c generated by valac 0.18.0, the Vala compiler + * generated from testcollection.vala, do not modify */ + +/* testcollection.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes' Villevalois + * Julien Peeters + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer collection_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +enum { + COLLECTION_TESTS_DUMMY_PROPERTY +}; +CollectionTests* collection_tests_construct (GType object_type, const gchar* name); +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void collection_tests_test_type_correctness (CollectionTests* self); +static void _collection_tests_test_type_correctness_gee_test_case_test_method (gpointer self); +void collection_tests_test_iterator_returns_all_elements_once (CollectionTests* self); +static void _collection_tests_test_iterator_returns_all_elements_once_gee_test_case_test_method (gpointer self); +void collection_tests_test_mutable_iterator (CollectionTests* self); +static void _collection_tests_test_mutable_iterator_gee_test_case_test_method (gpointer self); +void collection_tests_test_contains_size_and_is_empty (CollectionTests* self); +static void _collection_tests_test_contains_size_and_is_empty_gee_test_case_test_method (gpointer self); +void collection_tests_test_add_remove (CollectionTests* self); +static void _collection_tests_test_add_remove_gee_test_case_test_method (gpointer self); +void collection_tests_test_clear (CollectionTests* self); +static void _collection_tests_test_clear_gee_test_case_test_method (gpointer self); +void collection_tests_test_add_all (CollectionTests* self); +static void _collection_tests_test_add_all_gee_test_case_test_method (gpointer self); +void collection_tests_test_contains_all (CollectionTests* self); +static void _collection_tests_test_contains_all_gee_test_case_test_method (gpointer self); +void collection_tests_test_remove_all (CollectionTests* self); +static void _collection_tests_test_remove_all_gee_test_case_test_method (gpointer self); +void collection_tests_test_retain_all (CollectionTests* self); +static void _collection_tests_test_retain_all_gee_test_case_test_method (gpointer self); +void collection_tests_test_to_array (CollectionTests* self); +static void _collection_tests_test_to_array_gee_test_case_test_method (gpointer self); +void collection_tests_test_gobject_properties (CollectionTests* self); +static void _collection_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +static void collection_tests_finalize (GObject* obj); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); + + +static void _collection_tests_test_type_correctness_gee_test_case_test_method (gpointer self) { + collection_tests_test_type_correctness (self); +} + + +static void _collection_tests_test_iterator_returns_all_elements_once_gee_test_case_test_method (gpointer self) { + collection_tests_test_iterator_returns_all_elements_once (self); +} + + +static void _collection_tests_test_mutable_iterator_gee_test_case_test_method (gpointer self) { + collection_tests_test_mutable_iterator (self); +} + + +static void _collection_tests_test_contains_size_and_is_empty_gee_test_case_test_method (gpointer self) { + collection_tests_test_contains_size_and_is_empty (self); +} + + +static void _collection_tests_test_add_remove_gee_test_case_test_method (gpointer self) { + collection_tests_test_add_remove (self); +} + + +static void _collection_tests_test_clear_gee_test_case_test_method (gpointer self) { + collection_tests_test_clear (self); +} + + +static void _collection_tests_test_add_all_gee_test_case_test_method (gpointer self) { + collection_tests_test_add_all (self); +} + + +static void _collection_tests_test_contains_all_gee_test_case_test_method (gpointer self) { + collection_tests_test_contains_all (self); +} + + +static void _collection_tests_test_remove_all_gee_test_case_test_method (gpointer self) { + collection_tests_test_remove_all (self); +} + + +static void _collection_tests_test_retain_all_gee_test_case_test_method (gpointer self) { + collection_tests_test_retain_all (self); +} + + +static void _collection_tests_test_to_array_gee_test_case_test_method (gpointer self) { + collection_tests_test_to_array (self); +} + + +static void _collection_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + collection_tests_test_gobject_properties (self); +} + + +CollectionTests* collection_tests_construct (GType object_type, const gchar* name) { + CollectionTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (CollectionTests*) gee_test_case_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] type correctness", _collection_tests_test_type_correctness_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] iterator returns all elements once", _collection_tests_test_iterator_returns_all_elements_once_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] mutable iterator", _collection_tests_test_mutable_iterator_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] contains, size and is_empty", _collection_tests_test_contains_size_and_is_empty_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] add and remove", _collection_tests_test_add_remove_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] clear", _collection_tests_test_clear_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] add_all", _collection_tests_test_add_all_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] contains_all", _collection_tests_test_contains_all_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] remove_all", _collection_tests_test_remove_all_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] retain_all", _collection_tests_test_retain_all_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] to_array", _collection_tests_test_to_array_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] GObject properties", _collection_tests_test_gobject_properties_gee_test_case_test_method, self); + return self; +} + + +void collection_tests_test_type_correctness (CollectionTests* self) { + GeeCollection* _tmp0_; + GeeCollection* _tmp1_; + GType _tmp2_; + GType _tmp3_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = self->test_collection; + _tmp2_ = gee_iterable_get_element_type ((GeeIterable*) _tmp1_); + _tmp3_ = _tmp2_; + _vala_assert (_tmp3_ == G_TYPE_STRING, "test_collection.element_type == typeof (string)"); +} + + +void collection_tests_test_iterator_returns_all_elements_once (CollectionTests* self) { + GeeCollection* _tmp0_; + gboolean has_next = FALSE; + GeeCollection* _tmp1_; + GeeIterator* _tmp2_ = NULL; + GeeIterator* iterator; + GeeIterator* _tmp3_; + gboolean _tmp4_ = FALSE; + GeeIterator* _tmp5_; + gboolean _tmp6_ = FALSE; + GeeIterator* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeCollection* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeCollection* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeCollection* _tmp13_; + gboolean _tmp14_ = FALSE; + gboolean one_found; + gboolean two_found; + gboolean three_found; + gboolean one_found_once; + gboolean two_found_once; + gboolean three_found_once; + GeeCollection* _tmp15_; + GeeIterator* _tmp16_ = NULL; + GeeIterator* _tmp31_; + gboolean _tmp32_ = FALSE; + gboolean _tmp33_; + gboolean _tmp34_; + GeeIterator* _tmp35_; + gboolean _tmp36_ = FALSE; + gboolean _tmp37_; + gboolean _tmp38_; + gboolean _tmp39_; + gboolean _tmp40_; + gboolean _tmp41_; + gboolean _tmp42_; + GeeIterator* _tmp43_; + gboolean _tmp44_ = FALSE; + GeeIterator* _tmp59_; + gboolean _tmp60_ = FALSE; + gboolean _tmp61_; + gboolean _tmp62_; + GeeIterator* _tmp63_; + gboolean _tmp64_ = FALSE; + gboolean _tmp65_; + gboolean _tmp66_; + gboolean _tmp67_; + gboolean _tmp68_; + gboolean _tmp69_; + gboolean _tmp70_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = self->test_collection; + _tmp2_ = gee_iterable_iterator ((GeeIterable*) _tmp1_); + iterator = _tmp2_; + _tmp3_ = iterator; + _tmp4_ = gee_iterator_has_next (_tmp3_); + _vala_assert (!_tmp4_, "! iterator.has_next ()"); + _tmp5_ = iterator; + _tmp6_ = gee_iterator_next (_tmp5_); + _vala_assert (!_tmp6_, "! iterator.next ()"); + _tmp7_ = iterator; + _tmp8_ = gee_iterator_first (_tmp7_); + _vala_assert (!_tmp8_, "! iterator.first ()"); + _tmp9_ = self->test_collection; + _tmp10_ = gee_collection_add (_tmp9_, "one"); + _vala_assert (_tmp10_, "test_collection.add (\"one\")"); + _tmp11_ = self->test_collection; + _tmp12_ = gee_collection_add (_tmp11_, "two"); + _vala_assert (_tmp12_, "test_collection.add (\"two\")"); + _tmp13_ = self->test_collection; + _tmp14_ = gee_collection_add (_tmp13_, "three"); + _vala_assert (_tmp14_, "test_collection.add (\"three\")"); + one_found = FALSE; + two_found = FALSE; + three_found = FALSE; + one_found_once = TRUE; + two_found_once = TRUE; + three_found_once = TRUE; + _tmp15_ = self->test_collection; + _tmp16_ = gee_iterable_iterator ((GeeIterable*) _tmp15_); + _g_object_unref0 (iterator); + iterator = _tmp16_; + while (TRUE) { + GeeIterator* _tmp17_; + gboolean _tmp18_ = FALSE; + gboolean _tmp19_; + GeeIterator* _tmp20_; + gboolean _tmp21_ = FALSE; + gboolean _tmp22_; + GeeIterator* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* element; + const gchar* _tmp25_; + _tmp17_ = iterator; + _tmp18_ = gee_iterator_has_next (_tmp17_); + has_next = _tmp18_; + _tmp19_ = has_next; + _tmp20_ = iterator; + _tmp21_ = gee_iterator_next (_tmp20_); + _vala_assert (_tmp19_ == _tmp21_, "has_next == iterator.next ()"); + _tmp22_ = has_next; + if (!_tmp22_) { + break; + } + _tmp23_ = iterator; + _tmp24_ = gee_iterator_get (_tmp23_); + element = (gchar*) _tmp24_; + _tmp25_ = element; + if (g_strcmp0 (_tmp25_, "one") == 0) { + gboolean _tmp26_; + _tmp26_ = one_found; + if (_tmp26_) { + one_found_once = FALSE; + } + one_found = TRUE; + } else { + const gchar* _tmp27_; + _tmp27_ = element; + if (g_strcmp0 (_tmp27_, "two") == 0) { + gboolean _tmp28_; + _tmp28_ = two_found; + if (_tmp28_) { + two_found_once = FALSE; + } + two_found = TRUE; + } else { + const gchar* _tmp29_; + _tmp29_ = element; + if (g_strcmp0 (_tmp29_, "three") == 0) { + gboolean _tmp30_; + _tmp30_ = three_found; + if (_tmp30_) { + three_found_once = FALSE; + } + three_found = TRUE; + } + } + } + _g_free0 (element); + } + _tmp31_ = iterator; + _tmp32_ = gee_iterator_has_next (_tmp31_); + has_next = _tmp32_; + _tmp33_ = has_next; + _vala_assert (!_tmp33_, "! has_next"); + _tmp34_ = has_next; + _tmp35_ = iterator; + _tmp36_ = gee_iterator_next (_tmp35_); + _vala_assert (_tmp34_ == _tmp36_, "has_next == iterator.next ()"); + _tmp37_ = one_found; + _vala_assert (_tmp37_, "one_found"); + _tmp38_ = one_found_once; + _vala_assert (_tmp38_, "one_found_once"); + _tmp39_ = two_found; + _vala_assert (_tmp39_, "two_found"); + _tmp40_ = two_found_once; + _vala_assert (_tmp40_, "two_found_once"); + _tmp41_ = three_found; + _vala_assert (_tmp41_, "three_found"); + _tmp42_ = three_found_once; + _vala_assert (_tmp42_, "three_found_once"); + _tmp43_ = iterator; + _tmp44_ = gee_iterator_first (_tmp43_); + _vala_assert (_tmp44_, "iterator.first ()"); + one_found = FALSE; + two_found = FALSE; + three_found = FALSE; + one_found_once = TRUE; + two_found_once = TRUE; + three_found_once = TRUE; + while (TRUE) { + GeeIterator* _tmp45_; + gpointer _tmp46_ = NULL; + gchar* element; + const gchar* _tmp47_; + GeeIterator* _tmp53_; + gboolean _tmp54_ = FALSE; + gboolean _tmp55_; + GeeIterator* _tmp56_; + gboolean _tmp57_ = FALSE; + gboolean _tmp58_; + _tmp45_ = iterator; + _tmp46_ = gee_iterator_get (_tmp45_); + element = (gchar*) _tmp46_; + _tmp47_ = element; + if (g_strcmp0 (_tmp47_, "one") == 0) { + gboolean _tmp48_; + _tmp48_ = one_found; + if (_tmp48_) { + one_found_once = FALSE; + } + one_found = TRUE; + } else { + const gchar* _tmp49_; + _tmp49_ = element; + if (g_strcmp0 (_tmp49_, "two") == 0) { + gboolean _tmp50_; + _tmp50_ = two_found; + if (_tmp50_) { + two_found_once = FALSE; + } + two_found = TRUE; + } else { + const gchar* _tmp51_; + _tmp51_ = element; + if (g_strcmp0 (_tmp51_, "three") == 0) { + gboolean _tmp52_; + _tmp52_ = three_found; + if (_tmp52_) { + three_found_once = FALSE; + } + three_found = TRUE; + } + } + } + _tmp53_ = iterator; + _tmp54_ = gee_iterator_has_next (_tmp53_); + has_next = _tmp54_; + _tmp55_ = has_next; + _tmp56_ = iterator; + _tmp57_ = gee_iterator_next (_tmp56_); + _vala_assert (_tmp55_ == _tmp57_, "has_next == iterator.next ()"); + _tmp58_ = has_next; + if (!_tmp58_) { + _g_free0 (element); + break; + } + _g_free0 (element); + } + _tmp59_ = iterator; + _tmp60_ = gee_iterator_has_next (_tmp59_); + has_next = _tmp60_; + _tmp61_ = has_next; + _vala_assert (!_tmp61_, "! has_next"); + _tmp62_ = has_next; + _tmp63_ = iterator; + _tmp64_ = gee_iterator_next (_tmp63_); + _vala_assert (_tmp62_ == _tmp64_, "has_next == iterator.next ()"); + _tmp65_ = one_found; + _vala_assert (_tmp65_, "one_found"); + _tmp66_ = one_found_once; + _vala_assert (_tmp66_, "one_found_once"); + _tmp67_ = two_found; + _vala_assert (_tmp67_, "two_found"); + _tmp68_ = two_found_once; + _vala_assert (_tmp68_, "two_found_once"); + _tmp69_ = three_found; + _vala_assert (_tmp69_, "three_found"); + _tmp70_ = three_found_once; + _vala_assert (_tmp70_, "three_found_once"); + _g_object_unref0 (iterator); +} + + +void collection_tests_test_mutable_iterator (CollectionTests* self) { + GeeCollection* _tmp0_; + gboolean has_next = FALSE; + GeeCollection* _tmp1_; + GeeIterator* _tmp2_ = NULL; + GeeIterator* iterator; + GeeCollection* _tmp3_; + gboolean _tmp4_ = FALSE; + GeeCollection* _tmp5_; + gboolean _tmp6_ = FALSE; + GeeCollection* _tmp7_; + gboolean _tmp8_ = FALSE; + gboolean one_found; + gboolean two_found; + gboolean three_found; + gboolean one_found_once; + gboolean two_found_once; + gboolean three_found_once; + GeeCollection* _tmp9_; + GeeIterator* _tmp10_ = NULL; + GeeIterator* _tmp26_; + gboolean _tmp27_ = FALSE; + gboolean _tmp28_; + gboolean _tmp29_; + GeeIterator* _tmp30_; + gboolean _tmp31_ = FALSE; + gboolean _tmp32_; + gboolean _tmp33_; + gboolean _tmp34_; + gboolean _tmp35_; + gboolean _tmp36_; + gboolean _tmp37_; + GeeIterator* _tmp38_; + gboolean _tmp39_ = FALSE; + GeeIterator* _tmp53_; + gboolean _tmp54_ = FALSE; + gboolean _tmp55_; + gboolean _tmp56_; + GeeIterator* _tmp57_; + gboolean _tmp58_ = FALSE; + gboolean _tmp59_; + gboolean _tmp60_; + gboolean _tmp61_; + gboolean _tmp62_; + gboolean _tmp63_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = self->test_collection; + _tmp2_ = gee_iterable_iterator ((GeeIterable*) _tmp1_); + iterator = _tmp2_; + _tmp3_ = self->test_collection; + _tmp4_ = gee_collection_add (_tmp3_, "one"); + _vala_assert (_tmp4_, "test_collection.add (\"one\")"); + _tmp5_ = self->test_collection; + _tmp6_ = gee_collection_add (_tmp5_, "two"); + _vala_assert (_tmp6_, "test_collection.add (\"two\")"); + _tmp7_ = self->test_collection; + _tmp8_ = gee_collection_add (_tmp7_, "three"); + _vala_assert (_tmp8_, "test_collection.add (\"three\")"); + one_found = FALSE; + two_found = FALSE; + three_found = FALSE; + one_found_once = TRUE; + two_found_once = TRUE; + three_found_once = TRUE; + _tmp9_ = self->test_collection; + _tmp10_ = gee_iterable_iterator ((GeeIterable*) _tmp9_); + _g_object_unref0 (iterator); + iterator = _tmp10_; + while (TRUE) { + GeeIterator* _tmp11_; + gboolean _tmp12_ = FALSE; + gboolean _tmp13_; + GeeIterator* _tmp14_; + gboolean _tmp15_ = FALSE; + gboolean _tmp16_; + GeeIterator* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* element; + const gchar* _tmp19_; + _tmp11_ = iterator; + _tmp12_ = gee_iterator_has_next (_tmp11_); + has_next = _tmp12_; + _tmp13_ = has_next; + _tmp14_ = iterator; + _tmp15_ = gee_iterator_next (_tmp14_); + _vala_assert (_tmp13_ == _tmp15_, "has_next == iterator.next ()"); + _tmp16_ = has_next; + if (!_tmp16_) { + break; + } + _tmp17_ = iterator; + _tmp18_ = gee_iterator_get (_tmp17_); + element = (gchar*) _tmp18_; + _tmp19_ = element; + if (g_strcmp0 (_tmp19_, "one") == 0) { + gboolean _tmp20_; + _tmp20_ = one_found; + if (_tmp20_) { + one_found_once = FALSE; + } + one_found = TRUE; + } else { + const gchar* _tmp21_; + _tmp21_ = element; + if (g_strcmp0 (_tmp21_, "two") == 0) { + gboolean _tmp22_; + GeeIterator* _tmp23_; + _tmp22_ = two_found; + if (_tmp22_) { + two_found_once = FALSE; + } + two_found = TRUE; + _tmp23_ = iterator; + gee_iterator_remove (_tmp23_); + } else { + const gchar* _tmp24_; + _tmp24_ = element; + if (g_strcmp0 (_tmp24_, "three") == 0) { + gboolean _tmp25_; + _tmp25_ = three_found; + if (_tmp25_) { + three_found_once = FALSE; + } + three_found = TRUE; + } + } + } + _g_free0 (element); + } + _tmp26_ = iterator; + _tmp27_ = gee_iterator_has_next (_tmp26_); + has_next = _tmp27_; + _tmp28_ = has_next; + _vala_assert (!_tmp28_, "! has_next"); + _tmp29_ = has_next; + _tmp30_ = iterator; + _tmp31_ = gee_iterator_next (_tmp30_); + _vala_assert (_tmp29_ == _tmp31_, "has_next == iterator.next ()"); + _tmp32_ = one_found; + _vala_assert (_tmp32_, "one_found"); + _tmp33_ = one_found_once; + _vala_assert (_tmp33_, "one_found_once"); + _tmp34_ = two_found; + _vala_assert (_tmp34_, "two_found"); + _tmp35_ = two_found_once; + _vala_assert (_tmp35_, "two_found_once"); + _tmp36_ = three_found; + _vala_assert (_tmp36_, "three_found"); + _tmp37_ = three_found_once; + _vala_assert (_tmp37_, "three_found_once"); + _tmp38_ = iterator; + _tmp39_ = gee_iterator_first (_tmp38_); + _vala_assert (_tmp39_, "iterator.first ()"); + one_found = FALSE; + two_found = FALSE; + three_found = FALSE; + one_found_once = TRUE; + two_found_once = TRUE; + three_found_once = TRUE; + while (TRUE) { + GeeIterator* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* element; + const gchar* _tmp42_; + GeeIterator* _tmp47_; + gboolean _tmp48_ = FALSE; + gboolean _tmp49_; + GeeIterator* _tmp50_; + gboolean _tmp51_ = FALSE; + gboolean _tmp52_; + _tmp40_ = iterator; + _tmp41_ = gee_iterator_get (_tmp40_); + element = (gchar*) _tmp41_; + _tmp42_ = element; + if (g_strcmp0 (_tmp42_, "one") == 0) { + gboolean _tmp43_; + _tmp43_ = one_found; + if (_tmp43_) { + one_found_once = FALSE; + } + one_found = TRUE; + } else { + const gchar* _tmp44_; + _tmp44_ = element; + if (g_strcmp0 (_tmp44_, "two") == 0) { + two_found = TRUE; + } else { + const gchar* _tmp45_; + _tmp45_ = element; + if (g_strcmp0 (_tmp45_, "three") == 0) { + gboolean _tmp46_; + _tmp46_ = three_found; + if (_tmp46_) { + three_found_once = FALSE; + } + three_found = TRUE; + } + } + } + _tmp47_ = iterator; + _tmp48_ = gee_iterator_has_next (_tmp47_); + has_next = _tmp48_; + _tmp49_ = has_next; + _tmp50_ = iterator; + _tmp51_ = gee_iterator_next (_tmp50_); + _vala_assert (_tmp49_ == _tmp51_, "has_next == iterator.next ()"); + _tmp52_ = has_next; + if (!_tmp52_) { + _g_free0 (element); + break; + } + _g_free0 (element); + } + _tmp53_ = iterator; + _tmp54_ = gee_iterator_has_next (_tmp53_); + has_next = _tmp54_; + _tmp55_ = has_next; + _vala_assert (!_tmp55_, "! has_next"); + _tmp56_ = has_next; + _tmp57_ = iterator; + _tmp58_ = gee_iterator_next (_tmp57_); + _vala_assert (_tmp56_ == _tmp58_, "has_next == iterator.next ()"); + _tmp59_ = one_found; + _vala_assert (_tmp59_, "one_found"); + _tmp60_ = one_found_once; + _vala_assert (_tmp60_, "one_found_once"); + _tmp61_ = two_found; + _vala_assert (!_tmp61_, "!two_found"); + _tmp62_ = three_found; + _vala_assert (_tmp62_, "three_found"); + _tmp63_ = three_found_once; + _vala_assert (_tmp63_, "three_found_once"); + _g_object_unref0 (iterator); +} + + +void collection_tests_test_contains_size_and_is_empty (CollectionTests* self) { + GeeCollection* _tmp0_; + GeeCollection* _tmp1_; + gboolean _tmp2_ = FALSE; + GeeCollection* _tmp3_; + gboolean _tmp4_ = FALSE; + GeeCollection* _tmp5_; + gboolean _tmp6_ = FALSE; + GeeCollection* _tmp7_; + gint _tmp8_; + gint _tmp9_; + GeeCollection* _tmp10_; + gboolean _tmp11_; + gboolean _tmp12_; + GeeCollection* _tmp13_; + gboolean _tmp14_ = FALSE; + GeeCollection* _tmp15_; + gboolean _tmp16_ = FALSE; + GeeCollection* _tmp17_; + gboolean _tmp18_ = FALSE; + GeeCollection* _tmp19_; + gboolean _tmp20_ = FALSE; + GeeCollection* _tmp21_; + gint _tmp22_; + gint _tmp23_; + GeeCollection* _tmp24_; + gboolean _tmp25_; + gboolean _tmp26_; + GeeCollection* _tmp27_; + gboolean _tmp28_ = FALSE; + GeeCollection* _tmp29_; + gboolean _tmp30_ = FALSE; + GeeCollection* _tmp31_; + gboolean _tmp32_ = FALSE; + GeeCollection* _tmp33_; + gboolean _tmp34_ = FALSE; + GeeCollection* _tmp35_; + gint _tmp36_; + gint _tmp37_; + GeeCollection* _tmp38_; + gboolean _tmp39_; + gboolean _tmp40_; + GeeCollection* _tmp41_; + gboolean _tmp42_ = FALSE; + GeeCollection* _tmp43_; + gboolean _tmp44_ = FALSE; + GeeCollection* _tmp45_; + gboolean _tmp46_ = FALSE; + GeeCollection* _tmp47_; + gboolean _tmp48_ = FALSE; + GeeCollection* _tmp49_; + gint _tmp50_; + gint _tmp51_; + GeeCollection* _tmp52_; + gboolean _tmp53_; + gboolean _tmp54_; + GeeCollection* _tmp55_; + gboolean _tmp56_ = FALSE; + GeeCollection* _tmp57_; + gboolean _tmp58_ = FALSE; + GeeCollection* _tmp59_; + gboolean _tmp60_ = FALSE; + GeeCollection* _tmp61_; + gboolean _tmp62_ = FALSE; + GeeCollection* _tmp63_; + gint _tmp64_; + gint _tmp65_; + GeeCollection* _tmp66_; + gboolean _tmp67_; + gboolean _tmp68_; + GeeCollection* _tmp69_; + gboolean _tmp70_ = FALSE; + GeeCollection* _tmp71_; + gboolean _tmp72_ = FALSE; + GeeCollection* _tmp73_; + gboolean _tmp74_ = FALSE; + GeeCollection* _tmp75_; + gboolean _tmp76_ = FALSE; + GeeCollection* _tmp77_; + gint _tmp78_; + gint _tmp79_; + GeeCollection* _tmp80_; + gboolean _tmp81_; + gboolean _tmp82_; + GeeCollection* _tmp83_; + gboolean _tmp84_ = FALSE; + GeeCollection* _tmp85_; + gboolean _tmp86_ = FALSE; + GeeCollection* _tmp87_; + gboolean _tmp88_ = FALSE; + GeeCollection* _tmp89_; + gboolean _tmp90_ = FALSE; + GeeCollection* _tmp91_; + gint _tmp92_; + gint _tmp93_; + GeeCollection* _tmp94_; + gboolean _tmp95_; + gboolean _tmp96_; + GeeCollection* _tmp97_; + gboolean _tmp98_ = FALSE; + GeeCollection* _tmp99_; + gboolean _tmp100_ = FALSE; + GeeCollection* _tmp101_; + gboolean _tmp102_ = FALSE; + GeeCollection* _tmp103_; + gboolean _tmp104_ = FALSE; + GeeCollection* _tmp105_; + gint _tmp106_; + gint _tmp107_; + GeeCollection* _tmp108_; + gboolean _tmp109_; + gboolean _tmp110_; + GeeCollection* _tmp111_; + GeeCollection* _tmp112_; + gboolean _tmp113_ = FALSE; + GeeCollection* _tmp114_; + gboolean _tmp115_ = FALSE; + GeeCollection* _tmp116_; + gboolean _tmp117_ = FALSE; + GeeCollection* _tmp118_; + gint _tmp119_; + gint _tmp120_; + GeeCollection* _tmp121_; + gboolean _tmp122_; + gboolean _tmp123_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = self->test_collection; + _tmp2_ = gee_collection_contains (_tmp1_, "one"); + _vala_assert (!_tmp2_, "! test_collection.contains (\"one\")"); + _tmp3_ = self->test_collection; + _tmp4_ = gee_collection_contains (_tmp3_, "two"); + _vala_assert (!_tmp4_, "! test_collection.contains (\"two\")"); + _tmp5_ = self->test_collection; + _tmp6_ = gee_collection_contains (_tmp5_, "three"); + _vala_assert (!_tmp6_, "! test_collection.contains (\"three\")"); + _tmp7_ = self->test_collection; + _tmp8_ = gee_collection_get_size (_tmp7_); + _tmp9_ = _tmp8_; + _vala_assert (_tmp9_ == 0, "test_collection.size == 0"); + _tmp10_ = self->test_collection; + _tmp11_ = gee_collection_get_is_empty (_tmp10_); + _tmp12_ = _tmp11_; + _vala_assert (_tmp12_, "test_collection.is_empty"); + _tmp13_ = self->test_collection; + _tmp14_ = gee_collection_add (_tmp13_, "one"); + _vala_assert (_tmp14_, "test_collection.add (\"one\")"); + _tmp15_ = self->test_collection; + _tmp16_ = gee_collection_contains (_tmp15_, "one"); + _vala_assert (_tmp16_, "test_collection.contains (\"one\")"); + _tmp17_ = self->test_collection; + _tmp18_ = gee_collection_contains (_tmp17_, "two"); + _vala_assert (!_tmp18_, "! test_collection.contains (\"two\")"); + _tmp19_ = self->test_collection; + _tmp20_ = gee_collection_contains (_tmp19_, "three"); + _vala_assert (!_tmp20_, "! test_collection.contains (\"three\")"); + _tmp21_ = self->test_collection; + _tmp22_ = gee_collection_get_size (_tmp21_); + _tmp23_ = _tmp22_; + _vala_assert (_tmp23_ == 1, "test_collection.size == 1"); + _tmp24_ = self->test_collection; + _tmp25_ = gee_collection_get_is_empty (_tmp24_); + _tmp26_ = _tmp25_; + _vala_assert (!_tmp26_, "! test_collection.is_empty"); + _tmp27_ = self->test_collection; + _tmp28_ = gee_collection_remove (_tmp27_, "one"); + _vala_assert (_tmp28_, "test_collection.remove (\"one\")"); + _tmp29_ = self->test_collection; + _tmp30_ = gee_collection_contains (_tmp29_, "one"); + _vala_assert (!_tmp30_, "! test_collection.contains (\"one\")"); + _tmp31_ = self->test_collection; + _tmp32_ = gee_collection_contains (_tmp31_, "two"); + _vala_assert (!_tmp32_, "! test_collection.contains (\"two\")"); + _tmp33_ = self->test_collection; + _tmp34_ = gee_collection_contains (_tmp33_, "three"); + _vala_assert (!_tmp34_, "! test_collection.contains (\"three\")"); + _tmp35_ = self->test_collection; + _tmp36_ = gee_collection_get_size (_tmp35_); + _tmp37_ = _tmp36_; + _vala_assert (_tmp37_ == 0, "test_collection.size == 0"); + _tmp38_ = self->test_collection; + _tmp39_ = gee_collection_get_is_empty (_tmp38_); + _tmp40_ = _tmp39_; + _vala_assert (_tmp40_, "test_collection.is_empty"); + _tmp41_ = self->test_collection; + _tmp42_ = gee_collection_add (_tmp41_, "one"); + _vala_assert (_tmp42_, "test_collection.add (\"one\")"); + _tmp43_ = self->test_collection; + _tmp44_ = gee_collection_contains (_tmp43_, "one"); + _vala_assert (_tmp44_, "test_collection.contains (\"one\")"); + _tmp45_ = self->test_collection; + _tmp46_ = gee_collection_contains (_tmp45_, "two"); + _vala_assert (!_tmp46_, "! test_collection.contains (\"two\")"); + _tmp47_ = self->test_collection; + _tmp48_ = gee_collection_contains (_tmp47_, "three"); + _vala_assert (!_tmp48_, "! test_collection.contains (\"three\")"); + _tmp49_ = self->test_collection; + _tmp50_ = gee_collection_get_size (_tmp49_); + _tmp51_ = _tmp50_; + _vala_assert (_tmp51_ == 1, "test_collection.size == 1"); + _tmp52_ = self->test_collection; + _tmp53_ = gee_collection_get_is_empty (_tmp52_); + _tmp54_ = _tmp53_; + _vala_assert (!_tmp54_, "! test_collection.is_empty"); + _tmp55_ = self->test_collection; + _tmp56_ = gee_collection_add (_tmp55_, "two"); + _vala_assert (_tmp56_, "test_collection.add (\"two\")"); + _tmp57_ = self->test_collection; + _tmp58_ = gee_collection_contains (_tmp57_, "one"); + _vala_assert (_tmp58_, "test_collection.contains (\"one\")"); + _tmp59_ = self->test_collection; + _tmp60_ = gee_collection_contains (_tmp59_, "two"); + _vala_assert (_tmp60_, "test_collection.contains (\"two\")"); + _tmp61_ = self->test_collection; + _tmp62_ = gee_collection_contains (_tmp61_, "three"); + _vala_assert (!_tmp62_, "! test_collection.contains (\"three\")"); + _tmp63_ = self->test_collection; + _tmp64_ = gee_collection_get_size (_tmp63_); + _tmp65_ = _tmp64_; + _vala_assert (_tmp65_ == 2, "test_collection.size == 2"); + _tmp66_ = self->test_collection; + _tmp67_ = gee_collection_get_is_empty (_tmp66_); + _tmp68_ = _tmp67_; + _vala_assert (!_tmp68_, "! test_collection.is_empty"); + _tmp69_ = self->test_collection; + _tmp70_ = gee_collection_add (_tmp69_, "three"); + _vala_assert (_tmp70_, "test_collection.add (\"three\")"); + _tmp71_ = self->test_collection; + _tmp72_ = gee_collection_contains (_tmp71_, "one"); + _vala_assert (_tmp72_, "test_collection.contains (\"one\")"); + _tmp73_ = self->test_collection; + _tmp74_ = gee_collection_contains (_tmp73_, "two"); + _vala_assert (_tmp74_, "test_collection.contains (\"two\")"); + _tmp75_ = self->test_collection; + _tmp76_ = gee_collection_contains (_tmp75_, "three"); + _vala_assert (_tmp76_, "test_collection.contains (\"three\")"); + _tmp77_ = self->test_collection; + _tmp78_ = gee_collection_get_size (_tmp77_); + _tmp79_ = _tmp78_; + _vala_assert (_tmp79_ == 3, "test_collection.size == 3"); + _tmp80_ = self->test_collection; + _tmp81_ = gee_collection_get_is_empty (_tmp80_); + _tmp82_ = _tmp81_; + _vala_assert (!_tmp82_, "! test_collection.is_empty"); + _tmp83_ = self->test_collection; + _tmp84_ = gee_collection_remove (_tmp83_, "two"); + _vala_assert (_tmp84_, "test_collection.remove (\"two\")"); + _tmp85_ = self->test_collection; + _tmp86_ = gee_collection_contains (_tmp85_, "one"); + _vala_assert (_tmp86_, "test_collection.contains (\"one\")"); + _tmp87_ = self->test_collection; + _tmp88_ = gee_collection_contains (_tmp87_, "two"); + _vala_assert (!_tmp88_, "! test_collection.contains (\"two\")"); + _tmp89_ = self->test_collection; + _tmp90_ = gee_collection_contains (_tmp89_, "three"); + _vala_assert (_tmp90_, "test_collection.contains (\"three\")"); + _tmp91_ = self->test_collection; + _tmp92_ = gee_collection_get_size (_tmp91_); + _tmp93_ = _tmp92_; + _vala_assert (_tmp93_ == 2, "test_collection.size == 2"); + _tmp94_ = self->test_collection; + _tmp95_ = gee_collection_get_is_empty (_tmp94_); + _tmp96_ = _tmp95_; + _vala_assert (!_tmp96_, "! test_collection.is_empty"); + _tmp97_ = self->test_collection; + _tmp98_ = gee_collection_remove (_tmp97_, "two"); + _vala_assert (!_tmp98_, "! test_collection.remove (\"two\")"); + _tmp99_ = self->test_collection; + _tmp100_ = gee_collection_contains (_tmp99_, "one"); + _vala_assert (_tmp100_, "test_collection.contains (\"one\")"); + _tmp101_ = self->test_collection; + _tmp102_ = gee_collection_contains (_tmp101_, "two"); + _vala_assert (!_tmp102_, "! test_collection.contains (\"two\")"); + _tmp103_ = self->test_collection; + _tmp104_ = gee_collection_contains (_tmp103_, "three"); + _vala_assert (_tmp104_, "test_collection.contains (\"three\")"); + _tmp105_ = self->test_collection; + _tmp106_ = gee_collection_get_size (_tmp105_); + _tmp107_ = _tmp106_; + _vala_assert (_tmp107_ == 2, "test_collection.size == 2"); + _tmp108_ = self->test_collection; + _tmp109_ = gee_collection_get_is_empty (_tmp108_); + _tmp110_ = _tmp109_; + _vala_assert (!_tmp110_, "! test_collection.is_empty"); + _tmp111_ = self->test_collection; + gee_collection_clear (_tmp111_); + _tmp112_ = self->test_collection; + _tmp113_ = gee_collection_contains (_tmp112_, "one"); + _vala_assert (!_tmp113_, "! test_collection.contains (\"one\")"); + _tmp114_ = self->test_collection; + _tmp115_ = gee_collection_contains (_tmp114_, "two"); + _vala_assert (!_tmp115_, "! test_collection.contains (\"two\")"); + _tmp116_ = self->test_collection; + _tmp117_ = gee_collection_contains (_tmp116_, "three"); + _vala_assert (!_tmp117_, "! test_collection.contains (\"three\")"); + _tmp118_ = self->test_collection; + _tmp119_ = gee_collection_get_size (_tmp118_); + _tmp120_ = _tmp119_; + _vala_assert (_tmp120_ == 0, "test_collection.size == 0"); + _tmp121_ = self->test_collection; + _tmp122_ = gee_collection_get_is_empty (_tmp121_); + _tmp123_ = _tmp122_; + _vala_assert (_tmp123_, "test_collection.is_empty"); +} + + +void collection_tests_test_add_remove (CollectionTests* self) { + GeeCollection* _tmp0_; + gchar* _tmp1_; + gchar* _tmp2_; + gchar* _tmp3_; + gchar* _tmp4_; + gchar* _tmp5_; + gchar* _tmp6_; + gchar* _tmp7_; + gchar* _tmp8_; + gchar* _tmp9_; + gchar* _tmp10_; + gchar* _tmp11_; + gchar* _tmp12_; + gchar* _tmp13_; + gchar* _tmp14_; + gchar* _tmp15_; + gchar* _tmp16_; + gchar* _tmp17_; + gchar* _tmp18_; + gchar* _tmp19_; + gchar* _tmp20_; + gchar* _tmp21_; + gchar* _tmp22_; + gchar* _tmp23_; + gchar* _tmp24_; + gchar* _tmp25_; + gchar* _tmp26_; + gchar* _tmp27_; + gchar* _tmp28_; + gchar* _tmp29_; + gchar* _tmp30_; + gchar* _tmp31_; + gchar* _tmp32_; + gchar* _tmp33_; + gchar* _tmp34_; + gchar* _tmp35_; + gchar* _tmp36_; + gchar* _tmp37_; + gchar* _tmp38_; + gchar* _tmp39_; + gchar** _tmp40_ = NULL; + gchar** to_add; + gint to_add_length1; + gint _to_add_size_; + gint expected_size; + gchar** _tmp41_; + gint _tmp41__length1; + GeeCollection* _tmp56_; + gint _tmp57_; + gint _tmp58_; + gchar** _tmp59_; + gint _tmp59__length1; + gchar** _tmp60_; + gint _tmp60__length1; + gchar** _tmp65_; + gint _tmp65__length1; + GeeCollection* _tmp80_; + gint _tmp81_; + gint _tmp82_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = g_strdup ("one"); + _tmp2_ = g_strdup ("two"); + _tmp3_ = g_strdup ("three"); + _tmp4_ = g_strdup ("four"); + _tmp5_ = g_strdup ("five"); + _tmp6_ = g_strdup ("six"); + _tmp7_ = g_strdup ("seven"); + _tmp8_ = g_strdup ("eight"); + _tmp9_ = g_strdup ("nine"); + _tmp10_ = g_strdup ("ten"); + _tmp11_ = g_strdup ("eleven"); + _tmp12_ = g_strdup ("twelve"); + _tmp13_ = g_strdup ("thirteen"); + _tmp14_ = g_strdup ("fourteen"); + _tmp15_ = g_strdup ("fifteen"); + _tmp16_ = g_strdup ("sixteen"); + _tmp17_ = g_strdup ("seventeen"); + _tmp18_ = g_strdup ("eighteen"); + _tmp19_ = g_strdup ("nineteen"); + _tmp20_ = g_strdup ("twenty"); + _tmp21_ = g_strdup ("twenty one"); + _tmp22_ = g_strdup ("twenty two"); + _tmp23_ = g_strdup ("twenty three"); + _tmp24_ = g_strdup ("twenty four"); + _tmp25_ = g_strdup ("twenty five"); + _tmp26_ = g_strdup ("twenty six"); + _tmp27_ = g_strdup ("twenty seven"); + _tmp28_ = g_strdup ("twenty eight"); + _tmp29_ = g_strdup ("twenty nine"); + _tmp30_ = g_strdup ("thirty"); + _tmp31_ = g_strdup ("thirty one"); + _tmp32_ = g_strdup ("thirty two"); + _tmp33_ = g_strdup ("thirty four"); + _tmp34_ = g_strdup ("thirty five"); + _tmp35_ = g_strdup ("thirty six"); + _tmp36_ = g_strdup ("thirty seven"); + _tmp37_ = g_strdup ("thirty eight"); + _tmp38_ = g_strdup ("thirty nine"); + _tmp39_ = g_strdup ("fourty"); + _tmp40_ = g_new0 (gchar*, 39 + 1); + _tmp40_[0] = _tmp1_; + _tmp40_[1] = _tmp2_; + _tmp40_[2] = _tmp3_; + _tmp40_[3] = _tmp4_; + _tmp40_[4] = _tmp5_; + _tmp40_[5] = _tmp6_; + _tmp40_[6] = _tmp7_; + _tmp40_[7] = _tmp8_; + _tmp40_[8] = _tmp9_; + _tmp40_[9] = _tmp10_; + _tmp40_[10] = _tmp11_; + _tmp40_[11] = _tmp12_; + _tmp40_[12] = _tmp13_; + _tmp40_[13] = _tmp14_; + _tmp40_[14] = _tmp15_; + _tmp40_[15] = _tmp16_; + _tmp40_[16] = _tmp17_; + _tmp40_[17] = _tmp18_; + _tmp40_[18] = _tmp19_; + _tmp40_[19] = _tmp20_; + _tmp40_[20] = _tmp21_; + _tmp40_[21] = _tmp22_; + _tmp40_[22] = _tmp23_; + _tmp40_[23] = _tmp24_; + _tmp40_[24] = _tmp25_; + _tmp40_[25] = _tmp26_; + _tmp40_[26] = _tmp27_; + _tmp40_[27] = _tmp28_; + _tmp40_[28] = _tmp29_; + _tmp40_[29] = _tmp30_; + _tmp40_[30] = _tmp31_; + _tmp40_[31] = _tmp32_; + _tmp40_[32] = _tmp33_; + _tmp40_[33] = _tmp34_; + _tmp40_[34] = _tmp35_; + _tmp40_[35] = _tmp36_; + _tmp40_[36] = _tmp37_; + _tmp40_[37] = _tmp38_; + _tmp40_[38] = _tmp39_; + to_add = _tmp40_; + to_add_length1 = 39; + _to_add_size_ = to_add_length1; + expected_size = 0; + _tmp41_ = to_add; + _tmp41__length1 = to_add_length1; + { + gchar** a_collection = NULL; + gint a_collection_length1 = 0; + gint _a_collection_size_ = 0; + gint a_it = 0; + a_collection = _tmp41_; + a_collection_length1 = _tmp41__length1; + for (a_it = 0; a_it < _tmp41__length1; a_it = a_it + 1) { + gchar* _tmp42_; + gchar* a = NULL; + _tmp42_ = g_strdup (a_collection[a_it]); + a = _tmp42_; + { + GeeCollection* _tmp43_; + const gchar* _tmp44_; + gboolean _tmp45_ = FALSE; + GeeCollection* _tmp46_; + gint _tmp47_; + gint _tmp48_; + gint _tmp49_; + GeeCollection* _tmp50_; + const gchar* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeCollection* _tmp53_; + const gchar* _tmp54_; + gboolean _tmp55_ = FALSE; + _tmp43_ = self->test_collection; + _tmp44_ = a; + _tmp45_ = gee_collection_contains (_tmp43_, _tmp44_); + _vala_assert (!_tmp45_, "!test_collection.contains (a)"); + _tmp46_ = self->test_collection; + _tmp47_ = gee_collection_get_size (_tmp46_); + _tmp48_ = _tmp47_; + _tmp49_ = expected_size; + expected_size = _tmp49_ + 1; + _vala_assert (_tmp48_ == _tmp49_, "test_collection.size == expected_size++"); + _tmp50_ = self->test_collection; + _tmp51_ = a; + _tmp52_ = gee_collection_add (_tmp50_, _tmp51_); + _vala_assert (_tmp52_, "test_collection.add (a)"); + _tmp53_ = self->test_collection; + _tmp54_ = a; + _tmp55_ = gee_collection_contains (_tmp53_, _tmp54_); + _vala_assert (_tmp55_, "test_collection.contains (a)"); + _g_free0 (a); + } + } + } + _tmp56_ = self->test_collection; + _tmp57_ = gee_collection_get_size (_tmp56_); + _tmp58_ = _tmp57_; + _tmp59_ = to_add; + _tmp59__length1 = to_add_length1; + _vala_assert (_tmp58_ == _tmp59__length1, "test_collection.size == to_add.length"); + _tmp60_ = to_add; + _tmp60__length1 = to_add_length1; + { + gchar** a_collection = NULL; + gint a_collection_length1 = 0; + gint _a_collection_size_ = 0; + gint a_it = 0; + a_collection = _tmp60_; + a_collection_length1 = _tmp60__length1; + for (a_it = 0; a_it < _tmp60__length1; a_it = a_it + 1) { + gchar* _tmp61_; + gchar* a = NULL; + _tmp61_ = g_strdup (a_collection[a_it]); + a = _tmp61_; + { + GeeCollection* _tmp62_; + const gchar* _tmp63_; + gboolean _tmp64_ = FALSE; + _tmp62_ = self->test_collection; + _tmp63_ = a; + _tmp64_ = gee_collection_contains (_tmp62_, _tmp63_); + _vala_assert (_tmp64_, "test_collection.contains (a)"); + _g_free0 (a); + } + } + } + _tmp65_ = to_add; + _tmp65__length1 = to_add_length1; + { + gchar** a_collection = NULL; + gint a_collection_length1 = 0; + gint _a_collection_size_ = 0; + gint a_it = 0; + a_collection = _tmp65_; + a_collection_length1 = _tmp65__length1; + for (a_it = 0; a_it < _tmp65__length1; a_it = a_it + 1) { + gchar* _tmp66_; + gchar* a = NULL; + _tmp66_ = g_strdup (a_collection[a_it]); + a = _tmp66_; + { + GeeCollection* _tmp67_; + const gchar* _tmp68_; + gboolean _tmp69_ = FALSE; + GeeCollection* _tmp70_; + gint _tmp71_; + gint _tmp72_; + gint _tmp73_; + GeeCollection* _tmp74_; + const gchar* _tmp75_; + gboolean _tmp76_ = FALSE; + GeeCollection* _tmp77_; + const gchar* _tmp78_; + gboolean _tmp79_ = FALSE; + _tmp67_ = self->test_collection; + _tmp68_ = a; + _tmp69_ = gee_collection_contains (_tmp67_, _tmp68_); + _vala_assert (_tmp69_, "test_collection.contains (a)"); + _tmp70_ = self->test_collection; + _tmp71_ = gee_collection_get_size (_tmp70_); + _tmp72_ = _tmp71_; + _tmp73_ = expected_size; + expected_size = _tmp73_ - 1; + _vala_assert (_tmp72_ == _tmp73_, "test_collection.size == expected_size--"); + _tmp74_ = self->test_collection; + _tmp75_ = a; + _tmp76_ = gee_collection_remove (_tmp74_, _tmp75_); + _vala_assert (_tmp76_, "test_collection.remove (a)"); + _tmp77_ = self->test_collection; + _tmp78_ = a; + _tmp79_ = gee_collection_contains (_tmp77_, _tmp78_); + _vala_assert (!_tmp79_, "!test_collection.contains (a)"); + _g_free0 (a); + } + } + } + _tmp80_ = self->test_collection; + _tmp81_ = gee_collection_get_size (_tmp80_); + _tmp82_ = _tmp81_; + _vala_assert (_tmp82_ == 0, "test_collection.size == 0"); + to_add = (_vala_array_free (to_add, to_add_length1, (GDestroyNotify) g_free), NULL); +} + + +void collection_tests_test_clear (CollectionTests* self) { + GeeCollection* _tmp0_; + gchar* _tmp1_; + gchar* _tmp2_; + gchar* _tmp3_; + gchar* _tmp4_; + gchar* _tmp5_; + gchar* _tmp6_; + gchar* _tmp7_; + gchar* _tmp8_; + gchar* _tmp9_; + gchar* _tmp10_; + gchar* _tmp11_; + gchar* _tmp12_; + gchar* _tmp13_; + gchar* _tmp14_; + gchar* _tmp15_; + gchar* _tmp16_; + gchar* _tmp17_; + gchar* _tmp18_; + gchar* _tmp19_; + gchar* _tmp20_; + gchar* _tmp21_; + gchar* _tmp22_; + gchar* _tmp23_; + gchar* _tmp24_; + gchar* _tmp25_; + gchar* _tmp26_; + gchar* _tmp27_; + gchar* _tmp28_; + gchar* _tmp29_; + gchar* _tmp30_; + gchar* _tmp31_; + gchar* _tmp32_; + gchar* _tmp33_; + gchar* _tmp34_; + gchar* _tmp35_; + gchar* _tmp36_; + gchar* _tmp37_; + gchar* _tmp38_; + gchar* _tmp39_; + gchar** _tmp40_ = NULL; + gchar** to_add; + gint to_add_length1; + gint _to_add_size_; + gint expected_size; + gchar** _tmp41_; + gint _tmp41__length1; + GeeCollection* _tmp56_; + gint _tmp57_; + gint _tmp58_; + gchar** _tmp59_; + gint _tmp59__length1; + GeeCollection* _tmp60_; + GeeCollection* _tmp61_; + gint _tmp62_; + gint _tmp63_; + GeeCollection* _tmp64_; + GeeIterator* _tmp65_ = NULL; + GeeIterator* iter; + gboolean _tmp66_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = g_strdup ("one"); + _tmp2_ = g_strdup ("two"); + _tmp3_ = g_strdup ("three"); + _tmp4_ = g_strdup ("four"); + _tmp5_ = g_strdup ("five"); + _tmp6_ = g_strdup ("six"); + _tmp7_ = g_strdup ("seven"); + _tmp8_ = g_strdup ("eight"); + _tmp9_ = g_strdup ("nine"); + _tmp10_ = g_strdup ("ten"); + _tmp11_ = g_strdup ("eleven"); + _tmp12_ = g_strdup ("twelve"); + _tmp13_ = g_strdup ("thirteen"); + _tmp14_ = g_strdup ("fourteen"); + _tmp15_ = g_strdup ("fifteen"); + _tmp16_ = g_strdup ("sixteen"); + _tmp17_ = g_strdup ("seventeen"); + _tmp18_ = g_strdup ("eighteen"); + _tmp19_ = g_strdup ("nineteen"); + _tmp20_ = g_strdup ("twenty"); + _tmp21_ = g_strdup ("twenty one"); + _tmp22_ = g_strdup ("twenty two"); + _tmp23_ = g_strdup ("twenty three"); + _tmp24_ = g_strdup ("twenty four"); + _tmp25_ = g_strdup ("twenty five"); + _tmp26_ = g_strdup ("twenty six"); + _tmp27_ = g_strdup ("twenty seven"); + _tmp28_ = g_strdup ("twenty eight"); + _tmp29_ = g_strdup ("twenty nine"); + _tmp30_ = g_strdup ("thirty"); + _tmp31_ = g_strdup ("thirty one"); + _tmp32_ = g_strdup ("thirty two"); + _tmp33_ = g_strdup ("thirty four"); + _tmp34_ = g_strdup ("thirty five"); + _tmp35_ = g_strdup ("thirty six"); + _tmp36_ = g_strdup ("thirty seven"); + _tmp37_ = g_strdup ("thirty eight"); + _tmp38_ = g_strdup ("thirty nine"); + _tmp39_ = g_strdup ("fourty"); + _tmp40_ = g_new0 (gchar*, 39 + 1); + _tmp40_[0] = _tmp1_; + _tmp40_[1] = _tmp2_; + _tmp40_[2] = _tmp3_; + _tmp40_[3] = _tmp4_; + _tmp40_[4] = _tmp5_; + _tmp40_[5] = _tmp6_; + _tmp40_[6] = _tmp7_; + _tmp40_[7] = _tmp8_; + _tmp40_[8] = _tmp9_; + _tmp40_[9] = _tmp10_; + _tmp40_[10] = _tmp11_; + _tmp40_[11] = _tmp12_; + _tmp40_[12] = _tmp13_; + _tmp40_[13] = _tmp14_; + _tmp40_[14] = _tmp15_; + _tmp40_[15] = _tmp16_; + _tmp40_[16] = _tmp17_; + _tmp40_[17] = _tmp18_; + _tmp40_[18] = _tmp19_; + _tmp40_[19] = _tmp20_; + _tmp40_[20] = _tmp21_; + _tmp40_[21] = _tmp22_; + _tmp40_[22] = _tmp23_; + _tmp40_[23] = _tmp24_; + _tmp40_[24] = _tmp25_; + _tmp40_[25] = _tmp26_; + _tmp40_[26] = _tmp27_; + _tmp40_[27] = _tmp28_; + _tmp40_[28] = _tmp29_; + _tmp40_[29] = _tmp30_; + _tmp40_[30] = _tmp31_; + _tmp40_[31] = _tmp32_; + _tmp40_[32] = _tmp33_; + _tmp40_[33] = _tmp34_; + _tmp40_[34] = _tmp35_; + _tmp40_[35] = _tmp36_; + _tmp40_[36] = _tmp37_; + _tmp40_[37] = _tmp38_; + _tmp40_[38] = _tmp39_; + to_add = _tmp40_; + to_add_length1 = 39; + _to_add_size_ = to_add_length1; + expected_size = 0; + _tmp41_ = to_add; + _tmp41__length1 = to_add_length1; + { + gchar** a_collection = NULL; + gint a_collection_length1 = 0; + gint _a_collection_size_ = 0; + gint a_it = 0; + a_collection = _tmp41_; + a_collection_length1 = _tmp41__length1; + for (a_it = 0; a_it < _tmp41__length1; a_it = a_it + 1) { + gchar* _tmp42_; + gchar* a = NULL; + _tmp42_ = g_strdup (a_collection[a_it]); + a = _tmp42_; + { + GeeCollection* _tmp43_; + const gchar* _tmp44_; + gboolean _tmp45_ = FALSE; + GeeCollection* _tmp46_; + gint _tmp47_; + gint _tmp48_; + gint _tmp49_; + GeeCollection* _tmp50_; + const gchar* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeCollection* _tmp53_; + const gchar* _tmp54_; + gboolean _tmp55_ = FALSE; + _tmp43_ = self->test_collection; + _tmp44_ = a; + _tmp45_ = gee_collection_contains (_tmp43_, _tmp44_); + _vala_assert (!_tmp45_, "!test_collection.contains (a)"); + _tmp46_ = self->test_collection; + _tmp47_ = gee_collection_get_size (_tmp46_); + _tmp48_ = _tmp47_; + _tmp49_ = expected_size; + expected_size = _tmp49_ + 1; + _vala_assert (_tmp48_ == _tmp49_, "test_collection.size == expected_size++"); + _tmp50_ = self->test_collection; + _tmp51_ = a; + _tmp52_ = gee_collection_add (_tmp50_, _tmp51_); + _vala_assert (_tmp52_, "test_collection.add (a)"); + _tmp53_ = self->test_collection; + _tmp54_ = a; + _tmp55_ = gee_collection_contains (_tmp53_, _tmp54_); + _vala_assert (_tmp55_, "test_collection.contains (a)"); + _g_free0 (a); + } + } + } + _tmp56_ = self->test_collection; + _tmp57_ = gee_collection_get_size (_tmp56_); + _tmp58_ = _tmp57_; + _tmp59_ = to_add; + _tmp59__length1 = to_add_length1; + _vala_assert (_tmp58_ == _tmp59__length1, "test_collection.size == to_add.length"); + _tmp60_ = self->test_collection; + gee_collection_clear (_tmp60_); + _tmp61_ = self->test_collection; + _tmp62_ = gee_collection_get_size (_tmp61_); + _tmp63_ = _tmp62_; + _vala_assert (_tmp63_ == 0, "test_collection.size == 0"); + _tmp64_ = self->test_collection; + _tmp65_ = gee_iterable_iterator ((GeeIterable*) _tmp64_); + iter = _tmp65_; + _vala_assert (iter != NULL, "iter != null"); + _tmp66_ = gee_iterator_has_next (iter); + _vala_assert (!_tmp66_, "!iter.has_next ()"); + _g_object_unref0 (iter); + to_add = (_vala_array_free (to_add, to_add_length1, (GDestroyNotify) g_free), NULL); +} + + +void collection_tests_test_add_all (CollectionTests* self) { + GeeCollection* _tmp0_; + GeeArrayList* _tmp1_; + GeeArrayList* dummy; + GeeCollection* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeCollection* _tmp4_; + gboolean _tmp5_; + gboolean _tmp6_; + gboolean _tmp7_; + gboolean _tmp8_; + GeeCollection* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeCollection* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeCollection* _tmp13_; + gint _tmp14_; + gint _tmp15_; + GeeCollection* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeCollection* _tmp18_; + gboolean _tmp19_ = FALSE; + gboolean _tmp20_ = FALSE; + gboolean _tmp21_ = FALSE; + GeeCollection* _tmp22_; + gboolean _tmp23_ = FALSE; + GeeCollection* _tmp24_; + gint _tmp25_; + gint _tmp26_; + GeeCollection* _tmp27_; + gboolean _tmp28_ = FALSE; + GeeCollection* _tmp29_; + gboolean _tmp30_ = FALSE; + GeeCollection* _tmp31_; + gboolean _tmp32_ = FALSE; + gint _tmp33_; + gint _tmp34_; + gboolean _tmp35_ = FALSE; + gboolean _tmp36_ = FALSE; + gboolean _tmp37_ = FALSE; + GeeCollection* _tmp38_; + gboolean _tmp39_ = FALSE; + gboolean _tmp40_ = FALSE; + gboolean _tmp41_ = FALSE; + GeeCollection* _tmp42_; + gboolean _tmp43_ = FALSE; + GeeCollection* _tmp44_; + gboolean _tmp45_ = FALSE; + GeeCollection* _tmp46_; + gint _tmp47_; + gint _tmp48_; + GeeCollection* _tmp49_; + gboolean _tmp50_ = FALSE; + GeeCollection* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeCollection* _tmp53_; + gboolean _tmp54_ = FALSE; + GeeCollection* _tmp55_; + gboolean _tmp56_ = FALSE; + gint _tmp57_; + gint _tmp58_; + gboolean _tmp59_ = FALSE; + gboolean _tmp60_ = FALSE; + gboolean _tmp61_ = FALSE; + GeeCollection* _tmp62_; + gboolean _tmp63_ = FALSE; + gboolean _tmp64_ = FALSE; + gboolean _tmp65_ = FALSE; + GeeCollection* _tmp66_; + gboolean _tmp67_ = FALSE; + GeeCollection* _tmp68_; + gboolean _tmp69_ = FALSE; + GeeCollection* _tmp70_; + gint _tmp71_; + gint _tmp72_; + GeeCollection* _tmp73_; + gboolean _tmp74_ = FALSE; + GeeCollection* _tmp75_; + gboolean _tmp76_ = FALSE; + GeeCollection* _tmp77_; + gboolean _tmp78_ = FALSE; + gint _tmp79_; + gint _tmp80_; + gboolean _tmp81_ = FALSE; + gboolean _tmp82_ = FALSE; + gboolean _tmp83_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = _tmp1_; + _tmp2_ = self->test_collection; + _tmp3_ = gee_collection_add_all (_tmp2_, (GeeCollection*) dummy); + _vala_assert (!_tmp3_, "! test_collection.add_all (dummy)"); + _tmp4_ = self->test_collection; + _tmp5_ = gee_collection_get_is_empty (_tmp4_); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_, "test_collection.is_empty"); + _tmp7_ = gee_abstract_collection_get_is_empty ((GeeAbstractCollection*) dummy); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_, "dummy.is_empty"); + _tmp9_ = self->test_collection; + _tmp10_ = gee_collection_add (_tmp9_, "hello"); + _vala_assert (_tmp10_, "test_collection.add (\"hello\")"); + _tmp11_ = self->test_collection; + _tmp12_ = gee_collection_add_all (_tmp11_, (GeeCollection*) dummy); + _vala_assert (!_tmp12_, "! test_collection.add_all (dummy)"); + _tmp13_ = self->test_collection; + _tmp14_ = gee_collection_get_size (_tmp13_); + _tmp15_ = _tmp14_; + _vala_assert (_tmp15_ == 1, "test_collection.size == 1"); + _tmp16_ = self->test_collection; + _tmp17_ = gee_collection_contains (_tmp16_, "hello"); + _vala_assert (_tmp17_, "test_collection.contains (\"hello\")"); + _tmp18_ = self->test_collection; + gee_collection_clear (_tmp18_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp19_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp19_, "dummy.add (\"hello1\")"); + _tmp20_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp20_, "dummy.add (\"hello2\")"); + _tmp21_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp21_, "dummy.add (\"hello3\")"); + _tmp22_ = self->test_collection; + _tmp23_ = gee_collection_add_all (_tmp22_, (GeeCollection*) dummy); + _vala_assert (_tmp23_, "test_collection.add_all (dummy)"); + _tmp24_ = self->test_collection; + _tmp25_ = gee_collection_get_size (_tmp24_); + _tmp26_ = _tmp25_; + _vala_assert (_tmp26_ == 3, "test_collection.size == 3"); + _tmp27_ = self->test_collection; + _tmp28_ = gee_collection_contains (_tmp27_, "hello1"); + _vala_assert (_tmp28_, "test_collection.contains (\"hello1\")"); + _tmp29_ = self->test_collection; + _tmp30_ = gee_collection_contains (_tmp29_, "hello2"); + _vala_assert (_tmp30_, "test_collection.contains (\"hello2\")"); + _tmp31_ = self->test_collection; + _tmp32_ = gee_collection_contains (_tmp31_, "hello3"); + _vala_assert (_tmp32_, "test_collection.contains (\"hello3\")"); + _tmp33_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp34_ = _tmp33_; + _vala_assert (_tmp34_ == 3, "dummy.size == 3"); + _tmp35_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp35_, "dummy.contains (\"hello1\")"); + _tmp36_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp36_, "dummy.contains (\"hello2\")"); + _tmp37_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp37_, "dummy.contains (\"hello3\")"); + _tmp38_ = self->test_collection; + gee_collection_clear (_tmp38_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp39_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp39_, "dummy.add (\"hello1\")"); + _tmp40_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp40_, "dummy.add (\"hello2\")"); + _tmp41_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp41_, "dummy.add (\"hello3\")"); + _tmp42_ = self->test_collection; + _tmp43_ = gee_collection_add (_tmp42_, "hello"); + _vala_assert (_tmp43_, "test_collection.add (\"hello\")"); + _tmp44_ = self->test_collection; + _tmp45_ = gee_collection_add_all (_tmp44_, (GeeCollection*) dummy); + _vala_assert (_tmp45_, "test_collection.add_all (dummy)"); + _tmp46_ = self->test_collection; + _tmp47_ = gee_collection_get_size (_tmp46_); + _tmp48_ = _tmp47_; + _vala_assert (_tmp48_ == 4, "test_collection.size == 4"); + _tmp49_ = self->test_collection; + _tmp50_ = gee_collection_contains (_tmp49_, "hello"); + _vala_assert (_tmp50_, "test_collection.contains (\"hello\")"); + _tmp51_ = self->test_collection; + _tmp52_ = gee_collection_contains (_tmp51_, "hello1"); + _vala_assert (_tmp52_, "test_collection.contains (\"hello1\")"); + _tmp53_ = self->test_collection; + _tmp54_ = gee_collection_contains (_tmp53_, "hello2"); + _vala_assert (_tmp54_, "test_collection.contains (\"hello2\")"); + _tmp55_ = self->test_collection; + _tmp56_ = gee_collection_contains (_tmp55_, "hello3"); + _vala_assert (_tmp56_, "test_collection.contains (\"hello3\")"); + _tmp57_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp58_ = _tmp57_; + _vala_assert (_tmp58_ == 3, "dummy.size == 3"); + _tmp59_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp59_, "dummy.contains (\"hello1\")"); + _tmp60_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp60_, "dummy.contains (\"hello2\")"); + _tmp61_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp61_, "dummy.contains (\"hello3\")"); + _tmp62_ = self->test_collection; + gee_collection_clear (_tmp62_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp63_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp63_, "dummy.add (\"hello1\")"); + _tmp64_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp64_, "dummy.add (\"hello2\")"); + _tmp65_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp65_, "dummy.add (\"hello3\")"); + _tmp66_ = self->test_collection; + _tmp67_ = gee_collection_add (_tmp66_, "hello1"); + _vala_assert (_tmp67_, "test_collection.add (\"hello1\")"); + _tmp68_ = self->test_collection; + _tmp69_ = gee_collection_add_all (_tmp68_, (GeeCollection*) dummy); + _vala_assert (_tmp69_, "test_collection.add_all (dummy)"); + _tmp70_ = self->test_collection; + _tmp71_ = gee_collection_get_size (_tmp70_); + _tmp72_ = _tmp71_; + _vala_assert (_tmp72_ >= 3, "test_collection.size >= 3"); + _tmp73_ = self->test_collection; + _tmp74_ = gee_collection_contains (_tmp73_, "hello1"); + _vala_assert (_tmp74_, "test_collection.contains (\"hello1\")"); + _tmp75_ = self->test_collection; + _tmp76_ = gee_collection_contains (_tmp75_, "hello2"); + _vala_assert (_tmp76_, "test_collection.contains (\"hello2\")"); + _tmp77_ = self->test_collection; + _tmp78_ = gee_collection_contains (_tmp77_, "hello3"); + _vala_assert (_tmp78_, "test_collection.contains (\"hello3\")"); + _tmp79_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp80_ = _tmp79_; + _vala_assert (_tmp80_ == 3, "dummy.size == 3"); + _tmp81_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp81_, "dummy.contains (\"hello1\")"); + _tmp82_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp82_, "dummy.contains (\"hello2\")"); + _tmp83_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp83_, "dummy.contains (\"hello3\")"); + _g_object_unref0 (dummy); +} + + +void collection_tests_test_contains_all (CollectionTests* self) { + GeeCollection* _tmp0_; + GeeArrayList* _tmp1_; + GeeArrayList* dummy; + gboolean _tmp2_ = FALSE; + gboolean _tmp3_ = FALSE; + gboolean _tmp4_ = FALSE; + GeeCollection* _tmp5_; + gboolean _tmp6_; + gboolean _tmp7_; + GeeCollection* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeCollection* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeCollection* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeCollection* _tmp14_; + gboolean _tmp15_ = FALSE; + GeeCollection* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeCollection* _tmp18_; + gboolean _tmp19_ = FALSE; + GeeCollection* _tmp20_; + gboolean _tmp21_ = FALSE; + GeeCollection* _tmp22_; + gboolean _tmp23_ = FALSE; + GeeCollection* _tmp24_; + gboolean _tmp25_ = FALSE; + GeeCollection* _tmp26_; + gboolean _tmp27_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = _tmp1_; + _tmp2_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp2_, "dummy.add (\"hello1\")"); + _tmp3_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp3_, "dummy.add (\"hello2\")"); + _tmp4_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp4_, "dummy.add (\"hello3\")"); + _tmp5_ = self->test_collection; + _tmp6_ = gee_collection_get_is_empty (_tmp5_); + _tmp7_ = _tmp6_; + _vala_assert (_tmp7_, "test_collection.is_empty"); + _tmp8_ = self->test_collection; + _tmp9_ = gee_collection_contains_all (_tmp8_, (GeeCollection*) dummy); + _vala_assert (!_tmp9_, "! test_collection.contains_all (dummy)"); + _tmp10_ = self->test_collection; + _tmp11_ = gee_collection_add (_tmp10_, "hello4"); + _vala_assert (_tmp11_, "test_collection.add (\"hello4\")"); + _tmp12_ = self->test_collection; + _tmp13_ = gee_collection_add (_tmp12_, "hello5"); + _vala_assert (_tmp13_, "test_collection.add (\"hello5\")"); + _tmp14_ = self->test_collection; + _tmp15_ = gee_collection_contains_all (_tmp14_, (GeeCollection*) dummy); + _vala_assert (!_tmp15_, "! test_collection.contains_all (dummy)"); + _tmp16_ = self->test_collection; + _tmp17_ = gee_collection_add (_tmp16_, "hello1"); + _vala_assert (_tmp17_, "test_collection.add (\"hello1\")"); + _tmp18_ = self->test_collection; + _tmp19_ = gee_collection_add (_tmp18_, "hello2"); + _vala_assert (_tmp19_, "test_collection.add (\"hello2\")"); + _tmp20_ = self->test_collection; + _tmp21_ = gee_collection_contains_all (_tmp20_, (GeeCollection*) dummy); + _vala_assert (!_tmp21_, "! test_collection.contains_all (dummy)"); + _tmp22_ = self->test_collection; + _tmp23_ = gee_collection_add (_tmp22_, "hello3"); + _vala_assert (_tmp23_, "test_collection.add (\"hello3\")"); + _tmp24_ = self->test_collection; + _tmp25_ = gee_collection_contains_all (_tmp24_, (GeeCollection*) dummy); + _vala_assert (_tmp25_, "test_collection.contains_all (dummy)"); + _tmp26_ = self->test_collection; + _tmp27_ = gee_abstract_collection_contains_all ((GeeAbstractCollection*) dummy, _tmp26_); + _vala_assert (!_tmp27_, "! dummy.contains_all (test_collection)"); + _g_object_unref0 (dummy); +} + + +void collection_tests_test_remove_all (CollectionTests* self) { + GeeCollection* _tmp0_; + GeeArrayList* _tmp1_; + GeeArrayList* dummy; + GeeCollection* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeCollection* _tmp4_; + gboolean _tmp5_; + gboolean _tmp6_; + gboolean _tmp7_; + gboolean _tmp8_; + gboolean _tmp9_ = FALSE; + gboolean _tmp10_ = FALSE; + gboolean _tmp11_ = FALSE; + GeeCollection* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeCollection* _tmp14_; + gboolean _tmp15_; + gboolean _tmp16_; + GeeCollection* _tmp17_; + gboolean _tmp18_ = FALSE; + gboolean _tmp19_ = FALSE; + gboolean _tmp20_ = FALSE; + GeeCollection* _tmp21_; + gboolean _tmp22_ = FALSE; + GeeCollection* _tmp23_; + gboolean _tmp24_ = FALSE; + GeeCollection* _tmp25_; + gboolean _tmp26_ = FALSE; + GeeCollection* _tmp27_; + gint _tmp28_; + gint _tmp29_; + gint _tmp30_; + gint _tmp31_; + GeeCollection* _tmp32_; + gboolean _tmp33_ = FALSE; + gboolean _tmp34_ = FALSE; + gboolean _tmp35_ = FALSE; + GeeCollection* _tmp36_; + gboolean _tmp37_ = FALSE; + GeeCollection* _tmp38_; + gboolean _tmp39_ = FALSE; + GeeCollection* _tmp40_; + gboolean _tmp41_ = FALSE; + GeeCollection* _tmp42_; + gboolean _tmp43_ = FALSE; + GeeCollection* _tmp44_; + gboolean _tmp45_; + gboolean _tmp46_; + gint _tmp47_; + gint _tmp48_; + GeeCollection* _tmp49_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = _tmp1_; + _tmp2_ = self->test_collection; + _tmp3_ = gee_collection_remove_all (_tmp2_, (GeeCollection*) dummy); + _vala_assert (!_tmp3_, "! test_collection.remove_all (dummy)"); + _tmp4_ = self->test_collection; + _tmp5_ = gee_collection_get_is_empty (_tmp4_); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_, "test_collection.is_empty"); + _tmp7_ = gee_abstract_collection_get_is_empty ((GeeAbstractCollection*) dummy); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_, "dummy.is_empty"); + _tmp9_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp9_, "dummy.add (\"hello1\")"); + _tmp10_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp10_, "dummy.add (\"hello2\")"); + _tmp11_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp11_, "dummy.add (\"hello3\")"); + _tmp12_ = self->test_collection; + _tmp13_ = gee_collection_remove_all (_tmp12_, (GeeCollection*) dummy); + _vala_assert (!_tmp13_, "! test_collection.remove_all (dummy)"); + _tmp14_ = self->test_collection; + _tmp15_ = gee_collection_get_is_empty (_tmp14_); + _tmp16_ = _tmp15_; + _vala_assert (_tmp16_, "test_collection.is_empty"); + _tmp17_ = self->test_collection; + gee_collection_clear (_tmp17_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp18_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp18_, "dummy.add (\"hello1\")"); + _tmp19_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp19_, "dummy.add (\"hello2\")"); + _tmp20_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp20_, "dummy.add (\"hello3\")"); + _tmp21_ = self->test_collection; + _tmp22_ = gee_collection_add (_tmp21_, "hello4"); + _vala_assert (_tmp22_, "test_collection.add (\"hello4\")"); + _tmp23_ = self->test_collection; + _tmp24_ = gee_collection_add (_tmp23_, "hello5"); + _vala_assert (_tmp24_, "test_collection.add (\"hello5\")"); + _tmp25_ = self->test_collection; + _tmp26_ = gee_collection_remove_all (_tmp25_, (GeeCollection*) dummy); + _vala_assert (!_tmp26_, "! test_collection.remove_all (dummy)"); + _tmp27_ = self->test_collection; + _tmp28_ = gee_collection_get_size (_tmp27_); + _tmp29_ = _tmp28_; + _vala_assert (_tmp29_ == 2, "test_collection.size == 2"); + _tmp30_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp31_ = _tmp30_; + _vala_assert (_tmp31_ == 3, "dummy.size == 3"); + _tmp32_ = self->test_collection; + gee_collection_clear (_tmp32_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp33_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp33_, "dummy.add (\"hello1\")"); + _tmp34_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp34_, "dummy.add (\"hello2\")"); + _tmp35_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp35_, "dummy.add (\"hello3\")"); + _tmp36_ = self->test_collection; + _tmp37_ = gee_collection_add (_tmp36_, "hello1"); + _vala_assert (_tmp37_, "test_collection.add (\"hello1\")"); + _tmp38_ = self->test_collection; + _tmp39_ = gee_collection_add (_tmp38_, "hello2"); + _vala_assert (_tmp39_, "test_collection.add (\"hello2\")"); + _tmp40_ = self->test_collection; + _tmp41_ = gee_collection_add (_tmp40_, "hello3"); + _vala_assert (_tmp41_, "test_collection.add (\"hello3\")"); + _tmp42_ = self->test_collection; + _tmp43_ = gee_collection_remove_all (_tmp42_, (GeeCollection*) dummy); + _vala_assert (_tmp43_, "test_collection.remove_all (dummy)"); + _tmp44_ = self->test_collection; + _tmp45_ = gee_collection_get_is_empty (_tmp44_); + _tmp46_ = _tmp45_; + _vala_assert (_tmp46_, "test_collection.is_empty"); + _tmp47_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp48_ = _tmp47_; + _vala_assert (_tmp48_ == 3, "dummy.size == 3"); + _tmp49_ = self->test_collection; + gee_collection_clear (_tmp49_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _g_object_unref0 (dummy); +} + + +void collection_tests_test_retain_all (CollectionTests* self) { + GeeCollection* _tmp0_; + GeeArrayList* _tmp1_; + GeeArrayList* dummy; + GeeCollection* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeCollection* _tmp4_; + gboolean _tmp5_; + gboolean _tmp6_; + gboolean _tmp7_; + gboolean _tmp8_; + GeeCollection* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeCollection* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeCollection* _tmp13_; + gboolean _tmp14_ = FALSE; + GeeCollection* _tmp15_; + gboolean _tmp16_; + gboolean _tmp17_; + gboolean _tmp18_; + gboolean _tmp19_; + GeeCollection* _tmp20_; + gboolean _tmp21_ = FALSE; + gboolean _tmp22_ = FALSE; + gboolean _tmp23_ = FALSE; + GeeCollection* _tmp24_; + gboolean _tmp25_ = FALSE; + GeeCollection* _tmp26_; + gboolean _tmp27_; + gboolean _tmp28_; + gint _tmp29_; + gint _tmp30_; + gboolean _tmp31_ = FALSE; + gboolean _tmp32_ = FALSE; + gboolean _tmp33_ = FALSE; + GeeCollection* _tmp34_; + gboolean _tmp35_ = FALSE; + gboolean _tmp36_ = FALSE; + gboolean _tmp37_ = FALSE; + GeeCollection* _tmp38_; + gboolean _tmp39_ = FALSE; + GeeCollection* _tmp40_; + gboolean _tmp41_ = FALSE; + GeeCollection* _tmp42_; + gboolean _tmp43_ = FALSE; + GeeCollection* _tmp44_; + gboolean _tmp45_; + gboolean _tmp46_; + gint _tmp47_; + gint _tmp48_; + gboolean _tmp49_ = FALSE; + gboolean _tmp50_ = FALSE; + gboolean _tmp51_ = FALSE; + GeeCollection* _tmp52_; + gboolean _tmp53_ = FALSE; + gboolean _tmp54_ = FALSE; + gboolean _tmp55_ = FALSE; + GeeCollection* _tmp56_; + gboolean _tmp57_ = FALSE; + GeeCollection* _tmp58_; + gboolean _tmp59_ = FALSE; + GeeCollection* _tmp60_; + gboolean _tmp61_ = FALSE; + GeeCollection* _tmp62_; + gboolean _tmp63_ = FALSE; + GeeCollection* _tmp64_; + gint _tmp65_; + gint _tmp66_; + GeeCollection* _tmp67_; + gboolean _tmp68_ = FALSE; + GeeCollection* _tmp69_; + gboolean _tmp70_ = FALSE; + GeeCollection* _tmp71_; + gboolean _tmp72_ = FALSE; + gint _tmp73_; + gint _tmp74_; + gboolean _tmp75_ = FALSE; + gboolean _tmp76_ = FALSE; + gboolean _tmp77_ = FALSE; + GeeCollection* _tmp78_; + gboolean _tmp79_ = FALSE; + gboolean _tmp80_ = FALSE; + gboolean _tmp81_ = FALSE; + GeeCollection* _tmp82_; + gboolean _tmp83_ = FALSE; + GeeCollection* _tmp84_; + gboolean _tmp85_ = FALSE; + GeeCollection* _tmp86_; + gboolean _tmp87_ = FALSE; + GeeCollection* _tmp88_; + gboolean _tmp89_ = FALSE; + GeeCollection* _tmp90_; + gint _tmp91_; + gint _tmp92_; + GeeCollection* _tmp93_; + gboolean _tmp94_ = FALSE; + GeeCollection* _tmp95_; + gboolean _tmp96_ = FALSE; + gint _tmp97_; + gint _tmp98_; + gboolean _tmp99_ = FALSE; + gboolean _tmp100_ = FALSE; + gboolean _tmp101_ = FALSE; + GeeCollection* _tmp102_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = _tmp1_; + _tmp2_ = self->test_collection; + _tmp3_ = gee_collection_retain_all (_tmp2_, (GeeCollection*) dummy); + _vala_assert (!_tmp3_, "! test_collection.retain_all (dummy)"); + _tmp4_ = self->test_collection; + _tmp5_ = gee_collection_get_is_empty (_tmp4_); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_, "test_collection.is_empty"); + _tmp7_ = gee_abstract_collection_get_is_empty ((GeeAbstractCollection*) dummy); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_, "dummy.is_empty"); + _tmp9_ = self->test_collection; + _tmp10_ = gee_collection_add (_tmp9_, "hello1"); + _vala_assert (_tmp10_, "test_collection.add (\"hello1\")"); + _tmp11_ = self->test_collection; + _tmp12_ = gee_collection_add (_tmp11_, "hello2"); + _vala_assert (_tmp12_, "test_collection.add (\"hello2\")"); + _tmp13_ = self->test_collection; + _tmp14_ = gee_collection_retain_all (_tmp13_, (GeeCollection*) dummy); + _vala_assert (_tmp14_, "test_collection.retain_all (dummy)"); + _tmp15_ = self->test_collection; + _tmp16_ = gee_collection_get_is_empty (_tmp15_); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_, "test_collection.is_empty"); + _tmp18_ = gee_abstract_collection_get_is_empty ((GeeAbstractCollection*) dummy); + _tmp19_ = _tmp18_; + _vala_assert (_tmp19_, "dummy.is_empty"); + _tmp20_ = self->test_collection; + gee_collection_clear (_tmp20_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp21_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp21_, "dummy.add (\"hello1\")"); + _tmp22_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp22_, "dummy.add (\"hello2\")"); + _tmp23_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp23_, "dummy.add (\"hello3\")"); + _tmp24_ = self->test_collection; + _tmp25_ = gee_collection_retain_all (_tmp24_, (GeeCollection*) dummy); + _vala_assert (!_tmp25_, "! test_collection.retain_all (dummy)"); + _tmp26_ = self->test_collection; + _tmp27_ = gee_collection_get_is_empty (_tmp26_); + _tmp28_ = _tmp27_; + _vala_assert (_tmp28_, "test_collection.is_empty"); + _tmp29_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp30_ = _tmp29_; + _vala_assert (_tmp30_ == 3, "dummy.size == 3"); + _tmp31_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp31_, "dummy.contains (\"hello1\")"); + _tmp32_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp32_, "dummy.contains (\"hello2\")"); + _tmp33_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp33_, "dummy.contains (\"hello3\")"); + _tmp34_ = self->test_collection; + gee_collection_clear (_tmp34_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp35_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp35_, "dummy.add (\"hello1\")"); + _tmp36_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp36_, "dummy.add (\"hello2\")"); + _tmp37_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp37_, "dummy.add (\"hello3\")"); + _tmp38_ = self->test_collection; + _tmp39_ = gee_collection_add (_tmp38_, "hello4"); + _vala_assert (_tmp39_, "test_collection.add (\"hello4\")"); + _tmp40_ = self->test_collection; + _tmp41_ = gee_collection_add (_tmp40_, "hello5"); + _vala_assert (_tmp41_, "test_collection.add (\"hello5\")"); + _tmp42_ = self->test_collection; + _tmp43_ = gee_collection_retain_all (_tmp42_, (GeeCollection*) dummy); + _vala_assert (_tmp43_, "test_collection.retain_all (dummy)"); + _tmp44_ = self->test_collection; + _tmp45_ = gee_collection_get_is_empty (_tmp44_); + _tmp46_ = _tmp45_; + _vala_assert (_tmp46_, "test_collection.is_empty"); + _tmp47_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp48_ = _tmp47_; + _vala_assert (_tmp48_ == 3, "dummy.size == 3"); + _tmp49_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp49_, "dummy.contains (\"hello1\")"); + _tmp50_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp50_, "dummy.contains (\"hello2\")"); + _tmp51_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp51_, "dummy.contains (\"hello3\")"); + _tmp52_ = self->test_collection; + gee_collection_clear (_tmp52_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp53_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp53_, "dummy.add (\"hello1\")"); + _tmp54_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp54_, "dummy.add (\"hello2\")"); + _tmp55_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp55_, "dummy.add (\"hello3\")"); + _tmp56_ = self->test_collection; + _tmp57_ = gee_collection_add (_tmp56_, "hello1"); + _vala_assert (_tmp57_, "test_collection.add (\"hello1\")"); + _tmp58_ = self->test_collection; + _tmp59_ = gee_collection_add (_tmp58_, "hello2"); + _vala_assert (_tmp59_, "test_collection.add (\"hello2\")"); + _tmp60_ = self->test_collection; + _tmp61_ = gee_collection_add (_tmp60_, "hello3"); + _vala_assert (_tmp61_, "test_collection.add (\"hello3\")"); + _tmp62_ = self->test_collection; + _tmp63_ = gee_collection_retain_all (_tmp62_, (GeeCollection*) dummy); + _vala_assert (!_tmp63_, "! test_collection.retain_all (dummy)"); + _tmp64_ = self->test_collection; + _tmp65_ = gee_collection_get_size (_tmp64_); + _tmp66_ = _tmp65_; + _vala_assert (_tmp66_ == 3, "test_collection.size == 3"); + _tmp67_ = self->test_collection; + _tmp68_ = gee_collection_contains (_tmp67_, "hello1"); + _vala_assert (_tmp68_, "test_collection.contains (\"hello1\")"); + _tmp69_ = self->test_collection; + _tmp70_ = gee_collection_contains (_tmp69_, "hello2"); + _vala_assert (_tmp70_, "test_collection.contains (\"hello2\")"); + _tmp71_ = self->test_collection; + _tmp72_ = gee_collection_contains (_tmp71_, "hello3"); + _vala_assert (_tmp72_, "test_collection.contains (\"hello3\")"); + _tmp73_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp74_ = _tmp73_; + _vala_assert (_tmp74_ == 3, "dummy.size == 3"); + _tmp75_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp75_, "dummy.contains (\"hello1\")"); + _tmp76_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp76_, "dummy.contains (\"hello2\")"); + _tmp77_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp77_, "dummy.contains (\"hello3\")"); + _tmp78_ = self->test_collection; + gee_collection_clear (_tmp78_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp79_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp79_, "dummy.add (\"hello1\")"); + _tmp80_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp80_, "dummy.add (\"hello2\")"); + _tmp81_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp81_, "dummy.add (\"hello3\")"); + _tmp82_ = self->test_collection; + _tmp83_ = gee_collection_add (_tmp82_, "hello2"); + _vala_assert (_tmp83_, "test_collection.add (\"hello2\")"); + _tmp84_ = self->test_collection; + _tmp85_ = gee_collection_add (_tmp84_, "hello3"); + _vala_assert (_tmp85_, "test_collection.add (\"hello3\")"); + _tmp86_ = self->test_collection; + _tmp87_ = gee_collection_add (_tmp86_, "hello4"); + _vala_assert (_tmp87_, "test_collection.add (\"hello4\")"); + _tmp88_ = self->test_collection; + _tmp89_ = gee_collection_retain_all (_tmp88_, (GeeCollection*) dummy); + _vala_assert (_tmp89_, "test_collection.retain_all (dummy)"); + _tmp90_ = self->test_collection; + _tmp91_ = gee_collection_get_size (_tmp90_); + _tmp92_ = _tmp91_; + _vala_assert (_tmp92_ == 2, "test_collection.size == 2"); + _tmp93_ = self->test_collection; + _tmp94_ = gee_collection_contains (_tmp93_, "hello2"); + _vala_assert (_tmp94_, "test_collection.contains (\"hello2\")"); + _tmp95_ = self->test_collection; + _tmp96_ = gee_collection_contains (_tmp95_, "hello3"); + _vala_assert (_tmp96_, "test_collection.contains (\"hello3\")"); + _tmp97_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp98_ = _tmp97_; + _vala_assert (_tmp98_ == 3, "dummy.size == 3"); + _tmp99_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp99_, "dummy.contains (\"hello1\")"); + _tmp100_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp100_, "dummy.contains (\"hello2\")"); + _tmp101_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp101_, "dummy.contains (\"hello3\")"); + _tmp102_ = self->test_collection; + gee_collection_clear (_tmp102_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _g_object_unref0 (dummy); +} + + +void collection_tests_test_to_array (CollectionTests* self) { + GeeCollection* _tmp0_; + GeeCollection* _tmp1_; + gboolean _tmp2_; + gboolean _tmp3_; + GeeCollection* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeCollection* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeCollection* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeCollection* _tmp10_; + gint _tmp11_ = 0; + gpointer* _tmp12_ = NULL; + gchar** array; + gint array_length1; + gint _array_size_; + gint index; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = self->test_collection; + _tmp2_ = gee_collection_get_is_empty (_tmp1_); + _tmp3_ = _tmp2_; + _vala_assert (_tmp3_, "test_collection.is_empty"); + _tmp4_ = self->test_collection; + _tmp5_ = gee_collection_add (_tmp4_, "hello1"); + _vala_assert (_tmp5_, "test_collection.add (\"hello1\")"); + _tmp6_ = self->test_collection; + _tmp7_ = gee_collection_add (_tmp6_, "hello2"); + _vala_assert (_tmp7_, "test_collection.add (\"hello2\")"); + _tmp8_ = self->test_collection; + _tmp9_ = gee_collection_add (_tmp8_, "hello3"); + _vala_assert (_tmp9_, "test_collection.add (\"hello3\")"); + _tmp10_ = self->test_collection; + _tmp12_ = gee_collection_to_array (_tmp10_, &_tmp11_); + array = (gchar**) _tmp12_; + array_length1 = (_tmp11_ * sizeof (gchar*)) / sizeof (gchar*); + _array_size_ = array_length1; + index = 0; + { + GeeCollection* _tmp13_; + GeeIterator* _tmp14_ = NULL; + GeeIterator* _element_it; + _tmp13_ = self->test_collection; + _tmp14_ = gee_iterable_iterator ((GeeIterable*) _tmp13_); + _element_it = _tmp14_; + while (TRUE) { + GeeIterator* _tmp15_; + gboolean _tmp16_ = FALSE; + GeeIterator* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* element; + const gchar* _tmp19_; + gchar** _tmp20_; + gint _tmp20__length1; + gint _tmp21_; + const gchar* _tmp22_; + _tmp15_ = _element_it; + _tmp16_ = gee_iterator_next (_tmp15_); + if (!_tmp16_) { + break; + } + _tmp17_ = _element_it; + _tmp18_ = gee_iterator_get (_tmp17_); + element = (gchar*) _tmp18_; + _tmp19_ = element; + _tmp20_ = array; + _tmp20__length1 = array_length1; + _tmp21_ = index; + index = _tmp21_ + 1; + _tmp22_ = _tmp20_[_tmp21_]; + _vala_assert (g_strcmp0 (_tmp19_, _tmp22_) == 0, "element == array[index++]"); + _g_free0 (element); + } + _g_object_unref0 (_element_it); + } + array = (_vala_array_free (array, array_length1, (GDestroyNotify) g_free), NULL); +} + + +void collection_tests_test_gobject_properties (CollectionTests* self) { + GeeCollection* _tmp0_; + GValue value = {0}; + GValue _tmp1_ = {0}; + GValue _tmp2_; + GeeCollection* _tmp3_; + GType _tmp4_ = 0UL; + GeeCollection* _tmp5_; + GType _tmp6_; + GType _tmp7_; + GValue _tmp8_ = {0}; + GValue _tmp9_; + GeeCollection* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeCollection* _tmp12_; + gboolean _tmp13_; + gboolean _tmp14_; + GValue _tmp15_ = {0}; + GValue _tmp16_; + GeeCollection* _tmp17_; + gint _tmp18_ = 0; + GeeCollection* _tmp19_; + gint _tmp20_; + gint _tmp21_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + g_value_init (&_tmp1_, G_TYPE_GTYPE); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp1_; + _tmp2_ = value; + _tmp3_ = self->test_collection; + g_object_get_property ((GObject*) _tmp3_, "element-type", &value); + _tmp4_ = g_value_get_gtype (&value); + _tmp5_ = self->test_collection; + _tmp6_ = gee_iterable_get_element_type ((GeeIterable*) _tmp5_); + _tmp7_ = _tmp6_; + _vala_assert (_tmp4_ == _tmp7_, "value.get_gtype () == test_collection.element_type"); + g_value_unset (&value); + g_value_init (&_tmp8_, G_TYPE_BOOLEAN); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp8_; + _tmp9_ = value; + _tmp10_ = self->test_collection; + g_object_get_property ((GObject*) _tmp10_, "is-empty", &value); + _tmp11_ = g_value_get_boolean (&value); + _tmp12_ = self->test_collection; + _tmp13_ = gee_collection_get_is_empty (_tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp11_ == _tmp14_, "value.get_boolean () == test_collection.is_empty"); + g_value_unset (&value); + g_value_init (&_tmp15_, G_TYPE_INT); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp15_; + _tmp16_ = value; + _tmp17_ = self->test_collection; + g_object_get_property ((GObject*) _tmp17_, "size", &value); + _tmp18_ = g_value_get_int (&value); + _tmp19_ = self->test_collection; + _tmp20_ = gee_collection_get_size (_tmp19_); + _tmp21_ = _tmp20_; + _vala_assert (_tmp18_ == _tmp21_, "value.get_int () == test_collection.size"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; +} + + +static void collection_tests_class_init (CollectionTestsClass * klass) { + collection_tests_parent_class = g_type_class_peek_parent (klass); + G_OBJECT_CLASS (klass)->finalize = collection_tests_finalize; +} + + +static void collection_tests_instance_init (CollectionTests * self) { +} + + +static void collection_tests_finalize (GObject* obj) { + CollectionTests * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_COLLECTION_TESTS, CollectionTests); + _g_object_unref0 (self->test_collection); + G_OBJECT_CLASS (collection_tests_parent_class)->finalize (obj); +} + + +GType collection_tests_get_type (void) { + static volatile gsize collection_tests_type_id__volatile = 0; + if (g_once_init_enter (&collection_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (CollectionTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) collection_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CollectionTests), 0, (GInstanceInitFunc) collection_tests_instance_init, NULL }; + GType collection_tests_type_id; + collection_tests_type_id = g_type_register_static (GEE_TYPE_TEST_CASE, "CollectionTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&collection_tests_type_id__volatile, collection_tests_type_id); + } + return collection_tests_type_id__volatile; +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + + diff --git a/tests/testcollection.vala b/tests/testcollection.vala new file mode 100644 index 0000000..6155f9e --- /dev/null +++ b/tests/testcollection.vala @@ -0,0 +1,736 @@ +/* testcollection.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes' Villevalois + * Julien Peeters + */ + +using Gee; + +public abstract class CollectionTests : Gee.TestCase { + + public CollectionTests (string name) { + base (name); + add_test ("[Collection] type correctness", test_type_correctness); + add_test ("[Collection] iterator returns all elements once", + test_iterator_returns_all_elements_once); + add_test ("[Collection] mutable iterator", test_mutable_iterator); + add_test ("[Collection] contains, size and is_empty", + test_contains_size_and_is_empty); + add_test ("[Collection] add and remove", test_add_remove); + add_test ("[Collection] clear", test_clear); + add_test ("[Collection] add_all", test_add_all); + add_test ("[Collection] contains_all", test_contains_all); + add_test ("[Collection] remove_all", test_remove_all); + add_test ("[Collection] retain_all", test_retain_all); + add_test ("[Collection] to_array", test_to_array); + add_test ("[Collection] GObject properties", test_gobject_properties); + } + + protected Collection test_collection; + + public void test_type_correctness () { + // Check the collection exists + assert (test_collection != null); + + // Check the advertised element type + assert (test_collection.element_type == typeof (string)); + } + + public void test_iterator_returns_all_elements_once () { + // Check the collection exists + assert (test_collection != null); + bool has_next; + + // Check with an empty collection + Iterator iterator = test_collection.iterator (); + assert (! iterator.has_next ()); + assert (! iterator.next ()); + assert (! iterator.first ()); + + // Check for some elements in the collection + assert (test_collection.add ("one")); + assert (test_collection.add ("two")); + assert (test_collection.add ("three")); + + bool one_found = false; + bool two_found = false; + bool three_found = false; + bool one_found_once = true; + bool two_found_once = true; + bool three_found_once = true; + iterator = test_collection.iterator (); + while (true) { + has_next = iterator.has_next (); + assert (has_next == iterator.next ()); + if (! has_next) { + break; + } + + string element = iterator.get (); + if (element == "one") { + if (one_found) { + one_found_once = false; + } + one_found = true; + } else if (element == "two") { + if (two_found) { + two_found_once = false; + } + two_found = true; + } else if (element == "three") { + if (three_found) { + three_found_once = false; + } + three_found = true; + } + } + has_next = iterator.has_next (); + assert (! has_next); + assert (has_next == iterator.next ()); + assert (one_found); + assert (one_found_once); + assert (two_found); + assert (two_found_once); + assert (three_found); + assert (three_found_once); + + // Do it twice to check first () + assert (iterator.first ()); + + one_found = false; + two_found = false; + three_found = false; + one_found_once = true; + two_found_once = true; + three_found_once = true; + while (true) { + string element = iterator.get (); + if (element == "one") { + if (one_found) { + one_found_once = false; + } + one_found = true; + } else if (element == "two") { + if (two_found) { + two_found_once = false; + } + two_found = true; + } else if (element == "three") { + if (three_found) { + three_found_once = false; + } + three_found = true; + } + + has_next = iterator.has_next (); + assert (has_next == iterator.next ()); + if (! has_next) { + break; + } + } + has_next = iterator.has_next (); + assert (! has_next); + assert (has_next == iterator.next ()); + assert (one_found); + assert (one_found_once); + assert (two_found); + assert (two_found_once); + assert (three_found); + assert (three_found_once); + } + + public void test_mutable_iterator () { + // Check the collection exists + assert (test_collection != null); + bool has_next; + + // Check with an empty collection + Iterator iterator = test_collection.iterator (); + // ... + + // Check for some elements in the collection and remove one + assert (test_collection.add ("one")); + assert (test_collection.add ("two")); + assert (test_collection.add ("three")); + + bool one_found = false; + bool two_found = false; + bool three_found = false; + bool one_found_once = true; + bool two_found_once = true; + bool three_found_once = true; + iterator = test_collection.iterator (); + while (true) { + has_next = iterator.has_next (); + assert (has_next == iterator.next ()); + if (! has_next) { + break; + } + + string element = iterator.get (); + if (element == "one") { + if (one_found) { + one_found_once = false; + } + one_found = true; + } else if (element == "two") { + if (two_found) { + two_found_once = false; + } + two_found = true; + + // Remove this element + iterator.remove (); + } else if (element == "three") { + if (three_found) { + three_found_once = false; + } + three_found = true; + } + } + has_next = iterator.has_next (); + assert (! has_next); + assert (has_next == iterator.next ()); + assert (one_found); + assert (one_found_once); + assert (two_found); + assert (two_found_once); + assert (three_found); + assert (three_found_once); + + // Check after removal + assert (iterator.first ()); + + one_found = false; + two_found = false; + three_found = false; + one_found_once = true; + two_found_once = true; + three_found_once = true; + while (true) { + string element = iterator.get (); + if (element == "one") { + if (one_found) { + one_found_once = false; + } + one_found = true; + } else if (element == "two") { + two_found = true; + } else if (element == "three") { + if (three_found) { + three_found_once = false; + } + three_found = true; + } + + has_next = iterator.has_next (); + assert (has_next == iterator.next ()); + if (! has_next) { + break; + } + } + has_next = iterator.has_next (); + assert (! has_next); + assert (has_next == iterator.next ()); + assert (one_found); + assert (one_found_once); + assert (!two_found); + assert (three_found); + assert (three_found_once); + } + + public void test_contains_size_and_is_empty () { + // Check the collection exists + assert (test_collection != null); + + // Check the collection is initially empty + assert (! test_collection.contains ("one")); + assert (! test_collection.contains ("two")); + assert (! test_collection.contains ("three")); + assert (test_collection.size == 0); + assert (test_collection.is_empty); + + // Add an element + assert (test_collection.add ("one")); + assert (test_collection.contains ("one")); + assert (! test_collection.contains ("two")); + assert (! test_collection.contains ("three")); + assert (test_collection.size == 1); + assert (! test_collection.is_empty); + + // Remove the added element + assert (test_collection.remove ("one")); + assert (! test_collection.contains ("one")); + assert (! test_collection.contains ("two")); + assert (! test_collection.contains ("three")); + assert (test_collection.size == 0); + assert (test_collection.is_empty); + + // Add more elements + assert (test_collection.add ("one")); + assert (test_collection.contains ("one")); + assert (! test_collection.contains ("two")); + assert (! test_collection.contains ("three")); + assert (test_collection.size == 1); + assert (! test_collection.is_empty); + + assert (test_collection.add ("two")); + assert (test_collection.contains ("one")); + assert (test_collection.contains ("two")); + assert (! test_collection.contains ("three")); + assert (test_collection.size == 2); + assert (! test_collection.is_empty); + + assert (test_collection.add ("three")); + assert (test_collection.contains ("one")); + assert (test_collection.contains ("two")); + assert (test_collection.contains ("three")); + assert (test_collection.size == 3); + assert (! test_collection.is_empty); + + // Remove one element + assert (test_collection.remove ("two")); + assert (test_collection.contains ("one")); + assert (! test_collection.contains ("two")); + assert (test_collection.contains ("three")); + assert (test_collection.size == 2); + assert (! test_collection.is_empty); + + // Remove the same element again + assert (! test_collection.remove ("two")); + assert (test_collection.contains ("one")); + assert (! test_collection.contains ("two")); + assert (test_collection.contains ("three")); + assert (test_collection.size == 2); + assert (! test_collection.is_empty); + + // Remove all elements + test_collection.clear (); + assert (! test_collection.contains ("one")); + assert (! test_collection.contains ("two")); + assert (! test_collection.contains ("three")); + assert (test_collection.size == 0); + assert (test_collection.is_empty); + } + + public void test_add_remove () { + // Check the collection exists + assert (test_collection != null); + + string[] to_add = { + "one", "two", "three", "four", "five", "six", "seven", "eight", + "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", + "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", + "twenty one", "twenty two", "twenty three", "twenty four", + "twenty five", "twenty six", "twenty seven", "twenty eight", + "twenty nine", "thirty", "thirty one", "thirty two", "thirty four", + "thirty five", "thirty six", "thirty seven", "thirty eight", + "thirty nine", "fourty" + }; + var expected_size = 0; + + foreach (var a in to_add) { + assert (!test_collection.contains (a)); + assert (test_collection.size == expected_size++); + assert (test_collection.add (a)); + assert (test_collection.contains (a)); + } + assert (test_collection.size == to_add.length); + + foreach (var a in to_add) { + assert (test_collection.contains (a)); + } + + foreach (var a in to_add) { + assert (test_collection.contains (a)); + assert (test_collection.size == expected_size--); + assert (test_collection.remove (a)); + assert (!test_collection.contains (a)); + } + assert (test_collection.size == 0); + } + + public void test_clear () { + // Check the collection exists + assert (test_collection != null); + + string[] to_add = { + "one", "two", "three", "four", "five", "six", "seven", "eight", + "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", + "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", + "twenty one", "twenty two", "twenty three", "twenty four", + "twenty five", "twenty six", "twenty seven", "twenty eight", + "twenty nine", "thirty", "thirty one", "thirty two", "thirty four", + "thirty five", "thirty six", "thirty seven", "thirty eight", + "thirty nine", "fourty" + }; + var expected_size = 0; + + foreach (var a in to_add) { + assert (!test_collection.contains (a)); + assert (test_collection.size == expected_size++); + assert (test_collection.add (a)); + assert (test_collection.contains (a)); + } + assert (test_collection.size == to_add.length); + + test_collection.clear (); + + assert (test_collection.size == 0); + + Iterator iter = test_collection.iterator (); + assert (iter != null); + assert (!iter.has_next ()); + + } + + public void test_add_all () { + // Check the collection exists + assert (test_collection != null); + + // Creating a dummy collection + var dummy = new ArrayList (); + + // Check when the test collection is initially empty and + // dummy collection is empty + assert (! test_collection.add_all (dummy)); + + assert (test_collection.is_empty); + assert (dummy.is_empty); + + // Check when test collection is not empty but dummy is + assert (test_collection.add ("hello")); + assert (! test_collection.add_all (dummy)); + + assert (test_collection.size == 1); + assert (test_collection.contains ("hello")); + + test_collection.clear (); + dummy.clear (); + + // Check when the test collection is initially empty and + // dummy collection is not empty + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + + assert (test_collection.add_all (dummy)); + + assert (test_collection.size == 3); + assert (test_collection.contains ("hello1")); + assert (test_collection.contains ("hello2")); + assert (test_collection.contains ("hello3")); + assert (dummy.size == 3); + assert (dummy.contains ("hello1")); + assert (dummy.contains ("hello2")); + assert (dummy.contains ("hello3")); + + test_collection.clear (); + dummy.clear (); + + // Check when the test collection is not empty and both + // collections does not intersect + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + + assert (test_collection.add ("hello")); + + assert (test_collection.add_all (dummy)); + + assert (test_collection.size == 4); + assert (test_collection.contains ("hello")); + assert (test_collection.contains ("hello1")); + assert (test_collection.contains ("hello2")); + assert (test_collection.contains ("hello3")); + assert (dummy.size == 3); + assert (dummy.contains ("hello1")); + assert (dummy.contains ("hello2")); + assert (dummy.contains ("hello3")); + + test_collection.clear (); + dummy.clear (); + + // Check when the test collection is not empty and both + // collection intersect + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + + assert (test_collection.add ("hello1")); + + assert (test_collection.add_all (dummy)); + + // We can only assert the result is greater or equal than 3 + // as we do not assume duplicates + assert (test_collection.size >= 3); + assert (test_collection.contains ("hello1")); + assert (test_collection.contains ("hello2")); + assert (test_collection.contains ("hello3")); + assert (dummy.size == 3); + assert (dummy.contains ("hello1")); + assert (dummy.contains ("hello2")); + assert (dummy.contains ("hello3")); + } + + public void test_contains_all () { + // Check the collection exists + assert (test_collection != null); + + // Creating a dummy collection + var dummy = new ArrayList (); + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + + // Check when the test collection is initially empty + assert (test_collection.is_empty); + assert (! test_collection.contains_all (dummy)); + + // Check when the test collection is not empty and both + // collections does not intersect + assert (test_collection.add ("hello4")); + assert (test_collection.add ("hello5")); + assert (! test_collection.contains_all (dummy)); + + // Check when the test collection is not empty and both + // collections intersect but are not equal + assert (test_collection.add ("hello1")); + assert (test_collection.add ("hello2")); + assert (! test_collection.contains_all (dummy)); + + // Check when the test collection is not empty and the + // dummy collection is contained in the test one + assert (test_collection.add ("hello3")); + assert (test_collection.contains_all (dummy)); + assert (! dummy.contains_all (test_collection)); + } + + public void test_remove_all () { + // Check the collection exists + assert (test_collection != null); + + // Creating a dummy collection + var dummy = new ArrayList (); + + // Check when both collection are intially empty + assert (! test_collection.remove_all (dummy)); + + assert (test_collection.is_empty); + assert (dummy.is_empty); + + // Check when the test collection is initially empty and + // dummy collection is not empty + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + + assert (! test_collection.remove_all (dummy)); + + assert (test_collection.is_empty); + + test_collection.clear (); + dummy.clear (); + + // Check when the test collection is not empty and both + // collections does not intersect + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + assert (test_collection.add ("hello4")); + assert (test_collection.add ("hello5")); + + assert (! test_collection.remove_all (dummy)); + + assert (test_collection.size == 2); + assert (dummy.size == 3); + + test_collection.clear (); + dummy.clear (); + + // Check when the test collection is not empty and both + // collections intersect + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + assert (test_collection.add ("hello1")); + assert (test_collection.add ("hello2")); + assert (test_collection.add ("hello3")); + + assert (test_collection.remove_all (dummy)); + + assert (test_collection.is_empty); + assert (dummy.size == 3); + + test_collection.clear (); + dummy.clear (); + } + + public void test_retain_all () { + // Check the collection exists + assert (test_collection != null); + + // Creating a dummy collection + var dummy = new ArrayList (); + + // Check when the test collection is initially empty and + // dummy collection is empty + assert (! test_collection.retain_all (dummy)); + + assert (test_collection.is_empty); + assert (dummy.is_empty); + + // Check when the test collection is not empty and + // the dummy one is + assert (test_collection.add ("hello1")); + assert (test_collection.add ("hello2")); + + assert (test_collection.retain_all (dummy)); + + assert (test_collection.is_empty); + assert (dummy.is_empty); + + test_collection.clear (); + dummy.clear (); + + // Check when the test collection is initially empty and + // dummy collection is not empty + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + + assert (! test_collection.retain_all (dummy)); + + assert (test_collection.is_empty); + assert (dummy.size == 3); + assert (dummy.contains ("hello1")); + assert (dummy.contains ("hello2")); + assert (dummy.contains ("hello3")); + + test_collection.clear (); + dummy.clear (); + + // Check when the test collection is not empty and both + // collection does not intersect + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + assert (test_collection.add ("hello4")); + assert (test_collection.add ("hello5")); + + assert (test_collection.retain_all (dummy)); + + assert (test_collection.is_empty); + assert (dummy.size == 3); + assert (dummy.contains ("hello1")); + assert (dummy.contains ("hello2")); + assert (dummy.contains ("hello3")); + + test_collection.clear (); + dummy.clear (); + + // Check when both collections have the same elements + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + assert (test_collection.add ("hello1")); + assert (test_collection.add ("hello2")); + assert (test_collection.add ("hello3")); + + assert (! test_collection.retain_all (dummy)); + + assert (test_collection.size == 3); + assert (test_collection.contains ("hello1")); + assert (test_collection.contains ("hello2")); + assert (test_collection.contains ("hello3")); + assert (dummy.size == 3); + assert (dummy.contains ("hello1")); + assert (dummy.contains ("hello2")); + assert (dummy.contains ("hello3")); + + test_collection.clear (); + dummy.clear (); + + // Check when the test collection is not empty and both + // collections intersect but are not equal + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + assert (test_collection.add ("hello2")); + assert (test_collection.add ("hello3")); + assert (test_collection.add ("hello4")); + + assert (test_collection.retain_all (dummy)); + + assert (test_collection.size == 2); + assert (test_collection.contains ("hello2")); + assert (test_collection.contains ("hello3")); + assert (dummy.size == 3); + assert (dummy.contains ("hello1")); + assert (dummy.contains ("hello2")); + assert (dummy.contains ("hello3")); + + test_collection.clear (); + dummy.clear (); + } + + public void test_to_array () { + // Check the collection exists + assert (test_collection != null); + + // Check the collection is empty + assert (test_collection.is_empty); + + // Add some elements + assert (test_collection.add ("hello1")); + assert (test_collection.add ("hello2")); + assert (test_collection.add ("hello3")); + + // Check the conversion to array + string[] array = (string[]) test_collection.to_array (); + int index = 0; + foreach (string element in test_collection) { + assert (element == array[index++]); + } + } + + public void test_gobject_properties () { + // Check the collection exists + assert (test_collection != null); + Value value; + + value = Value (typeof (Type)); + test_collection.get_property ("element-type", ref value); + assert (value.get_gtype () == test_collection.element_type); + value.unset (); + + value = Value (typeof (bool)); + test_collection.get_property ("is-empty", ref value); + assert (value.get_boolean () == test_collection.is_empty); + value.unset (); + + value = Value (typeof (int)); + test_collection.get_property ("size", ref value); + assert (value.get_int () == test_collection.size); + value.unset (); + } +} diff --git a/tests/testcomparable.c b/tests/testcomparable.c new file mode 100644 index 0000000..2241ca0 --- /dev/null +++ b/tests/testcomparable.c @@ -0,0 +1,258 @@ +/* testcomparable.c generated by valac 0.18.0, the Vala compiler + * generated from testcomparable.vala, do not modify */ + +/* testcomparable.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COMPARABLE_TESTS (comparable_tests_get_type ()) +#define COMPARABLE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COMPARABLE_TESTS, ComparableTests)) +#define COMPARABLE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COMPARABLE_TESTS, ComparableTestsClass)) +#define IS_COMPARABLE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COMPARABLE_TESTS)) +#define IS_COMPARABLE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COMPARABLE_TESTS)) +#define COMPARABLE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COMPARABLE_TESTS, ComparableTestsClass)) + +typedef struct _ComparableTests ComparableTests; +typedef struct _ComparableTestsClass ComparableTestsClass; +typedef struct _ComparableTestsPrivate ComparableTestsPrivate; + +#define COMPARABLE_TESTS_TYPE_TEST_COMPARABLE (comparable_tests_test_comparable_get_type ()) +#define COMPARABLE_TESTS_TEST_COMPARABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COMPARABLE_TESTS_TYPE_TEST_COMPARABLE, ComparableTestsTestComparable)) +#define COMPARABLE_TESTS_TEST_COMPARABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), COMPARABLE_TESTS_TYPE_TEST_COMPARABLE, ComparableTestsTestComparableClass)) +#define COMPARABLE_TESTS_IS_TEST_COMPARABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COMPARABLE_TESTS_TYPE_TEST_COMPARABLE)) +#define COMPARABLE_TESTS_IS_TEST_COMPARABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), COMPARABLE_TESTS_TYPE_TEST_COMPARABLE)) +#define COMPARABLE_TESTS_TEST_COMPARABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), COMPARABLE_TESTS_TYPE_TEST_COMPARABLE, ComparableTestsTestComparableClass)) + +typedef struct _ComparableTestsTestComparable ComparableTestsTestComparable; +typedef struct _ComparableTestsTestComparableClass ComparableTestsTestComparableClass; +typedef struct _ComparableTestsTestComparablePrivate ComparableTestsTestComparablePrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _ComparableTests { + GeeTestCase parent_instance; + ComparableTestsPrivate * priv; +}; + +struct _ComparableTestsClass { + GeeTestCaseClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); +struct _ComparableTestsTestComparable { + GObject parent_instance; + ComparableTestsTestComparablePrivate * priv; + gint _a; +}; + +struct _ComparableTestsTestComparableClass { + GObjectClass parent_class; +}; + + +static gpointer comparable_tests_parent_class = NULL; +static gpointer comparable_tests_test_comparable_parent_class = NULL; +static GeeComparableIface* comparable_tests_test_comparable_gee_comparable_parent_iface = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType comparable_tests_get_type (void) G_GNUC_CONST; +enum { + COMPARABLE_TESTS_DUMMY_PROPERTY +}; +ComparableTests* comparable_tests_new (void); +ComparableTests* comparable_tests_construct (GType object_type); +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void comparable_tests_test_selected_functions (ComparableTests* self); +static void _comparable_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +static ComparableTestsTestComparable* comparable_tests_test_comparable_new (gint a); +static ComparableTestsTestComparable* comparable_tests_test_comparable_construct (GType object_type, gint a); +static GType comparable_tests_test_comparable_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +enum { + COMPARABLE_TESTS_TEST_COMPARABLE_DUMMY_PROPERTY +}; +static gint comparable_tests_test_comparable_real_compare_to (GeeComparable* base, ComparableTestsTestComparable* object); +static void comparable_tests_test_comparable_finalize (GObject* obj); + + +static void _comparable_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + comparable_tests_test_selected_functions (self); +} + + +ComparableTests* comparable_tests_construct (GType object_type) { + ComparableTests * self = NULL; + self = (ComparableTests*) gee_test_case_construct (object_type, "Comparable"); + gee_test_case_add_test ((GeeTestCase*) self, "[Comparable] selected functions", _comparable_tests_test_selected_functions_gee_test_case_test_method, self); + return self; +} + + +ComparableTests* comparable_tests_new (void) { + return comparable_tests_construct (TYPE_COMPARABLE_TESTS); +} + + +void comparable_tests_test_selected_functions (ComparableTests* self) { + ComparableTestsTestComparable* _tmp0_; + ComparableTestsTestComparable* o1; + ComparableTestsTestComparable* _tmp1_; + ComparableTestsTestComparable* o2; + GCompareFunc _tmp2_ = NULL; + GCompareFunc compare; + gint _tmp3_ = 0; + gint _tmp4_ = 0; + g_return_if_fail (self != NULL); + _tmp0_ = comparable_tests_test_comparable_new (10); + o1 = _tmp0_; + _tmp1_ = comparable_tests_test_comparable_new (20); + o2 = _tmp1_; + _tmp2_ = gee_functions_get_compare_func_for (COMPARABLE_TESTS_TYPE_TEST_COMPARABLE); + compare = _tmp2_; + _tmp3_ = compare (o1, o2); + _vala_assert (_tmp3_ < 0, "compare (o1, o2) < 0"); + o1->_a = 42; + _tmp4_ = compare (o1, o2); + _vala_assert (_tmp4_ > 0, "compare (o1, o2) > 0"); + _g_object_unref0 (o2); + _g_object_unref0 (o1); +} + + +static ComparableTestsTestComparable* comparable_tests_test_comparable_construct (GType object_type, gint a) { + ComparableTestsTestComparable * self = NULL; + gint _tmp0_; + self = (ComparableTestsTestComparable*) g_object_new (object_type, NULL); + _tmp0_ = a; + self->_a = _tmp0_; + return self; +} + + +static ComparableTestsTestComparable* comparable_tests_test_comparable_new (gint a) { + return comparable_tests_test_comparable_construct (COMPARABLE_TESTS_TYPE_TEST_COMPARABLE, a); +} + + +static gint comparable_tests_test_comparable_real_compare_to (GeeComparable* base, ComparableTestsTestComparable* object) { + ComparableTestsTestComparable * self; + gint result = 0; + gint _tmp0_; + ComparableTestsTestComparable* _tmp1_; + gint _tmp2_; + self = (ComparableTestsTestComparable*) base; + g_return_val_if_fail (object != NULL, 0); + _tmp0_ = self->_a; + _tmp1_ = object; + _tmp2_ = _tmp1_->_a; + result = _tmp0_ - _tmp2_; + return result; +} + + +static void comparable_tests_test_comparable_class_init (ComparableTestsTestComparableClass * klass) { + comparable_tests_test_comparable_parent_class = g_type_class_peek_parent (klass); + G_OBJECT_CLASS (klass)->finalize = comparable_tests_test_comparable_finalize; +} + + +static void comparable_tests_test_comparable_gee_comparable_interface_init (GeeComparableIface * iface) { + comparable_tests_test_comparable_gee_comparable_parent_iface = g_type_interface_peek_parent (iface); + iface->compare_to = (gint (*)(GeeComparable*, gconstpointer)) comparable_tests_test_comparable_real_compare_to; +} + + +static void comparable_tests_test_comparable_instance_init (ComparableTestsTestComparable * self) { +} + + +static void comparable_tests_test_comparable_finalize (GObject* obj) { + ComparableTestsTestComparable * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, COMPARABLE_TESTS_TYPE_TEST_COMPARABLE, ComparableTestsTestComparable); + G_OBJECT_CLASS (comparable_tests_test_comparable_parent_class)->finalize (obj); +} + + +static GType comparable_tests_test_comparable_get_type (void) { + static volatile gsize comparable_tests_test_comparable_type_id__volatile = 0; + if (g_once_init_enter (&comparable_tests_test_comparable_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (ComparableTestsTestComparableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) comparable_tests_test_comparable_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ComparableTestsTestComparable), 0, (GInstanceInitFunc) comparable_tests_test_comparable_instance_init, NULL }; + static const GInterfaceInfo gee_comparable_info = { (GInterfaceInitFunc) comparable_tests_test_comparable_gee_comparable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType comparable_tests_test_comparable_type_id; + comparable_tests_test_comparable_type_id = g_type_register_static (G_TYPE_OBJECT, "ComparableTestsTestComparable", &g_define_type_info, 0); + g_type_add_interface_static (comparable_tests_test_comparable_type_id, GEE_TYPE_COMPARABLE, &gee_comparable_info); + g_once_init_leave (&comparable_tests_test_comparable_type_id__volatile, comparable_tests_test_comparable_type_id); + } + return comparable_tests_test_comparable_type_id__volatile; +} + + +static void comparable_tests_class_init (ComparableTestsClass * klass) { + comparable_tests_parent_class = g_type_class_peek_parent (klass); +} + + +static void comparable_tests_instance_init (ComparableTests * self) { +} + + +GType comparable_tests_get_type (void) { + static volatile gsize comparable_tests_type_id__volatile = 0; + if (g_once_init_enter (&comparable_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (ComparableTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) comparable_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ComparableTests), 0, (GInstanceInitFunc) comparable_tests_instance_init, NULL }; + GType comparable_tests_type_id; + comparable_tests_type_id = g_type_register_static (GEE_TYPE_TEST_CASE, "ComparableTests", &g_define_type_info, 0); + g_once_init_leave (&comparable_tests_type_id__volatile, comparable_tests_type_id); + } + return comparable_tests_type_id__volatile; +} + + + diff --git a/tests/testcomparable.vala b/tests/testcomparable.vala new file mode 100644 index 0000000..de5c2ef --- /dev/null +++ b/tests/testcomparable.vala @@ -0,0 +1,54 @@ +/* testcomparable.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + */ + +using Gee; + +public class ComparableTests : Gee.TestCase { + + public ComparableTests () { + base ("Comparable"); + add_test ("[Comparable] selected functions", test_selected_functions); + } + + private class TestComparable : Object, Comparable { + public int _a; + + public TestComparable (int a) { + _a = a; + } + + public int compare_to (TestComparable object) { + return _a - object._a; + } + } + + public void test_selected_functions () { + TestComparable o1 = new TestComparable (10); + TestComparable o2 = new TestComparable (20); + + CompareFunc compare = Functions.get_compare_func_for (typeof (TestComparable)); + assert (compare (o1, o2) < 0); + + o1._a = 42; + assert (compare (o1, o2) > 0); + } +} diff --git a/tests/testdeque.c b/tests/testdeque.c new file mode 100644 index 0000000..4af05df --- /dev/null +++ b/tests/testdeque.c @@ -0,0 +1,873 @@ +/* testdeque.c generated by valac 0.18.0, the Vala compiler + * generated from testdeque.vala, do not modify */ + +/* testdeque.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_QUEUE_TESTS (queue_tests_get_type ()) +#define QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_QUEUE_TESTS, QueueTests)) +#define QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_QUEUE_TESTS, QueueTestsClass)) +#define IS_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_QUEUE_TESTS)) +#define IS_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_QUEUE_TESTS)) +#define QUEUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_QUEUE_TESTS, QueueTestsClass)) + +typedef struct _QueueTests QueueTests; +typedef struct _QueueTestsClass QueueTestsClass; +typedef struct _QueueTestsPrivate QueueTestsPrivate; + +#define TYPE_DEQUE_TESTS (deque_tests_get_type ()) +#define DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DEQUE_TESTS, DequeTests)) +#define DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DEQUE_TESTS, DequeTestsClass)) +#define IS_DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DEQUE_TESTS)) +#define IS_DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DEQUE_TESTS)) +#define DEQUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DEQUE_TESTS, DequeTestsClass)) + +typedef struct _DequeTests DequeTests; +typedef struct _DequeTestsClass DequeTestsClass; +typedef struct _DequeTestsPrivate DequeTestsPrivate; +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _QueueTests { + CollectionTests parent_instance; + QueueTestsPrivate * priv; +}; + +struct _QueueTestsClass { + CollectionTestsClass parent_class; +}; + +struct _DequeTests { + QueueTests parent_instance; + DequeTestsPrivate * priv; +}; + +struct _DequeTestsClass { + QueueTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer deque_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType queue_tests_get_type (void) G_GNUC_CONST; +GType deque_tests_get_type (void) G_GNUC_CONST; +enum { + DEQUE_TESTS_DUMMY_PROPERTY +}; +DequeTests* deque_tests_construct (GType object_type, const gchar* name); +QueueTests* queue_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void deque_tests_test_queue_use (DequeTests* self); +static void _deque_tests_test_queue_use_gee_test_case_test_method (gpointer self); +void deque_tests_test_stack_use (DequeTests* self); +static void _deque_tests_test_stack_use_gee_test_case_test_method (gpointer self); +void deque_tests_test_reversed_stack_use (DequeTests* self); +static void _deque_tests_test_reversed_stack_use_gee_test_case_test_method (gpointer self); + + +static void _deque_tests_test_queue_use_gee_test_case_test_method (gpointer self) { + deque_tests_test_queue_use (self); +} + + +static void _deque_tests_test_stack_use_gee_test_case_test_method (gpointer self) { + deque_tests_test_stack_use (self); +} + + +static void _deque_tests_test_reversed_stack_use_gee_test_case_test_method (gpointer self) { + deque_tests_test_reversed_stack_use (self); +} + + +DequeTests* deque_tests_construct (GType object_type, const gchar* name) { + DequeTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (DequeTests*) queue_tests_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[Deque] queue use", _deque_tests_test_queue_use_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Deque] stack use", _deque_tests_test_stack_use_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Deque] reversed stack use", _deque_tests_test_reversed_stack_use_gee_test_case_test_method, self); + return self; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void deque_tests_test_queue_use (DequeTests* self) { + GeeCollection* _tmp0_; + GeeDeque* _tmp1_; + GeeDeque* test_deque; + GeeArrayList* _tmp2_; + GeeArrayList* recipient; + gboolean _tmp3_ = FALSE; + gint _tmp4_; + gint _tmp5_; + gboolean _tmp6_ = FALSE; + gint _tmp7_; + gint _tmp8_; + gboolean _tmp9_ = FALSE; + gint _tmp10_; + gint _tmp11_; + gboolean _tmp12_ = FALSE; + gint _tmp13_; + gint _tmp14_; + gpointer _tmp15_ = NULL; + gchar* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + gint _tmp19_; + gint _tmp20_; + gpointer _tmp21_ = NULL; + gchar* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + gint _tmp25_; + gint _tmp26_; + gpointer _tmp27_ = NULL; + gchar* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + gint _tmp31_; + gint _tmp32_; + gpointer _tmp33_ = NULL; + gchar* _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + gint _tmp37_; + gint _tmp38_; + gpointer _tmp39_ = NULL; + gchar* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + gboolean _tmp43_ = FALSE; + gboolean _tmp44_ = FALSE; + gboolean _tmp45_ = FALSE; + gboolean _tmp46_ = FALSE; + gint _tmp47_; + gint _tmp48_; + gint _tmp49_ = 0; + gint _tmp50_; + gint _tmp51_; + gint _tmp52_; + gint _tmp53_; + gpointer _tmp54_ = NULL; + gchar* _tmp55_; + gint _tmp56_ = 0; + gint _tmp57_; + gint _tmp58_; + gint _tmp59_; + gint _tmp60_; + gpointer _tmp61_ = NULL; + gchar* _tmp62_; + gpointer _tmp63_ = NULL; + gchar* _tmp64_; + gpointer _tmp65_ = NULL; + gchar* _tmp66_; + gint _tmp67_ = 0; + gint _tmp68_; + gint _tmp69_; + gint _tmp70_; + gint _tmp71_; + gint _tmp72_ = 0; + gint _tmp73_; + gint _tmp74_; + gint _tmp75_; + gint _tmp76_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_DEQUE) ? ((GeeDeque*) _tmp0_) : NULL); + test_deque = _tmp1_; + _tmp2_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + recipient = _tmp2_; + _vala_assert (test_deque != NULL, "test_deque != null"); + _tmp3_ = gee_deque_offer_tail (test_deque, "one"); + _vala_assert (_tmp3_, "test_deque.offer_tail (\"one\")"); + _tmp4_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 1, "test_deque.size == 1"); + _tmp6_ = gee_deque_offer_tail (test_deque, "two"); + _vala_assert (_tmp6_, "test_deque.offer_tail (\"two\")"); + _tmp7_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_ == 2, "test_deque.size == 2"); + _tmp9_ = gee_deque_offer_tail (test_deque, "three"); + _vala_assert (_tmp9_, "test_deque.offer_tail (\"three\")"); + _tmp10_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp11_ = _tmp10_; + _vala_assert (_tmp11_ == 3, "test_deque.size == 3"); + _tmp12_ = gee_deque_offer_tail (test_deque, "four"); + _vala_assert (_tmp12_, "test_deque.offer_tail (\"four\")"); + _tmp13_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 4, "test_deque.size == 4"); + _tmp15_ = gee_deque_peek_head (test_deque); + _tmp16_ = (gchar*) _tmp15_; + _vala_assert (g_strcmp0 (_tmp16_, "one") == 0, "test_deque.peek_head () == \"one\""); + _g_free0 (_tmp16_); + _tmp17_ = gee_deque_poll_head (test_deque); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "one") == 0, "test_deque.poll_head () == \"one\""); + _g_free0 (_tmp18_); + _tmp19_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 3, "test_deque.size == 3"); + _tmp21_ = gee_deque_peek_head (test_deque); + _tmp22_ = (gchar*) _tmp21_; + _vala_assert (g_strcmp0 (_tmp22_, "two") == 0, "test_deque.peek_head () == \"two\""); + _g_free0 (_tmp22_); + _tmp23_ = gee_deque_poll_head (test_deque); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "two") == 0, "test_deque.poll_head () == \"two\""); + _g_free0 (_tmp24_); + _tmp25_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp26_ = _tmp25_; + _vala_assert (_tmp26_ == 2, "test_deque.size == 2"); + _tmp27_ = gee_deque_peek_head (test_deque); + _tmp28_ = (gchar*) _tmp27_; + _vala_assert (g_strcmp0 (_tmp28_, "three") == 0, "test_deque.peek_head () == \"three\""); + _g_free0 (_tmp28_); + _tmp29_ = gee_deque_poll_head (test_deque); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "three") == 0, "test_deque.poll_head () == \"three\""); + _g_free0 (_tmp30_); + _tmp31_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp32_ = _tmp31_; + _vala_assert (_tmp32_ == 1, "test_deque.size == 1"); + _tmp33_ = gee_deque_peek_head (test_deque); + _tmp34_ = (gchar*) _tmp33_; + _vala_assert (g_strcmp0 (_tmp34_, "four") == 0, "test_deque.peek_head () == \"four\""); + _g_free0 (_tmp34_); + _tmp35_ = gee_deque_poll_head (test_deque); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "four") == 0, "test_deque.poll_head () == \"four\""); + _g_free0 (_tmp36_); + _tmp37_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp38_ = _tmp37_; + _vala_assert (_tmp38_ == 0, "test_deque.size == 0"); + _tmp39_ = gee_deque_peek_head (test_deque); + _tmp40_ = (gchar*) _tmp39_; + _vala_assert (_tmp40_ == NULL, "test_deque.peek_head () == null"); + _g_free0 (_tmp40_); + _tmp41_ = gee_deque_poll_head (test_deque); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (_tmp42_ == NULL, "test_deque.poll_head () == null"); + _g_free0 (_tmp42_); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp43_ = gee_deque_offer_tail (test_deque, "one"); + _vala_assert (_tmp43_, "test_deque.offer_tail (\"one\")"); + _tmp44_ = gee_deque_offer_tail (test_deque, "two"); + _vala_assert (_tmp44_, "test_deque.offer_tail (\"two\")"); + _tmp45_ = gee_deque_offer_tail (test_deque, "three"); + _vala_assert (_tmp45_, "test_deque.offer_tail (\"three\")"); + _tmp46_ = gee_deque_offer_tail (test_deque, "four"); + _vala_assert (_tmp46_, "test_deque.offer_tail (\"four\")"); + _tmp47_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp48_ = _tmp47_; + _vala_assert (_tmp48_ == 4, "test_deque.size == 4"); + _tmp49_ = gee_deque_drain_head (test_deque, (GeeCollection*) recipient, 1); + _vala_assert (_tmp49_ == 1, "test_deque.drain_head (recipient, 1) == 1"); + _tmp50_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp51_ = _tmp50_; + _vala_assert (_tmp51_ == 3, "test_deque.size == 3"); + _tmp52_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp53_ = _tmp52_; + _vala_assert (_tmp53_ == 1, "recipient.size == 1"); + _tmp54_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 0); + _tmp55_ = (gchar*) _tmp54_; + _vala_assert (g_strcmp0 (_tmp55_, "one") == 0, "recipient.get (0) == \"one\""); + _g_free0 (_tmp55_); + _tmp56_ = gee_deque_drain_head (test_deque, (GeeCollection*) recipient, -1); + _vala_assert (_tmp56_ == 3, "test_deque.drain_head (recipient) == 3"); + _tmp57_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp58_ = _tmp57_; + _vala_assert (_tmp58_ == 0, "test_deque.size == 0"); + _tmp59_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp60_ = _tmp59_; + _vala_assert (_tmp60_ == 4, "recipient.size == 4"); + _tmp61_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 1); + _tmp62_ = (gchar*) _tmp61_; + _vala_assert (g_strcmp0 (_tmp62_, "two") == 0, "recipient.get (1) == \"two\""); + _g_free0 (_tmp62_); + _tmp63_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 2); + _tmp64_ = (gchar*) _tmp63_; + _vala_assert (g_strcmp0 (_tmp64_, "three") == 0, "recipient.get (2) == \"three\""); + _g_free0 (_tmp64_); + _tmp65_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 3); + _tmp66_ = (gchar*) _tmp65_; + _vala_assert (g_strcmp0 (_tmp66_, "four") == 0, "recipient.get (3) == \"four\""); + _g_free0 (_tmp66_); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp67_ = gee_deque_drain_head (test_deque, (GeeCollection*) recipient, 1); + _vala_assert (_tmp67_ == 0, "test_deque.drain_head (recipient, 1) == 0"); + _tmp68_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp69_ = _tmp68_; + _vala_assert (_tmp69_ == 0, "test_deque.size == 0"); + _tmp70_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp71_ = _tmp70_; + _vala_assert (_tmp71_ == 0, "recipient.size == 0"); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp72_ = gee_deque_drain_head (test_deque, (GeeCollection*) recipient, -1); + _vala_assert (_tmp72_ == 0, "test_deque.drain_head (recipient) == 0"); + _tmp73_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp74_ = _tmp73_; + _vala_assert (_tmp74_ == 0, "test_deque.size == 0"); + _tmp75_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp76_ = _tmp75_; + _vala_assert (_tmp76_ == 0, "recipient.size == 0"); + _g_object_unref0 (recipient); + _g_object_unref0 (test_deque); +} + + +void deque_tests_test_stack_use (DequeTests* self) { + GeeCollection* _tmp0_; + GeeDeque* _tmp1_; + GeeDeque* test_deque; + GeeArrayList* _tmp2_; + GeeArrayList* recipient; + gboolean _tmp3_ = FALSE; + gint _tmp4_; + gint _tmp5_; + gboolean _tmp6_ = FALSE; + gint _tmp7_; + gint _tmp8_; + gboolean _tmp9_ = FALSE; + gint _tmp10_; + gint _tmp11_; + gboolean _tmp12_ = FALSE; + gint _tmp13_; + gint _tmp14_; + gpointer _tmp15_ = NULL; + gchar* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + gint _tmp19_; + gint _tmp20_; + gpointer _tmp21_ = NULL; + gchar* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + gint _tmp25_; + gint _tmp26_; + gpointer _tmp27_ = NULL; + gchar* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + gint _tmp31_; + gint _tmp32_; + gpointer _tmp33_ = NULL; + gchar* _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + gint _tmp37_; + gint _tmp38_; + gpointer _tmp39_ = NULL; + gchar* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + gboolean _tmp43_ = FALSE; + gboolean _tmp44_ = FALSE; + gboolean _tmp45_ = FALSE; + gboolean _tmp46_ = FALSE; + gint _tmp47_; + gint _tmp48_; + gint _tmp49_ = 0; + gint _tmp50_; + gint _tmp51_; + gint _tmp52_; + gint _tmp53_; + gpointer _tmp54_ = NULL; + gchar* _tmp55_; + gint _tmp56_ = 0; + gint _tmp57_; + gint _tmp58_; + gint _tmp59_; + gint _tmp60_; + gpointer _tmp61_ = NULL; + gchar* _tmp62_; + gpointer _tmp63_ = NULL; + gchar* _tmp64_; + gpointer _tmp65_ = NULL; + gchar* _tmp66_; + gint _tmp67_ = 0; + gint _tmp68_; + gint _tmp69_; + gint _tmp70_; + gint _tmp71_; + gint _tmp72_ = 0; + gint _tmp73_; + gint _tmp74_; + gint _tmp75_; + gint _tmp76_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_DEQUE) ? ((GeeDeque*) _tmp0_) : NULL); + test_deque = _tmp1_; + _tmp2_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + recipient = _tmp2_; + _vala_assert (test_deque != NULL, "test_deque != null"); + _tmp3_ = gee_deque_offer_head (test_deque, "one"); + _vala_assert (_tmp3_, "test_deque.offer_head (\"one\")"); + _tmp4_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 1, "test_deque.size == 1"); + _tmp6_ = gee_deque_offer_head (test_deque, "two"); + _vala_assert (_tmp6_, "test_deque.offer_head (\"two\")"); + _tmp7_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_ == 2, "test_deque.size == 2"); + _tmp9_ = gee_deque_offer_head (test_deque, "three"); + _vala_assert (_tmp9_, "test_deque.offer_head (\"three\")"); + _tmp10_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp11_ = _tmp10_; + _vala_assert (_tmp11_ == 3, "test_deque.size == 3"); + _tmp12_ = gee_deque_offer_head (test_deque, "four"); + _vala_assert (_tmp12_, "test_deque.offer_head (\"four\")"); + _tmp13_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 4, "test_deque.size == 4"); + _tmp15_ = gee_deque_peek_head (test_deque); + _tmp16_ = (gchar*) _tmp15_; + _vala_assert (g_strcmp0 (_tmp16_, "four") == 0, "test_deque.peek_head () == \"four\""); + _g_free0 (_tmp16_); + _tmp17_ = gee_deque_poll_head (test_deque); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "four") == 0, "test_deque.poll_head () == \"four\""); + _g_free0 (_tmp18_); + _tmp19_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 3, "test_deque.size == 3"); + _tmp21_ = gee_deque_peek_head (test_deque); + _tmp22_ = (gchar*) _tmp21_; + _vala_assert (g_strcmp0 (_tmp22_, "three") == 0, "test_deque.peek_head () == \"three\""); + _g_free0 (_tmp22_); + _tmp23_ = gee_deque_poll_head (test_deque); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "three") == 0, "test_deque.poll_head () == \"three\""); + _g_free0 (_tmp24_); + _tmp25_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp26_ = _tmp25_; + _vala_assert (_tmp26_ == 2, "test_deque.size == 2"); + _tmp27_ = gee_deque_peek_head (test_deque); + _tmp28_ = (gchar*) _tmp27_; + _vala_assert (g_strcmp0 (_tmp28_, "two") == 0, "test_deque.peek_head () == \"two\""); + _g_free0 (_tmp28_); + _tmp29_ = gee_deque_poll_head (test_deque); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "two") == 0, "test_deque.poll_head () == \"two\""); + _g_free0 (_tmp30_); + _tmp31_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp32_ = _tmp31_; + _vala_assert (_tmp32_ == 1, "test_deque.size == 1"); + _tmp33_ = gee_deque_peek_head (test_deque); + _tmp34_ = (gchar*) _tmp33_; + _vala_assert (g_strcmp0 (_tmp34_, "one") == 0, "test_deque.peek_head () == \"one\""); + _g_free0 (_tmp34_); + _tmp35_ = gee_deque_poll_head (test_deque); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "one") == 0, "test_deque.poll_head () == \"one\""); + _g_free0 (_tmp36_); + _tmp37_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp38_ = _tmp37_; + _vala_assert (_tmp38_ == 0, "test_deque.size == 0"); + _tmp39_ = gee_deque_peek_head (test_deque); + _tmp40_ = (gchar*) _tmp39_; + _vala_assert (_tmp40_ == NULL, "test_deque.peek_head () == null"); + _g_free0 (_tmp40_); + _tmp41_ = gee_deque_poll_head (test_deque); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (_tmp42_ == NULL, "test_deque.poll_head () == null"); + _g_free0 (_tmp42_); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp43_ = gee_deque_offer_head (test_deque, "one"); + _vala_assert (_tmp43_, "test_deque.offer_head (\"one\")"); + _tmp44_ = gee_deque_offer_head (test_deque, "two"); + _vala_assert (_tmp44_, "test_deque.offer_head (\"two\")"); + _tmp45_ = gee_deque_offer_head (test_deque, "three"); + _vala_assert (_tmp45_, "test_deque.offer_head (\"three\")"); + _tmp46_ = gee_deque_offer_head (test_deque, "four"); + _vala_assert (_tmp46_, "test_deque.offer_head (\"four\")"); + _tmp47_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp48_ = _tmp47_; + _vala_assert (_tmp48_ == 4, "test_deque.size == 4"); + _tmp49_ = gee_deque_drain_head (test_deque, (GeeCollection*) recipient, 1); + _vala_assert (_tmp49_ == 1, "test_deque.drain_head (recipient, 1) == 1"); + _tmp50_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp51_ = _tmp50_; + _vala_assert (_tmp51_ == 3, "test_deque.size == 3"); + _tmp52_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp53_ = _tmp52_; + _vala_assert (_tmp53_ == 1, "recipient.size == 1"); + _tmp54_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 0); + _tmp55_ = (gchar*) _tmp54_; + _vala_assert (g_strcmp0 (_tmp55_, "four") == 0, "recipient.get (0) == \"four\""); + _g_free0 (_tmp55_); + _tmp56_ = gee_deque_drain_head (test_deque, (GeeCollection*) recipient, -1); + _vala_assert (_tmp56_ == 3, "test_deque.drain_head (recipient) == 3"); + _tmp57_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp58_ = _tmp57_; + _vala_assert (_tmp58_ == 0, "test_deque.size == 0"); + _tmp59_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp60_ = _tmp59_; + _vala_assert (_tmp60_ == 4, "recipient.size == 4"); + _tmp61_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 1); + _tmp62_ = (gchar*) _tmp61_; + _vala_assert (g_strcmp0 (_tmp62_, "three") == 0, "recipient.get (1) == \"three\""); + _g_free0 (_tmp62_); + _tmp63_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 2); + _tmp64_ = (gchar*) _tmp63_; + _vala_assert (g_strcmp0 (_tmp64_, "two") == 0, "recipient.get (2) == \"two\""); + _g_free0 (_tmp64_); + _tmp65_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 3); + _tmp66_ = (gchar*) _tmp65_; + _vala_assert (g_strcmp0 (_tmp66_, "one") == 0, "recipient.get (3) == \"one\""); + _g_free0 (_tmp66_); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp67_ = gee_deque_drain_head (test_deque, (GeeCollection*) recipient, 1); + _vala_assert (_tmp67_ == 0, "test_deque.drain_head (recipient, 1) == 0"); + _tmp68_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp69_ = _tmp68_; + _vala_assert (_tmp69_ == 0, "test_deque.size == 0"); + _tmp70_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp71_ = _tmp70_; + _vala_assert (_tmp71_ == 0, "recipient.size == 0"); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp72_ = gee_deque_drain_head (test_deque, (GeeCollection*) recipient, -1); + _vala_assert (_tmp72_ == 0, "test_deque.drain_head (recipient) == 0"); + _tmp73_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp74_ = _tmp73_; + _vala_assert (_tmp74_ == 0, "test_deque.size == 0"); + _tmp75_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp76_ = _tmp75_; + _vala_assert (_tmp76_ == 0, "recipient.size == 0"); + _g_object_unref0 (recipient); + _g_object_unref0 (test_deque); +} + + +void deque_tests_test_reversed_stack_use (DequeTests* self) { + GeeCollection* _tmp0_; + GeeDeque* _tmp1_; + GeeDeque* test_deque; + GeeArrayList* _tmp2_; + GeeArrayList* recipient; + gboolean _tmp3_ = FALSE; + gint _tmp4_; + gint _tmp5_; + gboolean _tmp6_ = FALSE; + gint _tmp7_; + gint _tmp8_; + gboolean _tmp9_ = FALSE; + gint _tmp10_; + gint _tmp11_; + gboolean _tmp12_ = FALSE; + gint _tmp13_; + gint _tmp14_; + gpointer _tmp15_ = NULL; + gchar* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + gint _tmp19_; + gint _tmp20_; + gpointer _tmp21_ = NULL; + gchar* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + gint _tmp25_; + gint _tmp26_; + gpointer _tmp27_ = NULL; + gchar* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + gint _tmp31_; + gint _tmp32_; + gpointer _tmp33_ = NULL; + gchar* _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + gint _tmp37_; + gint _tmp38_; + gpointer _tmp39_ = NULL; + gchar* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + gboolean _tmp43_ = FALSE; + gboolean _tmp44_ = FALSE; + gboolean _tmp45_ = FALSE; + gboolean _tmp46_ = FALSE; + gint _tmp47_; + gint _tmp48_; + gint _tmp49_ = 0; + gint _tmp50_; + gint _tmp51_; + gint _tmp52_; + gint _tmp53_; + gpointer _tmp54_ = NULL; + gchar* _tmp55_; + gint _tmp56_ = 0; + gint _tmp57_; + gint _tmp58_; + gint _tmp59_; + gint _tmp60_; + gpointer _tmp61_ = NULL; + gchar* _tmp62_; + gpointer _tmp63_ = NULL; + gchar* _tmp64_; + gpointer _tmp65_ = NULL; + gchar* _tmp66_; + gint _tmp67_ = 0; + gint _tmp68_; + gint _tmp69_; + gint _tmp70_; + gint _tmp71_; + gint _tmp72_ = 0; + gint _tmp73_; + gint _tmp74_; + gint _tmp75_; + gint _tmp76_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_DEQUE) ? ((GeeDeque*) _tmp0_) : NULL); + test_deque = _tmp1_; + _tmp2_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + recipient = _tmp2_; + _vala_assert (test_deque != NULL, "test_deque != null"); + _tmp3_ = gee_deque_offer_tail (test_deque, "one"); + _vala_assert (_tmp3_, "test_deque.offer_tail (\"one\")"); + _tmp4_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 1, "test_deque.size == 1"); + _tmp6_ = gee_deque_offer_tail (test_deque, "two"); + _vala_assert (_tmp6_, "test_deque.offer_tail (\"two\")"); + _tmp7_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_ == 2, "test_deque.size == 2"); + _tmp9_ = gee_deque_offer_tail (test_deque, "three"); + _vala_assert (_tmp9_, "test_deque.offer_tail (\"three\")"); + _tmp10_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp11_ = _tmp10_; + _vala_assert (_tmp11_ == 3, "test_deque.size == 3"); + _tmp12_ = gee_deque_offer_tail (test_deque, "four"); + _vala_assert (_tmp12_, "test_deque.offer_tail (\"four\")"); + _tmp13_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 4, "test_deque.size == 4"); + _tmp15_ = gee_deque_peek_tail (test_deque); + _tmp16_ = (gchar*) _tmp15_; + _vala_assert (g_strcmp0 (_tmp16_, "four") == 0, "test_deque.peek_tail () == \"four\""); + _g_free0 (_tmp16_); + _tmp17_ = gee_deque_poll_tail (test_deque); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "four") == 0, "test_deque.poll_tail () == \"four\""); + _g_free0 (_tmp18_); + _tmp19_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 3, "test_deque.size == 3"); + _tmp21_ = gee_deque_peek_tail (test_deque); + _tmp22_ = (gchar*) _tmp21_; + _vala_assert (g_strcmp0 (_tmp22_, "three") == 0, "test_deque.peek_tail () == \"three\""); + _g_free0 (_tmp22_); + _tmp23_ = gee_deque_poll_tail (test_deque); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "three") == 0, "test_deque.poll_tail () == \"three\""); + _g_free0 (_tmp24_); + _tmp25_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp26_ = _tmp25_; + _vala_assert (_tmp26_ == 2, "test_deque.size == 2"); + _tmp27_ = gee_deque_peek_tail (test_deque); + _tmp28_ = (gchar*) _tmp27_; + _vala_assert (g_strcmp0 (_tmp28_, "two") == 0, "test_deque.peek_tail () == \"two\""); + _g_free0 (_tmp28_); + _tmp29_ = gee_deque_poll_tail (test_deque); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "two") == 0, "test_deque.poll_tail () == \"two\""); + _g_free0 (_tmp30_); + _tmp31_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp32_ = _tmp31_; + _vala_assert (_tmp32_ == 1, "test_deque.size == 1"); + _tmp33_ = gee_deque_peek_tail (test_deque); + _tmp34_ = (gchar*) _tmp33_; + _vala_assert (g_strcmp0 (_tmp34_, "one") == 0, "test_deque.peek_tail () == \"one\""); + _g_free0 (_tmp34_); + _tmp35_ = gee_deque_poll_tail (test_deque); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "one") == 0, "test_deque.poll_tail () == \"one\""); + _g_free0 (_tmp36_); + _tmp37_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp38_ = _tmp37_; + _vala_assert (_tmp38_ == 0, "test_deque.size == 0"); + _tmp39_ = gee_deque_peek_tail (test_deque); + _tmp40_ = (gchar*) _tmp39_; + _vala_assert (_tmp40_ == NULL, "test_deque.peek_tail () == null"); + _g_free0 (_tmp40_); + _tmp41_ = gee_deque_poll_tail (test_deque); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (_tmp42_ == NULL, "test_deque.poll_tail () == null"); + _g_free0 (_tmp42_); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp43_ = gee_deque_offer_tail (test_deque, "one"); + _vala_assert (_tmp43_, "test_deque.offer_tail (\"one\")"); + _tmp44_ = gee_deque_offer_tail (test_deque, "two"); + _vala_assert (_tmp44_, "test_deque.offer_tail (\"two\")"); + _tmp45_ = gee_deque_offer_tail (test_deque, "three"); + _vala_assert (_tmp45_, "test_deque.offer_tail (\"three\")"); + _tmp46_ = gee_deque_offer_tail (test_deque, "four"); + _vala_assert (_tmp46_, "test_deque.offer_tail (\"four\")"); + _tmp47_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp48_ = _tmp47_; + _vala_assert (_tmp48_ == 4, "test_deque.size == 4"); + _tmp49_ = gee_deque_drain_tail (test_deque, (GeeCollection*) recipient, 1); + _vala_assert (_tmp49_ == 1, "test_deque.drain_tail (recipient, 1) == 1"); + _tmp50_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp51_ = _tmp50_; + _vala_assert (_tmp51_ == 3, "test_deque.size == 3"); + _tmp52_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp53_ = _tmp52_; + _vala_assert (_tmp53_ == 1, "recipient.size == 1"); + _tmp54_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 0); + _tmp55_ = (gchar*) _tmp54_; + _vala_assert (g_strcmp0 (_tmp55_, "four") == 0, "recipient.get (0) == \"four\""); + _g_free0 (_tmp55_); + _tmp56_ = gee_deque_drain_tail (test_deque, (GeeCollection*) recipient, -1); + _vala_assert (_tmp56_ == 3, "test_deque.drain_tail (recipient) == 3"); + _tmp57_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp58_ = _tmp57_; + _vala_assert (_tmp58_ == 0, "test_deque.size == 0"); + _tmp59_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp60_ = _tmp59_; + _vala_assert (_tmp60_ == 4, "recipient.size == 4"); + _tmp61_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 1); + _tmp62_ = (gchar*) _tmp61_; + _vala_assert (g_strcmp0 (_tmp62_, "three") == 0, "recipient.get (1) == \"three\""); + _g_free0 (_tmp62_); + _tmp63_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 2); + _tmp64_ = (gchar*) _tmp63_; + _vala_assert (g_strcmp0 (_tmp64_, "two") == 0, "recipient.get (2) == \"two\""); + _g_free0 (_tmp64_); + _tmp65_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 3); + _tmp66_ = (gchar*) _tmp65_; + _vala_assert (g_strcmp0 (_tmp66_, "one") == 0, "recipient.get (3) == \"one\""); + _g_free0 (_tmp66_); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp67_ = gee_deque_drain_tail (test_deque, (GeeCollection*) recipient, 1); + _vala_assert (_tmp67_ == 0, "test_deque.drain_tail (recipient, 1) == 0"); + _tmp68_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp69_ = _tmp68_; + _vala_assert (_tmp69_ == 0, "test_deque.size == 0"); + _tmp70_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp71_ = _tmp70_; + _vala_assert (_tmp71_ == 0, "recipient.size == 0"); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp72_ = gee_deque_drain_tail (test_deque, (GeeCollection*) recipient, -1); + _vala_assert (_tmp72_ == 0, "test_deque.drain_tail (recipient) == 0"); + _tmp73_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp74_ = _tmp73_; + _vala_assert (_tmp74_ == 0, "test_deque.size == 0"); + _tmp75_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp76_ = _tmp75_; + _vala_assert (_tmp76_ == 0, "recipient.size == 0"); + _g_object_unref0 (recipient); + _g_object_unref0 (test_deque); +} + + +static void deque_tests_class_init (DequeTestsClass * klass) { + deque_tests_parent_class = g_type_class_peek_parent (klass); +} + + +static void deque_tests_instance_init (DequeTests * self) { +} + + +GType deque_tests_get_type (void) { + static volatile gsize deque_tests_type_id__volatile = 0; + if (g_once_init_enter (&deque_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (DequeTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) deque_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DequeTests), 0, (GInstanceInitFunc) deque_tests_instance_init, NULL }; + GType deque_tests_type_id; + deque_tests_type_id = g_type_register_static (TYPE_QUEUE_TESTS, "DequeTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&deque_tests_type_id__volatile, deque_tests_type_id); + } + return deque_tests_type_id__volatile; +} + + + diff --git a/tests/testdeque.vala b/tests/testdeque.vala new file mode 100644 index 0000000..d100ce0 --- /dev/null +++ b/tests/testdeque.vala @@ -0,0 +1,225 @@ +/* testdeque.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + */ + +using Gee; + +public abstract class DequeTests : QueueTests { + + public DequeTests (string name) { + base (name); + add_test ("[Deque] queue use", test_queue_use); + add_test ("[Deque] stack use", test_stack_use); + add_test ("[Deque] reversed stack use", test_reversed_stack_use); + } + + public void test_queue_use () { + var test_deque = test_collection as Gee.Deque; + ArrayList recipient = new ArrayList (); + + // Check the test deque is not null + assert (test_deque != null); + + // Check normal FIFO behavior + assert (test_deque.offer_tail ("one")); + assert (test_deque.size == 1); + assert (test_deque.offer_tail ("two")); + assert (test_deque.size == 2); + assert (test_deque.offer_tail ("three")); + assert (test_deque.size == 3); + assert (test_deque.offer_tail ("four")); + assert (test_deque.size == 4); + assert (test_deque.peek_head () == "one"); + assert (test_deque.poll_head () == "one"); + assert (test_deque.size == 3); + assert (test_deque.peek_head () == "two"); + assert (test_deque.poll_head () == "two"); + assert (test_deque.size == 2); + assert (test_deque.peek_head () == "three"); + assert (test_deque.poll_head () == "three"); + assert (test_deque.size == 1); + assert (test_deque.peek_head () == "four"); + assert (test_deque.poll_head () == "four"); + assert (test_deque.size == 0); + + // Check normal behavior when no element + assert (test_deque.peek_head () == null); + assert (test_deque.poll_head () == null); + + // Check drain with FIFO behavior + recipient.clear (); + assert (test_deque.offer_tail ("one")); + assert (test_deque.offer_tail ("two")); + assert (test_deque.offer_tail ("three")); + assert (test_deque.offer_tail ("four")); + assert (test_deque.size == 4); + assert (test_deque.drain_head (recipient, 1) == 1); + assert (test_deque.size == 3); + assert (recipient.size == 1); + assert (recipient.get (0) == "one"); + assert (test_deque.drain_head (recipient) == 3); + assert (test_deque.size == 0); + assert (recipient.size == 4); + assert (recipient.get (1) == "two"); + assert (recipient.get (2) == "three"); + assert (recipient.get (3) == "four"); + + // Check drain one when no element + recipient.clear (); + assert (test_deque.drain_head (recipient, 1) == 0); + assert (test_deque.size == 0); + assert (recipient.size == 0); + + // Check drain all when no element + recipient.clear (); + assert (test_deque.drain_head (recipient) == 0); + assert (test_deque.size == 0); + assert (recipient.size == 0); + } + + public void test_stack_use () { + var test_deque = test_collection as Gee.Deque; + ArrayList recipient = new ArrayList (); + + // Check the test deque is not null + assert (test_deque != null); + + // Check normal LIFO behavior + assert (test_deque.offer_head ("one")); + assert (test_deque.size == 1); + assert (test_deque.offer_head ("two")); + assert (test_deque.size == 2); + assert (test_deque.offer_head ("three")); + assert (test_deque.size == 3); + assert (test_deque.offer_head ("four")); + assert (test_deque.size == 4); + assert (test_deque.peek_head () == "four"); + assert (test_deque.poll_head () == "four"); + assert (test_deque.size == 3); + assert (test_deque.peek_head () == "three"); + assert (test_deque.poll_head () == "three"); + assert (test_deque.size == 2); + assert (test_deque.peek_head () == "two"); + assert (test_deque.poll_head () == "two"); + assert (test_deque.size == 1); + assert (test_deque.peek_head () == "one"); + assert (test_deque.poll_head () == "one"); + assert (test_deque.size == 0); + + // Check normal behavior when no element + assert (test_deque.peek_head () == null); + assert (test_deque.poll_head () == null); + + // Check drain with LIFO behavior + recipient.clear (); + assert (test_deque.offer_head ("one")); + assert (test_deque.offer_head ("two")); + assert (test_deque.offer_head ("three")); + assert (test_deque.offer_head ("four")); + assert (test_deque.size == 4); + assert (test_deque.drain_head (recipient, 1) == 1); + assert (test_deque.size == 3); + assert (recipient.size == 1); + assert (recipient.get (0) == "four"); + assert (test_deque.drain_head (recipient) == 3); + assert (test_deque.size == 0); + assert (recipient.size == 4); + assert (recipient.get (1) == "three"); + assert (recipient.get (2) == "two"); + assert (recipient.get (3) == "one"); + + // Check drain one when no element + recipient.clear (); + assert (test_deque.drain_head (recipient, 1) == 0); + assert (test_deque.size == 0); + assert (recipient.size == 0); + + // Check drain all when no element + recipient.clear (); + assert (test_deque.drain_head (recipient) == 0); + assert (test_deque.size == 0); + assert (recipient.size == 0); + } + + public void test_reversed_stack_use () { + var test_deque = test_collection as Gee.Deque; + ArrayList recipient = new ArrayList (); + + // Check the test deque is not null + assert (test_deque != null); + + // Check normal LIFO behavior + assert (test_deque.offer_tail ("one")); + assert (test_deque.size == 1); + assert (test_deque.offer_tail ("two")); + assert (test_deque.size == 2); + assert (test_deque.offer_tail ("three")); + assert (test_deque.size == 3); + assert (test_deque.offer_tail ("four")); + assert (test_deque.size == 4); + assert (test_deque.peek_tail () == "four"); + assert (test_deque.poll_tail () == "four"); + assert (test_deque.size == 3); + assert (test_deque.peek_tail () == "three"); + assert (test_deque.poll_tail () == "three"); + assert (test_deque.size == 2); + assert (test_deque.peek_tail () == "two"); + assert (test_deque.poll_tail () == "two"); + assert (test_deque.size == 1); + assert (test_deque.peek_tail () == "one"); + assert (test_deque.poll_tail () == "one"); + assert (test_deque.size == 0); + + // Check normal behavior when no element + assert (test_deque.peek_tail () == null); + assert (test_deque.poll_tail () == null); + + // Check drain with LIFO behavior + recipient.clear (); + assert (test_deque.offer_tail ("one")); + assert (test_deque.offer_tail ("two")); + assert (test_deque.offer_tail ("three")); + assert (test_deque.offer_tail ("four")); + assert (test_deque.size == 4); + assert (test_deque.drain_tail (recipient, 1) == 1); + assert (test_deque.size == 3); + assert (recipient.size == 1); + assert (recipient.get (0) == "four"); + assert (test_deque.drain_tail (recipient) == 3); + assert (test_deque.size == 0); + assert (recipient.size == 4); + assert (recipient.get (1) == "three"); + assert (recipient.get (2) == "two"); + assert (recipient.get (3) == "one"); + + // Check drain one when no element + recipient.clear (); + assert (test_deque.drain_tail (recipient, 1) == 0); + assert (test_deque.size == 0); + assert (recipient.size == 0); + + // Check drain all when no element + recipient.clear (); + assert (test_deque.drain_tail (recipient) == 0); + assert (test_deque.size == 0); + assert (recipient.size == 0); + } +} diff --git a/tests/testhashmap.c b/tests/testhashmap.c new file mode 100644 index 0000000..9f826ed --- /dev/null +++ b/tests/testhashmap.c @@ -0,0 +1,285 @@ +/* testhashmap.c generated by valac 0.18.0, the Vala compiler + * generated from testhashmap.vala, do not modify */ + +/* testhashmap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Julien Peeters + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_MAP_TESTS (map_tests_get_type ()) +#define MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAP_TESTS, MapTests)) +#define MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAP_TESTS, MapTestsClass)) +#define IS_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAP_TESTS)) +#define IS_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAP_TESTS)) +#define MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAP_TESTS, MapTestsClass)) + +typedef struct _MapTests MapTests; +typedef struct _MapTestsClass MapTestsClass; +typedef struct _MapTestsPrivate MapTestsPrivate; + +#define TYPE_HASH_MAP_TESTS (hash_map_tests_get_type ()) +#define HASH_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_MAP_TESTS, HashMapTests)) +#define HASH_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_MAP_TESTS, HashMapTestsClass)) +#define IS_HASH_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_MAP_TESTS)) +#define IS_HASH_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_MAP_TESTS)) +#define HASH_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_MAP_TESTS, HashMapTestsClass)) + +typedef struct _HashMapTests HashMapTests; +typedef struct _HashMapTestsClass HashMapTestsClass; +typedef struct _HashMapTestsPrivate HashMapTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _MapTests { + GeeTestCase parent_instance; + MapTestsPrivate * priv; + GeeMap* test_map; +}; + +struct _MapTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _HashMapTests { + MapTests parent_instance; + HashMapTestsPrivate * priv; +}; + +struct _HashMapTestsClass { + MapTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer hash_map_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType map_tests_get_type (void) G_GNUC_CONST; +GType hash_map_tests_get_type (void) G_GNUC_CONST; +enum { + HASH_MAP_TESTS_DUMMY_PROPERTY +}; +HashMapTests* hash_map_tests_new (void); +HashMapTests* hash_map_tests_construct (GType object_type); +MapTests* map_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void hash_map_tests_test_selected_functions (HashMapTests* self); +static void _hash_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +void hash_map_tests_test_gobject_properties (HashMapTests* self); +static void _hash_map_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +static void hash_map_tests_real_set_up (GeeTestCase* base); +static void hash_map_tests_real_tear_down (GeeTestCase* base); + + +static void _hash_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + hash_map_tests_test_selected_functions (self); +} + + +static void _hash_map_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + hash_map_tests_test_gobject_properties (self); +} + + +HashMapTests* hash_map_tests_construct (GType object_type) { + HashMapTests * self = NULL; + self = (HashMapTests*) map_tests_construct (object_type, "HashMap"); + gee_test_case_add_test ((GeeTestCase*) self, "[HashMap] selected functions", _hash_map_tests_test_selected_functions_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[HashMap] GObject properties", _hash_map_tests_test_gobject_properties_gee_test_case_test_method, self); + return self; +} + + +HashMapTests* hash_map_tests_new (void) { + return hash_map_tests_construct (TYPE_HASH_MAP_TESTS); +} + + +static void hash_map_tests_real_set_up (GeeTestCase* base) { + HashMapTests * self; + GeeHashMap* _tmp0_; + self = (HashMapTests*) base; + _tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL); + _g_object_unref0 (((MapTests*) self)->test_map); + ((MapTests*) self)->test_map = (GeeMap*) _tmp0_; +} + + +static void hash_map_tests_real_tear_down (GeeTestCase* base) { + HashMapTests * self; + self = (HashMapTests*) base; + _g_object_unref0 (((MapTests*) self)->test_map); + ((MapTests*) self)->test_map = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void hash_map_tests_test_selected_functions (HashMapTests* self) { + GeeMap* _tmp0_; + GeeHashMap* _tmp1_; + GeeHashMap* test_hash_map; + GHashFunc _tmp2_; + GHashFunc _tmp3_; + GHashFunc _tmp4_; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + GEqualFunc _tmp7_; + GEqualFunc _tmp8_; + GEqualFunc _tmp9_; + GEqualFunc _tmp10_; + g_return_if_fail (self != NULL); + _tmp0_ = ((MapTests*) self)->test_map; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_HASH_MAP) ? ((GeeHashMap*) _tmp0_) : NULL); + test_hash_map = _tmp1_; + _vala_assert (test_hash_map != NULL, "test_hash_map != null"); + _tmp2_ = gee_hash_map_get_key_hash_func (test_hash_map); + _tmp3_ = _tmp2_; + _tmp4_ = g_str_hash; + _vala_assert (_tmp3_ == _tmp4_, "test_hash_map.key_hash_func == str_hash"); + _tmp5_ = gee_hash_map_get_key_equal_func (test_hash_map); + _tmp6_ = _tmp5_; + _tmp7_ = g_str_equal; + _vala_assert (_tmp6_ == _tmp7_, "test_hash_map.key_equal_func == str_equal"); + _tmp8_ = gee_hash_map_get_value_equal_func (test_hash_map); + _tmp9_ = _tmp8_; + _tmp10_ = g_str_equal; + _vala_assert (_tmp9_ == _tmp10_, "test_hash_map.value_equal_func == str_equal"); + _g_object_unref0 (test_hash_map); +} + + +void hash_map_tests_test_gobject_properties (HashMapTests* self) { + GeeMap* _tmp0_; + GeeHashMap* _tmp1_; + GeeHashMap* test_hash_map; + GValue value = {0}; + GValue _tmp2_ = {0}; + GValue _tmp3_; + void* _tmp4_ = NULL; + GHashFunc _tmp5_; + GHashFunc _tmp6_; + GValue _tmp7_ = {0}; + GValue _tmp8_; + void* _tmp9_ = NULL; + GEqualFunc _tmp10_; + GEqualFunc _tmp11_; + GValue _tmp12_ = {0}; + GValue _tmp13_; + void* _tmp14_ = NULL; + GEqualFunc _tmp15_; + GEqualFunc _tmp16_; + g_return_if_fail (self != NULL); + _tmp0_ = ((MapTests*) self)->test_map; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_HASH_MAP) ? ((GeeHashMap*) _tmp0_) : NULL); + test_hash_map = _tmp1_; + _vala_assert (test_hash_map != NULL, "test_hash_map != null"); + g_value_init (&_tmp2_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp2_; + _tmp3_ = value; + g_object_get_property ((GObject*) test_hash_map, "key-hash-func", &value); + _tmp4_ = g_value_get_pointer (&value); + _tmp5_ = gee_hash_map_get_key_hash_func (test_hash_map); + _tmp6_ = _tmp5_; + _vala_assert (_tmp4_ == ((void*) _tmp6_), "value.get_pointer () == (void*) test_hash_map.key_hash_func"); + g_value_unset (&value); + g_value_init (&_tmp7_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp7_; + _tmp8_ = value; + g_object_get_property ((GObject*) test_hash_map, "key-equal-func", &value); + _tmp9_ = g_value_get_pointer (&value); + _tmp10_ = gee_hash_map_get_key_equal_func (test_hash_map); + _tmp11_ = _tmp10_; + _vala_assert (_tmp9_ == ((void*) _tmp11_), "value.get_pointer () == (void*) test_hash_map.key_equal_func"); + g_value_unset (&value); + g_value_init (&_tmp12_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp12_; + _tmp13_ = value; + g_object_get_property ((GObject*) test_hash_map, "value-equal-func", &value); + _tmp14_ = g_value_get_pointer (&value); + _tmp15_ = gee_hash_map_get_value_equal_func (test_hash_map); + _tmp16_ = _tmp15_; + _vala_assert (_tmp14_ == ((void*) _tmp16_), "value.get_pointer () == (void*) test_hash_map.value_equal_func"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + _g_object_unref0 (test_hash_map); +} + + +static void hash_map_tests_class_init (HashMapTestsClass * klass) { + hash_map_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = hash_map_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = hash_map_tests_real_tear_down; +} + + +static void hash_map_tests_instance_init (HashMapTests * self) { +} + + +GType hash_map_tests_get_type (void) { + static volatile gsize hash_map_tests_type_id__volatile = 0; + if (g_once_init_enter (&hash_map_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (HashMapTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) hash_map_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HashMapTests), 0, (GInstanceInitFunc) hash_map_tests_instance_init, NULL }; + GType hash_map_tests_type_id; + hash_map_tests_type_id = g_type_register_static (TYPE_MAP_TESTS, "HashMapTests", &g_define_type_info, 0); + g_once_init_leave (&hash_map_tests_type_id__volatile, hash_map_tests_type_id); + } + return hash_map_tests_type_id__volatile; +} + + + diff --git a/tests/testhashmap.vala b/tests/testhashmap.vala new file mode 100644 index 0000000..6ea5582 --- /dev/null +++ b/tests/testhashmap.vala @@ -0,0 +1,76 @@ +/* testhashmap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Julien Peeters + */ + +using Gee; + +public class HashMapTests : MapTests { + + public HashMapTests () { + base ("HashMap"); + add_test ("[HashMap] selected functions", test_selected_functions); + add_test ("[HashMap] GObject properties", test_gobject_properties); + } + + public override void set_up () { + test_map = new HashMap (); + } + + public override void tear_down () { + test_map = null; + } + + public void test_selected_functions () { + var test_hash_map = test_map as HashMap; + + // Check the map exists + assert (test_hash_map != null); + + // Check the selected hash and equal functions + assert (test_hash_map.key_hash_func == str_hash); + assert (test_hash_map.key_equal_func == str_equal); + assert (test_hash_map.value_equal_func == str_equal); + } + + public new void test_gobject_properties () { + var test_hash_map = test_map as HashMap; + + // Check the list exists + assert (test_hash_map != null); + Value value; + + value = Value (typeof (HashFunc)); + test_hash_map.get_property ("key-hash-func", ref value); + assert (value.get_pointer () == (void*) test_hash_map.key_hash_func); + value.unset (); + + value = Value (typeof (EqualFunc)); + test_hash_map.get_property ("key-equal-func", ref value); + assert (value.get_pointer () == (void*) test_hash_map.key_equal_func); + value.unset (); + + value = Value (typeof (EqualFunc)); + test_hash_map.get_property ("value-equal-func", ref value); + assert (value.get_pointer () == (void*) test_hash_map.value_equal_func); + value.unset (); + } +} diff --git a/tests/testhashmultimap.c b/tests/testhashmultimap.c new file mode 100644 index 0000000..1e29589 --- /dev/null +++ b/tests/testhashmultimap.c @@ -0,0 +1,226 @@ +/* testhashmultimap.c generated by valac 0.18.0, the Vala compiler + * generated from testhashmultimap.vala, do not modify */ + +/* testhashmultimap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes Villevalois + * Julien Peeters + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_MULTI_MAP_TESTS (multi_map_tests_get_type ()) +#define MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTests)) +#define MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass)) +#define IS_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_MAP_TESTS)) +#define IS_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_MAP_TESTS)) +#define MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass)) + +typedef struct _MultiMapTests MultiMapTests; +typedef struct _MultiMapTestsClass MultiMapTestsClass; +typedef struct _MultiMapTestsPrivate MultiMapTestsPrivate; + +#define TYPE_HASH_MULTI_MAP_TESTS (hash_multi_map_tests_get_type ()) +#define HASH_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_MULTI_MAP_TESTS, HashMultiMapTests)) +#define HASH_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_MULTI_MAP_TESTS, HashMultiMapTestsClass)) +#define IS_HASH_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_MULTI_MAP_TESTS)) +#define IS_HASH_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_MULTI_MAP_TESTS)) +#define HASH_MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_MULTI_MAP_TESTS, HashMultiMapTestsClass)) + +typedef struct _HashMultiMapTests HashMultiMapTests; +typedef struct _HashMultiMapTestsClass HashMultiMapTestsClass; +typedef struct _HashMultiMapTestsPrivate HashMultiMapTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _MultiMapTests { + GeeTestCase parent_instance; + MultiMapTestsPrivate * priv; + GeeMultiMap* test_multi_map; +}; + +struct _MultiMapTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _HashMultiMapTests { + MultiMapTests parent_instance; + HashMultiMapTestsPrivate * priv; +}; + +struct _HashMultiMapTestsClass { + MultiMapTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer hash_multi_map_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType multi_map_tests_get_type (void) G_GNUC_CONST; +GType hash_multi_map_tests_get_type (void) G_GNUC_CONST; +enum { + HASH_MULTI_MAP_TESTS_DUMMY_PROPERTY +}; +HashMultiMapTests* hash_multi_map_tests_new (void); +HashMultiMapTests* hash_multi_map_tests_construct (GType object_type); +MultiMapTests* multi_map_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void hash_multi_map_tests_test_selected_functions (HashMultiMapTests* self); +static void _hash_multi_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +static void hash_multi_map_tests_real_set_up (GeeTestCase* base); +static void hash_multi_map_tests_real_tear_down (GeeTestCase* base); + + +static void _hash_multi_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + hash_multi_map_tests_test_selected_functions (self); +} + + +HashMultiMapTests* hash_multi_map_tests_construct (GType object_type) { + HashMultiMapTests * self = NULL; + self = (HashMultiMapTests*) multi_map_tests_construct (object_type, "HashMultiMap"); + gee_test_case_add_test ((GeeTestCase*) self, "[HashMultiMap] selected functions", _hash_multi_map_tests_test_selected_functions_gee_test_case_test_method, self); + return self; +} + + +HashMultiMapTests* hash_multi_map_tests_new (void) { + return hash_multi_map_tests_construct (TYPE_HASH_MULTI_MAP_TESTS); +} + + +static void hash_multi_map_tests_real_set_up (GeeTestCase* base) { + HashMultiMapTests * self; + GeeHashMultiMap* _tmp0_; + self = (HashMultiMapTests*) base; + _tmp0_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL, NULL); + _g_object_unref0 (((MultiMapTests*) self)->test_multi_map); + ((MultiMapTests*) self)->test_multi_map = (GeeMultiMap*) _tmp0_; +} + + +static void hash_multi_map_tests_real_tear_down (GeeTestCase* base) { + HashMultiMapTests * self; + self = (HashMultiMapTests*) base; + _g_object_unref0 (((MultiMapTests*) self)->test_multi_map); + ((MultiMapTests*) self)->test_multi_map = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void hash_multi_map_tests_test_selected_functions (HashMultiMapTests* self) { + GeeMultiMap* _tmp0_; + GeeHashMultiMap* _tmp1_; + GeeHashMultiMap* test_hash_multi_map; + GHashFunc _tmp2_; + GHashFunc _tmp3_; + GHashFunc _tmp4_; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + GEqualFunc _tmp7_; + GHashFunc _tmp8_; + GHashFunc _tmp9_; + GHashFunc _tmp10_; + GEqualFunc _tmp11_; + GEqualFunc _tmp12_; + GEqualFunc _tmp13_; + g_return_if_fail (self != NULL); + _tmp0_ = ((MultiMapTests*) self)->test_multi_map; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_HASH_MULTI_MAP) ? ((GeeHashMultiMap*) _tmp0_) : NULL); + test_hash_multi_map = _tmp1_; + _vala_assert (test_hash_multi_map != NULL, "test_hash_multi_map != null"); + _tmp2_ = gee_hash_multi_map_get_key_hash_func (test_hash_multi_map); + _tmp3_ = _tmp2_; + _tmp4_ = g_str_hash; + _vala_assert (_tmp3_ == _tmp4_, "test_hash_multi_map.key_hash_func == str_hash"); + _tmp5_ = gee_hash_multi_map_get_key_equal_func (test_hash_multi_map); + _tmp6_ = _tmp5_; + _tmp7_ = g_str_equal; + _vala_assert (_tmp6_ == _tmp7_, "test_hash_multi_map.key_equal_func == str_equal"); + _tmp8_ = gee_hash_multi_map_get_value_hash_func (test_hash_multi_map); + _tmp9_ = _tmp8_; + _tmp10_ = g_str_hash; + _vala_assert (_tmp9_ == _tmp10_, "test_hash_multi_map.value_hash_func == str_hash"); + _tmp11_ = gee_hash_multi_map_get_value_equal_func (test_hash_multi_map); + _tmp12_ = _tmp11_; + _tmp13_ = g_str_equal; + _vala_assert (_tmp12_ == _tmp13_, "test_hash_multi_map.value_equal_func == str_equal"); + _g_object_unref0 (test_hash_multi_map); +} + + +static void hash_multi_map_tests_class_init (HashMultiMapTestsClass * klass) { + hash_multi_map_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = hash_multi_map_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = hash_multi_map_tests_real_tear_down; +} + + +static void hash_multi_map_tests_instance_init (HashMultiMapTests * self) { +} + + +GType hash_multi_map_tests_get_type (void) { + static volatile gsize hash_multi_map_tests_type_id__volatile = 0; + if (g_once_init_enter (&hash_multi_map_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (HashMultiMapTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) hash_multi_map_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HashMultiMapTests), 0, (GInstanceInitFunc) hash_multi_map_tests_instance_init, NULL }; + GType hash_multi_map_tests_type_id; + hash_multi_map_tests_type_id = g_type_register_static (TYPE_MULTI_MAP_TESTS, "HashMultiMapTests", &g_define_type_info, 0); + g_once_init_leave (&hash_multi_map_tests_type_id__volatile, hash_multi_map_tests_type_id); + } + return hash_multi_map_tests_type_id__volatile; +} + + + diff --git a/tests/testhashmultimap.vala b/tests/testhashmultimap.vala new file mode 100644 index 0000000..160985b --- /dev/null +++ b/tests/testhashmultimap.vala @@ -0,0 +1,55 @@ +/* testhashmultimap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes Villevalois + * Julien Peeters + */ + +using Gee; + +public class HashMultiMapTests : MultiMapTests { + + public HashMultiMapTests () { + base ("HashMultiMap"); + add_test ("[HashMultiMap] selected functions", test_selected_functions); + } + + public override void set_up () { + test_multi_map = new HashMultiMap (); + } + + public override void tear_down () { + test_multi_map = null; + } + + private void test_selected_functions () { + var test_hash_multi_map = test_multi_map as HashMultiMap; + + // Check the map exists + assert (test_hash_multi_map != null); + + // Check the selected hash and equal functions + assert (test_hash_multi_map.key_hash_func == str_hash); + assert (test_hash_multi_map.key_equal_func == str_equal); + assert (test_hash_multi_map.value_hash_func == str_hash); + assert (test_hash_multi_map.value_equal_func == str_equal); + } +} diff --git a/tests/testhashmultiset.c b/tests/testhashmultiset.c new file mode 100644 index 0000000..31adc39 --- /dev/null +++ b/tests/testhashmultiset.c @@ -0,0 +1,233 @@ +/* testhashmultiset.c generated by valac 0.18.0, the Vala compiler + * generated from testhashmultiset.vala, do not modify */ + +/* testhashmultiset.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes Villevalois + * Julien Peeters + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_MULTI_SET_TESTS (multi_set_tests_get_type ()) +#define MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_SET_TESTS, MultiSetTests)) +#define MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_SET_TESTS, MultiSetTestsClass)) +#define IS_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_SET_TESTS)) +#define IS_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_SET_TESTS)) +#define MULTI_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_SET_TESTS, MultiSetTestsClass)) + +typedef struct _MultiSetTests MultiSetTests; +typedef struct _MultiSetTestsClass MultiSetTestsClass; +typedef struct _MultiSetTestsPrivate MultiSetTestsPrivate; + +#define TYPE_HASH_MULTI_SET_TESTS (hash_multi_set_tests_get_type ()) +#define HASH_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_MULTI_SET_TESTS, HashMultiSetTests)) +#define HASH_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_MULTI_SET_TESTS, HashMultiSetTestsClass)) +#define IS_HASH_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_MULTI_SET_TESTS)) +#define IS_HASH_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_MULTI_SET_TESTS)) +#define HASH_MULTI_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_MULTI_SET_TESTS, HashMultiSetTestsClass)) + +typedef struct _HashMultiSetTests HashMultiSetTests; +typedef struct _HashMultiSetTestsClass HashMultiSetTestsClass; +typedef struct _HashMultiSetTestsPrivate HashMultiSetTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _MultiSetTests { + CollectionTests parent_instance; + MultiSetTestsPrivate * priv; +}; + +struct _MultiSetTestsClass { + CollectionTestsClass parent_class; +}; + +struct _HashMultiSetTests { + MultiSetTests parent_instance; + HashMultiSetTestsPrivate * priv; +}; + +struct _HashMultiSetTestsClass { + MultiSetTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer hash_multi_set_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType multi_set_tests_get_type (void) G_GNUC_CONST; +GType hash_multi_set_tests_get_type (void) G_GNUC_CONST; +enum { + HASH_MULTI_SET_TESTS_DUMMY_PROPERTY +}; +HashMultiSetTests* hash_multi_set_tests_new (void); +HashMultiSetTests* hash_multi_set_tests_construct (GType object_type); +MultiSetTests* multi_set_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void hash_multi_set_tests_test_selected_functions (HashMultiSetTests* self); +static void _hash_multi_set_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +static void hash_multi_set_tests_real_set_up (GeeTestCase* base); +static void hash_multi_set_tests_real_tear_down (GeeTestCase* base); + + +static void _hash_multi_set_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + hash_multi_set_tests_test_selected_functions (self); +} + + +HashMultiSetTests* hash_multi_set_tests_construct (GType object_type) { + HashMultiSetTests * self = NULL; + self = (HashMultiSetTests*) multi_set_tests_construct (object_type, "HashMultiSet"); + gee_test_case_add_test ((GeeTestCase*) self, "[HashMultiSet] selected functions", _hash_multi_set_tests_test_selected_functions_gee_test_case_test_method, self); + return self; +} + + +HashMultiSetTests* hash_multi_set_tests_new (void) { + return hash_multi_set_tests_construct (TYPE_HASH_MULTI_SET_TESTS); +} + + +static void hash_multi_set_tests_real_set_up (GeeTestCase* base) { + HashMultiSetTests * self; + GeeHashMultiSet* _tmp0_; + self = (HashMultiSetTests*) base; + _tmp0_ = gee_hash_multi_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; +} + + +static void hash_multi_set_tests_real_tear_down (GeeTestCase* base) { + HashMultiSetTests * self; + self = (HashMultiSetTests*) base; + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void hash_multi_set_tests_test_selected_functions (HashMultiSetTests* self) { + GeeCollection* _tmp0_; + GeeHashMultiSet* _tmp1_; + GeeHashMultiSet* test_multi_set; + GHashFunc _tmp2_; + GHashFunc _tmp3_; + GHashFunc _tmp4_; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + GEqualFunc _tmp7_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_HASH_MULTI_SET) ? ((GeeHashMultiSet*) _tmp0_) : NULL); + test_multi_set = _tmp1_; + _vala_assert (test_multi_set != NULL, "test_multi_set != null"); + _tmp2_ = gee_hash_multi_set_get_hash_func (test_multi_set); + _tmp3_ = _tmp2_; + _tmp4_ = g_str_hash; + _vala_assert (_tmp3_ == _tmp4_, "test_multi_set.hash_func == str_hash"); + _tmp5_ = gee_hash_multi_set_get_equal_func (test_multi_set); + _tmp6_ = _tmp5_; + _tmp7_ = g_str_equal; + _vala_assert (_tmp6_ == _tmp7_, "test_multi_set.equal_func == str_equal"); + _g_object_unref0 (test_multi_set); +} + + +static void hash_multi_set_tests_class_init (HashMultiSetTestsClass * klass) { + hash_multi_set_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = hash_multi_set_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = hash_multi_set_tests_real_tear_down; +} + + +static void hash_multi_set_tests_instance_init (HashMultiSetTests * self) { +} + + +GType hash_multi_set_tests_get_type (void) { + static volatile gsize hash_multi_set_tests_type_id__volatile = 0; + if (g_once_init_enter (&hash_multi_set_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (HashMultiSetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) hash_multi_set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HashMultiSetTests), 0, (GInstanceInitFunc) hash_multi_set_tests_instance_init, NULL }; + GType hash_multi_set_tests_type_id; + hash_multi_set_tests_type_id = g_type_register_static (TYPE_MULTI_SET_TESTS, "HashMultiSetTests", &g_define_type_info, 0); + g_once_init_leave (&hash_multi_set_tests_type_id__volatile, hash_multi_set_tests_type_id); + } + return hash_multi_set_tests_type_id__volatile; +} + + + diff --git a/tests/testhashmultiset.vala b/tests/testhashmultiset.vala new file mode 100644 index 0000000..13b951c --- /dev/null +++ b/tests/testhashmultiset.vala @@ -0,0 +1,53 @@ +/* testhashmultiset.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes Villevalois + * Julien Peeters + */ + +using Gee; + +public class HashMultiSetTests : MultiSetTests { + + public HashMultiSetTests () { + base ("HashMultiSet"); + add_test ("[HashMultiSet] selected functions", test_selected_functions); + } + + public override void set_up () { + test_collection = new HashMultiSet (); + } + + public override void tear_down () { + test_collection = null; + } + + private void test_selected_functions () { + var test_multi_set = test_collection as HashMultiSet; + + // Check the collection exists + assert (test_multi_set != null); + + // Check the selected hash and equal functions + assert (test_multi_set.hash_func == str_hash); + assert (test_multi_set.equal_func == str_equal); + } +} diff --git a/tests/testhashset.c b/tests/testhashset.c new file mode 100644 index 0000000..59710db --- /dev/null +++ b/tests/testhashset.c @@ -0,0 +1,285 @@ +/* testhashset.c generated by valac 0.18.0, the Vala compiler + * generated from testhashset.vala, do not modify */ + +/* testhashset.vala + * + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + * Julien Peeters + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_SET_TESTS (set_tests_get_type ()) +#define SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SET_TESTS, SetTests)) +#define SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SET_TESTS, SetTestsClass)) +#define IS_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SET_TESTS)) +#define IS_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SET_TESTS)) +#define SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SET_TESTS, SetTestsClass)) + +typedef struct _SetTests SetTests; +typedef struct _SetTestsClass SetTestsClass; +typedef struct _SetTestsPrivate SetTestsPrivate; + +#define TYPE_HASH_SET_TESTS (hash_set_tests_get_type ()) +#define HASH_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_SET_TESTS, HashSetTests)) +#define HASH_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_SET_TESTS, HashSetTestsClass)) +#define IS_HASH_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_SET_TESTS)) +#define IS_HASH_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_SET_TESTS)) +#define HASH_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_SET_TESTS, HashSetTestsClass)) + +typedef struct _HashSetTests HashSetTests; +typedef struct _HashSetTestsClass HashSetTestsClass; +typedef struct _HashSetTestsPrivate HashSetTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _SetTests { + CollectionTests parent_instance; + SetTestsPrivate * priv; +}; + +struct _SetTestsClass { + CollectionTestsClass parent_class; + void (*test_duplicates_are_ignored) (SetTests* self); +}; + +struct _HashSetTests { + SetTests parent_instance; + HashSetTestsPrivate * priv; +}; + +struct _HashSetTestsClass { + SetTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer hash_set_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType set_tests_get_type (void) G_GNUC_CONST; +GType hash_set_tests_get_type (void) G_GNUC_CONST; +enum { + HASH_SET_TESTS_DUMMY_PROPERTY +}; +HashSetTests* hash_set_tests_new (void); +HashSetTests* hash_set_tests_construct (GType object_type); +SetTests* set_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void hash_set_tests_test_selected_functions (HashSetTests* self); +static void _hash_set_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +void hash_set_tests_test_gobject_properties (HashSetTests* self); +static void _hash_set_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +static void hash_set_tests_real_set_up (GeeTestCase* base); +static void hash_set_tests_real_tear_down (GeeTestCase* base); + + +static void _hash_set_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + hash_set_tests_test_selected_functions (self); +} + + +static void _hash_set_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + hash_set_tests_test_gobject_properties (self); +} + + +HashSetTests* hash_set_tests_construct (GType object_type) { + HashSetTests * self = NULL; + self = (HashSetTests*) set_tests_construct (object_type, "HashSet"); + gee_test_case_add_test ((GeeTestCase*) self, "[HashSet] selected functions", _hash_set_tests_test_selected_functions_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[HashSet] GObject properties", _hash_set_tests_test_gobject_properties_gee_test_case_test_method, self); + return self; +} + + +HashSetTests* hash_set_tests_new (void) { + return hash_set_tests_construct (TYPE_HASH_SET_TESTS); +} + + +static void hash_set_tests_real_set_up (GeeTestCase* base) { + HashSetTests * self; + GeeHashSet* _tmp0_; + self = (HashSetTests*) base; + _tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; +} + + +static void hash_set_tests_real_tear_down (GeeTestCase* base) { + HashSetTests * self; + self = (HashSetTests*) base; + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void hash_set_tests_test_selected_functions (HashSetTests* self) { + GeeCollection* _tmp0_; + GeeHashSet* _tmp1_; + GeeHashSet* test_set; + GHashFunc _tmp2_; + GHashFunc _tmp3_; + GHashFunc _tmp4_; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + GEqualFunc _tmp7_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_HASH_SET) ? ((GeeHashSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _vala_assert (test_set != NULL, "test_set != null"); + _tmp2_ = gee_hash_set_get_hash_func (test_set); + _tmp3_ = _tmp2_; + _tmp4_ = g_str_hash; + _vala_assert (_tmp3_ == _tmp4_, "test_set.hash_func == str_hash"); + _tmp5_ = gee_hash_set_get_equal_func (test_set); + _tmp6_ = _tmp5_; + _tmp7_ = g_str_equal; + _vala_assert (_tmp6_ == _tmp7_, "test_set.equal_func == str_equal"); + _g_object_unref0 (test_set); +} + + +void hash_set_tests_test_gobject_properties (HashSetTests* self) { + GeeCollection* _tmp0_; + GeeHashSet* _tmp1_; + GeeHashSet* test_set; + GValue value = {0}; + GValue _tmp2_ = {0}; + GValue _tmp3_; + void* _tmp4_ = NULL; + GHashFunc _tmp5_; + GHashFunc _tmp6_; + GValue _tmp7_ = {0}; + GValue _tmp8_; + void* _tmp9_ = NULL; + GEqualFunc _tmp10_; + GEqualFunc _tmp11_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_HASH_SET) ? ((GeeHashSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _vala_assert (test_set != NULL, "test_set != null"); + g_value_init (&_tmp2_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp2_; + _tmp3_ = value; + g_object_get_property ((GObject*) test_set, "hash-func", &value); + _tmp4_ = g_value_get_pointer (&value); + _tmp5_ = gee_hash_set_get_hash_func (test_set); + _tmp6_ = _tmp5_; + _vala_assert (_tmp4_ == ((void*) _tmp6_), "value.get_pointer () == (void*) test_set.hash_func"); + g_value_unset (&value); + g_value_init (&_tmp7_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp7_; + _tmp8_ = value; + g_object_get_property ((GObject*) test_set, "equal-func", &value); + _tmp9_ = g_value_get_pointer (&value); + _tmp10_ = gee_hash_set_get_equal_func (test_set); + _tmp11_ = _tmp10_; + _vala_assert (_tmp9_ == ((void*) _tmp11_), "value.get_pointer () == (void*) test_set.equal_func"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + _g_object_unref0 (test_set); +} + + +static void hash_set_tests_class_init (HashSetTestsClass * klass) { + hash_set_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = hash_set_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = hash_set_tests_real_tear_down; +} + + +static void hash_set_tests_instance_init (HashSetTests * self) { +} + + +GType hash_set_tests_get_type (void) { + static volatile gsize hash_set_tests_type_id__volatile = 0; + if (g_once_init_enter (&hash_set_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (HashSetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) hash_set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HashSetTests), 0, (GInstanceInitFunc) hash_set_tests_instance_init, NULL }; + GType hash_set_tests_type_id; + hash_set_tests_type_id = g_type_register_static (TYPE_SET_TESTS, "HashSetTests", &g_define_type_info, 0); + g_once_init_leave (&hash_set_tests_type_id__volatile, hash_set_tests_type_id); + } + return hash_set_tests_type_id__volatile; +} + + + diff --git a/tests/testhashset.vala b/tests/testhashset.vala new file mode 100644 index 0000000..b252c19 --- /dev/null +++ b/tests/testhashset.vala @@ -0,0 +1,70 @@ +/* testhashset.vala + * + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + * Julien Peeters + */ + +using Gee; + +public class HashSetTests : SetTests { + + public HashSetTests () { + base ("HashSet"); + add_test ("[HashSet] selected functions", test_selected_functions); + add_test ("[HashSet] GObject properties", test_gobject_properties); + } + + public override void set_up () { + test_collection = new HashSet (); + } + + public override void tear_down () { + test_collection = null; + } + + public void test_selected_functions () { + var test_set = test_collection as HashSet; + + // Check the map exists + assert (test_set != null); + + // Check the selected hash and equal functions + assert (test_set.hash_func == str_hash); + assert (test_set.equal_func == str_equal); + } + + public new void test_gobject_properties () { + var test_set = test_collection as HashSet; + + // Check the list exists + assert (test_set != null); + Value value; + + value = Value (typeof (HashFunc)); + test_set.get_property ("hash-func", ref value); + assert (value.get_pointer () == (void*) test_set.hash_func); + value.unset (); + + value = Value (typeof (EqualFunc)); + test_set.get_property ("equal-func", ref value); + assert (value.get_pointer () == (void*) test_set.equal_func); + value.unset (); + } +} diff --git a/tests/testlinkedlist.c b/tests/testlinkedlist.c new file mode 100644 index 0000000..a4113f3 --- /dev/null +++ b/tests/testlinkedlist.c @@ -0,0 +1,371 @@ +/* testlinkedlist.c generated by valac 0.18.0, the Vala compiler + * generated from testlinkedlist.vala, do not modify */ + +/* testlinkedlist.vala + * + * Copyright (C) 2008 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Jürg Billeter + * Mark Lee (port to LinkedList) + * Julien Peeters + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_LIST_TESTS (list_tests_get_type ()) +#define LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LIST_TESTS, ListTests)) +#define LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LIST_TESTS, ListTestsClass)) +#define IS_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LIST_TESTS)) +#define IS_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LIST_TESTS)) +#define LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LIST_TESTS, ListTestsClass)) + +typedef struct _ListTests ListTests; +typedef struct _ListTestsClass ListTestsClass; +typedef struct _ListTestsPrivate ListTestsPrivate; + +#define TYPE_LINKED_LIST_TESTS (linked_list_tests_get_type ()) +#define LINKED_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LINKED_LIST_TESTS, LinkedListTests)) +#define LINKED_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LINKED_LIST_TESTS, LinkedListTestsClass)) +#define IS_LINKED_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LINKED_LIST_TESTS)) +#define IS_LINKED_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LINKED_LIST_TESTS)) +#define LINKED_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LINKED_LIST_TESTS, LinkedListTestsClass)) + +typedef struct _LinkedListTests LinkedListTests; +typedef struct _LinkedListTestsClass LinkedListTestsClass; +typedef struct _LinkedListTestsPrivate LinkedListTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _ListTests { + CollectionTests parent_instance; + ListTestsPrivate * priv; +}; + +struct _ListTestsClass { + CollectionTestsClass parent_class; + void (*test_duplicates_are_retained) (ListTests* self); +}; + +struct _LinkedListTests { + ListTests parent_instance; + LinkedListTestsPrivate * priv; +}; + +struct _LinkedListTestsClass { + ListTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer linked_list_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType list_tests_get_type (void) G_GNUC_CONST; +GType linked_list_tests_get_type (void) G_GNUC_CONST; +enum { + LINKED_LIST_TESTS_DUMMY_PROPERTY +}; +LinkedListTests* linked_list_tests_new (void); +LinkedListTests* linked_list_tests_construct (GType object_type); +ListTests* list_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void linked_list_tests_test_selected_functions (LinkedListTests* self); +static void _linked_list_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +void linked_list_tests_test_gobject_properties (LinkedListTests* self); +static void _linked_list_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +static void linked_list_tests_test_sort (LinkedListTests* self); +static void _linked_list_tests_test_sort_gee_test_case_test_method (gpointer self); +static void linked_list_tests_real_set_up (GeeTestCase* base); +static void linked_list_tests_real_tear_down (GeeTestCase* base); + + +static void _linked_list_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + linked_list_tests_test_selected_functions (self); +} + + +static void _linked_list_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + linked_list_tests_test_gobject_properties (self); +} + + +static void _linked_list_tests_test_sort_gee_test_case_test_method (gpointer self) { + linked_list_tests_test_sort (self); +} + + +LinkedListTests* linked_list_tests_construct (GType object_type) { + LinkedListTests * self = NULL; + self = (LinkedListTests*) list_tests_construct (object_type, "LinkedList"); + gee_test_case_add_test ((GeeTestCase*) self, "[LinkedList] selected functions", _linked_list_tests_test_selected_functions_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[LinkedList] GObject properties", _linked_list_tests_test_gobject_properties_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[LinkedList] sort", _linked_list_tests_test_sort_gee_test_case_test_method, self); + return self; +} + + +LinkedListTests* linked_list_tests_new (void) { + return linked_list_tests_construct (TYPE_LINKED_LIST_TESTS); +} + + +static void linked_list_tests_real_set_up (GeeTestCase* base) { + LinkedListTests * self; + GeeLinkedList* _tmp0_; + self = (LinkedListTests*) base; + _tmp0_ = gee_linked_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; +} + + +static void linked_list_tests_real_tear_down (GeeTestCase* base) { + LinkedListTests * self; + self = (LinkedListTests*) base; + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void linked_list_tests_test_selected_functions (LinkedListTests* self) { + GeeCollection* _tmp0_; + GeeLinkedList* _tmp1_; + GeeLinkedList* test_list; + GEqualFunc _tmp2_; + GEqualFunc _tmp3_; + GEqualFunc _tmp4_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LINKED_LIST) ? ((GeeLinkedList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + _tmp2_ = gee_linked_list_get_equal_func (test_list); + _tmp3_ = _tmp2_; + _tmp4_ = g_str_equal; + _vala_assert (_tmp3_ == _tmp4_, "test_list.equal_func == str_equal"); + _g_object_unref0 (test_list); +} + + +void linked_list_tests_test_gobject_properties (LinkedListTests* self) { + GeeCollection* _tmp0_; + GeeLinkedList* _tmp1_; + GeeLinkedList* test_list; + GValue value = {0}; + GValue _tmp2_ = {0}; + GValue _tmp3_; + void* _tmp4_ = NULL; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LINKED_LIST) ? ((GeeLinkedList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + g_value_init (&_tmp2_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp2_; + _tmp3_ = value; + g_object_get_property ((GObject*) test_list, "equal-func", &value); + _tmp4_ = g_value_get_pointer (&value); + _tmp5_ = gee_linked_list_get_equal_func (test_list); + _tmp6_ = _tmp5_; + _vala_assert (_tmp4_ == ((void*) _tmp6_), "value.get_pointer () == (void*) test_list.equal_func"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + _g_object_unref0 (test_list); +} + + +static void linked_list_tests_test_sort (LinkedListTests* self) { + GeeCollection* _tmp0_; + GeeLinkedList* _tmp1_; + GeeLinkedList* test_list; + gpointer _tmp2_ = NULL; + gchar* _tmp3_; + gpointer _tmp4_ = NULL; + gchar* _tmp5_; + gpointer _tmp6_ = NULL; + gchar* _tmp7_; + gpointer _tmp8_ = NULL; + gchar* _tmp9_; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gpointer _tmp12_ = NULL; + gchar* _tmp13_; + gpointer _tmp14_ = NULL; + gchar* _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LINKED_LIST) ? ((GeeLinkedList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "one"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "two"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "three"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "four"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "five"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "six"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "seven"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "eight"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "nine"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "ten"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "eleven"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "twelve"); + gee_list_sort ((GeeList*) test_list, NULL); + _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 0); + _tmp3_ = (gchar*) _tmp2_; + _vala_assert (g_strcmp0 (_tmp3_, "eight") == 0, "test_list.get (0) == \"eight\""); + _g_free0 (_tmp3_); + _tmp4_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 1); + _tmp5_ = (gchar*) _tmp4_; + _vala_assert (g_strcmp0 (_tmp5_, "eleven") == 0, "test_list.get (1) == \"eleven\""); + _g_free0 (_tmp5_); + _tmp6_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 2); + _tmp7_ = (gchar*) _tmp6_; + _vala_assert (g_strcmp0 (_tmp7_, "five") == 0, "test_list.get (2) == \"five\""); + _g_free0 (_tmp7_); + _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 3); + _tmp9_ = (gchar*) _tmp8_; + _vala_assert (g_strcmp0 (_tmp9_, "four") == 0, "test_list.get (3) == \"four\""); + _g_free0 (_tmp9_); + _tmp10_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 4); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "nine") == 0, "test_list.get (4) == \"nine\""); + _g_free0 (_tmp11_); + _tmp12_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 5); + _tmp13_ = (gchar*) _tmp12_; + _vala_assert (g_strcmp0 (_tmp13_, "one") == 0, "test_list.get (5) == \"one\""); + _g_free0 (_tmp13_); + _tmp14_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 6); + _tmp15_ = (gchar*) _tmp14_; + _vala_assert (g_strcmp0 (_tmp15_, "seven") == 0, "test_list.get (6) == \"seven\""); + _g_free0 (_tmp15_); + _tmp16_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 7); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (g_strcmp0 (_tmp17_, "six") == 0, "test_list.get (7) == \"six\""); + _g_free0 (_tmp17_); + _tmp18_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 8); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (g_strcmp0 (_tmp19_, "ten") == 0, "test_list.get (8) == \"ten\""); + _g_free0 (_tmp19_); + _tmp20_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 9); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "three") == 0, "test_list.get (9) == \"three\""); + _g_free0 (_tmp21_); + _tmp22_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 10); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (g_strcmp0 (_tmp23_, "twelve") == 0, "test_list.get (10) == \"twelve\""); + _g_free0 (_tmp23_); + _tmp24_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 11); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "two") == 0, "test_list.get (11) == \"two\""); + _g_free0 (_tmp25_); + _g_object_unref0 (test_list); +} + + +static void linked_list_tests_class_init (LinkedListTestsClass * klass) { + linked_list_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = linked_list_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = linked_list_tests_real_tear_down; +} + + +static void linked_list_tests_instance_init (LinkedListTests * self) { +} + + +GType linked_list_tests_get_type (void) { + static volatile gsize linked_list_tests_type_id__volatile = 0; + if (g_once_init_enter (&linked_list_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (LinkedListTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) linked_list_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LinkedListTests), 0, (GInstanceInitFunc) linked_list_tests_instance_init, NULL }; + GType linked_list_tests_type_id; + linked_list_tests_type_id = g_type_register_static (TYPE_LIST_TESTS, "LinkedListTests", &g_define_type_info, 0); + g_once_init_leave (&linked_list_tests_type_id__volatile, linked_list_tests_type_id); + } + return linked_list_tests_type_id__volatile; +} + + + diff --git a/tests/testlinkedlist.vala b/tests/testlinkedlist.vala new file mode 100644 index 0000000..737b6e3 --- /dev/null +++ b/tests/testlinkedlist.vala @@ -0,0 +1,101 @@ +/* testlinkedlist.vala + * + * Copyright (C) 2008 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Jürg Billeter + * Mark Lee (port to LinkedList) + * Julien Peeters + */ + +using Gee; + +public class LinkedListTests : ListTests { + + public LinkedListTests () { + base ("LinkedList"); + add_test ("[LinkedList] selected functions", test_selected_functions); + add_test ("[LinkedList] GObject properties", test_gobject_properties); + add_test ("[LinkedList] sort", test_sort); + } + + public override void set_up () { + test_collection = new LinkedList (); + } + + public override void tear_down () { + test_collection = null; + } + + private void test_selected_functions () { + var test_list = test_collection as LinkedList; + + // Check the collection exists + assert (test_list != null); + + // Check the selected equal function + assert (test_list.equal_func == str_equal); + } + + public new void test_gobject_properties () { + var test_list = test_collection as LinkedList; + + // Check the list exists + assert (test_list != null); + Value value; + + value = Value (typeof (EqualFunc)); + test_list.get_property ("equal-func", ref value); + assert (value.get_pointer () == (void*) test_list.equal_func); + value.unset (); + } + + private void test_sort () { + var test_list = test_collection as LinkedList; + + // Check the collection exists + assert (test_list != null); + + test_list.add ("one"); + test_list.add ("two"); + test_list.add ("three"); + test_list.add ("four"); + test_list.add ("five"); + test_list.add ("six"); + test_list.add ("seven"); + test_list.add ("eight"); + test_list.add ("nine"); + test_list.add ("ten"); + test_list.add ("eleven"); + test_list.add ("twelve"); + + test_list.sort (); + + assert (test_list.get (0) == "eight"); + assert (test_list.get (1) == "eleven"); + assert (test_list.get (2) == "five"); + assert (test_list.get (3) == "four"); + assert (test_list.get (4) == "nine"); + assert (test_list.get (5) == "one"); + assert (test_list.get (6) == "seven"); + assert (test_list.get (7) == "six"); + assert (test_list.get (8) == "ten"); + assert (test_list.get (9) == "three"); + assert (test_list.get (10) == "twelve"); + assert (test_list.get (11) == "two"); + } +} diff --git a/tests/testlinkedlistasdeque.c b/tests/testlinkedlistasdeque.c new file mode 100644 index 0000000..2bc8f68 --- /dev/null +++ b/tests/testlinkedlistasdeque.c @@ -0,0 +1,244 @@ +/* testlinkedlistasdeque.c generated by valac 0.18.0, the Vala compiler + * generated from testlinkedlistasdeque.vala, do not modify */ + +/* testlinkedlistasdeque.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Didier 'Ptitjes Villevalois + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_QUEUE_TESTS (queue_tests_get_type ()) +#define QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_QUEUE_TESTS, QueueTests)) +#define QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_QUEUE_TESTS, QueueTestsClass)) +#define IS_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_QUEUE_TESTS)) +#define IS_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_QUEUE_TESTS)) +#define QUEUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_QUEUE_TESTS, QueueTestsClass)) + +typedef struct _QueueTests QueueTests; +typedef struct _QueueTestsClass QueueTestsClass; +typedef struct _QueueTestsPrivate QueueTestsPrivate; + +#define TYPE_DEQUE_TESTS (deque_tests_get_type ()) +#define DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DEQUE_TESTS, DequeTests)) +#define DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DEQUE_TESTS, DequeTestsClass)) +#define IS_DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DEQUE_TESTS)) +#define IS_DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DEQUE_TESTS)) +#define DEQUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DEQUE_TESTS, DequeTestsClass)) + +typedef struct _DequeTests DequeTests; +typedef struct _DequeTestsClass DequeTestsClass; +typedef struct _DequeTestsPrivate DequeTestsPrivate; + +#define TYPE_LINKED_LIST_AS_DEQUE_TESTS (linked_list_as_deque_tests_get_type ()) +#define LINKED_LIST_AS_DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LINKED_LIST_AS_DEQUE_TESTS, LinkedListAsDequeTests)) +#define LINKED_LIST_AS_DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LINKED_LIST_AS_DEQUE_TESTS, LinkedListAsDequeTestsClass)) +#define IS_LINKED_LIST_AS_DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LINKED_LIST_AS_DEQUE_TESTS)) +#define IS_LINKED_LIST_AS_DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LINKED_LIST_AS_DEQUE_TESTS)) +#define LINKED_LIST_AS_DEQUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LINKED_LIST_AS_DEQUE_TESTS, LinkedListAsDequeTestsClass)) + +typedef struct _LinkedListAsDequeTests LinkedListAsDequeTests; +typedef struct _LinkedListAsDequeTestsClass LinkedListAsDequeTestsClass; +typedef struct _LinkedListAsDequeTestsPrivate LinkedListAsDequeTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _QueueTests { + CollectionTests parent_instance; + QueueTestsPrivate * priv; +}; + +struct _QueueTestsClass { + CollectionTestsClass parent_class; +}; + +struct _DequeTests { + QueueTests parent_instance; + DequeTestsPrivate * priv; +}; + +struct _DequeTestsClass { + QueueTestsClass parent_class; +}; + +struct _LinkedListAsDequeTests { + DequeTests parent_instance; + LinkedListAsDequeTestsPrivate * priv; +}; + +struct _LinkedListAsDequeTestsClass { + DequeTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer linked_list_as_deque_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType queue_tests_get_type (void) G_GNUC_CONST; +GType deque_tests_get_type (void) G_GNUC_CONST; +GType linked_list_as_deque_tests_get_type (void) G_GNUC_CONST; +enum { + LINKED_LIST_AS_DEQUE_TESTS_DUMMY_PROPERTY +}; +LinkedListAsDequeTests* linked_list_as_deque_tests_new (void); +LinkedListAsDequeTests* linked_list_as_deque_tests_construct (GType object_type); +DequeTests* deque_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void linked_list_as_deque_tests_test_selected_functions (LinkedListAsDequeTests* self); +static void _linked_list_as_deque_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +static void linked_list_as_deque_tests_real_set_up (GeeTestCase* base); +static void linked_list_as_deque_tests_real_tear_down (GeeTestCase* base); + + +static void _linked_list_as_deque_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + linked_list_as_deque_tests_test_selected_functions (self); +} + + +LinkedListAsDequeTests* linked_list_as_deque_tests_construct (GType object_type) { + LinkedListAsDequeTests * self = NULL; + self = (LinkedListAsDequeTests*) deque_tests_construct (object_type, "LinkedList as Deque"); + gee_test_case_add_test ((GeeTestCase*) self, "[LinkedList] selected functions", _linked_list_as_deque_tests_test_selected_functions_gee_test_case_test_method, self); + return self; +} + + +LinkedListAsDequeTests* linked_list_as_deque_tests_new (void) { + return linked_list_as_deque_tests_construct (TYPE_LINKED_LIST_AS_DEQUE_TESTS); +} + + +static void linked_list_as_deque_tests_real_set_up (GeeTestCase* base) { + LinkedListAsDequeTests * self; + GeeLinkedList* _tmp0_; + self = (LinkedListAsDequeTests*) base; + _tmp0_ = gee_linked_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; +} + + +static void linked_list_as_deque_tests_real_tear_down (GeeTestCase* base) { + LinkedListAsDequeTests * self; + self = (LinkedListAsDequeTests*) base; + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void linked_list_as_deque_tests_test_selected_functions (LinkedListAsDequeTests* self) { + GeeCollection* _tmp0_; + GeeLinkedList* _tmp1_; + GeeLinkedList* test_list; + GEqualFunc _tmp2_; + GEqualFunc _tmp3_; + GEqualFunc _tmp4_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LINKED_LIST) ? ((GeeLinkedList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + _tmp2_ = gee_linked_list_get_equal_func (test_list); + _tmp3_ = _tmp2_; + _tmp4_ = g_str_equal; + _vala_assert (_tmp3_ == _tmp4_, "test_list.equal_func == str_equal"); + _g_object_unref0 (test_list); +} + + +static void linked_list_as_deque_tests_class_init (LinkedListAsDequeTestsClass * klass) { + linked_list_as_deque_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = linked_list_as_deque_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = linked_list_as_deque_tests_real_tear_down; +} + + +static void linked_list_as_deque_tests_instance_init (LinkedListAsDequeTests * self) { +} + + +GType linked_list_as_deque_tests_get_type (void) { + static volatile gsize linked_list_as_deque_tests_type_id__volatile = 0; + if (g_once_init_enter (&linked_list_as_deque_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (LinkedListAsDequeTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) linked_list_as_deque_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LinkedListAsDequeTests), 0, (GInstanceInitFunc) linked_list_as_deque_tests_instance_init, NULL }; + GType linked_list_as_deque_tests_type_id; + linked_list_as_deque_tests_type_id = g_type_register_static (TYPE_DEQUE_TESTS, "LinkedListAsDequeTests", &g_define_type_info, 0); + g_once_init_leave (&linked_list_as_deque_tests_type_id__volatile, linked_list_as_deque_tests_type_id); + } + return linked_list_as_deque_tests_type_id__volatile; +} + + + diff --git a/tests/testlinkedlistasdeque.vala b/tests/testlinkedlistasdeque.vala new file mode 100644 index 0000000..81b791f --- /dev/null +++ b/tests/testlinkedlistasdeque.vala @@ -0,0 +1,49 @@ +/* testlinkedlistasdeque.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Didier 'Ptitjes Villevalois + */ + +using Gee; + +public class LinkedListAsDequeTests : DequeTests { + + public LinkedListAsDequeTests () { + base ("LinkedList as Deque"); + add_test ("[LinkedList] selected functions", test_selected_functions); + } + + public override void set_up () { + test_collection = new LinkedList (); + } + + public override void tear_down () { + test_collection = null; + } + + private void test_selected_functions () { + var test_list = test_collection as LinkedList; + + // Check the collection exists + assert (test_list != null); + + // Check the selected equal function + assert (test_list.equal_func == str_equal); + } +} diff --git a/tests/testlist.c b/tests/testlist.c new file mode 100644 index 0000000..580d171 --- /dev/null +++ b/tests/testlist.c @@ -0,0 +1,2248 @@ +/* testlist.c generated by valac 0.18.0, the Vala compiler + * generated from testlist.vala, do not modify */ + +/* testlist.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes' Villevalois + * Julien Peeters + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_LIST_TESTS (list_tests_get_type ()) +#define LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LIST_TESTS, ListTests)) +#define LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LIST_TESTS, ListTestsClass)) +#define IS_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LIST_TESTS)) +#define IS_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LIST_TESTS)) +#define LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LIST_TESTS, ListTestsClass)) + +typedef struct _ListTests ListTests; +typedef struct _ListTestsClass ListTestsClass; +typedef struct _ListTestsPrivate ListTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _ListTests { + CollectionTests parent_instance; + ListTestsPrivate * priv; +}; + +struct _ListTestsClass { + CollectionTestsClass parent_class; + void (*test_duplicates_are_retained) (ListTests* self); +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer list_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType list_tests_get_type (void) G_GNUC_CONST; +enum { + LIST_TESTS_DUMMY_PROPERTY +}; +ListTests* list_tests_construct (GType object_type, const gchar* name); +CollectionTests* collection_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void list_tests_test_iterator_is_ordered (ListTests* self); +static void _list_tests_test_iterator_is_ordered_gee_test_case_test_method (gpointer self); +void list_tests_test_list_iterator (ListTests* self); +static void _list_tests_test_list_iterator_gee_test_case_test_method (gpointer self); +void list_tests_test_duplicates_are_retained (ListTests* self); +static void _list_tests_test_duplicates_are_retained_gee_test_case_test_method (gpointer self); +void list_tests_test_get (ListTests* self); +static void _list_tests_test_get_gee_test_case_test_method (gpointer self); +void list_tests_test_set (ListTests* self); +static void _list_tests_test_set_gee_test_case_test_method (gpointer self); +void list_tests_test_insert (ListTests* self); +static void _list_tests_test_insert_gee_test_case_test_method (gpointer self); +void list_tests_test_remove_at (ListTests* self); +static void _list_tests_test_remove_at_gee_test_case_test_method (gpointer self); +void list_tests_test_index_of (ListTests* self); +static void _list_tests_test_index_of_gee_test_case_test_method (gpointer self); +void list_tests_test_first (ListTests* self); +static void _list_tests_test_first_gee_test_case_test_method (gpointer self); +void list_tests_test_last (ListTests* self); +static void _list_tests_test_last_gee_test_case_test_method (gpointer self); +void list_tests_test_insert_all (ListTests* self); +static void _list_tests_test_insert_all_gee_test_case_test_method (gpointer self); +void list_tests_test_slice (ListTests* self); +static void _list_tests_test_slice_gee_test_case_test_method (gpointer self); +static void list_tests_real_test_duplicates_are_retained (ListTests* self); + + +static void _list_tests_test_iterator_is_ordered_gee_test_case_test_method (gpointer self) { + list_tests_test_iterator_is_ordered (self); +} + + +static void _list_tests_test_list_iterator_gee_test_case_test_method (gpointer self) { + list_tests_test_list_iterator (self); +} + + +static void _list_tests_test_duplicates_are_retained_gee_test_case_test_method (gpointer self) { + list_tests_test_duplicates_are_retained (self); +} + + +static void _list_tests_test_get_gee_test_case_test_method (gpointer self) { + list_tests_test_get (self); +} + + +static void _list_tests_test_set_gee_test_case_test_method (gpointer self) { + list_tests_test_set (self); +} + + +static void _list_tests_test_insert_gee_test_case_test_method (gpointer self) { + list_tests_test_insert (self); +} + + +static void _list_tests_test_remove_at_gee_test_case_test_method (gpointer self) { + list_tests_test_remove_at (self); +} + + +static void _list_tests_test_index_of_gee_test_case_test_method (gpointer self) { + list_tests_test_index_of (self); +} + + +static void _list_tests_test_first_gee_test_case_test_method (gpointer self) { + list_tests_test_first (self); +} + + +static void _list_tests_test_last_gee_test_case_test_method (gpointer self) { + list_tests_test_last (self); +} + + +static void _list_tests_test_insert_all_gee_test_case_test_method (gpointer self) { + list_tests_test_insert_all (self); +} + + +static void _list_tests_test_slice_gee_test_case_test_method (gpointer self) { + list_tests_test_slice (self); +} + + +ListTests* list_tests_construct (GType object_type, const gchar* name) { + ListTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (ListTests*) collection_tests_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[List] iterator is ordered", _list_tests_test_iterator_is_ordered_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] list iterator", _list_tests_test_list_iterator_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] duplicates are retained", _list_tests_test_duplicates_are_retained_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] get", _list_tests_test_get_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] set", _list_tests_test_set_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] insert", _list_tests_test_insert_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] remove_at", _list_tests_test_remove_at_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] index_of", _list_tests_test_index_of_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] first", _list_tests_test_first_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] last", _list_tests_test_last_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] insert_all", _list_tests_test_insert_all_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] slice", _list_tests_test_slice_gee_test_case_test_method, self); + return self; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void list_tests_test_iterator_is_ordered (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeIterator* _tmp2_ = NULL; + GeeIterator* iterator; + GeeIterator* _tmp3_; + gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gboolean _tmp8_ = FALSE; + GeeIterator* _tmp9_ = NULL; + GeeIterator* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeIterator* _tmp12_; + gpointer _tmp13_ = NULL; + gchar* _tmp14_; + GeeIterator* _tmp15_; + gboolean _tmp16_ = FALSE; + GeeIterator* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + GeeIterator* _tmp20_; + gboolean _tmp21_ = FALSE; + GeeIterator* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + GeeIterator* _tmp25_; + gboolean _tmp26_ = FALSE; + GeeIterator* _tmp27_; + gpointer _tmp28_ = NULL; + gchar* _tmp29_; + GeeIterator* _tmp30_; + gboolean _tmp31_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + _tmp2_ = gee_iterable_iterator ((GeeIterable*) test_list); + iterator = _tmp2_; + _tmp3_ = iterator; + _tmp4_ = gee_iterator_next (_tmp3_); + _vala_assert (!_tmp4_, "! iterator.next ()"); + _tmp5_ = gee_collection_add ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp5_, "test_list.add (\"one\")"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_list, "two"); + _vala_assert (_tmp6_, "test_list.add (\"two\")"); + _tmp7_ = gee_collection_add ((GeeCollection*) test_list, "three"); + _vala_assert (_tmp7_, "test_list.add (\"three\")"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp8_, "test_list.add (\"one\")"); + _tmp9_ = gee_iterable_iterator ((GeeIterable*) test_list); + _g_object_unref0 (iterator); + iterator = _tmp9_; + _tmp10_ = iterator; + _tmp11_ = gee_iterator_next (_tmp10_); + _vala_assert (_tmp11_, "iterator.next()"); + _tmp12_ = iterator; + _tmp13_ = gee_iterator_get (_tmp12_); + _tmp14_ = (gchar*) _tmp13_; + _vala_assert (g_strcmp0 (_tmp14_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp14_); + _tmp15_ = iterator; + _tmp16_ = gee_iterator_next (_tmp15_); + _vala_assert (_tmp16_, "iterator.next()"); + _tmp17_ = iterator; + _tmp18_ = gee_iterator_get (_tmp17_); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (g_strcmp0 (_tmp19_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp19_); + _tmp20_ = iterator; + _tmp21_ = gee_iterator_next (_tmp20_); + _vala_assert (_tmp21_, "iterator.next()"); + _tmp22_ = iterator; + _tmp23_ = gee_iterator_get (_tmp22_); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "three") == 0, "iterator.get () == \"three\""); + _g_free0 (_tmp24_); + _tmp25_ = iterator; + _tmp26_ = gee_iterator_next (_tmp25_); + _vala_assert (_tmp26_, "iterator.next()"); + _tmp27_ = iterator; + _tmp28_ = gee_iterator_get (_tmp27_); + _tmp29_ = (gchar*) _tmp28_; + _vala_assert (g_strcmp0 (_tmp29_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp29_); + _tmp30_ = iterator; + _tmp31_ = gee_iterator_next (_tmp30_); + _vala_assert (!_tmp31_, "! iterator.next ()"); + _g_object_unref0 (iterator); + _g_object_unref0 (test_list); +} + + +void list_tests_test_list_iterator (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeListIterator* _tmp2_ = NULL; + GeeListIterator* iterator; + GeeListIterator* _tmp3_; + gboolean _tmp4_ = FALSE; + GeeListIterator* _tmp5_; + gboolean _tmp6_ = FALSE; + GeeListIterator* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeListIterator* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeListIterator* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeListIterator* _tmp13_; + gboolean _tmp14_ = FALSE; + gboolean _tmp15_ = FALSE; + gboolean _tmp16_ = FALSE; + gboolean _tmp17_ = FALSE; + GeeListIterator* _tmp18_ = NULL; + GeeListIterator* _tmp19_; + gboolean _tmp20_ = FALSE; + GeeListIterator* _tmp21_; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + GeeListIterator* _tmp24_; + gint _tmp25_ = 0; + GeeListIterator* _tmp26_; + GeeListIterator* _tmp27_; + gboolean _tmp28_ = FALSE; + GeeListIterator* _tmp29_; + gpointer _tmp30_ = NULL; + gchar* _tmp31_; + GeeListIterator* _tmp32_; + gint _tmp33_ = 0; + GeeListIterator* _tmp34_; + gint _tmp35_; + gint _tmp36_; + GeeListIterator* _tmp37_; + gint _tmp38_ = 0; + GeeListIterator* _tmp39_; + gint _tmp40_; + gint _tmp41_; + GeeListIterator* _tmp42_; + gint _tmp43_ = 0; + GeeListIterator* _tmp44_; + gint _tmp45_; + gint _tmp46_; + GeeListIterator* _tmp47_; + gint _tmp48_ = 0; + GeeListIterator* _tmp49_; + gboolean _tmp50_ = FALSE; + GeeListIterator* _tmp51_; + gpointer _tmp52_ = NULL; + gchar* _tmp53_; + GeeListIterator* _tmp54_; + gint _tmp55_ = 0; + GeeListIterator* _tmp56_; + GeeListIterator* _tmp57_; + gboolean _tmp58_ = FALSE; + GeeListIterator* _tmp59_; + gboolean _tmp60_ = FALSE; + GeeListIterator* _tmp61_; + gboolean _tmp62_ = FALSE; + GeeListIterator* _tmp63_; + gpointer _tmp64_ = NULL; + gchar* _tmp65_; + GeeListIterator* _tmp66_; + gint _tmp67_ = 0; + GeeListIterator* _tmp68_; + gboolean _tmp69_ = FALSE; + GeeListIterator* _tmp70_; + gboolean _tmp71_ = FALSE; + GeeListIterator* _tmp72_; + gboolean _tmp73_ = FALSE; + GeeListIterator* _tmp74_; + gpointer _tmp75_ = NULL; + gchar* _tmp76_; + GeeListIterator* _tmp77_; + gint _tmp78_ = 0; + GeeListIterator* _tmp79_; + gboolean _tmp80_ = FALSE; + GeeListIterator* _tmp81_; + gboolean _tmp82_ = FALSE; + GeeListIterator* _tmp83_; + gboolean _tmp84_ = FALSE; + GeeListIterator* _tmp85_; + gboolean _tmp86_ = FALSE; + GeeListIterator* _tmp87_; + gpointer _tmp88_ = NULL; + gchar* _tmp89_; + GeeListIterator* _tmp90_; + gint _tmp91_ = 0; + GeeListIterator* _tmp92_; + gboolean _tmp93_ = FALSE; + GeeListIterator* _tmp94_; + gboolean _tmp95_ = FALSE; + GeeListIterator* _tmp96_; + gpointer _tmp97_ = NULL; + gchar* _tmp98_; + GeeListIterator* _tmp99_; + gint _tmp100_ = 0; + GeeListIterator* _tmp101_; + gboolean _tmp102_ = FALSE; + GeeListIterator* _tmp103_; + gboolean _tmp104_ = FALSE; + GeeListIterator* _tmp105_; + gpointer _tmp106_ = NULL; + gchar* _tmp107_; + GeeListIterator* _tmp108_; + gint _tmp109_ = 0; + GeeListIterator* _tmp110_; + gboolean _tmp111_ = FALSE; + GeeListIterator* _tmp112_; + gboolean _tmp113_ = FALSE; + GeeListIterator* _tmp114_; + gpointer _tmp115_ = NULL; + gchar* _tmp116_; + GeeListIterator* _tmp117_; + gint _tmp118_ = 0; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + _tmp2_ = gee_list_list_iterator (test_list); + iterator = _tmp2_; + _tmp3_ = iterator; + _tmp4_ = gee_iterator_has_next ((GeeIterator*) _tmp3_); + _vala_assert (!_tmp4_, "! iterator.has_next ()"); + _tmp5_ = iterator; + _tmp6_ = gee_iterator_next ((GeeIterator*) _tmp5_); + _vala_assert (!_tmp6_, "! iterator.next ()"); + _tmp7_ = iterator; + _tmp8_ = gee_bidir_iterator_has_previous ((GeeBidirIterator*) _tmp7_); + _vala_assert (!_tmp8_, "! iterator.has_previous ()"); + _tmp9_ = iterator; + _tmp10_ = gee_bidir_iterator_previous ((GeeBidirIterator*) _tmp9_); + _vala_assert (!_tmp10_, "! iterator.previous ()"); + _tmp11_ = iterator; + _tmp12_ = gee_iterator_first ((GeeIterator*) _tmp11_); + _vala_assert (!_tmp12_, "! iterator.first ()"); + _tmp13_ = iterator; + _tmp14_ = gee_bidir_iterator_last ((GeeBidirIterator*) _tmp13_); + _vala_assert (!_tmp14_, "! iterator.last ()"); + _tmp15_ = gee_collection_add ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp15_, "test_list.add (\"one\")"); + _tmp16_ = gee_collection_add ((GeeCollection*) test_list, "two"); + _vala_assert (_tmp16_, "test_list.add (\"two\")"); + _tmp17_ = gee_collection_add ((GeeCollection*) test_list, "three"); + _vala_assert (_tmp17_, "test_list.add (\"three\")"); + _tmp18_ = gee_list_list_iterator (test_list); + _g_object_unref0 (iterator); + iterator = _tmp18_; + _tmp19_ = iterator; + _tmp20_ = gee_iterator_next ((GeeIterator*) _tmp19_); + _vala_assert (_tmp20_, "iterator.next()"); + _tmp21_ = iterator; + _tmp22_ = gee_iterator_get ((GeeIterator*) _tmp21_); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (g_strcmp0 (_tmp23_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp23_); + _tmp24_ = iterator; + _tmp25_ = gee_list_iterator_index (_tmp24_); + _vala_assert (_tmp25_ == 0, "iterator.index () == 0"); + _tmp26_ = iterator; + gee_list_iterator_set (_tmp26_, "new one"); + _tmp27_ = iterator; + _tmp28_ = gee_iterator_next ((GeeIterator*) _tmp27_); + _vala_assert (_tmp28_, "iterator.next()"); + _tmp29_ = iterator; + _tmp30_ = gee_iterator_get ((GeeIterator*) _tmp29_); + _tmp31_ = (gchar*) _tmp30_; + _vala_assert (g_strcmp0 (_tmp31_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp31_); + _tmp32_ = iterator; + _tmp33_ = gee_list_iterator_index (_tmp32_); + _vala_assert (_tmp33_ == 1, "iterator.index () == 1"); + _tmp34_ = iterator; + gee_list_iterator_set (_tmp34_, "new two"); + _tmp35_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp36_ = _tmp35_; + _vala_assert (_tmp36_ == 3, "test_list.size == 3"); + _tmp37_ = iterator; + _tmp38_ = gee_list_iterator_index (_tmp37_); + _vala_assert (_tmp38_ == 1, "iterator.index () == 1"); + _tmp39_ = iterator; + gee_list_iterator_insert (_tmp39_, "before two"); + _tmp40_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp41_ = _tmp40_; + _vala_assert (_tmp41_ == 4, "test_list.size == 4"); + _tmp42_ = iterator; + _tmp43_ = gee_list_iterator_index (_tmp42_); + _vala_assert (_tmp43_ == 2, "iterator.index () == 2"); + _tmp44_ = iterator; + gee_list_iterator_add (_tmp44_, "after two"); + _tmp45_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp46_ = _tmp45_; + _vala_assert (_tmp46_ == 5, "test_list.size == 5"); + _tmp47_ = iterator; + _tmp48_ = gee_list_iterator_index (_tmp47_); + _vala_assert (_tmp48_ == 3, "iterator.index () == 3"); + _tmp49_ = iterator; + _tmp50_ = gee_iterator_next ((GeeIterator*) _tmp49_); + _vala_assert (_tmp50_, "iterator.next()"); + _tmp51_ = iterator; + _tmp52_ = gee_iterator_get ((GeeIterator*) _tmp51_); + _tmp53_ = (gchar*) _tmp52_; + _vala_assert (g_strcmp0 (_tmp53_, "three") == 0, "iterator.get () == \"three\""); + _g_free0 (_tmp53_); + _tmp54_ = iterator; + _tmp55_ = gee_list_iterator_index (_tmp54_); + _vala_assert (_tmp55_ == 4, "iterator.index () == 4"); + _tmp56_ = iterator; + gee_list_iterator_set (_tmp56_, "new three"); + _tmp57_ = iterator; + _tmp58_ = gee_iterator_has_next ((GeeIterator*) _tmp57_); + _vala_assert (!_tmp58_, "! iterator.has_next ()"); + _tmp59_ = iterator; + _tmp60_ = gee_iterator_next ((GeeIterator*) _tmp59_); + _vala_assert (!_tmp60_, "! iterator.next ()"); + _tmp61_ = iterator; + _tmp62_ = gee_iterator_first ((GeeIterator*) _tmp61_); + _vala_assert (_tmp62_, "iterator.first ()"); + _tmp63_ = iterator; + _tmp64_ = gee_iterator_get ((GeeIterator*) _tmp63_); + _tmp65_ = (gchar*) _tmp64_; + _vala_assert (g_strcmp0 (_tmp65_, "new one") == 0, "iterator.get () == \"new one\""); + _g_free0 (_tmp65_); + _tmp66_ = iterator; + _tmp67_ = gee_list_iterator_index (_tmp66_); + _vala_assert (_tmp67_ == 0, "iterator.index () == 0"); + _tmp68_ = iterator; + _tmp69_ = gee_bidir_iterator_has_previous ((GeeBidirIterator*) _tmp68_); + _vala_assert (!_tmp69_, "! iterator.has_previous ()"); + _tmp70_ = iterator; + _tmp71_ = gee_bidir_iterator_previous ((GeeBidirIterator*) _tmp70_); + _vala_assert (!_tmp71_, "! iterator.previous ()"); + _tmp72_ = iterator; + _tmp73_ = gee_bidir_iterator_last ((GeeBidirIterator*) _tmp72_); + _vala_assert (_tmp73_, "iterator.last ()"); + _tmp74_ = iterator; + _tmp75_ = gee_iterator_get ((GeeIterator*) _tmp74_); + _tmp76_ = (gchar*) _tmp75_; + _vala_assert (g_strcmp0 (_tmp76_, "new three") == 0, "iterator.get () == \"new three\""); + _g_free0 (_tmp76_); + _tmp77_ = iterator; + _tmp78_ = gee_list_iterator_index (_tmp77_); + _vala_assert (_tmp78_ == 4, "iterator.index () == 4"); + _tmp79_ = iterator; + _tmp80_ = gee_iterator_has_next ((GeeIterator*) _tmp79_); + _vala_assert (!_tmp80_, "! iterator.has_next ()"); + _tmp81_ = iterator; + _tmp82_ = gee_iterator_next ((GeeIterator*) _tmp81_); + _vala_assert (!_tmp82_, "! iterator.next ()"); + _tmp83_ = iterator; + _tmp84_ = gee_bidir_iterator_has_previous ((GeeBidirIterator*) _tmp83_); + _vala_assert (_tmp84_, "iterator.has_previous ()"); + _tmp85_ = iterator; + _tmp86_ = gee_bidir_iterator_previous ((GeeBidirIterator*) _tmp85_); + _vala_assert (_tmp86_, "iterator.previous ()"); + _tmp87_ = iterator; + _tmp88_ = gee_iterator_get ((GeeIterator*) _tmp87_); + _tmp89_ = (gchar*) _tmp88_; + _vala_assert (g_strcmp0 (_tmp89_, "after two") == 0, "iterator.get () == \"after two\""); + _g_free0 (_tmp89_); + _tmp90_ = iterator; + _tmp91_ = gee_list_iterator_index (_tmp90_); + _vala_assert (_tmp91_ == 3, "iterator.index () == 3"); + _tmp92_ = iterator; + _tmp93_ = gee_bidir_iterator_has_previous ((GeeBidirIterator*) _tmp92_); + _vala_assert (_tmp93_, "iterator.has_previous ()"); + _tmp94_ = iterator; + _tmp95_ = gee_bidir_iterator_previous ((GeeBidirIterator*) _tmp94_); + _vala_assert (_tmp95_, "iterator.previous ()"); + _tmp96_ = iterator; + _tmp97_ = gee_iterator_get ((GeeIterator*) _tmp96_); + _tmp98_ = (gchar*) _tmp97_; + _vala_assert (g_strcmp0 (_tmp98_, "new two") == 0, "iterator.get () == \"new two\""); + _g_free0 (_tmp98_); + _tmp99_ = iterator; + _tmp100_ = gee_list_iterator_index (_tmp99_); + _vala_assert (_tmp100_ == 2, "iterator.index () == 2"); + _tmp101_ = iterator; + _tmp102_ = gee_bidir_iterator_has_previous ((GeeBidirIterator*) _tmp101_); + _vala_assert (_tmp102_, "iterator.has_previous ()"); + _tmp103_ = iterator; + _tmp104_ = gee_bidir_iterator_previous ((GeeBidirIterator*) _tmp103_); + _vala_assert (_tmp104_, "iterator.previous ()"); + _tmp105_ = iterator; + _tmp106_ = gee_iterator_get ((GeeIterator*) _tmp105_); + _tmp107_ = (gchar*) _tmp106_; + _vala_assert (g_strcmp0 (_tmp107_, "before two") == 0, "iterator.get () == \"before two\""); + _g_free0 (_tmp107_); + _tmp108_ = iterator; + _tmp109_ = gee_list_iterator_index (_tmp108_); + _vala_assert (_tmp109_ == 1, "iterator.index () == 1"); + _tmp110_ = iterator; + _tmp111_ = gee_bidir_iterator_has_previous ((GeeBidirIterator*) _tmp110_); + _vala_assert (_tmp111_, "iterator.has_previous ()"); + _tmp112_ = iterator; + _tmp113_ = gee_bidir_iterator_previous ((GeeBidirIterator*) _tmp112_); + _vala_assert (_tmp113_, "iterator.previous ()"); + _tmp114_ = iterator; + _tmp115_ = gee_iterator_get ((GeeIterator*) _tmp114_); + _tmp116_ = (gchar*) _tmp115_; + _vala_assert (g_strcmp0 (_tmp116_, "new one") == 0, "iterator.get () == \"new one\""); + _g_free0 (_tmp116_); + _tmp117_ = iterator; + _tmp118_ = gee_list_iterator_index (_tmp117_); + _vala_assert (_tmp118_ == 0, "iterator.index () == 0"); + _g_object_unref0 (iterator); + _g_object_unref0 (test_list); +} + + +static void list_tests_real_test_duplicates_are_retained (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + gboolean _tmp2_ = FALSE; + gboolean _tmp3_ = FALSE; + gint _tmp4_; + gint _tmp5_; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gint _tmp8_; + gint _tmp9_; + gboolean _tmp10_ = FALSE; + gboolean _tmp11_ = FALSE; + gint _tmp12_; + gint _tmp13_; + gboolean _tmp14_ = FALSE; + gboolean _tmp15_ = FALSE; + gint _tmp16_; + gint _tmp17_; + gboolean _tmp18_ = FALSE; + gboolean _tmp19_ = FALSE; + gint _tmp20_; + gint _tmp21_; + gboolean _tmp22_ = FALSE; + gboolean _tmp23_ = FALSE; + gint _tmp24_; + gint _tmp25_; + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + _tmp2_ = gee_collection_add ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp2_, "test_list.add (\"one\")"); + _tmp3_ = gee_collection_contains ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp3_, "test_list.contains (\"one\")"); + _tmp4_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 1, "test_list.size == 1"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp6_, "test_list.add (\"one\")"); + _tmp7_ = gee_collection_contains ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp7_, "test_list.contains (\"one\")"); + _tmp8_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp9_ = _tmp8_; + _vala_assert (_tmp9_ == 2, "test_list.size == 2"); + _tmp10_ = gee_collection_add ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp10_, "test_list.add (\"one\")"); + _tmp11_ = gee_collection_contains ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp11_, "test_list.contains (\"one\")"); + _tmp12_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp13_ = _tmp12_; + _vala_assert (_tmp13_ == 3, "test_list.size == 3"); + _tmp14_ = gee_collection_remove ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp14_, "test_list.remove (\"one\")"); + _tmp15_ = gee_collection_contains ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp15_, "test_list.contains (\"one\")"); + _tmp16_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_ == 2, "test_list.size == 2"); + _tmp18_ = gee_collection_remove ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp18_, "test_list.remove (\"one\")"); + _tmp19_ = gee_collection_contains ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp19_, "test_list.contains (\"one\")"); + _tmp20_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp21_ = _tmp20_; + _vala_assert (_tmp21_ == 1, "test_list.size == 1"); + _tmp22_ = gee_collection_remove ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp22_, "test_list.remove (\"one\")"); + _tmp23_ = gee_collection_contains ((GeeCollection*) test_list, "one"); + _vala_assert (!_tmp23_, "!test_list.contains (\"one\")"); + _tmp24_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp25_ = _tmp24_; + _vala_assert (_tmp25_ == 0, "test_list.size == 0"); + _g_object_unref0 (test_list); +} + + +void list_tests_test_duplicates_are_retained (ListTests* self) { + g_return_if_fail (self != NULL); + LIST_TESTS_GET_CLASS (self)->test_duplicates_are_retained (self); +} + + +void list_tests_test_get (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeList* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeList* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeList* _tmp9_; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gboolean _tmp12_ = FALSE; + gboolean _tmp16_ = FALSE; + GeeList* _tmp20_; + gboolean _tmp21_ = FALSE; + GeeList* _tmp22_; + gboolean _tmp23_ = FALSE; + GeeList* _tmp24_; + gpointer _tmp25_ = NULL; + gchar* _tmp26_; + GeeList* _tmp27_; + gpointer _tmp28_ = NULL; + gchar* _tmp29_; + GeeList* _tmp30_; + gpointer _tmp31_ = NULL; + gchar* _tmp32_; + GeeList* _tmp33_; + gboolean _tmp34_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = test_list; + _vala_assert (_tmp2_ != NULL, "test_list != null"); + _tmp3_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp3_) { + GeeList* _tmp4_; + gpointer _tmp5_ = NULL; + gchar* _tmp6_; + _tmp4_ = test_list; + _tmp5_ = gee_list_get (_tmp4_, 0); + _tmp6_ = (gchar*) _tmp5_; + _g_free0 (_tmp6_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp7_ = test_list; + _tmp8_ = gee_collection_add ((GeeCollection*) _tmp7_, "one"); + _vala_assert (_tmp8_, "test_list.add (\"one\")"); + _tmp9_ = test_list; + _tmp10_ = gee_list_get (_tmp9_, 0); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "one") == 0, "test_list.get (0) == \"one\""); + _g_free0 (_tmp11_); + _tmp12_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp12_) { + GeeList* _tmp13_; + gpointer _tmp14_ = NULL; + gchar* _tmp15_; + _tmp13_ = test_list; + _tmp14_ = gee_list_get (_tmp13_, 1); + _tmp15_ = (gchar*) _tmp14_; + _g_free0 (_tmp15_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp16_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp16_) { + GeeList* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + _tmp17_ = test_list; + _tmp18_ = gee_list_get (_tmp17_, -1); + _tmp19_ = (gchar*) _tmp18_; + _g_free0 (_tmp19_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp20_ = test_list; + _tmp21_ = gee_collection_add ((GeeCollection*) _tmp20_, "two"); + _vala_assert (_tmp21_, "test_list.add (\"two\")"); + _tmp22_ = test_list; + _tmp23_ = gee_collection_add ((GeeCollection*) _tmp22_, "three"); + _vala_assert (_tmp23_, "test_list.add (\"three\")"); + _tmp24_ = test_list; + _tmp25_ = gee_list_get (_tmp24_, 0); + _tmp26_ = (gchar*) _tmp25_; + _vala_assert (g_strcmp0 (_tmp26_, "one") == 0, "test_list.get (0) == \"one\""); + _g_free0 (_tmp26_); + _tmp27_ = test_list; + _tmp28_ = gee_list_get (_tmp27_, 1); + _tmp29_ = (gchar*) _tmp28_; + _vala_assert (g_strcmp0 (_tmp29_, "two") == 0, "test_list.get (1) == \"two\""); + _g_free0 (_tmp29_); + _tmp30_ = test_list; + _tmp31_ = gee_list_get (_tmp30_, 2); + _tmp32_ = (gchar*) _tmp31_; + _vala_assert (g_strcmp0 (_tmp32_, "three") == 0, "test_list.get (2) == \"three\""); + _g_free0 (_tmp32_); + _tmp33_ = test_list; + gee_collection_clear ((GeeCollection*) _tmp33_); + _tmp34_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp34_) { + GeeList* _tmp35_; + gpointer _tmp36_ = NULL; + gchar* _tmp37_; + _tmp35_ = test_list; + _tmp36_ = gee_list_get (_tmp35_, 0); + _tmp37_ = (gchar*) _tmp36_; + _g_free0 (_tmp37_); + exit (0); + } + g_test_trap_assert_failed (); + _g_object_unref0 (test_list); +} + + +void list_tests_test_set (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeList* _tmp2_; + GeeList* _tmp3_; + gint _tmp4_; + gint _tmp5_; + gboolean _tmp6_ = FALSE; + GeeList* _tmp8_; + gint _tmp9_; + gint _tmp10_; + GeeList* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeList* _tmp13_; + gint _tmp14_; + gint _tmp15_; + GeeList* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + GeeList* _tmp19_; + GeeList* _tmp20_; + gint _tmp21_; + gint _tmp22_; + GeeList* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + GeeList* _tmp26_; + gint _tmp27_; + gint _tmp28_; + gboolean _tmp29_ = FALSE; + GeeList* _tmp31_; + gint _tmp32_; + gint _tmp33_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = test_list; + _vala_assert (_tmp2_ != NULL, "test_list != null"); + _tmp3_ = test_list; + _tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 0, "test_list.size == 0"); + _tmp6_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp6_) { + GeeList* _tmp7_; + _tmp7_ = test_list; + gee_list_set (_tmp7_, 0, "zero"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp8_ = test_list; + _tmp9_ = gee_collection_get_size ((GeeCollection*) _tmp8_); + _tmp10_ = _tmp9_; + _vala_assert (_tmp10_ == 0, "test_list.size == 0"); + _tmp11_ = test_list; + _tmp12_ = gee_collection_add ((GeeCollection*) _tmp11_, "one"); + _vala_assert (_tmp12_, "test_list.add (\"one\")"); + _tmp13_ = test_list; + _tmp14_ = gee_collection_get_size ((GeeCollection*) _tmp13_); + _tmp15_ = _tmp14_; + _vala_assert (_tmp15_ == 1, "test_list.size == 1"); + _tmp16_ = test_list; + _tmp17_ = gee_list_get (_tmp16_, 0); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "one") == 0, "test_list.get (0) == \"one\""); + _g_free0 (_tmp18_); + _tmp19_ = test_list; + gee_list_set (_tmp19_, 0, "two"); + _tmp20_ = test_list; + _tmp21_ = gee_collection_get_size ((GeeCollection*) _tmp20_); + _tmp22_ = _tmp21_; + _vala_assert (_tmp22_ == 1, "test_list.size == 1"); + _tmp23_ = test_list; + _tmp24_ = gee_list_get (_tmp23_, 0); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "two") == 0, "test_list.get (0) == \"two\""); + _g_free0 (_tmp25_); + _tmp26_ = test_list; + _tmp27_ = gee_collection_get_size ((GeeCollection*) _tmp26_); + _tmp28_ = _tmp27_; + _vala_assert (_tmp28_ == 1, "test_list.size == 1"); + _tmp29_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp29_) { + GeeList* _tmp30_; + _tmp30_ = test_list; + gee_list_set (_tmp30_, 1, "zero"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp31_ = test_list; + _tmp32_ = gee_collection_get_size ((GeeCollection*) _tmp31_); + _tmp33_ = _tmp32_; + _vala_assert (_tmp33_ == 1, "test_list.size == 1"); + _g_object_unref0 (test_list); +} + + +void list_tests_test_insert (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeList* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeList* _tmp5_; + gint _tmp6_; + gint _tmp7_; + GeeList* _tmp8_; + GeeList* _tmp9_; + gint _tmp10_; + gint _tmp11_; + GeeList* _tmp12_; + gpointer _tmp13_ = NULL; + gchar* _tmp14_; + GeeList* _tmp15_; + GeeList* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + GeeList* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + GeeList* _tmp22_; + GeeList* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + GeeList* _tmp26_; + gpointer _tmp27_ = NULL; + gchar* _tmp28_; + GeeList* _tmp29_; + gpointer _tmp30_ = NULL; + gchar* _tmp31_; + gboolean _tmp32_ = FALSE; + GeeList* _tmp34_; + GeeList* _tmp35_; + gpointer _tmp36_ = NULL; + gchar* _tmp37_; + GeeList* _tmp38_; + gpointer _tmp39_ = NULL; + gchar* _tmp40_; + GeeList* _tmp41_; + gpointer _tmp42_ = NULL; + gchar* _tmp43_; + GeeList* _tmp44_; + gpointer _tmp45_ = NULL; + gchar* _tmp46_; + gboolean _tmp47_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = test_list; + _vala_assert (_tmp2_ != NULL, "test_list != null"); + _tmp3_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp3_) { + GeeList* _tmp4_; + _tmp4_ = test_list; + gee_list_insert (_tmp4_, 1, "zero"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp5_ = test_list; + _tmp6_ = gee_collection_get_size ((GeeCollection*) _tmp5_); + _tmp7_ = _tmp6_; + _vala_assert (_tmp7_ == 0, "test_list.size == 0"); + _tmp8_ = test_list; + gee_list_insert (_tmp8_, 0, "one"); + _tmp9_ = test_list; + _tmp10_ = gee_collection_get_size ((GeeCollection*) _tmp9_); + _tmp11_ = _tmp10_; + _vala_assert (_tmp11_ == 1, "test_list.size == 1"); + _tmp12_ = test_list; + _tmp13_ = gee_list_get (_tmp12_, 0); + _tmp14_ = (gchar*) _tmp13_; + _vala_assert (g_strcmp0 (_tmp14_, "one") == 0, "test_list.get (0) == \"one\""); + _g_free0 (_tmp14_); + _tmp15_ = test_list; + gee_list_insert (_tmp15_, 0, "two"); + _tmp16_ = test_list; + _tmp17_ = gee_list_get (_tmp16_, 0); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "two") == 0, "test_list.get (0) == \"two\""); + _g_free0 (_tmp18_); + _tmp19_ = test_list; + _tmp20_ = gee_list_get (_tmp19_, 1); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "one") == 0, "test_list.get (1) == \"one\""); + _g_free0 (_tmp21_); + _tmp22_ = test_list; + gee_list_insert (_tmp22_, 1, "three"); + _tmp23_ = test_list; + _tmp24_ = gee_list_get (_tmp23_, 0); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "two") == 0, "test_list.get (0) == \"two\""); + _g_free0 (_tmp25_); + _tmp26_ = test_list; + _tmp27_ = gee_list_get (_tmp26_, 1); + _tmp28_ = (gchar*) _tmp27_; + _vala_assert (g_strcmp0 (_tmp28_, "three") == 0, "test_list.get (1) == \"three\""); + _g_free0 (_tmp28_); + _tmp29_ = test_list; + _tmp30_ = gee_list_get (_tmp29_, 2); + _tmp31_ = (gchar*) _tmp30_; + _vala_assert (g_strcmp0 (_tmp31_, "one") == 0, "test_list.get (2) == \"one\""); + _g_free0 (_tmp31_); + _tmp32_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp32_) { + GeeList* _tmp33_; + _tmp33_ = test_list; + gee_list_insert (_tmp33_, 4, "four"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp34_ = test_list; + gee_list_insert (_tmp34_, 3, "four"); + _tmp35_ = test_list; + _tmp36_ = gee_list_get (_tmp35_, 0); + _tmp37_ = (gchar*) _tmp36_; + _vala_assert (g_strcmp0 (_tmp37_, "two") == 0, "test_list.get (0) == \"two\""); + _g_free0 (_tmp37_); + _tmp38_ = test_list; + _tmp39_ = gee_list_get (_tmp38_, 1); + _tmp40_ = (gchar*) _tmp39_; + _vala_assert (g_strcmp0 (_tmp40_, "three") == 0, "test_list.get (1) == \"three\""); + _g_free0 (_tmp40_); + _tmp41_ = test_list; + _tmp42_ = gee_list_get (_tmp41_, 2); + _tmp43_ = (gchar*) _tmp42_; + _vala_assert (g_strcmp0 (_tmp43_, "one") == 0, "test_list.get (2) == \"one\""); + _g_free0 (_tmp43_); + _tmp44_ = test_list; + _tmp45_ = gee_list_get (_tmp44_, 3); + _tmp46_ = (gchar*) _tmp45_; + _vala_assert (g_strcmp0 (_tmp46_, "four") == 0, "test_list.get (3) == \"four\""); + _g_free0 (_tmp46_); + _tmp47_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp47_) { + GeeList* _tmp48_; + _tmp48_ = test_list; + gee_list_insert (_tmp48_, -1, "zero"); + exit (0); + } + g_test_trap_assert_failed (); + _g_object_unref0 (test_list); +} + + +void list_tests_test_remove_at (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeList* _tmp2_; + gboolean _tmp3_ = FALSE; + gboolean _tmp7_ = FALSE; + GeeList* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeList* _tmp13_; + gboolean _tmp14_ = FALSE; + GeeList* _tmp15_; + gboolean _tmp16_ = FALSE; + GeeList* _tmp17_; + gboolean _tmp18_ = FALSE; + GeeList* _tmp19_; + gboolean _tmp20_ = FALSE; + GeeList* _tmp21_; + gint _tmp22_; + gint _tmp23_; + GeeList* _tmp24_; + gpointer _tmp25_ = NULL; + gchar* _tmp26_; + GeeList* _tmp27_; + gint _tmp28_; + gint _tmp29_; + GeeList* _tmp30_; + gpointer _tmp31_ = NULL; + gchar* _tmp32_; + GeeList* _tmp33_; + gpointer _tmp34_ = NULL; + gchar* _tmp35_; + GeeList* _tmp36_; + gpointer _tmp37_ = NULL; + gchar* _tmp38_; + GeeList* _tmp39_; + gpointer _tmp40_ = NULL; + gchar* _tmp41_; + GeeList* _tmp42_; + gpointer _tmp43_ = NULL; + gchar* _tmp44_; + GeeList* _tmp45_; + gint _tmp46_; + gint _tmp47_; + GeeList* _tmp48_; + gpointer _tmp49_ = NULL; + gchar* _tmp50_; + GeeList* _tmp51_; + gpointer _tmp52_ = NULL; + gchar* _tmp53_; + GeeList* _tmp54_; + gpointer _tmp55_ = NULL; + gchar* _tmp56_; + GeeList* _tmp57_; + gpointer _tmp58_ = NULL; + gchar* _tmp59_; + GeeList* _tmp60_; + gint _tmp61_; + gint _tmp62_; + GeeList* _tmp63_; + gpointer _tmp64_ = NULL; + gchar* _tmp65_; + GeeList* _tmp66_; + gpointer _tmp67_ = NULL; + gchar* _tmp68_; + gboolean _tmp69_ = FALSE; + gboolean _tmp73_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = test_list; + _vala_assert (_tmp2_ != NULL, "test_list != null"); + _tmp3_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp3_) { + GeeList* _tmp4_; + gpointer _tmp5_ = NULL; + gchar* _tmp6_; + _tmp4_ = test_list; + _tmp5_ = gee_list_remove_at (_tmp4_, 0); + _tmp6_ = (gchar*) _tmp5_; + _g_free0 (_tmp6_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp7_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp7_) { + GeeList* _tmp8_; + gpointer _tmp9_ = NULL; + gchar* _tmp10_; + _tmp8_ = test_list; + _tmp9_ = gee_list_remove_at (_tmp8_, 1); + _tmp10_ = (gchar*) _tmp9_; + _g_free0 (_tmp10_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp11_ = test_list; + _tmp12_ = gee_collection_add ((GeeCollection*) _tmp11_, "one"); + _vala_assert (_tmp12_, "test_list.add (\"one\")"); + _tmp13_ = test_list; + _tmp14_ = gee_collection_add ((GeeCollection*) _tmp13_, "two"); + _vala_assert (_tmp14_, "test_list.add (\"two\")"); + _tmp15_ = test_list; + _tmp16_ = gee_collection_add ((GeeCollection*) _tmp15_, "three"); + _vala_assert (_tmp16_, "test_list.add (\"three\")"); + _tmp17_ = test_list; + _tmp18_ = gee_collection_add ((GeeCollection*) _tmp17_, "four"); + _vala_assert (_tmp18_, "test_list.add (\"four\")"); + _tmp19_ = test_list; + _tmp20_ = gee_collection_add ((GeeCollection*) _tmp19_, "five"); + _vala_assert (_tmp20_, "test_list.add (\"five\")"); + _tmp21_ = test_list; + _tmp22_ = gee_collection_get_size ((GeeCollection*) _tmp21_); + _tmp23_ = _tmp22_; + _vala_assert (_tmp23_ == 5, "test_list.size == 5"); + _tmp24_ = test_list; + _tmp25_ = gee_list_remove_at (_tmp24_, 0); + _tmp26_ = (gchar*) _tmp25_; + _vala_assert (g_strcmp0 (_tmp26_, "one") == 0, "test_list.remove_at (0) == \"one\""); + _g_free0 (_tmp26_); + _tmp27_ = test_list; + _tmp28_ = gee_collection_get_size ((GeeCollection*) _tmp27_); + _tmp29_ = _tmp28_; + _vala_assert (_tmp29_ == 4, "test_list.size == 4"); + _tmp30_ = test_list; + _tmp31_ = gee_list_get (_tmp30_, 0); + _tmp32_ = (gchar*) _tmp31_; + _vala_assert (g_strcmp0 (_tmp32_, "two") == 0, "test_list.get (0) == \"two\""); + _g_free0 (_tmp32_); + _tmp33_ = test_list; + _tmp34_ = gee_list_get (_tmp33_, 1); + _tmp35_ = (gchar*) _tmp34_; + _vala_assert (g_strcmp0 (_tmp35_, "three") == 0, "test_list.get (1) == \"three\""); + _g_free0 (_tmp35_); + _tmp36_ = test_list; + _tmp37_ = gee_list_get (_tmp36_, 2); + _tmp38_ = (gchar*) _tmp37_; + _vala_assert (g_strcmp0 (_tmp38_, "four") == 0, "test_list.get (2) == \"four\""); + _g_free0 (_tmp38_); + _tmp39_ = test_list; + _tmp40_ = gee_list_get (_tmp39_, 3); + _tmp41_ = (gchar*) _tmp40_; + _vala_assert (g_strcmp0 (_tmp41_, "five") == 0, "test_list.get (3) == \"five\""); + _g_free0 (_tmp41_); + _tmp42_ = test_list; + _tmp43_ = gee_list_remove_at (_tmp42_, 3); + _tmp44_ = (gchar*) _tmp43_; + _vala_assert (g_strcmp0 (_tmp44_, "five") == 0, "test_list.remove_at (3) == \"five\""); + _g_free0 (_tmp44_); + _tmp45_ = test_list; + _tmp46_ = gee_collection_get_size ((GeeCollection*) _tmp45_); + _tmp47_ = _tmp46_; + _vala_assert (_tmp47_ == 3, "test_list.size == 3"); + _tmp48_ = test_list; + _tmp49_ = gee_list_get (_tmp48_, 0); + _tmp50_ = (gchar*) _tmp49_; + _vala_assert (g_strcmp0 (_tmp50_, "two") == 0, "test_list.get (0) == \"two\""); + _g_free0 (_tmp50_); + _tmp51_ = test_list; + _tmp52_ = gee_list_get (_tmp51_, 1); + _tmp53_ = (gchar*) _tmp52_; + _vala_assert (g_strcmp0 (_tmp53_, "three") == 0, "test_list.get (1) == \"three\""); + _g_free0 (_tmp53_); + _tmp54_ = test_list; + _tmp55_ = gee_list_get (_tmp54_, 2); + _tmp56_ = (gchar*) _tmp55_; + _vala_assert (g_strcmp0 (_tmp56_, "four") == 0, "test_list.get (2) == \"four\""); + _g_free0 (_tmp56_); + _tmp57_ = test_list; + _tmp58_ = gee_list_remove_at (_tmp57_, 1); + _tmp59_ = (gchar*) _tmp58_; + _vala_assert (g_strcmp0 (_tmp59_, "three") == 0, "test_list.remove_at (1) == \"three\""); + _g_free0 (_tmp59_); + _tmp60_ = test_list; + _tmp61_ = gee_collection_get_size ((GeeCollection*) _tmp60_); + _tmp62_ = _tmp61_; + _vala_assert (_tmp62_ == 2, "test_list.size == 2"); + _tmp63_ = test_list; + _tmp64_ = gee_list_get (_tmp63_, 0); + _tmp65_ = (gchar*) _tmp64_; + _vala_assert (g_strcmp0 (_tmp65_, "two") == 0, "test_list.get (0) == \"two\""); + _g_free0 (_tmp65_); + _tmp66_ = test_list; + _tmp67_ = gee_list_get (_tmp66_, 1); + _tmp68_ = (gchar*) _tmp67_; + _vala_assert (g_strcmp0 (_tmp68_, "four") == 0, "test_list.get (1) == \"four\""); + _g_free0 (_tmp68_); + _tmp69_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp69_) { + GeeList* _tmp70_; + gpointer _tmp71_ = NULL; + gchar* _tmp72_; + _tmp70_ = test_list; + _tmp71_ = gee_list_remove_at (_tmp70_, 2); + _tmp72_ = (gchar*) _tmp71_; + _g_free0 (_tmp72_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp73_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp73_) { + GeeList* _tmp74_; + gpointer _tmp75_ = NULL; + gchar* _tmp76_; + _tmp74_ = test_list; + _tmp75_ = gee_list_remove_at (_tmp74_, -1); + _tmp76_ = (gchar*) _tmp75_; + _g_free0 (_tmp76_); + exit (0); + } + g_test_trap_assert_failed (); + _g_object_unref0 (test_list); +} + + +void list_tests_test_index_of (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + gint _tmp2_ = 0; + gboolean _tmp3_ = FALSE; + gint _tmp4_ = 0; + gint _tmp5_ = 0; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gboolean _tmp8_ = FALSE; + gint _tmp9_ = 0; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + gint _tmp12_ = 0; + gint _tmp13_ = 0; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + _tmp2_ = gee_list_index_of (test_list, "one"); + _vala_assert (_tmp2_ == (-1), "test_list.index_of (\"one\") == -1"); + _tmp3_ = gee_collection_add ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp3_, "test_list.add (\"one\")"); + _tmp4_ = gee_list_index_of (test_list, "one"); + _vala_assert (_tmp4_ == 0, "test_list.index_of (\"one\") == 0"); + _tmp5_ = gee_list_index_of (test_list, "two"); + _vala_assert (_tmp5_ == (-1), "test_list.index_of (\"two\") == -1"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_list, "two"); + _vala_assert (_tmp6_, "test_list.add (\"two\")"); + _tmp7_ = gee_collection_add ((GeeCollection*) test_list, "three"); + _vala_assert (_tmp7_, "test_list.add (\"three\")"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_list, "four"); + _vala_assert (_tmp8_, "test_list.add (\"four\")"); + _tmp9_ = gee_list_index_of (test_list, "one"); + _vala_assert (_tmp9_ == 0, "test_list.index_of (\"one\") == 0"); + _tmp10_ = gee_list_index_of (test_list, "two"); + _vala_assert (_tmp10_ == 1, "test_list.index_of (\"two\") == 1"); + _tmp11_ = gee_list_index_of (test_list, "three"); + _vala_assert (_tmp11_ == 2, "test_list.index_of (\"three\") == 2"); + _tmp12_ = gee_list_index_of (test_list, "four"); + _vala_assert (_tmp12_ == 3, "test_list.index_of (\"four\") == 3"); + _tmp13_ = gee_list_index_of (test_list, "five"); + _vala_assert (_tmp13_ == (-1), "test_list.index_of (\"five\") == -1"); + _g_object_unref0 (test_list); +} + + +void list_tests_test_first (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeList* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeList* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeList* _tmp9_; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + GeeList* _tmp12_; + gpointer _tmp13_ = NULL; + gchar* _tmp14_; + GeeList* _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + GeeList* _tmp18_; + gboolean _tmp19_ = FALSE; + GeeList* _tmp20_; + gboolean _tmp21_ = FALSE; + GeeList* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + GeeList* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + GeeList* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + GeeList* _tmp31_; + gboolean _tmp32_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = test_list; + _vala_assert (_tmp2_ != NULL, "test_list != null"); + _tmp3_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp3_) { + GeeList* _tmp4_; + gpointer _tmp5_ = NULL; + gchar* _tmp6_; + _tmp4_ = test_list; + _tmp5_ = gee_list_first (_tmp4_); + _tmp6_ = (gchar*) _tmp5_; + _g_free0 (_tmp6_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp7_ = test_list; + _tmp8_ = gee_collection_add ((GeeCollection*) _tmp7_, "one"); + _vala_assert (_tmp8_, "test_list.add (\"one\")"); + _tmp9_ = test_list; + _tmp10_ = gee_list_first (_tmp9_); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "one") == 0, "test_list.first () == \"one\""); + _g_free0 (_tmp11_); + _tmp12_ = test_list; + _tmp13_ = gee_list_first (_tmp12_); + _tmp14_ = (gchar*) _tmp13_; + _tmp15_ = test_list; + _tmp16_ = gee_list_get (_tmp15_, 0); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (g_strcmp0 (_tmp14_, _tmp17_) == 0, "test_list.first () == test_list.get (0)"); + _g_free0 (_tmp17_); + _g_free0 (_tmp14_); + _tmp18_ = test_list; + _tmp19_ = gee_collection_add ((GeeCollection*) _tmp18_, "two"); + _vala_assert (_tmp19_, "test_list.add (\"two\")"); + _tmp20_ = test_list; + _tmp21_ = gee_collection_add ((GeeCollection*) _tmp20_, "three"); + _vala_assert (_tmp21_, "test_list.add (\"three\")"); + _tmp22_ = test_list; + _tmp23_ = gee_list_first (_tmp22_); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "one") == 0, "test_list.first () == \"one\""); + _g_free0 (_tmp24_); + _tmp25_ = test_list; + _tmp26_ = gee_list_first (_tmp25_); + _tmp27_ = (gchar*) _tmp26_; + _tmp28_ = test_list; + _tmp29_ = gee_list_get (_tmp28_, 0); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp27_, _tmp30_) == 0, "test_list.first () == test_list.get (0)"); + _g_free0 (_tmp30_); + _g_free0 (_tmp27_); + _tmp31_ = test_list; + gee_collection_clear ((GeeCollection*) _tmp31_); + _tmp32_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp32_) { + GeeList* _tmp33_; + gpointer _tmp34_ = NULL; + gchar* _tmp35_; + _tmp33_ = test_list; + _tmp34_ = gee_list_first (_tmp33_); + _tmp35_ = (gchar*) _tmp34_; + _g_free0 (_tmp35_); + exit (0); + } + g_test_trap_assert_failed (); + _g_object_unref0 (test_list); +} + + +void list_tests_test_last (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeList* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeList* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeList* _tmp9_; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + GeeList* _tmp12_; + gpointer _tmp13_ = NULL; + gchar* _tmp14_; + GeeList* _tmp15_; + GeeList* _tmp16_; + gint _tmp17_; + gint _tmp18_; + gpointer _tmp19_ = NULL; + gchar* _tmp20_; + GeeList* _tmp21_; + gboolean _tmp22_ = FALSE; + GeeList* _tmp23_; + gboolean _tmp24_ = FALSE; + GeeList* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + GeeList* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + GeeList* _tmp31_; + GeeList* _tmp32_; + gint _tmp33_; + gint _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + GeeList* _tmp37_; + gboolean _tmp38_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = test_list; + _vala_assert (_tmp2_ != NULL, "test_list != null"); + _tmp3_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp3_) { + GeeList* _tmp4_; + gpointer _tmp5_ = NULL; + gchar* _tmp6_; + _tmp4_ = test_list; + _tmp5_ = gee_list_last (_tmp4_); + _tmp6_ = (gchar*) _tmp5_; + _g_free0 (_tmp6_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp7_ = test_list; + _tmp8_ = gee_collection_add ((GeeCollection*) _tmp7_, "one"); + _vala_assert (_tmp8_, "test_list.add (\"one\")"); + _tmp9_ = test_list; + _tmp10_ = gee_list_last (_tmp9_); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "one") == 0, "test_list.last () == \"one\""); + _g_free0 (_tmp11_); + _tmp12_ = test_list; + _tmp13_ = gee_list_last (_tmp12_); + _tmp14_ = (gchar*) _tmp13_; + _tmp15_ = test_list; + _tmp16_ = test_list; + _tmp17_ = gee_collection_get_size ((GeeCollection*) _tmp16_); + _tmp18_ = _tmp17_; + _tmp19_ = gee_list_get (_tmp15_, _tmp18_ - 1); + _tmp20_ = (gchar*) _tmp19_; + _vala_assert (g_strcmp0 (_tmp14_, _tmp20_) == 0, "test_list.last () == test_list.get (test_list.size - 1)"); + _g_free0 (_tmp20_); + _g_free0 (_tmp14_); + _tmp21_ = test_list; + _tmp22_ = gee_collection_add ((GeeCollection*) _tmp21_, "two"); + _vala_assert (_tmp22_, "test_list.add (\"two\")"); + _tmp23_ = test_list; + _tmp24_ = gee_collection_add ((GeeCollection*) _tmp23_, "three"); + _vala_assert (_tmp24_, "test_list.add (\"three\")"); + _tmp25_ = test_list; + _tmp26_ = gee_list_last (_tmp25_); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "three") == 0, "test_list.last () == \"three\""); + _g_free0 (_tmp27_); + _tmp28_ = test_list; + _tmp29_ = gee_list_last (_tmp28_); + _tmp30_ = (gchar*) _tmp29_; + _tmp31_ = test_list; + _tmp32_ = test_list; + _tmp33_ = gee_collection_get_size ((GeeCollection*) _tmp32_); + _tmp34_ = _tmp33_; + _tmp35_ = gee_list_get (_tmp31_, _tmp34_ - 1); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp30_, _tmp36_) == 0, "test_list.last () == test_list.get (test_list.size - 1)"); + _g_free0 (_tmp36_); + _g_free0 (_tmp30_); + _tmp37_ = test_list; + gee_collection_clear ((GeeCollection*) _tmp37_); + _tmp38_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp38_) { + GeeList* _tmp39_; + gpointer _tmp40_ = NULL; + gchar* _tmp41_; + _tmp39_ = test_list; + _tmp40_ = gee_list_last (_tmp39_); + _tmp41_ = (gchar*) _tmp40_; + _g_free0 (_tmp41_); + exit (0); + } + g_test_trap_assert_failed (); + _g_object_unref0 (test_list); +} + + +void list_tests_test_insert_all (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeList* _tmp2_; + GeeArrayList* _tmp3_; + GeeArrayList* dummy; + GeeList* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeList* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeList* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeList* _tmp10_; + gint _tmp11_; + gint _tmp12_; + GeeArrayList* _tmp13_; + gboolean _tmp14_; + gboolean _tmp15_; + GeeList* _tmp16_; + GeeArrayList* _tmp17_; + GeeList* _tmp18_; + gint _tmp19_; + gint _tmp20_; + GeeArrayList* _tmp21_; + gboolean _tmp22_; + gboolean _tmp23_; + GeeList* _tmp24_; + GeeArrayList* _tmp25_; + GeeArrayList* _tmp26_; + gboolean _tmp27_ = FALSE; + GeeArrayList* _tmp28_; + gboolean _tmp29_ = FALSE; + GeeArrayList* _tmp30_; + gboolean _tmp31_ = FALSE; + GeeList* _tmp32_; + gboolean _tmp33_; + gboolean _tmp34_; + GeeArrayList* _tmp35_; + gint _tmp36_; + gint _tmp37_; + GeeList* _tmp38_; + GeeArrayList* _tmp39_; + GeeList* _tmp40_; + gint _tmp41_; + gint _tmp42_; + GeeArrayList* _tmp43_; + gint _tmp44_; + gint _tmp45_; + GeeList* _tmp46_; + GeeArrayList* _tmp47_; + GeeArrayList* _tmp48_; + gboolean _tmp49_ = FALSE; + GeeArrayList* _tmp50_; + gboolean _tmp51_ = FALSE; + GeeArrayList* _tmp52_; + gboolean _tmp53_ = FALSE; + GeeList* _tmp54_; + gboolean _tmp55_; + gboolean _tmp56_; + gboolean _tmp57_ = FALSE; + GeeList* _tmp60_; + GeeArrayList* _tmp61_; + GeeList* _tmp62_; + gboolean _tmp63_ = FALSE; + GeeList* _tmp64_; + gboolean _tmp65_ = FALSE; + GeeList* _tmp66_; + gboolean _tmp67_ = FALSE; + GeeArrayList* _tmp68_; + gboolean _tmp69_ = FALSE; + GeeArrayList* _tmp70_; + gboolean _tmp71_ = FALSE; + GeeArrayList* _tmp72_; + gboolean _tmp73_ = FALSE; + GeeList* _tmp74_; + gint _tmp75_; + gint _tmp76_; + GeeArrayList* _tmp77_; + gint _tmp78_; + gint _tmp79_; + GeeList* _tmp80_; + GeeArrayList* _tmp81_; + GeeList* _tmp82_; + gint _tmp83_; + gint _tmp84_; + GeeArrayList* _tmp85_; + gint _tmp86_; + gint _tmp87_; + GeeList* _tmp88_; + gpointer _tmp89_ = NULL; + gchar* _tmp90_; + GeeList* _tmp91_; + gpointer _tmp92_ = NULL; + gchar* _tmp93_; + GeeList* _tmp94_; + gpointer _tmp95_ = NULL; + gchar* _tmp96_; + GeeList* _tmp97_; + gpointer _tmp98_ = NULL; + gchar* _tmp99_; + GeeList* _tmp100_; + gpointer _tmp101_ = NULL; + gchar* _tmp102_; + GeeList* _tmp103_; + gpointer _tmp104_ = NULL; + gchar* _tmp105_; + GeeList* _tmp106_; + GeeArrayList* _tmp107_; + GeeList* _tmp108_; + gboolean _tmp109_ = FALSE; + GeeList* _tmp110_; + gboolean _tmp111_ = FALSE; + GeeList* _tmp112_; + gboolean _tmp113_ = FALSE; + GeeList* _tmp114_; + gboolean _tmp115_ = FALSE; + GeeArrayList* _tmp116_; + gboolean _tmp117_ = FALSE; + GeeArrayList* _tmp118_; + gboolean _tmp119_ = FALSE; + GeeArrayList* _tmp120_; + gboolean _tmp121_ = FALSE; + GeeList* _tmp122_; + gint _tmp123_; + gint _tmp124_; + GeeArrayList* _tmp125_; + gint _tmp126_; + gint _tmp127_; + GeeList* _tmp128_; + GeeArrayList* _tmp129_; + GeeList* _tmp130_; + gint _tmp131_; + gint _tmp132_; + GeeArrayList* _tmp133_; + gint _tmp134_; + gint _tmp135_; + GeeList* _tmp136_; + gpointer _tmp137_ = NULL; + gchar* _tmp138_; + GeeList* _tmp139_; + gpointer _tmp140_ = NULL; + gchar* _tmp141_; + GeeList* _tmp142_; + gpointer _tmp143_ = NULL; + gchar* _tmp144_; + GeeList* _tmp145_; + gpointer _tmp146_ = NULL; + gchar* _tmp147_; + GeeList* _tmp148_; + gpointer _tmp149_ = NULL; + gchar* _tmp150_; + GeeList* _tmp151_; + gpointer _tmp152_ = NULL; + gchar* _tmp153_; + GeeList* _tmp154_; + gpointer _tmp155_ = NULL; + gchar* _tmp156_; + GeeList* _tmp157_; + GeeArrayList* _tmp158_; + GeeList* _tmp159_; + gboolean _tmp160_ = FALSE; + GeeList* _tmp161_; + gboolean _tmp162_ = FALSE; + GeeList* _tmp163_; + gboolean _tmp164_ = FALSE; + GeeArrayList* _tmp165_; + gboolean _tmp166_ = FALSE; + GeeArrayList* _tmp167_; + gboolean _tmp168_ = FALSE; + GeeArrayList* _tmp169_; + gboolean _tmp170_ = FALSE; + GeeList* _tmp171_; + gint _tmp172_; + gint _tmp173_; + GeeArrayList* _tmp174_; + gint _tmp175_; + gint _tmp176_; + GeeList* _tmp177_; + GeeArrayList* _tmp178_; + GeeList* _tmp179_; + gint _tmp180_; + gint _tmp181_; + GeeArrayList* _tmp182_; + gint _tmp183_; + gint _tmp184_; + GeeList* _tmp185_; + gpointer _tmp186_ = NULL; + gchar* _tmp187_; + GeeList* _tmp188_; + gpointer _tmp189_ = NULL; + gchar* _tmp190_; + GeeList* _tmp191_; + gpointer _tmp192_ = NULL; + gchar* _tmp193_; + GeeList* _tmp194_; + gpointer _tmp195_ = NULL; + gchar* _tmp196_; + GeeList* _tmp197_; + gpointer _tmp198_ = NULL; + gchar* _tmp199_; + GeeList* _tmp200_; + gpointer _tmp201_ = NULL; + gchar* _tmp202_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = test_list; + _vala_assert (_tmp2_ != NULL, "test_list != null"); + _tmp3_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = _tmp3_; + _tmp4_ = test_list; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "zero"); + _vala_assert (_tmp5_, "test_list.add (\"zero\")"); + _tmp6_ = test_list; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "one"); + _vala_assert (_tmp7_, "test_list.add (\"one\")"); + _tmp8_ = test_list; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "two"); + _vala_assert (_tmp9_, "test_list.add (\"two\")"); + _tmp10_ = test_list; + _tmp11_ = gee_collection_get_size ((GeeCollection*) _tmp10_); + _tmp12_ = _tmp11_; + _vala_assert (_tmp12_ == 3, "test_list.size == 3"); + _tmp13_ = dummy; + _tmp14_ = gee_abstract_collection_get_is_empty ((GeeAbstractCollection*) _tmp13_); + _tmp15_ = _tmp14_; + _vala_assert (_tmp15_, "dummy.is_empty"); + _tmp16_ = test_list; + _tmp17_ = dummy; + gee_list_insert_all (_tmp16_, 0, (GeeCollection*) _tmp17_); + _tmp18_ = test_list; + _tmp19_ = gee_collection_get_size ((GeeCollection*) _tmp18_); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 3, "test_list.size == 3"); + _tmp21_ = dummy; + _tmp22_ = gee_abstract_collection_get_is_empty ((GeeAbstractCollection*) _tmp21_); + _tmp23_ = _tmp22_; + _vala_assert (_tmp23_, "dummy.is_empty"); + _tmp24_ = test_list; + gee_collection_clear ((GeeCollection*) _tmp24_); + _tmp25_ = dummy; + gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp25_); + _tmp26_ = dummy; + _tmp27_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp26_, "zero"); + _vala_assert (_tmp27_, "dummy.add (\"zero\")"); + _tmp28_ = dummy; + _tmp29_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp28_, "one"); + _vala_assert (_tmp29_, "dummy.add (\"one\")"); + _tmp30_ = dummy; + _tmp31_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp30_, "two"); + _vala_assert (_tmp31_, "dummy.add (\"two\")"); + _tmp32_ = test_list; + _tmp33_ = gee_collection_get_is_empty ((GeeCollection*) _tmp32_); + _tmp34_ = _tmp33_; + _vala_assert (_tmp34_, "test_list.is_empty"); + _tmp35_ = dummy; + _tmp36_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp35_); + _tmp37_ = _tmp36_; + _vala_assert (_tmp37_ == 3, "dummy.size == 3"); + _tmp38_ = test_list; + _tmp39_ = dummy; + gee_list_insert_all (_tmp38_, 0, (GeeCollection*) _tmp39_); + _tmp40_ = test_list; + _tmp41_ = gee_collection_get_size ((GeeCollection*) _tmp40_); + _tmp42_ = _tmp41_; + _vala_assert (_tmp42_ == 3, "test_list.size == 3"); + _tmp43_ = dummy; + _tmp44_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp43_); + _tmp45_ = _tmp44_; + _vala_assert (_tmp45_ == 3, "dummy.size == 3"); + _tmp46_ = test_list; + gee_collection_clear ((GeeCollection*) _tmp46_); + _tmp47_ = dummy; + gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp47_); + _tmp48_ = dummy; + _tmp49_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp48_, "zero"); + _vala_assert (_tmp49_, "dummy.add (\"zero\")"); + _tmp50_ = dummy; + _tmp51_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp50_, "one"); + _vala_assert (_tmp51_, "dummy.add (\"one\")"); + _tmp52_ = dummy; + _tmp53_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp52_, "two"); + _vala_assert (_tmp53_, "dummy.add (\"two\")"); + _tmp54_ = test_list; + _tmp55_ = gee_collection_get_is_empty ((GeeCollection*) _tmp54_); + _tmp56_ = _tmp55_; + _vala_assert (_tmp56_, "test_list.is_empty"); + _tmp57_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp57_) { + GeeList* _tmp58_; + GeeArrayList* _tmp59_; + _tmp58_ = test_list; + _tmp59_ = dummy; + gee_list_insert_all (_tmp58_, 1, (GeeCollection*) _tmp59_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp60_ = test_list; + gee_collection_clear ((GeeCollection*) _tmp60_); + _tmp61_ = dummy; + gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp61_); + _tmp62_ = test_list; + _tmp63_ = gee_collection_add ((GeeCollection*) _tmp62_, "three"); + _vala_assert (_tmp63_, "test_list.add (\"three\")"); + _tmp64_ = test_list; + _tmp65_ = gee_collection_add ((GeeCollection*) _tmp64_, "four"); + _vala_assert (_tmp65_, "test_list.add (\"four\")"); + _tmp66_ = test_list; + _tmp67_ = gee_collection_add ((GeeCollection*) _tmp66_, "five"); + _vala_assert (_tmp67_, "test_list.add (\"five\")"); + _tmp68_ = dummy; + _tmp69_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp68_, "zero"); + _vala_assert (_tmp69_, "dummy.add (\"zero\")"); + _tmp70_ = dummy; + _tmp71_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp70_, "one"); + _vala_assert (_tmp71_, "dummy.add (\"one\")"); + _tmp72_ = dummy; + _tmp73_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp72_, "two"); + _vala_assert (_tmp73_, "dummy.add (\"two\")"); + _tmp74_ = test_list; + _tmp75_ = gee_collection_get_size ((GeeCollection*) _tmp74_); + _tmp76_ = _tmp75_; + _vala_assert (_tmp76_ == 3, "test_list.size == 3"); + _tmp77_ = dummy; + _tmp78_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp77_); + _tmp79_ = _tmp78_; + _vala_assert (_tmp79_ == 3, "dummy.size == 3"); + _tmp80_ = test_list; + _tmp81_ = dummy; + gee_list_insert_all (_tmp80_, 0, (GeeCollection*) _tmp81_); + _tmp82_ = test_list; + _tmp83_ = gee_collection_get_size ((GeeCollection*) _tmp82_); + _tmp84_ = _tmp83_; + _vala_assert (_tmp84_ == 6, "test_list.size == 6"); + _tmp85_ = dummy; + _tmp86_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp85_); + _tmp87_ = _tmp86_; + _vala_assert (_tmp87_ == 3, "dummy.size == 3"); + _tmp88_ = test_list; + _tmp89_ = gee_list_get (_tmp88_, 0); + _tmp90_ = (gchar*) _tmp89_; + _vala_assert (g_strcmp0 (_tmp90_, "zero") == 0, "test_list.get (0) == \"zero\""); + _g_free0 (_tmp90_); + _tmp91_ = test_list; + _tmp92_ = gee_list_get (_tmp91_, 1); + _tmp93_ = (gchar*) _tmp92_; + _vala_assert (g_strcmp0 (_tmp93_, "one") == 0, "test_list.get (1) == \"one\""); + _g_free0 (_tmp93_); + _tmp94_ = test_list; + _tmp95_ = gee_list_get (_tmp94_, 2); + _tmp96_ = (gchar*) _tmp95_; + _vala_assert (g_strcmp0 (_tmp96_, "two") == 0, "test_list.get (2) == \"two\""); + _g_free0 (_tmp96_); + _tmp97_ = test_list; + _tmp98_ = gee_list_get (_tmp97_, 3); + _tmp99_ = (gchar*) _tmp98_; + _vala_assert (g_strcmp0 (_tmp99_, "three") == 0, "test_list.get (3) == \"three\""); + _g_free0 (_tmp99_); + _tmp100_ = test_list; + _tmp101_ = gee_list_get (_tmp100_, 4); + _tmp102_ = (gchar*) _tmp101_; + _vala_assert (g_strcmp0 (_tmp102_, "four") == 0, "test_list.get (4) == \"four\""); + _g_free0 (_tmp102_); + _tmp103_ = test_list; + _tmp104_ = gee_list_get (_tmp103_, 5); + _tmp105_ = (gchar*) _tmp104_; + _vala_assert (g_strcmp0 (_tmp105_, "five") == 0, "test_list.get (5) == \"five\""); + _g_free0 (_tmp105_); + _tmp106_ = test_list; + gee_collection_clear ((GeeCollection*) _tmp106_); + _tmp107_ = dummy; + gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp107_); + _tmp108_ = test_list; + _tmp109_ = gee_collection_add ((GeeCollection*) _tmp108_, "zero"); + _vala_assert (_tmp109_, "test_list.add (\"zero\")"); + _tmp110_ = test_list; + _tmp111_ = gee_collection_add ((GeeCollection*) _tmp110_, "one"); + _vala_assert (_tmp111_, "test_list.add (\"one\")"); + _tmp112_ = test_list; + _tmp113_ = gee_collection_add ((GeeCollection*) _tmp112_, "five"); + _vala_assert (_tmp113_, "test_list.add (\"five\")"); + _tmp114_ = test_list; + _tmp115_ = gee_collection_add ((GeeCollection*) _tmp114_, "six"); + _vala_assert (_tmp115_, "test_list.add (\"six\")"); + _tmp116_ = dummy; + _tmp117_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp116_, "two"); + _vala_assert (_tmp117_, "dummy.add (\"two\")"); + _tmp118_ = dummy; + _tmp119_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp118_, "three"); + _vala_assert (_tmp119_, "dummy.add (\"three\")"); + _tmp120_ = dummy; + _tmp121_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp120_, "four"); + _vala_assert (_tmp121_, "dummy.add (\"four\")"); + _tmp122_ = test_list; + _tmp123_ = gee_collection_get_size ((GeeCollection*) _tmp122_); + _tmp124_ = _tmp123_; + _vala_assert (_tmp124_ == 4, "test_list.size == 4"); + _tmp125_ = dummy; + _tmp126_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp125_); + _tmp127_ = _tmp126_; + _vala_assert (_tmp127_ == 3, "dummy.size == 3"); + _tmp128_ = test_list; + _tmp129_ = dummy; + gee_list_insert_all (_tmp128_, 2, (GeeCollection*) _tmp129_); + _tmp130_ = test_list; + _tmp131_ = gee_collection_get_size ((GeeCollection*) _tmp130_); + _tmp132_ = _tmp131_; + _vala_assert (_tmp132_ == 7, "test_list.size == 7"); + _tmp133_ = dummy; + _tmp134_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp133_); + _tmp135_ = _tmp134_; + _vala_assert (_tmp135_ == 3, "dummy.size == 3"); + _tmp136_ = test_list; + _tmp137_ = gee_list_get (_tmp136_, 0); + _tmp138_ = (gchar*) _tmp137_; + _vala_assert (g_strcmp0 (_tmp138_, "zero") == 0, "test_list.get (0) == \"zero\""); + _g_free0 (_tmp138_); + _tmp139_ = test_list; + _tmp140_ = gee_list_get (_tmp139_, 1); + _tmp141_ = (gchar*) _tmp140_; + _vala_assert (g_strcmp0 (_tmp141_, "one") == 0, "test_list.get (1) == \"one\""); + _g_free0 (_tmp141_); + _tmp142_ = test_list; + _tmp143_ = gee_list_get (_tmp142_, 2); + _tmp144_ = (gchar*) _tmp143_; + _vala_assert (g_strcmp0 (_tmp144_, "two") == 0, "test_list.get (2) == \"two\""); + _g_free0 (_tmp144_); + _tmp145_ = test_list; + _tmp146_ = gee_list_get (_tmp145_, 3); + _tmp147_ = (gchar*) _tmp146_; + _vala_assert (g_strcmp0 (_tmp147_, "three") == 0, "test_list.get (3) == \"three\""); + _g_free0 (_tmp147_); + _tmp148_ = test_list; + _tmp149_ = gee_list_get (_tmp148_, 4); + _tmp150_ = (gchar*) _tmp149_; + _vala_assert (g_strcmp0 (_tmp150_, "four") == 0, "test_list.get (4) == \"four\""); + _g_free0 (_tmp150_); + _tmp151_ = test_list; + _tmp152_ = gee_list_get (_tmp151_, 5); + _tmp153_ = (gchar*) _tmp152_; + _vala_assert (g_strcmp0 (_tmp153_, "five") == 0, "test_list.get (5) == \"five\""); + _g_free0 (_tmp153_); + _tmp154_ = test_list; + _tmp155_ = gee_list_get (_tmp154_, 6); + _tmp156_ = (gchar*) _tmp155_; + _vala_assert (g_strcmp0 (_tmp156_, "six") == 0, "test_list.get (6) == \"six\""); + _g_free0 (_tmp156_); + _tmp157_ = test_list; + gee_collection_clear ((GeeCollection*) _tmp157_); + _tmp158_ = dummy; + gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp158_); + _tmp159_ = test_list; + _tmp160_ = gee_collection_add ((GeeCollection*) _tmp159_, "zero"); + _vala_assert (_tmp160_, "test_list.add (\"zero\")"); + _tmp161_ = test_list; + _tmp162_ = gee_collection_add ((GeeCollection*) _tmp161_, "one"); + _vala_assert (_tmp162_, "test_list.add (\"one\")"); + _tmp163_ = test_list; + _tmp164_ = gee_collection_add ((GeeCollection*) _tmp163_, "two"); + _vala_assert (_tmp164_, "test_list.add (\"two\")"); + _tmp165_ = dummy; + _tmp166_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp165_, "three"); + _vala_assert (_tmp166_, "dummy.add (\"three\")"); + _tmp167_ = dummy; + _tmp168_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp167_, "four"); + _vala_assert (_tmp168_, "dummy.add (\"four\")"); + _tmp169_ = dummy; + _tmp170_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp169_, "five"); + _vala_assert (_tmp170_, "dummy.add (\"five\")"); + _tmp171_ = test_list; + _tmp172_ = gee_collection_get_size ((GeeCollection*) _tmp171_); + _tmp173_ = _tmp172_; + _vala_assert (_tmp173_ == 3, "test_list.size == 3"); + _tmp174_ = dummy; + _tmp175_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp174_); + _tmp176_ = _tmp175_; + _vala_assert (_tmp176_ == 3, "dummy.size == 3"); + _tmp177_ = test_list; + _tmp178_ = dummy; + gee_list_insert_all (_tmp177_, 3, (GeeCollection*) _tmp178_); + _tmp179_ = test_list; + _tmp180_ = gee_collection_get_size ((GeeCollection*) _tmp179_); + _tmp181_ = _tmp180_; + _vala_assert (_tmp181_ == 6, "test_list.size == 6"); + _tmp182_ = dummy; + _tmp183_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp182_); + _tmp184_ = _tmp183_; + _vala_assert (_tmp184_ == 3, "dummy.size == 3"); + _tmp185_ = test_list; + _tmp186_ = gee_list_get (_tmp185_, 0); + _tmp187_ = (gchar*) _tmp186_; + _vala_assert (g_strcmp0 (_tmp187_, "zero") == 0, "test_list.get (0) == \"zero\""); + _g_free0 (_tmp187_); + _tmp188_ = test_list; + _tmp189_ = gee_list_get (_tmp188_, 1); + _tmp190_ = (gchar*) _tmp189_; + _vala_assert (g_strcmp0 (_tmp190_, "one") == 0, "test_list.get (1) == \"one\""); + _g_free0 (_tmp190_); + _tmp191_ = test_list; + _tmp192_ = gee_list_get (_tmp191_, 2); + _tmp193_ = (gchar*) _tmp192_; + _vala_assert (g_strcmp0 (_tmp193_, "two") == 0, "test_list.get (2) == \"two\""); + _g_free0 (_tmp193_); + _tmp194_ = test_list; + _tmp195_ = gee_list_get (_tmp194_, 3); + _tmp196_ = (gchar*) _tmp195_; + _vala_assert (g_strcmp0 (_tmp196_, "three") == 0, "test_list.get (3) == \"three\""); + _g_free0 (_tmp196_); + _tmp197_ = test_list; + _tmp198_ = gee_list_get (_tmp197_, 4); + _tmp199_ = (gchar*) _tmp198_; + _vala_assert (g_strcmp0 (_tmp199_, "four") == 0, "test_list.get (4) == \"four\""); + _g_free0 (_tmp199_); + _tmp200_ = test_list; + _tmp201_ = gee_list_get (_tmp200_, 5); + _tmp202_ = (gchar*) _tmp201_; + _vala_assert (g_strcmp0 (_tmp202_, "five") == 0, "test_list.get (5) == \"five\""); + _g_free0 (_tmp202_); + _g_object_unref0 (dummy); + _g_object_unref0 (test_list); +} + + +void list_tests_test_slice (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeList* _tmp2_; + GeeList* dummy = NULL; + gboolean _tmp3_ = FALSE; + GeeList* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeList* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeList* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeList* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeList* _tmp14_; + gboolean _tmp15_ = FALSE; + GeeList* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeList* _tmp18_; + gint _tmp19_; + gint _tmp20_; + GeeList* _tmp21_; + GeeList* _tmp22_ = NULL; + GeeList* _tmp23_; + gint _tmp24_; + gint _tmp25_; + GeeList* _tmp26_; + gint _tmp27_; + gint _tmp28_; + GeeList* _tmp29_; + gpointer _tmp30_ = NULL; + gchar* _tmp31_; + GeeList* _tmp32_; + gpointer _tmp33_ = NULL; + gchar* _tmp34_; + GeeList* _tmp35_; + gpointer _tmp36_ = NULL; + gchar* _tmp37_; + gboolean _tmp38_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = test_list; + _vala_assert (_tmp2_ != NULL, "test_list != null"); + _tmp3_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp3_) { + GeeList* _tmp4_; + GeeList* _tmp5_ = NULL; + _tmp4_ = test_list; + _tmp5_ = gee_list_slice (_tmp4_, 1, 4); + _g_object_unref0 (dummy); + dummy = _tmp5_; + exit (0); + } + g_test_trap_assert_failed (); + _tmp6_ = test_list; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "zero"); + _vala_assert (_tmp7_, "test_list.add (\"zero\")"); + _tmp8_ = test_list; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "one"); + _vala_assert (_tmp9_, "test_list.add (\"one\")"); + _tmp10_ = test_list; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "two"); + _vala_assert (_tmp11_, "test_list.add (\"two\")"); + _tmp12_ = test_list; + _tmp13_ = gee_collection_add ((GeeCollection*) _tmp12_, "three"); + _vala_assert (_tmp13_, "test_list.add (\"three\")"); + _tmp14_ = test_list; + _tmp15_ = gee_collection_add ((GeeCollection*) _tmp14_, "four"); + _vala_assert (_tmp15_, "test_list.add (\"four\")"); + _tmp16_ = test_list; + _tmp17_ = gee_collection_add ((GeeCollection*) _tmp16_, "five"); + _vala_assert (_tmp17_, "test_list.add (\"five\")"); + _tmp18_ = test_list; + _tmp19_ = gee_collection_get_size ((GeeCollection*) _tmp18_); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 6, "test_list.size == 6"); + _tmp21_ = test_list; + _tmp22_ = gee_list_slice (_tmp21_, 1, 4); + _g_object_unref0 (dummy); + dummy = _tmp22_; + _tmp23_ = dummy; + _tmp24_ = gee_collection_get_size ((GeeCollection*) _tmp23_); + _tmp25_ = _tmp24_; + _vala_assert (_tmp25_ == 3, "dummy.size == 3"); + _tmp26_ = test_list; + _tmp27_ = gee_collection_get_size ((GeeCollection*) _tmp26_); + _tmp28_ = _tmp27_; + _vala_assert (_tmp28_ == 6, "test_list.size == 6"); + _tmp29_ = dummy; + _tmp30_ = gee_list_get (_tmp29_, 0); + _tmp31_ = (gchar*) _tmp30_; + _vala_assert (g_strcmp0 (_tmp31_, "one") == 0, "dummy.get (0) == \"one\""); + _g_free0 (_tmp31_); + _tmp32_ = dummy; + _tmp33_ = gee_list_get (_tmp32_, 1); + _tmp34_ = (gchar*) _tmp33_; + _vala_assert (g_strcmp0 (_tmp34_, "two") == 0, "dummy.get (1) == \"two\""); + _g_free0 (_tmp34_); + _tmp35_ = dummy; + _tmp36_ = gee_list_get (_tmp35_, 2); + _tmp37_ = (gchar*) _tmp36_; + _vala_assert (g_strcmp0 (_tmp37_, "three") == 0, "dummy.get (2) == \"three\""); + _g_free0 (_tmp37_); + _tmp38_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp38_) { + GeeList* _tmp39_; + GeeList* _tmp40_ = NULL; + _tmp39_ = test_list; + _tmp40_ = gee_list_slice (_tmp39_, 0, 9); + _g_object_unref0 (dummy); + dummy = _tmp40_; + exit (0); + } + g_test_trap_assert_failed (); + _g_object_unref0 (dummy); + _g_object_unref0 (test_list); +} + + +static void list_tests_class_init (ListTestsClass * klass) { + list_tests_parent_class = g_type_class_peek_parent (klass); + LIST_TESTS_CLASS (klass)->test_duplicates_are_retained = list_tests_real_test_duplicates_are_retained; +} + + +static void list_tests_instance_init (ListTests * self) { +} + + +GType list_tests_get_type (void) { + static volatile gsize list_tests_type_id__volatile = 0; + if (g_once_init_enter (&list_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (ListTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) list_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ListTests), 0, (GInstanceInitFunc) list_tests_instance_init, NULL }; + GType list_tests_type_id; + list_tests_type_id = g_type_register_static (TYPE_COLLECTION_TESTS, "ListTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&list_tests_type_id__volatile, list_tests_type_id); + } + return list_tests_type_id__volatile; +} + + + diff --git a/tests/testlist.vala b/tests/testlist.vala new file mode 100644 index 0000000..48ca387 --- /dev/null +++ b/tests/testlist.vala @@ -0,0 +1,667 @@ +/* testlist.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes' Villevalois + * Julien Peeters + */ + +using GLib; +using Gee; + +public abstract class ListTests : CollectionTests { + + public ListTests (string name) { + base (name); + add_test ("[List] iterator is ordered", test_iterator_is_ordered); + add_test ("[List] list iterator", test_list_iterator); + add_test ("[List] duplicates are retained", + test_duplicates_are_retained); + add_test ("[List] get", test_get); + add_test ("[List] set", test_set); + add_test ("[List] insert", test_insert); + add_test ("[List] remove_at", test_remove_at); + add_test ("[List] index_of", test_index_of); + add_test ("[List] first", test_first); + add_test ("[List] last", test_last); + add_test ("[List] insert_all", test_insert_all); + add_test ("[List] slice", test_slice); + } + + public void test_iterator_is_ordered () { + var test_list = test_collection as Gee.List; + + // Check the test list is not null + assert (test_list != null); + + // Check iterate empty list + var iterator = test_list.iterator (); + assert (! iterator.next ()); + + // Check iterate list + assert (test_list.add ("one")); + assert (test_list.add ("two")); + assert (test_list.add ("three")); + assert (test_list.add ("one")); + + iterator = test_list.iterator (); + assert (iterator.next()); + assert (iterator.get () == "one"); + assert (iterator.next()); + assert (iterator.get () == "two"); + assert (iterator.next()); + assert (iterator.get () == "three"); + assert (iterator.next()); + assert (iterator.get () == "one"); + assert (! iterator.next ()); + } + + public void test_list_iterator () { + var test_list = test_collection as Gee.List; + + // Check the test list is not null + assert (test_list != null); + + // Check iterate empty list + var iterator = test_list.list_iterator (); + assert (! iterator.has_next ()); + assert (! iterator.next ()); + assert (! iterator.has_previous ()); + assert (! iterator.previous ()); + assert (! iterator.first ()); + assert (! iterator.last ()); + + // Check iterate list + assert (test_list.add ("one")); + assert (test_list.add ("two")); + assert (test_list.add ("three")); + + iterator = test_list.list_iterator (); + assert (iterator.next()); + assert (iterator.get () == "one"); + assert (iterator.index () == 0); + iterator.set ("new one"); + assert (iterator.next()); + assert (iterator.get () == "two"); + assert (iterator.index () == 1); + iterator.set ("new two"); + assert (test_list.size == 3); + assert (iterator.index () == 1); + iterator.insert ("before two"); + assert (test_list.size == 4); + assert (iterator.index () == 2); + iterator.add ("after two"); + assert (test_list.size == 5); + assert (iterator.index () == 3); + assert (iterator.next()); + assert (iterator.get () == "three"); + assert (iterator.index () == 4); + iterator.set ("new three"); + assert (! iterator.has_next ()); + assert (! iterator.next ()); + + assert (iterator.first ()); + assert (iterator.get () == "new one"); + assert (iterator.index () == 0); + assert (! iterator.has_previous ()); + assert (! iterator.previous ()); + + assert (iterator.last ()); + assert (iterator.get () == "new three"); + assert (iterator.index () == 4); + assert (! iterator.has_next ()); + assert (! iterator.next ()); + + assert (iterator.has_previous ()); + assert (iterator.previous ()); + assert (iterator.get () == "after two"); + assert (iterator.index () == 3); + assert (iterator.has_previous ()); + assert (iterator.previous ()); + assert (iterator.get () == "new two"); + assert (iterator.index () == 2); + assert (iterator.has_previous ()); + assert (iterator.previous ()); + assert (iterator.get () == "before two"); + assert (iterator.index () == 1); + assert (iterator.has_previous ()); + assert (iterator.previous ()); + assert (iterator.get () == "new one"); + assert (iterator.index () == 0); + } + + public virtual void test_duplicates_are_retained () { + var test_list = test_collection as Gee.List; + + // Check the test list is not null + assert (test_list != null); + + assert (test_list.add ("one")); + assert (test_list.contains ("one")); + assert (test_list.size == 1); + + assert (test_list.add ("one")); + assert (test_list.contains ("one")); + assert (test_list.size == 2); + + assert (test_list.add ("one")); + assert (test_list.contains ("one")); + assert (test_list.size == 3); + + assert (test_list.remove ("one")); + assert (test_list.contains ("one")); + assert (test_list.size == 2); + + assert (test_list.remove ("one")); + assert (test_list.contains ("one")); + assert (test_list.size == 1); + + assert (test_list.remove ("one")); + assert (!test_list.contains ("one")); + assert (test_list.size == 0); + } + + public void test_get () { + var test_list = test_collection as Gee.List; + + // Check the test list is not null + assert (test_list != null); + + // Check get for empty list + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.get (0); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Check get for valid index in list with one element + assert (test_list.add ("one")); + assert (test_list.get (0) == "one"); + + // Check get for indexes out of range + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.get (1); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Check get for invalid index number + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.get (-1); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Check get for valid indexes in list with multiple element + assert (test_list.add ("two")); + assert (test_list.add ("three")); + assert (test_list.get (0) == "one"); + assert (test_list.get (1) == "two"); + assert (test_list.get (2) == "three"); + + // Check get if list is cleared and empty again + test_list.clear (); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.get (0); + Posix.exit (0); + } + Test.trap_assert_failed (); + } + + public void test_set () { + var test_list = test_collection as Gee.List; + + // Check the test list is not null + assert (test_list != null); + + // Check set when list is empty + assert (test_list.size == 0); + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.set (0, "zero"); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (test_list.size == 0); + + // Check set when one item is in list + assert (test_list.add ("one")); // Add item "one" + assert (test_list.size == 1); + assert (test_list.get (0) == "one"); + + test_list.set (0, "two"); // Set the item to value 2 + assert (test_list.size == 1); + assert (test_list.get (0) == "two"); + + // Check set when index out of range + assert (test_list.size == 1); + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.set (1, "zero"); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (test_list.size == 1); + } + + public void test_insert () { + var test_list = test_collection as Gee.List; + + // Check the test list is not null + assert (test_list != null); + + // Check inserting in empty list + // Inserting at index 1 + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.insert (1, "zero"); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Inserting at index 0 + assert (test_list.size == 0); + test_list.insert (0, "one"); + assert (test_list.size == 1); + assert (test_list.get (0) == "one"); + + // Check insert to the beginning + test_list.insert (0, "two"); + assert (test_list.get (0) == "two"); + assert (test_list.get (1) == "one"); + + // Check insert in between + test_list.insert (1, "three"); + assert (test_list.get (0) == "two"); + assert (test_list.get (1) == "three"); + assert (test_list.get (2) == "one"); + + // Check insert into index out of current range + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.insert (4, "four"); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Check insert to the end + test_list.insert (3, "four"); + assert (test_list.get (0) == "two"); + assert (test_list.get (1) == "three"); + assert (test_list.get (2) == "one"); + assert (test_list.get (3) == "four"); + + // Check insert into invalid index + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.insert (-1, "zero"); + Posix.exit (0); + } + Test.trap_assert_failed (); + } + + public void test_remove_at () { + var test_list = test_collection as Gee.List; + + // Check the test list is not null + assert (test_list != null); + + // Check removing in empty list + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.remove_at (0); + Posix.exit (0); + } + Test.trap_assert_failed (); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.remove_at (1); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // add 5 items + assert (test_list.add ("one")); + assert (test_list.add ("two")); + assert (test_list.add ("three")); + assert (test_list.add ("four")); + assert (test_list.add ("five")); + assert (test_list.size == 5); + + // Check remove_at first + assert (test_list.remove_at (0) == "one"); + assert (test_list.size == 4); + assert (test_list.get (0) == "two"); + assert (test_list.get (1) == "three"); + assert (test_list.get (2) == "four"); + assert (test_list.get (3) == "five"); + + // Check remove_at last + assert (test_list.remove_at (3) == "five"); + assert (test_list.size == 3); + assert (test_list.get (0) == "two"); + assert (test_list.get (1) == "three"); + assert (test_list.get (2) == "four"); + + // Check remove_at in between + assert (test_list.remove_at (1) == "three"); + assert (test_list.size == 2); + assert (test_list.get (0) == "two"); + assert (test_list.get (1) == "four"); + + // Check remove_at when index out of range + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.remove_at (2); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Check remove_at when invalid index + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.remove_at (-1); + Posix.exit (0); + } + Test.trap_assert_failed (); + } + + public void test_index_of () { + var test_list = test_collection as Gee.List; + + // Check the test list is not null + assert (test_list != null); + + // Check empty list + assert (test_list.index_of ("one") == -1); + + // Check one item + assert (test_list.add ("one")); + assert (test_list.index_of ("one") == 0); + assert (test_list.index_of ("two") == -1); + + // Check more items + assert (test_list.add ("two")); + assert (test_list.add ("three")); + assert (test_list.add ("four")); + assert (test_list.index_of ("one") == 0); + assert (test_list.index_of ("two") == 1); + assert (test_list.index_of ("three") == 2); + assert (test_list.index_of ("four") == 3); + assert (test_list.index_of ("five") == -1); + } + + public void test_first () { + var test_list = test_collection as Gee.List; + + // Check the test list is not null + assert (test_list != null); + + // Check first for empty list + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.first (); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Check first for list with one element + assert (test_list.add ("one")); + assert (test_list.first () == "one"); + assert (test_list.first () == test_list.get (0)); + + // Check first for for list with multiple element + assert (test_list.add ("two")); + assert (test_list.add ("three")); + assert (test_list.first () == "one"); + assert (test_list.first () == test_list.get (0)); + + // Check first if list is cleared and empty again + test_list.clear (); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.first (); + Posix.exit (0); + } + Test.trap_assert_failed (); + } + + public void test_last () { + var test_list = test_collection as Gee.List; + + // Check the test list is not null + assert (test_list != null); + + // Check last for empty list + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.last (); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Check last for list with one element + assert (test_list.add ("one")); + assert (test_list.last () == "one"); + assert (test_list.last () == test_list.get (test_list.size - 1)); + + // Check last for for list with multiple element + assert (test_list.add ("two")); + assert (test_list.add ("three")); + assert (test_list.last () == "three"); + assert (test_list.last () == test_list.get (test_list.size - 1)); + + // Check last if list is cleared and empty again + test_list.clear (); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.last (); + Posix.exit (0); + } + Test.trap_assert_failed (); + } + + public void test_insert_all () { + var test_list = test_collection as Gee.List; + + // Check the test list is not null + assert (test_list != null); + + var dummy = new ArrayList (); + + // Insert an empty list + assert (test_list.add ("zero")); + assert (test_list.add ("one")); + assert (test_list.add ("two")); + + assert (test_list.size == 3); + assert (dummy.is_empty); + + test_list.insert_all (0, dummy); + + assert (test_list.size == 3); + assert (dummy.is_empty); + + test_list.clear (); + dummy.clear (); + + // Insert into an empty list at index 0 + assert (dummy.add ("zero")); + assert (dummy.add ("one")); + assert (dummy.add ("two")); + + assert (test_list.is_empty); + assert (dummy.size == 3); + + test_list.insert_all (0, dummy); + + assert (test_list.size == 3); + assert (dummy.size == 3); + + test_list.clear (); + dummy.clear (); + + // Insert all into empty list as index 1 + assert (dummy.add ("zero")); + assert (dummy.add ("one")); + assert (dummy.add ("two")); + + assert (test_list.is_empty); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.insert_all (1, dummy); + Posix.exit (0); + } + Test.trap_assert_failed (); + + test_list.clear (); + dummy.clear (); + + // Insert all in the beginnig + assert (test_list.add ("three")); + assert (test_list.add ("four")); + assert (test_list.add ("five")); + + assert (dummy.add ("zero")); + assert (dummy.add ("one")); + assert (dummy.add ("two")); + + assert (test_list.size == 3); + assert (dummy.size == 3); + + test_list.insert_all (0, dummy); + + assert (test_list.size == 6); + assert (dummy.size == 3); + + assert (test_list.get (0) == "zero"); + assert (test_list.get (1) == "one"); + assert (test_list.get (2) == "two"); + assert (test_list.get (3) == "three"); + assert (test_list.get (4) == "four"); + assert (test_list.get (5) == "five"); + + test_list.clear (); + dummy.clear (); + + // Insert all in the middle + assert (test_list.add ("zero")); + assert (test_list.add ("one")); + assert (test_list.add ("five")); + assert (test_list.add ("six")); + + assert (dummy.add ("two")); + assert (dummy.add ("three")); + assert (dummy.add ("four")); + + assert (test_list.size == 4); + assert (dummy.size == 3); + + test_list.insert_all (2, dummy); + + assert (test_list.size == 7); + assert (dummy.size == 3); + + assert (test_list.get (0) == "zero"); + assert (test_list.get (1) == "one"); + assert (test_list.get (2) == "two"); + assert (test_list.get (3) == "three"); + assert (test_list.get (4) == "four"); + assert (test_list.get (5) == "five"); + assert (test_list.get (6) == "six"); + + test_list.clear (); + dummy.clear (); + + // Insert all in at the end + assert (test_list.add ("zero")); + assert (test_list.add ("one")); + assert (test_list.add ("two")); + + assert (dummy.add ("three")); + assert (dummy.add ("four")); + assert (dummy.add ("five")); + + assert (test_list.size == 3); + assert (dummy.size == 3); + + test_list.insert_all (3, dummy); + + assert (test_list.size == 6); + assert (dummy.size == 3); + + assert (test_list.get (0) == "zero"); + assert (test_list.get (1) == "one"); + assert (test_list.get (2) == "two"); + assert (test_list.get (3) == "three"); + assert (test_list.get (4) == "four"); + assert (test_list.get (5) == "five"); + } + + public void test_slice () { + var test_list = test_collection as Gee.List; + + // Check the test list is not null + assert (test_list != null); + Gee.List dummy; + + // Check first for empty list + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + dummy = test_list.slice (1, 4); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Check for list with some items + assert (test_list.add ("zero")); + assert (test_list.add ("one")); + assert (test_list.add ("two")); + assert (test_list.add ("three")); + assert (test_list.add ("four")); + assert (test_list.add ("five")); + assert (test_list.size == 6); + + dummy = test_list.slice (1, 4); + assert (dummy.size == 3); + assert (test_list.size == 6); + + assert (dummy.get (0) == "one"); + assert (dummy.get (1) == "two"); + assert (dummy.get (2) == "three"); + + // Check for invalid indices + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + dummy = test_list.slice (0, 9); + Posix.exit (0); + } + Test.trap_assert_failed (); + } +} diff --git a/tests/testmain.c b/tests/testmain.c new file mode 100644 index 0000000..2b62033 --- /dev/null +++ b/tests/testmain.c @@ -0,0 +1,554 @@ +/* testmain.c generated by valac 0.18.0, the Vala compiler + * generated from testmain.vala, do not modify */ + +/* testmain.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + */ + +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; + +#define TYPE_LIST_TESTS (list_tests_get_type ()) +#define LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LIST_TESTS, ListTests)) +#define LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LIST_TESTS, ListTestsClass)) +#define IS_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LIST_TESTS)) +#define IS_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LIST_TESTS)) +#define LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LIST_TESTS, ListTestsClass)) + +typedef struct _ListTests ListTests; +typedef struct _ListTestsClass ListTestsClass; + +#define TYPE_ARRAY_LIST_TESTS (array_list_tests_get_type ()) +#define ARRAY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ARRAY_LIST_TESTS, ArrayListTests)) +#define ARRAY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ARRAY_LIST_TESTS, ArrayListTestsClass)) +#define IS_ARRAY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ARRAY_LIST_TESTS)) +#define IS_ARRAY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ARRAY_LIST_TESTS)) +#define ARRAY_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ARRAY_LIST_TESTS, ArrayListTestsClass)) + +typedef struct _ArrayListTests ArrayListTests; +typedef struct _ArrayListTestsClass ArrayListTestsClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define TYPE_COMPARABLE_TESTS (comparable_tests_get_type ()) +#define COMPARABLE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COMPARABLE_TESTS, ComparableTests)) +#define COMPARABLE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COMPARABLE_TESTS, ComparableTestsClass)) +#define IS_COMPARABLE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COMPARABLE_TESTS)) +#define IS_COMPARABLE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COMPARABLE_TESTS)) +#define COMPARABLE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COMPARABLE_TESTS, ComparableTestsClass)) + +typedef struct _ComparableTests ComparableTests; +typedef struct _ComparableTestsClass ComparableTestsClass; + +#define TYPE_MAP_TESTS (map_tests_get_type ()) +#define MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAP_TESTS, MapTests)) +#define MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAP_TESTS, MapTestsClass)) +#define IS_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAP_TESTS)) +#define IS_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAP_TESTS)) +#define MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAP_TESTS, MapTestsClass)) + +typedef struct _MapTests MapTests; +typedef struct _MapTestsClass MapTestsClass; + +#define TYPE_HASH_MAP_TESTS (hash_map_tests_get_type ()) +#define HASH_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_MAP_TESTS, HashMapTests)) +#define HASH_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_MAP_TESTS, HashMapTestsClass)) +#define IS_HASH_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_MAP_TESTS)) +#define IS_HASH_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_MAP_TESTS)) +#define HASH_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_MAP_TESTS, HashMapTestsClass)) + +typedef struct _HashMapTests HashMapTests; +typedef struct _HashMapTestsClass HashMapTestsClass; + +#define TYPE_MULTI_MAP_TESTS (multi_map_tests_get_type ()) +#define MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTests)) +#define MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass)) +#define IS_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_MAP_TESTS)) +#define IS_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_MAP_TESTS)) +#define MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass)) + +typedef struct _MultiMapTests MultiMapTests; +typedef struct _MultiMapTestsClass MultiMapTestsClass; + +#define TYPE_HASH_MULTI_MAP_TESTS (hash_multi_map_tests_get_type ()) +#define HASH_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_MULTI_MAP_TESTS, HashMultiMapTests)) +#define HASH_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_MULTI_MAP_TESTS, HashMultiMapTestsClass)) +#define IS_HASH_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_MULTI_MAP_TESTS)) +#define IS_HASH_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_MULTI_MAP_TESTS)) +#define HASH_MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_MULTI_MAP_TESTS, HashMultiMapTestsClass)) + +typedef struct _HashMultiMapTests HashMultiMapTests; +typedef struct _HashMultiMapTestsClass HashMultiMapTestsClass; + +#define TYPE_MULTI_SET_TESTS (multi_set_tests_get_type ()) +#define MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_SET_TESTS, MultiSetTests)) +#define MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_SET_TESTS, MultiSetTestsClass)) +#define IS_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_SET_TESTS)) +#define IS_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_SET_TESTS)) +#define MULTI_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_SET_TESTS, MultiSetTestsClass)) + +typedef struct _MultiSetTests MultiSetTests; +typedef struct _MultiSetTestsClass MultiSetTestsClass; + +#define TYPE_HASH_MULTI_SET_TESTS (hash_multi_set_tests_get_type ()) +#define HASH_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_MULTI_SET_TESTS, HashMultiSetTests)) +#define HASH_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_MULTI_SET_TESTS, HashMultiSetTestsClass)) +#define IS_HASH_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_MULTI_SET_TESTS)) +#define IS_HASH_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_MULTI_SET_TESTS)) +#define HASH_MULTI_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_MULTI_SET_TESTS, HashMultiSetTestsClass)) + +typedef struct _HashMultiSetTests HashMultiSetTests; +typedef struct _HashMultiSetTestsClass HashMultiSetTestsClass; + +#define TYPE_SET_TESTS (set_tests_get_type ()) +#define SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SET_TESTS, SetTests)) +#define SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SET_TESTS, SetTestsClass)) +#define IS_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SET_TESTS)) +#define IS_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SET_TESTS)) +#define SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SET_TESTS, SetTestsClass)) + +typedef struct _SetTests SetTests; +typedef struct _SetTestsClass SetTestsClass; + +#define TYPE_HASH_SET_TESTS (hash_set_tests_get_type ()) +#define HASH_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_SET_TESTS, HashSetTests)) +#define HASH_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_SET_TESTS, HashSetTestsClass)) +#define IS_HASH_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_SET_TESTS)) +#define IS_HASH_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_SET_TESTS)) +#define HASH_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_SET_TESTS, HashSetTestsClass)) + +typedef struct _HashSetTests HashSetTests; +typedef struct _HashSetTestsClass HashSetTestsClass; + +#define TYPE_LINKED_LIST_TESTS (linked_list_tests_get_type ()) +#define LINKED_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LINKED_LIST_TESTS, LinkedListTests)) +#define LINKED_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LINKED_LIST_TESTS, LinkedListTestsClass)) +#define IS_LINKED_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LINKED_LIST_TESTS)) +#define IS_LINKED_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LINKED_LIST_TESTS)) +#define LINKED_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LINKED_LIST_TESTS, LinkedListTestsClass)) + +typedef struct _LinkedListTests LinkedListTests; +typedef struct _LinkedListTestsClass LinkedListTestsClass; + +#define TYPE_QUEUE_TESTS (queue_tests_get_type ()) +#define QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_QUEUE_TESTS, QueueTests)) +#define QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_QUEUE_TESTS, QueueTestsClass)) +#define IS_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_QUEUE_TESTS)) +#define IS_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_QUEUE_TESTS)) +#define QUEUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_QUEUE_TESTS, QueueTestsClass)) + +typedef struct _QueueTests QueueTests; +typedef struct _QueueTestsClass QueueTestsClass; + +#define TYPE_DEQUE_TESTS (deque_tests_get_type ()) +#define DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DEQUE_TESTS, DequeTests)) +#define DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DEQUE_TESTS, DequeTestsClass)) +#define IS_DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DEQUE_TESTS)) +#define IS_DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DEQUE_TESTS)) +#define DEQUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DEQUE_TESTS, DequeTestsClass)) + +typedef struct _DequeTests DequeTests; +typedef struct _DequeTestsClass DequeTestsClass; + +#define TYPE_LINKED_LIST_AS_DEQUE_TESTS (linked_list_as_deque_tests_get_type ()) +#define LINKED_LIST_AS_DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LINKED_LIST_AS_DEQUE_TESTS, LinkedListAsDequeTests)) +#define LINKED_LIST_AS_DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LINKED_LIST_AS_DEQUE_TESTS, LinkedListAsDequeTestsClass)) +#define IS_LINKED_LIST_AS_DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LINKED_LIST_AS_DEQUE_TESTS)) +#define IS_LINKED_LIST_AS_DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LINKED_LIST_AS_DEQUE_TESTS)) +#define LINKED_LIST_AS_DEQUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LINKED_LIST_AS_DEQUE_TESTS, LinkedListAsDequeTestsClass)) + +typedef struct _LinkedListAsDequeTests LinkedListAsDequeTests; +typedef struct _LinkedListAsDequeTestsClass LinkedListAsDequeTestsClass; + +#define TYPE_PRIORITY_QUEUE_TESTS (priority_queue_tests_get_type ()) +#define PRIORITY_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PRIORITY_QUEUE_TESTS, PriorityQueueTests)) +#define PRIORITY_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PRIORITY_QUEUE_TESTS, PriorityQueueTestsClass)) +#define IS_PRIORITY_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PRIORITY_QUEUE_TESTS)) +#define IS_PRIORITY_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PRIORITY_QUEUE_TESTS)) +#define PRIORITY_QUEUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PRIORITY_QUEUE_TESTS, PriorityQueueTestsClass)) + +typedef struct _PriorityQueueTests PriorityQueueTests; +typedef struct _PriorityQueueTestsClass PriorityQueueTestsClass; + +#define TYPE_READ_ONLY_COLLECTION_TESTS (read_only_collection_tests_get_type ()) +#define READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTests)) +#define READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass)) +#define IS_READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_COLLECTION_TESTS)) +#define IS_READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_COLLECTION_TESTS)) +#define READ_ONLY_COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass)) + +typedef struct _ReadOnlyCollectionTests ReadOnlyCollectionTests; +typedef struct _ReadOnlyCollectionTestsClass ReadOnlyCollectionTestsClass; + +#define TYPE_READ_ONLY_LIST_TESTS (read_only_list_tests_get_type ()) +#define READ_ONLY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_LIST_TESTS, ReadOnlyListTests)) +#define READ_ONLY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_LIST_TESTS, ReadOnlyListTestsClass)) +#define IS_READ_ONLY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_LIST_TESTS)) +#define IS_READ_ONLY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_LIST_TESTS)) +#define READ_ONLY_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_LIST_TESTS, ReadOnlyListTestsClass)) + +typedef struct _ReadOnlyListTests ReadOnlyListTests; +typedef struct _ReadOnlyListTestsClass ReadOnlyListTestsClass; + +#define TYPE_READ_ONLY_MAP_TESTS (read_only_map_tests_get_type ()) +#define READ_ONLY_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_MAP_TESTS, ReadOnlyMapTests)) +#define READ_ONLY_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_MAP_TESTS, ReadOnlyMapTestsClass)) +#define IS_READ_ONLY_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_MAP_TESTS)) +#define IS_READ_ONLY_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_MAP_TESTS)) +#define READ_ONLY_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_MAP_TESTS, ReadOnlyMapTestsClass)) + +typedef struct _ReadOnlyMapTests ReadOnlyMapTests; +typedef struct _ReadOnlyMapTestsClass ReadOnlyMapTestsClass; + +#define TYPE_READ_ONLY_SET_TESTS (read_only_set_tests_get_type ()) +#define READ_ONLY_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_SET_TESTS, ReadOnlySetTests)) +#define READ_ONLY_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_SET_TESTS, ReadOnlySetTestsClass)) +#define IS_READ_ONLY_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_SET_TESTS)) +#define IS_READ_ONLY_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_SET_TESTS)) +#define READ_ONLY_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_SET_TESTS, ReadOnlySetTestsClass)) + +typedef struct _ReadOnlySetTests ReadOnlySetTests; +typedef struct _ReadOnlySetTestsClass ReadOnlySetTestsClass; + +#define TYPE_TREE_MAP_TESTS (tree_map_tests_get_type ()) +#define TREE_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TREE_MAP_TESTS, TreeMapTests)) +#define TREE_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TREE_MAP_TESTS, TreeMapTestsClass)) +#define IS_TREE_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TREE_MAP_TESTS)) +#define IS_TREE_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TREE_MAP_TESTS)) +#define TREE_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TREE_MAP_TESTS, TreeMapTestsClass)) + +typedef struct _TreeMapTests TreeMapTests; +typedef struct _TreeMapTestsClass TreeMapTestsClass; + +#define TYPE_TREE_MULTI_MAP_TESTS (tree_multi_map_tests_get_type ()) +#define TREE_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TREE_MULTI_MAP_TESTS, TreeMultiMapTests)) +#define TREE_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TREE_MULTI_MAP_TESTS, TreeMultiMapTestsClass)) +#define IS_TREE_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TREE_MULTI_MAP_TESTS)) +#define IS_TREE_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TREE_MULTI_MAP_TESTS)) +#define TREE_MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TREE_MULTI_MAP_TESTS, TreeMultiMapTestsClass)) + +typedef struct _TreeMultiMapTests TreeMultiMapTests; +typedef struct _TreeMultiMapTestsClass TreeMultiMapTestsClass; + +#define TYPE_TREE_MULTI_SET_TESTS (tree_multi_set_tests_get_type ()) +#define TREE_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TREE_MULTI_SET_TESTS, TreeMultiSetTests)) +#define TREE_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TREE_MULTI_SET_TESTS, TreeMultiSetTestsClass)) +#define IS_TREE_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TREE_MULTI_SET_TESTS)) +#define IS_TREE_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TREE_MULTI_SET_TESTS)) +#define TREE_MULTI_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TREE_MULTI_SET_TESTS, TreeMultiSetTestsClass)) + +typedef struct _TreeMultiSetTests TreeMultiSetTests; +typedef struct _TreeMultiSetTestsClass TreeMultiSetTestsClass; + +#define TYPE_SORTED_SET_TESTS (sorted_set_tests_get_type ()) +#define SORTED_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SORTED_SET_TESTS, SortedSetTests)) +#define SORTED_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SORTED_SET_TESTS, SortedSetTestsClass)) +#define IS_SORTED_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SORTED_SET_TESTS)) +#define IS_SORTED_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SORTED_SET_TESTS)) +#define SORTED_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SORTED_SET_TESTS, SortedSetTestsClass)) + +typedef struct _SortedSetTests SortedSetTests; +typedef struct _SortedSetTestsClass SortedSetTestsClass; + +#define TYPE_TREE_SET_TESTS (tree_set_tests_get_type ()) +#define TREE_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TREE_SET_TESTS, TreeSetTests)) +#define TREE_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TREE_SET_TESTS, TreeSetTestsClass)) +#define IS_TREE_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TREE_SET_TESTS)) +#define IS_TREE_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TREE_SET_TESTS)) +#define TREE_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TREE_SET_TESTS, TreeSetTestsClass)) + +typedef struct _TreeSetTests TreeSetTests; +typedef struct _TreeSetTestsClass TreeSetTestsClass; + + + +void _vala_main (gchar** args, int args_length1); +ArrayListTests* array_list_tests_new (void); +ArrayListTests* array_list_tests_construct (GType object_type); +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType list_tests_get_type (void) G_GNUC_CONST; +GType array_list_tests_get_type (void) G_GNUC_CONST; +GTestSuite* gee_test_case_get_suite (GeeTestCase* self); +ComparableTests* comparable_tests_new (void); +ComparableTests* comparable_tests_construct (GType object_type); +GType comparable_tests_get_type (void) G_GNUC_CONST; +HashMapTests* hash_map_tests_new (void); +HashMapTests* hash_map_tests_construct (GType object_type); +GType map_tests_get_type (void) G_GNUC_CONST; +GType hash_map_tests_get_type (void) G_GNUC_CONST; +HashMultiMapTests* hash_multi_map_tests_new (void); +HashMultiMapTests* hash_multi_map_tests_construct (GType object_type); +GType multi_map_tests_get_type (void) G_GNUC_CONST; +GType hash_multi_map_tests_get_type (void) G_GNUC_CONST; +HashMultiSetTests* hash_multi_set_tests_new (void); +HashMultiSetTests* hash_multi_set_tests_construct (GType object_type); +GType multi_set_tests_get_type (void) G_GNUC_CONST; +GType hash_multi_set_tests_get_type (void) G_GNUC_CONST; +HashSetTests* hash_set_tests_new (void); +HashSetTests* hash_set_tests_construct (GType object_type); +GType set_tests_get_type (void) G_GNUC_CONST; +GType hash_set_tests_get_type (void) G_GNUC_CONST; +LinkedListTests* linked_list_tests_new (void); +LinkedListTests* linked_list_tests_construct (GType object_type); +GType linked_list_tests_get_type (void) G_GNUC_CONST; +LinkedListAsDequeTests* linked_list_as_deque_tests_new (void); +LinkedListAsDequeTests* linked_list_as_deque_tests_construct (GType object_type); +GType queue_tests_get_type (void) G_GNUC_CONST; +GType deque_tests_get_type (void) G_GNUC_CONST; +GType linked_list_as_deque_tests_get_type (void) G_GNUC_CONST; +PriorityQueueTests* priority_queue_tests_new (void); +PriorityQueueTests* priority_queue_tests_construct (GType object_type); +GType priority_queue_tests_get_type (void) G_GNUC_CONST; +ReadOnlyCollectionTests* read_only_collection_tests_new (void); +ReadOnlyCollectionTests* read_only_collection_tests_construct (GType object_type); +GType read_only_collection_tests_get_type (void) G_GNUC_CONST; +ReadOnlyListTests* read_only_list_tests_new (void); +ReadOnlyListTests* read_only_list_tests_construct (GType object_type); +GType read_only_list_tests_get_type (void) G_GNUC_CONST; +ReadOnlyMapTests* read_only_map_tests_new (void); +ReadOnlyMapTests* read_only_map_tests_construct (GType object_type); +GType read_only_map_tests_get_type (void) G_GNUC_CONST; +ReadOnlySetTests* read_only_set_tests_new (void); +ReadOnlySetTests* read_only_set_tests_construct (GType object_type); +GType read_only_set_tests_get_type (void) G_GNUC_CONST; +TreeMapTests* tree_map_tests_new (void); +TreeMapTests* tree_map_tests_construct (GType object_type); +GType tree_map_tests_get_type (void) G_GNUC_CONST; +TreeMultiMapTests* tree_multi_map_tests_new (void); +TreeMultiMapTests* tree_multi_map_tests_construct (GType object_type); +GType tree_multi_map_tests_get_type (void) G_GNUC_CONST; +TreeMultiSetTests* tree_multi_set_tests_new (void); +TreeMultiSetTests* tree_multi_set_tests_construct (GType object_type); +GType tree_multi_set_tests_get_type (void) G_GNUC_CONST; +TreeSetTests* tree_set_tests_new (void); +TreeSetTests* tree_set_tests_construct (GType object_type); +GType sorted_set_tests_get_type (void) G_GNUC_CONST; +GType tree_set_tests_get_type (void) G_GNUC_CONST; + + +void _vala_main (gchar** args, int args_length1) { + GTestSuite* _tmp0_ = NULL; + ArrayListTests* _tmp1_; + ArrayListTests* _tmp2_; + GTestSuite* _tmp3_ = NULL; + GTestSuite* _tmp4_ = NULL; + ComparableTests* _tmp5_; + ComparableTests* _tmp6_; + GTestSuite* _tmp7_ = NULL; + GTestSuite* _tmp8_ = NULL; + HashMapTests* _tmp9_; + HashMapTests* _tmp10_; + GTestSuite* _tmp11_ = NULL; + GTestSuite* _tmp12_ = NULL; + HashMultiMapTests* _tmp13_; + HashMultiMapTests* _tmp14_; + GTestSuite* _tmp15_ = NULL; + GTestSuite* _tmp16_ = NULL; + HashMultiSetTests* _tmp17_; + HashMultiSetTests* _tmp18_; + GTestSuite* _tmp19_ = NULL; + GTestSuite* _tmp20_ = NULL; + HashSetTests* _tmp21_; + HashSetTests* _tmp22_; + GTestSuite* _tmp23_ = NULL; + GTestSuite* _tmp24_ = NULL; + LinkedListTests* _tmp25_; + LinkedListTests* _tmp26_; + GTestSuite* _tmp27_ = NULL; + GTestSuite* _tmp28_ = NULL; + LinkedListAsDequeTests* _tmp29_; + LinkedListAsDequeTests* _tmp30_; + GTestSuite* _tmp31_ = NULL; + GTestSuite* _tmp32_ = NULL; + PriorityQueueTests* _tmp33_; + PriorityQueueTests* _tmp34_; + GTestSuite* _tmp35_ = NULL; + GTestSuite* _tmp36_ = NULL; + ReadOnlyCollectionTests* _tmp37_; + ReadOnlyCollectionTests* _tmp38_; + GTestSuite* _tmp39_ = NULL; + GTestSuite* _tmp40_ = NULL; + ReadOnlyListTests* _tmp41_; + ReadOnlyListTests* _tmp42_; + GTestSuite* _tmp43_ = NULL; + GTestSuite* _tmp44_ = NULL; + ReadOnlyMapTests* _tmp45_; + ReadOnlyMapTests* _tmp46_; + GTestSuite* _tmp47_ = NULL; + GTestSuite* _tmp48_ = NULL; + ReadOnlySetTests* _tmp49_; + ReadOnlySetTests* _tmp50_; + GTestSuite* _tmp51_ = NULL; + GTestSuite* _tmp52_ = NULL; + TreeMapTests* _tmp53_; + TreeMapTests* _tmp54_; + GTestSuite* _tmp55_ = NULL; + GTestSuite* _tmp56_ = NULL; + TreeMultiMapTests* _tmp57_; + TreeMultiMapTests* _tmp58_; + GTestSuite* _tmp59_ = NULL; + GTestSuite* _tmp60_ = NULL; + TreeMultiSetTests* _tmp61_; + TreeMultiSetTests* _tmp62_; + GTestSuite* _tmp63_ = NULL; + GTestSuite* _tmp64_ = NULL; + TreeSetTests* _tmp65_; + TreeSetTests* _tmp66_; + GTestSuite* _tmp67_ = NULL; + g_test_init (&args_length1, &args, NULL); + _tmp0_ = g_test_get_root (); + _tmp1_ = array_list_tests_new (); + _tmp2_ = _tmp1_; + _tmp3_ = gee_test_case_get_suite ((GeeTestCase*) _tmp2_); + g_test_suite_add_suite (_tmp0_, _tmp3_); + _g_object_unref0 (_tmp2_); + _tmp4_ = g_test_get_root (); + _tmp5_ = comparable_tests_new (); + _tmp6_ = _tmp5_; + _tmp7_ = gee_test_case_get_suite ((GeeTestCase*) _tmp6_); + g_test_suite_add_suite (_tmp4_, _tmp7_); + _g_object_unref0 (_tmp6_); + _tmp8_ = g_test_get_root (); + _tmp9_ = hash_map_tests_new (); + _tmp10_ = _tmp9_; + _tmp11_ = gee_test_case_get_suite ((GeeTestCase*) _tmp10_); + g_test_suite_add_suite (_tmp8_, _tmp11_); + _g_object_unref0 (_tmp10_); + _tmp12_ = g_test_get_root (); + _tmp13_ = hash_multi_map_tests_new (); + _tmp14_ = _tmp13_; + _tmp15_ = gee_test_case_get_suite ((GeeTestCase*) _tmp14_); + g_test_suite_add_suite (_tmp12_, _tmp15_); + _g_object_unref0 (_tmp14_); + _tmp16_ = g_test_get_root (); + _tmp17_ = hash_multi_set_tests_new (); + _tmp18_ = _tmp17_; + _tmp19_ = gee_test_case_get_suite ((GeeTestCase*) _tmp18_); + g_test_suite_add_suite (_tmp16_, _tmp19_); + _g_object_unref0 (_tmp18_); + _tmp20_ = g_test_get_root (); + _tmp21_ = hash_set_tests_new (); + _tmp22_ = _tmp21_; + _tmp23_ = gee_test_case_get_suite ((GeeTestCase*) _tmp22_); + g_test_suite_add_suite (_tmp20_, _tmp23_); + _g_object_unref0 (_tmp22_); + _tmp24_ = g_test_get_root (); + _tmp25_ = linked_list_tests_new (); + _tmp26_ = _tmp25_; + _tmp27_ = gee_test_case_get_suite ((GeeTestCase*) _tmp26_); + g_test_suite_add_suite (_tmp24_, _tmp27_); + _g_object_unref0 (_tmp26_); + _tmp28_ = g_test_get_root (); + _tmp29_ = linked_list_as_deque_tests_new (); + _tmp30_ = _tmp29_; + _tmp31_ = gee_test_case_get_suite ((GeeTestCase*) _tmp30_); + g_test_suite_add_suite (_tmp28_, _tmp31_); + _g_object_unref0 (_tmp30_); + _tmp32_ = g_test_get_root (); + _tmp33_ = priority_queue_tests_new (); + _tmp34_ = _tmp33_; + _tmp35_ = gee_test_case_get_suite ((GeeTestCase*) _tmp34_); + g_test_suite_add_suite (_tmp32_, _tmp35_); + _g_object_unref0 (_tmp34_); + _tmp36_ = g_test_get_root (); + _tmp37_ = read_only_collection_tests_new (); + _tmp38_ = _tmp37_; + _tmp39_ = gee_test_case_get_suite ((GeeTestCase*) _tmp38_); + g_test_suite_add_suite (_tmp36_, _tmp39_); + _g_object_unref0 (_tmp38_); + _tmp40_ = g_test_get_root (); + _tmp41_ = read_only_list_tests_new (); + _tmp42_ = _tmp41_; + _tmp43_ = gee_test_case_get_suite ((GeeTestCase*) _tmp42_); + g_test_suite_add_suite (_tmp40_, _tmp43_); + _g_object_unref0 (_tmp42_); + _tmp44_ = g_test_get_root (); + _tmp45_ = read_only_map_tests_new (); + _tmp46_ = _tmp45_; + _tmp47_ = gee_test_case_get_suite ((GeeTestCase*) _tmp46_); + g_test_suite_add_suite (_tmp44_, _tmp47_); + _g_object_unref0 (_tmp46_); + _tmp48_ = g_test_get_root (); + _tmp49_ = read_only_set_tests_new (); + _tmp50_ = _tmp49_; + _tmp51_ = gee_test_case_get_suite ((GeeTestCase*) _tmp50_); + g_test_suite_add_suite (_tmp48_, _tmp51_); + _g_object_unref0 (_tmp50_); + _tmp52_ = g_test_get_root (); + _tmp53_ = tree_map_tests_new (); + _tmp54_ = _tmp53_; + _tmp55_ = gee_test_case_get_suite ((GeeTestCase*) _tmp54_); + g_test_suite_add_suite (_tmp52_, _tmp55_); + _g_object_unref0 (_tmp54_); + _tmp56_ = g_test_get_root (); + _tmp57_ = tree_multi_map_tests_new (); + _tmp58_ = _tmp57_; + _tmp59_ = gee_test_case_get_suite ((GeeTestCase*) _tmp58_); + g_test_suite_add_suite (_tmp56_, _tmp59_); + _g_object_unref0 (_tmp58_); + _tmp60_ = g_test_get_root (); + _tmp61_ = tree_multi_set_tests_new (); + _tmp62_ = _tmp61_; + _tmp63_ = gee_test_case_get_suite ((GeeTestCase*) _tmp62_); + g_test_suite_add_suite (_tmp60_, _tmp63_); + _g_object_unref0 (_tmp62_); + _tmp64_ = g_test_get_root (); + _tmp65_ = tree_set_tests_new (); + _tmp66_ = _tmp65_; + _tmp67_ = gee_test_case_get_suite ((GeeTestCase*) _tmp66_); + g_test_suite_add_suite (_tmp64_, _tmp67_); + _g_object_unref0 (_tmp66_); + g_test_run (); +} + + +int main (int argc, char ** argv) { + g_type_init (); + _vala_main (argv, argc); + return 0; +} + + + diff --git a/tests/testmain.vala b/tests/testmain.vala new file mode 100644 index 0000000..ad6e992 --- /dev/null +++ b/tests/testmain.vala @@ -0,0 +1,46 @@ +/* testmain.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + */ + +void main (string[] args) { + Test.init (ref args); + + TestSuite.get_root ().add_suite (new ArrayListTests ().get_suite ()); + TestSuite.get_root ().add_suite (new ComparableTests ().get_suite ()); + TestSuite.get_root ().add_suite (new HashMapTests ().get_suite ()); + TestSuite.get_root ().add_suite (new HashMultiMapTests ().get_suite ()); + TestSuite.get_root ().add_suite (new HashMultiSetTests ().get_suite ()); + TestSuite.get_root ().add_suite (new HashSetTests ().get_suite ()); + TestSuite.get_root ().add_suite (new LinkedListTests ().get_suite ()); + TestSuite.get_root ().add_suite (new LinkedListAsDequeTests ().get_suite ()); + TestSuite.get_root ().add_suite (new PriorityQueueTests ().get_suite ()); + TestSuite.get_root ().add_suite (new ReadOnlyCollectionTests ().get_suite ()); + TestSuite.get_root ().add_suite (new ReadOnlyListTests ().get_suite ()); + TestSuite.get_root ().add_suite (new ReadOnlyMapTests ().get_suite ()); + TestSuite.get_root ().add_suite (new ReadOnlySetTests ().get_suite ()); + TestSuite.get_root ().add_suite (new TreeMapTests ().get_suite ()); + TestSuite.get_root ().add_suite (new TreeMultiMapTests ().get_suite ()); + TestSuite.get_root ().add_suite (new TreeMultiSetTests ().get_suite ()); + TestSuite.get_root ().add_suite (new TreeSetTests ().get_suite ()); + + Test.run (); +} diff --git a/tests/testmap.c b/tests/testmap.c new file mode 100644 index 0000000..e49ca88 --- /dev/null +++ b/tests/testmap.c @@ -0,0 +1,2060 @@ +/* testmap.c generated by valac 0.18.0, the Vala compiler + * generated from testmap.vala, do not modify */ + +/* testmap.vala + * + * Copyright (C) 2008 Jürg Billeter, Maciej Piechotka + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Maciej Piechotka + * Julien Peeters + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_MAP_TESTS (map_tests_get_type ()) +#define MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAP_TESTS, MapTests)) +#define MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAP_TESTS, MapTestsClass)) +#define IS_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAP_TESTS)) +#define IS_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAP_TESTS)) +#define MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAP_TESTS, MapTestsClass)) + +typedef struct _MapTests MapTests; +typedef struct _MapTestsClass MapTestsClass; +typedef struct _MapTestsPrivate MapTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) + +#define MAP_TESTS_TYPE_TEST_ENTRY (map_tests_test_entry_get_type ()) +#define MAP_TESTS_TEST_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAP_TESTS_TYPE_TEST_ENTRY, MapTestsTestEntry)) +#define MAP_TESTS_TEST_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAP_TESTS_TYPE_TEST_ENTRY, MapTestsTestEntryClass)) +#define MAP_TESTS_IS_TEST_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAP_TESTS_TYPE_TEST_ENTRY)) +#define MAP_TESTS_IS_TEST_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAP_TESTS_TYPE_TEST_ENTRY)) +#define MAP_TESTS_TEST_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAP_TESTS_TYPE_TEST_ENTRY, MapTestsTestEntryClass)) + +typedef struct _MapTestsTestEntry MapTestsTestEntry; +typedef struct _MapTestsTestEntryClass MapTestsTestEntryClass; +typedef struct _MapTestsTestEntryPrivate MapTestsTestEntryPrivate; +#define _k_destroy_func0(var) (((var == NULL) || (k_destroy_func == NULL)) ? NULL : (var = (k_destroy_func (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _MapTests { + GeeTestCase parent_instance; + MapTestsPrivate * priv; + GeeMap* test_map; +}; + +struct _MapTestsClass { + GeeTestCaseClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); +struct _MapTestsTestEntry { + GeeMapEntry parent_instance; + MapTestsTestEntryPrivate * priv; +}; + +struct _MapTestsTestEntryClass { + GeeMapEntryClass parent_class; +}; + +struct _MapTestsTestEntryPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + gpointer _key; + gpointer _value; +}; + + +static gpointer map_tests_parent_class = NULL; +static gpointer map_tests_test_entry_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType map_tests_get_type (void) G_GNUC_CONST; +enum { + MAP_TESTS_DUMMY_PROPERTY +}; +MapTests* map_tests_construct (GType object_type, const gchar* name); +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void map_tests_test_type_correctness (MapTests* self); +static void _map_tests_test_type_correctness_gee_test_case_test_method (gpointer self); +void map_tests_test_has_key_size_is_empty (MapTests* self); +static void _map_tests_test_has_key_size_is_empty_gee_test_case_test_method (gpointer self); +void map_tests_test_keys (MapTests* self); +static void _map_tests_test_keys_gee_test_case_test_method (gpointer self); +void map_tests_test_values (MapTests* self); +static void _map_tests_test_values_gee_test_case_test_method (gpointer self); +void map_tests_test_entries (MapTests* self); +static void _map_tests_test_entries_gee_test_case_test_method (gpointer self); +void map_tests_test_set_all (MapTests* self); +static void _map_tests_test_set_all_gee_test_case_test_method (gpointer self); +void map_tests_test_unset_all (MapTests* self); +static void _map_tests_test_unset_all_gee_test_case_test_method (gpointer self); +void map_tests_test_has_all (MapTests* self); +static void _map_tests_test_has_all_gee_test_case_test_method (gpointer self); +void map_tests_test_gobject_properties (MapTests* self); +static void _map_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +MapTestsTestEntry* map_tests_test_entry_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, gconstpointer key, gconstpointer value); +MapTestsTestEntry* map_tests_test_entry_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, gconstpointer key, gconstpointer value); +GType map_tests_test_entry_get_type (void) G_GNUC_CONST; +void map_tests_test_clear (MapTests* self); +#define MAP_TESTS_TEST_ENTRY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MAP_TESTS_TYPE_TEST_ENTRY, MapTestsTestEntryPrivate)) +enum { + MAP_TESTS_TEST_ENTRY_DUMMY_PROPERTY, + MAP_TESTS_TEST_ENTRY_K_TYPE, + MAP_TESTS_TEST_ENTRY_K_DUP_FUNC, + MAP_TESTS_TEST_ENTRY_K_DESTROY_FUNC, + MAP_TESTS_TEST_ENTRY_V_TYPE, + MAP_TESTS_TEST_ENTRY_V_DUP_FUNC, + MAP_TESTS_TEST_ENTRY_V_DESTROY_FUNC, + MAP_TESTS_TEST_ENTRY_KEY, + MAP_TESTS_TEST_ENTRY_VALUE +}; +static void map_tests_test_entry_finalize (GObject* obj); +static void _vala_map_tests_test_entry_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_map_tests_test_entry_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void map_tests_finalize (GObject* obj); + + +static void _map_tests_test_type_correctness_gee_test_case_test_method (gpointer self) { + map_tests_test_type_correctness (self); +} + + +static void _map_tests_test_has_key_size_is_empty_gee_test_case_test_method (gpointer self) { + map_tests_test_has_key_size_is_empty (self); +} + + +static void _map_tests_test_keys_gee_test_case_test_method (gpointer self) { + map_tests_test_keys (self); +} + + +static void _map_tests_test_values_gee_test_case_test_method (gpointer self) { + map_tests_test_values (self); +} + + +static void _map_tests_test_entries_gee_test_case_test_method (gpointer self) { + map_tests_test_entries (self); +} + + +static void _map_tests_test_set_all_gee_test_case_test_method (gpointer self) { + map_tests_test_set_all (self); +} + + +static void _map_tests_test_unset_all_gee_test_case_test_method (gpointer self) { + map_tests_test_unset_all (self); +} + + +static void _map_tests_test_has_all_gee_test_case_test_method (gpointer self) { + map_tests_test_has_all (self); +} + + +static void _map_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + map_tests_test_gobject_properties (self); +} + + +MapTests* map_tests_construct (GType object_type, const gchar* name) { + MapTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (MapTests*) gee_test_case_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] type correctness", _map_tests_test_type_correctness_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] has_key, size and is_empty", _map_tests_test_has_key_size_is_empty_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] keys", _map_tests_test_keys_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] values", _map_tests_test_values_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] entries", _map_tests_test_entries_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] set all", _map_tests_test_set_all_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] unset all", _map_tests_test_unset_all_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] has all", _map_tests_test_has_all_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] GObject properties", _map_tests_test_gobject_properties_gee_test_case_test_method, self); + return self; +} + + +void map_tests_test_type_correctness (MapTests* self) { + GeeMap* _tmp0_; + GeeMap* _tmp1_; + GType _tmp2_; + GType _tmp3_; + GeeMap* _tmp4_; + GType _tmp5_; + GType _tmp6_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + _vala_assert (_tmp0_ != NULL, "test_map != null"); + _tmp1_ = self->test_map; + _tmp2_ = gee_map_get_key_type (_tmp1_); + _tmp3_ = _tmp2_; + _vala_assert (_tmp3_ == G_TYPE_STRING, "test_map.key_type == typeof (string)"); + _tmp4_ = self->test_map; + _tmp5_ = gee_map_get_value_type (_tmp4_); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_ == G_TYPE_STRING, "test_map.value_type == typeof (string)"); +} + + +void map_tests_test_has_key_size_is_empty (MapTests* self) { + GeeMap* _tmp0_; + gchar* value = NULL; + GeeMap* _tmp1_; + gboolean _tmp2_ = FALSE; + GeeMap* _tmp3_; + gboolean _tmp4_ = FALSE; + GeeMap* _tmp5_; + gboolean _tmp6_ = FALSE; + GeeMap* _tmp7_; + gint _tmp8_; + gint _tmp9_; + GeeMap* _tmp10_; + gboolean _tmp11_; + gboolean _tmp12_; + GeeMap* _tmp13_; + GeeMap* _tmp14_; + gboolean _tmp15_ = FALSE; + GeeMap* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeMap* _tmp18_; + gboolean _tmp19_ = FALSE; + GeeMap* _tmp20_; + gpointer _tmp21_ = NULL; + gchar* _tmp22_; + GeeMap* _tmp23_; + gboolean _tmp24_ = FALSE; + GeeMap* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + GeeMap* _tmp28_; + gboolean _tmp29_ = FALSE; + GeeMap* _tmp30_; + gpointer _tmp31_ = NULL; + gchar* _tmp32_; + GeeMap* _tmp33_; + gint _tmp34_; + gint _tmp35_; + GeeMap* _tmp36_; + gboolean _tmp37_; + gboolean _tmp38_; + GeeMap* _tmp39_; + gboolean _tmp40_ = FALSE; + GeeMap* _tmp41_; + gboolean _tmp42_ = FALSE; + GeeMap* _tmp43_; + gboolean _tmp44_ = FALSE; + GeeMap* _tmp45_; + gboolean _tmp46_ = FALSE; + GeeMap* _tmp47_; + gpointer _tmp48_ = NULL; + gchar* _tmp49_; + GeeMap* _tmp50_; + gboolean _tmp51_ = FALSE; + GeeMap* _tmp52_; + gpointer _tmp53_ = NULL; + gchar* _tmp54_; + GeeMap* _tmp55_; + gboolean _tmp56_ = FALSE; + GeeMap* _tmp57_; + gpointer _tmp58_ = NULL; + gchar* _tmp59_; + GeeMap* _tmp60_; + gint _tmp61_; + gint _tmp62_; + GeeMap* _tmp63_; + gboolean _tmp64_; + gboolean _tmp65_; + GeeMap* _tmp66_; + GeeMap* _tmp67_; + gboolean _tmp68_ = FALSE; + GeeMap* _tmp69_; + gpointer _tmp70_ = NULL; + gchar* _tmp71_; + GeeMap* _tmp72_; + gboolean _tmp73_ = FALSE; + GeeMap* _tmp74_; + gpointer _tmp75_ = NULL; + gchar* _tmp76_; + GeeMap* _tmp77_; + gboolean _tmp78_ = FALSE; + GeeMap* _tmp79_; + gpointer _tmp80_ = NULL; + gchar* _tmp81_; + GeeMap* _tmp82_; + gint _tmp83_; + gint _tmp84_; + GeeMap* _tmp85_; + gboolean _tmp86_; + gboolean _tmp87_; + GeeMap* _tmp88_; + GeeMap* _tmp89_; + gboolean _tmp90_ = FALSE; + GeeMap* _tmp91_; + gpointer _tmp92_ = NULL; + gchar* _tmp93_; + GeeMap* _tmp94_; + gboolean _tmp95_ = FALSE; + GeeMap* _tmp96_; + gpointer _tmp97_ = NULL; + gchar* _tmp98_; + GeeMap* _tmp99_; + gboolean _tmp100_ = FALSE; + GeeMap* _tmp101_; + gpointer _tmp102_ = NULL; + gchar* _tmp103_; + GeeMap* _tmp104_; + gint _tmp105_; + gint _tmp106_; + GeeMap* _tmp107_; + gboolean _tmp108_; + gboolean _tmp109_; + GeeMap* _tmp110_; + GeeMap* _tmp111_; + gboolean _tmp112_ = FALSE; + GeeMap* _tmp113_; + gpointer _tmp114_ = NULL; + gchar* _tmp115_; + GeeMap* _tmp116_; + gboolean _tmp117_ = FALSE; + GeeMap* _tmp118_; + gpointer _tmp119_ = NULL; + gchar* _tmp120_; + GeeMap* _tmp121_; + gboolean _tmp122_ = FALSE; + GeeMap* _tmp123_; + gpointer _tmp124_ = NULL; + gchar* _tmp125_; + GeeMap* _tmp126_; + gint _tmp127_; + gint _tmp128_; + GeeMap* _tmp129_; + gboolean _tmp130_; + gboolean _tmp131_; + GeeMap* _tmp132_; + GeeMap* _tmp133_; + gboolean _tmp134_ = FALSE; + GeeMap* _tmp135_; + gpointer _tmp136_ = NULL; + gchar* _tmp137_; + GeeMap* _tmp138_; + gboolean _tmp139_ = FALSE; + GeeMap* _tmp140_; + gpointer _tmp141_ = NULL; + gchar* _tmp142_; + GeeMap* _tmp143_; + gboolean _tmp144_ = FALSE; + GeeMap* _tmp145_; + gpointer _tmp146_ = NULL; + gchar* _tmp147_; + GeeMap* _tmp148_; + gint _tmp149_; + gint _tmp150_; + GeeMap* _tmp151_; + gboolean _tmp152_; + gboolean _tmp153_; + GeeMap* _tmp154_; + gpointer _tmp155_ = NULL; + gboolean _tmp156_ = FALSE; + const gchar* _tmp157_; + GeeMap* _tmp158_; + gboolean _tmp159_ = FALSE; + GeeMap* _tmp160_; + gpointer _tmp161_ = NULL; + gchar* _tmp162_; + GeeMap* _tmp163_; + gboolean _tmp164_ = FALSE; + GeeMap* _tmp165_; + gpointer _tmp166_ = NULL; + gchar* _tmp167_; + GeeMap* _tmp168_; + gboolean _tmp169_ = FALSE; + GeeMap* _tmp170_; + gpointer _tmp171_ = NULL; + gchar* _tmp172_; + GeeMap* _tmp173_; + gint _tmp174_; + gint _tmp175_; + GeeMap* _tmp176_; + gboolean _tmp177_; + gboolean _tmp178_; + GeeMap* _tmp179_; + gpointer _tmp180_ = NULL; + gboolean _tmp181_ = FALSE; + const gchar* _tmp182_; + GeeMap* _tmp183_; + gboolean _tmp184_ = FALSE; + GeeMap* _tmp185_; + gboolean _tmp186_ = FALSE; + GeeMap* _tmp187_; + gboolean _tmp188_ = FALSE; + GeeMap* _tmp189_; + gint _tmp190_; + gint _tmp191_; + GeeMap* _tmp192_; + gboolean _tmp193_; + gboolean _tmp194_; + GeeMap* _tmp195_; + GeeMap* _tmp196_; + gboolean _tmp197_ = FALSE; + GeeMap* _tmp198_; + gpointer _tmp199_ = NULL; + gchar* _tmp200_; + GeeMap* _tmp201_; + gboolean _tmp202_ = FALSE; + GeeMap* _tmp203_; + gpointer _tmp204_ = NULL; + gchar* _tmp205_; + GeeMap* _tmp206_; + gboolean _tmp207_ = FALSE; + GeeMap* _tmp208_; + gpointer _tmp209_ = NULL; + gchar* _tmp210_; + GeeMap* _tmp211_; + gint _tmp212_; + gint _tmp213_; + GeeMap* _tmp214_; + gboolean _tmp215_; + gboolean _tmp216_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + _vala_assert (_tmp0_ != NULL, "test_map != null"); + _tmp1_ = self->test_map; + _tmp2_ = gee_map_has_key (_tmp1_, "one"); + _vala_assert (!_tmp2_, "! test_map.has_key (\"one\")"); + _tmp3_ = self->test_map; + _tmp4_ = gee_map_has_key (_tmp3_, "two"); + _vala_assert (!_tmp4_, "! test_map.has_key (\"two\")"); + _tmp5_ = self->test_map; + _tmp6_ = gee_map_has_key (_tmp5_, "three"); + _vala_assert (!_tmp6_, "! test_map.has_key (\"three\")"); + _tmp7_ = self->test_map; + _tmp8_ = gee_map_get_size (_tmp7_); + _tmp9_ = _tmp8_; + _vala_assert (_tmp9_ == 0, "test_map.size == 0"); + _tmp10_ = self->test_map; + _tmp11_ = gee_map_get_is_empty (_tmp10_); + _tmp12_ = _tmp11_; + _vala_assert (_tmp12_, "test_map.is_empty"); + _tmp13_ = self->test_map; + gee_map_set (_tmp13_, "one", "value_of_one"); + _tmp14_ = self->test_map; + _tmp15_ = gee_map_has_key (_tmp14_, "one"); + _vala_assert (_tmp15_, "test_map.has_key (\"one\")"); + _tmp16_ = self->test_map; + _tmp17_ = gee_map_has (_tmp16_, "one", "value_of_one"); + _vala_assert (_tmp17_, "test_map.has (\"one\", \"value_of_one\")"); + _tmp18_ = self->test_map; + _tmp19_ = gee_map_has (_tmp18_, "one", "another_value_for_one"); + _vala_assert (!_tmp19_, "! test_map.has (\"one\", \"another_value_for_one\")"); + _tmp20_ = self->test_map; + _tmp21_ = gee_map_get (_tmp20_, "one"); + _tmp22_ = (gchar*) _tmp21_; + _vala_assert (g_strcmp0 (_tmp22_, "value_of_one") == 0, "test_map.get (\"one\") == \"value_of_one\""); + _g_free0 (_tmp22_); + _tmp23_ = self->test_map; + _tmp24_ = gee_map_has_key (_tmp23_, "two"); + _vala_assert (!_tmp24_, "! test_map.has_key (\"two\")"); + _tmp25_ = self->test_map; + _tmp26_ = gee_map_get (_tmp25_, "two"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (_tmp27_ == NULL, "test_map.get (\"two\") == null"); + _g_free0 (_tmp27_); + _tmp28_ = self->test_map; + _tmp29_ = gee_map_has_key (_tmp28_, "three"); + _vala_assert (!_tmp29_, "! test_map.has_key (\"three\")"); + _tmp30_ = self->test_map; + _tmp31_ = gee_map_get (_tmp30_, "three"); + _tmp32_ = (gchar*) _tmp31_; + _vala_assert (_tmp32_ == NULL, "test_map.get (\"three\") == null"); + _g_free0 (_tmp32_); + _tmp33_ = self->test_map; + _tmp34_ = gee_map_get_size (_tmp33_); + _tmp35_ = _tmp34_; + _vala_assert (_tmp35_ == 1, "test_map.size == 1"); + _tmp36_ = self->test_map; + _tmp37_ = gee_map_get_is_empty (_tmp36_); + _tmp38_ = _tmp37_; + _vala_assert (!_tmp38_, "! test_map.is_empty"); + _tmp39_ = self->test_map; + _tmp40_ = gee_map_unset (_tmp39_, "one", NULL); + _vala_assert (_tmp40_, "test_map.unset (\"one\")"); + _tmp41_ = self->test_map; + _tmp42_ = gee_map_has_key (_tmp41_, "one"); + _vala_assert (!_tmp42_, "! test_map.has_key (\"one\")"); + _tmp43_ = self->test_map; + _tmp44_ = gee_map_has (_tmp43_, "one", "value_of_one"); + _vala_assert (!_tmp44_, "! test_map.has (\"one\", \"value_of_one\")"); + _tmp45_ = self->test_map; + _tmp46_ = gee_map_has (_tmp45_, "one", "another_value_for_one"); + _vala_assert (!_tmp46_, "! test_map.has (\"one\", \"another_value_for_one\")"); + _tmp47_ = self->test_map; + _tmp48_ = gee_map_get (_tmp47_, "one"); + _tmp49_ = (gchar*) _tmp48_; + _vala_assert (_tmp49_ == NULL, "test_map.get (\"one\") == null"); + _g_free0 (_tmp49_); + _tmp50_ = self->test_map; + _tmp51_ = gee_map_has_key (_tmp50_, "two"); + _vala_assert (!_tmp51_, "! test_map.has_key (\"two\")"); + _tmp52_ = self->test_map; + _tmp53_ = gee_map_get (_tmp52_, "two"); + _tmp54_ = (gchar*) _tmp53_; + _vala_assert (_tmp54_ == NULL, "test_map.get (\"two\") == null"); + _g_free0 (_tmp54_); + _tmp55_ = self->test_map; + _tmp56_ = gee_map_has_key (_tmp55_, "three"); + _vala_assert (!_tmp56_, "! test_map.has_key (\"three\")"); + _tmp57_ = self->test_map; + _tmp58_ = gee_map_get (_tmp57_, "three"); + _tmp59_ = (gchar*) _tmp58_; + _vala_assert (_tmp59_ == NULL, "test_map.get (\"three\") == null"); + _g_free0 (_tmp59_); + _tmp60_ = self->test_map; + _tmp61_ = gee_map_get_size (_tmp60_); + _tmp62_ = _tmp61_; + _vala_assert (_tmp62_ == 0, "test_map.size == 0"); + _tmp63_ = self->test_map; + _tmp64_ = gee_map_get_is_empty (_tmp63_); + _tmp65_ = _tmp64_; + _vala_assert (_tmp65_, "test_map.is_empty"); + _tmp66_ = self->test_map; + gee_map_set (_tmp66_, "one", "value_of_one"); + _tmp67_ = self->test_map; + _tmp68_ = gee_map_has_key (_tmp67_, "one"); + _vala_assert (_tmp68_, "test_map.has_key (\"one\")"); + _tmp69_ = self->test_map; + _tmp70_ = gee_map_get (_tmp69_, "one"); + _tmp71_ = (gchar*) _tmp70_; + _vala_assert (g_strcmp0 (_tmp71_, "value_of_one") == 0, "test_map.get (\"one\") == \"value_of_one\""); + _g_free0 (_tmp71_); + _tmp72_ = self->test_map; + _tmp73_ = gee_map_has_key (_tmp72_, "two"); + _vala_assert (!_tmp73_, "! test_map.has_key (\"two\")"); + _tmp74_ = self->test_map; + _tmp75_ = gee_map_get (_tmp74_, "two"); + _tmp76_ = (gchar*) _tmp75_; + _vala_assert (_tmp76_ == NULL, "test_map.get (\"two\") == null"); + _g_free0 (_tmp76_); + _tmp77_ = self->test_map; + _tmp78_ = gee_map_has_key (_tmp77_, "three"); + _vala_assert (!_tmp78_, "! test_map.has_key (\"three\")"); + _tmp79_ = self->test_map; + _tmp80_ = gee_map_get (_tmp79_, "three"); + _tmp81_ = (gchar*) _tmp80_; + _vala_assert (_tmp81_ == NULL, "test_map.get (\"three\") == null"); + _g_free0 (_tmp81_); + _tmp82_ = self->test_map; + _tmp83_ = gee_map_get_size (_tmp82_); + _tmp84_ = _tmp83_; + _vala_assert (_tmp84_ == 1, "test_map.size == 1"); + _tmp85_ = self->test_map; + _tmp86_ = gee_map_get_is_empty (_tmp85_); + _tmp87_ = _tmp86_; + _vala_assert (!_tmp87_, "! test_map.is_empty"); + _tmp88_ = self->test_map; + gee_map_set (_tmp88_, "two", "value_of_two"); + _tmp89_ = self->test_map; + _tmp90_ = gee_map_has_key (_tmp89_, "one"); + _vala_assert (_tmp90_, "test_map.has_key (\"one\")"); + _tmp91_ = self->test_map; + _tmp92_ = gee_map_get (_tmp91_, "one"); + _tmp93_ = (gchar*) _tmp92_; + _vala_assert (g_strcmp0 (_tmp93_, "value_of_one") == 0, "test_map.get (\"one\") == \"value_of_one\""); + _g_free0 (_tmp93_); + _tmp94_ = self->test_map; + _tmp95_ = gee_map_has_key (_tmp94_, "two"); + _vala_assert (_tmp95_, "test_map.has_key (\"two\")"); + _tmp96_ = self->test_map; + _tmp97_ = gee_map_get (_tmp96_, "two"); + _tmp98_ = (gchar*) _tmp97_; + _vala_assert (g_strcmp0 (_tmp98_, "value_of_two") == 0, "test_map.get (\"two\") == \"value_of_two\""); + _g_free0 (_tmp98_); + _tmp99_ = self->test_map; + _tmp100_ = gee_map_has_key (_tmp99_, "three"); + _vala_assert (!_tmp100_, "! test_map.has_key (\"three\")"); + _tmp101_ = self->test_map; + _tmp102_ = gee_map_get (_tmp101_, "three"); + _tmp103_ = (gchar*) _tmp102_; + _vala_assert (_tmp103_ == NULL, "test_map.get (\"three\") == null"); + _g_free0 (_tmp103_); + _tmp104_ = self->test_map; + _tmp105_ = gee_map_get_size (_tmp104_); + _tmp106_ = _tmp105_; + _vala_assert (_tmp106_ == 2, "test_map.size == 2"); + _tmp107_ = self->test_map; + _tmp108_ = gee_map_get_is_empty (_tmp107_); + _tmp109_ = _tmp108_; + _vala_assert (!_tmp109_, "! test_map.is_empty"); + _tmp110_ = self->test_map; + gee_map_set (_tmp110_, "three", "value_of_three"); + _tmp111_ = self->test_map; + _tmp112_ = gee_map_has_key (_tmp111_, "one"); + _vala_assert (_tmp112_, "test_map.has_key (\"one\")"); + _tmp113_ = self->test_map; + _tmp114_ = gee_map_get (_tmp113_, "one"); + _tmp115_ = (gchar*) _tmp114_; + _vala_assert (g_strcmp0 (_tmp115_, "value_of_one") == 0, "test_map.get (\"one\") == \"value_of_one\""); + _g_free0 (_tmp115_); + _tmp116_ = self->test_map; + _tmp117_ = gee_map_has_key (_tmp116_, "two"); + _vala_assert (_tmp117_, "test_map.has_key (\"two\")"); + _tmp118_ = self->test_map; + _tmp119_ = gee_map_get (_tmp118_, "two"); + _tmp120_ = (gchar*) _tmp119_; + _vala_assert (g_strcmp0 (_tmp120_, "value_of_two") == 0, "test_map.get (\"two\") == \"value_of_two\""); + _g_free0 (_tmp120_); + _tmp121_ = self->test_map; + _tmp122_ = gee_map_has_key (_tmp121_, "three"); + _vala_assert (_tmp122_, "test_map.has_key (\"three\")"); + _tmp123_ = self->test_map; + _tmp124_ = gee_map_get (_tmp123_, "three"); + _tmp125_ = (gchar*) _tmp124_; + _vala_assert (g_strcmp0 (_tmp125_, "value_of_three") == 0, "test_map.get (\"three\") == \"value_of_three\""); + _g_free0 (_tmp125_); + _tmp126_ = self->test_map; + _tmp127_ = gee_map_get_size (_tmp126_); + _tmp128_ = _tmp127_; + _vala_assert (_tmp128_ == 3, "test_map.size == 3"); + _tmp129_ = self->test_map; + _tmp130_ = gee_map_get_is_empty (_tmp129_); + _tmp131_ = _tmp130_; + _vala_assert (!_tmp131_, "! test_map.is_empty"); + _tmp132_ = self->test_map; + gee_map_set (_tmp132_, "two", "value_of_two_new"); + _tmp133_ = self->test_map; + _tmp134_ = gee_map_has_key (_tmp133_, "one"); + _vala_assert (_tmp134_, "test_map.has_key (\"one\")"); + _tmp135_ = self->test_map; + _tmp136_ = gee_map_get (_tmp135_, "one"); + _tmp137_ = (gchar*) _tmp136_; + _vala_assert (g_strcmp0 (_tmp137_, "value_of_one") == 0, "test_map.get (\"one\") == \"value_of_one\""); + _g_free0 (_tmp137_); + _tmp138_ = self->test_map; + _tmp139_ = gee_map_has_key (_tmp138_, "two"); + _vala_assert (_tmp139_, "test_map.has_key (\"two\")"); + _tmp140_ = self->test_map; + _tmp141_ = gee_map_get (_tmp140_, "two"); + _tmp142_ = (gchar*) _tmp141_; + _vala_assert (g_strcmp0 (_tmp142_, "value_of_two_new") == 0, "test_map.get (\"two\") == \"value_of_two_new\""); + _g_free0 (_tmp142_); + _tmp143_ = self->test_map; + _tmp144_ = gee_map_has_key (_tmp143_, "three"); + _vala_assert (_tmp144_, "test_map.has_key (\"three\")"); + _tmp145_ = self->test_map; + _tmp146_ = gee_map_get (_tmp145_, "three"); + _tmp147_ = (gchar*) _tmp146_; + _vala_assert (g_strcmp0 (_tmp147_, "value_of_three") == 0, "test_map.get (\"three\") == \"value_of_three\""); + _g_free0 (_tmp147_); + _tmp148_ = self->test_map; + _tmp149_ = gee_map_get_size (_tmp148_); + _tmp150_ = _tmp149_; + _vala_assert (_tmp150_ == 3, "test_map.size == 3"); + _tmp151_ = self->test_map; + _tmp152_ = gee_map_get_is_empty (_tmp151_); + _tmp153_ = _tmp152_; + _vala_assert (!_tmp153_, "! test_map.is_empty"); + _tmp154_ = self->test_map; + _tmp156_ = gee_map_unset (_tmp154_, "two", &_tmp155_); + _g_free0 (value); + value = _tmp155_; + _vala_assert (_tmp156_, "test_map.unset (\"two\", out value)"); + _tmp157_ = value; + _vala_assert (g_strcmp0 (_tmp157_, "value_of_two_new") == 0, "value == \"value_of_two_new\""); + _tmp158_ = self->test_map; + _tmp159_ = gee_map_has_key (_tmp158_, "one"); + _vala_assert (_tmp159_, "test_map.has_key (\"one\")"); + _tmp160_ = self->test_map; + _tmp161_ = gee_map_get (_tmp160_, "one"); + _tmp162_ = (gchar*) _tmp161_; + _vala_assert (g_strcmp0 (_tmp162_, "value_of_one") == 0, "test_map.get (\"one\") == \"value_of_one\""); + _g_free0 (_tmp162_); + _tmp163_ = self->test_map; + _tmp164_ = gee_map_has_key (_tmp163_, "two"); + _vala_assert (!_tmp164_, "! test_map.has_key (\"two\")"); + _tmp165_ = self->test_map; + _tmp166_ = gee_map_get (_tmp165_, "two"); + _tmp167_ = (gchar*) _tmp166_; + _vala_assert (_tmp167_ == NULL, "test_map.get (\"two\") == null"); + _g_free0 (_tmp167_); + _tmp168_ = self->test_map; + _tmp169_ = gee_map_has_key (_tmp168_, "three"); + _vala_assert (_tmp169_, "test_map.has_key (\"three\")"); + _tmp170_ = self->test_map; + _tmp171_ = gee_map_get (_tmp170_, "three"); + _tmp172_ = (gchar*) _tmp171_; + _vala_assert (g_strcmp0 (_tmp172_, "value_of_three") == 0, "test_map.get (\"three\") == \"value_of_three\""); + _g_free0 (_tmp172_); + _tmp173_ = self->test_map; + _tmp174_ = gee_map_get_size (_tmp173_); + _tmp175_ = _tmp174_; + _vala_assert (_tmp175_ == 2, "test_map.size == 2"); + _tmp176_ = self->test_map; + _tmp177_ = gee_map_get_is_empty (_tmp176_); + _tmp178_ = _tmp177_; + _vala_assert (!_tmp178_, "! test_map.is_empty"); + _tmp179_ = self->test_map; + _tmp181_ = gee_map_unset (_tmp179_, "two", &_tmp180_); + _g_free0 (value); + value = _tmp180_; + _vala_assert (!_tmp181_, "! test_map.unset (\"two\", out value)"); + _tmp182_ = value; + _vala_assert (_tmp182_ == NULL, "value == null"); + _tmp183_ = self->test_map; + _tmp184_ = gee_map_has_key (_tmp183_, "one"); + _vala_assert (_tmp184_, "test_map.has_key (\"one\")"); + _tmp185_ = self->test_map; + _tmp186_ = gee_map_has_key (_tmp185_, "two"); + _vala_assert (!_tmp186_, "! test_map.has_key (\"two\")"); + _tmp187_ = self->test_map; + _tmp188_ = gee_map_has_key (_tmp187_, "three"); + _vala_assert (_tmp188_, "test_map.has_key (\"three\")"); + _tmp189_ = self->test_map; + _tmp190_ = gee_map_get_size (_tmp189_); + _tmp191_ = _tmp190_; + _vala_assert (_tmp191_ == 2, "test_map.size == 2"); + _tmp192_ = self->test_map; + _tmp193_ = gee_map_get_is_empty (_tmp192_); + _tmp194_ = _tmp193_; + _vala_assert (!_tmp194_, "! test_map.is_empty"); + _tmp195_ = self->test_map; + gee_map_clear (_tmp195_); + _tmp196_ = self->test_map; + _tmp197_ = gee_map_has_key (_tmp196_, "one"); + _vala_assert (!_tmp197_, "! test_map.has_key (\"one\")"); + _tmp198_ = self->test_map; + _tmp199_ = gee_map_get (_tmp198_, "one"); + _tmp200_ = (gchar*) _tmp199_; + _vala_assert (_tmp200_ == NULL, "test_map.get (\"one\") == null"); + _g_free0 (_tmp200_); + _tmp201_ = self->test_map; + _tmp202_ = gee_map_has_key (_tmp201_, "two"); + _vala_assert (!_tmp202_, "! test_map.has_key (\"two\")"); + _tmp203_ = self->test_map; + _tmp204_ = gee_map_get (_tmp203_, "two"); + _tmp205_ = (gchar*) _tmp204_; + _vala_assert (_tmp205_ == NULL, "test_map.get (\"two\") == null"); + _g_free0 (_tmp205_); + _tmp206_ = self->test_map; + _tmp207_ = gee_map_has_key (_tmp206_, "three"); + _vala_assert (!_tmp207_, "! test_map.has_key (\"three\")"); + _tmp208_ = self->test_map; + _tmp209_ = gee_map_get (_tmp208_, "three"); + _tmp210_ = (gchar*) _tmp209_; + _vala_assert (_tmp210_ == NULL, "test_map.get (\"three\") == null"); + _g_free0 (_tmp210_); + _tmp211_ = self->test_map; + _tmp212_ = gee_map_get_size (_tmp211_); + _tmp213_ = _tmp212_; + _vala_assert (_tmp213_ == 0, "test_map.size == 0"); + _tmp214_ = self->test_map; + _tmp215_ = gee_map_get_is_empty (_tmp214_); + _tmp216_ = _tmp215_; + _vala_assert (_tmp216_, "test_map.is_empty"); + _g_free0 (value); +} + + +void map_tests_test_keys (MapTests* self) { + GeeMap* _tmp0_; + GeeSet* _tmp1_; + GeeSet* _tmp2_; + GeeSet* keys; + GeeSet* _tmp3_; + gint _tmp4_; + gint _tmp5_; + GeeMap* _tmp6_; + GeeSet* _tmp7_; + gint _tmp8_; + gint _tmp9_; + GeeSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeMap* _tmp12_; + GeeSet* _tmp13_; + GeeSet* _tmp14_; + GeeSet* _tmp15_; + gint _tmp16_; + gint _tmp17_; + GeeSet* _tmp18_; + gboolean _tmp19_ = FALSE; + gboolean _tmp20_ = FALSE; + GeeMap* _tmp23_; + GeeSet* _tmp24_; + gint _tmp25_; + gint _tmp26_; + GeeSet* _tmp27_; + gboolean _tmp28_ = FALSE; + GeeSet* _tmp29_; + gboolean _tmp30_ = FALSE; + GeeMap* _tmp31_; + GeeSet* _tmp32_; + GeeSet* _tmp33_; + GeeSet* _tmp34_; + gint _tmp35_; + gint _tmp36_; + GeeSet* _tmp37_; + gboolean _tmp38_ = FALSE; + GeeSet* _tmp39_; + gboolean _tmp40_ = FALSE; + GeeMap* _tmp41_; + GeeSet* _tmp42_; + gint _tmp43_; + gint _tmp44_; + GeeMap* _tmp45_; + GeeSet* _tmp46_; + GeeSet* _tmp47_; + GeeSet* _tmp48_; + gint _tmp49_; + gint _tmp50_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + _tmp1_ = gee_map_get_keys (_tmp0_); + _tmp2_ = _tmp1_; + keys = _tmp2_; + _tmp3_ = keys; + _tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 0, "keys.size == 0"); + _tmp6_ = self->test_map; + gee_map_set (_tmp6_, "one", "value_of_one"); + _tmp7_ = keys; + _tmp8_ = gee_collection_get_size ((GeeCollection*) _tmp7_); + _tmp9_ = _tmp8_; + _vala_assert (_tmp9_ == 1, "keys.size == 1"); + _tmp10_ = keys; + _tmp11_ = gee_collection_contains ((GeeCollection*) _tmp10_, "one"); + _vala_assert (_tmp11_, "keys.contains (\"one\")"); + _tmp12_ = self->test_map; + _tmp13_ = gee_map_get_keys (_tmp12_); + _tmp14_ = _tmp13_; + _g_object_unref0 (keys); + keys = _tmp14_; + _tmp15_ = keys; + _tmp16_ = gee_collection_get_size ((GeeCollection*) _tmp15_); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_ == 1, "keys.size == 1"); + _tmp18_ = keys; + _tmp19_ = gee_collection_contains ((GeeCollection*) _tmp18_, "one"); + _vala_assert (_tmp19_, "keys.contains (\"one\")"); + _tmp20_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp20_) { + GeeSet* _tmp21_; + gboolean _tmp22_ = FALSE; + _tmp21_ = keys; + _tmp22_ = gee_collection_add ((GeeCollection*) _tmp21_, "three"); + _vala_assert (!_tmp22_, "! keys.add (\"three\")"); + exit (0); + } + g_test_trap_assert_failed (); + g_test_trap_assert_stderr ("*code should not be reached*"); + _tmp23_ = self->test_map; + gee_map_set (_tmp23_, "two", "value_of_two"); + _tmp24_ = keys; + _tmp25_ = gee_collection_get_size ((GeeCollection*) _tmp24_); + _tmp26_ = _tmp25_; + _vala_assert (_tmp26_ == 2, "keys.size == 2"); + _tmp27_ = keys; + _tmp28_ = gee_collection_contains ((GeeCollection*) _tmp27_, "one"); + _vala_assert (_tmp28_, "keys.contains (\"one\")"); + _tmp29_ = keys; + _tmp30_ = gee_collection_contains ((GeeCollection*) _tmp29_, "two"); + _vala_assert (_tmp30_, "keys.contains (\"two\")"); + _tmp31_ = self->test_map; + _tmp32_ = gee_map_get_keys (_tmp31_); + _tmp33_ = _tmp32_; + _g_object_unref0 (keys); + keys = _tmp33_; + _tmp34_ = keys; + _tmp35_ = gee_collection_get_size ((GeeCollection*) _tmp34_); + _tmp36_ = _tmp35_; + _vala_assert (_tmp36_ == 2, "keys.size == 2"); + _tmp37_ = keys; + _tmp38_ = gee_collection_contains ((GeeCollection*) _tmp37_, "one"); + _vala_assert (_tmp38_, "keys.contains (\"one\")"); + _tmp39_ = keys; + _tmp40_ = gee_collection_contains ((GeeCollection*) _tmp39_, "two"); + _vala_assert (_tmp40_, "keys.contains (\"two\")"); + _tmp41_ = self->test_map; + gee_map_clear (_tmp41_); + _tmp42_ = keys; + _tmp43_ = gee_collection_get_size ((GeeCollection*) _tmp42_); + _tmp44_ = _tmp43_; + _vala_assert (_tmp44_ == 0, "keys.size == 0"); + _tmp45_ = self->test_map; + _tmp46_ = gee_map_get_keys (_tmp45_); + _tmp47_ = _tmp46_; + _g_object_unref0 (keys); + keys = _tmp47_; + _tmp48_ = keys; + _tmp49_ = gee_collection_get_size ((GeeCollection*) _tmp48_); + _tmp50_ = _tmp49_; + _vala_assert (_tmp50_ == 0, "keys.size == 0"); + _g_object_unref0 (keys); +} + + +void map_tests_test_values (MapTests* self) { + GeeMap* _tmp0_; + GeeCollection* _tmp1_; + GeeCollection* _tmp2_; + GeeCollection* values; + GeeCollection* _tmp3_; + gint _tmp4_; + gint _tmp5_; + GeeMap* _tmp6_; + GeeCollection* _tmp7_; + gint _tmp8_; + gint _tmp9_; + GeeCollection* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeMap* _tmp12_; + GeeCollection* _tmp13_; + GeeCollection* _tmp14_; + GeeCollection* _tmp15_; + gint _tmp16_; + gint _tmp17_; + GeeCollection* _tmp18_; + gboolean _tmp19_ = FALSE; + gboolean _tmp20_ = FALSE; + GeeMap* _tmp23_; + GeeCollection* _tmp24_; + gint _tmp25_; + gint _tmp26_; + GeeCollection* _tmp27_; + gboolean _tmp28_ = FALSE; + GeeCollection* _tmp29_; + gboolean _tmp30_ = FALSE; + GeeMap* _tmp31_; + GeeCollection* _tmp32_; + GeeCollection* _tmp33_; + GeeCollection* _tmp34_; + gint _tmp35_; + gint _tmp36_; + GeeCollection* _tmp37_; + gboolean _tmp38_ = FALSE; + GeeCollection* _tmp39_; + gboolean _tmp40_ = FALSE; + GeeMap* _tmp41_; + GeeCollection* _tmp42_; + gint _tmp43_; + gint _tmp44_; + GeeMap* _tmp45_; + GeeCollection* _tmp46_; + GeeCollection* _tmp47_; + GeeCollection* _tmp48_; + gint _tmp49_; + gint _tmp50_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + _tmp1_ = gee_map_get_values (_tmp0_); + _tmp2_ = _tmp1_; + values = _tmp2_; + _tmp3_ = values; + _tmp4_ = gee_collection_get_size (_tmp3_); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 0, "values.size == 0"); + _tmp6_ = self->test_map; + gee_map_set (_tmp6_, "one", "value_of_one"); + _tmp7_ = values; + _tmp8_ = gee_collection_get_size (_tmp7_); + _tmp9_ = _tmp8_; + _vala_assert (_tmp9_ == 1, "values.size == 1"); + _tmp10_ = values; + _tmp11_ = gee_collection_contains (_tmp10_, "value_of_one"); + _vala_assert (_tmp11_, "values.contains (\"value_of_one\")"); + _tmp12_ = self->test_map; + _tmp13_ = gee_map_get_values (_tmp12_); + _tmp14_ = _tmp13_; + _g_object_unref0 (values); + values = _tmp14_; + _tmp15_ = values; + _tmp16_ = gee_collection_get_size (_tmp15_); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_ == 1, "values.size == 1"); + _tmp18_ = values; + _tmp19_ = gee_collection_contains (_tmp18_, "value_of_one"); + _vala_assert (_tmp19_, "values.contains (\"value_of_one\")"); + _tmp20_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp20_) { + GeeCollection* _tmp21_; + gboolean _tmp22_ = FALSE; + _tmp21_ = values; + _tmp22_ = gee_collection_add (_tmp21_, "two"); + _vala_assert (!_tmp22_, "! values.add (\"two\")"); + exit (0); + } + g_test_trap_assert_failed (); + g_test_trap_assert_stderr ("*code should not be reached*"); + _tmp23_ = self->test_map; + gee_map_set (_tmp23_, "two", "value_of_two"); + _tmp24_ = values; + _tmp25_ = gee_collection_get_size (_tmp24_); + _tmp26_ = _tmp25_; + _vala_assert (_tmp26_ == 2, "values.size == 2"); + _tmp27_ = values; + _tmp28_ = gee_collection_contains (_tmp27_, "value_of_one"); + _vala_assert (_tmp28_, "values.contains (\"value_of_one\")"); + _tmp29_ = values; + _tmp30_ = gee_collection_contains (_tmp29_, "value_of_two"); + _vala_assert (_tmp30_, "values.contains (\"value_of_two\")"); + _tmp31_ = self->test_map; + _tmp32_ = gee_map_get_values (_tmp31_); + _tmp33_ = _tmp32_; + _g_object_unref0 (values); + values = _tmp33_; + _tmp34_ = values; + _tmp35_ = gee_collection_get_size (_tmp34_); + _tmp36_ = _tmp35_; + _vala_assert (_tmp36_ == 2, "values.size == 2"); + _tmp37_ = values; + _tmp38_ = gee_collection_contains (_tmp37_, "value_of_one"); + _vala_assert (_tmp38_, "values.contains (\"value_of_one\")"); + _tmp39_ = values; + _tmp40_ = gee_collection_contains (_tmp39_, "value_of_two"); + _vala_assert (_tmp40_, "values.contains (\"value_of_two\")"); + _tmp41_ = self->test_map; + gee_map_clear (_tmp41_); + _tmp42_ = values; + _tmp43_ = gee_collection_get_size (_tmp42_); + _tmp44_ = _tmp43_; + _vala_assert (_tmp44_ == 0, "values.size == 0"); + _tmp45_ = self->test_map; + _tmp46_ = gee_map_get_values (_tmp45_); + _tmp47_ = _tmp46_; + _g_object_unref0 (values); + values = _tmp47_; + _tmp48_ = values; + _tmp49_ = gee_collection_get_size (_tmp48_); + _tmp50_ = _tmp49_; + _vala_assert (_tmp50_ == 0, "values.size == 0"); + _g_object_unref0 (values); +} + + +void map_tests_test_entries (MapTests* self) { + GeeMap* _tmp0_; + GeeSet* _tmp1_; + GeeSet* _tmp2_; + GeeSet* entries; + GeeSet* _tmp3_; + gint _tmp4_; + gint _tmp5_; + GeeMap* _tmp6_; + GeeSet* _tmp7_; + gint _tmp8_; + gint _tmp9_; + GeeSet* _tmp10_; + MapTestsTestEntry* _tmp11_; + MapTestsTestEntry* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeMap* _tmp14_; + GeeSet* _tmp15_; + GeeSet* _tmp16_; + GeeSet* _tmp17_; + gint _tmp18_; + gint _tmp19_; + GeeSet* _tmp20_; + MapTestsTestEntry* _tmp21_; + MapTestsTestEntry* _tmp22_; + gboolean _tmp23_ = FALSE; + gboolean _tmp24_ = FALSE; + GeeMap* _tmp29_; + GeeSet* _tmp30_; + gint _tmp31_; + gint _tmp32_; + GeeSet* _tmp33_; + MapTestsTestEntry* _tmp34_; + MapTestsTestEntry* _tmp35_; + gboolean _tmp36_ = FALSE; + GeeSet* _tmp37_; + MapTestsTestEntry* _tmp38_; + MapTestsTestEntry* _tmp39_; + gboolean _tmp40_ = FALSE; + GeeMap* _tmp41_; + GeeSet* _tmp42_; + GeeSet* _tmp43_; + GeeSet* _tmp44_; + gint _tmp45_; + gint _tmp46_; + GeeSet* _tmp47_; + MapTestsTestEntry* _tmp48_; + MapTestsTestEntry* _tmp49_; + gboolean _tmp50_ = FALSE; + GeeSet* _tmp51_; + MapTestsTestEntry* _tmp52_; + MapTestsTestEntry* _tmp53_; + gboolean _tmp54_ = FALSE; + GeeMap* _tmp55_; + GeeSet* _tmp56_; + gint _tmp57_; + gint _tmp58_; + GeeMap* _tmp59_; + GeeSet* _tmp60_; + GeeSet* _tmp61_; + GeeSet* _tmp62_; + gint _tmp63_; + gint _tmp64_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + _tmp1_ = gee_map_get_entries (_tmp0_); + _tmp2_ = _tmp1_; + entries = _tmp2_; + _tmp3_ = entries; + _tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 0, "entries.size == 0"); + _tmp6_ = self->test_map; + gee_map_set (_tmp6_, "one", "value_of_one"); + _tmp7_ = entries; + _tmp8_ = gee_collection_get_size ((GeeCollection*) _tmp7_); + _tmp9_ = _tmp8_; + _vala_assert (_tmp9_ == 1, "entries.size == 1"); + _tmp10_ = entries; + _tmp11_ = map_tests_test_entry_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, "one", "value_of_one"); + _tmp12_ = _tmp11_; + _tmp13_ = gee_collection_contains ((GeeCollection*) _tmp10_, (GeeMapEntry*) _tmp12_); + _vala_assert (_tmp13_, "entries.contains (new TestEntry (\"one\", \"value_of_one\"))"); + _g_object_unref0 (_tmp12_); + _tmp14_ = self->test_map; + _tmp15_ = gee_map_get_entries (_tmp14_); + _tmp16_ = _tmp15_; + _g_object_unref0 (entries); + entries = _tmp16_; + _tmp17_ = entries; + _tmp18_ = gee_collection_get_size ((GeeCollection*) _tmp17_); + _tmp19_ = _tmp18_; + _vala_assert (_tmp19_ == 1, "entries.size == 1"); + _tmp20_ = entries; + _tmp21_ = map_tests_test_entry_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, "one", "value_of_one"); + _tmp22_ = _tmp21_; + _tmp23_ = gee_collection_contains ((GeeCollection*) _tmp20_, (GeeMapEntry*) _tmp22_); + _vala_assert (_tmp23_, "entries.contains (new TestEntry (\"one\", \"value_of_one\"))"); + _g_object_unref0 (_tmp22_); + _tmp24_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp24_) { + GeeSet* _tmp25_; + MapTestsTestEntry* _tmp26_; + MapTestsTestEntry* _tmp27_; + gboolean _tmp28_ = FALSE; + _tmp25_ = entries; + _tmp26_ = map_tests_test_entry_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, "two", "value_of_two"); + _tmp27_ = _tmp26_; + _tmp28_ = gee_collection_add ((GeeCollection*) _tmp25_, (GeeMapEntry*) _tmp27_); + _vala_assert (!_tmp28_, "! entries.add (new TestEntry (\"two\", \"value_of_two\"))"); + _g_object_unref0 (_tmp27_); + exit (0); + } + g_test_trap_assert_failed (); + g_test_trap_assert_stderr ("*code should not be reached*"); + _tmp29_ = self->test_map; + gee_map_set (_tmp29_, "two", "value_of_two"); + _tmp30_ = entries; + _tmp31_ = gee_collection_get_size ((GeeCollection*) _tmp30_); + _tmp32_ = _tmp31_; + _vala_assert (_tmp32_ == 2, "entries.size == 2"); + _tmp33_ = entries; + _tmp34_ = map_tests_test_entry_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, "one", "value_of_one"); + _tmp35_ = _tmp34_; + _tmp36_ = gee_collection_contains ((GeeCollection*) _tmp33_, (GeeMapEntry*) _tmp35_); + _vala_assert (_tmp36_, "entries.contains (new TestEntry (\"one\", \"value_of_one\"))"); + _g_object_unref0 (_tmp35_); + _tmp37_ = entries; + _tmp38_ = map_tests_test_entry_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, "two", "value_of_two"); + _tmp39_ = _tmp38_; + _tmp40_ = gee_collection_contains ((GeeCollection*) _tmp37_, (GeeMapEntry*) _tmp39_); + _vala_assert (_tmp40_, "entries.contains (new TestEntry (\"two\", \"value_of_two\"))"); + _g_object_unref0 (_tmp39_); + _tmp41_ = self->test_map; + _tmp42_ = gee_map_get_entries (_tmp41_); + _tmp43_ = _tmp42_; + _g_object_unref0 (entries); + entries = _tmp43_; + _tmp44_ = entries; + _tmp45_ = gee_collection_get_size ((GeeCollection*) _tmp44_); + _tmp46_ = _tmp45_; + _vala_assert (_tmp46_ == 2, "entries.size == 2"); + _tmp47_ = entries; + _tmp48_ = map_tests_test_entry_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, "one", "value_of_one"); + _tmp49_ = _tmp48_; + _tmp50_ = gee_collection_contains ((GeeCollection*) _tmp47_, (GeeMapEntry*) _tmp49_); + _vala_assert (_tmp50_, "entries.contains (new TestEntry (\"one\", \"value_of_one\"))"); + _g_object_unref0 (_tmp49_); + _tmp51_ = entries; + _tmp52_ = map_tests_test_entry_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, "two", "value_of_two"); + _tmp53_ = _tmp52_; + _tmp54_ = gee_collection_contains ((GeeCollection*) _tmp51_, (GeeMapEntry*) _tmp53_); + _vala_assert (_tmp54_, "entries.contains (new TestEntry (\"two\", \"value_of_two\"))"); + _g_object_unref0 (_tmp53_); + _tmp55_ = self->test_map; + gee_map_clear (_tmp55_); + _tmp56_ = entries; + _tmp57_ = gee_collection_get_size ((GeeCollection*) _tmp56_); + _tmp58_ = _tmp57_; + _vala_assert (_tmp58_ == 0, "entries.size == 0"); + _tmp59_ = self->test_map; + _tmp60_ = gee_map_get_entries (_tmp59_); + _tmp61_ = _tmp60_; + _g_object_unref0 (entries); + entries = _tmp61_; + _tmp62_ = entries; + _tmp63_ = gee_collection_get_size ((GeeCollection*) _tmp62_); + _tmp64_ = _tmp63_; + _vala_assert (_tmp64_ == 0, "entries.size == 0"); + _g_object_unref0 (entries); +} + + +void map_tests_test_clear (MapTests* self) { + GeeMap* _tmp0_; + GeeMap* _tmp1_; + GeeMap* _tmp2_; + GeeMap* _tmp3_; + GeeMap* _tmp4_; + gint _tmp5_; + gint _tmp6_; + GeeMap* _tmp7_; + GeeSet* _tmp8_; + GeeSet* _tmp9_; + GeeSet* keys; + GeeIterator* _tmp10_ = NULL; + GeeIterator* ikeys; + gboolean _tmp11_ = FALSE; + GeeMap* _tmp12_; + GeeCollection* _tmp13_; + GeeCollection* _tmp14_; + GeeCollection* vals; + GeeIterator* _tmp15_ = NULL; + GeeIterator* ivals; + gboolean _tmp16_ = FALSE; + GeeMap* _tmp17_; + GeeSet* _tmp18_; + GeeSet* _tmp19_; + GeeSet* ents; + GeeIterator* _tmp20_ = NULL; + GeeIterator* ients; + gboolean _tmp21_ = FALSE; + GeeMap* _tmp22_; + GeeMapIterator* _tmp23_ = NULL; + GeeMapIterator* iter; + gboolean _tmp24_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + gee_map_set (_tmp0_, "one", "value_of_one"); + _tmp1_ = self->test_map; + gee_map_set (_tmp1_, "two", "value_of_two"); + _tmp2_ = self->test_map; + gee_map_set (_tmp2_, "three", "value_of_three"); + _tmp3_ = self->test_map; + gee_map_clear (_tmp3_); + _tmp4_ = self->test_map; + _tmp5_ = gee_map_get_size (_tmp4_); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_ == 0, "test_map.size == 0"); + _tmp7_ = self->test_map; + _tmp8_ = gee_map_get_keys (_tmp7_); + _tmp9_ = _tmp8_; + keys = _tmp9_; + _vala_assert (keys != NULL, "keys != null"); + _tmp10_ = gee_iterable_iterator ((GeeIterable*) keys); + ikeys = _tmp10_; + _vala_assert (ikeys != NULL, "ikeys != null"); + _tmp11_ = gee_iterator_has_next (ikeys); + _vala_assert (!_tmp11_, "!ikeys.has_next ()"); + _tmp12_ = self->test_map; + _tmp13_ = gee_map_get_values (_tmp12_); + _tmp14_ = _tmp13_; + vals = _tmp14_; + _vala_assert (vals != NULL, "vals != null"); + _tmp15_ = gee_iterable_iterator ((GeeIterable*) vals); + ivals = _tmp15_; + _vala_assert (ivals != NULL, "ivals != null"); + _tmp16_ = gee_iterator_has_next (ivals); + _vala_assert (!_tmp16_, "!ivals.has_next ()"); + _tmp17_ = self->test_map; + _tmp18_ = gee_map_get_entries (_tmp17_); + _tmp19_ = _tmp18_; + ents = _tmp19_; + _vala_assert (ents != NULL, "ents != null"); + _tmp20_ = gee_iterable_iterator ((GeeIterable*) ents); + ients = _tmp20_; + _vala_assert (ients != NULL, "ients != null"); + _tmp21_ = gee_iterator_has_next (ients); + _vala_assert (!_tmp21_, "!ients.has_next ()"); + _tmp22_ = self->test_map; + _tmp23_ = gee_map_map_iterator (_tmp22_); + iter = _tmp23_; + _vala_assert (iter != NULL, "iter != null"); + _tmp24_ = gee_map_iterator_has_next (iter); + _vala_assert (!_tmp24_, "!iter.has_next ()"); + _g_object_unref0 (iter); + _g_object_unref0 (ients); + _g_object_unref0 (ents); + _g_object_unref0 (ivals); + _g_object_unref0 (vals); + _g_object_unref0 (ikeys); + _g_object_unref0 (keys); +} + + +void map_tests_test_set_all (MapTests* self) { + GHashFunc _tmp0_; + GEqualFunc _tmp1_; + GEqualFunc _tmp2_; + GeeHashMap* _tmp3_; + GeeHashMap* another_map; + GeeMap* _tmp4_; + GeeMap* _tmp5_; + GeeMap* _tmp6_; + GeeMap* _tmp7_; + GeeMap* _tmp8_; + gint _tmp9_; + gint _tmp10_; + GeeMap* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeMap* _tmp13_; + gboolean _tmp14_ = FALSE; + GeeMap* _tmp15_; + gboolean _tmp16_ = FALSE; + GeeMap* _tmp17_; + gboolean _tmp18_ = FALSE; + GeeMap* _tmp19_; + gboolean _tmp20_ = FALSE; + GeeMap* _tmp21_; + gboolean _tmp22_ = FALSE; + GeeMap* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + GeeMap* _tmp26_; + gpointer _tmp27_ = NULL; + gchar* _tmp28_; + GeeMap* _tmp29_; + gpointer _tmp30_ = NULL; + gchar* _tmp31_; + GeeMap* _tmp32_; + gpointer _tmp33_ = NULL; + gchar* _tmp34_; + GeeMap* _tmp35_; + gpointer _tmp36_ = NULL; + gchar* _tmp37_; + GeeMap* _tmp38_; + gpointer _tmp39_ = NULL; + gchar* _tmp40_; + g_return_if_fail (self != NULL); + _tmp0_ = g_str_hash; + _tmp1_ = g_str_equal; + _tmp2_ = g_str_equal; + _tmp3_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, _tmp0_, _tmp1_, _tmp2_); + another_map = _tmp3_; + _tmp4_ = self->test_map; + gee_map_set (_tmp4_, "one", "value_of_one"); + _tmp5_ = self->test_map; + gee_map_set (_tmp5_, "two", "value_of_two"); + _tmp6_ = self->test_map; + gee_map_set (_tmp6_, "three", "value_of_three"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "four", "value_of_four"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "five", "value_of_five"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "six", "value_of_six"); + _tmp7_ = self->test_map; + gee_map_set_all (_tmp7_, (GeeMap*) another_map); + _tmp8_ = self->test_map; + _tmp9_ = gee_map_get_size (_tmp8_); + _tmp10_ = _tmp9_; + _vala_assert (_tmp10_ == 6, "test_map.size == 6"); + _tmp11_ = self->test_map; + _tmp12_ = gee_map_has_key (_tmp11_, "one"); + _vala_assert (_tmp12_, "test_map.has_key (\"one\")"); + _tmp13_ = self->test_map; + _tmp14_ = gee_map_has_key (_tmp13_, "two"); + _vala_assert (_tmp14_, "test_map.has_key (\"two\")"); + _tmp15_ = self->test_map; + _tmp16_ = gee_map_has_key (_tmp15_, "three"); + _vala_assert (_tmp16_, "test_map.has_key (\"three\")"); + _tmp17_ = self->test_map; + _tmp18_ = gee_map_has_key (_tmp17_, "four"); + _vala_assert (_tmp18_, "test_map.has_key (\"four\")"); + _tmp19_ = self->test_map; + _tmp20_ = gee_map_has_key (_tmp19_, "five"); + _vala_assert (_tmp20_, "test_map.has_key (\"five\")"); + _tmp21_ = self->test_map; + _tmp22_ = gee_map_has_key (_tmp21_, "six"); + _vala_assert (_tmp22_, "test_map.has_key (\"six\")"); + _tmp23_ = self->test_map; + _tmp24_ = gee_map_get (_tmp23_, "one"); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "value_of_one") == 0, "test_map.get (\"one\") == \"value_of_one\""); + _g_free0 (_tmp25_); + _tmp26_ = self->test_map; + _tmp27_ = gee_map_get (_tmp26_, "two"); + _tmp28_ = (gchar*) _tmp27_; + _vala_assert (g_strcmp0 (_tmp28_, "value_of_two") == 0, "test_map.get (\"two\") == \"value_of_two\""); + _g_free0 (_tmp28_); + _tmp29_ = self->test_map; + _tmp30_ = gee_map_get (_tmp29_, "three"); + _tmp31_ = (gchar*) _tmp30_; + _vala_assert (g_strcmp0 (_tmp31_, "value_of_three") == 0, "test_map.get (\"three\") == \"value_of_three\""); + _g_free0 (_tmp31_); + _tmp32_ = self->test_map; + _tmp33_ = gee_map_get (_tmp32_, "four"); + _tmp34_ = (gchar*) _tmp33_; + _vala_assert (g_strcmp0 (_tmp34_, "value_of_four") == 0, "test_map.get (\"four\") == \"value_of_four\""); + _g_free0 (_tmp34_); + _tmp35_ = self->test_map; + _tmp36_ = gee_map_get (_tmp35_, "five"); + _tmp37_ = (gchar*) _tmp36_; + _vala_assert (g_strcmp0 (_tmp37_, "value_of_five") == 0, "test_map.get (\"five\") == \"value_of_five\""); + _g_free0 (_tmp37_); + _tmp38_ = self->test_map; + _tmp39_ = gee_map_get (_tmp38_, "six"); + _tmp40_ = (gchar*) _tmp39_; + _vala_assert (g_strcmp0 (_tmp40_, "value_of_six") == 0, "test_map.get (\"six\") == \"value_of_six\""); + _g_free0 (_tmp40_); + _g_object_unref0 (another_map); +} + + +void map_tests_test_unset_all (MapTests* self) { + GHashFunc _tmp0_; + GEqualFunc _tmp1_; + GEqualFunc _tmp2_; + GeeHashMap* _tmp3_; + GeeHashMap* another_map; + GeeMap* _tmp4_; + gboolean _tmp5_; + gboolean _tmp6_; + gboolean _tmp7_; + gboolean _tmp8_; + GeeMap* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeMap* _tmp11_; + gboolean _tmp12_; + gboolean _tmp13_; + gboolean _tmp14_; + gboolean _tmp15_; + GeeMap* _tmp16_; + GeeMap* _tmp17_; + gboolean _tmp18_; + gboolean _tmp19_; + gint _tmp20_; + gint _tmp21_; + GeeMap* _tmp22_; + gboolean _tmp23_ = FALSE; + GeeMap* _tmp24_; + gboolean _tmp25_; + gboolean _tmp26_; + gint _tmp27_; + gint _tmp28_; + GeeMap* _tmp29_; + GeeMap* _tmp30_; + GeeMap* _tmp31_; + GeeMap* _tmp32_; + gint _tmp33_; + gint _tmp34_; + gboolean _tmp35_; + gboolean _tmp36_; + GeeMap* _tmp37_; + gboolean _tmp38_ = FALSE; + GeeMap* _tmp39_; + gint _tmp40_; + gint _tmp41_; + gboolean _tmp42_; + gboolean _tmp43_; + GeeMap* _tmp44_; + GeeMap* _tmp45_; + GeeMap* _tmp46_; + GeeMap* _tmp47_; + gint _tmp48_; + gint _tmp49_; + gint _tmp50_; + gint _tmp51_; + GeeMap* _tmp52_; + gboolean _tmp53_ = FALSE; + GeeMap* _tmp54_; + gboolean _tmp55_; + gboolean _tmp56_; + gint _tmp57_; + gint _tmp58_; + GeeMap* _tmp59_; + GeeMap* _tmp60_; + GeeMap* _tmp61_; + GeeMap* _tmp62_; + GeeMap* _tmp63_; + gint _tmp64_; + gint _tmp65_; + gint _tmp66_; + gint _tmp67_; + GeeMap* _tmp68_; + gboolean _tmp69_ = FALSE; + GeeMap* _tmp70_; + gint _tmp71_; + gint _tmp72_; + gint _tmp73_; + gint _tmp74_; + GeeMap* _tmp75_; + gboolean _tmp76_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = g_str_hash; + _tmp1_ = g_str_equal; + _tmp2_ = g_str_equal; + _tmp3_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, _tmp0_, _tmp1_, _tmp2_); + another_map = _tmp3_; + _tmp4_ = self->test_map; + _tmp5_ = gee_map_get_is_empty (_tmp4_); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_, "test_map.is_empty"); + _tmp7_ = gee_abstract_map_get_is_empty ((GeeAbstractMap*) another_map); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_, "another_map.is_empty"); + _tmp9_ = self->test_map; + _tmp10_ = gee_map_unset_all (_tmp9_, (GeeMap*) another_map); + _vala_assert (!_tmp10_, "! test_map.unset_all (another_map)"); + _tmp11_ = self->test_map; + _tmp12_ = gee_map_get_is_empty (_tmp11_); + _tmp13_ = _tmp12_; + _vala_assert (_tmp13_, "test_map.is_empty"); + _tmp14_ = gee_abstract_map_get_is_empty ((GeeAbstractMap*) another_map); + _tmp15_ = _tmp14_; + _vala_assert (_tmp15_, "another_map.is_empty"); + _tmp16_ = self->test_map; + gee_map_clear (_tmp16_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "one", "value_of_one"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "two", "value_of_two"); + _tmp17_ = self->test_map; + _tmp18_ = gee_map_get_is_empty (_tmp17_); + _tmp19_ = _tmp18_; + _vala_assert (_tmp19_, "test_map.is_empty"); + _tmp20_ = gee_abstract_map_get_size ((GeeMap*) another_map); + _tmp21_ = _tmp20_; + _vala_assert (_tmp21_ == 2, "another_map.size == 2"); + _tmp22_ = self->test_map; + _tmp23_ = gee_map_unset_all (_tmp22_, (GeeMap*) another_map); + _vala_assert (!_tmp23_, "! test_map.unset_all (another_map)"); + _tmp24_ = self->test_map; + _tmp25_ = gee_map_get_is_empty (_tmp24_); + _tmp26_ = _tmp25_; + _vala_assert (_tmp26_, "test_map.is_empty"); + _tmp27_ = gee_abstract_map_get_size ((GeeMap*) another_map); + _tmp28_ = _tmp27_; + _vala_assert (_tmp28_ == 2, "another_map.size == 2"); + _tmp29_ = self->test_map; + gee_map_clear (_tmp29_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + _tmp30_ = self->test_map; + gee_map_set (_tmp30_, "one", "value_of_one"); + _tmp31_ = self->test_map; + gee_map_set (_tmp31_, "two", "value_of_two"); + _tmp32_ = self->test_map; + _tmp33_ = gee_map_get_size (_tmp32_); + _tmp34_ = _tmp33_; + _vala_assert (_tmp34_ == 2, "test_map.size == 2"); + _tmp35_ = gee_abstract_map_get_is_empty ((GeeAbstractMap*) another_map); + _tmp36_ = _tmp35_; + _vala_assert (_tmp36_, "another_map.is_empty"); + _tmp37_ = self->test_map; + _tmp38_ = gee_map_unset_all (_tmp37_, (GeeMap*) another_map); + _vala_assert (!_tmp38_, "! test_map.unset_all (another_map)"); + _tmp39_ = self->test_map; + _tmp40_ = gee_map_get_size (_tmp39_); + _tmp41_ = _tmp40_; + _vala_assert (_tmp41_ == 2, "test_map.size == 2"); + _tmp42_ = gee_abstract_map_get_is_empty ((GeeAbstractMap*) another_map); + _tmp43_ = _tmp42_; + _vala_assert (_tmp43_, "another_map.is_empty"); + _tmp44_ = self->test_map; + gee_map_clear (_tmp44_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + _tmp45_ = self->test_map; + gee_map_set (_tmp45_, "one", "value_of_one"); + _tmp46_ = self->test_map; + gee_map_set (_tmp46_, "two", "value_of_two"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "one", "value_of_one"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "two", "value_of_two"); + _tmp47_ = self->test_map; + _tmp48_ = gee_map_get_size (_tmp47_); + _tmp49_ = _tmp48_; + _vala_assert (_tmp49_ == 2, "test_map.size == 2"); + _tmp50_ = gee_abstract_map_get_size ((GeeMap*) another_map); + _tmp51_ = _tmp50_; + _vala_assert (_tmp51_ == 2, "another_map.size == 2"); + _tmp52_ = self->test_map; + _tmp53_ = gee_map_unset_all (_tmp52_, (GeeMap*) another_map); + _vala_assert (_tmp53_, "test_map.unset_all (another_map)"); + _tmp54_ = self->test_map; + _tmp55_ = gee_map_get_is_empty (_tmp54_); + _tmp56_ = _tmp55_; + _vala_assert (_tmp56_, "test_map.is_empty"); + _tmp57_ = gee_abstract_map_get_size ((GeeMap*) another_map); + _tmp58_ = _tmp57_; + _vala_assert (_tmp58_ == 2, "another_map.size == 2"); + _tmp59_ = self->test_map; + gee_map_clear (_tmp59_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + _tmp60_ = self->test_map; + gee_map_set (_tmp60_, "one", "value_of_one"); + _tmp61_ = self->test_map; + gee_map_set (_tmp61_, "two", "value_of_two"); + _tmp62_ = self->test_map; + gee_map_set (_tmp62_, "three", "value_of_three"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "two", "value_of_two"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "three", "value_of_three"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "four", "value_of_four"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "five", "value_of_five"); + _tmp63_ = self->test_map; + _tmp64_ = gee_map_get_size (_tmp63_); + _tmp65_ = _tmp64_; + _vala_assert (_tmp65_ == 3, "test_map.size == 3"); + _tmp66_ = gee_abstract_map_get_size ((GeeMap*) another_map); + _tmp67_ = _tmp66_; + _vala_assert (_tmp67_ == 4, "another_map.size == 4"); + _tmp68_ = self->test_map; + _tmp69_ = gee_map_unset_all (_tmp68_, (GeeMap*) another_map); + _vala_assert (_tmp69_, "test_map.unset_all (another_map)"); + _tmp70_ = self->test_map; + _tmp71_ = gee_map_get_size (_tmp70_); + _tmp72_ = _tmp71_; + _vala_assert (_tmp72_ == 1, "test_map.size == 1"); + _tmp73_ = gee_abstract_map_get_size ((GeeMap*) another_map); + _tmp74_ = _tmp73_; + _vala_assert (_tmp74_ == 4, "another_map.size == 4"); + _tmp75_ = self->test_map; + _tmp76_ = gee_map_has_key (_tmp75_, "one"); + _vala_assert (_tmp76_, "test_map.has_key (\"one\")"); + _g_object_unref0 (another_map); +} + + +void map_tests_test_has_all (MapTests* self) { + GHashFunc _tmp0_; + GEqualFunc _tmp1_; + GEqualFunc _tmp2_; + GeeHashMap* _tmp3_; + GeeHashMap* another_map; + GeeMap* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeMap* _tmp6_; + GeeMap* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeMap* _tmp9_; + GeeMap* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeMap* _tmp12_; + GeeMap* _tmp13_; + GeeMap* _tmp14_; + GeeMap* _tmp15_; + gboolean _tmp16_ = FALSE; + GeeMap* _tmp17_; + GeeMap* _tmp18_; + GeeMap* _tmp19_; + GeeMap* _tmp20_; + gboolean _tmp21_ = FALSE; + GeeMap* _tmp22_; + GeeMap* _tmp23_; + GeeMap* _tmp24_; + gboolean _tmp25_ = FALSE; + GeeMap* _tmp26_; + GeeMap* _tmp27_; + GeeMap* _tmp28_; + GeeMap* _tmp29_; + GeeMap* _tmp30_; + GeeMap* _tmp31_; + GeeMap* _tmp32_; + GeeMap* _tmp33_; + gboolean _tmp34_ = FALSE; + GeeMap* _tmp35_; + GeeMap* _tmp36_; + GeeMap* _tmp37_; + GeeMap* _tmp38_; + GeeMap* _tmp39_; + GeeMap* _tmp40_; + GeeMap* _tmp41_; + GeeMap* _tmp42_; + gboolean _tmp43_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = g_str_hash; + _tmp1_ = g_str_equal; + _tmp2_ = g_str_equal; + _tmp3_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, _tmp0_, _tmp1_, _tmp2_); + another_map = _tmp3_; + _tmp4_ = self->test_map; + _tmp5_ = gee_map_has_all (_tmp4_, (GeeMap*) another_map); + _vala_assert (_tmp5_, "test_map.has_all (another_map)"); + _tmp6_ = self->test_map; + gee_map_set (_tmp6_, "one", "value_of_one"); + _tmp7_ = self->test_map; + _tmp8_ = gee_map_has_all (_tmp7_, (GeeMap*) another_map); + _vala_assert (_tmp8_, "test_map.has_all (another_map)"); + _tmp9_ = self->test_map; + gee_map_clear (_tmp9_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "one", "value_of_one"); + _tmp10_ = self->test_map; + _tmp11_ = gee_map_has_all (_tmp10_, (GeeMap*) another_map); + _vala_assert (!_tmp11_, "! test_map.has_all (another_map)"); + _tmp12_ = self->test_map; + gee_map_clear (_tmp12_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + _tmp13_ = self->test_map; + gee_map_set (_tmp13_, "one", "value_of_one"); + _tmp14_ = self->test_map; + gee_map_set (_tmp14_, "two", "value_of_two"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "one", "value_of_one"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "two", "value_of_two"); + _tmp15_ = self->test_map; + _tmp16_ = gee_map_has_all (_tmp15_, (GeeMap*) another_map); + _vala_assert (_tmp16_, "test_map.has_all (another_map)"); + _tmp17_ = self->test_map; + gee_map_clear (_tmp17_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + _tmp18_ = self->test_map; + gee_map_set (_tmp18_, "one", "value_of_one"); + _tmp19_ = self->test_map; + gee_map_set (_tmp19_, "two", "value_of_two"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "one", "another_value_of_one"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "two", "another_value_of_two"); + _tmp20_ = self->test_map; + _tmp21_ = gee_map_has_all (_tmp20_, (GeeMap*) another_map); + _vala_assert (!_tmp21_, "! test_map.has_all (another_map)"); + _tmp22_ = self->test_map; + gee_map_clear (_tmp22_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + _tmp23_ = self->test_map; + gee_map_set (_tmp23_, "one", "value_of_one"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "two", "value_of_two"); + _tmp24_ = self->test_map; + _tmp25_ = gee_map_has_all (_tmp24_, (GeeMap*) another_map); + _vala_assert (!_tmp25_, "! test_map.has_all (another_map)"); + _tmp26_ = self->test_map; + gee_map_clear (_tmp26_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + _tmp27_ = self->test_map; + gee_map_set (_tmp27_, "one", "value_of_one"); + _tmp28_ = self->test_map; + gee_map_set (_tmp28_, "two", "value_of_two"); + _tmp29_ = self->test_map; + gee_map_set (_tmp29_, "three", "value_of_three"); + _tmp30_ = self->test_map; + gee_map_set (_tmp30_, "four", "value_of_four"); + _tmp31_ = self->test_map; + gee_map_set (_tmp31_, "five", "value_of_five"); + _tmp32_ = self->test_map; + gee_map_set (_tmp32_, "six", "value_of_six"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "two", "value_of_two"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "three", "value_of_three"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "four", "value_of_four"); + _tmp33_ = self->test_map; + _tmp34_ = gee_map_has_all (_tmp33_, (GeeMap*) another_map); + _vala_assert (_tmp34_, "test_map.has_all (another_map)"); + _tmp35_ = self->test_map; + gee_map_clear (_tmp35_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + _tmp36_ = self->test_map; + gee_map_set (_tmp36_, "one", "value_of_one"); + _tmp37_ = self->test_map; + gee_map_set (_tmp37_, "two", "value_of_two"); + _tmp38_ = self->test_map; + gee_map_set (_tmp38_, "three", "value_of_three"); + _tmp39_ = self->test_map; + gee_map_set (_tmp39_, "four", "value_of_four"); + _tmp40_ = self->test_map; + gee_map_set (_tmp40_, "five", "value_of_five"); + _tmp41_ = self->test_map; + gee_map_set (_tmp41_, "six", "value_of_six"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "two", "value_of_two"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "three", "value_of_three"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "four", "value_of_four"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "height", "value_of_height"); + _tmp42_ = self->test_map; + _tmp43_ = gee_map_has_all (_tmp42_, (GeeMap*) another_map); + _vala_assert (!_tmp43_, "! test_map.has_all (another_map)"); + _g_object_unref0 (another_map); +} + + +void map_tests_test_gobject_properties (MapTests* self) { + GeeMap* _tmp0_; + GValue value = {0}; + GValue _tmp1_ = {0}; + GValue _tmp2_; + GeeMap* _tmp3_; + gboolean _tmp4_ = FALSE; + GeeMap* _tmp5_; + gboolean _tmp6_; + gboolean _tmp7_; + GValue _tmp8_ = {0}; + GValue _tmp9_; + GeeMap* _tmp10_; + gint _tmp11_ = 0; + GeeMap* _tmp12_; + gint _tmp13_; + gint _tmp14_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + _vala_assert (_tmp0_ != NULL, "test_map != null"); + g_value_init (&_tmp1_, G_TYPE_BOOLEAN); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp1_; + _tmp2_ = value; + _tmp3_ = self->test_map; + g_object_get_property ((GObject*) _tmp3_, "is-empty", &value); + _tmp4_ = g_value_get_boolean (&value); + _tmp5_ = self->test_map; + _tmp6_ = gee_map_get_is_empty (_tmp5_); + _tmp7_ = _tmp6_; + _vala_assert (_tmp4_ == _tmp7_, "value.get_boolean () == test_map.is_empty"); + g_value_unset (&value); + g_value_init (&_tmp8_, G_TYPE_INT); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp8_; + _tmp9_ = value; + _tmp10_ = self->test_map; + g_object_get_property ((GObject*) _tmp10_, "size", &value); + _tmp11_ = g_value_get_int (&value); + _tmp12_ = self->test_map; + _tmp13_ = gee_map_get_size (_tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp11_ == _tmp14_, "value.get_int () == test_map.size"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; +} + + +MapTestsTestEntry* map_tests_test_entry_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, gconstpointer key, gconstpointer value) { + MapTestsTestEntry * self = NULL; + gconstpointer _tmp0_; + gpointer _tmp1_; + gconstpointer _tmp2_; + self = (MapTestsTestEntry*) gee_map_entry_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _tmp0_ = key; + _tmp1_ = ((_tmp0_ != NULL) && (k_dup_func != NULL)) ? k_dup_func ((gpointer) _tmp0_) : ((gpointer) _tmp0_); + _k_destroy_func0 (self->priv->_key); + self->priv->_key = _tmp1_; + _tmp2_ = value; + gee_map_entry_set_value ((GeeMapEntry*) self, _tmp2_); + return self; +} + + +MapTestsTestEntry* map_tests_test_entry_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, gconstpointer key, gconstpointer value) { + return map_tests_test_entry_construct (MAP_TESTS_TYPE_TEST_ENTRY, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, key, value); +} + + +static gconstpointer map_tests_test_entry_real_get_key (GeeMapEntry* base) { + gconstpointer result; + MapTestsTestEntry* self; + gconstpointer _tmp0_; + self = (MapTestsTestEntry*) base; + _tmp0_ = self->priv->_key; + result = _tmp0_; + return result; +} + + +static gconstpointer map_tests_test_entry_real_get_value (GeeMapEntry* base) { + gconstpointer result; + MapTestsTestEntry* self; + gconstpointer _tmp0_; + self = (MapTestsTestEntry*) base; + _tmp0_ = self->priv->_value; + result = _tmp0_; + return result; +} + + +static void map_tests_test_entry_real_set_value (GeeMapEntry* base, gconstpointer value) { + MapTestsTestEntry* self; + gconstpointer _tmp0_; + gpointer _tmp1_; + self = (MapTestsTestEntry*) base; + _tmp0_ = value; + _tmp1_ = ((_tmp0_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp0_) : ((gpointer) _tmp0_); + ((self->priv->_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (self->priv->_value = (self->priv->v_destroy_func (self->priv->_value), NULL)); + self->priv->_value = _tmp1_; + g_object_notify ((GObject *) self, "value"); +} + + +static void map_tests_test_entry_class_init (MapTestsTestEntryClass * klass) { + map_tests_test_entry_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (MapTestsTestEntryPrivate)); + GEE_MAP_ENTRY_CLASS (klass)->get_key = map_tests_test_entry_real_get_key; + GEE_MAP_ENTRY_CLASS (klass)->get_value = map_tests_test_entry_real_get_value; + GEE_MAP_ENTRY_CLASS (klass)->set_value = map_tests_test_entry_real_set_value; + G_OBJECT_CLASS (klass)->get_property = _vala_map_tests_test_entry_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_map_tests_test_entry_set_property; + G_OBJECT_CLASS (klass)->finalize = map_tests_test_entry_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), MAP_TESTS_TEST_ENTRY_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), MAP_TESTS_TEST_ENTRY_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), MAP_TESTS_TEST_ENTRY_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), MAP_TESTS_TEST_ENTRY_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), MAP_TESTS_TEST_ENTRY_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), MAP_TESTS_TEST_ENTRY_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), MAP_TESTS_TEST_ENTRY_KEY, g_param_spec_pointer ("key", "key", "key", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), MAP_TESTS_TEST_ENTRY_VALUE, g_param_spec_pointer ("value", "value", "value", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +static void map_tests_test_entry_instance_init (MapTestsTestEntry * self) { + self->priv = MAP_TESTS_TEST_ENTRY_GET_PRIVATE (self); +} + + +static void map_tests_test_entry_finalize (GObject* obj) { + MapTestsTestEntry * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAP_TESTS_TYPE_TEST_ENTRY, MapTestsTestEntry); + ((self->priv->_key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (self->priv->_key = (self->priv->k_destroy_func (self->priv->_key), NULL)); + ((self->priv->_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (self->priv->_value = (self->priv->v_destroy_func (self->priv->_value), NULL)); + G_OBJECT_CLASS (map_tests_test_entry_parent_class)->finalize (obj); +} + + +GType map_tests_test_entry_get_type (void) { + static volatile gsize map_tests_test_entry_type_id__volatile = 0; + if (g_once_init_enter (&map_tests_test_entry_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (MapTestsTestEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) map_tests_test_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MapTestsTestEntry), 0, (GInstanceInitFunc) map_tests_test_entry_instance_init, NULL }; + GType map_tests_test_entry_type_id; + map_tests_test_entry_type_id = g_type_register_static (GEE_MAP_TYPE_ENTRY, "MapTestsTestEntry", &g_define_type_info, 0); + g_once_init_leave (&map_tests_test_entry_type_id__volatile, map_tests_test_entry_type_id); + } + return map_tests_test_entry_type_id__volatile; +} + + +static void _vala_map_tests_test_entry_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + MapTestsTestEntry * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, MAP_TESTS_TYPE_TEST_ENTRY, MapTestsTestEntry); + switch (property_id) { + case MAP_TESTS_TEST_ENTRY_KEY: + g_value_set_pointer (value, gee_map_entry_get_key ((GeeMapEntry*) self)); + break; + case MAP_TESTS_TEST_ENTRY_VALUE: + g_value_set_pointer (value, gee_map_entry_get_value ((GeeMapEntry*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_map_tests_test_entry_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + MapTestsTestEntry * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, MAP_TESTS_TYPE_TEST_ENTRY, MapTestsTestEntry); + switch (property_id) { + case MAP_TESTS_TEST_ENTRY_VALUE: + gee_map_entry_set_value ((GeeMapEntry*) self, g_value_get_pointer (value)); + break; + case MAP_TESTS_TEST_ENTRY_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case MAP_TESTS_TEST_ENTRY_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case MAP_TESTS_TEST_ENTRY_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case MAP_TESTS_TEST_ENTRY_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case MAP_TESTS_TEST_ENTRY_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case MAP_TESTS_TEST_ENTRY_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void map_tests_class_init (MapTestsClass * klass) { + map_tests_parent_class = g_type_class_peek_parent (klass); + G_OBJECT_CLASS (klass)->finalize = map_tests_finalize; +} + + +static void map_tests_instance_init (MapTests * self) { +} + + +static void map_tests_finalize (GObject* obj) { + MapTests * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAP_TESTS, MapTests); + _g_object_unref0 (self->test_map); + G_OBJECT_CLASS (map_tests_parent_class)->finalize (obj); +} + + +GType map_tests_get_type (void) { + static volatile gsize map_tests_type_id__volatile = 0; + if (g_once_init_enter (&map_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (MapTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) map_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MapTests), 0, (GInstanceInitFunc) map_tests_instance_init, NULL }; + GType map_tests_type_id; + map_tests_type_id = g_type_register_static (GEE_TYPE_TEST_CASE, "MapTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&map_tests_type_id__volatile, map_tests_type_id); + } + return map_tests_type_id__volatile; +} + + + diff --git a/tests/testmap.vala b/tests/testmap.vala new file mode 100644 index 0000000..19fc091 --- /dev/null +++ b/tests/testmap.vala @@ -0,0 +1,549 @@ +/* testmap.vala + * + * Copyright (C) 2008 Jürg Billeter, Maciej Piechotka + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Maciej Piechotka + * Julien Peeters + */ + +using Gee; + +public abstract class MapTests : Gee.TestCase { + + public MapTests (string name) { + base (name); + add_test ("[Map] type correctness", test_type_correctness); + add_test ("[Map] has_key, size and is_empty", + test_has_key_size_is_empty); + add_test ("[Map] keys", test_keys); + add_test ("[Map] values", test_values); + add_test ("[Map] entries", test_entries); + add_test ("[Map] set all", test_set_all); + add_test ("[Map] unset all", test_unset_all); + add_test ("[Map] has all", test_has_all); + add_test ("[Map] GObject properties", test_gobject_properties); + } + + protected Map test_map; + + public void test_type_correctness () { + // Check the map exists + assert (test_map != null); + + // Check the advertised key and value types + assert (test_map.key_type == typeof (string)); + assert (test_map.value_type == typeof (string)); + } + + public void test_has_key_size_is_empty () { + // Check the collection exists + assert (test_map != null); + string value; + + // Check the collection is initially empty + assert (! test_map.has_key ("one")); + assert (! test_map.has_key ("two")); + assert (! test_map.has_key ("three")); + assert (test_map.size == 0); + assert (test_map.is_empty); + + // Add a binding + test_map.set ("one", "value_of_one"); + assert (test_map.has_key ("one")); + assert (test_map.has ("one", "value_of_one")); + assert (! test_map.has ("one", "another_value_for_one")); + assert (test_map.get ("one") == "value_of_one"); + assert (! test_map.has_key ("two")); + assert (test_map.get ("two") == null); + assert (! test_map.has_key ("three")); + assert (test_map.get ("three") == null); + assert (test_map.size == 1); + assert (! test_map.is_empty); + + // Remove the last added binding + assert (test_map.unset ("one")); + assert (! test_map.has_key ("one")); + assert (! test_map.has ("one", "value_of_one")); + assert (! test_map.has ("one", "another_value_for_one")); + assert (test_map.get ("one") == null); + assert (! test_map.has_key ("two")); + assert (test_map.get ("two") == null); + assert (! test_map.has_key ("three")); + assert (test_map.get ("three") == null); + assert (test_map.size == 0); + assert (test_map.is_empty); + + // Add more bindings + test_map.set ("one", "value_of_one"); + assert (test_map.has_key ("one")); + assert (test_map.get ("one") == "value_of_one"); + assert (! test_map.has_key ("two")); + assert (test_map.get ("two") == null); + assert (! test_map.has_key ("three")); + assert (test_map.get ("three") == null); + assert (test_map.size == 1); + assert (! test_map.is_empty); + + test_map.set ("two", "value_of_two"); + assert (test_map.has_key ("one")); + assert (test_map.get ("one") == "value_of_one"); + assert (test_map.has_key ("two")); + assert (test_map.get ("two") == "value_of_two"); + assert (! test_map.has_key ("three")); + assert (test_map.get ("three") == null); + assert (test_map.size == 2); + assert (! test_map.is_empty); + + test_map.set ("three", "value_of_three"); + assert (test_map.has_key ("one")); + assert (test_map.get ("one") == "value_of_one"); + assert (test_map.has_key ("two")); + assert (test_map.get ("two") == "value_of_two"); + assert (test_map.has_key ("three")); + assert (test_map.get ("three") == "value_of_three"); + assert (test_map.size == 3); + assert (! test_map.is_empty); + + // Update an existent binding + test_map.set ("two", "value_of_two_new"); + assert (test_map.has_key ("one")); + assert (test_map.get ("one") == "value_of_one"); + assert (test_map.has_key ("two")); + assert (test_map.get ("two") == "value_of_two_new"); + assert (test_map.has_key ("three")); + assert (test_map.get ("three") == "value_of_three"); + assert (test_map.size == 3); + assert (! test_map.is_empty); + + // Remove one element + assert (test_map.unset ("two", out value)); + assert (value == "value_of_two_new"); + assert (test_map.has_key ("one")); + assert (test_map.get ("one") == "value_of_one"); + assert (! test_map.has_key ("two")); + assert (test_map.get ("two") == null); + assert (test_map.has_key ("three")); + assert (test_map.get ("three") == "value_of_three"); + assert (test_map.size == 2); + assert (! test_map.is_empty); + + // Remove the same element again + assert (! test_map.unset ("two", out value)); + assert (value == null); + assert (test_map.has_key ("one")); + assert (! test_map.has_key ("two")); + assert (test_map.has_key ("three")); + assert (test_map.size == 2); + assert (! test_map.is_empty); + + // Remove all elements + test_map.clear (); + assert (! test_map.has_key ("one")); + assert (test_map.get ("one") == null); + assert (! test_map.has_key ("two")); + assert (test_map.get ("two") == null); + assert (! test_map.has_key ("three")); + assert (test_map.get ("three") == null); + assert (test_map.size == 0); + assert (test_map.is_empty); + } + + public void test_keys () { + // Check keys on empty map + var keys = test_map.keys; + assert (keys.size == 0); + + // Check keys on map with one item + test_map.set ("one", "value_of_one"); + assert (keys.size == 1); + assert (keys.contains ("one")); + keys = test_map.keys; + assert (keys.size == 1); + assert (keys.contains ("one")); + + // Check modify key set directly + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (! keys.add ("three")); + Posix.exit (0); + } + Test.trap_assert_failed (); + Test.trap_assert_stderr ("*code should not be reached*"); + + // Check keys on map with multiple items + test_map.set ("two", "value_of_two"); + assert (keys.size == 2); + assert (keys.contains ("one")); + assert (keys.contains ("two")); + keys = test_map.keys; + assert (keys.size == 2); + assert (keys.contains ("one")); + assert (keys.contains ("two")); + + // Check keys on map clear + test_map.clear (); + assert (keys.size == 0); + keys = test_map.keys; + assert (keys.size == 0); + } + + public void test_values () { + // Check keys on empty map + var values = test_map.values; + assert (values.size == 0); + + // Check keys on map with one item + test_map.set ("one", "value_of_one"); + assert (values.size == 1); + assert (values.contains ("value_of_one")); + values = test_map.values; + assert (values.size == 1); + assert (values.contains ("value_of_one")); + + // Check modify key set directly + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (! values.add ("two")); + Posix.exit (0); + } + Test.trap_assert_failed (); + Test.trap_assert_stderr ("*code should not be reached*"); + + // Check keys on map with multiple items + test_map.set ("two", "value_of_two"); + assert (values.size == 2); + assert (values.contains ("value_of_one")); + assert (values.contains ("value_of_two")); + values = test_map.values; + assert (values.size == 2); + assert (values.contains ("value_of_one")); + assert (values.contains ("value_of_two")); + + // Check keys on map clear + test_map.clear (); + assert (values.size == 0); + values = test_map.values; + assert (values.size == 0); + } + + public void test_entries () { + // Check entries on empty map + var entries = test_map.entries; + assert (entries.size == 0); + + // Check entries on map with one item + test_map.set ("one", "value_of_one"); + assert (entries.size == 1); + assert (entries.contains (new TestEntry ("one", "value_of_one"))); + entries = test_map.entries; + assert (entries.size == 1); + assert (entries.contains (new TestEntry ("one", "value_of_one"))); + + // Check modify entry set directly + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (! entries.add (new TestEntry ("two", "value_of_two"))); + Posix.exit (0); + } + Test.trap_assert_failed (); + Test.trap_assert_stderr ("*code should not be reached*"); + + // Check entries on map with multiple items + test_map.set ("two", "value_of_two"); + assert (entries.size == 2); + assert (entries.contains (new TestEntry ("one", "value_of_one"))); + assert (entries.contains (new TestEntry ("two", "value_of_two"))); + entries = test_map.entries; + assert (entries.size == 2); + assert (entries.contains (new TestEntry ("one", "value_of_one"))); + assert (entries.contains (new TestEntry ("two", "value_of_two"))); + + // Check keys on map clear + test_map.clear (); + assert (entries.size == 0); + entries = test_map.entries; + assert (entries.size == 0); + } + + public void test_clear () { + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + test_map.set ("three", "value_of_three"); + + test_map.clear (); + assert (test_map.size == 0); + + Set keys = test_map.keys; + assert (keys != null); + Iterator ikeys = keys.iterator (); + assert (ikeys != null); + assert (!ikeys.has_next ()); + + Collection vals = test_map.values; + assert (vals != null); + Iterator ivals = vals.iterator (); + assert (ivals != null); + assert (!ivals.has_next ()); + + Set> ents = test_map.entries; + assert (ents != null); + Iterator> ients = ents.iterator (); + assert (ients != null); + assert (!ients.has_next ()); + + MapIterator iter = test_map.map_iterator (); + assert (iter != null); + assert (!iter.has_next ()); + } + + public void test_set_all () { + var another_map = new HashMap (str_hash, + str_equal, + str_equal); + + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + test_map.set ("three", "value_of_three"); + another_map.set ("four", "value_of_four"); + another_map.set ("five", "value_of_five"); + another_map.set ("six", "value_of_six"); + + test_map.set_all (another_map); + + assert (test_map.size == 6); + assert (test_map.has_key ("one")); + assert (test_map.has_key ("two")); + assert (test_map.has_key ("three")); + assert (test_map.has_key ("four")); + assert (test_map.has_key ("five")); + assert (test_map.has_key ("six")); + + assert (test_map.get ("one") == "value_of_one"); + assert (test_map.get ("two") == "value_of_two"); + assert (test_map.get ("three") == "value_of_three"); + assert (test_map.get ("four") == "value_of_four"); + assert (test_map.get ("five") == "value_of_five"); + assert (test_map.get ("six") == "value_of_six"); + } + + public void test_unset_all () { + var another_map = new HashMap (str_hash, + str_equal, + str_equal); + + // Check unset all on empty maps. + assert (test_map.is_empty); + assert (another_map.is_empty); + + assert (! test_map.unset_all (another_map)); + + assert (test_map.is_empty); + assert (another_map.is_empty); + + test_map.clear (); + another_map.clear (); + + // Test_Map is empty, another_map has entries. -> no change + another_map.set ("one", "value_of_one"); + another_map.set ("two", "value_of_two"); + + assert (test_map.is_empty); + assert (another_map.size == 2); + + assert (! test_map.unset_all (another_map)); + + assert (test_map.is_empty); + assert (another_map.size == 2); + + test_map.clear (); + another_map.clear (); + + // Test_Map has entries, another_map is empty. -> no change + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + + assert (test_map.size == 2); + assert (another_map.is_empty); + + assert (! test_map.unset_all (another_map)); + + assert (test_map.size == 2); + assert (another_map.is_empty); + + test_map.clear (); + another_map.clear (); + + // Test_Map and another_map have the same + // entries -> test_map is cleared + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + another_map.set ("one", "value_of_one"); + another_map.set ("two", "value_of_two"); + + assert (test_map.size == 2); + assert (another_map.size == 2); + + assert (test_map.unset_all (another_map)); + + assert (test_map.is_empty); + assert (another_map.size == 2); + + test_map.clear (); + another_map.clear (); + + // Test_Map has some common keys with another_map + // but both have also unique keys -> common key are + // cleared from test_map + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + test_map.set ("three", "value_of_three"); + another_map.set ("two", "value_of_two"); + another_map.set ("three", "value_of_three"); + another_map.set ("four", "value_of_four"); + another_map.set ("five", "value_of_five"); + + assert (test_map.size == 3); + assert (another_map.size == 4); + + assert (test_map.unset_all (another_map)); + + assert (test_map.size == 1); + assert (another_map.size == 4); + + assert (test_map.has_key ("one")); + } + + public void test_has_all () { + var another_map = new HashMap (str_hash, + str_equal, + str_equal); + + // Check empty. + assert (test_map.has_all (another_map)); + + // Test_Map has items, another_map is empty. + test_map.set ("one", "value_of_one"); + + assert (test_map.has_all (another_map)); + + test_map.clear (); + another_map.clear (); + + // Test_Map is empty, another_map has items. + another_map.set ("one", "value_of_one"); + + assert (! test_map.has_all (another_map)); + + test_map.clear (); + another_map.clear (); + + // Test_Map and another_map are the same. + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + + another_map.set ("one", "value_of_one"); + another_map.set ("two", "value_of_two"); + + assert (test_map.has_all (another_map)); + + test_map.clear (); + another_map.clear (); + + // Test_Map and another_map are not the same. + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + + another_map.set ("one", "another_value_of_one"); + another_map.set ("two", "another_value_of_two"); + + assert (! test_map.has_all (another_map)); + + test_map.clear (); + another_map.clear (); + + // Test_Map and another_map are not the same + test_map.set ("one", "value_of_one"); + another_map.set ("two", "value_of_two"); + + assert (! test_map.has_all (another_map)); + + test_map.clear (); + another_map.clear (); + + // Test_Map has a subset of another_map + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + test_map.set ("three", "value_of_three"); + test_map.set ("four", "value_of_four"); + test_map.set ("five", "value_of_five"); + test_map.set ("six", "value_of_six"); + another_map.set ("two", "value_of_two"); + another_map.set ("three", "value_of_three"); + another_map.set ("four", "value_of_four"); + + assert (test_map.has_all (another_map)); + + test_map.clear (); + another_map.clear (); + + // Test_Map has a subset of another_map in all but one element another_map + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + test_map.set ("three", "value_of_three"); + test_map.set ("four", "value_of_four"); + test_map.set ("five", "value_of_five"); + test_map.set ("six", "value_of_six"); + another_map.set ("two", "value_of_two"); + another_map.set ("three", "value_of_three"); + another_map.set ("four", "value_of_four"); + another_map.set ("height", "value_of_height"); + + assert (! test_map.has_all (another_map)); + } + + public void test_gobject_properties () { + // Check the map exists + assert (test_map != null); + Value value; + + value = Value (typeof (bool)); + test_map.get_property ("is-empty", ref value); + assert (value.get_boolean () == test_map.is_empty); + value.unset (); + + value = Value (typeof (int)); + test_map.get_property ("size", ref value); + assert (value.get_int () == test_map.size); + value.unset (); + } + + + + public class TestEntry : Map.Entry { + public TestEntry (K key, V value) { + this._key = key; + this.value = value; + } + + public override K key { get {return _key; } } + private K _key; + public override V value { get; set; } + } +} diff --git a/tests/testmultimap.c b/tests/testmultimap.c new file mode 100644 index 0000000..f341696 --- /dev/null +++ b/tests/testmultimap.c @@ -0,0 +1,851 @@ +/* testmultimap.c generated by valac 0.18.0, the Vala compiler + * generated from testmultimap.vala, do not modify */ + +/* testmultimap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes' Villevalois + * Julien Peeters + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_MULTI_MAP_TESTS (multi_map_tests_get_type ()) +#define MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTests)) +#define MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass)) +#define IS_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_MAP_TESTS)) +#define IS_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_MAP_TESTS)) +#define MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass)) + +typedef struct _MultiMapTests MultiMapTests; +typedef struct _MultiMapTestsClass MultiMapTestsClass; +typedef struct _MultiMapTestsPrivate MultiMapTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _MultiMapTests { + GeeTestCase parent_instance; + MultiMapTestsPrivate * priv; + GeeMultiMap* test_multi_map; +}; + +struct _MultiMapTestsClass { + GeeTestCaseClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer multi_map_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType multi_map_tests_get_type (void) G_GNUC_CONST; +enum { + MULTI_MAP_TESTS_DUMMY_PROPERTY +}; +MultiMapTests* multi_map_tests_construct (GType object_type, const gchar* name); +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void multi_map_tests_test_size (MultiMapTests* self); +static void _multi_map_tests_test_size_gee_test_case_test_method (gpointer self); +static void multi_map_tests_test_getting_setting (MultiMapTests* self); +static void _multi_map_tests_test_getting_setting_gee_test_case_test_method (gpointer self); +static void multi_map_tests_test_keys_all_keys_values (MultiMapTests* self); +static void _multi_map_tests_test_keys_all_keys_values_gee_test_case_test_method (gpointer self); +static void multi_map_tests_finalize (GObject* obj); + + +static void _multi_map_tests_test_size_gee_test_case_test_method (gpointer self) { + multi_map_tests_test_size (self); +} + + +static void _multi_map_tests_test_getting_setting_gee_test_case_test_method (gpointer self) { + multi_map_tests_test_getting_setting (self); +} + + +static void _multi_map_tests_test_keys_all_keys_values_gee_test_case_test_method (gpointer self) { + multi_map_tests_test_keys_all_keys_values (self); +} + + +MultiMapTests* multi_map_tests_construct (GType object_type, const gchar* name) { + MultiMapTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (MultiMapTests*) gee_test_case_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[MultiMap] size", _multi_map_tests_test_size_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[MultiMap] getting and setting", _multi_map_tests_test_getting_setting_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[MultiMap] keys, all keys and values", _multi_map_tests_test_keys_all_keys_values_gee_test_case_test_method, self); + return self; +} + + +static void multi_map_tests_test_size (MultiMapTests* self) { + GeeMultiMap* _tmp0_; + GeeMultiMap* _tmp1_; + gint _tmp2_; + gint _tmp3_; + GeeMultiMap* _tmp4_; + GeeMultiMap* _tmp5_; + gint _tmp6_; + gint _tmp7_; + GeeMultiMap* _tmp8_; + GeeMultiMap* _tmp9_; + gint _tmp10_; + gint _tmp11_; + GeeMultiMap* _tmp12_; + GeeMultiMap* _tmp13_; + gint _tmp14_; + gint _tmp15_; + GeeMultiMap* _tmp16_; + GeeMultiMap* _tmp17_; + GeeMultiMap* _tmp18_; + gint _tmp19_; + gint _tmp20_; + GeeMultiMap* _tmp21_; + GeeMultiMap* _tmp22_; + gint _tmp23_; + gint _tmp24_; + GeeMultiMap* _tmp25_; + GeeMultiMap* _tmp26_; + gint _tmp27_; + gint _tmp28_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_multi_map; + _vala_assert (_tmp0_ != NULL, "test_multi_map != null"); + _tmp1_ = self->test_multi_map; + _tmp2_ = gee_multi_map_get_size (_tmp1_); + _tmp3_ = _tmp2_; + _vala_assert (_tmp3_ == 0, "test_multi_map.size == 0"); + _tmp4_ = self->test_multi_map; + gee_multi_map_set (_tmp4_, "0", "0"); + _tmp5_ = self->test_multi_map; + _tmp6_ = gee_multi_map_get_size (_tmp5_); + _tmp7_ = _tmp6_; + _vala_assert (_tmp7_ == 1, "test_multi_map.size == 1"); + _tmp8_ = self->test_multi_map; + gee_multi_map_set (_tmp8_, "0", "1"); + _tmp9_ = self->test_multi_map; + _tmp10_ = gee_multi_map_get_size (_tmp9_); + _tmp11_ = _tmp10_; + _vala_assert (_tmp11_ == 2, "test_multi_map.size == 2"); + _tmp12_ = self->test_multi_map; + gee_multi_map_remove (_tmp12_, "0", "1"); + _tmp13_ = self->test_multi_map; + _tmp14_ = gee_multi_map_get_size (_tmp13_); + _tmp15_ = _tmp14_; + _vala_assert (_tmp15_ == 1, "test_multi_map.size == 1"); + _tmp16_ = self->test_multi_map; + gee_multi_map_set (_tmp16_, "0", "1"); + _tmp17_ = self->test_multi_map; + gee_multi_map_remove_all (_tmp17_, "0"); + _tmp18_ = self->test_multi_map; + _tmp19_ = gee_multi_map_get_size (_tmp18_); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 0, "test_multi_map.size == 0"); + _tmp21_ = self->test_multi_map; + gee_multi_map_set (_tmp21_, "0", "0"); + _tmp22_ = self->test_multi_map; + _tmp23_ = gee_multi_map_get_size (_tmp22_); + _tmp24_ = _tmp23_; + _vala_assert (_tmp24_ == 1, "test_multi_map.size == 1"); + _tmp25_ = self->test_multi_map; + gee_multi_map_set (_tmp25_, "1", "1"); + _tmp26_ = self->test_multi_map; + _tmp27_ = gee_multi_map_get_size (_tmp26_); + _tmp28_ = _tmp27_; + _vala_assert (_tmp28_ == 2, "test_multi_map.size == 2"); +} + + +static void multi_map_tests_test_getting_setting (MultiMapTests* self) { + GeeMultiMap* _tmp0_; + GeeMultiMap* _tmp1_; + GeeMultiMap* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeMultiMap* _tmp4_; + GeeCollection* _tmp5_ = NULL; + GeeCollection* _tmp6_; + gint _tmp7_; + gint _tmp8_; + GeeMultiMap* _tmp9_; + GeeCollection* _tmp10_ = NULL; + GeeCollection* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeMultiMap* _tmp13_; + GeeCollection* _tmp14_ = NULL; + GeeCollection* _tmp15_; + gint _tmp16_; + gint _tmp17_; + GeeMultiMap* _tmp18_; + GeeMultiMap* _tmp19_; + GeeCollection* _tmp20_ = NULL; + GeeCollection* _tmp21_; + gint _tmp22_; + gint _tmp23_; + GeeMultiMap* _tmp24_; + GeeCollection* _tmp25_ = NULL; + GeeCollection* _tmp26_; + gboolean _tmp27_ = FALSE; + GeeMultiMap* _tmp28_; + GeeCollection* _tmp29_ = NULL; + GeeCollection* _tmp30_; + gboolean _tmp31_ = FALSE; + GeeMultiMap* _tmp32_; + GeeMultiMap* _tmp33_; + gboolean _tmp34_ = FALSE; + GeeMultiMap* _tmp35_; + GeeCollection* _tmp36_ = NULL; + GeeCollection* _tmp37_; + gint _tmp38_; + gint _tmp39_; + GeeMultiMap* _tmp40_; + GeeCollection* _tmp41_ = NULL; + GeeCollection* _tmp42_; + gboolean _tmp43_ = FALSE; + GeeMultiMap* _tmp44_; + GeeCollection* _tmp45_ = NULL; + GeeCollection* _tmp46_; + gboolean _tmp47_ = FALSE; + GeeMultiMap* _tmp48_; + GeeCollection* _tmp49_ = NULL; + GeeCollection* _tmp50_; + gint _tmp51_; + gint _tmp52_; + GeeMultiMap* _tmp53_; + GeeCollection* _tmp54_ = NULL; + GeeCollection* _tmp55_; + gboolean _tmp56_ = FALSE; + GeeMultiMap* _tmp57_; + gboolean _tmp58_ = FALSE; + GeeMultiMap* _tmp59_; + gboolean _tmp60_ = FALSE; + GeeMultiMap* _tmp61_; + GeeCollection* _tmp62_ = NULL; + GeeCollection* _tmp63_; + gboolean _tmp64_ = FALSE; + GeeMultiMap* _tmp65_; + GeeCollection* _tmp66_ = NULL; + GeeCollection* _tmp67_; + gboolean _tmp68_ = FALSE; + GeeMultiMap* _tmp69_; + gboolean _tmp70_ = FALSE; + GeeMultiMap* _tmp71_; + GeeCollection* _tmp72_ = NULL; + GeeCollection* _tmp73_; + gboolean _tmp74_ = FALSE; + GeeMultiMap* _tmp75_; + gboolean _tmp76_ = FALSE; + GeeMultiMap* _tmp77_; + gboolean _tmp78_ = FALSE; + GeeMultiMap* _tmp79_; + GeeCollection* _tmp80_ = NULL; + GeeCollection* _tmp81_; + gboolean _tmp82_ = FALSE; + GeeMultiMap* _tmp83_; + GeeCollection* _tmp84_ = NULL; + GeeCollection* _tmp85_; + gboolean _tmp86_ = FALSE; + GeeMultiMap* _tmp87_; + gboolean _tmp88_ = FALSE; + GeeMultiMap* _tmp89_; + GeeCollection* _tmp90_ = NULL; + GeeCollection* _tmp91_; + gboolean _tmp92_ = FALSE; + GeeMultiMap* _tmp93_; + gboolean _tmp94_ = FALSE; + GeeMultiMap* _tmp95_; + gboolean _tmp96_ = FALSE; + GeeMultiMap* _tmp97_; + GeeCollection* _tmp98_ = NULL; + GeeCollection* _tmp99_; + gboolean _tmp100_ = FALSE; + GeeMultiMap* _tmp101_; + GeeCollection* _tmp102_ = NULL; + GeeCollection* _tmp103_; + gboolean _tmp104_ = FALSE; + GeeMultiMap* _tmp105_; + gboolean _tmp106_ = FALSE; + GeeMultiMap* _tmp107_; + GeeCollection* _tmp108_ = NULL; + GeeCollection* _tmp109_; + gboolean _tmp110_ = FALSE; + GeeMultiMap* _tmp111_; + GeeMultiMap* _tmp112_; + gboolean _tmp113_ = FALSE; + GeeMultiMap* _tmp114_; + gboolean _tmp115_ = FALSE; + GeeMultiMap* _tmp116_; + GeeMultiMap* _tmp117_; + GeeMultiMap* _tmp118_; + GeeMultiMap* _tmp119_; + gint _tmp120_; + gint _tmp121_; + GeeMultiMap* _tmp122_; + gboolean _tmp123_ = FALSE; + GeeMultiMap* _tmp124_; + gboolean _tmp125_ = FALSE; + GeeMultiMap* _tmp126_; + GeeCollection* _tmp127_ = NULL; + GeeCollection* _tmp128_; + gint _tmp129_; + gint _tmp130_; + GeeMultiMap* _tmp131_; + GeeCollection* _tmp132_ = NULL; + GeeCollection* _tmp133_; + gboolean _tmp134_ = FALSE; + GeeMultiMap* _tmp135_; + GeeCollection* _tmp136_ = NULL; + GeeCollection* _tmp137_; + gboolean _tmp138_ = FALSE; + GeeMultiMap* _tmp139_; + GeeCollection* _tmp140_ = NULL; + GeeCollection* _tmp141_; + gint _tmp142_; + gint _tmp143_; + GeeMultiMap* _tmp144_; + GeeCollection* _tmp145_ = NULL; + GeeCollection* _tmp146_; + gboolean _tmp147_ = FALSE; + GeeMultiMap* _tmp148_; + gboolean _tmp149_ = FALSE; + GeeMultiMap* _tmp150_; + gboolean _tmp151_ = FALSE; + GeeMultiMap* _tmp152_; + GeeCollection* _tmp153_ = NULL; + GeeCollection* _tmp154_; + gboolean _tmp155_ = FALSE; + GeeMultiMap* _tmp156_; + GeeCollection* _tmp157_ = NULL; + GeeCollection* _tmp158_; + gboolean _tmp159_ = FALSE; + GeeMultiMap* _tmp160_; + gboolean _tmp161_ = FALSE; + GeeMultiMap* _tmp162_; + GeeCollection* _tmp163_ = NULL; + GeeCollection* _tmp164_; + gboolean _tmp165_ = FALSE; + GeeMultiMap* _tmp166_; + gboolean _tmp167_ = FALSE; + GeeMultiMap* _tmp168_; + gboolean _tmp169_ = FALSE; + GeeMultiMap* _tmp170_; + GeeCollection* _tmp171_ = NULL; + GeeCollection* _tmp172_; + gboolean _tmp173_ = FALSE; + GeeMultiMap* _tmp174_; + GeeCollection* _tmp175_ = NULL; + GeeCollection* _tmp176_; + gboolean _tmp177_ = FALSE; + GeeMultiMap* _tmp178_; + gboolean _tmp179_ = FALSE; + GeeMultiMap* _tmp180_; + GeeCollection* _tmp181_ = NULL; + GeeCollection* _tmp182_; + gboolean _tmp183_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_multi_map; + _vala_assert (_tmp0_ != NULL, "test_multi_map != null"); + _tmp1_ = self->test_multi_map; + gee_multi_map_set (_tmp1_, "0", "0"); + _tmp2_ = self->test_multi_map; + _tmp3_ = gee_multi_map_contains (_tmp2_, "0"); + _vala_assert (_tmp3_, "test_multi_map.contains (\"0\")"); + _tmp4_ = self->test_multi_map; + _tmp5_ = gee_multi_map_get (_tmp4_, "0"); + _tmp6_ = _tmp5_; + _tmp7_ = gee_collection_get_size (_tmp6_); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_ == 1, "test_multi_map.get (\"0\").size == 1"); + _g_object_unref0 (_tmp6_); + _tmp9_ = self->test_multi_map; + _tmp10_ = gee_multi_map_get (_tmp9_, "0"); + _tmp11_ = _tmp10_; + _tmp12_ = gee_collection_contains (_tmp11_, "0"); + _vala_assert (_tmp12_, "test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp11_); + _tmp13_ = self->test_multi_map; + _tmp14_ = gee_multi_map_get (_tmp13_, "1"); + _tmp15_ = _tmp14_; + _tmp16_ = gee_collection_get_size (_tmp15_); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_ == 0, "test_multi_map.get (\"1\").size == 0"); + _g_object_unref0 (_tmp15_); + _tmp18_ = self->test_multi_map; + gee_multi_map_set (_tmp18_, "0", "1"); + _tmp19_ = self->test_multi_map; + _tmp20_ = gee_multi_map_get (_tmp19_, "0"); + _tmp21_ = _tmp20_; + _tmp22_ = gee_collection_get_size (_tmp21_); + _tmp23_ = _tmp22_; + _vala_assert (_tmp23_ == 2, "test_multi_map.get (\"0\").size == 2"); + _g_object_unref0 (_tmp21_); + _tmp24_ = self->test_multi_map; + _tmp25_ = gee_multi_map_get (_tmp24_, "0"); + _tmp26_ = _tmp25_; + _tmp27_ = gee_collection_contains (_tmp26_, "0"); + _vala_assert (_tmp27_, "test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp26_); + _tmp28_ = self->test_multi_map; + _tmp29_ = gee_multi_map_get (_tmp28_, "0"); + _tmp30_ = _tmp29_; + _tmp31_ = gee_collection_contains (_tmp30_, "1"); + _vala_assert (_tmp31_, "test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp30_); + _tmp32_ = self->test_multi_map; + gee_multi_map_set (_tmp32_, "1", "1"); + _tmp33_ = self->test_multi_map; + _tmp34_ = gee_multi_map_contains (_tmp33_, "1"); + _vala_assert (_tmp34_, "test_multi_map.contains (\"1\")"); + _tmp35_ = self->test_multi_map; + _tmp36_ = gee_multi_map_get (_tmp35_, "0"); + _tmp37_ = _tmp36_; + _tmp38_ = gee_collection_get_size (_tmp37_); + _tmp39_ = _tmp38_; + _vala_assert (_tmp39_ == 2, "test_multi_map.get (\"0\").size == 2"); + _g_object_unref0 (_tmp37_); + _tmp40_ = self->test_multi_map; + _tmp41_ = gee_multi_map_get (_tmp40_, "0"); + _tmp42_ = _tmp41_; + _tmp43_ = gee_collection_contains (_tmp42_, "0"); + _vala_assert (_tmp43_, "test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp42_); + _tmp44_ = self->test_multi_map; + _tmp45_ = gee_multi_map_get (_tmp44_, "0"); + _tmp46_ = _tmp45_; + _tmp47_ = gee_collection_contains (_tmp46_, "1"); + _vala_assert (_tmp47_, "test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp46_); + _tmp48_ = self->test_multi_map; + _tmp49_ = gee_multi_map_get (_tmp48_, "1"); + _tmp50_ = _tmp49_; + _tmp51_ = gee_collection_get_size (_tmp50_); + _tmp52_ = _tmp51_; + _vala_assert (_tmp52_ == 1, "test_multi_map.get (\"1\").size == 1"); + _g_object_unref0 (_tmp50_); + _tmp53_ = self->test_multi_map; + _tmp54_ = gee_multi_map_get (_tmp53_, "0"); + _tmp55_ = _tmp54_; + _tmp56_ = gee_collection_contains (_tmp55_, "1"); + _vala_assert (_tmp56_, "test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp55_); + _tmp57_ = self->test_multi_map; + _tmp58_ = gee_multi_map_remove (_tmp57_, "0", "0"); + _vala_assert (_tmp58_, "test_multi_map.remove (\"0\", \"0\")"); + _tmp59_ = self->test_multi_map; + _tmp60_ = gee_multi_map_contains (_tmp59_, "0"); + _vala_assert (_tmp60_, "test_multi_map.contains (\"0\")"); + _tmp61_ = self->test_multi_map; + _tmp62_ = gee_multi_map_get (_tmp61_, "0"); + _tmp63_ = _tmp62_; + _tmp64_ = gee_collection_contains (_tmp63_, "0"); + _vala_assert (!_tmp64_, "! test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp63_); + _tmp65_ = self->test_multi_map; + _tmp66_ = gee_multi_map_get (_tmp65_, "0"); + _tmp67_ = _tmp66_; + _tmp68_ = gee_collection_contains (_tmp67_, "1"); + _vala_assert (_tmp68_, "test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp67_); + _tmp69_ = self->test_multi_map; + _tmp70_ = gee_multi_map_contains (_tmp69_, "1"); + _vala_assert (_tmp70_, "test_multi_map.contains (\"1\")"); + _tmp71_ = self->test_multi_map; + _tmp72_ = gee_multi_map_get (_tmp71_, "1"); + _tmp73_ = _tmp72_; + _tmp74_ = gee_collection_contains (_tmp73_, "1"); + _vala_assert (_tmp74_, "test_multi_map.get (\"1\").contains (\"1\")"); + _g_object_unref0 (_tmp73_); + _tmp75_ = self->test_multi_map; + _tmp76_ = gee_multi_map_remove (_tmp75_, "0", "1"); + _vala_assert (_tmp76_, "test_multi_map.remove (\"0\", \"1\")"); + _tmp77_ = self->test_multi_map; + _tmp78_ = gee_multi_map_contains (_tmp77_, "0"); + _vala_assert (!_tmp78_, "! test_multi_map.contains (\"0\")"); + _tmp79_ = self->test_multi_map; + _tmp80_ = gee_multi_map_get (_tmp79_, "0"); + _tmp81_ = _tmp80_; + _tmp82_ = gee_collection_contains (_tmp81_, "0"); + _vala_assert (!_tmp82_, "! test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp81_); + _tmp83_ = self->test_multi_map; + _tmp84_ = gee_multi_map_get (_tmp83_, "0"); + _tmp85_ = _tmp84_; + _tmp86_ = gee_collection_contains (_tmp85_, "1"); + _vala_assert (!_tmp86_, "! test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp85_); + _tmp87_ = self->test_multi_map; + _tmp88_ = gee_multi_map_contains (_tmp87_, "1"); + _vala_assert (_tmp88_, "test_multi_map.contains (\"1\")"); + _tmp89_ = self->test_multi_map; + _tmp90_ = gee_multi_map_get (_tmp89_, "1"); + _tmp91_ = _tmp90_; + _tmp92_ = gee_collection_contains (_tmp91_, "1"); + _vala_assert (_tmp92_, "test_multi_map.get (\"1\").contains (\"1\")"); + _g_object_unref0 (_tmp91_); + _tmp93_ = self->test_multi_map; + _tmp94_ = gee_multi_map_remove (_tmp93_, "0", "1"); + _vala_assert (!_tmp94_, "! test_multi_map.remove (\"0\", \"1\")"); + _tmp95_ = self->test_multi_map; + _tmp96_ = gee_multi_map_contains (_tmp95_, "0"); + _vala_assert (!_tmp96_, "! test_multi_map.contains (\"0\")"); + _tmp97_ = self->test_multi_map; + _tmp98_ = gee_multi_map_get (_tmp97_, "0"); + _tmp99_ = _tmp98_; + _tmp100_ = gee_collection_contains (_tmp99_, "0"); + _vala_assert (!_tmp100_, "! test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp99_); + _tmp101_ = self->test_multi_map; + _tmp102_ = gee_multi_map_get (_tmp101_, "0"); + _tmp103_ = _tmp102_; + _tmp104_ = gee_collection_contains (_tmp103_, "1"); + _vala_assert (!_tmp104_, "! test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp103_); + _tmp105_ = self->test_multi_map; + _tmp106_ = gee_multi_map_contains (_tmp105_, "1"); + _vala_assert (_tmp106_, "test_multi_map.contains (\"1\")"); + _tmp107_ = self->test_multi_map; + _tmp108_ = gee_multi_map_get (_tmp107_, "1"); + _tmp109_ = _tmp108_; + _tmp110_ = gee_collection_contains (_tmp109_, "1"); + _vala_assert (_tmp110_, "test_multi_map.get (\"1\").contains (\"1\")"); + _g_object_unref0 (_tmp109_); + _tmp111_ = self->test_multi_map; + gee_multi_map_clear (_tmp111_); + _tmp112_ = self->test_multi_map; + _tmp113_ = gee_multi_map_contains (_tmp112_, "0"); + _vala_assert (!_tmp113_, "! test_multi_map.contains (\"0\")"); + _tmp114_ = self->test_multi_map; + _tmp115_ = gee_multi_map_contains (_tmp114_, "1"); + _vala_assert (!_tmp115_, "! test_multi_map.contains (\"1\")"); + _tmp116_ = self->test_multi_map; + gee_multi_map_set (_tmp116_, "0", "0"); + _tmp117_ = self->test_multi_map; + gee_multi_map_set (_tmp117_, "0", "1"); + _tmp118_ = self->test_multi_map; + gee_multi_map_set (_tmp118_, "1", "1"); + _tmp119_ = self->test_multi_map; + _tmp120_ = gee_multi_map_get_size (_tmp119_); + _tmp121_ = _tmp120_; + _vala_assert (_tmp121_ == 3, "test_multi_map.size == 3"); + _tmp122_ = self->test_multi_map; + _tmp123_ = gee_multi_map_contains (_tmp122_, "0"); + _vala_assert (_tmp123_, "test_multi_map.contains (\"0\")"); + _tmp124_ = self->test_multi_map; + _tmp125_ = gee_multi_map_contains (_tmp124_, "1"); + _vala_assert (_tmp125_, "test_multi_map.contains (\"1\")"); + _tmp126_ = self->test_multi_map; + _tmp127_ = gee_multi_map_get (_tmp126_, "0"); + _tmp128_ = _tmp127_; + _tmp129_ = gee_collection_get_size (_tmp128_); + _tmp130_ = _tmp129_; + _vala_assert (_tmp130_ == 2, "test_multi_map.get (\"0\").size == 2"); + _g_object_unref0 (_tmp128_); + _tmp131_ = self->test_multi_map; + _tmp132_ = gee_multi_map_get (_tmp131_, "0"); + _tmp133_ = _tmp132_; + _tmp134_ = gee_collection_contains (_tmp133_, "0"); + _vala_assert (_tmp134_, "test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp133_); + _tmp135_ = self->test_multi_map; + _tmp136_ = gee_multi_map_get (_tmp135_, "0"); + _tmp137_ = _tmp136_; + _tmp138_ = gee_collection_contains (_tmp137_, "1"); + _vala_assert (_tmp138_, "test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp137_); + _tmp139_ = self->test_multi_map; + _tmp140_ = gee_multi_map_get (_tmp139_, "1"); + _tmp141_ = _tmp140_; + _tmp142_ = gee_collection_get_size (_tmp141_); + _tmp143_ = _tmp142_; + _vala_assert (_tmp143_ == 1, "test_multi_map.get (\"1\").size == 1"); + _g_object_unref0 (_tmp141_); + _tmp144_ = self->test_multi_map; + _tmp145_ = gee_multi_map_get (_tmp144_, "0"); + _tmp146_ = _tmp145_; + _tmp147_ = gee_collection_contains (_tmp146_, "1"); + _vala_assert (_tmp147_, "test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp146_); + _tmp148_ = self->test_multi_map; + _tmp149_ = gee_multi_map_remove_all (_tmp148_, "0"); + _vala_assert (_tmp149_, "test_multi_map.remove_all (\"0\")"); + _tmp150_ = self->test_multi_map; + _tmp151_ = gee_multi_map_contains (_tmp150_, "0"); + _vala_assert (!_tmp151_, "! test_multi_map.contains (\"0\")"); + _tmp152_ = self->test_multi_map; + _tmp153_ = gee_multi_map_get (_tmp152_, "0"); + _tmp154_ = _tmp153_; + _tmp155_ = gee_collection_contains (_tmp154_, "0"); + _vala_assert (!_tmp155_, "! test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp154_); + _tmp156_ = self->test_multi_map; + _tmp157_ = gee_multi_map_get (_tmp156_, "0"); + _tmp158_ = _tmp157_; + _tmp159_ = gee_collection_contains (_tmp158_, "1"); + _vala_assert (!_tmp159_, "! test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp158_); + _tmp160_ = self->test_multi_map; + _tmp161_ = gee_multi_map_contains (_tmp160_, "1"); + _vala_assert (_tmp161_, "test_multi_map.contains (\"1\")"); + _tmp162_ = self->test_multi_map; + _tmp163_ = gee_multi_map_get (_tmp162_, "1"); + _tmp164_ = _tmp163_; + _tmp165_ = gee_collection_contains (_tmp164_, "1"); + _vala_assert (_tmp165_, "test_multi_map.get (\"1\").contains (\"1\")"); + _g_object_unref0 (_tmp164_); + _tmp166_ = self->test_multi_map; + _tmp167_ = gee_multi_map_remove_all (_tmp166_, "0"); + _vala_assert (!_tmp167_, "! test_multi_map.remove_all (\"0\")"); + _tmp168_ = self->test_multi_map; + _tmp169_ = gee_multi_map_contains (_tmp168_, "0"); + _vala_assert (!_tmp169_, "! test_multi_map.contains (\"0\")"); + _tmp170_ = self->test_multi_map; + _tmp171_ = gee_multi_map_get (_tmp170_, "0"); + _tmp172_ = _tmp171_; + _tmp173_ = gee_collection_contains (_tmp172_, "0"); + _vala_assert (!_tmp173_, "! test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp172_); + _tmp174_ = self->test_multi_map; + _tmp175_ = gee_multi_map_get (_tmp174_, "0"); + _tmp176_ = _tmp175_; + _tmp177_ = gee_collection_contains (_tmp176_, "1"); + _vala_assert (!_tmp177_, "! test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp176_); + _tmp178_ = self->test_multi_map; + _tmp179_ = gee_multi_map_contains (_tmp178_, "1"); + _vala_assert (_tmp179_, "test_multi_map.contains (\"1\")"); + _tmp180_ = self->test_multi_map; + _tmp181_ = gee_multi_map_get (_tmp180_, "1"); + _tmp182_ = _tmp181_; + _tmp183_ = gee_collection_contains (_tmp182_, "1"); + _vala_assert (_tmp183_, "test_multi_map.get (\"1\").contains (\"1\")"); + _g_object_unref0 (_tmp182_); +} + + +static void multi_map_tests_test_keys_all_keys_values (MultiMapTests* self) { + GeeMultiMap* _tmp0_; + GeeMultiMap* _tmp1_; + GeeMultiMap* _tmp2_; + GeeMultiMap* _tmp3_; + GeeMultiMap* _tmp4_; + GeeSet* _tmp5_ = NULL; + GeeSet* keys; + GeeMultiMap* _tmp6_; + GeeMultiSet* _tmp7_ = NULL; + GeeMultiSet* all_keys; + GeeMultiMap* _tmp8_; + GeeCollection* _tmp9_ = NULL; + GeeCollection* values; + GeeSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSet* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeMultiSet* _tmp14_; + gint _tmp15_ = 0; + GeeMultiSet* _tmp16_; + gint _tmp17_ = 0; + GeeCollection* _tmp18_; + gboolean _tmp19_ = FALSE; + GeeCollection* _tmp20_; + gboolean _tmp21_ = FALSE; + gboolean zero_found; + gboolean zero_found_once; + gboolean one_found; + gboolean one_found_twice; + gboolean nothing_more; + gboolean _tmp33_; + gboolean _tmp34_; + gboolean _tmp35_; + gboolean _tmp36_; + gboolean _tmp37_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_multi_map; + _vala_assert (_tmp0_ != NULL, "test_multi_map != null"); + _tmp1_ = self->test_multi_map; + gee_multi_map_set (_tmp1_, "0", "0"); + _tmp2_ = self->test_multi_map; + gee_multi_map_set (_tmp2_, "0", "1"); + _tmp3_ = self->test_multi_map; + gee_multi_map_set (_tmp3_, "1", "1"); + _tmp4_ = self->test_multi_map; + _tmp5_ = gee_multi_map_get_keys (_tmp4_); + keys = _tmp5_; + _tmp6_ = self->test_multi_map; + _tmp7_ = gee_multi_map_get_all_keys (_tmp6_); + all_keys = _tmp7_; + _tmp8_ = self->test_multi_map; + _tmp9_ = gee_multi_map_get_values (_tmp8_); + values = _tmp9_; + _tmp10_ = keys; + _tmp11_ = gee_collection_contains ((GeeCollection*) _tmp10_, "0"); + _vala_assert (_tmp11_, "keys.contains (\"0\")"); + _tmp12_ = keys; + _tmp13_ = gee_collection_contains ((GeeCollection*) _tmp12_, "1"); + _vala_assert (_tmp13_, "keys.contains (\"1\")"); + _tmp14_ = all_keys; + _tmp15_ = gee_multi_set_count (_tmp14_, "0"); + _vala_assert (_tmp15_ == 2, "all_keys.count (\"0\") == 2"); + _tmp16_ = all_keys; + _tmp17_ = gee_multi_set_count (_tmp16_, "1"); + _vala_assert (_tmp17_ == 1, "all_keys.count (\"1\") == 1"); + _tmp18_ = values; + _tmp19_ = gee_collection_contains (_tmp18_, "0"); + _vala_assert (_tmp19_, "values.contains (\"0\")"); + _tmp20_ = values; + _tmp21_ = gee_collection_contains (_tmp20_, "1"); + _vala_assert (_tmp21_, "values.contains (\"1\")"); + zero_found = FALSE; + zero_found_once = TRUE; + one_found = FALSE; + one_found_twice = FALSE; + nothing_more = TRUE; + { + GeeCollection* _tmp22_; + GeeIterator* _tmp23_ = NULL; + GeeIterator* _value_it; + _tmp22_ = values; + _tmp23_ = gee_iterable_iterator ((GeeIterable*) _tmp22_); + _value_it = _tmp23_; + while (TRUE) { + GeeIterator* _tmp24_; + gboolean _tmp25_ = FALSE; + GeeIterator* _tmp26_; + gpointer _tmp27_ = NULL; + gchar* value; + const gchar* _tmp28_; + _tmp24_ = _value_it; + _tmp25_ = gee_iterator_next (_tmp24_); + if (!_tmp25_) { + break; + } + _tmp26_ = _value_it; + _tmp27_ = gee_iterator_get (_tmp26_); + value = (gchar*) _tmp27_; + _tmp28_ = value; + if (g_strcmp0 (_tmp28_, "0") == 0) { + gboolean _tmp29_; + _tmp29_ = zero_found; + if (_tmp29_) { + zero_found_once = FALSE; + } + zero_found = TRUE; + } else { + const gchar* _tmp30_; + _tmp30_ = value; + if (g_strcmp0 (_tmp30_, "1") == 0) { + gboolean _tmp31_; + _tmp31_ = one_found; + if (_tmp31_) { + gboolean _tmp32_; + _tmp32_ = one_found_twice; + if (_tmp32_) { + one_found_twice = FALSE; + } else { + one_found_twice = TRUE; + } + } + one_found = TRUE; + } else { + nothing_more = FALSE; + } + } + _g_free0 (value); + } + _g_object_unref0 (_value_it); + } + _tmp33_ = zero_found; + _vala_assert (_tmp33_, "zero_found"); + _tmp34_ = zero_found_once; + _vala_assert (_tmp34_, "zero_found_once"); + _tmp35_ = one_found; + _vala_assert (_tmp35_, "one_found"); + _tmp36_ = one_found_twice; + _vala_assert (_tmp36_, "one_found_twice"); + _tmp37_ = nothing_more; + _vala_assert (_tmp37_, "nothing_more"); + _g_object_unref0 (values); + _g_object_unref0 (all_keys); + _g_object_unref0 (keys); +} + + +static void multi_map_tests_class_init (MultiMapTestsClass * klass) { + multi_map_tests_parent_class = g_type_class_peek_parent (klass); + G_OBJECT_CLASS (klass)->finalize = multi_map_tests_finalize; +} + + +static void multi_map_tests_instance_init (MultiMapTests * self) { +} + + +static void multi_map_tests_finalize (GObject* obj) { + MultiMapTests * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MULTI_MAP_TESTS, MultiMapTests); + _g_object_unref0 (self->test_multi_map); + G_OBJECT_CLASS (multi_map_tests_parent_class)->finalize (obj); +} + + +GType multi_map_tests_get_type (void) { + static volatile gsize multi_map_tests_type_id__volatile = 0; + if (g_once_init_enter (&multi_map_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (MultiMapTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) multi_map_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MultiMapTests), 0, (GInstanceInitFunc) multi_map_tests_instance_init, NULL }; + GType multi_map_tests_type_id; + multi_map_tests_type_id = g_type_register_static (GEE_TYPE_TEST_CASE, "MultiMapTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&multi_map_tests_type_id__volatile, multi_map_tests_type_id); + } + return multi_map_tests_type_id__volatile; +} + + + diff --git a/tests/testmultimap.vala b/tests/testmultimap.vala new file mode 100644 index 0000000..7a2f9e0 --- /dev/null +++ b/tests/testmultimap.vala @@ -0,0 +1,193 @@ +/* testmultimap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes' Villevalois + * Julien Peeters + */ + +using GLib; +using Gee; + +public abstract class MultiMapTests : Gee.TestCase { + + public MultiMapTests (string name) { + base (name); + add_test ("[MultiMap] size", test_size); + add_test ("[MultiMap] getting and setting", test_getting_setting); + add_test ("[MultiMap] keys, all keys and values", test_keys_all_keys_values); + } + + protected MultiMap test_multi_map; + + private void test_size () { + // Check the map exists + assert (test_multi_map != null); + + assert (test_multi_map.size == 0); + test_multi_map.set ("0", "0"); + assert (test_multi_map.size == 1); + test_multi_map.set ("0", "1"); + assert (test_multi_map.size == 2); + test_multi_map.remove ("0", "1"); + assert (test_multi_map.size == 1); + test_multi_map.set ("0", "1"); + test_multi_map.remove_all ("0"); + assert (test_multi_map.size == 0); + test_multi_map.set ("0", "0"); + assert (test_multi_map.size == 1); + test_multi_map.set ("1", "1"); + assert (test_multi_map.size == 2); + } + + private void test_getting_setting () { + // Check the map exists + assert (test_multi_map != null); + + test_multi_map.set ("0", "0"); + assert (test_multi_map.contains ("0")); + assert (test_multi_map.get ("0").size == 1); + assert (test_multi_map.get ("0").contains ("0")); + + assert (test_multi_map.get ("1").size == 0); + + test_multi_map.set ("0", "1"); + assert (test_multi_map.get ("0").size == 2); + assert (test_multi_map.get ("0").contains ("0")); + assert (test_multi_map.get ("0").contains ("1")); + + test_multi_map.set ("1", "1"); + assert (test_multi_map.contains ("1")); + assert (test_multi_map.get ("0").size == 2); + assert (test_multi_map.get ("0").contains ("0")); + assert (test_multi_map.get ("0").contains ("1")); + assert (test_multi_map.get ("1").size == 1); + assert (test_multi_map.get ("0").contains ("1")); + + // Check remove if bindings exist + assert (test_multi_map.remove ("0", "0")); + assert (test_multi_map.contains ("0")); + assert (! test_multi_map.get ("0").contains ("0")); + assert (test_multi_map.get ("0").contains ("1")); + assert (test_multi_map.contains ("1")); + assert (test_multi_map.get ("1").contains ("1")); + + // Check remove if only one binding exists + assert (test_multi_map.remove ("0", "1")); + assert (! test_multi_map.contains ("0")); + assert (! test_multi_map.get ("0").contains ("0")); + assert (! test_multi_map.get ("0").contains ("1")); + assert (test_multi_map.contains ("1")); + assert (test_multi_map.get ("1").contains ("1")); + + // Check remove if no binding exists + assert (! test_multi_map.remove ("0", "1")); + assert (! test_multi_map.contains ("0")); + assert (! test_multi_map.get ("0").contains ("0")); + assert (! test_multi_map.get ("0").contains ("1")); + assert (test_multi_map.contains ("1")); + assert (test_multi_map.get ("1").contains ("1")); + + test_multi_map.clear (); + assert (! test_multi_map.contains ("0")); + assert (! test_multi_map.contains ("1")); + + // Check remove_all + test_multi_map.set ("0", "0"); + test_multi_map.set ("0", "1"); + test_multi_map.set ("1", "1"); + assert (test_multi_map.size == 3); + + assert (test_multi_map.contains ("0")); + assert (test_multi_map.contains ("1")); + assert (test_multi_map.get ("0").size == 2); + assert (test_multi_map.get ("0").contains ("0")); + assert (test_multi_map.get ("0").contains ("1")); + assert (test_multi_map.get ("1").size == 1); + assert (test_multi_map.get ("0").contains ("1")); + + // Check remove_all if bindings exist + assert (test_multi_map.remove_all ("0")); + assert (! test_multi_map.contains ("0")); + assert (! test_multi_map.get ("0").contains ("0")); + assert (! test_multi_map.get ("0").contains ("1")); + assert (test_multi_map.contains ("1")); + assert (test_multi_map.get ("1").contains ("1")); + + // Check remove_all if no binding exists + assert (! test_multi_map.remove_all ("0")); + assert (! test_multi_map.contains ("0")); + assert (! test_multi_map.get ("0").contains ("0")); + assert (! test_multi_map.get ("0").contains ("1")); + assert (test_multi_map.contains ("1")); + assert (test_multi_map.get ("1").contains ("1")); + } + + private void test_keys_all_keys_values () { + // Check the map exists + assert (test_multi_map != null); + + test_multi_map.set ("0", "0"); + test_multi_map.set ("0", "1"); + test_multi_map.set ("1", "1"); + + // Check for keys, all_keys and values + Set keys = test_multi_map.get_keys (); + MultiSet all_keys = test_multi_map.get_all_keys (); + Collection values = test_multi_map.get_values (); + + assert (keys.contains ("0")); + assert (keys.contains ("1")); + assert (all_keys.count ("0") == 2); + assert (all_keys.count ("1") == 1); + assert (values.contains ("0")); + assert (values.contains ("1")); + + bool zero_found = false; + bool zero_found_once = true; + bool one_found = false; + bool one_found_twice = false; + bool nothing_more = true; + foreach (string value in values) { + if (value == "0") { + if (zero_found) { + zero_found_once = false; + } + zero_found = true; + } else if (value == "1") { + if (one_found) { + if (one_found_twice) { + one_found_twice = false; + } else { + one_found_twice = true; + } + } + one_found = true; + } else { + nothing_more = false; + } + } + assert (zero_found); + assert (zero_found_once); + assert (one_found); + assert (one_found_twice); + assert (nothing_more); + } +} diff --git a/tests/testmultiset.c b/tests/testmultiset.c new file mode 100644 index 0000000..81a4598 --- /dev/null +++ b/tests/testmultiset.c @@ -0,0 +1,260 @@ +/* testmultiset.c generated by valac 0.18.0, the Vala compiler + * generated from testmultiset.vala, do not modify */ + +/* testmultiset.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes' Villevalois + * Julien Peeters + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_MULTI_SET_TESTS (multi_set_tests_get_type ()) +#define MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_SET_TESTS, MultiSetTests)) +#define MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_SET_TESTS, MultiSetTestsClass)) +#define IS_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_SET_TESTS)) +#define IS_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_SET_TESTS)) +#define MULTI_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_SET_TESTS, MultiSetTestsClass)) + +typedef struct _MultiSetTests MultiSetTests; +typedef struct _MultiSetTestsClass MultiSetTestsClass; +typedef struct _MultiSetTestsPrivate MultiSetTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _MultiSetTests { + CollectionTests parent_instance; + MultiSetTestsPrivate * priv; +}; + +struct _MultiSetTestsClass { + CollectionTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer multi_set_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType multi_set_tests_get_type (void) G_GNUC_CONST; +enum { + MULTI_SET_TESTS_DUMMY_PROPERTY +}; +MultiSetTests* multi_set_tests_construct (GType object_type, const gchar* name); +CollectionTests* collection_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void multi_set_tests_test_duplicates_are_retained (MultiSetTests* self); +static void _multi_set_tests_test_duplicates_are_retained_gee_test_case_test_method (gpointer self); + + +static void _multi_set_tests_test_duplicates_are_retained_gee_test_case_test_method (gpointer self) { + multi_set_tests_test_duplicates_are_retained (self); +} + + +MultiSetTests* multi_set_tests_construct (GType object_type, const gchar* name) { + MultiSetTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (MultiSetTests*) collection_tests_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[MultiSet] duplicates are retained", _multi_set_tests_test_duplicates_are_retained_gee_test_case_test_method, self); + return self; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void multi_set_tests_test_duplicates_are_retained (MultiSetTests* self) { + GeeCollection* _tmp0_; + GeeMultiSet* _tmp1_; + GeeMultiSet* test_multi_set; + gint _tmp2_ = 0; + gboolean _tmp3_ = FALSE; + gboolean _tmp4_ = FALSE; + gint _tmp5_; + gint _tmp6_; + gint _tmp7_ = 0; + gboolean _tmp8_ = FALSE; + gboolean _tmp9_ = FALSE; + gint _tmp10_; + gint _tmp11_; + gint _tmp12_ = 0; + gboolean _tmp13_ = FALSE; + gboolean _tmp14_ = FALSE; + gint _tmp15_; + gint _tmp16_; + gint _tmp17_ = 0; + gboolean _tmp18_ = FALSE; + gboolean _tmp19_ = FALSE; + gint _tmp20_; + gint _tmp21_; + gint _tmp22_ = 0; + gboolean _tmp23_ = FALSE; + gboolean _tmp24_ = FALSE; + gint _tmp25_; + gint _tmp26_; + gint _tmp27_ = 0; + gboolean _tmp28_ = FALSE; + gboolean _tmp29_ = FALSE; + gint _tmp30_; + gint _tmp31_; + gint _tmp32_ = 0; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_MULTI_SET) ? ((GeeMultiSet*) _tmp0_) : NULL); + test_multi_set = _tmp1_; + _vala_assert (test_multi_set != NULL, "test_multi_set != null"); + _tmp2_ = gee_multi_set_count (test_multi_set, "one"); + _vala_assert (_tmp2_ == 0, "test_multi_set.count (\"one\") == 0"); + _tmp3_ = gee_collection_add ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp3_, "test_multi_set.add (\"one\")"); + _tmp4_ = gee_collection_contains ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp4_, "test_multi_set.contains (\"one\")"); + _tmp5_ = gee_collection_get_size ((GeeCollection*) test_multi_set); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_ == 1, "test_multi_set.size == 1"); + _tmp7_ = gee_multi_set_count (test_multi_set, "one"); + _vala_assert (_tmp7_ == 1, "test_multi_set.count (\"one\") == 1"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp8_, "test_multi_set.add (\"one\")"); + _tmp9_ = gee_collection_contains ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp9_, "test_multi_set.contains (\"one\")"); + _tmp10_ = gee_collection_get_size ((GeeCollection*) test_multi_set); + _tmp11_ = _tmp10_; + _vala_assert (_tmp11_ == 2, "test_multi_set.size == 2"); + _tmp12_ = gee_multi_set_count (test_multi_set, "one"); + _vala_assert (_tmp12_ == 2, "test_multi_set.count (\"one\") == 2"); + _tmp13_ = gee_collection_add ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp13_, "test_multi_set.add (\"one\")"); + _tmp14_ = gee_collection_contains ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp14_, "test_multi_set.contains (\"one\")"); + _tmp15_ = gee_collection_get_size ((GeeCollection*) test_multi_set); + _tmp16_ = _tmp15_; + _vala_assert (_tmp16_ == 3, "test_multi_set.size == 3"); + _tmp17_ = gee_multi_set_count (test_multi_set, "one"); + _vala_assert (_tmp17_ == 3, "test_multi_set.count (\"one\") == 3"); + _tmp18_ = gee_collection_remove ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp18_, "test_multi_set.remove (\"one\")"); + _tmp19_ = gee_collection_contains ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp19_, "test_multi_set.contains (\"one\")"); + _tmp20_ = gee_collection_get_size ((GeeCollection*) test_multi_set); + _tmp21_ = _tmp20_; + _vala_assert (_tmp21_ == 2, "test_multi_set.size == 2"); + _tmp22_ = gee_multi_set_count (test_multi_set, "one"); + _vala_assert (_tmp22_ == 2, "test_multi_set.count (\"one\") == 2"); + _tmp23_ = gee_collection_remove ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp23_, "test_multi_set.remove (\"one\")"); + _tmp24_ = gee_collection_contains ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp24_, "test_multi_set.contains (\"one\")"); + _tmp25_ = gee_collection_get_size ((GeeCollection*) test_multi_set); + _tmp26_ = _tmp25_; + _vala_assert (_tmp26_ == 1, "test_multi_set.size == 1"); + _tmp27_ = gee_multi_set_count (test_multi_set, "one"); + _vala_assert (_tmp27_ == 1, "test_multi_set.count (\"one\") == 1"); + _tmp28_ = gee_collection_remove ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp28_, "test_multi_set.remove (\"one\")"); + _tmp29_ = gee_collection_contains ((GeeCollection*) test_multi_set, "one"); + _vala_assert (!_tmp29_, "!test_multi_set.contains (\"one\")"); + _tmp30_ = gee_collection_get_size ((GeeCollection*) test_multi_set); + _tmp31_ = _tmp30_; + _vala_assert (_tmp31_ == 0, "test_multi_set.size == 0"); + _tmp32_ = gee_multi_set_count (test_multi_set, "one"); + _vala_assert (_tmp32_ == 0, "test_multi_set.count (\"one\") == 0"); + _g_object_unref0 (test_multi_set); +} + + +static void multi_set_tests_class_init (MultiSetTestsClass * klass) { + multi_set_tests_parent_class = g_type_class_peek_parent (klass); +} + + +static void multi_set_tests_instance_init (MultiSetTests * self) { +} + + +GType multi_set_tests_get_type (void) { + static volatile gsize multi_set_tests_type_id__volatile = 0; + if (g_once_init_enter (&multi_set_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (MultiSetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) multi_set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MultiSetTests), 0, (GInstanceInitFunc) multi_set_tests_instance_init, NULL }; + GType multi_set_tests_type_id; + multi_set_tests_type_id = g_type_register_static (TYPE_COLLECTION_TESTS, "MultiSetTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&multi_set_tests_type_id__volatile, multi_set_tests_type_id); + } + return multi_set_tests_type_id__volatile; +} + + + diff --git a/tests/testmultiset.vala b/tests/testmultiset.vala new file mode 100644 index 0000000..6812bdd --- /dev/null +++ b/tests/testmultiset.vala @@ -0,0 +1,75 @@ +/* testmultiset.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes' Villevalois + * Julien Peeters + */ + +using GLib; +using Gee; + +public abstract class MultiSetTests : CollectionTests { + + public MultiSetTests (string name) { + base (name); + add_test ("[MultiSet] duplicates are retained", + test_duplicates_are_retained); + } + + private void test_duplicates_are_retained () { + var test_multi_set = test_collection as MultiSet; + + // Check the test set is not null + assert (test_multi_set != null); + + assert (test_multi_set.count ("one") == 0); + + assert (test_multi_set.add ("one")); + assert (test_multi_set.contains ("one")); + assert (test_multi_set.size == 1); + assert (test_multi_set.count ("one") == 1); + + assert (test_multi_set.add ("one")); + assert (test_multi_set.contains ("one")); + assert (test_multi_set.size == 2); + assert (test_multi_set.count ("one") == 2); + + assert (test_multi_set.add ("one")); + assert (test_multi_set.contains ("one")); + assert (test_multi_set.size == 3); + assert (test_multi_set.count ("one") == 3); + + assert (test_multi_set.remove ("one")); + assert (test_multi_set.contains ("one")); + assert (test_multi_set.size == 2); + assert (test_multi_set.count ("one") == 2); + + assert (test_multi_set.remove ("one")); + assert (test_multi_set.contains ("one")); + assert (test_multi_set.size == 1); + assert (test_multi_set.count ("one") == 1); + + assert (test_multi_set.remove ("one")); + assert (!test_multi_set.contains ("one")); + assert (test_multi_set.size == 0); + assert (test_multi_set.count ("one") == 0); + } +} diff --git a/tests/testpriorityqueue.c b/tests/testpriorityqueue.c new file mode 100644 index 0000000..8bdbd4f --- /dev/null +++ b/tests/testpriorityqueue.c @@ -0,0 +1,520 @@ +/* testpriorityqueue.c generated by valac 0.18.0, the Vala compiler + * generated from testpriorityqueue.vala, do not modify */ + +/* testpriorityqueue.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Didier 'Ptitjes Villevalois + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_QUEUE_TESTS (queue_tests_get_type ()) +#define QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_QUEUE_TESTS, QueueTests)) +#define QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_QUEUE_TESTS, QueueTestsClass)) +#define IS_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_QUEUE_TESTS)) +#define IS_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_QUEUE_TESTS)) +#define QUEUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_QUEUE_TESTS, QueueTestsClass)) + +typedef struct _QueueTests QueueTests; +typedef struct _QueueTestsClass QueueTestsClass; +typedef struct _QueueTestsPrivate QueueTestsPrivate; + +#define TYPE_PRIORITY_QUEUE_TESTS (priority_queue_tests_get_type ()) +#define PRIORITY_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PRIORITY_QUEUE_TESTS, PriorityQueueTests)) +#define PRIORITY_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PRIORITY_QUEUE_TESTS, PriorityQueueTestsClass)) +#define IS_PRIORITY_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PRIORITY_QUEUE_TESTS)) +#define IS_PRIORITY_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PRIORITY_QUEUE_TESTS)) +#define PRIORITY_QUEUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PRIORITY_QUEUE_TESTS, PriorityQueueTestsClass)) + +typedef struct _PriorityQueueTests PriorityQueueTests; +typedef struct _PriorityQueueTestsClass PriorityQueueTestsClass; +typedef struct _PriorityQueueTestsPrivate PriorityQueueTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _QueueTests { + CollectionTests parent_instance; + QueueTestsPrivate * priv; +}; + +struct _QueueTestsClass { + CollectionTestsClass parent_class; +}; + +struct _PriorityQueueTests { + QueueTests parent_instance; + PriorityQueueTestsPrivate * priv; +}; + +struct _PriorityQueueTestsClass { + QueueTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer priority_queue_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType queue_tests_get_type (void) G_GNUC_CONST; +GType priority_queue_tests_get_type (void) G_GNUC_CONST; +enum { + PRIORITY_QUEUE_TESTS_DUMMY_PROPERTY +}; +PriorityQueueTests* priority_queue_tests_new (void); +PriorityQueueTests* priority_queue_tests_construct (GType object_type); +QueueTests* queue_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void priority_queue_tests_test_selected_functions (PriorityQueueTests* self); +static void _priority_queue_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +void priority_queue_tests_test_gobject_properties (PriorityQueueTests* self); +static void _priority_queue_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +static void priority_queue_tests_test_poll_gives_minimum (PriorityQueueTests* self); +static void _priority_queue_tests_test_poll_gives_minimum_gee_test_case_test_method (gpointer self); +static void priority_queue_tests_real_set_up (GeeTestCase* base); +static void priority_queue_tests_real_tear_down (GeeTestCase* base); + + +static void _priority_queue_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + priority_queue_tests_test_selected_functions (self); +} + + +static void _priority_queue_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + priority_queue_tests_test_gobject_properties (self); +} + + +static void _priority_queue_tests_test_poll_gives_minimum_gee_test_case_test_method (gpointer self) { + priority_queue_tests_test_poll_gives_minimum (self); +} + + +PriorityQueueTests* priority_queue_tests_construct (GType object_type) { + PriorityQueueTests * self = NULL; + self = (PriorityQueueTests*) queue_tests_construct (object_type, "PriorityQueue"); + gee_test_case_add_test ((GeeTestCase*) self, "[PriorityQueue] selected functions", _priority_queue_tests_test_selected_functions_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[PriorityQueue] GObject properties", _priority_queue_tests_test_gobject_properties_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[PriorityQueue] poll gives minimum", _priority_queue_tests_test_poll_gives_minimum_gee_test_case_test_method, self); + return self; +} + + +PriorityQueueTests* priority_queue_tests_new (void) { + return priority_queue_tests_construct (TYPE_PRIORITY_QUEUE_TESTS); +} + + +static void priority_queue_tests_real_set_up (GeeTestCase* base) { + PriorityQueueTests * self; + GeePriorityQueue* _tmp0_; + self = (PriorityQueueTests*) base; + _tmp0_ = gee_priority_queue_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; +} + + +static void priority_queue_tests_real_tear_down (GeeTestCase* base) { + PriorityQueueTests * self; + self = (PriorityQueueTests*) base; + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void priority_queue_tests_test_selected_functions (PriorityQueueTests* self) { + GeeCollection* _tmp0_; + GeePriorityQueue* _tmp1_; + GeePriorityQueue* test_queue; + GCompareFunc _tmp2_; + GCompareFunc _tmp3_; + GCompareFunc _tmp4_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_PRIORITY_QUEUE) ? ((GeePriorityQueue*) _tmp0_) : NULL); + test_queue = _tmp1_; + _vala_assert (test_queue != NULL, "test_queue != null"); + _tmp2_ = gee_priority_queue_get_compare_func (test_queue); + _tmp3_ = _tmp2_; + _tmp4_ = g_strcmp0; + _vala_assert (_tmp3_ == ((GCompareFunc) _tmp4_), "test_queue.compare_func == (CompareFunc) strcmp"); + _g_object_unref0 (test_queue); +} + + +void priority_queue_tests_test_gobject_properties (PriorityQueueTests* self) { + GeeCollection* _tmp0_; + GeePriorityQueue* _tmp1_; + GeePriorityQueue* test_queue; + GValue value = {0}; + GValue _tmp2_ = {0}; + GValue _tmp3_; + void* _tmp4_ = NULL; + GCompareFunc _tmp5_; + GCompareFunc _tmp6_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_PRIORITY_QUEUE) ? ((GeePriorityQueue*) _tmp0_) : NULL); + test_queue = _tmp1_; + _vala_assert (test_queue != NULL, "test_queue != null"); + g_value_init (&_tmp2_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp2_; + _tmp3_ = value; + g_object_get_property ((GObject*) test_queue, "compare-func", &value); + _tmp4_ = g_value_get_pointer (&value); + _tmp5_ = gee_priority_queue_get_compare_func (test_queue); + _tmp6_ = _tmp5_; + _vala_assert (_tmp4_ == ((void*) _tmp6_), "value.get_pointer () == (void*) test_queue.compare_func"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + _g_object_unref0 (test_queue); +} + + +static void priority_queue_tests_test_poll_gives_minimum (PriorityQueueTests* self) { + GeeCollection* _tmp0_; + GeeQueue* _tmp1_; + GeeQueue* test_queue; + gboolean _tmp2_ = FALSE; + gboolean _tmp3_ = FALSE; + gpointer _tmp4_ = NULL; + gchar* _tmp5_; + gboolean _tmp6_ = FALSE; + gpointer _tmp7_ = NULL; + gchar* _tmp8_; + gpointer _tmp9_ = NULL; + gchar* _tmp10_; + gboolean _tmp11_ = FALSE; + gboolean _tmp12_ = FALSE; + gboolean _tmp13_ = FALSE; + gboolean _tmp14_ = FALSE; + gboolean _tmp15_ = FALSE; + gboolean _tmp16_ = FALSE; + gboolean _tmp17_ = FALSE; + gboolean _tmp18_ = FALSE; + gboolean _tmp19_ = FALSE; + gboolean _tmp20_ = FALSE; + gboolean _tmp21_ = FALSE; + gboolean _tmp22_ = FALSE; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + gpointer _tmp25_ = NULL; + gchar* _tmp26_; + gpointer _tmp27_ = NULL; + gchar* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + gpointer _tmp31_ = NULL; + gchar* _tmp32_; + gpointer _tmp33_ = NULL; + gchar* _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + gpointer _tmp37_ = NULL; + gchar* _tmp38_; + gpointer _tmp39_ = NULL; + gchar* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + gpointer _tmp43_ = NULL; + gchar* _tmp44_; + gpointer _tmp45_ = NULL; + gchar* _tmp46_; + gpointer _tmp47_ = NULL; + gchar* _tmp48_; + gpointer _tmp49_ = NULL; + gchar* _tmp50_; + gpointer _tmp51_ = NULL; + gchar* _tmp52_; + gpointer _tmp53_ = NULL; + gchar* _tmp54_; + gpointer _tmp55_ = NULL; + gchar* _tmp56_; + gpointer _tmp57_ = NULL; + gchar* _tmp58_; + gpointer _tmp59_ = NULL; + gchar* _tmp60_; + gpointer _tmp61_ = NULL; + gchar* _tmp62_; + gpointer _tmp63_ = NULL; + gchar* _tmp64_; + gpointer _tmp65_ = NULL; + gchar* _tmp66_; + gpointer _tmp67_ = NULL; + gchar* _tmp68_; + gpointer _tmp69_ = NULL; + gchar* _tmp70_; + gboolean _tmp71_ = FALSE; + gboolean _tmp72_ = FALSE; + gpointer _tmp73_ = NULL; + gchar* _tmp74_; + gpointer _tmp75_ = NULL; + gchar* _tmp76_; + gpointer _tmp77_ = NULL; + gchar* _tmp78_; + gpointer _tmp79_ = NULL; + gchar* _tmp80_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_QUEUE) ? ((GeeQueue*) _tmp0_) : NULL); + test_queue = _tmp1_; + _vala_assert (test_queue != NULL, "test_queue != null"); + _tmp2_ = gee_queue_offer (test_queue, "one"); + _vala_assert (_tmp2_, "test_queue.offer (\"one\")"); + _tmp3_ = gee_queue_offer (test_queue, "two"); + _vala_assert (_tmp3_, "test_queue.offer (\"two\")"); + _tmp4_ = gee_queue_peek (test_queue); + _tmp5_ = (gchar*) _tmp4_; + _vala_assert (g_strcmp0 (_tmp5_, "one") == 0, "test_queue.peek () == \"one\""); + _g_free0 (_tmp5_); + _tmp6_ = gee_collection_remove ((GeeCollection*) test_queue, "two"); + _vala_assert (_tmp6_, "test_queue.remove (\"two\")"); + _tmp7_ = gee_queue_peek (test_queue); + _tmp8_ = (gchar*) _tmp7_; + _vala_assert (g_strcmp0 (_tmp8_, "one") == 0, "test_queue.peek () == \"one\""); + _g_free0 (_tmp8_); + _tmp9_ = gee_queue_poll (test_queue); + _tmp10_ = (gchar*) _tmp9_; + _vala_assert (g_strcmp0 (_tmp10_, "one") == 0, "test_queue.poll () == \"one\""); + _g_free0 (_tmp10_); + _tmp11_ = gee_queue_offer (test_queue, "one"); + _vala_assert (_tmp11_, "test_queue.offer (\"one\")"); + _tmp12_ = gee_queue_offer (test_queue, "two"); + _vala_assert (_tmp12_, "test_queue.offer (\"two\")"); + _tmp13_ = gee_queue_offer (test_queue, "three"); + _vala_assert (_tmp13_, "test_queue.offer (\"three\")"); + _tmp14_ = gee_queue_offer (test_queue, "four"); + _vala_assert (_tmp14_, "test_queue.offer (\"four\")"); + _tmp15_ = gee_queue_offer (test_queue, "five"); + _vala_assert (_tmp15_, "test_queue.offer (\"five\")"); + _tmp16_ = gee_queue_offer (test_queue, "six"); + _vala_assert (_tmp16_, "test_queue.offer (\"six\")"); + _tmp17_ = gee_queue_offer (test_queue, "seven"); + _vala_assert (_tmp17_, "test_queue.offer (\"seven\")"); + _tmp18_ = gee_queue_offer (test_queue, "eight"); + _vala_assert (_tmp18_, "test_queue.offer (\"eight\")"); + _tmp19_ = gee_queue_offer (test_queue, "nine"); + _vala_assert (_tmp19_, "test_queue.offer (\"nine\")"); + _tmp20_ = gee_queue_offer (test_queue, "ten"); + _vala_assert (_tmp20_, "test_queue.offer (\"ten\")"); + _tmp21_ = gee_queue_offer (test_queue, "eleven"); + _vala_assert (_tmp21_, "test_queue.offer (\"eleven\")"); + _tmp22_ = gee_queue_offer (test_queue, "twelve"); + _vala_assert (_tmp22_, "test_queue.offer (\"twelve\")"); + _tmp23_ = gee_queue_peek (test_queue); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "eight") == 0, "test_queue.peek () == \"eight\""); + _g_free0 (_tmp24_); + _tmp25_ = gee_queue_poll (test_queue); + _tmp26_ = (gchar*) _tmp25_; + _vala_assert (g_strcmp0 (_tmp26_, "eight") == 0, "test_queue.poll () == \"eight\""); + _g_free0 (_tmp26_); + _tmp27_ = gee_queue_peek (test_queue); + _tmp28_ = (gchar*) _tmp27_; + _vala_assert (g_strcmp0 (_tmp28_, "eleven") == 0, "test_queue.peek () == \"eleven\""); + _g_free0 (_tmp28_); + _tmp29_ = gee_queue_poll (test_queue); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "eleven") == 0, "test_queue.poll () == \"eleven\""); + _g_free0 (_tmp30_); + _tmp31_ = gee_queue_peek (test_queue); + _tmp32_ = (gchar*) _tmp31_; + _vala_assert (g_strcmp0 (_tmp32_, "five") == 0, "test_queue.peek () == \"five\""); + _g_free0 (_tmp32_); + _tmp33_ = gee_queue_poll (test_queue); + _tmp34_ = (gchar*) _tmp33_; + _vala_assert (g_strcmp0 (_tmp34_, "five") == 0, "test_queue.poll () == \"five\""); + _g_free0 (_tmp34_); + _tmp35_ = gee_queue_peek (test_queue); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "four") == 0, "test_queue.peek () == \"four\""); + _g_free0 (_tmp36_); + _tmp37_ = gee_queue_poll (test_queue); + _tmp38_ = (gchar*) _tmp37_; + _vala_assert (g_strcmp0 (_tmp38_, "four") == 0, "test_queue.poll () == \"four\""); + _g_free0 (_tmp38_); + _tmp39_ = gee_queue_peek (test_queue); + _tmp40_ = (gchar*) _tmp39_; + _vala_assert (g_strcmp0 (_tmp40_, "nine") == 0, "test_queue.peek () == \"nine\""); + _g_free0 (_tmp40_); + _tmp41_ = gee_queue_poll (test_queue); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (g_strcmp0 (_tmp42_, "nine") == 0, "test_queue.poll () == \"nine\""); + _g_free0 (_tmp42_); + _tmp43_ = gee_queue_peek (test_queue); + _tmp44_ = (gchar*) _tmp43_; + _vala_assert (g_strcmp0 (_tmp44_, "one") == 0, "test_queue.peek () == \"one\""); + _g_free0 (_tmp44_); + _tmp45_ = gee_queue_poll (test_queue); + _tmp46_ = (gchar*) _tmp45_; + _vala_assert (g_strcmp0 (_tmp46_, "one") == 0, "test_queue.poll () == \"one\""); + _g_free0 (_tmp46_); + _tmp47_ = gee_queue_peek (test_queue); + _tmp48_ = (gchar*) _tmp47_; + _vala_assert (g_strcmp0 (_tmp48_, "seven") == 0, "test_queue.peek () == \"seven\""); + _g_free0 (_tmp48_); + _tmp49_ = gee_queue_poll (test_queue); + _tmp50_ = (gchar*) _tmp49_; + _vala_assert (g_strcmp0 (_tmp50_, "seven") == 0, "test_queue.poll () == \"seven\""); + _g_free0 (_tmp50_); + _tmp51_ = gee_queue_peek (test_queue); + _tmp52_ = (gchar*) _tmp51_; + _vala_assert (g_strcmp0 (_tmp52_, "six") == 0, "test_queue.peek () == \"six\""); + _g_free0 (_tmp52_); + _tmp53_ = gee_queue_poll (test_queue); + _tmp54_ = (gchar*) _tmp53_; + _vala_assert (g_strcmp0 (_tmp54_, "six") == 0, "test_queue.poll () == \"six\""); + _g_free0 (_tmp54_); + _tmp55_ = gee_queue_peek (test_queue); + _tmp56_ = (gchar*) _tmp55_; + _vala_assert (g_strcmp0 (_tmp56_, "ten") == 0, "test_queue.peek () == \"ten\""); + _g_free0 (_tmp56_); + _tmp57_ = gee_queue_poll (test_queue); + _tmp58_ = (gchar*) _tmp57_; + _vala_assert (g_strcmp0 (_tmp58_, "ten") == 0, "test_queue.poll () == \"ten\""); + _g_free0 (_tmp58_); + _tmp59_ = gee_queue_peek (test_queue); + _tmp60_ = (gchar*) _tmp59_; + _vala_assert (g_strcmp0 (_tmp60_, "three") == 0, "test_queue.peek () == \"three\""); + _g_free0 (_tmp60_); + _tmp61_ = gee_queue_poll (test_queue); + _tmp62_ = (gchar*) _tmp61_; + _vala_assert (g_strcmp0 (_tmp62_, "three") == 0, "test_queue.poll () == \"three\""); + _g_free0 (_tmp62_); + _tmp63_ = gee_queue_peek (test_queue); + _tmp64_ = (gchar*) _tmp63_; + _vala_assert (g_strcmp0 (_tmp64_, "twelve") == 0, "test_queue.peek () == \"twelve\""); + _g_free0 (_tmp64_); + _tmp65_ = gee_queue_poll (test_queue); + _tmp66_ = (gchar*) _tmp65_; + _vala_assert (g_strcmp0 (_tmp66_, "twelve") == 0, "test_queue.poll () == \"twelve\""); + _g_free0 (_tmp66_); + _tmp67_ = gee_queue_peek (test_queue); + _tmp68_ = (gchar*) _tmp67_; + _vala_assert (g_strcmp0 (_tmp68_, "two") == 0, "test_queue.peek () == \"two\""); + _g_free0 (_tmp68_); + _tmp69_ = gee_queue_poll (test_queue); + _tmp70_ = (gchar*) _tmp69_; + _vala_assert (g_strcmp0 (_tmp70_, "two") == 0, "test_queue.poll () == \"two\""); + _g_free0 (_tmp70_); + _tmp71_ = gee_queue_offer (test_queue, "2"); + _vala_assert (_tmp71_, "test_queue.offer (\"2\")"); + _tmp72_ = gee_queue_offer (test_queue, "1"); + _vala_assert (_tmp72_, "test_queue.offer (\"1\")"); + _tmp73_ = gee_queue_peek (test_queue); + _tmp74_ = (gchar*) _tmp73_; + _vala_assert (g_strcmp0 (_tmp74_, "1") == 0, "test_queue.peek () == \"1\""); + _g_free0 (_tmp74_); + _tmp75_ = gee_queue_poll (test_queue); + _tmp76_ = (gchar*) _tmp75_; + _vala_assert (g_strcmp0 (_tmp76_, "1") == 0, "test_queue.poll () == \"1\""); + _g_free0 (_tmp76_); + _tmp77_ = gee_queue_peek (test_queue); + _tmp78_ = (gchar*) _tmp77_; + _vala_assert (g_strcmp0 (_tmp78_, "2") == 0, "test_queue.peek () == \"2\""); + _g_free0 (_tmp78_); + _tmp79_ = gee_queue_poll (test_queue); + _tmp80_ = (gchar*) _tmp79_; + _vala_assert (g_strcmp0 (_tmp80_, "2") == 0, "test_queue.poll () == \"2\""); + _g_free0 (_tmp80_); + _g_object_unref0 (test_queue); +} + + +static void priority_queue_tests_class_init (PriorityQueueTestsClass * klass) { + priority_queue_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = priority_queue_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = priority_queue_tests_real_tear_down; +} + + +static void priority_queue_tests_instance_init (PriorityQueueTests * self) { +} + + +GType priority_queue_tests_get_type (void) { + static volatile gsize priority_queue_tests_type_id__volatile = 0; + if (g_once_init_enter (&priority_queue_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (PriorityQueueTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) priority_queue_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PriorityQueueTests), 0, (GInstanceInitFunc) priority_queue_tests_instance_init, NULL }; + GType priority_queue_tests_type_id; + priority_queue_tests_type_id = g_type_register_static (TYPE_QUEUE_TESTS, "PriorityQueueTests", &g_define_type_info, 0); + g_once_init_leave (&priority_queue_tests_type_id__volatile, priority_queue_tests_type_id); + } + return priority_queue_tests_type_id__volatile; +} + + + diff --git a/tests/testpriorityqueue.vala b/tests/testpriorityqueue.vala new file mode 100644 index 0000000..cbeac2f --- /dev/null +++ b/tests/testpriorityqueue.vala @@ -0,0 +1,128 @@ +/* testpriorityqueue.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Didier 'Ptitjes Villevalois + */ + +using Gee; + +public class PriorityQueueTests : QueueTests { + + public PriorityQueueTests () { + base ("PriorityQueue"); + add_test ("[PriorityQueue] selected functions", test_selected_functions); + add_test ("[PriorityQueue] GObject properties", test_gobject_properties); + add_test ("[PriorityQueue] poll gives minimum", test_poll_gives_minimum); + } + + public override void set_up () { + test_collection = new PriorityQueue (); + } + + public override void tear_down () { + test_collection = null; + } + + private void test_selected_functions () { + var test_queue = test_collection as PriorityQueue; + + // Check the queue exists + assert (test_queue != null); + + // Check the selected compare function + assert (test_queue.compare_func == (CompareFunc) strcmp); + } + + public new void test_gobject_properties () { + var test_queue = test_collection as PriorityQueue; + + // Check the list exists + assert (test_queue != null); + Value value; + + value = Value (typeof (CompareFunc)); + test_queue.get_property ("compare-func", ref value); + assert (value.get_pointer () == (void*) test_queue.compare_func); + value.unset (); + } + + private void test_poll_gives_minimum () { + var test_queue = test_collection as Gee.Queue; + + // Check the queue exists + assert (test_queue != null); + + // Add two elements and remove the greatest + assert (test_queue.offer ("one")); + assert (test_queue.offer ("two")); + assert (test_queue.peek () == "one"); + assert (test_queue.remove ("two")); + assert (test_queue.peek () == "one"); + assert (test_queue.poll () == "one"); + + // Add twelve elements + assert (test_queue.offer ("one")); + assert (test_queue.offer ("two")); + assert (test_queue.offer ("three")); + assert (test_queue.offer ("four")); + assert (test_queue.offer ("five")); + assert (test_queue.offer ("six")); + assert (test_queue.offer ("seven")); + assert (test_queue.offer ("eight")); + assert (test_queue.offer ("nine")); + assert (test_queue.offer ("ten")); + assert (test_queue.offer ("eleven")); + assert (test_queue.offer ("twelve")); + + assert (test_queue.peek () == "eight"); + assert (test_queue.poll () == "eight"); + assert (test_queue.peek () == "eleven"); + assert (test_queue.poll () == "eleven"); + assert (test_queue.peek () == "five"); + assert (test_queue.poll () == "five"); + assert (test_queue.peek () == "four"); + assert (test_queue.poll () == "four"); + assert (test_queue.peek () == "nine"); + assert (test_queue.poll () == "nine"); + assert (test_queue.peek () == "one"); + assert (test_queue.poll () == "one"); + assert (test_queue.peek () == "seven"); + assert (test_queue.poll () == "seven"); + assert (test_queue.peek () == "six"); + assert (test_queue.poll () == "six"); + assert (test_queue.peek () == "ten"); + assert (test_queue.poll () == "ten"); + assert (test_queue.peek () == "three"); + assert (test_queue.poll () == "three"); + assert (test_queue.peek () == "twelve"); + assert (test_queue.poll () == "twelve"); + assert (test_queue.peek () == "two"); + assert (test_queue.poll () == "two"); + + // Add decreasing elements + assert (test_queue.offer ("2")); + assert (test_queue.offer ("1")); + + + assert (test_queue.peek () == "1"); + assert (test_queue.poll () == "1"); + assert (test_queue.peek () == "2"); + assert (test_queue.poll () == "2"); + } +} diff --git a/tests/testqueue.c b/tests/testqueue.c new file mode 100644 index 0000000..d31807b --- /dev/null +++ b/tests/testqueue.c @@ -0,0 +1,538 @@ +/* testqueue.c generated by valac 0.18.0, the Vala compiler + * generated from testqueue.vala, do not modify */ + +/* testqueue.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_QUEUE_TESTS (queue_tests_get_type ()) +#define QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_QUEUE_TESTS, QueueTests)) +#define QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_QUEUE_TESTS, QueueTestsClass)) +#define IS_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_QUEUE_TESTS)) +#define IS_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_QUEUE_TESTS)) +#define QUEUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_QUEUE_TESTS, QueueTestsClass)) + +typedef struct _QueueTests QueueTests; +typedef struct _QueueTestsClass QueueTestsClass; +typedef struct _QueueTestsPrivate QueueTestsPrivate; +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _QueueTests { + CollectionTests parent_instance; + QueueTestsPrivate * priv; +}; + +struct _QueueTestsClass { + CollectionTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer queue_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType queue_tests_get_type (void) G_GNUC_CONST; +enum { + QUEUE_TESTS_DUMMY_PROPERTY +}; +QueueTests* queue_tests_construct (GType object_type, const gchar* name); +CollectionTests* collection_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void queue_tests_test_capacity_bound (QueueTests* self); +static void _queue_tests_test_capacity_bound_gee_test_case_test_method (gpointer self); +void queue_tests_test_one_element_operation (QueueTests* self); +static void _queue_tests_test_one_element_operation_gee_test_case_test_method (gpointer self); +void queue_tests_test_gobject_properties (QueueTests* self); +static void _queue_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); + + +static void _queue_tests_test_capacity_bound_gee_test_case_test_method (gpointer self) { + queue_tests_test_capacity_bound (self); +} + + +static void _queue_tests_test_one_element_operation_gee_test_case_test_method (gpointer self) { + queue_tests_test_one_element_operation (self); +} + + +static void _queue_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + queue_tests_test_gobject_properties (self); +} + + +QueueTests* queue_tests_construct (GType object_type, const gchar* name) { + QueueTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (QueueTests*) collection_tests_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[Queue] capacity bound", _queue_tests_test_capacity_bound_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Queue] one element operation", _queue_tests_test_one_element_operation_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Queue] GObject properties", _queue_tests_test_gobject_properties_gee_test_case_test_method, self); + return self; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void queue_tests_test_capacity_bound (QueueTests* self) { + GeeCollection* _tmp0_; + GeeQueue* _tmp1_; + GeeQueue* test_queue; + GeeQueue* _tmp2_; + GeeQueue* _tmp3_; + gint _tmp4_; + gint _tmp5_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_QUEUE) ? ((GeeQueue*) _tmp0_) : NULL); + test_queue = _tmp1_; + _tmp2_ = test_queue; + _vala_assert (_tmp2_ != NULL, "test_queue != null"); + _tmp3_ = test_queue; + _tmp4_ = gee_queue_get_capacity (_tmp3_); + _tmp5_ = _tmp4_; + if (_tmp5_ == GEE_QUEUE_UNBOUNDED_CAPACITY) { + GeeQueue* _tmp6_; + gint _tmp7_; + gint _tmp8_; + GeeQueue* _tmp9_; + gboolean _tmp10_; + gboolean _tmp11_; + _tmp6_ = test_queue; + _tmp7_ = gee_queue_get_remaining_capacity (_tmp6_); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_ == GEE_QUEUE_UNBOUNDED_CAPACITY, "test_queue.remaining_capacity == Gee.Queue.UNBOUNDED_CAPACITY"); + _tmp9_ = test_queue; + _tmp10_ = gee_queue_get_is_full (_tmp9_); + _tmp11_ = _tmp10_; + _vala_assert (!_tmp11_, "! test_queue.is_full"); + } else { + GeeQueue* _tmp12_; + gboolean _tmp13_; + gboolean _tmp14_; + GeeQueue* _tmp15_; + gint _tmp16_; + gint _tmp17_; + gint capacity; + GeeQueue* _tmp33_; + gboolean _tmp34_; + gboolean _tmp35_; + GeeQueue* _tmp51_; + gboolean _tmp52_; + gboolean _tmp53_; + _tmp12_ = test_queue; + _tmp13_ = gee_collection_get_is_empty ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_, "test_queue.is_empty"); + _tmp15_ = test_queue; + _tmp16_ = gee_queue_get_capacity (_tmp15_); + _tmp17_ = _tmp16_; + capacity = _tmp17_; + { + gint i; + i = 1; + { + gboolean _tmp18_; + _tmp18_ = TRUE; + while (TRUE) { + gboolean _tmp19_; + gint _tmp21_; + gint _tmp22_; + GeeQueue* _tmp23_; + gboolean _tmp24_; + gboolean _tmp25_; + GeeQueue* _tmp26_; + gboolean _tmp27_ = FALSE; + GeeQueue* _tmp28_; + gint _tmp29_; + gint _tmp30_; + gint _tmp31_; + gint _tmp32_; + _tmp19_ = _tmp18_; + if (!_tmp19_) { + gint _tmp20_; + _tmp20_ = i; + i = _tmp20_ + 1; + } + _tmp18_ = FALSE; + _tmp21_ = i; + _tmp22_ = capacity; + if (!(_tmp21_ <= _tmp22_)) { + break; + } + _tmp23_ = test_queue; + _tmp24_ = gee_queue_get_is_full (_tmp23_); + _tmp25_ = _tmp24_; + _vala_assert (!_tmp25_, "! test_queue.is_full"); + _tmp26_ = test_queue; + _tmp27_ = gee_queue_offer (_tmp26_, "one"); + _vala_assert (_tmp27_, "test_queue.offer (\"one\")"); + _tmp28_ = test_queue; + _tmp29_ = gee_queue_get_remaining_capacity (_tmp28_); + _tmp30_ = _tmp29_; + _tmp31_ = capacity; + _tmp32_ = i; + _vala_assert (_tmp30_ == (_tmp31_ - _tmp32_), "test_queue.remaining_capacity == capacity - i"); + } + } + } + _tmp33_ = test_queue; + _tmp34_ = gee_queue_get_is_full (_tmp33_); + _tmp35_ = _tmp34_; + _vala_assert (_tmp35_, "test_queue.is_full"); + { + gint i; + i = 1; + { + gboolean _tmp36_; + _tmp36_ = TRUE; + while (TRUE) { + gboolean _tmp37_; + gint _tmp39_; + gint _tmp40_; + GeeQueue* _tmp41_; + gpointer _tmp42_ = NULL; + gchar* _tmp43_; + GeeQueue* _tmp44_; + gboolean _tmp45_; + gboolean _tmp46_; + GeeQueue* _tmp47_; + gint _tmp48_; + gint _tmp49_; + gint _tmp50_; + _tmp37_ = _tmp36_; + if (!_tmp37_) { + gint _tmp38_; + _tmp38_ = i; + i = _tmp38_ + 1; + } + _tmp36_ = FALSE; + _tmp39_ = i; + _tmp40_ = capacity; + if (!(_tmp39_ <= _tmp40_)) { + break; + } + _tmp41_ = test_queue; + _tmp42_ = gee_queue_poll (_tmp41_); + _tmp43_ = (gchar*) _tmp42_; + _vala_assert (g_strcmp0 (_tmp43_, "one") == 0, "test_queue.poll () == \"one\""); + _g_free0 (_tmp43_); + _tmp44_ = test_queue; + _tmp45_ = gee_queue_get_is_full (_tmp44_); + _tmp46_ = _tmp45_; + _vala_assert (!_tmp46_, "! test_queue.is_full"); + _tmp47_ = test_queue; + _tmp48_ = gee_queue_get_remaining_capacity (_tmp47_); + _tmp49_ = _tmp48_; + _tmp50_ = i; + _vala_assert (_tmp49_ == _tmp50_, "test_queue.remaining_capacity == i"); + } + } + } + _tmp51_ = test_queue; + _tmp52_ = gee_collection_get_is_empty ((GeeCollection*) _tmp51_); + _tmp53_ = _tmp52_; + _vala_assert (_tmp53_, "test_queue.is_empty"); + } + _g_object_unref0 (test_queue); +} + + +void queue_tests_test_one_element_operation (QueueTests* self) { + GeeCollection* _tmp0_; + GeeQueue* _tmp1_; + GeeQueue* test_queue; + GeeArrayList* _tmp2_; + GeeArrayList* recipient; + gboolean _tmp3_ = FALSE; + gpointer _tmp4_ = NULL; + gchar* _tmp5_; + gint _tmp6_; + gint _tmp7_; + gboolean _tmp8_; + gboolean _tmp9_; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gint _tmp12_; + gint _tmp13_; + gboolean _tmp14_; + gboolean _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + gboolean _tmp20_ = FALSE; + gint _tmp21_ = 0; + gint _tmp22_; + gint _tmp23_; + gboolean _tmp24_; + gboolean _tmp25_; + gint _tmp26_; + gint _tmp27_; + gpointer _tmp28_ = NULL; + gchar* _tmp29_; + gint _tmp30_ = 0; + gint _tmp31_; + gint _tmp32_; + gboolean _tmp33_; + gboolean _tmp34_; + gint _tmp35_; + gint _tmp36_; + gboolean _tmp37_ = FALSE; + gint _tmp38_ = 0; + gint _tmp39_; + gint _tmp40_; + gboolean _tmp41_; + gboolean _tmp42_; + gint _tmp43_; + gint _tmp44_; + gpointer _tmp45_ = NULL; + gchar* _tmp46_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_QUEUE) ? ((GeeQueue*) _tmp0_) : NULL); + test_queue = _tmp1_; + _tmp2_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + recipient = _tmp2_; + _vala_assert (test_queue != NULL, "test_queue != null"); + _tmp3_ = gee_queue_offer (test_queue, "one"); + _vala_assert (_tmp3_, "test_queue.offer (\"one\")"); + _tmp4_ = gee_queue_peek (test_queue); + _tmp5_ = (gchar*) _tmp4_; + _vala_assert (g_strcmp0 (_tmp5_, "one") == 0, "test_queue.peek () == \"one\""); + _g_free0 (_tmp5_); + _tmp6_ = gee_collection_get_size ((GeeCollection*) test_queue); + _tmp7_ = _tmp6_; + _vala_assert (_tmp7_ == 1, "test_queue.size == 1"); + _tmp8_ = gee_collection_get_is_empty ((GeeCollection*) test_queue); + _tmp9_ = _tmp8_; + _vala_assert (!_tmp9_, "! test_queue.is_empty"); + _tmp10_ = gee_queue_poll (test_queue); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "one") == 0, "test_queue.poll () == \"one\""); + _g_free0 (_tmp11_); + _tmp12_ = gee_collection_get_size ((GeeCollection*) test_queue); + _tmp13_ = _tmp12_; + _vala_assert (_tmp13_ == 0, "test_queue.size == 0"); + _tmp14_ = gee_collection_get_is_empty ((GeeCollection*) test_queue); + _tmp15_ = _tmp14_; + _vala_assert (_tmp15_, "test_queue.is_empty"); + _tmp16_ = gee_queue_peek (test_queue); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (_tmp17_ == NULL, "test_queue.peek () == null"); + _g_free0 (_tmp17_); + _tmp18_ = gee_queue_poll (test_queue); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (_tmp19_ == NULL, "test_queue.poll () == null"); + _g_free0 (_tmp19_); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp20_ = gee_queue_offer (test_queue, "one"); + _vala_assert (_tmp20_, "test_queue.offer (\"one\")"); + _tmp21_ = gee_queue_drain (test_queue, (GeeCollection*) recipient, 1); + _vala_assert (_tmp21_ == 1, "test_queue.drain (recipient, 1) == 1"); + _tmp22_ = gee_collection_get_size ((GeeCollection*) test_queue); + _tmp23_ = _tmp22_; + _vala_assert (_tmp23_ == 0, "test_queue.size == 0"); + _tmp24_ = gee_collection_get_is_empty ((GeeCollection*) test_queue); + _tmp25_ = _tmp24_; + _vala_assert (_tmp25_, "test_queue.is_empty"); + _tmp26_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp27_ = _tmp26_; + _vala_assert (_tmp27_ == 1, "recipient.size == 1"); + _tmp28_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 0); + _tmp29_ = (gchar*) _tmp28_; + _vala_assert (g_strcmp0 (_tmp29_, "one") == 0, "recipient.get (0) == \"one\""); + _g_free0 (_tmp29_); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp30_ = gee_queue_drain (test_queue, (GeeCollection*) recipient, 1); + _vala_assert (_tmp30_ == 0, "test_queue.drain (recipient, 1) == 0"); + _tmp31_ = gee_collection_get_size ((GeeCollection*) test_queue); + _tmp32_ = _tmp31_; + _vala_assert (_tmp32_ == 0, "test_queue.size == 0"); + _tmp33_ = gee_collection_get_is_empty ((GeeCollection*) test_queue); + _tmp34_ = _tmp33_; + _vala_assert (_tmp34_, "test_queue.is_empty"); + _tmp35_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp36_ = _tmp35_; + _vala_assert (_tmp36_ == 0, "recipient.size == 0"); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp37_ = gee_queue_offer (test_queue, "one"); + _vala_assert (_tmp37_, "test_queue.offer (\"one\")"); + _tmp38_ = gee_queue_drain (test_queue, (GeeCollection*) recipient, -1); + _vala_assert (_tmp38_ == 1, "test_queue.drain (recipient) == 1"); + _tmp39_ = gee_collection_get_size ((GeeCollection*) test_queue); + _tmp40_ = _tmp39_; + _vala_assert (_tmp40_ == 0, "test_queue.size == 0"); + _tmp41_ = gee_collection_get_is_empty ((GeeCollection*) test_queue); + _tmp42_ = _tmp41_; + _vala_assert (_tmp42_, "test_queue.is_empty"); + _tmp43_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp44_ = _tmp43_; + _vala_assert (_tmp44_ == 1, "recipient.size == 1"); + _tmp45_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 0); + _tmp46_ = (gchar*) _tmp45_; + _vala_assert (g_strcmp0 (_tmp46_, "one") == 0, "recipient.get (0) == \"one\""); + _g_free0 (_tmp46_); + _g_object_unref0 (recipient); + _g_object_unref0 (test_queue); +} + + +void queue_tests_test_gobject_properties (QueueTests* self) { + GeeCollection* _tmp0_; + GeeQueue* _tmp1_; + GeeQueue* test_queue; + GValue value = {0}; + GValue _tmp2_ = {0}; + GValue _tmp3_; + gint _tmp4_ = 0; + gint _tmp5_; + gint _tmp6_; + GValue _tmp7_ = {0}; + GValue _tmp8_; + gint _tmp9_ = 0; + gint _tmp10_; + gint _tmp11_; + GValue _tmp12_ = {0}; + GValue _tmp13_; + gboolean _tmp14_ = FALSE; + gboolean _tmp15_; + gboolean _tmp16_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_QUEUE) ? ((GeeQueue*) _tmp0_) : NULL); + test_queue = _tmp1_; + _vala_assert (test_queue != NULL, "test_queue != null"); + g_value_init (&_tmp2_, G_TYPE_INT); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp2_; + _tmp3_ = value; + g_object_get_property ((GObject*) test_queue, "capacity", &value); + _tmp4_ = g_value_get_int (&value); + _tmp5_ = gee_queue_get_capacity (test_queue); + _tmp6_ = _tmp5_; + _vala_assert (_tmp4_ == _tmp6_, "value.get_int () == test_queue.capacity"); + g_value_unset (&value); + g_value_init (&_tmp7_, G_TYPE_INT); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp7_; + _tmp8_ = value; + g_object_get_property ((GObject*) test_queue, "remaining-capacity", &value); + _tmp9_ = g_value_get_int (&value); + _tmp10_ = gee_queue_get_remaining_capacity (test_queue); + _tmp11_ = _tmp10_; + _vala_assert (_tmp9_ == _tmp11_, "value.get_int () == test_queue.remaining_capacity"); + g_value_unset (&value); + g_value_init (&_tmp12_, G_TYPE_BOOLEAN); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp12_; + _tmp13_ = value; + g_object_get_property ((GObject*) test_queue, "is-full", &value); + _tmp14_ = g_value_get_boolean (&value); + _tmp15_ = gee_queue_get_is_full (test_queue); + _tmp16_ = _tmp15_; + _vala_assert (_tmp14_ == _tmp16_, "value.get_boolean () == test_queue.is_full"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + _g_object_unref0 (test_queue); +} + + +static void queue_tests_class_init (QueueTestsClass * klass) { + queue_tests_parent_class = g_type_class_peek_parent (klass); +} + + +static void queue_tests_instance_init (QueueTests * self) { +} + + +GType queue_tests_get_type (void) { + static volatile gsize queue_tests_type_id__volatile = 0; + if (g_once_init_enter (&queue_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (QueueTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) queue_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (QueueTests), 0, (GInstanceInitFunc) queue_tests_instance_init, NULL }; + GType queue_tests_type_id; + queue_tests_type_id = g_type_register_static (TYPE_COLLECTION_TESTS, "QueueTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&queue_tests_type_id__volatile, queue_tests_type_id); + } + return queue_tests_type_id__volatile; +} + + + diff --git a/tests/testqueue.vala b/tests/testqueue.vala new file mode 100644 index 0000000..aaeb545 --- /dev/null +++ b/tests/testqueue.vala @@ -0,0 +1,137 @@ +/* testqueue.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + */ + +using Gee; + +public abstract class QueueTests : CollectionTests { + + public QueueTests (string name) { + base (name); + add_test ("[Queue] capacity bound", test_capacity_bound); + add_test ("[Queue] one element operation", test_one_element_operation); + add_test ("[Queue] GObject properties", test_gobject_properties); + } + + public void test_capacity_bound () { + var test_queue = test_collection as Gee.Queue; + + // Check the test queue is not null + assert (test_queue != null); + + if (test_queue.capacity == Gee.Queue.UNBOUNDED_CAPACITY) { + // Unbounded capacity + assert (test_queue.remaining_capacity == Gee.Queue.UNBOUNDED_CAPACITY); + assert (! test_queue.is_full); + } else { + // Bounded capacity + assert (test_queue.is_empty); + + // Check that we can fill it completely + int capacity = test_queue.capacity; + for (int i = 1; i <= capacity; i++) { + assert (! test_queue.is_full); + assert (test_queue.offer ("one")); + assert (test_queue.remaining_capacity == capacity - i); + } + assert (test_queue.is_full); + + // Check that we can empty it completely + for (int i = 1; i <= capacity; i++) { + assert (test_queue.poll () == "one"); + assert (! test_queue.is_full); + assert (test_queue.remaining_capacity == i); + } + assert (test_queue.is_empty); + } + } + + public void test_one_element_operation () { + var test_queue = test_collection as Gee.Queue; + ArrayList recipient = new ArrayList (); + + // Check the test queue is not null + assert (test_queue != null); + + // Check offer one element when there is none yet + assert (test_queue.offer ("one")); + assert (test_queue.peek () == "one"); + assert (test_queue.size == 1); + assert (! test_queue.is_empty); + + // Check poll when there is one element + assert (test_queue.poll () == "one"); + assert (test_queue.size == 0); + assert (test_queue.is_empty); + + // Check poll when there is no element + assert (test_queue.peek () == null); + assert (test_queue.poll () == null); + + // Check drain one element when there is one + recipient.clear (); + assert (test_queue.offer ("one")); + assert (test_queue.drain (recipient, 1) == 1); + assert (test_queue.size == 0); + assert (test_queue.is_empty); + assert (recipient.size == 1); + assert (recipient.get (0) == "one"); + + // Check drain one element when there is none + recipient.clear (); + assert (test_queue.drain (recipient, 1) == 0); + assert (test_queue.size == 0); + assert (test_queue.is_empty); + assert (recipient.size == 0); + + // Check drain all elements when there is one + recipient.clear (); + assert (test_queue.offer ("one")); + assert (test_queue.drain (recipient) == 1); + assert (test_queue.size == 0); + assert (test_queue.is_empty); + assert (recipient.size == 1); + assert (recipient.get (0) == "one"); + } + + public new void test_gobject_properties () { + var test_queue = test_collection as Gee.Queue; + + // Check the list exists + assert (test_queue != null); + Value value; + + value = Value (typeof (int)); + test_queue.get_property ("capacity", ref value); + assert (value.get_int () == test_queue.capacity); + value.unset (); + + value = Value (typeof (int)); + test_queue.get_property ("remaining-capacity", ref value); + assert (value.get_int () == test_queue.remaining_capacity); + value.unset (); + + value = Value (typeof (bool)); + test_queue.get_property ("is-full", ref value); + assert (value.get_boolean () == test_queue.is_full); + value.unset (); + } +} diff --git a/tests/testreadonlycollection.c b/tests/testreadonlycollection.c new file mode 100644 index 0000000..96122b6 --- /dev/null +++ b/tests/testreadonlycollection.c @@ -0,0 +1,780 @@ +/* testreadonlycollection.c generated by valac 0.18.0, the Vala compiler + * generated from testreadonlycollection.vala, do not modify */ + +/* testreadonlycollection.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Tomaž Vajngerl + * Julien Peeters + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_READ_ONLY_COLLECTION_TESTS (read_only_collection_tests_get_type ()) +#define READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTests)) +#define READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass)) +#define IS_READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_COLLECTION_TESTS)) +#define IS_READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_COLLECTION_TESTS)) +#define READ_ONLY_COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass)) + +typedef struct _ReadOnlyCollectionTests ReadOnlyCollectionTests; +typedef struct _ReadOnlyCollectionTestsClass ReadOnlyCollectionTestsClass; +typedef struct _ReadOnlyCollectionTestsPrivate ReadOnlyCollectionTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _ReadOnlyCollectionTests { + GeeTestCase parent_instance; + ReadOnlyCollectionTestsPrivate * priv; + GeeCollection* test_collection; + GeeCollection* ro_collection; +}; + +struct _ReadOnlyCollectionTestsClass { + GeeTestCaseClass parent_class; + GeeCollection* (*get_ro_view) (ReadOnlyCollectionTests* self, GeeCollection* collection); +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer read_only_collection_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType read_only_collection_tests_get_type (void) G_GNUC_CONST; +enum { + READ_ONLY_COLLECTION_TESTS_DUMMY_PROPERTY +}; +ReadOnlyCollectionTests* read_only_collection_tests_new (void); +ReadOnlyCollectionTests* read_only_collection_tests_construct (GType object_type); +ReadOnlyCollectionTests* read_only_collection_tests_new_with_name (const gchar* name); +ReadOnlyCollectionTests* read_only_collection_tests_construct_with_name (GType object_type, const gchar* name); +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void read_only_collection_tests_test_unique_read_only_view_instance (ReadOnlyCollectionTests* self); +static void _read_only_collection_tests_test_unique_read_only_view_instance_gee_test_case_test_method (gpointer self); +void read_only_collection_tests_test_immutable_iterator (ReadOnlyCollectionTests* self); +static void _read_only_collection_tests_test_immutable_iterator_gee_test_case_test_method (gpointer self); +void read_only_collection_tests_test_immutable (ReadOnlyCollectionTests* self); +static void _read_only_collection_tests_test_immutable_gee_test_case_test_method (gpointer self); +void read_only_collection_tests_test_accurate_view (ReadOnlyCollectionTests* self); +static void _read_only_collection_tests_test_accurate_view_gee_test_case_test_method (gpointer self); +static void read_only_collection_tests_real_set_up (GeeTestCase* base); +GeeCollection* read_only_collection_tests_get_ro_view (ReadOnlyCollectionTests* self, GeeCollection* collection); +static void read_only_collection_tests_real_tear_down (GeeTestCase* base); +static GeeCollection* read_only_collection_tests_real_get_ro_view (ReadOnlyCollectionTests* self, GeeCollection* collection); +static void read_only_collection_tests_finalize (GObject* obj); + + +ReadOnlyCollectionTests* read_only_collection_tests_construct (GType object_type) { + ReadOnlyCollectionTests * self = NULL; + self = (ReadOnlyCollectionTests*) read_only_collection_tests_construct_with_name (object_type, "ReadOnlyCollection"); + return self; +} + + +ReadOnlyCollectionTests* read_only_collection_tests_new (void) { + return read_only_collection_tests_construct (TYPE_READ_ONLY_COLLECTION_TESTS); +} + + +static void _read_only_collection_tests_test_unique_read_only_view_instance_gee_test_case_test_method (gpointer self) { + read_only_collection_tests_test_unique_read_only_view_instance (self); +} + + +static void _read_only_collection_tests_test_immutable_iterator_gee_test_case_test_method (gpointer self) { + read_only_collection_tests_test_immutable_iterator (self); +} + + +static void _read_only_collection_tests_test_immutable_gee_test_case_test_method (gpointer self) { + read_only_collection_tests_test_immutable (self); +} + + +static void _read_only_collection_tests_test_accurate_view_gee_test_case_test_method (gpointer self) { + read_only_collection_tests_test_accurate_view (self); +} + + +ReadOnlyCollectionTests* read_only_collection_tests_construct_with_name (GType object_type, const gchar* name) { + ReadOnlyCollectionTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (ReadOnlyCollectionTests*) gee_test_case_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyCollection] unique read-only view instance", _read_only_collection_tests_test_unique_read_only_view_instance_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyCollection] immutable iterator", _read_only_collection_tests_test_immutable_iterator_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyCollection] immutable", _read_only_collection_tests_test_immutable_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyCollection] accurate view", _read_only_collection_tests_test_accurate_view_gee_test_case_test_method, self); + return self; +} + + +ReadOnlyCollectionTests* read_only_collection_tests_new_with_name (const gchar* name) { + return read_only_collection_tests_construct_with_name (TYPE_READ_ONLY_COLLECTION_TESTS, name); +} + + +static void read_only_collection_tests_real_set_up (GeeTestCase* base) { + ReadOnlyCollectionTests * self; + GeeHashMultiSet* _tmp0_; + GeeCollection* _tmp1_; + GeeCollection* _tmp2_ = NULL; + self = (ReadOnlyCollectionTests*) base; + _tmp0_ = gee_hash_multi_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); + _g_object_unref0 (self->test_collection); + self->test_collection = (GeeCollection*) _tmp0_; + _tmp1_ = self->test_collection; + _tmp2_ = read_only_collection_tests_get_ro_view (self, _tmp1_); + _g_object_unref0 (self->ro_collection); + self->ro_collection = _tmp2_; +} + + +static void read_only_collection_tests_real_tear_down (GeeTestCase* base) { + ReadOnlyCollectionTests * self; + self = (ReadOnlyCollectionTests*) base; + _g_object_unref0 (self->test_collection); + self->test_collection = NULL; + _g_object_unref0 (self->ro_collection); + self->ro_collection = NULL; +} + + +static GeeCollection* read_only_collection_tests_real_get_ro_view (ReadOnlyCollectionTests* self, GeeCollection* collection) { + GeeCollection* result = NULL; + GeeCollection* _tmp0_; + GeeCollection* _tmp1_; + GeeCollection* _tmp2_; + g_return_val_if_fail (collection != NULL, NULL); + _tmp0_ = collection; + _tmp1_ = gee_collection_get_read_only_view (_tmp0_); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +GeeCollection* read_only_collection_tests_get_ro_view (ReadOnlyCollectionTests* self, GeeCollection* collection) { + g_return_val_if_fail (self != NULL, NULL); + return READ_ONLY_COLLECTION_TESTS_GET_CLASS (self)->get_ro_view (self, collection); +} + + +void read_only_collection_tests_test_unique_read_only_view_instance (ReadOnlyCollectionTests* self) { + GeeCollection* _tmp0_; + GeeCollection* _tmp1_ = NULL; + GeeCollection* another_ro_collection; + GeeCollection* _tmp2_; + GeeCollection* _tmp3_; + GeeCollection* _tmp4_; + GObject* _tmp5_; + GeeCollection* _tmp6_; + gconstpointer _tmp7_ = NULL; + GeeCollection* _tmp8_; + GeeCollection* _tmp9_ = NULL; + GeeCollection* _tmp10_; + gconstpointer _tmp11_ = NULL; + GeeCollection* _tmp12_; + GeeCollection* _tmp13_; + GeeCollection* _tmp14_ = NULL; + GeeCollection* _tmp15_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _tmp1_ = read_only_collection_tests_get_ro_view (self, _tmp0_); + another_ro_collection = _tmp1_; + _tmp2_ = self->ro_collection; + _tmp3_ = another_ro_collection; + _vala_assert (_tmp2_ == _tmp3_, "ro_collection == another_ro_collection"); + _tmp4_ = self->ro_collection; + _tmp5_ = g_object_new (G_TYPE_OBJECT, NULL); + g_object_set_data_full ((GObject*) _tmp4_, "marker", _tmp5_, g_object_unref); + _tmp6_ = another_ro_collection; + _tmp7_ = g_object_get_data ((GObject*) _tmp6_, "marker"); + _vala_assert (((GObject*) _tmp7_) != NULL, "another_ro_collection.get_data (\"marker\") != null"); + _g_object_unref0 (another_ro_collection); + another_ro_collection = NULL; + _g_object_unref0 (self->ro_collection); + self->ro_collection = NULL; + _tmp8_ = self->test_collection; + _tmp9_ = read_only_collection_tests_get_ro_view (self, _tmp8_); + _g_object_unref0 (another_ro_collection); + another_ro_collection = _tmp9_; + _tmp10_ = another_ro_collection; + _tmp11_ = g_object_get_data ((GObject*) _tmp10_, "marker"); + _vala_assert (((GObject*) _tmp11_) == NULL, "another_ro_collection.get_data (\"marker\") == null"); + _tmp12_ = another_ro_collection; + _tmp13_ = another_ro_collection; + _tmp14_ = read_only_collection_tests_get_ro_view (self, _tmp13_); + _tmp15_ = _tmp14_; + _vala_assert (_tmp12_ == _tmp15_, "another_ro_collection == get_ro_view (another_ro_collection)"); + _g_object_unref0 (_tmp15_); + _g_object_unref0 (another_ro_collection); +} + + +void read_only_collection_tests_test_immutable_iterator (ReadOnlyCollectionTests* self) { + GeeCollection* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeCollection* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeCollection* _tmp4_; + gint _tmp5_; + gint _tmp6_; + GeeCollection* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeCollection* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeCollection* _tmp11_; + GeeIterator* _tmp12_ = NULL; + GeeIterator* iterator; + gboolean one_found; + gboolean two_found; + gboolean _tmp22_; + gboolean _tmp23_; + GeeIterator* _tmp24_; + gboolean _tmp25_ = FALSE; + GeeIterator* _tmp26_; + gboolean _tmp27_ = FALSE; + GeeIterator* _tmp28_; + gboolean _tmp29_ = FALSE; + gboolean _tmp30_ = FALSE; + GeeCollection* _tmp32_; + gint _tmp33_; + gint _tmp34_; + GeeCollection* _tmp35_; + gboolean _tmp36_ = FALSE; + GeeCollection* _tmp37_; + gboolean _tmp38_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _tmp1_ = gee_collection_add (_tmp0_, "one"); + _vala_assert (_tmp1_, "test_collection.add (\"one\")"); + _tmp2_ = self->test_collection; + _tmp3_ = gee_collection_add (_tmp2_, "two"); + _vala_assert (_tmp3_, "test_collection.add (\"two\")"); + _tmp4_ = self->ro_collection; + _tmp5_ = gee_collection_get_size (_tmp4_); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_ == 2, "ro_collection.size == 2"); + _tmp7_ = self->ro_collection; + _tmp8_ = gee_collection_contains (_tmp7_, "one"); + _vala_assert (_tmp8_, "ro_collection.contains (\"one\")"); + _tmp9_ = self->ro_collection; + _tmp10_ = gee_collection_contains (_tmp9_, "two"); + _vala_assert (_tmp10_, "ro_collection.contains (\"two\")"); + _tmp11_ = self->ro_collection; + _tmp12_ = gee_iterable_iterator ((GeeIterable*) _tmp11_); + iterator = _tmp12_; + one_found = FALSE; + two_found = FALSE; + while (TRUE) { + GeeIterator* _tmp13_; + gboolean _tmp14_ = FALSE; + GeeIterator* _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + GQuark _tmp19_ = 0U; + static GQuark _tmp18_label0 = 0; + static GQuark _tmp18_label1 = 0; + _tmp13_ = iterator; + _tmp14_ = gee_iterator_next (_tmp13_); + if (!_tmp14_) { + break; + } + _tmp15_ = iterator; + _tmp16_ = gee_iterator_get (_tmp15_); + _tmp17_ = (gchar*) _tmp16_; + _tmp19_ = (NULL == _tmp17_) ? 0 : g_quark_from_string (_tmp17_); + g_free (_tmp17_); + if (_tmp19_ == ((0 != _tmp18_label0) ? _tmp18_label0 : (_tmp18_label0 = g_quark_from_static_string ("one")))) { + switch (0) { + default: + { + gboolean _tmp20_; + _tmp20_ = one_found; + _vala_assert (!_tmp20_, "! one_found"); + one_found = TRUE; + break; + } + } + } else if (_tmp19_ == ((0 != _tmp18_label1) ? _tmp18_label1 : (_tmp18_label1 = g_quark_from_static_string ("two")))) { + switch (0) { + default: + { + gboolean _tmp21_; + _tmp21_ = two_found; + _vala_assert (!_tmp21_, "! two_found"); + two_found = TRUE; + break; + } + } + } else { + switch (0) { + default: + { + g_assert_not_reached (); + } + } + } + } + _tmp22_ = one_found; + _vala_assert (_tmp22_, "one_found"); + _tmp23_ = two_found; + _vala_assert (_tmp23_, "two_found"); + _tmp24_ = iterator; + _tmp25_ = gee_iterator_has_next (_tmp24_); + _vala_assert (!_tmp25_, "! iterator.has_next ()"); + _tmp26_ = iterator; + _tmp27_ = gee_iterator_next (_tmp26_); + _vala_assert (!_tmp27_, "! iterator.next ()"); + _tmp28_ = iterator; + _tmp29_ = gee_iterator_first (_tmp28_); + _vala_assert (_tmp29_, "iterator.first ()"); + _tmp30_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp30_) { + GeeIterator* _tmp31_; + _tmp31_ = iterator; + gee_iterator_remove (_tmp31_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp32_ = self->ro_collection; + _tmp33_ = gee_collection_get_size (_tmp32_); + _tmp34_ = _tmp33_; + _vala_assert (_tmp34_ == 2, "ro_collection.size == 2"); + _tmp35_ = self->ro_collection; + _tmp36_ = gee_collection_contains (_tmp35_, "one"); + _vala_assert (_tmp36_, "ro_collection.contains (\"one\")"); + _tmp37_ = self->ro_collection; + _tmp38_ = gee_collection_contains (_tmp37_, "two"); + _vala_assert (_tmp38_, "ro_collection.contains (\"two\")"); + _g_object_unref0 (iterator); +} + + +void read_only_collection_tests_test_immutable (ReadOnlyCollectionTests* self) { + GeeCollection* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeCollection* _tmp2_; + gint _tmp3_; + gint _tmp4_; + GeeCollection* _tmp5_; + gboolean _tmp6_ = FALSE; + GeeArrayList* _tmp7_; + GeeCollection* dummy; + GeeCollection* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeCollection* _tmp10_; + gboolean _tmp11_ = FALSE; + gboolean _tmp12_ = FALSE; + GeeCollection* _tmp15_; + gint _tmp16_; + gint _tmp17_; + GeeCollection* _tmp18_; + gboolean _tmp19_ = FALSE; + gboolean _tmp20_ = FALSE; + GeeCollection* _tmp22_; + gint _tmp23_; + gint _tmp24_; + GeeCollection* _tmp25_; + gboolean _tmp26_ = FALSE; + gboolean _tmp27_ = FALSE; + GeeCollection* _tmp30_; + gint _tmp31_; + gint _tmp32_; + GeeCollection* _tmp33_; + gboolean _tmp34_ = FALSE; + gboolean _tmp35_ = FALSE; + GeeCollection* _tmp39_; + gint _tmp40_; + gint _tmp41_; + GeeCollection* _tmp42_; + gboolean _tmp43_ = FALSE; + gboolean _tmp44_ = FALSE; + GeeCollection* _tmp48_; + gint _tmp49_; + gint _tmp50_; + GeeCollection* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeCollection* _tmp53_; + gboolean _tmp54_ = FALSE; + gboolean _tmp55_ = FALSE; + GeeCollection* _tmp59_; + gint _tmp60_; + gint _tmp61_; + GeeCollection* _tmp62_; + gboolean _tmp63_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _tmp1_ = gee_collection_add (_tmp0_, "one"); + _vala_assert (_tmp1_, "test_collection.add (\"one\")"); + _tmp2_ = self->ro_collection; + _tmp3_ = gee_collection_get_size (_tmp2_); + _tmp4_ = _tmp3_; + _vala_assert (_tmp4_ == 1, "ro_collection.size == 1"); + _tmp5_ = self->ro_collection; + _tmp6_ = gee_collection_contains (_tmp5_, "one"); + _vala_assert (_tmp6_, "ro_collection.contains (\"one\")"); + _tmp7_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = (GeeCollection*) _tmp7_; + _tmp8_ = dummy; + _tmp9_ = gee_collection_add (_tmp8_, "one"); + _vala_assert (_tmp9_, "dummy.add (\"one\")"); + _tmp10_ = dummy; + _tmp11_ = gee_collection_add (_tmp10_, "two"); + _vala_assert (_tmp11_, "dummy.add (\"two\")"); + _tmp12_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp12_) { + GeeCollection* _tmp13_; + gboolean _tmp14_ = FALSE; + _tmp13_ = self->ro_collection; + _tmp14_ = gee_collection_add (_tmp13_, "two"); + _vala_assert (_tmp14_, "ro_collection.add (\"two\")"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp15_ = self->ro_collection; + _tmp16_ = gee_collection_get_size (_tmp15_); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_ == 1, "ro_collection.size == 1"); + _tmp18_ = self->ro_collection; + _tmp19_ = gee_collection_contains (_tmp18_, "one"); + _vala_assert (_tmp19_, "ro_collection.contains (\"one\")"); + _tmp20_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp20_) { + GeeCollection* _tmp21_; + _tmp21_ = self->ro_collection; + gee_collection_clear (_tmp21_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp22_ = self->ro_collection; + _tmp23_ = gee_collection_get_size (_tmp22_); + _tmp24_ = _tmp23_; + _vala_assert (_tmp24_ == 1, "ro_collection.size == 1"); + _tmp25_ = self->ro_collection; + _tmp26_ = gee_collection_contains (_tmp25_, "one"); + _vala_assert (_tmp26_, "ro_collection.contains (\"one\")"); + _tmp27_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp27_) { + GeeCollection* _tmp28_; + gboolean _tmp29_ = FALSE; + _tmp28_ = self->ro_collection; + _tmp29_ = gee_collection_remove (_tmp28_, "one"); + _vala_assert (_tmp29_, "ro_collection.remove (\"one\")"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp30_ = self->ro_collection; + _tmp31_ = gee_collection_get_size (_tmp30_); + _tmp32_ = _tmp31_; + _vala_assert (_tmp32_ == 1, "ro_collection.size == 1"); + _tmp33_ = self->ro_collection; + _tmp34_ = gee_collection_contains (_tmp33_, "one"); + _vala_assert (_tmp34_, "ro_collection.contains (\"one\")"); + _tmp35_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp35_) { + GeeCollection* _tmp36_; + GeeCollection* _tmp37_; + gboolean _tmp38_ = FALSE; + _tmp36_ = self->ro_collection; + _tmp37_ = dummy; + _tmp38_ = gee_collection_add_all (_tmp36_, _tmp37_); + _vala_assert (_tmp38_, "ro_collection.add_all (dummy)"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp39_ = self->ro_collection; + _tmp40_ = gee_collection_get_size (_tmp39_); + _tmp41_ = _tmp40_; + _vala_assert (_tmp41_ == 1, "ro_collection.size == 1"); + _tmp42_ = self->ro_collection; + _tmp43_ = gee_collection_contains (_tmp42_, "one"); + _vala_assert (_tmp43_, "ro_collection.contains (\"one\")"); + _tmp44_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp44_) { + GeeCollection* _tmp45_; + GeeCollection* _tmp46_; + gboolean _tmp47_ = FALSE; + _tmp45_ = self->ro_collection; + _tmp46_ = dummy; + _tmp47_ = gee_collection_remove_all (_tmp45_, _tmp46_); + _vala_assert (_tmp47_, "ro_collection.remove_all (dummy)"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp48_ = self->ro_collection; + _tmp49_ = gee_collection_get_size (_tmp48_); + _tmp50_ = _tmp49_; + _vala_assert (_tmp50_ == 1, "ro_collection.size == 1"); + _tmp51_ = self->ro_collection; + _tmp52_ = gee_collection_contains (_tmp51_, "one"); + _vala_assert (_tmp52_, "ro_collection.contains (\"one\")"); + _tmp53_ = dummy; + _tmp54_ = gee_collection_remove (_tmp53_, "one"); + _vala_assert (_tmp54_, "dummy.remove (\"one\")"); + _tmp55_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp55_) { + GeeCollection* _tmp56_; + GeeCollection* _tmp57_; + gboolean _tmp58_ = FALSE; + _tmp56_ = self->ro_collection; + _tmp57_ = dummy; + _tmp58_ = gee_collection_retain_all (_tmp56_, _tmp57_); + _vala_assert (_tmp58_, "ro_collection.retain_all (dummy)"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp59_ = self->ro_collection; + _tmp60_ = gee_collection_get_size (_tmp59_); + _tmp61_ = _tmp60_; + _vala_assert (_tmp61_ == 1, "ro_collection.size == 1"); + _tmp62_ = self->ro_collection; + _tmp63_ = gee_collection_contains (_tmp62_, "one"); + _vala_assert (_tmp63_, "ro_collection.contains (\"one\")"); + _g_object_unref0 (dummy); +} + + +void read_only_collection_tests_test_accurate_view (ReadOnlyCollectionTests* self) { + GeeArrayList* _tmp0_; + GeeCollection* dummy; + gboolean _tmp1_ = FALSE; + gboolean _tmp2_ = FALSE; + GeeCollection* _tmp3_; + GType _tmp4_; + GType _tmp5_; + GeeCollection* _tmp6_; + gint _tmp7_; + gint _tmp8_; + GeeCollection* _tmp9_; + gboolean _tmp10_; + gboolean _tmp11_; + GeeCollection* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeCollection* _tmp14_; + gboolean _tmp15_ = FALSE; + GeeCollection* _tmp16_; + gint _tmp17_; + gint _tmp18_; + GeeCollection* _tmp19_; + gboolean _tmp20_; + gboolean _tmp21_; + GeeCollection* _tmp22_; + gboolean _tmp23_ = FALSE; + GeeCollection* _tmp24_; + gboolean _tmp25_ = FALSE; + GeeCollection* _tmp26_; + gint _tmp27_; + gint _tmp28_; + GeeCollection* _tmp29_; + gboolean _tmp30_; + gboolean _tmp31_; + GeeCollection* _tmp32_; + gboolean _tmp33_ = FALSE; + GeeCollection* _tmp34_; + gboolean _tmp35_ = FALSE; + GeeCollection* _tmp36_; + gboolean _tmp37_ = FALSE; + GeeCollection* _tmp38_; + gboolean _tmp39_ = FALSE; + GeeCollection* _tmp40_; + gint _tmp41_; + gint _tmp42_; + GeeCollection* _tmp43_; + gboolean _tmp44_; + gboolean _tmp45_; + GeeCollection* _tmp46_; + gboolean _tmp47_ = FALSE; + GeeCollection* _tmp48_; + gboolean _tmp49_ = FALSE; + GeeCollection* _tmp50_; + gboolean _tmp51_ = FALSE; + GeeCollection* _tmp52_; + GeeCollection* _tmp53_; + gint _tmp54_; + gint _tmp55_; + GeeCollection* _tmp56_; + gboolean _tmp57_; + gboolean _tmp58_; + GeeCollection* _tmp59_; + gboolean _tmp60_ = FALSE; + GeeCollection* _tmp61_; + gboolean _tmp62_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = (GeeCollection*) _tmp0_; + _tmp1_ = gee_collection_add (dummy, "one"); + _vala_assert (_tmp1_, "dummy.add (\"one\")"); + _tmp2_ = gee_collection_add (dummy, "two"); + _vala_assert (_tmp2_, "dummy.add (\"two\")"); + _tmp3_ = self->ro_collection; + _tmp4_ = gee_iterable_get_element_type ((GeeIterable*) _tmp3_); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == G_TYPE_STRING, "ro_collection.element_type == typeof (string)"); + _tmp6_ = self->ro_collection; + _tmp7_ = gee_collection_get_size (_tmp6_); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_ == 0, "ro_collection.size == 0"); + _tmp9_ = self->ro_collection; + _tmp10_ = gee_collection_get_is_empty (_tmp9_); + _tmp11_ = _tmp10_; + _vala_assert (_tmp11_, "ro_collection.is_empty"); + _tmp12_ = self->ro_collection; + _tmp13_ = gee_collection_contains (_tmp12_, "one"); + _vala_assert (!_tmp13_, "! ro_collection.contains (\"one\")"); + _tmp14_ = self->test_collection; + _tmp15_ = gee_collection_add (_tmp14_, "one"); + _vala_assert (_tmp15_, "test_collection.add (\"one\")"); + _tmp16_ = self->ro_collection; + _tmp17_ = gee_collection_get_size (_tmp16_); + _tmp18_ = _tmp17_; + _vala_assert (_tmp18_ == 1, "ro_collection.size == 1"); + _tmp19_ = self->ro_collection; + _tmp20_ = gee_collection_get_is_empty (_tmp19_); + _tmp21_ = _tmp20_; + _vala_assert (!_tmp21_, "! ro_collection.is_empty"); + _tmp22_ = self->ro_collection; + _tmp23_ = gee_collection_contains (_tmp22_, "one"); + _vala_assert (_tmp23_, "ro_collection.contains (\"one\")"); + _tmp24_ = self->test_collection; + _tmp25_ = gee_collection_add (_tmp24_, "two"); + _vala_assert (_tmp25_, "test_collection.add (\"two\")"); + _tmp26_ = self->ro_collection; + _tmp27_ = gee_collection_get_size (_tmp26_); + _tmp28_ = _tmp27_; + _vala_assert (_tmp28_ == 2, "ro_collection.size == 2"); + _tmp29_ = self->ro_collection; + _tmp30_ = gee_collection_get_is_empty (_tmp29_); + _tmp31_ = _tmp30_; + _vala_assert (!_tmp31_, "! ro_collection.is_empty"); + _tmp32_ = self->ro_collection; + _tmp33_ = gee_collection_contains (_tmp32_, "one"); + _vala_assert (_tmp33_, "ro_collection.contains (\"one\")"); + _tmp34_ = self->ro_collection; + _tmp35_ = gee_collection_contains (_tmp34_, "two"); + _vala_assert (_tmp35_, "ro_collection.contains (\"two\")"); + _tmp36_ = self->ro_collection; + _tmp37_ = gee_collection_contains_all (_tmp36_, dummy); + _vala_assert (_tmp37_, "ro_collection.contains_all (dummy)"); + _tmp38_ = self->test_collection; + _tmp39_ = gee_collection_remove (_tmp38_, "one"); + _vala_assert (_tmp39_, "test_collection.remove (\"one\")"); + _tmp40_ = self->ro_collection; + _tmp41_ = gee_collection_get_size (_tmp40_); + _tmp42_ = _tmp41_; + _vala_assert (_tmp42_ == 1, "ro_collection.size == 1"); + _tmp43_ = self->ro_collection; + _tmp44_ = gee_collection_get_is_empty (_tmp43_); + _tmp45_ = _tmp44_; + _vala_assert (!_tmp45_, "! ro_collection.is_empty"); + _tmp46_ = self->ro_collection; + _tmp47_ = gee_collection_contains (_tmp46_, "one"); + _vala_assert (!_tmp47_, "! ro_collection.contains (\"one\")"); + _tmp48_ = self->ro_collection; + _tmp49_ = gee_collection_contains (_tmp48_, "two"); + _vala_assert (_tmp49_, "ro_collection.contains (\"two\")"); + _tmp50_ = self->ro_collection; + _tmp51_ = gee_collection_contains_all (_tmp50_, dummy); + _vala_assert (!_tmp51_, "! ro_collection.contains_all (dummy)"); + _tmp52_ = self->test_collection; + gee_collection_clear (_tmp52_); + _tmp53_ = self->ro_collection; + _tmp54_ = gee_collection_get_size (_tmp53_); + _tmp55_ = _tmp54_; + _vala_assert (_tmp55_ == 0, "ro_collection.size == 0"); + _tmp56_ = self->ro_collection; + _tmp57_ = gee_collection_get_is_empty (_tmp56_); + _tmp58_ = _tmp57_; + _vala_assert (_tmp58_, "ro_collection.is_empty"); + _tmp59_ = self->ro_collection; + _tmp60_ = gee_collection_contains (_tmp59_, "one"); + _vala_assert (!_tmp60_, "! ro_collection.contains (\"one\")"); + _tmp61_ = self->ro_collection; + _tmp62_ = gee_collection_contains (_tmp61_, "two"); + _vala_assert (!_tmp62_, "! ro_collection.contains (\"two\")"); + _g_object_unref0 (dummy); +} + + +static void read_only_collection_tests_class_init (ReadOnlyCollectionTestsClass * klass) { + read_only_collection_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = read_only_collection_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = read_only_collection_tests_real_tear_down; + READ_ONLY_COLLECTION_TESTS_CLASS (klass)->get_ro_view = read_only_collection_tests_real_get_ro_view; + G_OBJECT_CLASS (klass)->finalize = read_only_collection_tests_finalize; +} + + +static void read_only_collection_tests_instance_init (ReadOnlyCollectionTests * self) { +} + + +static void read_only_collection_tests_finalize (GObject* obj) { + ReadOnlyCollectionTests * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTests); + _g_object_unref0 (self->test_collection); + _g_object_unref0 (self->ro_collection); + G_OBJECT_CLASS (read_only_collection_tests_parent_class)->finalize (obj); +} + + +GType read_only_collection_tests_get_type (void) { + static volatile gsize read_only_collection_tests_type_id__volatile = 0; + if (g_once_init_enter (&read_only_collection_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (ReadOnlyCollectionTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) read_only_collection_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ReadOnlyCollectionTests), 0, (GInstanceInitFunc) read_only_collection_tests_instance_init, NULL }; + GType read_only_collection_tests_type_id; + read_only_collection_tests_type_id = g_type_register_static (GEE_TYPE_TEST_CASE, "ReadOnlyCollectionTests", &g_define_type_info, 0); + g_once_init_leave (&read_only_collection_tests_type_id__volatile, read_only_collection_tests_type_id); + } + return read_only_collection_tests_type_id__volatile; +} + + + diff --git a/tests/testreadonlycollection.vala b/tests/testreadonlycollection.vala new file mode 100644 index 0000000..42134f5 --- /dev/null +++ b/tests/testreadonlycollection.vala @@ -0,0 +1,225 @@ +/* testreadonlycollection.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Tomaž Vajngerl + * Julien Peeters + */ + +using Gee; + +public class ReadOnlyCollectionTests : Gee.TestCase { + + public ReadOnlyCollectionTests () { + this.with_name ("ReadOnlyCollection"); + } + + public ReadOnlyCollectionTests.with_name (string name) { + base (name); + add_test ("[ReadOnlyCollection] unique read-only view instance", + test_unique_read_only_view_instance); + add_test ("[ReadOnlyCollection] immutable iterator", test_immutable_iterator); + add_test ("[ReadOnlyCollection] immutable", test_immutable); + add_test ("[ReadOnlyCollection] accurate view", test_accurate_view); + } + + protected Collection test_collection; + protected Collection ro_collection; + + public override void set_up () { + test_collection = new HashMultiSet (); + ro_collection = get_ro_view (test_collection); + } + + public override void tear_down () { + test_collection = null; + ro_collection = null; + } + + protected virtual Collection get_ro_view (Collection collection) { + return collection.read_only_view; + } + + public void test_unique_read_only_view_instance () { + var another_ro_collection = get_ro_view (test_collection); + assert (ro_collection == another_ro_collection); + + ro_collection.set_data ("marker", new Object ()); + assert (another_ro_collection.get_data ("marker") != null); + + another_ro_collection = null; + ro_collection = null; + + another_ro_collection = get_ro_view (test_collection); + assert (another_ro_collection.get_data ("marker") == null); + + // Check that the read-only view of the view is itself + assert (another_ro_collection == get_ro_view (another_ro_collection)); + } + + public void test_immutable_iterator () { + assert (test_collection.add ("one")); + assert (test_collection.add ("two")); + + assert (ro_collection.size == 2); + assert (ro_collection.contains ("one")); + assert (ro_collection.contains ("two")); + + Iterator iterator = ro_collection.iterator (); + + bool one_found = false; + bool two_found = false; + + while (iterator.next ()) { + switch(iterator.get ()) { + case "one": + assert (! one_found); + one_found = true; + break; + case "two": + assert (! two_found); + two_found = true; + break; + default: + assert_not_reached (); + } + } + + assert (one_found); + assert (two_found); + + assert (! iterator.has_next ()); + assert (! iterator.next ()); + + assert (iterator.first ()); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iterator.remove (); + Posix.exit (0); + } + Test.trap_assert_failed (); + + assert (ro_collection.size == 2); + assert (ro_collection.contains ("one")); + assert (ro_collection.contains ("two")); + } + + public void test_immutable () { + assert (test_collection.add ("one")); + assert (ro_collection.size == 1); + assert (ro_collection.contains ("one")); + + Collection dummy = new ArrayList (); + assert (dummy.add ("one")); + assert (dummy.add ("two")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (ro_collection.add ("two")); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_collection.size == 1); + assert (ro_collection.contains ("one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_collection.clear (); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_collection.size == 1); + assert (ro_collection.contains ("one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (ro_collection.remove ("one")); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_collection.size == 1); + assert (ro_collection.contains ("one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (ro_collection.add_all (dummy)); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_collection.size == 1); + assert (ro_collection.contains ("one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (ro_collection.remove_all (dummy)); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_collection.size == 1); + assert (ro_collection.contains ("one")); + + assert (dummy.remove ("one")); + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (ro_collection.retain_all (dummy)); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_collection.size == 1); + assert (ro_collection.contains ("one")); + } + + public void test_accurate_view () { + Collection dummy = new ArrayList (); + assert (dummy.add ("one")); + assert (dummy.add ("two")); + + assert (ro_collection.element_type == typeof (string)); + + assert (ro_collection.size == 0); + assert (ro_collection.is_empty); + assert (! ro_collection.contains ("one")); + + assert (test_collection.add ("one")); + assert (ro_collection.size == 1); + assert (! ro_collection.is_empty); + assert (ro_collection.contains ("one")); + + assert (test_collection.add ("two")); + assert (ro_collection.size == 2); + assert (! ro_collection.is_empty); + assert (ro_collection.contains ("one")); + assert (ro_collection.contains ("two")); + assert (ro_collection.contains_all (dummy)); + + assert (test_collection.remove ("one")); + assert (ro_collection.size == 1); + assert (! ro_collection.is_empty); + assert (! ro_collection.contains ("one")); + assert (ro_collection.contains ("two")); + assert (! ro_collection.contains_all (dummy)); + + test_collection.clear (); + assert (ro_collection.size == 0); + assert (ro_collection.is_empty); + assert (! ro_collection.contains ("one")); + assert (! ro_collection.contains ("two")); + } +} diff --git a/tests/testreadonlylist.c b/tests/testreadonlylist.c new file mode 100644 index 0000000..9a53a3c --- /dev/null +++ b/tests/testreadonlylist.c @@ -0,0 +1,904 @@ +/* testreadonlylist.c generated by valac 0.18.0, the Vala compiler + * generated from testreadonlylist.vala, do not modify */ + +/* testreadonlylist.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Tomaž Vajngerl + * Julien Peeters + * Didier 'Ptitjes' Villevalois + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_READ_ONLY_COLLECTION_TESTS (read_only_collection_tests_get_type ()) +#define READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTests)) +#define READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass)) +#define IS_READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_COLLECTION_TESTS)) +#define IS_READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_COLLECTION_TESTS)) +#define READ_ONLY_COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass)) + +typedef struct _ReadOnlyCollectionTests ReadOnlyCollectionTests; +typedef struct _ReadOnlyCollectionTestsClass ReadOnlyCollectionTestsClass; +typedef struct _ReadOnlyCollectionTestsPrivate ReadOnlyCollectionTestsPrivate; + +#define TYPE_READ_ONLY_LIST_TESTS (read_only_list_tests_get_type ()) +#define READ_ONLY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_LIST_TESTS, ReadOnlyListTests)) +#define READ_ONLY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_LIST_TESTS, ReadOnlyListTestsClass)) +#define IS_READ_ONLY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_LIST_TESTS)) +#define IS_READ_ONLY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_LIST_TESTS)) +#define READ_ONLY_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_LIST_TESTS, ReadOnlyListTestsClass)) + +typedef struct _ReadOnlyListTests ReadOnlyListTests; +typedef struct _ReadOnlyListTestsClass ReadOnlyListTestsClass; +typedef struct _ReadOnlyListTestsPrivate ReadOnlyListTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _ReadOnlyCollectionTests { + GeeTestCase parent_instance; + ReadOnlyCollectionTestsPrivate * priv; + GeeCollection* test_collection; + GeeCollection* ro_collection; +}; + +struct _ReadOnlyCollectionTestsClass { + GeeTestCaseClass parent_class; + GeeCollection* (*get_ro_view) (ReadOnlyCollectionTests* self, GeeCollection* collection); +}; + +struct _ReadOnlyListTests { + ReadOnlyCollectionTests parent_instance; + ReadOnlyListTestsPrivate * priv; +}; + +struct _ReadOnlyListTestsClass { + ReadOnlyCollectionTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer read_only_list_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType read_only_collection_tests_get_type (void) G_GNUC_CONST; +GType read_only_list_tests_get_type (void) G_GNUC_CONST; +enum { + READ_ONLY_LIST_TESTS_DUMMY_PROPERTY +}; +ReadOnlyListTests* read_only_list_tests_new (void); +ReadOnlyListTests* read_only_list_tests_construct (GType object_type); +ReadOnlyCollectionTests* read_only_collection_tests_new_with_name (const gchar* name); +ReadOnlyCollectionTests* read_only_collection_tests_construct_with_name (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void read_only_list_tests_test_immutable_iterator (ReadOnlyListTests* self); +static void _read_only_list_tests_test_immutable_iterator_gee_test_case_test_method (gpointer self); +void read_only_list_tests_test_immutable (ReadOnlyListTests* self); +static void _read_only_list_tests_test_immutable_gee_test_case_test_method (gpointer self); +void read_only_list_tests_test_accurate_view (ReadOnlyListTests* self); +static void _read_only_list_tests_test_accurate_view_gee_test_case_test_method (gpointer self); +static void read_only_list_tests_real_set_up (GeeTestCase* base); +GeeCollection* read_only_collection_tests_get_ro_view (ReadOnlyCollectionTests* self, GeeCollection* collection); +static void read_only_list_tests_real_tear_down (GeeTestCase* base); +static GeeCollection* read_only_list_tests_real_get_ro_view (ReadOnlyCollectionTests* base, GeeCollection* collection); + + +static void _read_only_list_tests_test_immutable_iterator_gee_test_case_test_method (gpointer self) { + read_only_list_tests_test_immutable_iterator (self); +} + + +static void _read_only_list_tests_test_immutable_gee_test_case_test_method (gpointer self) { + read_only_list_tests_test_immutable (self); +} + + +static void _read_only_list_tests_test_accurate_view_gee_test_case_test_method (gpointer self) { + read_only_list_tests_test_accurate_view (self); +} + + +ReadOnlyListTests* read_only_list_tests_construct (GType object_type) { + ReadOnlyListTests * self = NULL; + self = (ReadOnlyListTests*) read_only_collection_tests_construct_with_name (object_type, "ReadOnlyList"); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyList] immutable iterator", _read_only_list_tests_test_immutable_iterator_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyList] immutable", _read_only_list_tests_test_immutable_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyList] accurate view", _read_only_list_tests_test_accurate_view_gee_test_case_test_method, self); + return self; +} + + +ReadOnlyListTests* read_only_list_tests_new (void) { + return read_only_list_tests_construct (TYPE_READ_ONLY_LIST_TESTS); +} + + +static void read_only_list_tests_real_set_up (GeeTestCase* base) { + ReadOnlyListTests * self; + GeeArrayList* _tmp0_; + GeeCollection* _tmp1_; + GeeCollection* _tmp2_ = NULL; + self = (ReadOnlyListTests*) base; + _tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + _g_object_unref0 (((ReadOnlyCollectionTests*) self)->test_collection); + ((ReadOnlyCollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; + _tmp1_ = ((ReadOnlyCollectionTests*) self)->test_collection; + _tmp2_ = read_only_collection_tests_get_ro_view ((ReadOnlyCollectionTests*) self, _tmp1_); + _g_object_unref0 (((ReadOnlyCollectionTests*) self)->ro_collection); + ((ReadOnlyCollectionTests*) self)->ro_collection = _tmp2_; +} + + +static void read_only_list_tests_real_tear_down (GeeTestCase* base) { + ReadOnlyListTests * self; + self = (ReadOnlyListTests*) base; + _g_object_unref0 (((ReadOnlyCollectionTests*) self)->test_collection); + ((ReadOnlyCollectionTests*) self)->test_collection = NULL; + _g_object_unref0 (((ReadOnlyCollectionTests*) self)->ro_collection); + ((ReadOnlyCollectionTests*) self)->ro_collection = NULL; +} + + +static GeeCollection* read_only_list_tests_real_get_ro_view (ReadOnlyCollectionTests* base, GeeCollection* collection) { + ReadOnlyListTests * self; + GeeCollection* result = NULL; + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* _tmp2_; + self = (ReadOnlyListTests*) base; + g_return_val_if_fail (collection != NULL, NULL); + _tmp0_ = collection; + _tmp1_ = gee_list_get_read_only_view (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST, GeeList)); + _tmp2_ = _tmp1_; + result = (GeeCollection*) _tmp2_; + return result; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void read_only_list_tests_test_immutable_iterator (ReadOnlyListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeCollection* _tmp2_; + GeeList* _tmp3_; + GeeList* ro_list; + GeeList* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeList* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeList* _tmp8_; + gint _tmp9_; + gint _tmp10_; + GeeList* _tmp11_; + gpointer _tmp12_ = NULL; + gchar* _tmp13_; + GeeList* _tmp14_; + gpointer _tmp15_ = NULL; + gchar* _tmp16_; + GeeList* _tmp17_; + GeeListIterator* _tmp18_ = NULL; + GeeListIterator* iterator; + GeeListIterator* _tmp19_; + gboolean _tmp20_ = FALSE; + GeeListIterator* _tmp21_; + gboolean _tmp22_ = FALSE; + GeeListIterator* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + GeeListIterator* _tmp26_; + gint _tmp27_ = 0; + GeeListIterator* _tmp28_; + gboolean _tmp29_ = FALSE; + GeeListIterator* _tmp30_; + gboolean _tmp31_ = FALSE; + GeeListIterator* _tmp32_; + gpointer _tmp33_ = NULL; + gchar* _tmp34_; + GeeListIterator* _tmp35_; + gint _tmp36_ = 0; + GeeListIterator* _tmp37_; + gboolean _tmp38_ = FALSE; + GeeListIterator* _tmp39_; + gboolean _tmp40_ = FALSE; + GeeListIterator* _tmp41_; + gboolean _tmp42_ = FALSE; + GeeListIterator* _tmp43_; + gboolean _tmp44_ = FALSE; + GeeListIterator* _tmp45_; + gpointer _tmp46_ = NULL; + gchar* _tmp47_; + GeeListIterator* _tmp48_; + gint _tmp49_ = 0; + GeeListIterator* _tmp50_; + gboolean _tmp51_ = FALSE; + GeeListIterator* _tmp52_; + gpointer _tmp53_ = NULL; + gchar* _tmp54_; + GeeListIterator* _tmp55_; + gint _tmp56_ = 0; + GeeListIterator* _tmp57_; + gboolean _tmp58_ = FALSE; + GeeListIterator* _tmp59_; + gpointer _tmp60_ = NULL; + gchar* _tmp61_; + GeeListIterator* _tmp62_; + gint _tmp63_ = 0; + gboolean _tmp64_ = FALSE; + GeeList* _tmp66_; + gint _tmp67_; + gint _tmp68_; + GeeList* _tmp69_; + gpointer _tmp70_ = NULL; + gchar* _tmp71_; + GeeList* _tmp72_; + gpointer _tmp73_ = NULL; + gchar* _tmp74_; + GeeListIterator* _tmp75_; + gint _tmp76_ = 0; + gboolean _tmp77_ = FALSE; + GeeList* _tmp79_; + gint _tmp80_; + gint _tmp81_; + GeeList* _tmp82_; + gpointer _tmp83_ = NULL; + gchar* _tmp84_; + GeeList* _tmp85_; + gpointer _tmp86_ = NULL; + gchar* _tmp87_; + GeeListIterator* _tmp88_; + gint _tmp89_ = 0; + gboolean _tmp90_ = FALSE; + GeeList* _tmp92_; + gint _tmp93_; + gint _tmp94_; + GeeList* _tmp95_; + gpointer _tmp96_ = NULL; + gchar* _tmp97_; + GeeList* _tmp98_; + gpointer _tmp99_ = NULL; + gchar* _tmp100_; + GeeListIterator* _tmp101_; + gint _tmp102_ = 0; + gboolean _tmp103_ = FALSE; + GeeList* _tmp105_; + gint _tmp106_; + gint _tmp107_; + GeeList* _tmp108_; + gpointer _tmp109_ = NULL; + gchar* _tmp110_; + GeeList* _tmp111_; + gpointer _tmp112_ = NULL; + gchar* _tmp113_; + GeeListIterator* _tmp114_; + gint _tmp115_ = 0; + g_return_if_fail (self != NULL); + _tmp0_ = ((ReadOnlyCollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = ((ReadOnlyCollectionTests*) self)->ro_collection; + _tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, GEE_TYPE_LIST) ? ((GeeList*) _tmp2_) : NULL); + ro_list = _tmp3_; + _tmp4_ = test_list; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "one"); + _vala_assert (_tmp5_, "test_list.add (\"one\")"); + _tmp6_ = test_list; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "two"); + _vala_assert (_tmp7_, "test_list.add (\"two\")"); + _tmp8_ = ro_list; + _tmp9_ = gee_collection_get_size ((GeeCollection*) _tmp8_); + _tmp10_ = _tmp9_; + _vala_assert (_tmp10_ == 2, "ro_list.size == 2"); + _tmp11_ = ro_list; + _tmp12_ = gee_list_get (_tmp11_, 0); + _tmp13_ = (gchar*) _tmp12_; + _vala_assert (g_strcmp0 (_tmp13_, "one") == 0, "ro_list.get (0) == \"one\""); + _g_free0 (_tmp13_); + _tmp14_ = ro_list; + _tmp15_ = gee_list_get (_tmp14_, 1); + _tmp16_ = (gchar*) _tmp15_; + _vala_assert (g_strcmp0 (_tmp16_, "two") == 0, "ro_list.get (1) == \"two\""); + _g_free0 (_tmp16_); + _tmp17_ = ro_list; + _tmp18_ = gee_list_list_iterator (_tmp17_); + iterator = _tmp18_; + _tmp19_ = iterator; + _tmp20_ = gee_iterator_has_next ((GeeIterator*) _tmp19_); + _vala_assert (_tmp20_, "iterator.has_next ()"); + _tmp21_ = iterator; + _tmp22_ = gee_iterator_next ((GeeIterator*) _tmp21_); + _vala_assert (_tmp22_, "iterator.next ()"); + _tmp23_ = iterator; + _tmp24_ = gee_iterator_get ((GeeIterator*) _tmp23_); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp25_); + _tmp26_ = iterator; + _tmp27_ = gee_list_iterator_index (_tmp26_); + _vala_assert (_tmp27_ == 0, "iterator.index () == 0"); + _tmp28_ = iterator; + _tmp29_ = gee_iterator_has_next ((GeeIterator*) _tmp28_); + _vala_assert (_tmp29_, "iterator.has_next ()"); + _tmp30_ = iterator; + _tmp31_ = gee_iterator_next ((GeeIterator*) _tmp30_); + _vala_assert (_tmp31_, "iterator.next ()"); + _tmp32_ = iterator; + _tmp33_ = gee_iterator_get ((GeeIterator*) _tmp32_); + _tmp34_ = (gchar*) _tmp33_; + _vala_assert (g_strcmp0 (_tmp34_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp34_); + _tmp35_ = iterator; + _tmp36_ = gee_list_iterator_index (_tmp35_); + _vala_assert (_tmp36_ == 1, "iterator.index () == 1"); + _tmp37_ = iterator; + _tmp38_ = gee_iterator_has_next ((GeeIterator*) _tmp37_); + _vala_assert (!_tmp38_, "! iterator.has_next ()"); + _tmp39_ = iterator; + _tmp40_ = gee_iterator_next ((GeeIterator*) _tmp39_); + _vala_assert (!_tmp40_, "! iterator.next ()"); + _tmp41_ = iterator; + _tmp42_ = gee_bidir_iterator_has_previous ((GeeBidirIterator*) _tmp41_); + _vala_assert (_tmp42_, "iterator.has_previous ()"); + _tmp43_ = iterator; + _tmp44_ = gee_bidir_iterator_previous ((GeeBidirIterator*) _tmp43_); + _vala_assert (_tmp44_, "iterator.previous ()"); + _tmp45_ = iterator; + _tmp46_ = gee_iterator_get ((GeeIterator*) _tmp45_); + _tmp47_ = (gchar*) _tmp46_; + _vala_assert (g_strcmp0 (_tmp47_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp47_); + _tmp48_ = iterator; + _tmp49_ = gee_list_iterator_index (_tmp48_); + _vala_assert (_tmp49_ == 0, "iterator.index () == 0"); + _tmp50_ = iterator; + _tmp51_ = gee_bidir_iterator_last ((GeeBidirIterator*) _tmp50_); + _vala_assert (_tmp51_, "iterator.last ()"); + _tmp52_ = iterator; + _tmp53_ = gee_iterator_get ((GeeIterator*) _tmp52_); + _tmp54_ = (gchar*) _tmp53_; + _vala_assert (g_strcmp0 (_tmp54_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp54_); + _tmp55_ = iterator; + _tmp56_ = gee_list_iterator_index (_tmp55_); + _vala_assert (_tmp56_ == 1, "iterator.index () == 1"); + _tmp57_ = iterator; + _tmp58_ = gee_iterator_first ((GeeIterator*) _tmp57_); + _vala_assert (_tmp58_, "iterator.first ()"); + _tmp59_ = iterator; + _tmp60_ = gee_iterator_get ((GeeIterator*) _tmp59_); + _tmp61_ = (gchar*) _tmp60_; + _vala_assert (g_strcmp0 (_tmp61_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp61_); + _tmp62_ = iterator; + _tmp63_ = gee_list_iterator_index (_tmp62_); + _vala_assert (_tmp63_ == 0, "iterator.index () == 0"); + _tmp64_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp64_) { + GeeListIterator* _tmp65_; + _tmp65_ = iterator; + gee_iterator_remove ((GeeIterator*) _tmp65_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp66_ = ro_list; + _tmp67_ = gee_collection_get_size ((GeeCollection*) _tmp66_); + _tmp68_ = _tmp67_; + _vala_assert (_tmp68_ == 2, "ro_list.size == 2"); + _tmp69_ = ro_list; + _tmp70_ = gee_list_get (_tmp69_, 0); + _tmp71_ = (gchar*) _tmp70_; + _vala_assert (g_strcmp0 (_tmp71_, "one") == 0, "ro_list.get (0) == \"one\""); + _g_free0 (_tmp71_); + _tmp72_ = ro_list; + _tmp73_ = gee_list_get (_tmp72_, 1); + _tmp74_ = (gchar*) _tmp73_; + _vala_assert (g_strcmp0 (_tmp74_, "two") == 0, "ro_list.get (1) == \"two\""); + _g_free0 (_tmp74_); + _tmp75_ = iterator; + _tmp76_ = gee_list_iterator_index (_tmp75_); + _vala_assert (_tmp76_ == 0, "iterator.index () == 0"); + _tmp77_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp77_) { + GeeListIterator* _tmp78_; + _tmp78_ = iterator; + gee_list_iterator_set (_tmp78_, "three"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp79_ = ro_list; + _tmp80_ = gee_collection_get_size ((GeeCollection*) _tmp79_); + _tmp81_ = _tmp80_; + _vala_assert (_tmp81_ == 2, "ro_list.size == 2"); + _tmp82_ = ro_list; + _tmp83_ = gee_list_get (_tmp82_, 0); + _tmp84_ = (gchar*) _tmp83_; + _vala_assert (g_strcmp0 (_tmp84_, "one") == 0, "ro_list.get (0) == \"one\""); + _g_free0 (_tmp84_); + _tmp85_ = ro_list; + _tmp86_ = gee_list_get (_tmp85_, 1); + _tmp87_ = (gchar*) _tmp86_; + _vala_assert (g_strcmp0 (_tmp87_, "two") == 0, "ro_list.get (1) == \"two\""); + _g_free0 (_tmp87_); + _tmp88_ = iterator; + _tmp89_ = gee_list_iterator_index (_tmp88_); + _vala_assert (_tmp89_ == 0, "iterator.index () == 0"); + _tmp90_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp90_) { + GeeListIterator* _tmp91_; + _tmp91_ = iterator; + gee_list_iterator_insert (_tmp91_, "three"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp92_ = ro_list; + _tmp93_ = gee_collection_get_size ((GeeCollection*) _tmp92_); + _tmp94_ = _tmp93_; + _vala_assert (_tmp94_ == 2, "ro_list.size == 2"); + _tmp95_ = ro_list; + _tmp96_ = gee_list_get (_tmp95_, 0); + _tmp97_ = (gchar*) _tmp96_; + _vala_assert (g_strcmp0 (_tmp97_, "one") == 0, "ro_list.get (0) == \"one\""); + _g_free0 (_tmp97_); + _tmp98_ = ro_list; + _tmp99_ = gee_list_get (_tmp98_, 1); + _tmp100_ = (gchar*) _tmp99_; + _vala_assert (g_strcmp0 (_tmp100_, "two") == 0, "ro_list.get (1) == \"two\""); + _g_free0 (_tmp100_); + _tmp101_ = iterator; + _tmp102_ = gee_list_iterator_index (_tmp101_); + _vala_assert (_tmp102_ == 0, "iterator.index () == 0"); + _tmp103_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp103_) { + GeeListIterator* _tmp104_; + _tmp104_ = iterator; + gee_list_iterator_add (_tmp104_, "three"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp105_ = ro_list; + _tmp106_ = gee_collection_get_size ((GeeCollection*) _tmp105_); + _tmp107_ = _tmp106_; + _vala_assert (_tmp107_ == 2, "ro_list.size == 2"); + _tmp108_ = ro_list; + _tmp109_ = gee_list_get (_tmp108_, 0); + _tmp110_ = (gchar*) _tmp109_; + _vala_assert (g_strcmp0 (_tmp110_, "one") == 0, "ro_list.get (0) == \"one\""); + _g_free0 (_tmp110_); + _tmp111_ = ro_list; + _tmp112_ = gee_list_get (_tmp111_, 1); + _tmp113_ = (gchar*) _tmp112_; + _vala_assert (g_strcmp0 (_tmp113_, "two") == 0, "ro_list.get (1) == \"two\""); + _g_free0 (_tmp113_); + _tmp114_ = iterator; + _tmp115_ = gee_list_iterator_index (_tmp114_); + _vala_assert (_tmp115_ == 0, "iterator.index () == 0"); + _g_object_unref0 (iterator); + _g_object_unref0 (ro_list); + _g_object_unref0 (test_list); +} + + +void read_only_list_tests_test_immutable (ReadOnlyListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeCollection* _tmp2_; + GeeList* _tmp3_; + GeeList* ro_list; + GeeList* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeList* _tmp6_; + gint _tmp7_; + gint _tmp8_; + GeeList* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeArrayList* _tmp11_; + GeeCollection* dummy; + GeeCollection* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeCollection* _tmp14_; + gboolean _tmp15_ = FALSE; + gboolean _tmp16_ = FALSE; + GeeList* _tmp18_; + gint _tmp19_; + gint _tmp20_; + GeeList* _tmp21_; + gboolean _tmp22_ = FALSE; + gboolean _tmp23_ = FALSE; + GeeList* _tmp25_; + gint _tmp26_; + gint _tmp27_; + GeeList* _tmp28_; + gboolean _tmp29_ = FALSE; + gboolean _tmp30_ = FALSE; + GeeList* _tmp34_; + gint _tmp35_; + gint _tmp36_; + GeeList* _tmp37_; + gboolean _tmp38_ = FALSE; + gboolean _tmp39_ = FALSE; + GeeList* _tmp42_; + gint _tmp43_; + gint _tmp44_; + GeeList* _tmp45_; + gboolean _tmp46_ = FALSE; + gboolean _tmp47_ = FALSE; + GeeList* _tmp49_; + gint _tmp50_; + gint _tmp51_; + GeeList* _tmp52_; + gboolean _tmp53_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((ReadOnlyCollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = ((ReadOnlyCollectionTests*) self)->ro_collection; + _tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, GEE_TYPE_LIST) ? ((GeeList*) _tmp2_) : NULL); + ro_list = _tmp3_; + _tmp4_ = test_list; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "one"); + _vala_assert (_tmp5_, "test_list.add (\"one\")"); + _tmp6_ = ro_list; + _tmp7_ = gee_collection_get_size ((GeeCollection*) _tmp6_); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_ == 1, "ro_list.size == 1"); + _tmp9_ = ro_list; + _tmp10_ = gee_collection_contains ((GeeCollection*) _tmp9_, "one"); + _vala_assert (_tmp10_, "ro_list.contains (\"one\")"); + _tmp11_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = (GeeCollection*) _tmp11_; + _tmp12_ = dummy; + _tmp13_ = gee_collection_add (_tmp12_, "one"); + _vala_assert (_tmp13_, "dummy.add (\"one\")"); + _tmp14_ = dummy; + _tmp15_ = gee_collection_add (_tmp14_, "two"); + _vala_assert (_tmp15_, "dummy.add (\"two\")"); + _tmp16_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp16_) { + GeeList* _tmp17_; + _tmp17_ = ro_list; + gee_list_set (_tmp17_, 0, "two"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp18_ = ro_list; + _tmp19_ = gee_collection_get_size ((GeeCollection*) _tmp18_); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 1, "ro_list.size == 1"); + _tmp21_ = ro_list; + _tmp22_ = gee_collection_contains ((GeeCollection*) _tmp21_, "one"); + _vala_assert (_tmp22_, "ro_list.contains (\"one\")"); + _tmp23_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp23_) { + GeeList* _tmp24_; + _tmp24_ = ro_list; + gee_list_insert (_tmp24_, 1, "two"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp25_ = ro_list; + _tmp26_ = gee_collection_get_size ((GeeCollection*) _tmp25_); + _tmp27_ = _tmp26_; + _vala_assert (_tmp27_ == 1, "ro_list.size == 1"); + _tmp28_ = ro_list; + _tmp29_ = gee_collection_contains ((GeeCollection*) _tmp28_, "one"); + _vala_assert (_tmp29_, "ro_list.contains (\"one\")"); + _tmp30_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp30_) { + GeeList* _tmp31_; + gpointer _tmp32_ = NULL; + gchar* _tmp33_; + _tmp31_ = ro_list; + _tmp32_ = gee_list_remove_at (_tmp31_, 1); + _tmp33_ = (gchar*) _tmp32_; + _g_free0 (_tmp33_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp34_ = ro_list; + _tmp35_ = gee_collection_get_size ((GeeCollection*) _tmp34_); + _tmp36_ = _tmp35_; + _vala_assert (_tmp36_ == 1, "ro_list.size == 1"); + _tmp37_ = ro_list; + _tmp38_ = gee_collection_contains ((GeeCollection*) _tmp37_, "one"); + _vala_assert (_tmp38_, "ro_list.contains (\"one\")"); + _tmp39_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp39_) { + GeeList* _tmp40_; + GeeCollection* _tmp41_; + _tmp40_ = ro_list; + _tmp41_ = dummy; + gee_list_insert_all (_tmp40_, 1, _tmp41_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp42_ = ro_list; + _tmp43_ = gee_collection_get_size ((GeeCollection*) _tmp42_); + _tmp44_ = _tmp43_; + _vala_assert (_tmp44_ == 1, "ro_list.size == 1"); + _tmp45_ = ro_list; + _tmp46_ = gee_collection_contains ((GeeCollection*) _tmp45_, "one"); + _vala_assert (_tmp46_, "ro_list.contains (\"one\")"); + _tmp47_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp47_) { + GeeList* _tmp48_; + _tmp48_ = ro_list; + gee_list_sort (_tmp48_, NULL); + exit (0); + } + g_test_trap_assert_failed (); + _tmp49_ = ro_list; + _tmp50_ = gee_collection_get_size ((GeeCollection*) _tmp49_); + _tmp51_ = _tmp50_; + _vala_assert (_tmp51_ == 1, "ro_list.size == 1"); + _tmp52_ = ro_list; + _tmp53_ = gee_collection_contains ((GeeCollection*) _tmp52_, "one"); + _vala_assert (_tmp53_, "ro_list.contains (\"one\")"); + _g_object_unref0 (dummy); + _g_object_unref0 (ro_list); + _g_object_unref0 (test_list); +} + + +void read_only_list_tests_test_accurate_view (ReadOnlyListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeCollection* _tmp2_; + GeeList* _tmp3_; + GeeList* ro_list; + GeeArrayList* _tmp4_; + GeeCollection* dummy; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_ = FALSE; + GType _tmp7_; + GType _tmp8_; + gint _tmp9_; + gint _tmp10_; + gboolean _tmp11_; + gboolean _tmp12_; + gboolean _tmp13_ = FALSE; + gint _tmp14_ = 0; + gboolean _tmp15_ = FALSE; + gint _tmp16_; + gint _tmp17_; + gboolean _tmp18_; + gboolean _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + gint _tmp22_ = 0; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + gpointer _tmp25_ = NULL; + gchar* _tmp26_; + gboolean _tmp27_ = FALSE; + gint _tmp28_; + gint _tmp29_; + gboolean _tmp30_; + gboolean _tmp31_; + gpointer _tmp32_ = NULL; + gchar* _tmp33_; + gint _tmp34_ = 0; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + gint _tmp37_ = 0; + gpointer _tmp38_ = NULL; + gchar* _tmp39_; + gpointer _tmp40_ = NULL; + gchar* _tmp41_; + gboolean _tmp42_ = FALSE; + gint _tmp43_; + gint _tmp44_; + gboolean _tmp45_; + gboolean _tmp46_; + gboolean _tmp47_ = FALSE; + gint _tmp48_ = 0; + gboolean _tmp49_ = FALSE; + gpointer _tmp50_ = NULL; + gchar* _tmp51_; + gint _tmp52_ = 0; + gpointer _tmp53_ = NULL; + gchar* _tmp54_; + gpointer _tmp55_ = NULL; + gchar* _tmp56_; + gint _tmp57_; + gint _tmp58_; + gboolean _tmp59_; + gboolean _tmp60_; + gint _tmp61_ = 0; + gint _tmp62_ = 0; + g_return_if_fail (self != NULL); + _tmp0_ = ((ReadOnlyCollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = ((ReadOnlyCollectionTests*) self)->ro_collection; + _tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, GEE_TYPE_LIST) ? ((GeeList*) _tmp2_) : NULL); + ro_list = _tmp3_; + _tmp4_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = (GeeCollection*) _tmp4_; + _tmp5_ = gee_collection_add (dummy, "one"); + _vala_assert (_tmp5_, "dummy.add (\"one\")"); + _tmp6_ = gee_collection_add (dummy, "two"); + _vala_assert (_tmp6_, "dummy.add (\"two\")"); + _tmp7_ = gee_iterable_get_element_type ((GeeIterable*) ro_list); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_ == G_TYPE_STRING, "ro_list.element_type == typeof (string)"); + _tmp9_ = gee_collection_get_size ((GeeCollection*) ro_list); + _tmp10_ = _tmp9_; + _vala_assert (_tmp10_ == 0, "ro_list.size == 0"); + _tmp11_ = gee_collection_get_is_empty ((GeeCollection*) ro_list); + _tmp12_ = _tmp11_; + _vala_assert (_tmp12_, "ro_list.is_empty"); + _tmp13_ = gee_collection_contains ((GeeCollection*) ro_list, "one"); + _vala_assert (!_tmp13_, "! ro_list.contains (\"one\")"); + _tmp14_ = gee_list_index_of (ro_list, "one"); + _vala_assert (_tmp14_ == (-1), "ro_list.index_of (\"one\") == -1"); + _tmp15_ = gee_collection_add ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp15_, "test_list.add (\"one\")"); + _tmp16_ = gee_collection_get_size ((GeeCollection*) ro_list); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_ == 1, "ro_list.size == 1"); + _tmp18_ = gee_collection_get_is_empty ((GeeCollection*) ro_list); + _tmp19_ = _tmp18_; + _vala_assert (!_tmp19_, "! ro_list.is_empty"); + _tmp20_ = gee_list_get (ro_list, 0); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "one") == 0, "ro_list.get (0) == \"one\""); + _g_free0 (_tmp21_); + _tmp22_ = gee_list_index_of (ro_list, "one"); + _vala_assert (_tmp22_ == 0, "ro_list.index_of (\"one\") == 0"); + _tmp23_ = gee_list_first (ro_list); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "one") == 0, "ro_list.first () == \"one\""); + _g_free0 (_tmp24_); + _tmp25_ = gee_list_last (ro_list); + _tmp26_ = (gchar*) _tmp25_; + _vala_assert (g_strcmp0 (_tmp26_, "one") == 0, "ro_list.last () == \"one\""); + _g_free0 (_tmp26_); + _tmp27_ = gee_collection_add ((GeeCollection*) test_list, "two"); + _vala_assert (_tmp27_, "test_list.add (\"two\")"); + _tmp28_ = gee_collection_get_size ((GeeCollection*) ro_list); + _tmp29_ = _tmp28_; + _vala_assert (_tmp29_ == 2, "ro_list.size == 2"); + _tmp30_ = gee_collection_get_is_empty ((GeeCollection*) ro_list); + _tmp31_ = _tmp30_; + _vala_assert (!_tmp31_, "! ro_list.is_empty"); + _tmp32_ = gee_list_get (ro_list, 0); + _tmp33_ = (gchar*) _tmp32_; + _vala_assert (g_strcmp0 (_tmp33_, "one") == 0, "ro_list.get (0) == \"one\""); + _g_free0 (_tmp33_); + _tmp34_ = gee_list_index_of (ro_list, "one"); + _vala_assert (_tmp34_ == 0, "ro_list.index_of (\"one\") == 0"); + _tmp35_ = gee_list_get (ro_list, 1); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "two") == 0, "ro_list.get (1) == \"two\""); + _g_free0 (_tmp36_); + _tmp37_ = gee_list_index_of (ro_list, "two"); + _vala_assert (_tmp37_ == 1, "ro_list.index_of (\"two\") == 1"); + _tmp38_ = gee_list_first (ro_list); + _tmp39_ = (gchar*) _tmp38_; + _vala_assert (g_strcmp0 (_tmp39_, "one") == 0, "ro_list.first () == \"one\""); + _g_free0 (_tmp39_); + _tmp40_ = gee_list_last (ro_list); + _tmp41_ = (gchar*) _tmp40_; + _vala_assert (g_strcmp0 (_tmp41_, "two") == 0, "ro_list.last () == \"two\""); + _g_free0 (_tmp41_); + _tmp42_ = gee_collection_remove ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp42_, "test_list.remove (\"one\")"); + _tmp43_ = gee_collection_get_size ((GeeCollection*) ro_list); + _tmp44_ = _tmp43_; + _vala_assert (_tmp44_ == 1, "ro_list.size == 1"); + _tmp45_ = gee_collection_get_is_empty ((GeeCollection*) ro_list); + _tmp46_ = _tmp45_; + _vala_assert (!_tmp46_, "! ro_list.is_empty"); + _tmp47_ = gee_collection_contains ((GeeCollection*) ro_list, "one"); + _vala_assert (!_tmp47_, "! ro_list.contains (\"one\")"); + _tmp48_ = gee_list_index_of (ro_list, "one"); + _vala_assert (_tmp48_ == (-1), "ro_list.index_of (\"one\") == -1"); + _tmp49_ = gee_collection_contains ((GeeCollection*) ro_list, "two"); + _vala_assert (_tmp49_, "ro_list.contains (\"two\")"); + _tmp50_ = gee_list_get (ro_list, 0); + _tmp51_ = (gchar*) _tmp50_; + _vala_assert (g_strcmp0 (_tmp51_, "two") == 0, "ro_list.get (0) == \"two\""); + _g_free0 (_tmp51_); + _tmp52_ = gee_list_index_of (ro_list, "two"); + _vala_assert (_tmp52_ == 0, "ro_list.index_of (\"two\") == 0"); + _tmp53_ = gee_list_first (ro_list); + _tmp54_ = (gchar*) _tmp53_; + _vala_assert (g_strcmp0 (_tmp54_, "two") == 0, "ro_list.first () == \"two\""); + _g_free0 (_tmp54_); + _tmp55_ = gee_list_last (ro_list); + _tmp56_ = (gchar*) _tmp55_; + _vala_assert (g_strcmp0 (_tmp56_, "two") == 0, "ro_list.last () == \"two\""); + _g_free0 (_tmp56_); + gee_collection_clear ((GeeCollection*) test_list); + _tmp57_ = gee_collection_get_size ((GeeCollection*) ro_list); + _tmp58_ = _tmp57_; + _vala_assert (_tmp58_ == 0, "ro_list.size == 0"); + _tmp59_ = gee_collection_get_is_empty ((GeeCollection*) ro_list); + _tmp60_ = _tmp59_; + _vala_assert (_tmp60_, "ro_list.is_empty"); + _tmp61_ = gee_list_index_of (ro_list, "one"); + _vala_assert (_tmp61_ == (-1), "ro_list.index_of (\"one\") == -1"); + _tmp62_ = gee_list_index_of (ro_list, "two"); + _vala_assert (_tmp62_ == (-1), "ro_list.index_of (\"two\") == -1"); + _g_object_unref0 (dummy); + _g_object_unref0 (ro_list); + _g_object_unref0 (test_list); +} + + +static void read_only_list_tests_class_init (ReadOnlyListTestsClass * klass) { + read_only_list_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = read_only_list_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = read_only_list_tests_real_tear_down; + READ_ONLY_COLLECTION_TESTS_CLASS (klass)->get_ro_view = read_only_list_tests_real_get_ro_view; +} + + +static void read_only_list_tests_instance_init (ReadOnlyListTests * self) { +} + + +GType read_only_list_tests_get_type (void) { + static volatile gsize read_only_list_tests_type_id__volatile = 0; + if (g_once_init_enter (&read_only_list_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (ReadOnlyListTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) read_only_list_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ReadOnlyListTests), 0, (GInstanceInitFunc) read_only_list_tests_instance_init, NULL }; + GType read_only_list_tests_type_id; + read_only_list_tests_type_id = g_type_register_static (TYPE_READ_ONLY_COLLECTION_TESTS, "ReadOnlyListTests", &g_define_type_info, 0); + g_once_init_leave (&read_only_list_tests_type_id__volatile, read_only_list_tests_type_id); + } + return read_only_list_tests_type_id__volatile; +} + + + diff --git a/tests/testreadonlylist.vala b/tests/testreadonlylist.vala new file mode 100644 index 0000000..d1b2220 --- /dev/null +++ b/tests/testreadonlylist.vala @@ -0,0 +1,243 @@ +/* testreadonlylist.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Tomaž Vajngerl + * Julien Peeters + * Didier 'Ptitjes' Villevalois + */ + +using Gee; + +public class ReadOnlyListTests : ReadOnlyCollectionTests { + + public ReadOnlyListTests () { + base.with_name ("ReadOnlyList"); + add_test ("[ReadOnlyList] immutable iterator", test_immutable_iterator); + add_test ("[ReadOnlyList] immutable", test_immutable); + add_test ("[ReadOnlyList] accurate view", test_accurate_view); + } + + public override void set_up () { + test_collection = new ArrayList (); + ro_collection = get_ro_view (test_collection); + } + + public override void tear_down () { + test_collection = null; + ro_collection = null; + } + + protected override Collection get_ro_view (Collection collection) { + return ((Gee.List) collection).read_only_view; + } + + public new void test_immutable_iterator () { + var test_list = test_collection as Gee.List; + var ro_list = ro_collection as Gee.List; + + assert (test_list.add ("one")); + assert (test_list.add ("two")); + + assert (ro_list.size == 2); + assert (ro_list.get (0) == "one"); + assert (ro_list.get (1) == "two"); + + ListIterator iterator = ro_list.list_iterator (); + + assert (iterator.has_next ()); + assert (iterator.next ()); + assert (iterator.get () == "one"); + assert (iterator.index () == 0); + + assert (iterator.has_next ()); + assert (iterator.next ()); + assert (iterator.get () == "two"); + assert (iterator.index () == 1); + + assert (! iterator.has_next ()); + assert (! iterator.next ()); + + assert (iterator.has_previous ()); + assert (iterator.previous ()); + assert (iterator.get () == "one"); + assert (iterator.index () == 0); + + assert (iterator.last ()); + assert (iterator.get () == "two"); + assert (iterator.index () == 1); + + assert (iterator.first ()); + assert (iterator.get () == "one"); + assert (iterator.index () == 0); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iterator.remove (); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 2); + assert (ro_list.get (0) == "one"); + assert (ro_list.get (1) == "two"); + assert (iterator.index () == 0); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iterator.set ("three"); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 2); + assert (ro_list.get (0) == "one"); + assert (ro_list.get (1) == "two"); + assert (iterator.index () == 0); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iterator.insert ("three"); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 2); + assert (ro_list.get (0) == "one"); + assert (ro_list.get (1) == "two"); + assert (iterator.index () == 0); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iterator.add ("three"); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 2); + assert (ro_list.get (0) == "one"); + assert (ro_list.get (1) == "two"); + assert (iterator.index () == 0); + } + + public new void test_immutable () { + var test_list = test_collection as Gee.List; + var ro_list = ro_collection as Gee.List; + + assert (test_list.add ("one")); + assert (ro_list.size == 1); + assert (ro_list.contains ("one")); + + Collection dummy = new ArrayList (); + assert (dummy.add ("one")); + assert (dummy.add ("two")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_list.set (0, "two"); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 1); + assert (ro_list.contains ("one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_list.insert (1, "two"); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 1); + assert (ro_list.contains ("one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_list.remove_at (1); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 1); + assert (ro_list.contains ("one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_list.insert_all (1, dummy); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 1); + assert (ro_list.contains ("one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_list.sort (); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 1); + assert (ro_list.contains ("one")); + } + + public new void test_accurate_view () { + var test_list = test_collection as Gee.List; + var ro_list = ro_collection as Gee.List; + + Collection dummy = new ArrayList (); + assert (dummy.add ("one")); + assert (dummy.add ("two")); + + assert (ro_list.element_type == typeof (string)); + + assert (ro_list.size == 0); + assert (ro_list.is_empty); + assert (! ro_list.contains ("one")); + assert (ro_list.index_of ("one") == -1); + + assert (test_list.add ("one")); + assert (ro_list.size == 1); + assert (! ro_list.is_empty); + assert (ro_list.get (0) == "one"); + assert (ro_list.index_of ("one") == 0); + assert (ro_list.first () == "one"); + assert (ro_list.last () == "one"); + + assert (test_list.add ("two")); + assert (ro_list.size == 2); + assert (! ro_list.is_empty); + assert (ro_list.get (0) == "one"); + assert (ro_list.index_of ("one") == 0); + assert (ro_list.get (1) == "two"); + assert (ro_list.index_of ("two") == 1); + assert (ro_list.first () == "one"); + assert (ro_list.last () == "two"); + + assert (test_list.remove ("one")); + assert (ro_list.size == 1); + assert (! ro_list.is_empty); + assert (! ro_list.contains ("one")); + assert (ro_list.index_of ("one") == -1); + assert (ro_list.contains ("two")); + assert (ro_list.get (0) == "two"); + assert (ro_list.index_of ("two") == 0); + assert (ro_list.first () == "two"); + assert (ro_list.last () == "two"); + + test_list.clear (); + assert (ro_list.size == 0); + assert (ro_list.is_empty); + assert (ro_list.index_of ("one") == -1); + assert (ro_list.index_of ("two") == -1); + } +} diff --git a/tests/testreadonlymap.c b/tests/testreadonlymap.c new file mode 100644 index 0000000..67b82f1 --- /dev/null +++ b/tests/testreadonlymap.c @@ -0,0 +1,825 @@ +/* testreadonlymap.c generated by valac 0.18.0, the Vala compiler + * generated from testreadonlymap.vala, do not modify */ + +/* testreadonlymap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_READ_ONLY_MAP_TESTS (read_only_map_tests_get_type ()) +#define READ_ONLY_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_MAP_TESTS, ReadOnlyMapTests)) +#define READ_ONLY_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_MAP_TESTS, ReadOnlyMapTestsClass)) +#define IS_READ_ONLY_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_MAP_TESTS)) +#define IS_READ_ONLY_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_MAP_TESTS)) +#define READ_ONLY_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_MAP_TESTS, ReadOnlyMapTestsClass)) + +typedef struct _ReadOnlyMapTests ReadOnlyMapTests; +typedef struct _ReadOnlyMapTestsClass ReadOnlyMapTestsClass; +typedef struct _ReadOnlyMapTestsPrivate ReadOnlyMapTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _ReadOnlyMapTests { + GeeTestCase parent_instance; + ReadOnlyMapTestsPrivate * priv; + GeeMap* test_map; + GeeMap* ro_map; +}; + +struct _ReadOnlyMapTestsClass { + GeeTestCaseClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer read_only_map_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType read_only_map_tests_get_type (void) G_GNUC_CONST; +enum { + READ_ONLY_MAP_TESTS_DUMMY_PROPERTY +}; +ReadOnlyMapTests* read_only_map_tests_new (void); +ReadOnlyMapTests* read_only_map_tests_construct (GType object_type); +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void read_only_map_tests_test_unique_read_only_view_instance (ReadOnlyMapTests* self); +static void _read_only_map_tests_test_unique_read_only_view_instance_gee_test_case_test_method (gpointer self); +void read_only_map_tests_test_immutable_iterator (ReadOnlyMapTests* self); +static void _read_only_map_tests_test_immutable_iterator_gee_test_case_test_method (gpointer self); +void read_only_map_tests_test_immutable (ReadOnlyMapTests* self); +static void _read_only_map_tests_test_immutable_gee_test_case_test_method (gpointer self); +void read_only_map_tests_test_accurate_view (ReadOnlyMapTests* self); +static void _read_only_map_tests_test_accurate_view_gee_test_case_test_method (gpointer self); +static void read_only_map_tests_real_set_up (GeeTestCase* base); +static void read_only_map_tests_real_tear_down (GeeTestCase* base); +static void read_only_map_tests_finalize (GObject* obj); + + +static void _read_only_map_tests_test_unique_read_only_view_instance_gee_test_case_test_method (gpointer self) { + read_only_map_tests_test_unique_read_only_view_instance (self); +} + + +static void _read_only_map_tests_test_immutable_iterator_gee_test_case_test_method (gpointer self) { + read_only_map_tests_test_immutable_iterator (self); +} + + +static void _read_only_map_tests_test_immutable_gee_test_case_test_method (gpointer self) { + read_only_map_tests_test_immutable (self); +} + + +static void _read_only_map_tests_test_accurate_view_gee_test_case_test_method (gpointer self) { + read_only_map_tests_test_accurate_view (self); +} + + +ReadOnlyMapTests* read_only_map_tests_construct (GType object_type) { + ReadOnlyMapTests * self = NULL; + self = (ReadOnlyMapTests*) gee_test_case_construct (object_type, "ReadOnlyMap"); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyMap] unique read-only view instance", _read_only_map_tests_test_unique_read_only_view_instance_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyMap] immutable iterator", _read_only_map_tests_test_immutable_iterator_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyMap] immutable", _read_only_map_tests_test_immutable_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyMap] accurate view", _read_only_map_tests_test_accurate_view_gee_test_case_test_method, self); + return self; +} + + +ReadOnlyMapTests* read_only_map_tests_new (void) { + return read_only_map_tests_construct (TYPE_READ_ONLY_MAP_TESTS); +} + + +static void read_only_map_tests_real_set_up (GeeTestCase* base) { + ReadOnlyMapTests * self; + GeeTreeMap* _tmp0_; + GeeMap* _tmp1_; + GeeMap* _tmp2_; + GeeMap* _tmp3_; + self = (ReadOnlyMapTests*) base; + _tmp0_ = gee_tree_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); + _g_object_unref0 (self->test_map); + self->test_map = (GeeMap*) _tmp0_; + _tmp1_ = self->test_map; + _tmp2_ = gee_map_get_read_only_view (_tmp1_); + _tmp3_ = _tmp2_; + _g_object_unref0 (self->ro_map); + self->ro_map = _tmp3_; +} + + +static void read_only_map_tests_real_tear_down (GeeTestCase* base) { + ReadOnlyMapTests * self; + self = (ReadOnlyMapTests*) base; + _g_object_unref0 (self->test_map); + self->test_map = NULL; + _g_object_unref0 (self->ro_map); + self->ro_map = NULL; +} + + +void read_only_map_tests_test_unique_read_only_view_instance (ReadOnlyMapTests* self) { + GeeMap* _tmp0_; + GeeMap* _tmp1_; + GeeMap* _tmp2_; + GeeMap* another_ro_map; + GeeMap* _tmp3_; + GeeMap* _tmp4_; + GeeMap* _tmp5_; + GObject* _tmp6_; + GeeMap* _tmp7_; + gconstpointer _tmp8_ = NULL; + GeeMap* _tmp9_; + GeeMap* _tmp10_; + GeeMap* _tmp11_; + GeeMap* _tmp12_; + gconstpointer _tmp13_ = NULL; + GeeMap* _tmp14_; + GeeMap* _tmp15_; + GeeMap* _tmp16_; + GeeMap* _tmp17_; + GeeMap* _tmp18_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + _tmp1_ = gee_map_get_read_only_view (_tmp0_); + _tmp2_ = _tmp1_; + another_ro_map = _tmp2_; + _tmp3_ = self->ro_map; + _tmp4_ = another_ro_map; + _vala_assert (_tmp3_ == _tmp4_, "ro_map == another_ro_map"); + _tmp5_ = self->ro_map; + _tmp6_ = g_object_new (G_TYPE_OBJECT, NULL); + g_object_set_data_full ((GObject*) _tmp5_, "marker", _tmp6_, g_object_unref); + _tmp7_ = another_ro_map; + _tmp8_ = g_object_get_data ((GObject*) _tmp7_, "marker"); + _vala_assert (((GObject*) _tmp8_) != NULL, "another_ro_map.get_data (\"marker\") != null"); + _g_object_unref0 (another_ro_map); + another_ro_map = NULL; + _g_object_unref0 (self->ro_map); + self->ro_map = NULL; + _tmp9_ = self->test_map; + _tmp10_ = gee_map_get_read_only_view (_tmp9_); + _tmp11_ = _tmp10_; + _g_object_unref0 (another_ro_map); + another_ro_map = _tmp11_; + _tmp12_ = another_ro_map; + _tmp13_ = g_object_get_data ((GObject*) _tmp12_, "marker"); + _vala_assert (((GObject*) _tmp13_) == NULL, "another_ro_map.get_data (\"marker\") == null"); + _tmp14_ = another_ro_map; + _tmp15_ = another_ro_map; + _tmp16_ = gee_map_get_read_only_view (_tmp15_); + _tmp17_ = _tmp16_; + _tmp18_ = _tmp17_; + _vala_assert (_tmp14_ == _tmp18_, "another_ro_map == another_ro_map.read_only_view"); + _g_object_unref0 (_tmp18_); + _g_object_unref0 (another_ro_map); +} + + +void read_only_map_tests_test_immutable_iterator (ReadOnlyMapTests* self) { + GeeMap* _tmp0_; + GeeMap* _tmp1_; + GeeMap* _tmp2_; + gint _tmp3_; + gint _tmp4_; + GeeMap* _tmp5_; + gboolean _tmp6_ = FALSE; + GeeMap* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeMap* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeMap* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeMap* _tmp13_; + GeeSet* _tmp14_; + GeeSet* _tmp15_; + GeeSet* _tmp16_; + GeeIterator* _tmp17_ = NULL; + GeeIterator* _tmp18_; + GeeIterator* iterator; + GeeIterator* _tmp19_; + gboolean _tmp20_ = FALSE; + GeeIterator* _tmp21_; + gboolean _tmp22_ = FALSE; + GeeIterator* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + GeeIterator* _tmp26_; + gboolean _tmp27_ = FALSE; + GeeIterator* _tmp28_; + gboolean _tmp29_ = FALSE; + GeeIterator* _tmp30_; + gpointer _tmp31_ = NULL; + gchar* _tmp32_; + GeeIterator* _tmp33_; + gboolean _tmp34_ = FALSE; + GeeIterator* _tmp35_; + gboolean _tmp36_ = FALSE; + GeeIterator* _tmp37_; + gboolean _tmp38_ = FALSE; + GeeIterator* _tmp39_; + gpointer _tmp40_ = NULL; + gchar* _tmp41_; + gboolean _tmp42_ = FALSE; + GeeMap* _tmp44_; + gint _tmp45_; + gint _tmp46_; + GeeMap* _tmp47_; + gboolean _tmp48_ = FALSE; + GeeMap* _tmp49_; + gboolean _tmp50_ = FALSE; + GeeMap* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeMap* _tmp53_; + gboolean _tmp54_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + gee_map_set (_tmp0_, "one", "one"); + _tmp1_ = self->test_map; + gee_map_set (_tmp1_, "two", "two"); + _tmp2_ = self->ro_map; + _tmp3_ = gee_map_get_size (_tmp2_); + _tmp4_ = _tmp3_; + _vala_assert (_tmp4_ == 2, "ro_map.size == 2"); + _tmp5_ = self->ro_map; + _tmp6_ = gee_map_has_key (_tmp5_, "one"); + _vala_assert (_tmp6_, "ro_map.has_key (\"one\")"); + _tmp7_ = self->ro_map; + _tmp8_ = gee_map_has (_tmp7_, "one", "one"); + _vala_assert (_tmp8_, "ro_map.has (\"one\", \"one\")"); + _tmp9_ = self->ro_map; + _tmp10_ = gee_map_has_key (_tmp9_, "two"); + _vala_assert (_tmp10_, "ro_map.has_key (\"two\")"); + _tmp11_ = self->ro_map; + _tmp12_ = gee_map_has (_tmp11_, "two", "two"); + _vala_assert (_tmp12_, "ro_map.has (\"two\", \"two\")"); + _tmp13_ = self->ro_map; + _tmp14_ = gee_map_get_keys (_tmp13_); + _tmp15_ = _tmp14_; + _tmp16_ = _tmp15_; + _tmp17_ = gee_iterable_iterator ((GeeIterable*) _tmp16_); + _tmp18_ = _tmp17_; + _g_object_unref0 (_tmp16_); + iterator = _tmp18_; + _tmp19_ = iterator; + _tmp20_ = gee_iterator_has_next (_tmp19_); + _vala_assert (_tmp20_, "iterator.has_next ()"); + _tmp21_ = iterator; + _tmp22_ = gee_iterator_next (_tmp21_); + _vala_assert (_tmp22_, "iterator.next ()"); + _tmp23_ = iterator; + _tmp24_ = gee_iterator_get (_tmp23_); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp25_); + _tmp26_ = iterator; + _tmp27_ = gee_iterator_has_next (_tmp26_); + _vala_assert (_tmp27_, "iterator.has_next ()"); + _tmp28_ = iterator; + _tmp29_ = gee_iterator_next (_tmp28_); + _vala_assert (_tmp29_, "iterator.next ()"); + _tmp30_ = iterator; + _tmp31_ = gee_iterator_get (_tmp30_); + _tmp32_ = (gchar*) _tmp31_; + _vala_assert (g_strcmp0 (_tmp32_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp32_); + _tmp33_ = iterator; + _tmp34_ = gee_iterator_has_next (_tmp33_); + _vala_assert (!_tmp34_, "! iterator.has_next ()"); + _tmp35_ = iterator; + _tmp36_ = gee_iterator_next (_tmp35_); + _vala_assert (!_tmp36_, "! iterator.next ()"); + _tmp37_ = iterator; + _tmp38_ = gee_iterator_first (_tmp37_); + _vala_assert (_tmp38_, "iterator.first ()"); + _tmp39_ = iterator; + _tmp40_ = gee_iterator_get (_tmp39_); + _tmp41_ = (gchar*) _tmp40_; + _vala_assert (g_strcmp0 (_tmp41_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp41_); + _tmp42_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp42_) { + GeeIterator* _tmp43_; + _tmp43_ = iterator; + gee_iterator_remove (_tmp43_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp44_ = self->ro_map; + _tmp45_ = gee_map_get_size (_tmp44_); + _tmp46_ = _tmp45_; + _vala_assert (_tmp46_ == 2, "ro_map.size == 2"); + _tmp47_ = self->ro_map; + _tmp48_ = gee_map_has_key (_tmp47_, "one"); + _vala_assert (_tmp48_, "ro_map.has_key (\"one\")"); + _tmp49_ = self->ro_map; + _tmp50_ = gee_map_has (_tmp49_, "one", "one"); + _vala_assert (_tmp50_, "ro_map.has (\"one\", \"one\")"); + _tmp51_ = self->ro_map; + _tmp52_ = gee_map_has_key (_tmp51_, "two"); + _vala_assert (_tmp52_, "ro_map.has_key (\"two\")"); + _tmp53_ = self->ro_map; + _tmp54_ = gee_map_has (_tmp53_, "two", "two"); + _vala_assert (_tmp54_, "ro_map.has (\"two\", \"two\")"); + _g_object_unref0 (iterator); +} + + +void read_only_map_tests_test_immutable (ReadOnlyMapTests* self) { + GeeMap* _tmp0_; + GeeMap* _tmp1_; + gint _tmp2_; + gint _tmp3_; + GeeMap* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeMap* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeHashMap* _tmp8_; + GeeMap* dummy; + GeeMap* _tmp9_; + GeeMap* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeMap* _tmp13_; + gint _tmp14_; + gint _tmp15_; + GeeMap* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeMap* _tmp18_; + gboolean _tmp19_ = FALSE; + gboolean _tmp20_ = FALSE; + GeeMap* _tmp22_; + gint _tmp23_; + gint _tmp24_; + GeeMap* _tmp25_; + gboolean _tmp26_ = FALSE; + GeeMap* _tmp27_; + gboolean _tmp28_ = FALSE; + gboolean _tmp29_ = FALSE; + GeeMap* _tmp32_; + gint _tmp33_; + gint _tmp34_; + GeeMap* _tmp35_; + gboolean _tmp36_ = FALSE; + GeeMap* _tmp37_; + gboolean _tmp38_ = FALSE; + gboolean _tmp39_ = FALSE; + GeeMap* _tmp42_; + gint _tmp43_; + gint _tmp44_; + GeeMap* _tmp45_; + gboolean _tmp46_ = FALSE; + GeeMap* _tmp47_; + gboolean _tmp48_ = FALSE; + gboolean _tmp49_ = FALSE; + GeeMap* _tmp53_; + gint _tmp54_; + gint _tmp55_; + GeeMap* _tmp56_; + gboolean _tmp57_ = FALSE; + GeeMap* _tmp58_; + gboolean _tmp59_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + gee_map_set (_tmp0_, "one", "one"); + _tmp1_ = self->ro_map; + _tmp2_ = gee_map_get_size (_tmp1_); + _tmp3_ = _tmp2_; + _vala_assert (_tmp3_ == 1, "ro_map.size == 1"); + _tmp4_ = self->ro_map; + _tmp5_ = gee_map_has_key (_tmp4_, "one"); + _vala_assert (_tmp5_, "ro_map.has_key (\"one\")"); + _tmp6_ = self->ro_map; + _tmp7_ = gee_map_has (_tmp6_, "one", "one"); + _vala_assert (_tmp7_, "ro_map.has (\"one\", \"one\")"); + _tmp8_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL); + dummy = (GeeMap*) _tmp8_; + _tmp9_ = dummy; + gee_map_set (_tmp9_, "one", "one"); + _tmp10_ = dummy; + gee_map_set (_tmp10_, "two", "two"); + _tmp11_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp11_) { + GeeMap* _tmp12_; + _tmp12_ = self->ro_map; + gee_map_set (_tmp12_, "two", "two"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp13_ = self->ro_map; + _tmp14_ = gee_map_get_size (_tmp13_); + _tmp15_ = _tmp14_; + _vala_assert (_tmp15_ == 1, "ro_map.size == 1"); + _tmp16_ = self->ro_map; + _tmp17_ = gee_map_has_key (_tmp16_, "one"); + _vala_assert (_tmp17_, "ro_map.has_key (\"one\")"); + _tmp18_ = self->ro_map; + _tmp19_ = gee_map_has (_tmp18_, "one", "one"); + _vala_assert (_tmp19_, "ro_map.has (\"one\", \"one\")"); + _tmp20_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp20_) { + GeeMap* _tmp21_; + _tmp21_ = self->ro_map; + gee_map_clear (_tmp21_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp22_ = self->ro_map; + _tmp23_ = gee_map_get_size (_tmp22_); + _tmp24_ = _tmp23_; + _vala_assert (_tmp24_ == 1, "ro_map.size == 1"); + _tmp25_ = self->ro_map; + _tmp26_ = gee_map_has_key (_tmp25_, "one"); + _vala_assert (_tmp26_, "ro_map.has_key (\"one\")"); + _tmp27_ = self->ro_map; + _tmp28_ = gee_map_has (_tmp27_, "one", "one"); + _vala_assert (_tmp28_, "ro_map.has (\"one\", \"one\")"); + _tmp29_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp29_) { + GeeMap* _tmp30_; + gboolean _tmp31_ = FALSE; + _tmp30_ = self->ro_map; + _tmp31_ = gee_map_unset (_tmp30_, "one", NULL); + _vala_assert (_tmp31_, "ro_map.unset (\"one\")"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp32_ = self->ro_map; + _tmp33_ = gee_map_get_size (_tmp32_); + _tmp34_ = _tmp33_; + _vala_assert (_tmp34_ == 1, "ro_map.size == 1"); + _tmp35_ = self->ro_map; + _tmp36_ = gee_map_has_key (_tmp35_, "one"); + _vala_assert (_tmp36_, "ro_map.has_key (\"one\")"); + _tmp37_ = self->ro_map; + _tmp38_ = gee_map_has (_tmp37_, "one", "one"); + _vala_assert (_tmp38_, "ro_map.has (\"one\", \"one\")"); + _tmp39_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp39_) { + GeeMap* _tmp40_; + GeeMap* _tmp41_; + _tmp40_ = self->ro_map; + _tmp41_ = dummy; + gee_map_set_all (_tmp40_, _tmp41_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp42_ = self->ro_map; + _tmp43_ = gee_map_get_size (_tmp42_); + _tmp44_ = _tmp43_; + _vala_assert (_tmp44_ == 1, "ro_map.size == 1"); + _tmp45_ = self->ro_map; + _tmp46_ = gee_map_has_key (_tmp45_, "one"); + _vala_assert (_tmp46_, "ro_map.has_key (\"one\")"); + _tmp47_ = self->ro_map; + _tmp48_ = gee_map_has (_tmp47_, "one", "one"); + _vala_assert (_tmp48_, "ro_map.has (\"one\", \"one\")"); + _tmp49_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp49_) { + GeeMap* _tmp50_; + GeeMap* _tmp51_; + gboolean _tmp52_ = FALSE; + _tmp50_ = self->ro_map; + _tmp51_ = dummy; + _tmp52_ = gee_map_unset_all (_tmp50_, _tmp51_); + _vala_assert (_tmp52_, "ro_map.unset_all (dummy)"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp53_ = self->ro_map; + _tmp54_ = gee_map_get_size (_tmp53_); + _tmp55_ = _tmp54_; + _vala_assert (_tmp55_ == 1, "ro_map.size == 1"); + _tmp56_ = self->ro_map; + _tmp57_ = gee_map_has_key (_tmp56_, "one"); + _vala_assert (_tmp57_, "ro_map.has_key (\"one\")"); + _tmp58_ = self->ro_map; + _tmp59_ = gee_map_has (_tmp58_, "one", "one"); + _vala_assert (_tmp59_, "ro_map.has (\"one\", \"one\")"); + _g_object_unref0 (dummy); +} + + +void read_only_map_tests_test_accurate_view (ReadOnlyMapTests* self) { + GeeHashMap* _tmp0_; + GeeMap* dummy; + GeeMap* _tmp1_; + gint _tmp2_; + gint _tmp3_; + GeeMap* _tmp4_; + gboolean _tmp5_; + gboolean _tmp6_; + GeeMap* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeMap* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeMap* _tmp11_; + gpointer _tmp12_ = NULL; + gchar* _tmp13_; + GeeMap* _tmp14_; + GeeMap* _tmp15_; + gint _tmp16_; + gint _tmp17_; + GeeMap* _tmp18_; + gboolean _tmp19_; + gboolean _tmp20_; + GeeMap* _tmp21_; + gboolean _tmp22_ = FALSE; + GeeMap* _tmp23_; + gboolean _tmp24_ = FALSE; + GeeMap* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + GeeMap* _tmp28_; + GeeMap* _tmp29_; + gint _tmp30_; + gint _tmp31_; + GeeMap* _tmp32_; + gboolean _tmp33_; + gboolean _tmp34_; + GeeMap* _tmp35_; + gboolean _tmp36_ = FALSE; + GeeMap* _tmp37_; + gboolean _tmp38_ = FALSE; + GeeMap* _tmp39_; + gpointer _tmp40_ = NULL; + gchar* _tmp41_; + GeeMap* _tmp42_; + gboolean _tmp43_ = FALSE; + GeeMap* _tmp44_; + gboolean _tmp45_ = FALSE; + GeeMap* _tmp46_; + gpointer _tmp47_ = NULL; + gchar* _tmp48_; + GeeMap* _tmp49_; + gboolean _tmp50_ = FALSE; + GeeMap* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeMap* _tmp53_; + gint _tmp54_; + gint _tmp55_; + GeeMap* _tmp56_; + gboolean _tmp57_; + gboolean _tmp58_; + GeeMap* _tmp59_; + gboolean _tmp60_ = FALSE; + GeeMap* _tmp61_; + gboolean _tmp62_ = FALSE; + GeeMap* _tmp63_; + gpointer _tmp64_ = NULL; + gchar* _tmp65_; + GeeMap* _tmp66_; + gboolean _tmp67_ = FALSE; + GeeMap* _tmp68_; + gboolean _tmp69_ = FALSE; + GeeMap* _tmp70_; + gpointer _tmp71_ = NULL; + gchar* _tmp72_; + GeeMap* _tmp73_; + gboolean _tmp74_ = FALSE; + GeeMap* _tmp75_; + GeeMap* _tmp76_; + gint _tmp77_; + gint _tmp78_; + GeeMap* _tmp79_; + gboolean _tmp80_; + gboolean _tmp81_; + GeeMap* _tmp82_; + gboolean _tmp83_ = FALSE; + GeeMap* _tmp84_; + gboolean _tmp85_ = FALSE; + GeeMap* _tmp86_; + gpointer _tmp87_ = NULL; + gchar* _tmp88_; + GeeMap* _tmp89_; + gpointer _tmp90_ = NULL; + gchar* _tmp91_; + g_return_if_fail (self != NULL); + _tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL); + dummy = (GeeMap*) _tmp0_; + gee_map_set (dummy, "one", "one"); + gee_map_set (dummy, "two", "two"); + _tmp1_ = self->ro_map; + _tmp2_ = gee_map_get_size (_tmp1_); + _tmp3_ = _tmp2_; + _vala_assert (_tmp3_ == 0, "ro_map.size == 0"); + _tmp4_ = self->ro_map; + _tmp5_ = gee_map_get_is_empty (_tmp4_); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_, "ro_map.is_empty"); + _tmp7_ = self->ro_map; + _tmp8_ = gee_map_has_key (_tmp7_, "one"); + _vala_assert (!_tmp8_, "! ro_map.has_key (\"one\")"); + _tmp9_ = self->ro_map; + _tmp10_ = gee_map_has (_tmp9_, "one", "one"); + _vala_assert (!_tmp10_, "! ro_map.has (\"one\", \"one\")"); + _tmp11_ = self->ro_map; + _tmp12_ = gee_map_get (_tmp11_, "one"); + _tmp13_ = (gchar*) _tmp12_; + _vala_assert (_tmp13_ == NULL, "ro_map.get (\"one\") == null"); + _g_free0 (_tmp13_); + _tmp14_ = self->test_map; + gee_map_set (_tmp14_, "one", "one"); + _tmp15_ = self->ro_map; + _tmp16_ = gee_map_get_size (_tmp15_); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_ == 1, "ro_map.size == 1"); + _tmp18_ = self->ro_map; + _tmp19_ = gee_map_get_is_empty (_tmp18_); + _tmp20_ = _tmp19_; + _vala_assert (!_tmp20_, "! ro_map.is_empty"); + _tmp21_ = self->ro_map; + _tmp22_ = gee_map_has_key (_tmp21_, "one"); + _vala_assert (_tmp22_, "ro_map.has_key (\"one\")"); + _tmp23_ = self->ro_map; + _tmp24_ = gee_map_has (_tmp23_, "one", "one"); + _vala_assert (_tmp24_, "ro_map.has (\"one\", \"one\")"); + _tmp25_ = self->ro_map; + _tmp26_ = gee_map_get (_tmp25_, "one"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "one") == 0, "ro_map.get (\"one\") == \"one\""); + _g_free0 (_tmp27_); + _tmp28_ = self->test_map; + gee_map_set (_tmp28_, "two", "two"); + _tmp29_ = self->ro_map; + _tmp30_ = gee_map_get_size (_tmp29_); + _tmp31_ = _tmp30_; + _vala_assert (_tmp31_ == 2, "ro_map.size == 2"); + _tmp32_ = self->ro_map; + _tmp33_ = gee_map_get_is_empty (_tmp32_); + _tmp34_ = _tmp33_; + _vala_assert (!_tmp34_, "! ro_map.is_empty"); + _tmp35_ = self->ro_map; + _tmp36_ = gee_map_has_key (_tmp35_, "one"); + _vala_assert (_tmp36_, "ro_map.has_key (\"one\")"); + _tmp37_ = self->ro_map; + _tmp38_ = gee_map_has (_tmp37_, "one", "one"); + _vala_assert (_tmp38_, "ro_map.has (\"one\", \"one\")"); + _tmp39_ = self->ro_map; + _tmp40_ = gee_map_get (_tmp39_, "one"); + _tmp41_ = (gchar*) _tmp40_; + _vala_assert (g_strcmp0 (_tmp41_, "one") == 0, "ro_map.get (\"one\") == \"one\""); + _g_free0 (_tmp41_); + _tmp42_ = self->ro_map; + _tmp43_ = gee_map_has_key (_tmp42_, "two"); + _vala_assert (_tmp43_, "ro_map.has_key (\"two\")"); + _tmp44_ = self->ro_map; + _tmp45_ = gee_map_has (_tmp44_, "two", "two"); + _vala_assert (_tmp45_, "ro_map.has (\"two\", \"two\")"); + _tmp46_ = self->ro_map; + _tmp47_ = gee_map_get (_tmp46_, "two"); + _tmp48_ = (gchar*) _tmp47_; + _vala_assert (g_strcmp0 (_tmp48_, "two") == 0, "ro_map.get (\"two\") == \"two\""); + _g_free0 (_tmp48_); + _tmp49_ = self->ro_map; + _tmp50_ = gee_map_has_all (_tmp49_, dummy); + _vala_assert (_tmp50_, "ro_map.has_all (dummy)"); + _tmp51_ = self->test_map; + _tmp52_ = gee_map_unset (_tmp51_, "one", NULL); + _vala_assert (_tmp52_, "test_map.unset (\"one\")"); + _tmp53_ = self->ro_map; + _tmp54_ = gee_map_get_size (_tmp53_); + _tmp55_ = _tmp54_; + _vala_assert (_tmp55_ == 1, "ro_map.size == 1"); + _tmp56_ = self->ro_map; + _tmp57_ = gee_map_get_is_empty (_tmp56_); + _tmp58_ = _tmp57_; + _vala_assert (!_tmp58_, "! ro_map.is_empty"); + _tmp59_ = self->ro_map; + _tmp60_ = gee_map_has_key (_tmp59_, "one"); + _vala_assert (!_tmp60_, "! ro_map.has_key (\"one\")"); + _tmp61_ = self->ro_map; + _tmp62_ = gee_map_has (_tmp61_, "one", "one"); + _vala_assert (!_tmp62_, "! ro_map.has (\"one\", \"one\")"); + _tmp63_ = self->ro_map; + _tmp64_ = gee_map_get (_tmp63_, "one"); + _tmp65_ = (gchar*) _tmp64_; + _vala_assert (_tmp65_ == NULL, "ro_map.get (\"one\") == null"); + _g_free0 (_tmp65_); + _tmp66_ = self->ro_map; + _tmp67_ = gee_map_has_key (_tmp66_, "two"); + _vala_assert (_tmp67_, "ro_map.has_key (\"two\")"); + _tmp68_ = self->ro_map; + _tmp69_ = gee_map_has (_tmp68_, "two", "two"); + _vala_assert (_tmp69_, "ro_map.has (\"two\", \"two\")"); + _tmp70_ = self->ro_map; + _tmp71_ = gee_map_get (_tmp70_, "two"); + _tmp72_ = (gchar*) _tmp71_; + _vala_assert (g_strcmp0 (_tmp72_, "two") == 0, "ro_map.get (\"two\") == \"two\""); + _g_free0 (_tmp72_); + _tmp73_ = self->ro_map; + _tmp74_ = gee_map_has_all (_tmp73_, dummy); + _vala_assert (!_tmp74_, "! ro_map.has_all (dummy)"); + _tmp75_ = self->test_map; + gee_map_clear (_tmp75_); + _tmp76_ = self->ro_map; + _tmp77_ = gee_map_get_size (_tmp76_); + _tmp78_ = _tmp77_; + _vala_assert (_tmp78_ == 0, "ro_map.size == 0"); + _tmp79_ = self->ro_map; + _tmp80_ = gee_map_get_is_empty (_tmp79_); + _tmp81_ = _tmp80_; + _vala_assert (_tmp81_, "ro_map.is_empty"); + _tmp82_ = self->ro_map; + _tmp83_ = gee_map_has (_tmp82_, "one", "one"); + _vala_assert (!_tmp83_, "! ro_map.has (\"one\", \"one\")"); + _tmp84_ = self->ro_map; + _tmp85_ = gee_map_has (_tmp84_, "two", "two"); + _vala_assert (!_tmp85_, "! ro_map.has (\"two\", \"two\")"); + _tmp86_ = self->ro_map; + _tmp87_ = gee_map_get (_tmp86_, "one"); + _tmp88_ = (gchar*) _tmp87_; + _vala_assert (_tmp88_ == NULL, "ro_map.get (\"one\") == null"); + _g_free0 (_tmp88_); + _tmp89_ = self->ro_map; + _tmp90_ = gee_map_get (_tmp89_, "two"); + _tmp91_ = (gchar*) _tmp90_; + _vala_assert (_tmp91_ == NULL, "ro_map.get (\"two\") == null"); + _g_free0 (_tmp91_); + _g_object_unref0 (dummy); +} + + +static void read_only_map_tests_class_init (ReadOnlyMapTestsClass * klass) { + read_only_map_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = read_only_map_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = read_only_map_tests_real_tear_down; + G_OBJECT_CLASS (klass)->finalize = read_only_map_tests_finalize; +} + + +static void read_only_map_tests_instance_init (ReadOnlyMapTests * self) { +} + + +static void read_only_map_tests_finalize (GObject* obj) { + ReadOnlyMapTests * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_READ_ONLY_MAP_TESTS, ReadOnlyMapTests); + _g_object_unref0 (self->test_map); + _g_object_unref0 (self->ro_map); + G_OBJECT_CLASS (read_only_map_tests_parent_class)->finalize (obj); +} + + +GType read_only_map_tests_get_type (void) { + static volatile gsize read_only_map_tests_type_id__volatile = 0; + if (g_once_init_enter (&read_only_map_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (ReadOnlyMapTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) read_only_map_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ReadOnlyMapTests), 0, (GInstanceInitFunc) read_only_map_tests_instance_init, NULL }; + GType read_only_map_tests_type_id; + read_only_map_tests_type_id = g_type_register_static (GEE_TYPE_TEST_CASE, "ReadOnlyMapTests", &g_define_type_info, 0); + g_once_init_leave (&read_only_map_tests_type_id__volatile, read_only_map_tests_type_id); + } + return read_only_map_tests_type_id__volatile; +} + + + diff --git a/tests/testreadonlymap.vala b/tests/testreadonlymap.vala new file mode 100644 index 0000000..c32f763 --- /dev/null +++ b/tests/testreadonlymap.vala @@ -0,0 +1,216 @@ +/* testreadonlymap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + */ + +using Gee; + +public class ReadOnlyMapTests : Gee.TestCase { + + public ReadOnlyMapTests () { + base ("ReadOnlyMap"); + add_test ("[ReadOnlyMap] unique read-only view instance", + test_unique_read_only_view_instance); + add_test ("[ReadOnlyMap] immutable iterator", test_immutable_iterator); + add_test ("[ReadOnlyMap] immutable", test_immutable); + add_test ("[ReadOnlyMap] accurate view", test_accurate_view); + } + + protected Map test_map; + protected Map ro_map; + + public override void set_up () { + test_map = new TreeMap (); + ro_map = test_map.read_only_view; + } + + public override void tear_down () { + test_map = null; + ro_map = null; + } + + public void test_unique_read_only_view_instance () { + var another_ro_map = test_map.read_only_view; + assert (ro_map == another_ro_map); + + ro_map.set_data ("marker", new Object ()); + assert (another_ro_map.get_data ("marker") != null); + + another_ro_map = null; + ro_map = null; + + another_ro_map = test_map.read_only_view; + assert (another_ro_map.get_data ("marker") == null); + + // Check that the read-only view of the view is itself + assert (another_ro_map == another_ro_map.read_only_view); + } + + public void test_immutable_iterator () { + test_map.set ("one", "one"); + test_map.set ("two", "two"); + + assert (ro_map.size == 2); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + assert (ro_map.has_key ("two")); + assert (ro_map.has ("two", "two")); + + Iterator iterator = ro_map.keys.iterator (); + + assert (iterator.has_next ()); + assert (iterator.next ()); + assert (iterator.get () == "one"); + + assert (iterator.has_next ()); + assert (iterator.next ()); + assert (iterator.get () == "two"); + + assert (! iterator.has_next ()); + assert (! iterator.next ()); + + assert (iterator.first ()); + assert (iterator.get () == "one"); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iterator.remove (); + Posix.exit (0); + } + Test.trap_assert_failed (); + + assert (ro_map.size == 2); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + assert (ro_map.has_key ("two")); + assert (ro_map.has ("two", "two")); + } + + public void test_immutable () { + test_map.set ("one", "one"); + assert (ro_map.size == 1); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + + Map dummy = new HashMap (); + dummy.set ("one", "one"); + dummy.set ("two", "two"); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_map.set ("two", "two"); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_map.size == 1); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_map.clear (); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_map.size == 1); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (ro_map.unset ("one")); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_map.size == 1); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_map.set_all (dummy); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_map.size == 1); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (ro_map.unset_all (dummy)); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_map.size == 1); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + } + + public void test_accurate_view () { + Map dummy = new HashMap (); + dummy.set ("one", "one"); + dummy.set ("two", "two"); + + assert (ro_map.size == 0); + assert (ro_map.is_empty); + assert (! ro_map.has_key ("one")); + assert (! ro_map.has ("one", "one")); + assert (ro_map.get ("one") == null); + + test_map.set ("one", "one"); + assert (ro_map.size == 1); + assert (! ro_map.is_empty); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + assert (ro_map.get ("one") == "one"); + + test_map.set ("two", "two"); + assert (ro_map.size == 2); + assert (! ro_map.is_empty); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + assert (ro_map.get ("one") == "one"); + assert (ro_map.has_key ("two")); + assert (ro_map.has ("two", "two")); + assert (ro_map.get ("two") == "two"); + assert (ro_map.has_all (dummy)); + + assert (test_map.unset ("one")); + assert (ro_map.size == 1); + assert (! ro_map.is_empty); + assert (! ro_map.has_key ("one")); + assert (! ro_map.has ("one", "one")); + assert (ro_map.get ("one") == null); + assert (ro_map.has_key ("two")); + assert (ro_map.has ("two", "two")); + assert (ro_map.get ("two") == "two"); + assert (! ro_map.has_all (dummy)); + + test_map.clear (); + assert (ro_map.size == 0); + assert (ro_map.is_empty); + assert (! ro_map.has ("one", "one")); + assert (! ro_map.has ("two", "two")); + assert (ro_map.get ("one") == null); + assert (ro_map.get ("two") == null); + } +} diff --git a/tests/testreadonlyset.c b/tests/testreadonlyset.c new file mode 100644 index 0000000..fe8d420 --- /dev/null +++ b/tests/testreadonlyset.c @@ -0,0 +1,198 @@ +/* testreadonlyset.c generated by valac 0.18.0, the Vala compiler + * generated from testreadonlyset.vala, do not modify */ + +/* testreadonlyset.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Tomaž Vajngerl + * Julien Peeters + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_READ_ONLY_COLLECTION_TESTS (read_only_collection_tests_get_type ()) +#define READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTests)) +#define READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass)) +#define IS_READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_COLLECTION_TESTS)) +#define IS_READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_COLLECTION_TESTS)) +#define READ_ONLY_COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass)) + +typedef struct _ReadOnlyCollectionTests ReadOnlyCollectionTests; +typedef struct _ReadOnlyCollectionTestsClass ReadOnlyCollectionTestsClass; +typedef struct _ReadOnlyCollectionTestsPrivate ReadOnlyCollectionTestsPrivate; + +#define TYPE_READ_ONLY_SET_TESTS (read_only_set_tests_get_type ()) +#define READ_ONLY_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_SET_TESTS, ReadOnlySetTests)) +#define READ_ONLY_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_SET_TESTS, ReadOnlySetTestsClass)) +#define IS_READ_ONLY_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_SET_TESTS)) +#define IS_READ_ONLY_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_SET_TESTS)) +#define READ_ONLY_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_SET_TESTS, ReadOnlySetTestsClass)) + +typedef struct _ReadOnlySetTests ReadOnlySetTests; +typedef struct _ReadOnlySetTestsClass ReadOnlySetTestsClass; +typedef struct _ReadOnlySetTestsPrivate ReadOnlySetTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _ReadOnlyCollectionTests { + GeeTestCase parent_instance; + ReadOnlyCollectionTestsPrivate * priv; + GeeCollection* test_collection; + GeeCollection* ro_collection; +}; + +struct _ReadOnlyCollectionTestsClass { + GeeTestCaseClass parent_class; + GeeCollection* (*get_ro_view) (ReadOnlyCollectionTests* self, GeeCollection* collection); +}; + +struct _ReadOnlySetTests { + ReadOnlyCollectionTests parent_instance; + ReadOnlySetTestsPrivate * priv; +}; + +struct _ReadOnlySetTestsClass { + ReadOnlyCollectionTestsClass parent_class; +}; + + +static gpointer read_only_set_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType read_only_collection_tests_get_type (void) G_GNUC_CONST; +GType read_only_set_tests_get_type (void) G_GNUC_CONST; +enum { + READ_ONLY_SET_TESTS_DUMMY_PROPERTY +}; +ReadOnlySetTests* read_only_set_tests_new (void); +ReadOnlySetTests* read_only_set_tests_construct (GType object_type); +ReadOnlyCollectionTests* read_only_collection_tests_new_with_name (const gchar* name); +ReadOnlyCollectionTests* read_only_collection_tests_construct_with_name (GType object_type, const gchar* name); +static void read_only_set_tests_real_set_up (GeeTestCase* base); +GeeCollection* read_only_collection_tests_get_ro_view (ReadOnlyCollectionTests* self, GeeCollection* collection); +static void read_only_set_tests_real_tear_down (GeeTestCase* base); +static GeeCollection* read_only_set_tests_real_get_ro_view (ReadOnlyCollectionTests* base, GeeCollection* collection); + + +ReadOnlySetTests* read_only_set_tests_construct (GType object_type) { + ReadOnlySetTests * self = NULL; + self = (ReadOnlySetTests*) read_only_collection_tests_construct_with_name (object_type, "ReadOnlySet"); + return self; +} + + +ReadOnlySetTests* read_only_set_tests_new (void) { + return read_only_set_tests_construct (TYPE_READ_ONLY_SET_TESTS); +} + + +static void read_only_set_tests_real_set_up (GeeTestCase* base) { + ReadOnlySetTests * self; + GeeHashSet* _tmp0_; + GeeCollection* _tmp1_; + GeeCollection* _tmp2_ = NULL; + self = (ReadOnlySetTests*) base; + _tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); + _g_object_unref0 (((ReadOnlyCollectionTests*) self)->test_collection); + ((ReadOnlyCollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; + _tmp1_ = ((ReadOnlyCollectionTests*) self)->test_collection; + _tmp2_ = read_only_collection_tests_get_ro_view ((ReadOnlyCollectionTests*) self, _tmp1_); + _g_object_unref0 (((ReadOnlyCollectionTests*) self)->ro_collection); + ((ReadOnlyCollectionTests*) self)->ro_collection = _tmp2_; +} + + +static void read_only_set_tests_real_tear_down (GeeTestCase* base) { + ReadOnlySetTests * self; + self = (ReadOnlySetTests*) base; + _g_object_unref0 (((ReadOnlyCollectionTests*) self)->test_collection); + ((ReadOnlyCollectionTests*) self)->test_collection = NULL; + _g_object_unref0 (((ReadOnlyCollectionTests*) self)->ro_collection); + ((ReadOnlyCollectionTests*) self)->ro_collection = NULL; +} + + +static GeeCollection* read_only_set_tests_real_get_ro_view (ReadOnlyCollectionTests* base, GeeCollection* collection) { + ReadOnlySetTests * self; + GeeCollection* result = NULL; + GeeCollection* _tmp0_; + GeeSet* _tmp1_; + GeeSet* _tmp2_; + self = (ReadOnlySetTests*) base; + g_return_val_if_fail (collection != NULL, NULL); + _tmp0_ = collection; + _tmp1_ = gee_set_get_read_only_view (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_SET, GeeSet)); + _tmp2_ = _tmp1_; + result = (GeeCollection*) _tmp2_; + return result; +} + + +static void read_only_set_tests_class_init (ReadOnlySetTestsClass * klass) { + read_only_set_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = read_only_set_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = read_only_set_tests_real_tear_down; + READ_ONLY_COLLECTION_TESTS_CLASS (klass)->get_ro_view = read_only_set_tests_real_get_ro_view; +} + + +static void read_only_set_tests_instance_init (ReadOnlySetTests * self) { +} + + +GType read_only_set_tests_get_type (void) { + static volatile gsize read_only_set_tests_type_id__volatile = 0; + if (g_once_init_enter (&read_only_set_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (ReadOnlySetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) read_only_set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ReadOnlySetTests), 0, (GInstanceInitFunc) read_only_set_tests_instance_init, NULL }; + GType read_only_set_tests_type_id; + read_only_set_tests_type_id = g_type_register_static (TYPE_READ_ONLY_COLLECTION_TESTS, "ReadOnlySetTests", &g_define_type_info, 0); + g_once_init_leave (&read_only_set_tests_type_id__volatile, read_only_set_tests_type_id); + } + return read_only_set_tests_type_id__volatile; +} + + + diff --git a/tests/testreadonlyset.vala b/tests/testreadonlyset.vala new file mode 100644 index 0000000..a573cda --- /dev/null +++ b/tests/testreadonlyset.vala @@ -0,0 +1,46 @@ +/* testreadonlyset.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Tomaž Vajngerl + * Julien Peeters + */ + +using Gee; + +public class ReadOnlySetTests : ReadOnlyCollectionTests { + + public ReadOnlySetTests () { + base.with_name ("ReadOnlySet"); + } + + public override void set_up () { + test_collection = new HashSet (); + ro_collection = get_ro_view (test_collection); + } + + public override void tear_down () { + test_collection = null; + ro_collection = null; + } + + protected override Collection get_ro_view (Collection collection) { + return ((Gee.Set) collection).read_only_view; + } +} diff --git a/tests/tests.vala.stamp b/tests/tests.vala.stamp new file mode 100644 index 0000000..e69de29 diff --git a/tests/testset.c b/tests/testset.c new file mode 100644 index 0000000..2b29b70 --- /dev/null +++ b/tests/testset.c @@ -0,0 +1,225 @@ +/* testset.c generated by valac 0.18.0, the Vala compiler + * generated from testset.vala, do not modify */ + +/* testset.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes' Villevalois + * Julien Peeters + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_SET_TESTS (set_tests_get_type ()) +#define SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SET_TESTS, SetTests)) +#define SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SET_TESTS, SetTestsClass)) +#define IS_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SET_TESTS)) +#define IS_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SET_TESTS)) +#define SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SET_TESTS, SetTestsClass)) + +typedef struct _SetTests SetTests; +typedef struct _SetTestsClass SetTestsClass; +typedef struct _SetTestsPrivate SetTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _SetTests { + CollectionTests parent_instance; + SetTestsPrivate * priv; +}; + +struct _SetTestsClass { + CollectionTestsClass parent_class; + void (*test_duplicates_are_ignored) (SetTests* self); +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer set_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType set_tests_get_type (void) G_GNUC_CONST; +enum { + SET_TESTS_DUMMY_PROPERTY +}; +SetTests* set_tests_construct (GType object_type, const gchar* name); +CollectionTests* collection_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void set_tests_test_duplicates_are_ignored (SetTests* self); +static void _set_tests_test_duplicates_are_ignored_gee_test_case_test_method (gpointer self); +static void set_tests_real_test_duplicates_are_ignored (SetTests* self); + + +static void _set_tests_test_duplicates_are_ignored_gee_test_case_test_method (gpointer self) { + set_tests_test_duplicates_are_ignored (self); +} + + +SetTests* set_tests_construct (GType object_type, const gchar* name) { + SetTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (SetTests*) collection_tests_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[Set] duplicates are ignored", _set_tests_test_duplicates_are_ignored_gee_test_case_test_method, self); + return self; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void set_tests_real_test_duplicates_are_ignored (SetTests* self) { + GeeCollection* _tmp0_; + GeeSet* _tmp1_; + GeeSet* test_set; + gboolean _tmp2_ = FALSE; + gboolean _tmp3_ = FALSE; + gint _tmp4_; + gint _tmp5_; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gint _tmp8_; + gint _tmp9_; + gboolean _tmp10_ = FALSE; + gboolean _tmp11_ = FALSE; + gint _tmp12_; + gint _tmp13_; + gboolean _tmp14_ = FALSE; + gboolean _tmp15_ = FALSE; + gint _tmp16_; + gint _tmp17_; + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SET) ? ((GeeSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _vala_assert (test_set != NULL, "test_set != null"); + _tmp2_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp2_, "test_set.add (\"one\")"); + _tmp3_ = gee_collection_contains ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp3_, "test_set.contains (\"one\")"); + _tmp4_ = gee_collection_get_size ((GeeCollection*) test_set); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 1, "test_set.size == 1"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (!_tmp6_, "! test_set.add (\"one\")"); + _tmp7_ = gee_collection_contains ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp7_, "test_set.contains (\"one\")"); + _tmp8_ = gee_collection_get_size ((GeeCollection*) test_set); + _tmp9_ = _tmp8_; + _vala_assert (_tmp9_ == 1, "test_set.size == 1"); + _tmp10_ = gee_collection_remove ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp10_, "test_set.remove (\"one\")"); + _tmp11_ = gee_collection_contains ((GeeCollection*) test_set, "one"); + _vala_assert (!_tmp11_, "! test_set.contains (\"one\")"); + _tmp12_ = gee_collection_get_size ((GeeCollection*) test_set); + _tmp13_ = _tmp12_; + _vala_assert (_tmp13_ == 0, "test_set.size == 0"); + _tmp14_ = gee_collection_remove ((GeeCollection*) test_set, "one"); + _vala_assert (!_tmp14_, "! test_set.remove (\"one\")"); + _tmp15_ = gee_collection_contains ((GeeCollection*) test_set, "one"); + _vala_assert (!_tmp15_, "! test_set.contains (\"one\")"); + _tmp16_ = gee_collection_get_size ((GeeCollection*) test_set); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_ == 0, "test_set.size == 0"); + _g_object_unref0 (test_set); +} + + +void set_tests_test_duplicates_are_ignored (SetTests* self) { + g_return_if_fail (self != NULL); + SET_TESTS_GET_CLASS (self)->test_duplicates_are_ignored (self); +} + + +static void set_tests_class_init (SetTestsClass * klass) { + set_tests_parent_class = g_type_class_peek_parent (klass); + SET_TESTS_CLASS (klass)->test_duplicates_are_ignored = set_tests_real_test_duplicates_are_ignored; +} + + +static void set_tests_instance_init (SetTests * self) { +} + + +GType set_tests_get_type (void) { + static volatile gsize set_tests_type_id__volatile = 0; + if (g_once_init_enter (&set_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (SetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SetTests), 0, (GInstanceInitFunc) set_tests_instance_init, NULL }; + GType set_tests_type_id; + set_tests_type_id = g_type_register_static (TYPE_COLLECTION_TESTS, "SetTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&set_tests_type_id__volatile, set_tests_type_id); + } + return set_tests_type_id__volatile; +} + + + diff --git a/tests/testset.vala b/tests/testset.vala new file mode 100644 index 0000000..e2fc83f --- /dev/null +++ b/tests/testset.vala @@ -0,0 +1,58 @@ +/* testset.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes' Villevalois + * Julien Peeters + */ + +using GLib; +using Gee; + +public abstract class SetTests : CollectionTests { + + public SetTests (string name) { + base (name); + add_test ("[Set] duplicates are ignored", test_duplicates_are_ignored); + } + + public virtual void test_duplicates_are_ignored () { + var test_set = test_collection as Set; + + // Check the test list is not null + assert (test_set != null); + + assert (test_set.add ("one")); + assert (test_set.contains ("one")); + assert (test_set.size == 1); + + assert (! test_set.add ("one")); + assert (test_set.contains ("one")); + assert (test_set.size == 1); + + assert (test_set.remove ("one")); + assert (! test_set.contains ("one")); + assert (test_set.size == 0); + + assert (! test_set.remove ("one")); + assert (! test_set.contains ("one")); + assert (test_set.size == 0); + } +} diff --git a/tests/testsortedset.c b/tests/testsortedset.c new file mode 100644 index 0000000..5b09260 --- /dev/null +++ b/tests/testsortedset.c @@ -0,0 +1,4740 @@ +/* testsortedset.c generated by valac 0.18.0, the Vala compiler + * generated from testsortedset.vala, do not modify */ + +/* testsortedset.vala + * + * Copyright (C) 2009 Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Maciej Piechotka + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_SET_TESTS (set_tests_get_type ()) +#define SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SET_TESTS, SetTests)) +#define SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SET_TESTS, SetTestsClass)) +#define IS_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SET_TESTS)) +#define IS_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SET_TESTS)) +#define SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SET_TESTS, SetTestsClass)) + +typedef struct _SetTests SetTests; +typedef struct _SetTestsClass SetTestsClass; +typedef struct _SetTestsPrivate SetTestsPrivate; + +#define TYPE_SORTED_SET_TESTS (sorted_set_tests_get_type ()) +#define SORTED_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SORTED_SET_TESTS, SortedSetTests)) +#define SORTED_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SORTED_SET_TESTS, SortedSetTestsClass)) +#define IS_SORTED_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SORTED_SET_TESTS)) +#define IS_SORTED_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SORTED_SET_TESTS)) +#define SORTED_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SORTED_SET_TESTS, SortedSetTestsClass)) + +typedef struct _SortedSetTests SortedSetTests; +typedef struct _SortedSetTestsClass SortedSetTestsClass; +typedef struct _SortedSetTestsPrivate SortedSetTestsPrivate; + +#define SORTED_SET_TESTS_SUB_SET_TYPE_TYPE (sorted_set_tests_sub_set_type_get_type ()) + +#define SORTED_SET_TESTS_TYPE_SUB_SET (sorted_set_tests_sub_set_get_type ()) +#define SORTED_SET_TESTS_SUB_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SORTED_SET_TESTS_TYPE_SUB_SET, SortedSetTestsSubSet)) +#define SORTED_SET_TESTS_SUB_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SORTED_SET_TESTS_TYPE_SUB_SET, SortedSetTestsSubSetClass)) +#define SORTED_SET_TESTS_IS_SUB_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SORTED_SET_TESTS_TYPE_SUB_SET)) +#define SORTED_SET_TESTS_IS_SUB_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SORTED_SET_TESTS_TYPE_SUB_SET)) +#define SORTED_SET_TESTS_SUB_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SORTED_SET_TESTS_TYPE_SUB_SET, SortedSetTestsSubSetClass)) + +typedef struct _SortedSetTestsSubSet SortedSetTestsSubSet; +typedef struct _SortedSetTestsSubSetClass SortedSetTestsSubSetClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +typedef struct _SortedSetTestsSubSetPrivate SortedSetTestsSubSetPrivate; +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _SetTests { + CollectionTests parent_instance; + SetTestsPrivate * priv; +}; + +struct _SetTestsClass { + CollectionTestsClass parent_class; + void (*test_duplicates_are_ignored) (SetTests* self); +}; + +struct _SortedSetTests { + SetTests parent_instance; + SortedSetTestsPrivate * priv; +}; + +struct _SortedSetTestsClass { + SetTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); +typedef enum { + SORTED_SET_TESTS_SUB_SET_TYPE_HEAD, + SORTED_SET_TESTS_SUB_SET_TYPE_TAIL, + SORTED_SET_TESTS_SUB_SET_TYPE_SUB, + SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY +} SortedSetTestsSubSetType; + +struct _SortedSetTestsSubSet { + GeeTestCase parent_instance; + SortedSetTestsSubSetPrivate * priv; +}; + +struct _SortedSetTestsSubSetClass { + GeeTestCaseClass parent_class; +}; + +struct _SortedSetTestsSubSetPrivate { + GeeSortedSet* master; + GeeSortedSet* subset; + SortedSetTests* test; + SortedSetTestsSubSetType type; +}; + + +static gpointer sorted_set_tests_parent_class = NULL; +static gpointer sorted_set_tests_sub_set_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType set_tests_get_type (void) G_GNUC_CONST; +GType sorted_set_tests_get_type (void) G_GNUC_CONST; +enum { + SORTED_SET_TESTS_DUMMY_PROPERTY +}; +SortedSetTests* sorted_set_tests_construct (GType object_type, const gchar* name); +SetTests* set_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void sorted_set_tests_test_first (SortedSetTests* self); +static void _sorted_set_tests_test_first_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_last (SortedSetTests* self); +static void _sorted_set_tests_test_last_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_ordering (SortedSetTests* self); +static void _sorted_set_tests_test_ordering_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_iterator_at (SortedSetTests* self); +static void _sorted_set_tests_test_iterator_at_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_lower (SortedSetTests* self); +static void _sorted_set_tests_test_lower_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_higher (SortedSetTests* self); +static void _sorted_set_tests_test_higher_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_floor (SortedSetTests* self); +static void _sorted_set_tests_test_floor_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_ceil (SortedSetTests* self); +static void _sorted_set_tests_test_ceil_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_bidir_iterator_can_go_backward (SortedSetTests* self); +static void _sorted_set_tests_test_bidir_iterator_can_go_backward_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_mutable_bidir_iterator (SortedSetTests* self); +static void _sorted_set_tests_test_mutable_bidir_iterator_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_bidir_iterator_last (SortedSetTests* self); +static void _sorted_set_tests_test_bidir_iterator_last_gee_test_case_test_method (gpointer self); +GTestSuite* gee_test_case_get_suite (GeeTestCase* self); +GType sorted_set_tests_sub_set_type_get_type (void) G_GNUC_CONST; +SortedSetTestsSubSet* sorted_set_tests_sub_set_new (SortedSetTests* test, SortedSetTestsSubSetType type); +SortedSetTestsSubSet* sorted_set_tests_sub_set_construct (GType object_type, SortedSetTests* test, SortedSetTestsSubSetType type); +GType sorted_set_tests_sub_set_get_type (void) G_GNUC_CONST; +#define SORTED_SET_TESTS_SUB_SET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SORTED_SET_TESTS_TYPE_SUB_SET, SortedSetTestsSubSetPrivate)) +enum { + SORTED_SET_TESTS_SUB_SET_DUMMY_PROPERTY +}; +const gchar* sorted_set_tests_sub_set_type_to_string (SortedSetTestsSubSetType self); +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name); +void sorted_set_tests_sub_set_test_size (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_size_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_contains (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_contains_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_add (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_add_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_remove (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_remove_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_iterator (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_iterator_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_clear (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_clear_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_iterator_at (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_iterator_at_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_lower (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_lower_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_higher (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_higher_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_ceil (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_ceil_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_floor (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_floor_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_subsets (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_subsets_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_boundaries (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_boundaries_gee_test_case_test_method (gpointer self); +static void sorted_set_tests_sub_set_real_set_up (GeeTestCase* base); +void gee_test_case_set_up (GeeTestCase* self); +static void sorted_set_tests_sub_set_real_tear_down (GeeTestCase* base); +void gee_test_case_tear_down (GeeTestCase* self); +static void sorted_set_tests_sub_set_finalize (GObject* obj); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); + + +static void _sorted_set_tests_test_first_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_first (self); +} + + +static void _sorted_set_tests_test_last_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_last (self); +} + + +static void _sorted_set_tests_test_ordering_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_ordering (self); +} + + +static void _sorted_set_tests_test_iterator_at_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_iterator_at (self); +} + + +static void _sorted_set_tests_test_lower_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_lower (self); +} + + +static void _sorted_set_tests_test_higher_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_higher (self); +} + + +static void _sorted_set_tests_test_floor_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_floor (self); +} + + +static void _sorted_set_tests_test_ceil_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_ceil (self); +} + + +static void _sorted_set_tests_test_bidir_iterator_can_go_backward_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_bidir_iterator_can_go_backward (self); +} + + +static void _sorted_set_tests_test_mutable_bidir_iterator_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_mutable_bidir_iterator (self); +} + + +static void _sorted_set_tests_test_bidir_iterator_last_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_bidir_iterator_last (self); +} + + +SortedSetTests* sorted_set_tests_construct (GType object_type, const gchar* name) { + SortedSetTests * self = NULL; + const gchar* _tmp0_; + GTestSuite* _tmp1_ = NULL; + SortedSetTestsSubSet* _tmp2_; + SortedSetTestsSubSet* _tmp3_; + GTestSuite* _tmp4_ = NULL; + GTestSuite* _tmp5_ = NULL; + SortedSetTestsSubSet* _tmp6_; + SortedSetTestsSubSet* _tmp7_; + GTestSuite* _tmp8_ = NULL; + GTestSuite* _tmp9_ = NULL; + SortedSetTestsSubSet* _tmp10_; + SortedSetTestsSubSet* _tmp11_; + GTestSuite* _tmp12_ = NULL; + GTestSuite* _tmp13_ = NULL; + SortedSetTestsSubSet* _tmp14_; + SortedSetTestsSubSet* _tmp15_; + GTestSuite* _tmp16_ = NULL; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (SortedSetTests*) set_tests_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] first", _sorted_set_tests_test_first_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] last", _sorted_set_tests_test_last_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] ordering", _sorted_set_tests_test_ordering_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] iterator at", _sorted_set_tests_test_iterator_at_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] lower", _sorted_set_tests_test_lower_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] higher", _sorted_set_tests_test_higher_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] floor", _sorted_set_tests_test_floor_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] ceil", _sorted_set_tests_test_ceil_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] bi-directional iterators can go backward", _sorted_set_tests_test_bidir_iterator_can_go_backward_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] bi-directional iterators are mutable", _sorted_set_tests_test_mutable_bidir_iterator_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] bi-directional iterators can to end", _sorted_set_tests_test_bidir_iterator_last_gee_test_case_test_method, self); + _tmp1_ = gee_test_case_get_suite ((GeeTestCase*) self); + _tmp2_ = sorted_set_tests_sub_set_new (self, SORTED_SET_TESTS_SUB_SET_TYPE_HEAD); + _tmp3_ = _tmp2_; + _tmp4_ = gee_test_case_get_suite ((GeeTestCase*) _tmp3_); + g_test_suite_add_suite (_tmp1_, _tmp4_); + _g_object_unref0 (_tmp3_); + _tmp5_ = gee_test_case_get_suite ((GeeTestCase*) self); + _tmp6_ = sorted_set_tests_sub_set_new (self, SORTED_SET_TESTS_SUB_SET_TYPE_TAIL); + _tmp7_ = _tmp6_; + _tmp8_ = gee_test_case_get_suite ((GeeTestCase*) _tmp7_); + g_test_suite_add_suite (_tmp5_, _tmp8_); + _g_object_unref0 (_tmp7_); + _tmp9_ = gee_test_case_get_suite ((GeeTestCase*) self); + _tmp10_ = sorted_set_tests_sub_set_new (self, SORTED_SET_TESTS_SUB_SET_TYPE_SUB); + _tmp11_ = _tmp10_; + _tmp12_ = gee_test_case_get_suite ((GeeTestCase*) _tmp11_); + g_test_suite_add_suite (_tmp9_, _tmp12_); + _g_object_unref0 (_tmp11_); + _tmp13_ = gee_test_case_get_suite ((GeeTestCase*) self); + _tmp14_ = sorted_set_tests_sub_set_new (self, SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY); + _tmp15_ = _tmp14_; + _tmp16_ = gee_test_case_get_suite ((GeeTestCase*) _tmp15_); + g_test_suite_add_suite (_tmp13_, _tmp16_); + _g_object_unref0 (_tmp15_); + return self; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void sorted_set_tests_test_ordering (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + GeeIterator* _tmp2_ = NULL; + GeeIterator* iterator; + gboolean _tmp3_ = FALSE; + gpointer _tmp4_ = NULL; + gchar* _tmp5_; + gboolean _tmp6_ = FALSE; + gpointer _tmp7_ = NULL; + gchar* _tmp8_; + gboolean _tmp9_ = FALSE; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gboolean _tmp12_ = FALSE; + gpointer _tmp13_ = NULL; + gchar* _tmp14_; + gboolean _tmp15_ = FALSE; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + gboolean _tmp18_ = FALSE; + gpointer _tmp19_ = NULL; + gchar* _tmp20_; + gboolean _tmp21_ = FALSE; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + gboolean _tmp24_ = FALSE; + gpointer _tmp25_ = NULL; + gchar* _tmp26_; + gboolean _tmp27_ = FALSE; + gpointer _tmp28_ = NULL; + gchar* _tmp29_; + gboolean _tmp30_ = FALSE; + gpointer _tmp31_ = NULL; + gchar* _tmp32_; + gboolean _tmp33_ = FALSE; + gpointer _tmp34_ = NULL; + gchar* _tmp35_; + gboolean _tmp36_ = FALSE; + gpointer _tmp37_ = NULL; + gchar* _tmp38_; + gboolean _tmp39_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _vala_assert (test_set != NULL, "test_set != null"); + gee_collection_add ((GeeCollection*) test_set, "one"); + gee_collection_add ((GeeCollection*) test_set, "two"); + gee_collection_add ((GeeCollection*) test_set, "three"); + gee_collection_add ((GeeCollection*) test_set, "four"); + gee_collection_add ((GeeCollection*) test_set, "five"); + gee_collection_add ((GeeCollection*) test_set, "six"); + gee_collection_add ((GeeCollection*) test_set, "seven"); + gee_collection_add ((GeeCollection*) test_set, "eight"); + gee_collection_add ((GeeCollection*) test_set, "nine"); + gee_collection_add ((GeeCollection*) test_set, "ten"); + gee_collection_add ((GeeCollection*) test_set, "eleven"); + gee_collection_add ((GeeCollection*) test_set, "twelve"); + _tmp2_ = gee_iterable_iterator ((GeeIterable*) test_set); + iterator = _tmp2_; + _tmp3_ = gee_iterator_next (iterator); + _vala_assert (_tmp3_, "iterator.next ()"); + _tmp4_ = gee_iterator_get (iterator); + _tmp5_ = (gchar*) _tmp4_; + _vala_assert (g_strcmp0 (_tmp5_, "eight") == 0, "iterator.get () == \"eight\""); + _g_free0 (_tmp5_); + _tmp6_ = gee_iterator_next (iterator); + _vala_assert (_tmp6_, "iterator.next ()"); + _tmp7_ = gee_iterator_get (iterator); + _tmp8_ = (gchar*) _tmp7_; + _vala_assert (g_strcmp0 (_tmp8_, "eleven") == 0, "iterator.get () == \"eleven\""); + _g_free0 (_tmp8_); + _tmp9_ = gee_iterator_next (iterator); + _vala_assert (_tmp9_, "iterator.next ()"); + _tmp10_ = gee_iterator_get (iterator); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "five") == 0, "iterator.get () == \"five\""); + _g_free0 (_tmp11_); + _tmp12_ = gee_iterator_next (iterator); + _vala_assert (_tmp12_, "iterator.next ()"); + _tmp13_ = gee_iterator_get (iterator); + _tmp14_ = (gchar*) _tmp13_; + _vala_assert (g_strcmp0 (_tmp14_, "four") == 0, "iterator.get () == \"four\""); + _g_free0 (_tmp14_); + _tmp15_ = gee_iterator_next (iterator); + _vala_assert (_tmp15_, "iterator.next ()"); + _tmp16_ = gee_iterator_get (iterator); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (g_strcmp0 (_tmp17_, "nine") == 0, "iterator.get () == \"nine\""); + _g_free0 (_tmp17_); + _tmp18_ = gee_iterator_next (iterator); + _vala_assert (_tmp18_, "iterator.next ()"); + _tmp19_ = gee_iterator_get (iterator); + _tmp20_ = (gchar*) _tmp19_; + _vala_assert (g_strcmp0 (_tmp20_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp20_); + _tmp21_ = gee_iterator_next (iterator); + _vala_assert (_tmp21_, "iterator.next ()"); + _tmp22_ = gee_iterator_get (iterator); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (g_strcmp0 (_tmp23_, "seven") == 0, "iterator.get () == \"seven\""); + _g_free0 (_tmp23_); + _tmp24_ = gee_iterator_next (iterator); + _vala_assert (_tmp24_, "iterator.next ()"); + _tmp25_ = gee_iterator_get (iterator); + _tmp26_ = (gchar*) _tmp25_; + _vala_assert (g_strcmp0 (_tmp26_, "six") == 0, "iterator.get () == \"six\""); + _g_free0 (_tmp26_); + _tmp27_ = gee_iterator_next (iterator); + _vala_assert (_tmp27_, "iterator.next ()"); + _tmp28_ = gee_iterator_get (iterator); + _tmp29_ = (gchar*) _tmp28_; + _vala_assert (g_strcmp0 (_tmp29_, "ten") == 0, "iterator.get () == \"ten\""); + _g_free0 (_tmp29_); + _tmp30_ = gee_iterator_next (iterator); + _vala_assert (_tmp30_, "iterator.next ()"); + _tmp31_ = gee_iterator_get (iterator); + _tmp32_ = (gchar*) _tmp31_; + _vala_assert (g_strcmp0 (_tmp32_, "three") == 0, "iterator.get () == \"three\""); + _g_free0 (_tmp32_); + _tmp33_ = gee_iterator_next (iterator); + _vala_assert (_tmp33_, "iterator.next ()"); + _tmp34_ = gee_iterator_get (iterator); + _tmp35_ = (gchar*) _tmp34_; + _vala_assert (g_strcmp0 (_tmp35_, "twelve") == 0, "iterator.get () == \"twelve\""); + _g_free0 (_tmp35_); + _tmp36_ = gee_iterator_next (iterator); + _vala_assert (_tmp36_, "iterator.next ()"); + _tmp37_ = gee_iterator_get (iterator); + _tmp38_ = (gchar*) _tmp37_; + _vala_assert (g_strcmp0 (_tmp38_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp38_); + _tmp39_ = gee_iterator_next (iterator); + _vala_assert (_tmp39_ == FALSE, "iterator.next () == false"); + _g_object_unref0 (iterator); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_first (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + gboolean _tmp2_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeSortedSet* _tmp14_; + gboolean _tmp15_ = FALSE; + GeeSortedSet* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeSortedSet* _tmp18_; + gpointer _tmp19_ = NULL; + gchar* _tmp20_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp2_) { + GeeSortedSet* _tmp3_; + gpointer _tmp4_ = NULL; + gchar* _tmp5_; + _tmp3_ = test_set; + _tmp4_ = gee_sorted_set_first (_tmp3_); + _tmp5_ = (gchar*) _tmp4_; + _g_free0 (_tmp5_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp6_ = test_set; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "one"); + _vala_assert (_tmp7_, "test_set.add (\"one\")"); + _tmp8_ = test_set; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "two"); + _vala_assert (_tmp9_, "test_set.add (\"two\")"); + _tmp10_ = test_set; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "three"); + _vala_assert (_tmp11_, "test_set.add (\"three\")"); + _tmp12_ = test_set; + _tmp13_ = gee_collection_add ((GeeCollection*) _tmp12_, "four"); + _vala_assert (_tmp13_, "test_set.add (\"four\")"); + _tmp14_ = test_set; + _tmp15_ = gee_collection_add ((GeeCollection*) _tmp14_, "five"); + _vala_assert (_tmp15_, "test_set.add (\"five\")"); + _tmp16_ = test_set; + _tmp17_ = gee_collection_add ((GeeCollection*) _tmp16_, "six"); + _vala_assert (_tmp17_, "test_set.add (\"six\")"); + _tmp18_ = test_set; + _tmp19_ = gee_sorted_set_first (_tmp18_); + _tmp20_ = (gchar*) _tmp19_; + _vala_assert (g_strcmp0 (_tmp20_, "five") == 0, "test_set.first () == \"five\""); + _g_free0 (_tmp20_); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_last (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + gboolean _tmp2_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeSortedSet* _tmp14_; + gboolean _tmp15_ = FALSE; + GeeSortedSet* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeSortedSet* _tmp18_; + gpointer _tmp19_ = NULL; + gchar* _tmp20_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp2_) { + GeeSortedSet* _tmp3_; + gpointer _tmp4_ = NULL; + gchar* _tmp5_; + _tmp3_ = test_set; + _tmp4_ = gee_sorted_set_last (_tmp3_); + _tmp5_ = (gchar*) _tmp4_; + _g_free0 (_tmp5_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp6_ = test_set; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "one"); + _vala_assert (_tmp7_, "test_set.add (\"one\")"); + _tmp8_ = test_set; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "two"); + _vala_assert (_tmp9_, "test_set.add (\"two\")"); + _tmp10_ = test_set; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "three"); + _vala_assert (_tmp11_, "test_set.add (\"three\")"); + _tmp12_ = test_set; + _tmp13_ = gee_collection_add ((GeeCollection*) _tmp12_, "four"); + _vala_assert (_tmp13_, "test_set.add (\"four\")"); + _tmp14_ = test_set; + _tmp15_ = gee_collection_add ((GeeCollection*) _tmp14_, "five"); + _vala_assert (_tmp15_, "test_set.add (\"five\")"); + _tmp16_ = test_set; + _tmp17_ = gee_collection_add ((GeeCollection*) _tmp16_, "six"); + _vala_assert (_tmp17_, "test_set.add (\"six\")"); + _tmp18_ = test_set; + _tmp19_ = gee_sorted_set_last (_tmp18_); + _tmp20_ = (gchar*) _tmp19_; + _vala_assert (g_strcmp0 (_tmp20_, "two") == 0, "test_set.last () == \"two\""); + _g_free0 (_tmp20_); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_iterator_at (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + gboolean _tmp2_ = FALSE; + gboolean _tmp3_ = FALSE; + gboolean _tmp4_ = FALSE; + GeeBidirIterator* _tmp5_ = NULL; + GeeBidirIterator* iter; + GeeBidirIterator* _tmp6_; + GeeBidirIterator* _tmp7_; + gpointer _tmp8_ = NULL; + gchar* _tmp9_; + GeeBidirIterator* _tmp10_ = NULL; + GeeBidirIterator* _tmp11_; + GeeBidirIterator* _tmp12_; + gpointer _tmp13_ = NULL; + gchar* _tmp14_; + GeeBidirIterator* _tmp15_ = NULL; + GeeBidirIterator* _tmp16_; + GeeBidirIterator* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + GeeBidirIterator* _tmp20_ = NULL; + GeeBidirIterator* _tmp21_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp2_, "test_set.add (\"one\")"); + _tmp3_ = gee_collection_add ((GeeCollection*) test_set, "two"); + _vala_assert (_tmp3_, "test_set.add (\"two\")"); + _tmp4_ = gee_collection_add ((GeeCollection*) test_set, "three"); + _vala_assert (_tmp4_, "test_set.add (\"three\")"); + _tmp5_ = gee_sorted_set_iterator_at (test_set, "one"); + iter = _tmp5_; + _tmp6_ = iter; + _vala_assert (_tmp6_ != NULL, "iter != null"); + _tmp7_ = iter; + _tmp8_ = gee_iterator_get ((GeeIterator*) _tmp7_); + _tmp9_ = (gchar*) _tmp8_; + _vala_assert (g_strcmp0 (_tmp9_, "one") == 0, "iter.get () == \"one\""); + _g_free0 (_tmp9_); + _tmp10_ = gee_sorted_set_iterator_at (test_set, "two"); + _g_object_unref0 (iter); + iter = _tmp10_; + _tmp11_ = iter; + _vala_assert (_tmp11_ != NULL, "iter != null"); + _tmp12_ = iter; + _tmp13_ = gee_iterator_get ((GeeIterator*) _tmp12_); + _tmp14_ = (gchar*) _tmp13_; + _vala_assert (g_strcmp0 (_tmp14_, "two") == 0, "iter.get () == \"two\""); + _g_free0 (_tmp14_); + _tmp15_ = gee_sorted_set_iterator_at (test_set, "three"); + _g_object_unref0 (iter); + iter = _tmp15_; + _tmp16_ = iter; + _vala_assert (_tmp16_ != NULL, "iter != null"); + _tmp17_ = iter; + _tmp18_ = gee_iterator_get ((GeeIterator*) _tmp17_); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (g_strcmp0 (_tmp19_, "three") == 0, "iter.get () == \"three\""); + _g_free0 (_tmp19_); + _tmp20_ = gee_sorted_set_iterator_at (test_set, "zero"); + _g_object_unref0 (iter); + iter = _tmp20_; + _tmp21_ = iter; + _vala_assert (_tmp21_ == NULL, "iter == null"); + _g_object_unref0 (iter); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_lower (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + gpointer _tmp2_ = NULL; + gchar* _tmp3_; + gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gboolean _tmp8_ = FALSE; + gboolean _tmp9_ = FALSE; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gpointer _tmp12_ = NULL; + gchar* _tmp13_; + gpointer _tmp14_ = NULL; + gchar* _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + gpointer _tmp28_ = NULL; + gchar* _tmp29_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = gee_sorted_set_lower (test_set, "one"); + _tmp3_ = (gchar*) _tmp2_; + _vala_assert (_tmp3_ == NULL, "test_set.lower (\"one\") == null"); + _g_free0 (_tmp3_); + _tmp4_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp4_, "test_set.add (\"one\")"); + _tmp5_ = gee_collection_add ((GeeCollection*) test_set, "two"); + _vala_assert (_tmp5_, "test_set.add (\"two\")"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_set, "three"); + _vala_assert (_tmp6_, "test_set.add (\"three\")"); + _tmp7_ = gee_collection_add ((GeeCollection*) test_set, "four"); + _vala_assert (_tmp7_, "test_set.add (\"four\")"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_set, "five"); + _vala_assert (_tmp8_, "test_set.add (\"five\")"); + _tmp9_ = gee_collection_add ((GeeCollection*) test_set, "six"); + _vala_assert (_tmp9_, "test_set.add (\"six\")"); + _tmp10_ = gee_sorted_set_lower (test_set, "one"); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "four") == 0, "test_set.lower (\"one\") == \"four\""); + _g_free0 (_tmp11_); + _tmp12_ = gee_sorted_set_lower (test_set, "o"); + _tmp13_ = (gchar*) _tmp12_; + _vala_assert (g_strcmp0 (_tmp13_, "four") == 0, "test_set.lower (\"o\") == \"four\""); + _g_free0 (_tmp13_); + _tmp14_ = gee_sorted_set_lower (test_set, "two"); + _tmp15_ = (gchar*) _tmp14_; + _vala_assert (g_strcmp0 (_tmp15_, "three") == 0, "test_set.lower (\"two\") == \"three\""); + _g_free0 (_tmp15_); + _tmp16_ = gee_sorted_set_lower (test_set, "t"); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (g_strcmp0 (_tmp17_, "six") == 0, "test_set.lower (\"t\") == \"six\""); + _g_free0 (_tmp17_); + _tmp18_ = gee_sorted_set_lower (test_set, "three"); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (g_strcmp0 (_tmp19_, "six") == 0, "test_set.lower (\"three\") == \"six\""); + _g_free0 (_tmp19_); + _tmp20_ = gee_sorted_set_lower (test_set, "four"); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "five") == 0, "test_set.lower (\"four\") == \"five\""); + _g_free0 (_tmp21_); + _tmp22_ = gee_sorted_set_lower (test_set, "f"); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (_tmp23_ == NULL, "test_set.lower (\"f\") == null"); + _g_free0 (_tmp23_); + _tmp24_ = gee_sorted_set_lower (test_set, "five"); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (_tmp25_ == NULL, "test_set.lower (\"five\") == null"); + _g_free0 (_tmp25_); + _tmp26_ = gee_sorted_set_lower (test_set, "six"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "one") == 0, "test_set.lower (\"six\") == \"one\""); + _g_free0 (_tmp27_); + _tmp28_ = gee_sorted_set_lower (test_set, "s"); + _tmp29_ = (gchar*) _tmp28_; + _vala_assert (g_strcmp0 (_tmp29_, "one") == 0, "test_set.lower (\"s\") == \"one\""); + _g_free0 (_tmp29_); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_higher (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + gpointer _tmp2_ = NULL; + gchar* _tmp3_; + gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gboolean _tmp8_ = FALSE; + gboolean _tmp9_ = FALSE; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gpointer _tmp12_ = NULL; + gchar* _tmp13_; + gpointer _tmp14_ = NULL; + gchar* _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + gpointer _tmp28_ = NULL; + gchar* _tmp29_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = gee_sorted_set_higher (test_set, "one"); + _tmp3_ = (gchar*) _tmp2_; + _vala_assert (_tmp3_ == NULL, "test_set.higher (\"one\") == null"); + _g_free0 (_tmp3_); + _tmp4_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp4_, "test_set.add (\"one\")"); + _tmp5_ = gee_collection_add ((GeeCollection*) test_set, "two"); + _vala_assert (_tmp5_, "test_set.add (\"two\")"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_set, "three"); + _vala_assert (_tmp6_, "test_set.add (\"three\")"); + _tmp7_ = gee_collection_add ((GeeCollection*) test_set, "four"); + _vala_assert (_tmp7_, "test_set.add (\"four\")"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_set, "five"); + _vala_assert (_tmp8_, "test_set.add (\"five\")"); + _tmp9_ = gee_collection_add ((GeeCollection*) test_set, "six"); + _vala_assert (_tmp9_, "test_set.add (\"six\")"); + _tmp10_ = gee_sorted_set_higher (test_set, "one"); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "six") == 0, "test_set.higher (\"one\") == \"six\""); + _g_free0 (_tmp11_); + _tmp12_ = gee_sorted_set_higher (test_set, "o"); + _tmp13_ = (gchar*) _tmp12_; + _vala_assert (g_strcmp0 (_tmp13_, "one") == 0, "test_set.higher (\"o\") == \"one\""); + _g_free0 (_tmp13_); + _tmp14_ = gee_sorted_set_higher (test_set, "two"); + _tmp15_ = (gchar*) _tmp14_; + _vala_assert (_tmp15_ == NULL, "test_set.higher (\"two\") == null"); + _g_free0 (_tmp15_); + _tmp16_ = gee_sorted_set_higher (test_set, "t"); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (g_strcmp0 (_tmp17_, "three") == 0, "test_set.higher (\"t\") == \"three\""); + _g_free0 (_tmp17_); + _tmp18_ = gee_sorted_set_higher (test_set, "three"); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (g_strcmp0 (_tmp19_, "two") == 0, "test_set.higher (\"three\") == \"two\""); + _g_free0 (_tmp19_); + _tmp20_ = gee_sorted_set_higher (test_set, "four"); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "one") == 0, "test_set.higher (\"four\") == \"one\""); + _g_free0 (_tmp21_); + _tmp22_ = gee_sorted_set_higher (test_set, "f"); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (g_strcmp0 (_tmp23_, "five") == 0, "test_set.higher (\"f\") == \"five\""); + _g_free0 (_tmp23_); + _tmp24_ = gee_sorted_set_higher (test_set, "five"); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "four") == 0, "test_set.higher (\"five\") == \"four\""); + _g_free0 (_tmp25_); + _tmp26_ = gee_sorted_set_higher (test_set, "six"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "three") == 0, "test_set.higher (\"six\") == \"three\""); + _g_free0 (_tmp27_); + _tmp28_ = gee_sorted_set_higher (test_set, "s"); + _tmp29_ = (gchar*) _tmp28_; + _vala_assert (g_strcmp0 (_tmp29_, "six") == 0, "test_set.higher (\"s\") == \"six\""); + _g_free0 (_tmp29_); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_floor (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + gpointer _tmp2_ = NULL; + gchar* _tmp3_; + gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gboolean _tmp8_ = FALSE; + gboolean _tmp9_ = FALSE; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gpointer _tmp12_ = NULL; + gchar* _tmp13_; + gpointer _tmp14_ = NULL; + gchar* _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + gpointer _tmp28_ = NULL; + gchar* _tmp29_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = gee_sorted_set_floor (test_set, "one"); + _tmp3_ = (gchar*) _tmp2_; + _vala_assert (_tmp3_ == NULL, "test_set.floor (\"one\") == null"); + _g_free0 (_tmp3_); + _tmp4_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp4_, "test_set.add (\"one\")"); + _tmp5_ = gee_collection_add ((GeeCollection*) test_set, "two"); + _vala_assert (_tmp5_, "test_set.add (\"two\")"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_set, "three"); + _vala_assert (_tmp6_, "test_set.add (\"three\")"); + _tmp7_ = gee_collection_add ((GeeCollection*) test_set, "four"); + _vala_assert (_tmp7_, "test_set.add (\"four\")"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_set, "five"); + _vala_assert (_tmp8_, "test_set.add (\"five\")"); + _tmp9_ = gee_collection_add ((GeeCollection*) test_set, "six"); + _vala_assert (_tmp9_, "test_set.add (\"six\")"); + _tmp10_ = gee_sorted_set_floor (test_set, "one"); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "one") == 0, "test_set.floor (\"one\") == \"one\""); + _g_free0 (_tmp11_); + _tmp12_ = gee_sorted_set_floor (test_set, "o"); + _tmp13_ = (gchar*) _tmp12_; + _vala_assert (g_strcmp0 (_tmp13_, "four") == 0, "test_set.floor (\"o\") == \"four\""); + _g_free0 (_tmp13_); + _tmp14_ = gee_sorted_set_floor (test_set, "two"); + _tmp15_ = (gchar*) _tmp14_; + _vala_assert (g_strcmp0 (_tmp15_, "two") == 0, "test_set.floor (\"two\") == \"two\""); + _g_free0 (_tmp15_); + _tmp16_ = gee_sorted_set_floor (test_set, "t"); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (g_strcmp0 (_tmp17_, "six") == 0, "test_set.floor (\"t\") == \"six\""); + _g_free0 (_tmp17_); + _tmp18_ = gee_sorted_set_floor (test_set, "three"); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (g_strcmp0 (_tmp19_, "three") == 0, "test_set.floor (\"three\") == \"three\""); + _g_free0 (_tmp19_); + _tmp20_ = gee_sorted_set_floor (test_set, "four"); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "four") == 0, "test_set.floor (\"four\") == \"four\""); + _g_free0 (_tmp21_); + _tmp22_ = gee_sorted_set_floor (test_set, "f"); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (_tmp23_ == NULL, "test_set.floor (\"f\") == null"); + _g_free0 (_tmp23_); + _tmp24_ = gee_sorted_set_floor (test_set, "five"); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "five") == 0, "test_set.floor (\"five\") == \"five\""); + _g_free0 (_tmp25_); + _tmp26_ = gee_sorted_set_floor (test_set, "six"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "six") == 0, "test_set.floor (\"six\") == \"six\""); + _g_free0 (_tmp27_); + _tmp28_ = gee_sorted_set_floor (test_set, "s"); + _tmp29_ = (gchar*) _tmp28_; + _vala_assert (g_strcmp0 (_tmp29_, "one") == 0, "test_set.floor (\"s\") == \"one\""); + _g_free0 (_tmp29_); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_ceil (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + gpointer _tmp2_ = NULL; + gchar* _tmp3_; + gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gboolean _tmp8_ = FALSE; + gboolean _tmp9_ = FALSE; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gpointer _tmp12_ = NULL; + gchar* _tmp13_; + gpointer _tmp14_ = NULL; + gchar* _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + gpointer _tmp28_ = NULL; + gchar* _tmp29_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = gee_sorted_set_ceil (test_set, "one"); + _tmp3_ = (gchar*) _tmp2_; + _vala_assert (_tmp3_ == NULL, "test_set.ceil (\"one\") == null"); + _g_free0 (_tmp3_); + _tmp4_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp4_, "test_set.add (\"one\")"); + _tmp5_ = gee_collection_add ((GeeCollection*) test_set, "two"); + _vala_assert (_tmp5_, "test_set.add (\"two\")"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_set, "three"); + _vala_assert (_tmp6_, "test_set.add (\"three\")"); + _tmp7_ = gee_collection_add ((GeeCollection*) test_set, "four"); + _vala_assert (_tmp7_, "test_set.add (\"four\")"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_set, "five"); + _vala_assert (_tmp8_, "test_set.add (\"five\")"); + _tmp9_ = gee_collection_add ((GeeCollection*) test_set, "six"); + _vala_assert (_tmp9_, "test_set.add (\"six\")"); + _tmp10_ = gee_sorted_set_ceil (test_set, "one"); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "one") == 0, "test_set.ceil (\"one\") == \"one\""); + _g_free0 (_tmp11_); + _tmp12_ = gee_sorted_set_ceil (test_set, "o"); + _tmp13_ = (gchar*) _tmp12_; + _vala_assert (g_strcmp0 (_tmp13_, "one") == 0, "test_set.ceil (\"o\") == \"one\""); + _g_free0 (_tmp13_); + _tmp14_ = gee_sorted_set_ceil (test_set, "two"); + _tmp15_ = (gchar*) _tmp14_; + _vala_assert (g_strcmp0 (_tmp15_, "two") == 0, "test_set.ceil (\"two\") == \"two\""); + _g_free0 (_tmp15_); + _tmp16_ = gee_sorted_set_ceil (test_set, "t"); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (g_strcmp0 (_tmp17_, "three") == 0, "test_set.ceil (\"t\") == \"three\""); + _g_free0 (_tmp17_); + _tmp18_ = gee_sorted_set_ceil (test_set, "three"); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (g_strcmp0 (_tmp19_, "three") == 0, "test_set.ceil (\"three\") == \"three\""); + _g_free0 (_tmp19_); + _tmp20_ = gee_sorted_set_ceil (test_set, "four"); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "four") == 0, "test_set.ceil (\"four\") == \"four\""); + _g_free0 (_tmp21_); + _tmp22_ = gee_sorted_set_ceil (test_set, "f"); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (g_strcmp0 (_tmp23_, "five") == 0, "test_set.ceil (\"f\") == \"five\""); + _g_free0 (_tmp23_); + _tmp24_ = gee_sorted_set_ceil (test_set, "five"); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "five") == 0, "test_set.ceil (\"five\") == \"five\""); + _g_free0 (_tmp25_); + _tmp26_ = gee_sorted_set_ceil (test_set, "six"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "six") == 0, "test_set.ceil (\"six\") == \"six\""); + _g_free0 (_tmp27_); + _tmp28_ = gee_sorted_set_ceil (test_set, "s"); + _tmp29_ = (gchar*) _tmp28_; + _vala_assert (g_strcmp0 (_tmp29_, "six") == 0, "test_set.ceil (\"s\") == \"six\""); + _g_free0 (_tmp29_); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_bidir_iterator_can_go_backward (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + GeeBidirIterator* _tmp2_ = NULL; + GeeBidirIterator* iterator; + GeeBidirIterator* _tmp3_; + gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gboolean _tmp8_ = FALSE; + gboolean _tmp9_ = FALSE; + gboolean _tmp10_ = FALSE; + GeeBidirIterator* _tmp11_ = NULL; + GeeBidirIterator* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeBidirIterator* _tmp14_; + gpointer _tmp15_ = NULL; + gchar* _tmp16_; + GeeBidirIterator* _tmp17_; + gboolean _tmp18_ = FALSE; + GeeBidirIterator* _tmp19_; + gboolean _tmp20_ = FALSE; + GeeBidirIterator* _tmp21_; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + GeeBidirIterator* _tmp24_; + gboolean _tmp25_ = FALSE; + GeeBidirIterator* _tmp26_; + gboolean _tmp27_ = FALSE; + GeeBidirIterator* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + GeeBidirIterator* _tmp31_; + gboolean _tmp32_ = FALSE; + GeeBidirIterator* _tmp33_; + gboolean _tmp34_ = FALSE; + GeeBidirIterator* _tmp35_; + gpointer _tmp36_ = NULL; + gchar* _tmp37_; + GeeBidirIterator* _tmp38_; + gboolean _tmp39_ = FALSE; + GeeBidirIterator* _tmp40_; + gboolean _tmp41_ = FALSE; + GeeBidirIterator* _tmp42_; + gpointer _tmp43_ = NULL; + gchar* _tmp44_; + GeeBidirIterator* _tmp45_; + gboolean _tmp46_ = FALSE; + GeeBidirIterator* _tmp47_; + gboolean _tmp48_ = FALSE; + GeeBidirIterator* _tmp49_; + gpointer _tmp50_ = NULL; + gchar* _tmp51_; + GeeBidirIterator* _tmp52_; + gboolean _tmp53_ = FALSE; + GeeBidirIterator* _tmp54_; + gboolean _tmp55_ = FALSE; + GeeBidirIterator* _tmp56_; + gboolean _tmp57_ = FALSE; + GeeBidirIterator* _tmp58_; + gpointer _tmp59_ = NULL; + gchar* _tmp60_; + GeeBidirIterator* _tmp61_; + gboolean _tmp62_ = FALSE; + GeeBidirIterator* _tmp63_; + gpointer _tmp64_ = NULL; + gchar* _tmp65_; + GeeBidirIterator* _tmp66_; + gboolean _tmp67_ = FALSE; + GeeBidirIterator* _tmp68_; + gpointer _tmp69_ = NULL; + gchar* _tmp70_; + GeeBidirIterator* _tmp71_; + gboolean _tmp72_ = FALSE; + GeeBidirIterator* _tmp73_; + gpointer _tmp74_ = NULL; + gchar* _tmp75_; + GeeBidirIterator* _tmp76_; + gboolean _tmp77_ = FALSE; + GeeBidirIterator* _tmp78_; + gpointer _tmp79_ = NULL; + gchar* _tmp80_; + GeeBidirIterator* _tmp81_; + gboolean _tmp82_ = FALSE; + GeeBidirIterator* _tmp83_; + gpointer _tmp84_ = NULL; + gchar* _tmp85_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = gee_sorted_set_bidir_iterator (test_set); + iterator = _tmp2_; + _tmp3_ = iterator; + _tmp4_ = gee_bidir_iterator_has_previous (_tmp3_); + _vala_assert (!_tmp4_, "!iterator.has_previous ()"); + _tmp5_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp5_, "test_set.add (\"one\")"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_set, "two"); + _vala_assert (_tmp6_, "test_set.add (\"two\")"); + _tmp7_ = gee_collection_add ((GeeCollection*) test_set, "three"); + _vala_assert (_tmp7_, "test_set.add (\"three\")"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_set, "four"); + _vala_assert (_tmp8_, "test_set.add (\"four\")"); + _tmp9_ = gee_collection_add ((GeeCollection*) test_set, "five"); + _vala_assert (_tmp9_, "test_set.add (\"five\")"); + _tmp10_ = gee_collection_add ((GeeCollection*) test_set, "six"); + _vala_assert (_tmp10_, "test_set.add (\"six\")"); + _tmp11_ = gee_sorted_set_bidir_iterator (test_set); + _g_object_unref0 (iterator); + iterator = _tmp11_; + _tmp12_ = iterator; + _tmp13_ = gee_iterator_next ((GeeIterator*) _tmp12_); + _vala_assert (_tmp13_, "iterator.next ()"); + _tmp14_ = iterator; + _tmp15_ = gee_iterator_get ((GeeIterator*) _tmp14_); + _tmp16_ = (gchar*) _tmp15_; + _vala_assert (g_strcmp0 (_tmp16_, "five") == 0, "iterator.get () == \"five\""); + _g_free0 (_tmp16_); + _tmp17_ = iterator; + _tmp18_ = gee_bidir_iterator_has_previous (_tmp17_); + _vala_assert (!_tmp18_, "!iterator.has_previous ()"); + _tmp19_ = iterator; + _tmp20_ = gee_iterator_next ((GeeIterator*) _tmp19_); + _vala_assert (_tmp20_, "iterator.next ()"); + _tmp21_ = iterator; + _tmp22_ = gee_iterator_get ((GeeIterator*) _tmp21_); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (g_strcmp0 (_tmp23_, "four") == 0, "iterator.get () == \"four\""); + _g_free0 (_tmp23_); + _tmp24_ = iterator; + _tmp25_ = gee_bidir_iterator_has_previous (_tmp24_); + _vala_assert (_tmp25_, "iterator.has_previous ()"); + _tmp26_ = iterator; + _tmp27_ = gee_iterator_next ((GeeIterator*) _tmp26_); + _vala_assert (_tmp27_, "iterator.next ()"); + _tmp28_ = iterator; + _tmp29_ = gee_iterator_get ((GeeIterator*) _tmp28_); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp30_); + _tmp31_ = iterator; + _tmp32_ = gee_bidir_iterator_has_previous (_tmp31_); + _vala_assert (_tmp32_, "iterator.has_previous ()"); + _tmp33_ = iterator; + _tmp34_ = gee_iterator_next ((GeeIterator*) _tmp33_); + _vala_assert (_tmp34_, "iterator.next ()"); + _tmp35_ = iterator; + _tmp36_ = gee_iterator_get ((GeeIterator*) _tmp35_); + _tmp37_ = (gchar*) _tmp36_; + _vala_assert (g_strcmp0 (_tmp37_, "six") == 0, "iterator.get () == \"six\""); + _g_free0 (_tmp37_); + _tmp38_ = iterator; + _tmp39_ = gee_bidir_iterator_has_previous (_tmp38_); + _vala_assert (_tmp39_, "iterator.has_previous ()"); + _tmp40_ = iterator; + _tmp41_ = gee_iterator_next ((GeeIterator*) _tmp40_); + _vala_assert (_tmp41_, "iterator.next ()"); + _tmp42_ = iterator; + _tmp43_ = gee_iterator_get ((GeeIterator*) _tmp42_); + _tmp44_ = (gchar*) _tmp43_; + _vala_assert (g_strcmp0 (_tmp44_, "three") == 0, "iterator.get () == \"three\""); + _g_free0 (_tmp44_); + _tmp45_ = iterator; + _tmp46_ = gee_bidir_iterator_has_previous (_tmp45_); + _vala_assert (_tmp46_, "iterator.has_previous ()"); + _tmp47_ = iterator; + _tmp48_ = gee_iterator_next ((GeeIterator*) _tmp47_); + _vala_assert (_tmp48_, "iterator.next ()"); + _tmp49_ = iterator; + _tmp50_ = gee_iterator_get ((GeeIterator*) _tmp49_); + _tmp51_ = (gchar*) _tmp50_; + _vala_assert (g_strcmp0 (_tmp51_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp51_); + _tmp52_ = iterator; + _tmp53_ = gee_bidir_iterator_has_previous (_tmp52_); + _vala_assert (_tmp53_, "iterator.has_previous ()"); + _tmp54_ = iterator; + _tmp55_ = gee_iterator_next ((GeeIterator*) _tmp54_); + _vala_assert (!_tmp55_, "!iterator.next ()"); + _tmp56_ = iterator; + _tmp57_ = gee_bidir_iterator_previous (_tmp56_); + _vala_assert (_tmp57_, "iterator.previous ()"); + _tmp58_ = iterator; + _tmp59_ = gee_iterator_get ((GeeIterator*) _tmp58_); + _tmp60_ = (gchar*) _tmp59_; + _vala_assert (g_strcmp0 (_tmp60_, "three") == 0, "iterator.get () == \"three\""); + _g_free0 (_tmp60_); + _tmp61_ = iterator; + _tmp62_ = gee_bidir_iterator_previous (_tmp61_); + _vala_assert (_tmp62_, "iterator.previous ()"); + _tmp63_ = iterator; + _tmp64_ = gee_iterator_get ((GeeIterator*) _tmp63_); + _tmp65_ = (gchar*) _tmp64_; + _vala_assert (g_strcmp0 (_tmp65_, "six") == 0, "iterator.get () == \"six\""); + _g_free0 (_tmp65_); + _tmp66_ = iterator; + _tmp67_ = gee_bidir_iterator_previous (_tmp66_); + _vala_assert (_tmp67_, "iterator.previous ()"); + _tmp68_ = iterator; + _tmp69_ = gee_iterator_get ((GeeIterator*) _tmp68_); + _tmp70_ = (gchar*) _tmp69_; + _vala_assert (g_strcmp0 (_tmp70_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp70_); + _tmp71_ = iterator; + _tmp72_ = gee_bidir_iterator_previous (_tmp71_); + _vala_assert (_tmp72_, "iterator.previous ()"); + _tmp73_ = iterator; + _tmp74_ = gee_iterator_get ((GeeIterator*) _tmp73_); + _tmp75_ = (gchar*) _tmp74_; + _vala_assert (g_strcmp0 (_tmp75_, "four") == 0, "iterator.get () == \"four\""); + _g_free0 (_tmp75_); + _tmp76_ = iterator; + _tmp77_ = gee_bidir_iterator_previous (_tmp76_); + _vala_assert (_tmp77_, "iterator.previous ()"); + _tmp78_ = iterator; + _tmp79_ = gee_iterator_get ((GeeIterator*) _tmp78_); + _tmp80_ = (gchar*) _tmp79_; + _vala_assert (g_strcmp0 (_tmp80_, "five") == 0, "iterator.get () == \"five\""); + _g_free0 (_tmp80_); + _tmp81_ = iterator; + _tmp82_ = gee_bidir_iterator_previous (_tmp81_); + _vala_assert (!_tmp82_, "!iterator.previous ()"); + _tmp83_ = iterator; + _tmp84_ = gee_iterator_get ((GeeIterator*) _tmp83_); + _tmp85_ = (gchar*) _tmp84_; + _vala_assert (g_strcmp0 (_tmp85_, "five") == 0, "iterator.get () == \"five\""); + _g_free0 (_tmp85_); + _g_object_unref0 (iterator); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_bidir_iterator_last (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + GeeBidirIterator* _tmp2_ = NULL; + GeeBidirIterator* iterator; + GeeBidirIterator* _tmp3_; + gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gboolean _tmp8_ = FALSE; + gboolean _tmp9_ = FALSE; + gboolean _tmp10_ = FALSE; + GeeBidirIterator* _tmp11_ = NULL; + GeeBidirIterator* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeBidirIterator* _tmp14_; + gpointer _tmp15_ = NULL; + gchar* _tmp16_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = gee_sorted_set_bidir_iterator (test_set); + iterator = _tmp2_; + _tmp3_ = iterator; + _tmp4_ = gee_bidir_iterator_last (_tmp3_); + _vala_assert (!_tmp4_, "!iterator.last ()"); + _tmp5_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp5_, "test_set.add (\"one\")"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_set, "two"); + _vala_assert (_tmp6_, "test_set.add (\"two\")"); + _tmp7_ = gee_collection_add ((GeeCollection*) test_set, "three"); + _vala_assert (_tmp7_, "test_set.add (\"three\")"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_set, "four"); + _vala_assert (_tmp8_, "test_set.add (\"four\")"); + _tmp9_ = gee_collection_add ((GeeCollection*) test_set, "five"); + _vala_assert (_tmp9_, "test_set.add (\"five\")"); + _tmp10_ = gee_collection_add ((GeeCollection*) test_set, "six"); + _vala_assert (_tmp10_, "test_set.add (\"six\")"); + _tmp11_ = gee_sorted_set_bidir_iterator (test_set); + _g_object_unref0 (iterator); + iterator = _tmp11_; + _tmp12_ = iterator; + _tmp13_ = gee_bidir_iterator_last (_tmp12_); + _vala_assert (_tmp13_, "iterator.last ()"); + _tmp14_ = iterator; + _tmp15_ = gee_iterator_get ((GeeIterator*) _tmp14_); + _tmp16_ = (gchar*) _tmp15_; + _vala_assert (g_strcmp0 (_tmp16_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp16_); + _g_object_unref0 (iterator); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_mutable_bidir_iterator (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + GeeSortedSet* _tmp2_; + GeeBidirIterator* _tmp3_ = NULL; + GeeBidirIterator* iterator; + GeeBidirIterator* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeSortedSet* _tmp14_; + gboolean _tmp15_ = FALSE; + GeeSortedSet* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeSortedSet* _tmp18_; + GeeBidirIterator* _tmp19_ = NULL; + gboolean _tmp20_ = FALSE; + GeeBidirIterator* _tmp22_; + gboolean _tmp23_ = FALSE; + GeeBidirIterator* _tmp24_; + gpointer _tmp25_ = NULL; + gchar* _tmp26_; + GeeBidirIterator* _tmp27_; + GeeSortedSet* _tmp28_; + gboolean _tmp29_ = FALSE; + GeeBidirIterator* _tmp30_; + gboolean _tmp31_ = FALSE; + GeeBidirIterator* _tmp32_; + gboolean _tmp33_ = FALSE; + gboolean _tmp34_ = FALSE; + GeeBidirIterator* _tmp38_; + gboolean _tmp39_ = FALSE; + GeeBidirIterator* _tmp40_; + gboolean _tmp41_ = FALSE; + GeeBidirIterator* _tmp42_; + gpointer _tmp43_ = NULL; + gchar* _tmp44_; + GeeBidirIterator* _tmp45_; + gboolean _tmp46_ = FALSE; + GeeBidirIterator* _tmp47_; + gpointer _tmp48_ = NULL; + gchar* _tmp49_; + GeeBidirIterator* _tmp50_; + GeeSortedSet* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeBidirIterator* _tmp53_; + gboolean _tmp54_ = FALSE; + GeeBidirIterator* _tmp55_; + gboolean _tmp56_ = FALSE; + GeeBidirIterator* _tmp57_; + gboolean _tmp58_ = FALSE; + GeeBidirIterator* _tmp59_; + gpointer _tmp60_ = NULL; + gchar* _tmp61_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = test_set; + _tmp3_ = gee_sorted_set_bidir_iterator (_tmp2_); + iterator = _tmp3_; + _tmp4_ = iterator; + _tmp5_ = gee_bidir_iterator_has_previous (_tmp4_); + _vala_assert (!_tmp5_, "!iterator.has_previous ()"); + _tmp6_ = test_set; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "one"); + _vala_assert (_tmp7_, "test_set.add (\"one\")"); + _tmp8_ = test_set; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "two"); + _vala_assert (_tmp9_, "test_set.add (\"two\")"); + _tmp10_ = test_set; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "three"); + _vala_assert (_tmp11_, "test_set.add (\"three\")"); + _tmp12_ = test_set; + _tmp13_ = gee_collection_add ((GeeCollection*) _tmp12_, "four"); + _vala_assert (_tmp13_, "test_set.add (\"four\")"); + _tmp14_ = test_set; + _tmp15_ = gee_collection_add ((GeeCollection*) _tmp14_, "five"); + _vala_assert (_tmp15_, "test_set.add (\"five\")"); + _tmp16_ = test_set; + _tmp17_ = gee_collection_add ((GeeCollection*) _tmp16_, "six"); + _vala_assert (_tmp17_, "test_set.add (\"six\")"); + _tmp18_ = test_set; + _tmp19_ = gee_sorted_set_bidir_iterator (_tmp18_); + _g_object_unref0 (iterator); + iterator = _tmp19_; + _tmp20_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp20_) { + GeeBidirIterator* _tmp21_; + _tmp21_ = iterator; + gee_iterator_remove ((GeeIterator*) _tmp21_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp22_ = iterator; + _tmp23_ = gee_iterator_next ((GeeIterator*) _tmp22_); + _vala_assert (_tmp23_, "iterator.next ()"); + _tmp24_ = iterator; + _tmp25_ = gee_iterator_get ((GeeIterator*) _tmp24_); + _tmp26_ = (gchar*) _tmp25_; + _vala_assert (g_strcmp0 (_tmp26_, "five") == 0, "iterator.get () == \"five\""); + _g_free0 (_tmp26_); + _tmp27_ = iterator; + gee_iterator_remove ((GeeIterator*) _tmp27_); + _tmp28_ = test_set; + _tmp29_ = gee_collection_contains ((GeeCollection*) _tmp28_, "five"); + _vala_assert (!_tmp29_, "!test_set.contains (\"five\")"); + _tmp30_ = iterator; + _tmp31_ = gee_iterator_has_next ((GeeIterator*) _tmp30_); + _vala_assert (_tmp31_, "iterator.has_next ()"); + _tmp32_ = iterator; + _tmp33_ = gee_bidir_iterator_has_previous (_tmp32_); + _vala_assert (!_tmp33_, "!iterator.has_previous ()"); + _tmp34_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp34_) { + GeeBidirIterator* _tmp35_; + gpointer _tmp36_ = NULL; + gchar* _tmp37_; + _tmp35_ = iterator; + _tmp36_ = gee_iterator_get ((GeeIterator*) _tmp35_); + _tmp37_ = (gchar*) _tmp36_; + _g_free0 (_tmp37_); + exit (0); + } + _tmp38_ = iterator; + _tmp39_ = gee_bidir_iterator_previous (_tmp38_); + _vala_assert (!_tmp39_, "!iterator.previous ()"); + _tmp40_ = iterator; + _tmp41_ = gee_iterator_next ((GeeIterator*) _tmp40_); + _vala_assert (_tmp41_, "iterator.next ()"); + _tmp42_ = iterator; + _tmp43_ = gee_iterator_get ((GeeIterator*) _tmp42_); + _tmp44_ = (gchar*) _tmp43_; + _vala_assert (g_strcmp0 (_tmp44_, "four") == 0, "iterator.get () == \"four\""); + _g_free0 (_tmp44_); + _tmp45_ = iterator; + _tmp46_ = gee_iterator_next ((GeeIterator*) _tmp45_); + _vala_assert (_tmp46_, "iterator.next ()"); + _tmp47_ = iterator; + _tmp48_ = gee_iterator_get ((GeeIterator*) _tmp47_); + _tmp49_ = (gchar*) _tmp48_; + _vala_assert (g_strcmp0 (_tmp49_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp49_); + _tmp50_ = iterator; + gee_iterator_remove ((GeeIterator*) _tmp50_); + _tmp51_ = test_set; + _tmp52_ = gee_collection_contains ((GeeCollection*) _tmp51_, "one"); + _vala_assert (!_tmp52_, "!test_set.contains (\"one\")"); + _tmp53_ = iterator; + _tmp54_ = gee_iterator_has_next ((GeeIterator*) _tmp53_); + _vala_assert (_tmp54_, "iterator.has_next ()"); + _tmp55_ = iterator; + _tmp56_ = gee_bidir_iterator_has_previous (_tmp55_); + _vala_assert (_tmp56_, "iterator.has_previous ()"); + _tmp57_ = iterator; + _tmp58_ = gee_bidir_iterator_previous (_tmp57_); + _vala_assert (_tmp58_, "iterator.previous ()"); + _tmp59_ = iterator; + _tmp60_ = gee_iterator_get ((GeeIterator*) _tmp59_); + _tmp61_ = (gchar*) _tmp60_; + _vala_assert (g_strcmp0 (_tmp61_, "four") == 0, "iterator.get () == \"four\""); + _g_free0 (_tmp61_); + _g_object_unref0 (iterator); + _g_object_unref0 (test_set); +} + + +const gchar* sorted_set_tests_sub_set_type_to_string (SortedSetTestsSubSetType self) { + const gchar* result = NULL; + switch (self) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + result = "Head"; + return result; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + result = "Tail"; + return result; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + result = "Range"; + return result; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + result = "Empty"; + return result; + } + default: + { + g_assert_not_reached (); + } + } +} + + +GType sorted_set_tests_sub_set_type_get_type (void) { + static volatile gsize sorted_set_tests_sub_set_type_type_id__volatile = 0; + if (g_once_init_enter (&sorted_set_tests_sub_set_type_type_id__volatile)) { + static const GEnumValue values[] = {{SORTED_SET_TESTS_SUB_SET_TYPE_HEAD, "SORTED_SET_TESTS_SUB_SET_TYPE_HEAD", "head"}, {SORTED_SET_TESTS_SUB_SET_TYPE_TAIL, "SORTED_SET_TESTS_SUB_SET_TYPE_TAIL", "tail"}, {SORTED_SET_TESTS_SUB_SET_TYPE_SUB, "SORTED_SET_TESTS_SUB_SET_TYPE_SUB", "sub"}, {SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY, "SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY", "empty"}, {0, NULL, NULL}}; + GType sorted_set_tests_sub_set_type_type_id; + sorted_set_tests_sub_set_type_type_id = g_enum_register_static ("SortedSetTestsSubSetType", values); + g_once_init_leave (&sorted_set_tests_sub_set_type_type_id__volatile, sorted_set_tests_sub_set_type_type_id); + } + return sorted_set_tests_sub_set_type_type_id__volatile; +} + + +static void _sorted_set_tests_sub_set_test_size_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_size (self); +} + + +static void _sorted_set_tests_sub_set_test_contains_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_contains (self); +} + + +static void _sorted_set_tests_sub_set_test_add_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_add (self); +} + + +static void _sorted_set_tests_sub_set_test_remove_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_remove (self); +} + + +static void _sorted_set_tests_sub_set_test_iterator_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_iterator (self); +} + + +static void _sorted_set_tests_sub_set_test_clear_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_clear (self); +} + + +static void _sorted_set_tests_sub_set_test_iterator_at_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_iterator_at (self); +} + + +static void _sorted_set_tests_sub_set_test_lower_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_lower (self); +} + + +static void _sorted_set_tests_sub_set_test_higher_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_higher (self); +} + + +static void _sorted_set_tests_sub_set_test_ceil_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_ceil (self); +} + + +static void _sorted_set_tests_sub_set_test_floor_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_floor (self); +} + + +static void _sorted_set_tests_sub_set_test_subsets_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_subsets (self); +} + + +static void _sorted_set_tests_sub_set_test_boundaries_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_boundaries (self); +} + + +SortedSetTestsSubSet* sorted_set_tests_sub_set_construct (GType object_type, SortedSetTests* test, SortedSetTestsSubSetType type) { + SortedSetTestsSubSet * self = NULL; + SortedSetTestsSubSetType _tmp0_; + const gchar* _tmp1_ = NULL; + gchar* _tmp2_ = NULL; + gchar* _tmp3_; + SortedSetTests* _tmp4_; + SortedSetTests* _tmp5_; + SortedSetTestsSubSetType _tmp6_; + g_return_val_if_fail (test != NULL, NULL); + _tmp0_ = type; + _tmp1_ = sorted_set_tests_sub_set_type_to_string (_tmp0_); + _tmp2_ = g_strdup_printf ("%s Subset", _tmp1_); + _tmp3_ = _tmp2_; + self = (SortedSetTestsSubSet*) gee_test_case_construct (object_type, _tmp3_); + _g_free0 (_tmp3_); + _tmp4_ = test; + _tmp5_ = _g_object_ref0 (_tmp4_); + _g_object_unref0 (self->priv->test); + self->priv->test = _tmp5_; + _tmp6_ = type; + self->priv->type = _tmp6_; + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] size", _sorted_set_tests_sub_set_test_size_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] contains", _sorted_set_tests_sub_set_test_contains_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] add", _sorted_set_tests_sub_set_test_add_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] remove", _sorted_set_tests_sub_set_test_remove_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] iterator", _sorted_set_tests_sub_set_test_iterator_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] clear", _sorted_set_tests_sub_set_test_clear_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] iterator at", _sorted_set_tests_sub_set_test_iterator_at_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] lower", _sorted_set_tests_sub_set_test_lower_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] higher", _sorted_set_tests_sub_set_test_higher_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] ceil", _sorted_set_tests_sub_set_test_ceil_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] floor", _sorted_set_tests_sub_set_test_floor_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] subsets", _sorted_set_tests_sub_set_test_subsets_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] boundaries", _sorted_set_tests_sub_set_test_boundaries_gee_test_case_test_method, self); + return self; +} + + +SortedSetTestsSubSet* sorted_set_tests_sub_set_new (SortedSetTests* test, SortedSetTestsSubSetType type) { + return sorted_set_tests_sub_set_construct (SORTED_SET_TESTS_TYPE_SUB_SET, test, type); +} + + +static void sorted_set_tests_sub_set_real_set_up (GeeTestCase* base) { + SortedSetTestsSubSet * self; + SortedSetTests* _tmp0_; + SortedSetTests* _tmp1_; + GeeCollection* _tmp2_; + GeeSortedSet* _tmp3_; + SortedSetTestsSubSetType _tmp4_; + self = (SortedSetTestsSubSet*) base; + _tmp0_ = self->priv->test; + gee_test_case_set_up ((GeeTestCase*) _tmp0_); + _tmp1_ = self->priv->test; + _tmp2_ = ((CollectionTests*) _tmp1_)->test_collection; + _tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp2_) : NULL); + _g_object_unref0 (self->priv->master); + self->priv->master = _tmp3_; + _tmp4_ = self->priv->type; + switch (_tmp4_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + GeeSortedSet* _tmp5_; + GeeSortedSet* _tmp6_ = NULL; + _tmp5_ = self->priv->master; + _tmp6_ = gee_sorted_set_head_set (_tmp5_, "one"); + _g_object_unref0 (self->priv->subset); + self->priv->subset = _tmp6_; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + GeeSortedSet* _tmp7_; + GeeSortedSet* _tmp8_ = NULL; + _tmp7_ = self->priv->master; + _tmp8_ = gee_sorted_set_tail_set (_tmp7_, "six"); + _g_object_unref0 (self->priv->subset); + self->priv->subset = _tmp8_; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + GeeSortedSet* _tmp9_; + GeeSortedSet* _tmp10_ = NULL; + _tmp9_ = self->priv->master; + _tmp10_ = gee_sorted_set_sub_set (_tmp9_, "four", "three"); + _g_object_unref0 (self->priv->subset); + self->priv->subset = _tmp10_; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + GeeSortedSet* _tmp11_; + GeeSortedSet* _tmp12_ = NULL; + _tmp11_ = self->priv->master; + _tmp12_ = gee_sorted_set_sub_set (_tmp11_, "three", "four"); + _g_object_unref0 (self->priv->subset); + self->priv->subset = _tmp12_; + break; + } + default: + { + g_assert_not_reached (); + } + } +} + + +static void sorted_set_tests_sub_set_real_tear_down (GeeTestCase* base) { + SortedSetTestsSubSet * self; + SortedSetTests* _tmp0_; + self = (SortedSetTestsSubSet*) base; + _tmp0_ = self->priv->test; + gee_test_case_tear_down ((GeeTestCase*) _tmp0_); +} + + +void sorted_set_tests_sub_set_test_size (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_; + gboolean _tmp2_; + GeeSortedSet* _tmp3_; + gint _tmp4_; + gint _tmp5_; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeSortedSet* _tmp14_; + gboolean _tmp15_ = FALSE; + GeeSortedSet* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeSortedSet* _tmp18_; + gint _tmp19_; + gint _tmp20_; + SortedSetTestsSubSetType _tmp21_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->subset; + _tmp1_ = gee_collection_get_is_empty ((GeeCollection*) _tmp0_); + _tmp2_ = _tmp1_; + _vala_assert (_tmp2_, "subset.is_empty"); + _tmp3_ = self->priv->subset; + _tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 0, "subset.size == 0"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "one"); + _vala_assert (_tmp7_, "master.add (\"one\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "two"); + _vala_assert (_tmp9_, "master.add (\"two\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "three"); + _vala_assert (_tmp11_, "master.add (\"three\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_add ((GeeCollection*) _tmp12_, "four"); + _vala_assert (_tmp13_, "master.add (\"four\")"); + _tmp14_ = self->priv->master; + _tmp15_ = gee_collection_add ((GeeCollection*) _tmp14_, "five"); + _vala_assert (_tmp15_, "master.add (\"five\")"); + _tmp16_ = self->priv->master; + _tmp17_ = gee_collection_add ((GeeCollection*) _tmp16_, "six"); + _vala_assert (_tmp17_, "master.add (\"six\")"); + _tmp18_ = self->priv->master; + _tmp19_ = gee_collection_get_size ((GeeCollection*) _tmp18_); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 6, "master.size == 6"); + _tmp21_ = self->priv->type; + switch (_tmp21_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + GeeSortedSet* _tmp22_; + gboolean _tmp23_; + gboolean _tmp24_; + GeeSortedSet* _tmp25_; + gint _tmp26_; + gint _tmp27_; + _tmp22_ = self->priv->subset; + _tmp23_ = gee_collection_get_is_empty ((GeeCollection*) _tmp22_); + _tmp24_ = _tmp23_; + _vala_assert (!_tmp24_, "!subset.is_empty"); + _tmp25_ = self->priv->subset; + _tmp26_ = gee_collection_get_size ((GeeCollection*) _tmp25_); + _tmp27_ = _tmp26_; + _vala_assert (_tmp27_ == 2, "subset.size == 2"); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + GeeSortedSet* _tmp28_; + gboolean _tmp29_; + gboolean _tmp30_; + GeeSortedSet* _tmp31_; + gint _tmp32_; + gint _tmp33_; + _tmp28_ = self->priv->subset; + _tmp29_ = gee_collection_get_is_empty ((GeeCollection*) _tmp28_); + _tmp30_ = _tmp29_; + _vala_assert (!_tmp30_, "!subset.is_empty"); + _tmp31_ = self->priv->subset; + _tmp32_ = gee_collection_get_size ((GeeCollection*) _tmp31_); + _tmp33_ = _tmp32_; + _vala_assert (_tmp33_ == 3, "subset.size == 3"); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + GeeSortedSet* _tmp34_; + gboolean _tmp35_; + gboolean _tmp36_; + GeeSortedSet* _tmp37_; + gint _tmp38_; + gint _tmp39_; + _tmp34_ = self->priv->subset; + _tmp35_ = gee_collection_get_is_empty ((GeeCollection*) _tmp34_); + _tmp36_ = _tmp35_; + _vala_assert (!_tmp36_, "!subset.is_empty"); + _tmp37_ = self->priv->subset; + _tmp38_ = gee_collection_get_size ((GeeCollection*) _tmp37_); + _tmp39_ = _tmp38_; + _vala_assert (_tmp39_ == 3, "subset.size == 3"); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + GeeSortedSet* _tmp40_; + gboolean _tmp41_; + gboolean _tmp42_; + GeeSortedSet* _tmp43_; + gint _tmp44_; + gint _tmp45_; + _tmp40_ = self->priv->subset; + _tmp41_ = gee_collection_get_is_empty ((GeeCollection*) _tmp40_); + _tmp42_ = _tmp41_; + _vala_assert (_tmp42_, "subset.is_empty"); + _tmp43_ = self->priv->subset; + _tmp44_ = gee_collection_get_size ((GeeCollection*) _tmp43_); + _tmp45_ = _tmp44_; + _vala_assert (_tmp45_ == 0, "subset.size == 0"); + break; + } + default: + { + g_assert_not_reached (); + } + } +} + + +void sorted_set_tests_sub_set_test_contains (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + gchar** contains = NULL; + gint contains_length1 = 0; + gint _contains_size_ = 0; + gchar** not_contains = NULL; + gint not_contains_length1 = 0; + gint _not_contains_size_ = 0; + SortedSetTestsSubSetType _tmp15_; + gchar** _tmp48_; + gint _tmp48__length1; + gchar** _tmp53_; + gint _tmp53__length1; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + gchar* _tmp16_; + gchar* _tmp17_; + gchar** _tmp18_ = NULL; + gchar* _tmp19_; + gchar* _tmp20_; + gchar* _tmp21_; + gchar* _tmp22_; + gchar** _tmp23_ = NULL; + _tmp16_ = g_strdup ("four"); + _tmp17_ = g_strdup ("five"); + _tmp18_ = g_new0 (gchar*, 2 + 1); + _tmp18_[0] = _tmp16_; + _tmp18_[1] = _tmp17_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp18_; + contains_length1 = 2; + _contains_size_ = contains_length1; + _tmp19_ = g_strdup ("one"); + _tmp20_ = g_strdup ("two"); + _tmp21_ = g_strdup ("three"); + _tmp22_ = g_strdup ("six"); + _tmp23_ = g_new0 (gchar*, 4 + 1); + _tmp23_[0] = _tmp19_; + _tmp23_[1] = _tmp20_; + _tmp23_[2] = _tmp21_; + _tmp23_[3] = _tmp22_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp23_; + not_contains_length1 = 4; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + gchar* _tmp24_; + gchar* _tmp25_; + gchar* _tmp26_; + gchar** _tmp27_ = NULL; + gchar* _tmp28_; + gchar* _tmp29_; + gchar* _tmp30_; + gchar** _tmp31_ = NULL; + _tmp24_ = g_strdup ("two"); + _tmp25_ = g_strdup ("three"); + _tmp26_ = g_strdup ("six"); + _tmp27_ = g_new0 (gchar*, 3 + 1); + _tmp27_[0] = _tmp24_; + _tmp27_[1] = _tmp25_; + _tmp27_[2] = _tmp26_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp27_; + contains_length1 = 3; + _contains_size_ = contains_length1; + _tmp28_ = g_strdup ("one"); + _tmp29_ = g_strdup ("four"); + _tmp30_ = g_strdup ("five"); + _tmp31_ = g_new0 (gchar*, 3 + 1); + _tmp31_[0] = _tmp28_; + _tmp31_[1] = _tmp29_; + _tmp31_[2] = _tmp30_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp31_; + not_contains_length1 = 3; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + gchar* _tmp32_; + gchar* _tmp33_; + gchar* _tmp34_; + gchar** _tmp35_ = NULL; + gchar* _tmp36_; + gchar* _tmp37_; + gchar* _tmp38_; + gchar** _tmp39_ = NULL; + _tmp32_ = g_strdup ("one"); + _tmp33_ = g_strdup ("four"); + _tmp34_ = g_strdup ("six"); + _tmp35_ = g_new0 (gchar*, 3 + 1); + _tmp35_[0] = _tmp32_; + _tmp35_[1] = _tmp33_; + _tmp35_[2] = _tmp34_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp35_; + contains_length1 = 3; + _contains_size_ = contains_length1; + _tmp36_ = g_strdup ("two"); + _tmp37_ = g_strdup ("three"); + _tmp38_ = g_strdup ("five"); + _tmp39_ = g_new0 (gchar*, 3 + 1); + _tmp39_[0] = _tmp36_; + _tmp39_[1] = _tmp37_; + _tmp39_[2] = _tmp38_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp39_; + not_contains_length1 = 3; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + gchar** _tmp40_ = NULL; + gchar* _tmp41_; + gchar* _tmp42_; + gchar* _tmp43_; + gchar* _tmp44_; + gchar* _tmp45_; + gchar* _tmp46_; + gchar** _tmp47_ = NULL; + _tmp40_ = g_new0 (gchar*, 0 + 1); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp40_; + contains_length1 = 0; + _contains_size_ = contains_length1; + _tmp41_ = g_strdup ("one"); + _tmp42_ = g_strdup ("two"); + _tmp43_ = g_strdup ("three"); + _tmp44_ = g_strdup ("four"); + _tmp45_ = g_strdup ("five"); + _tmp46_ = g_strdup ("six"); + _tmp47_ = g_new0 (gchar*, 6 + 1); + _tmp47_[0] = _tmp41_; + _tmp47_[1] = _tmp42_; + _tmp47_[2] = _tmp43_; + _tmp47_[3] = _tmp44_; + _tmp47_[4] = _tmp45_; + _tmp47_[5] = _tmp46_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp47_; + not_contains_length1 = 6; + _not_contains_size_ = not_contains_length1; + break; + } + default: + { + g_assert_not_reached (); + } + } + _tmp48_ = contains; + _tmp48__length1 = contains_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp48_; + s_collection_length1 = _tmp48__length1; + for (s_it = 0; s_it < _tmp48__length1; s_it = s_it + 1) { + gchar* _tmp49_; + gchar* s = NULL; + _tmp49_ = g_strdup (s_collection[s_it]); + s = _tmp49_; + { + GeeSortedSet* _tmp50_; + const gchar* _tmp51_; + gboolean _tmp52_ = FALSE; + _tmp50_ = self->priv->subset; + _tmp51_ = s; + _tmp52_ = gee_collection_contains ((GeeCollection*) _tmp50_, _tmp51_); + _vala_assert (_tmp52_, "subset.contains (s)"); + _g_free0 (s); + } + } + } + _tmp53_ = not_contains; + _tmp53__length1 = not_contains_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp53_; + s_collection_length1 = _tmp53__length1; + for (s_it = 0; s_it < _tmp53__length1; s_it = s_it + 1) { + gchar* _tmp54_; + gchar* s = NULL; + _tmp54_ = g_strdup (s_collection[s_it]); + s = _tmp54_; + { + GeeSortedSet* _tmp55_; + const gchar* _tmp56_; + gboolean _tmp57_ = FALSE; + _tmp55_ = self->priv->subset; + _tmp56_ = s; + _tmp57_ = gee_collection_contains ((GeeCollection*) _tmp55_, _tmp56_); + _vala_assert (!_tmp57_, "!subset.contains (s)"); + _g_free0 (s); + } + } + } + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); +} + + +void sorted_set_tests_sub_set_test_add (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + gchar** success = NULL; + gint success_length1 = 0; + gint _success_size_ = 0; + gchar** fail = NULL; + gint fail_length1 = 0; + gint _fail_size_ = 0; + SortedSetTestsSubSetType _tmp15_; + gchar** _tmp40_; + gint _tmp40__length1; + gchar** _tmp51_; + gint _tmp51__length1; + GeeSortedSet* _tmp62_; + gint _tmp63_; + gint _tmp64_; + gchar** _tmp65_; + gint _tmp65__length1; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + gchar* _tmp16_; + gchar* _tmp17_; + gchar** _tmp18_ = NULL; + gchar* _tmp19_; + gchar* _tmp20_; + gchar** _tmp21_ = NULL; + _tmp16_ = g_strdup ("a"); + _tmp17_ = g_strdup ("o"); + _tmp18_ = g_new0 (gchar*, 2 + 1); + _tmp18_[0] = _tmp16_; + _tmp18_[1] = _tmp17_; + success = (_vala_array_free (success, success_length1, (GDestroyNotify) g_free), NULL); + success = _tmp18_; + success_length1 = 2; + _success_size_ = success_length1; + _tmp19_ = g_strdup ("oz"); + _tmp20_ = g_strdup ("z"); + _tmp21_ = g_new0 (gchar*, 2 + 1); + _tmp21_[0] = _tmp19_; + _tmp21_[1] = _tmp20_; + fail = (_vala_array_free (fail, fail_length1, (GDestroyNotify) g_free), NULL); + fail = _tmp21_; + fail_length1 = 2; + _fail_size_ = fail_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + gchar* _tmp22_; + gchar* _tmp23_; + gchar** _tmp24_ = NULL; + gchar* _tmp25_; + gchar* _tmp26_; + gchar** _tmp27_ = NULL; + _tmp22_ = g_strdup ("siz"); + _tmp23_ = g_strdup ("z"); + _tmp24_ = g_new0 (gchar*, 2 + 1); + _tmp24_[0] = _tmp22_; + _tmp24_[1] = _tmp23_; + success = (_vala_array_free (success, success_length1, (GDestroyNotify) g_free), NULL); + success = _tmp24_; + success_length1 = 2; + _success_size_ = success_length1; + _tmp25_ = g_strdup ("sia"); + _tmp26_ = g_strdup ("a"); + _tmp27_ = g_new0 (gchar*, 2 + 1); + _tmp27_[0] = _tmp25_; + _tmp27_[1] = _tmp26_; + fail = (_vala_array_free (fail, fail_length1, (GDestroyNotify) g_free), NULL); + fail = _tmp27_; + fail_length1 = 2; + _fail_size_ = fail_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + gchar* _tmp28_; + gchar* _tmp29_; + gchar** _tmp30_ = NULL; + gchar* _tmp31_; + gchar* _tmp32_; + gchar** _tmp33_ = NULL; + _tmp28_ = g_strdup ("o"); + _tmp29_ = g_strdup ("th"); + _tmp30_ = g_new0 (gchar*, 2 + 1); + _tmp30_[0] = _tmp28_; + _tmp30_[1] = _tmp29_; + success = (_vala_array_free (success, success_length1, (GDestroyNotify) g_free), NULL); + success = _tmp30_; + success_length1 = 2; + _success_size_ = success_length1; + _tmp31_ = g_strdup ("f"); + _tmp32_ = g_strdup ("u"); + _tmp33_ = g_new0 (gchar*, 2 + 1); + _tmp33_[0] = _tmp31_; + _tmp33_[1] = _tmp32_; + fail = (_vala_array_free (fail, fail_length1, (GDestroyNotify) g_free), NULL); + fail = _tmp33_; + fail_length1 = 2; + _fail_size_ = fail_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + gchar** _tmp34_ = NULL; + gchar* _tmp35_; + gchar* _tmp36_; + gchar* _tmp37_; + gchar* _tmp38_; + gchar** _tmp39_ = NULL; + _tmp34_ = g_new0 (gchar*, 0 + 1); + success = (_vala_array_free (success, success_length1, (GDestroyNotify) g_free), NULL); + success = _tmp34_; + success_length1 = 0; + _success_size_ = success_length1; + _tmp35_ = g_strdup ("o"); + _tmp36_ = g_strdup ("th"); + _tmp37_ = g_strdup ("f"); + _tmp38_ = g_strdup ("u"); + _tmp39_ = g_new0 (gchar*, 4 + 1); + _tmp39_[0] = _tmp35_; + _tmp39_[1] = _tmp36_; + _tmp39_[2] = _tmp37_; + _tmp39_[3] = _tmp38_; + fail = (_vala_array_free (fail, fail_length1, (GDestroyNotify) g_free), NULL); + fail = _tmp39_; + fail_length1 = 4; + _fail_size_ = fail_length1; + break; + } + default: + { + g_assert_not_reached (); + } + } + _tmp40_ = success; + _tmp40__length1 = success_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp40_; + s_collection_length1 = _tmp40__length1; + for (s_it = 0; s_it < _tmp40__length1; s_it = s_it + 1) { + gchar* _tmp41_; + gchar* s = NULL; + _tmp41_ = g_strdup (s_collection[s_it]); + s = _tmp41_; + { + GeeSortedSet* _tmp42_; + const gchar* _tmp43_; + gboolean _tmp44_ = FALSE; + GeeSortedSet* _tmp45_; + const gchar* _tmp46_; + gboolean _tmp47_ = FALSE; + GeeSortedSet* _tmp48_; + const gchar* _tmp49_; + gboolean _tmp50_ = FALSE; + _tmp42_ = self->priv->subset; + _tmp43_ = s; + _tmp44_ = gee_collection_add ((GeeCollection*) _tmp42_, _tmp43_); + _vala_assert (_tmp44_, "subset.add (s)"); + _tmp45_ = self->priv->subset; + _tmp46_ = s; + _tmp47_ = gee_collection_contains ((GeeCollection*) _tmp45_, _tmp46_); + _vala_assert (_tmp47_, "subset.contains (s)"); + _tmp48_ = self->priv->master; + _tmp49_ = s; + _tmp50_ = gee_collection_contains ((GeeCollection*) _tmp48_, _tmp49_); + _vala_assert (_tmp50_, "master.contains (s)"); + _g_free0 (s); + } + } + } + _tmp51_ = fail; + _tmp51__length1 = fail_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp51_; + s_collection_length1 = _tmp51__length1; + for (s_it = 0; s_it < _tmp51__length1; s_it = s_it + 1) { + gchar* _tmp52_; + gchar* s = NULL; + _tmp52_ = g_strdup (s_collection[s_it]); + s = _tmp52_; + { + GeeSortedSet* _tmp53_; + const gchar* _tmp54_; + gboolean _tmp55_ = FALSE; + GeeSortedSet* _tmp56_; + const gchar* _tmp57_; + gboolean _tmp58_ = FALSE; + GeeSortedSet* _tmp59_; + const gchar* _tmp60_; + gboolean _tmp61_ = FALSE; + _tmp53_ = self->priv->subset; + _tmp54_ = s; + _tmp55_ = gee_collection_add ((GeeCollection*) _tmp53_, _tmp54_); + _vala_assert (!_tmp55_, "!subset.add (s)"); + _tmp56_ = self->priv->subset; + _tmp57_ = s; + _tmp58_ = gee_collection_contains ((GeeCollection*) _tmp56_, _tmp57_); + _vala_assert (!_tmp58_, "!subset.contains (s)"); + _tmp59_ = self->priv->master; + _tmp60_ = s; + _tmp61_ = gee_collection_contains ((GeeCollection*) _tmp59_, _tmp60_); + _vala_assert (!_tmp61_, "!master.contains (s)"); + _g_free0 (s); + } + } + } + _tmp62_ = self->priv->master; + _tmp63_ = gee_collection_get_size ((GeeCollection*) _tmp62_); + _tmp64_ = _tmp63_; + _tmp65_ = success; + _tmp65__length1 = success_length1; + _vala_assert (_tmp64_ == (6 + _tmp65__length1), "master.size == 6 + success.length"); + fail = (_vala_array_free (fail, fail_length1, (GDestroyNotify) g_free), NULL); + success = (_vala_array_free (success, success_length1, (GDestroyNotify) g_free), NULL); +} + + +void sorted_set_tests_sub_set_test_remove (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + gchar** contains = NULL; + gint contains_length1 = 0; + gint _contains_size_ = 0; + gchar** not_contains = NULL; + gint not_contains_length1 = 0; + gint _not_contains_size_ = 0; + SortedSetTestsSubSetType _tmp15_; + gchar** _tmp48_; + gint _tmp48__length1; + gchar** _tmp56_; + gint _tmp56__length1; + GeeSortedSet* _tmp64_; + gint _tmp65_; + gint _tmp66_; + gchar** _tmp67_; + gint _tmp67__length1; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + gchar* _tmp16_; + gchar* _tmp17_; + gchar** _tmp18_ = NULL; + gchar* _tmp19_; + gchar* _tmp20_; + gchar* _tmp21_; + gchar* _tmp22_; + gchar** _tmp23_ = NULL; + _tmp16_ = g_strdup ("four"); + _tmp17_ = g_strdup ("five"); + _tmp18_ = g_new0 (gchar*, 2 + 1); + _tmp18_[0] = _tmp16_; + _tmp18_[1] = _tmp17_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp18_; + contains_length1 = 2; + _contains_size_ = contains_length1; + _tmp19_ = g_strdup ("one"); + _tmp20_ = g_strdup ("two"); + _tmp21_ = g_strdup ("three"); + _tmp22_ = g_strdup ("six"); + _tmp23_ = g_new0 (gchar*, 4 + 1); + _tmp23_[0] = _tmp19_; + _tmp23_[1] = _tmp20_; + _tmp23_[2] = _tmp21_; + _tmp23_[3] = _tmp22_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp23_; + not_contains_length1 = 4; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + gchar* _tmp24_; + gchar* _tmp25_; + gchar* _tmp26_; + gchar** _tmp27_ = NULL; + gchar* _tmp28_; + gchar* _tmp29_; + gchar* _tmp30_; + gchar** _tmp31_ = NULL; + _tmp24_ = g_strdup ("two"); + _tmp25_ = g_strdup ("three"); + _tmp26_ = g_strdup ("six"); + _tmp27_ = g_new0 (gchar*, 3 + 1); + _tmp27_[0] = _tmp24_; + _tmp27_[1] = _tmp25_; + _tmp27_[2] = _tmp26_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp27_; + contains_length1 = 3; + _contains_size_ = contains_length1; + _tmp28_ = g_strdup ("one"); + _tmp29_ = g_strdup ("four"); + _tmp30_ = g_strdup ("five"); + _tmp31_ = g_new0 (gchar*, 3 + 1); + _tmp31_[0] = _tmp28_; + _tmp31_[1] = _tmp29_; + _tmp31_[2] = _tmp30_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp31_; + not_contains_length1 = 3; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + gchar* _tmp32_; + gchar* _tmp33_; + gchar* _tmp34_; + gchar** _tmp35_ = NULL; + gchar* _tmp36_; + gchar* _tmp37_; + gchar* _tmp38_; + gchar** _tmp39_ = NULL; + _tmp32_ = g_strdup ("one"); + _tmp33_ = g_strdup ("four"); + _tmp34_ = g_strdup ("six"); + _tmp35_ = g_new0 (gchar*, 3 + 1); + _tmp35_[0] = _tmp32_; + _tmp35_[1] = _tmp33_; + _tmp35_[2] = _tmp34_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp35_; + contains_length1 = 3; + _contains_size_ = contains_length1; + _tmp36_ = g_strdup ("two"); + _tmp37_ = g_strdup ("three"); + _tmp38_ = g_strdup ("five"); + _tmp39_ = g_new0 (gchar*, 3 + 1); + _tmp39_[0] = _tmp36_; + _tmp39_[1] = _tmp37_; + _tmp39_[2] = _tmp38_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp39_; + not_contains_length1 = 3; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + gchar** _tmp40_ = NULL; + gchar* _tmp41_; + gchar* _tmp42_; + gchar* _tmp43_; + gchar* _tmp44_; + gchar* _tmp45_; + gchar* _tmp46_; + gchar** _tmp47_ = NULL; + _tmp40_ = g_new0 (gchar*, 0 + 1); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp40_; + contains_length1 = 0; + _contains_size_ = contains_length1; + _tmp41_ = g_strdup ("one"); + _tmp42_ = g_strdup ("two"); + _tmp43_ = g_strdup ("three"); + _tmp44_ = g_strdup ("four"); + _tmp45_ = g_strdup ("five"); + _tmp46_ = g_strdup ("six"); + _tmp47_ = g_new0 (gchar*, 6 + 1); + _tmp47_[0] = _tmp41_; + _tmp47_[1] = _tmp42_; + _tmp47_[2] = _tmp43_; + _tmp47_[3] = _tmp44_; + _tmp47_[4] = _tmp45_; + _tmp47_[5] = _tmp46_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp47_; + not_contains_length1 = 6; + _not_contains_size_ = not_contains_length1; + break; + } + default: + { + g_assert_not_reached (); + } + } + _tmp48_ = contains; + _tmp48__length1 = contains_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp48_; + s_collection_length1 = _tmp48__length1; + for (s_it = 0; s_it < _tmp48__length1; s_it = s_it + 1) { + gchar* _tmp49_; + gchar* s = NULL; + _tmp49_ = g_strdup (s_collection[s_it]); + s = _tmp49_; + { + GeeSortedSet* _tmp50_; + const gchar* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeSortedSet* _tmp53_; + const gchar* _tmp54_; + gboolean _tmp55_ = FALSE; + _tmp50_ = self->priv->subset; + _tmp51_ = s; + _tmp52_ = gee_collection_remove ((GeeCollection*) _tmp50_, _tmp51_); + _vala_assert (_tmp52_, "subset.remove (s)"); + _tmp53_ = self->priv->master; + _tmp54_ = s; + _tmp55_ = gee_collection_contains ((GeeCollection*) _tmp53_, _tmp54_); + _vala_assert (!_tmp55_, "!master.contains (s)"); + _g_free0 (s); + } + } + } + _tmp56_ = not_contains; + _tmp56__length1 = not_contains_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp56_; + s_collection_length1 = _tmp56__length1; + for (s_it = 0; s_it < _tmp56__length1; s_it = s_it + 1) { + gchar* _tmp57_; + gchar* s = NULL; + _tmp57_ = g_strdup (s_collection[s_it]); + s = _tmp57_; + { + GeeSortedSet* _tmp58_; + const gchar* _tmp59_; + gboolean _tmp60_ = FALSE; + GeeSortedSet* _tmp61_; + const gchar* _tmp62_; + gboolean _tmp63_ = FALSE; + _tmp58_ = self->priv->subset; + _tmp59_ = s; + _tmp60_ = gee_collection_remove ((GeeCollection*) _tmp58_, _tmp59_); + _vala_assert (!_tmp60_, "!subset.remove (s)"); + _tmp61_ = self->priv->master; + _tmp62_ = s; + _tmp63_ = gee_collection_contains ((GeeCollection*) _tmp61_, _tmp62_); + _vala_assert (_tmp63_, "master.contains (s)"); + _g_free0 (s); + } + } + } + _tmp64_ = self->priv->master; + _tmp65_ = gee_collection_get_size ((GeeCollection*) _tmp64_); + _tmp66_ = _tmp65_; + _tmp67_ = contains; + _tmp67__length1 = contains_length1; + _vala_assert (_tmp66_ == (6 - _tmp67__length1), "master.size == 6 - contains.length"); + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); +} + + +void sorted_set_tests_sub_set_test_iterator (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + gchar** contains = NULL; + gint contains_length1 = 0; + gint _contains_size_ = 0; + SortedSetTestsSubSetType _tmp15_; + guint i; + guint _tmp38_; + gchar** _tmp39_; + gint _tmp39__length1; + GeeSortedSet* _tmp40_; + GeeBidirIterator* _tmp41_ = NULL; + GeeBidirIterator* iter; + SortedSetTestsSubSetType _tmp42_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + gchar* _tmp16_; + gchar* _tmp17_; + gchar** _tmp18_ = NULL; + _tmp16_ = g_strdup ("five"); + _tmp17_ = g_strdup ("four"); + _tmp18_ = g_new0 (gchar*, 2 + 1); + _tmp18_[0] = _tmp16_; + _tmp18_[1] = _tmp17_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp18_; + contains_length1 = 2; + _contains_size_ = contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + gchar* _tmp19_; + gchar* _tmp20_; + gchar* _tmp21_; + gchar** _tmp22_ = NULL; + _tmp19_ = g_strdup ("six"); + _tmp20_ = g_strdup ("three"); + _tmp21_ = g_strdup ("two"); + _tmp22_ = g_new0 (gchar*, 3 + 1); + _tmp22_[0] = _tmp19_; + _tmp22_[1] = _tmp20_; + _tmp22_[2] = _tmp21_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp22_; + contains_length1 = 3; + _contains_size_ = contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + gchar* _tmp23_; + gchar* _tmp24_; + gchar* _tmp25_; + gchar** _tmp26_ = NULL; + _tmp23_ = g_strdup ("four"); + _tmp24_ = g_strdup ("one"); + _tmp25_ = g_strdup ("six"); + _tmp26_ = g_new0 (gchar*, 3 + 1); + _tmp26_[0] = _tmp23_; + _tmp26_[1] = _tmp24_; + _tmp26_[2] = _tmp25_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp26_; + contains_length1 = 3; + _contains_size_ = contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + gchar** _tmp27_ = NULL; + _tmp27_ = g_new0 (gchar*, 0 + 1); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp27_; + contains_length1 = 0; + _contains_size_ = contains_length1; + break; + } + default: + { + g_assert_not_reached (); + } + } + i = (guint) 0; + { + GeeSortedSet* _tmp28_; + GeeIterator* _tmp29_ = NULL; + GeeIterator* _e_it; + _tmp28_ = self->priv->subset; + _tmp29_ = gee_iterable_iterator ((GeeIterable*) _tmp28_); + _e_it = _tmp29_; + while (TRUE) { + GeeIterator* _tmp30_; + gboolean _tmp31_ = FALSE; + GeeIterator* _tmp32_; + gpointer _tmp33_ = NULL; + gchar* e; + const gchar* _tmp34_; + gchar** _tmp35_; + gint _tmp35__length1; + guint _tmp36_; + const gchar* _tmp37_; + _tmp30_ = _e_it; + _tmp31_ = gee_iterator_next (_tmp30_); + if (!_tmp31_) { + break; + } + _tmp32_ = _e_it; + _tmp33_ = gee_iterator_get (_tmp32_); + e = (gchar*) _tmp33_; + _tmp34_ = e; + _tmp35_ = contains; + _tmp35__length1 = contains_length1; + _tmp36_ = i; + i = _tmp36_ + 1; + _tmp37_ = _tmp35_[_tmp36_]; + _vala_assert (g_strcmp0 (_tmp34_, _tmp37_) == 0, "e == contains[i++]"); + _g_free0 (e); + } + _g_object_unref0 (_e_it); + } + _tmp38_ = i; + _tmp39_ = contains; + _tmp39__length1 = contains_length1; + _vala_assert (_tmp38_ == ((guint) _tmp39__length1), "i == contains.length"); + _tmp40_ = self->priv->subset; + _tmp41_ = gee_sorted_set_bidir_iterator (_tmp40_); + iter = _tmp41_; + _tmp42_ = self->priv->type; + if (_tmp42_ != SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY) { + GeeBidirIterator* _tmp43_; + gboolean _tmp44_ = FALSE; + GeeBidirIterator* _tmp45_; + gpointer _tmp46_ = NULL; + gchar* _tmp47_; + gchar** _tmp48_; + gint _tmp48__length1; + gchar** _tmp49_; + gint _tmp49__length1; + const gchar* _tmp50_; + GeeBidirIterator* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeBidirIterator* _tmp53_; + gpointer _tmp54_ = NULL; + gchar* _tmp55_; + gchar** _tmp56_; + gint _tmp56__length1; + const gchar* _tmp57_; + GeeBidirIterator* _tmp58_; + gboolean _tmp59_ = FALSE; + GeeBidirIterator* _tmp60_; + gboolean _tmp61_ = FALSE; + GeeBidirIterator* _tmp62_; + gpointer _tmp63_ = NULL; + gchar* _tmp64_; + gchar** _tmp65_; + gint _tmp65__length1; + const gchar* _tmp66_; + GeeBidirIterator* _tmp67_; + gboolean _tmp68_ = FALSE; + GeeBidirIterator* _tmp69_; + GeeBidirIterator* _tmp70_; + gboolean _tmp71_ = FALSE; + SortedSetTestsSubSetType _tmp72_; + GeeBidirIterator* _tmp77_; + gboolean _tmp78_ = FALSE; + GeeBidirIterator* _tmp79_; + gpointer _tmp80_ = NULL; + gchar* _tmp81_; + gchar** _tmp82_; + gint _tmp82__length1; + const gchar* _tmp83_; + _tmp43_ = iter; + _tmp44_ = gee_bidir_iterator_last (_tmp43_); + _vala_assert (_tmp44_, "iter.last ()"); + _tmp45_ = iter; + _tmp46_ = gee_iterator_get ((GeeIterator*) _tmp45_); + _tmp47_ = (gchar*) _tmp46_; + _tmp48_ = contains; + _tmp48__length1 = contains_length1; + _tmp49_ = contains; + _tmp49__length1 = contains_length1; + _tmp50_ = _tmp48_[_tmp49__length1 - 1]; + _vala_assert (g_strcmp0 (_tmp47_, _tmp50_) == 0, "iter.get () == contains[contains.length - 1]"); + _g_free0 (_tmp47_); + _tmp51_ = iter; + _tmp52_ = gee_iterator_first ((GeeIterator*) _tmp51_); + _vala_assert (_tmp52_, "iter.first ()"); + _tmp53_ = iter; + _tmp54_ = gee_iterator_get ((GeeIterator*) _tmp53_); + _tmp55_ = (gchar*) _tmp54_; + _tmp56_ = contains; + _tmp56__length1 = contains_length1; + _tmp57_ = _tmp56_[0]; + _vala_assert (g_strcmp0 (_tmp55_, _tmp57_) == 0, "iter.get () == contains[0]"); + _g_free0 (_tmp55_); + _tmp58_ = iter; + _tmp59_ = gee_iterator_has_next ((GeeIterator*) _tmp58_); + _vala_assert (_tmp59_, "iter.has_next ()"); + _tmp60_ = iter; + _tmp61_ = gee_iterator_next ((GeeIterator*) _tmp60_); + _vala_assert (_tmp61_, "iter.next ()"); + _tmp62_ = iter; + _tmp63_ = gee_iterator_get ((GeeIterator*) _tmp62_); + _tmp64_ = (gchar*) _tmp63_; + _tmp65_ = contains; + _tmp65__length1 = contains_length1; + _tmp66_ = _tmp65_[1]; + _vala_assert (g_strcmp0 (_tmp64_, _tmp66_) == 0, "iter.get () == contains[1]"); + _g_free0 (_tmp64_); + _tmp67_ = iter; + _tmp68_ = gee_bidir_iterator_has_previous (_tmp67_); + _vala_assert (_tmp68_, "iter.has_previous ()"); + _tmp69_ = iter; + gee_iterator_remove ((GeeIterator*) _tmp69_); + _tmp70_ = iter; + _tmp71_ = gee_bidir_iterator_has_previous (_tmp70_); + _vala_assert (_tmp71_, "iter.has_previous ()"); + _tmp72_ = self->priv->type; + if (_tmp72_ != SORTED_SET_TESTS_SUB_SET_TYPE_HEAD) { + GeeBidirIterator* _tmp73_; + gboolean _tmp74_ = FALSE; + _tmp73_ = iter; + _tmp74_ = gee_iterator_has_next ((GeeIterator*) _tmp73_); + _vala_assert (_tmp74_, "iter.has_next ()"); + } else { + GeeBidirIterator* _tmp75_; + gboolean _tmp76_ = FALSE; + _tmp75_ = iter; + _tmp76_ = gee_iterator_has_next ((GeeIterator*) _tmp75_); + _vala_assert (!_tmp76_, "!iter.has_next ()"); + } + _tmp77_ = iter; + _tmp78_ = gee_bidir_iterator_previous (_tmp77_); + _vala_assert (_tmp78_, "iter.previous ()"); + _tmp79_ = iter; + _tmp80_ = gee_iterator_get ((GeeIterator*) _tmp79_); + _tmp81_ = (gchar*) _tmp80_; + _tmp82_ = contains; + _tmp82__length1 = contains_length1; + _tmp83_ = _tmp82_[0]; + _vala_assert (g_strcmp0 (_tmp81_, _tmp83_) == 0, "iter.get () == contains[0]"); + _g_free0 (_tmp81_); + } else { + GeeBidirIterator* _tmp84_; + gboolean _tmp85_ = FALSE; + gboolean _tmp86_ = FALSE; + _tmp84_ = iter; + _tmp85_ = gee_iterator_first ((GeeIterator*) _tmp84_); + _vala_assert (!_tmp85_, "!iter.first ()"); + _tmp86_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp86_) { + GeeBidirIterator* _tmp87_; + _tmp87_ = iter; + gee_iterator_remove ((GeeIterator*) _tmp87_); + exit (0); + } + g_test_trap_assert_failed (); + } + _g_object_unref0 (iter); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); +} + + +void sorted_set_tests_sub_set_test_clear (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + gchar** contains = NULL; + gint contains_length1 = 0; + gint _contains_size_ = 0; + gchar** not_contains = NULL; + gint not_contains_length1 = 0; + gint _not_contains_size_ = 0; + SortedSetTestsSubSetType _tmp15_; + GeeSortedSet* _tmp48_; + gchar** _tmp49_; + gint _tmp49__length1; + gchar** _tmp54_; + gint _tmp54__length1; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + gchar* _tmp16_; + gchar* _tmp17_; + gchar** _tmp18_ = NULL; + gchar* _tmp19_; + gchar* _tmp20_; + gchar* _tmp21_; + gchar* _tmp22_; + gchar** _tmp23_ = NULL; + _tmp16_ = g_strdup ("four"); + _tmp17_ = g_strdup ("five"); + _tmp18_ = g_new0 (gchar*, 2 + 1); + _tmp18_[0] = _tmp16_; + _tmp18_[1] = _tmp17_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp18_; + contains_length1 = 2; + _contains_size_ = contains_length1; + _tmp19_ = g_strdup ("one"); + _tmp20_ = g_strdup ("two"); + _tmp21_ = g_strdup ("three"); + _tmp22_ = g_strdup ("six"); + _tmp23_ = g_new0 (gchar*, 4 + 1); + _tmp23_[0] = _tmp19_; + _tmp23_[1] = _tmp20_; + _tmp23_[2] = _tmp21_; + _tmp23_[3] = _tmp22_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp23_; + not_contains_length1 = 4; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + gchar* _tmp24_; + gchar* _tmp25_; + gchar* _tmp26_; + gchar** _tmp27_ = NULL; + gchar* _tmp28_; + gchar* _tmp29_; + gchar* _tmp30_; + gchar** _tmp31_ = NULL; + _tmp24_ = g_strdup ("two"); + _tmp25_ = g_strdup ("three"); + _tmp26_ = g_strdup ("six"); + _tmp27_ = g_new0 (gchar*, 3 + 1); + _tmp27_[0] = _tmp24_; + _tmp27_[1] = _tmp25_; + _tmp27_[2] = _tmp26_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp27_; + contains_length1 = 3; + _contains_size_ = contains_length1; + _tmp28_ = g_strdup ("one"); + _tmp29_ = g_strdup ("four"); + _tmp30_ = g_strdup ("five"); + _tmp31_ = g_new0 (gchar*, 3 + 1); + _tmp31_[0] = _tmp28_; + _tmp31_[1] = _tmp29_; + _tmp31_[2] = _tmp30_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp31_; + not_contains_length1 = 3; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + gchar* _tmp32_; + gchar* _tmp33_; + gchar* _tmp34_; + gchar** _tmp35_ = NULL; + gchar* _tmp36_; + gchar* _tmp37_; + gchar* _tmp38_; + gchar** _tmp39_ = NULL; + _tmp32_ = g_strdup ("one"); + _tmp33_ = g_strdup ("four"); + _tmp34_ = g_strdup ("six"); + _tmp35_ = g_new0 (gchar*, 3 + 1); + _tmp35_[0] = _tmp32_; + _tmp35_[1] = _tmp33_; + _tmp35_[2] = _tmp34_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp35_; + contains_length1 = 3; + _contains_size_ = contains_length1; + _tmp36_ = g_strdup ("two"); + _tmp37_ = g_strdup ("three"); + _tmp38_ = g_strdup ("five"); + _tmp39_ = g_new0 (gchar*, 3 + 1); + _tmp39_[0] = _tmp36_; + _tmp39_[1] = _tmp37_; + _tmp39_[2] = _tmp38_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp39_; + not_contains_length1 = 3; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + gchar** _tmp40_ = NULL; + gchar* _tmp41_; + gchar* _tmp42_; + gchar* _tmp43_; + gchar* _tmp44_; + gchar* _tmp45_; + gchar* _tmp46_; + gchar** _tmp47_ = NULL; + _tmp40_ = g_new0 (gchar*, 0 + 1); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp40_; + contains_length1 = 0; + _contains_size_ = contains_length1; + _tmp41_ = g_strdup ("one"); + _tmp42_ = g_strdup ("two"); + _tmp43_ = g_strdup ("three"); + _tmp44_ = g_strdup ("four"); + _tmp45_ = g_strdup ("five"); + _tmp46_ = g_strdup ("six"); + _tmp47_ = g_new0 (gchar*, 6 + 1); + _tmp47_[0] = _tmp41_; + _tmp47_[1] = _tmp42_; + _tmp47_[2] = _tmp43_; + _tmp47_[3] = _tmp44_; + _tmp47_[4] = _tmp45_; + _tmp47_[5] = _tmp46_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp47_; + not_contains_length1 = 6; + _not_contains_size_ = not_contains_length1; + break; + } + default: + { + g_assert_not_reached (); + } + } + _tmp48_ = self->priv->subset; + gee_collection_clear ((GeeCollection*) _tmp48_); + _tmp49_ = contains; + _tmp49__length1 = contains_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp49_; + s_collection_length1 = _tmp49__length1; + for (s_it = 0; s_it < _tmp49__length1; s_it = s_it + 1) { + gchar* _tmp50_; + gchar* s = NULL; + _tmp50_ = g_strdup (s_collection[s_it]); + s = _tmp50_; + { + GeeSortedSet* _tmp51_; + const gchar* _tmp52_; + gboolean _tmp53_ = FALSE; + _tmp51_ = self->priv->master; + _tmp52_ = s; + _tmp53_ = gee_collection_contains ((GeeCollection*) _tmp51_, _tmp52_); + _vala_assert (!_tmp53_, "!master.contains (s)"); + _g_free0 (s); + } + } + } + _tmp54_ = not_contains; + _tmp54__length1 = not_contains_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp54_; + s_collection_length1 = _tmp54__length1; + for (s_it = 0; s_it < _tmp54__length1; s_it = s_it + 1) { + gchar* _tmp55_; + gchar* s = NULL; + _tmp55_ = g_strdup (s_collection[s_it]); + s = _tmp55_; + { + GeeSortedSet* _tmp56_; + const gchar* _tmp57_; + gboolean _tmp58_ = FALSE; + _tmp56_ = self->priv->master; + _tmp57_ = s; + _tmp58_ = gee_collection_contains ((GeeCollection*) _tmp56_, _tmp57_); + _vala_assert (_tmp58_, "master.contains (s)"); + _g_free0 (s); + } + } + } + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); +} + + +void sorted_set_tests_sub_set_test_boundaries (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + SortedSetTestsSubSetType _tmp15_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + GeeSortedSet* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + GeeSortedSet* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + _tmp16_ = self->priv->subset; + _tmp17_ = gee_sorted_set_first (_tmp16_); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "five") == 0, "subset.first () == \"five\""); + _g_free0 (_tmp18_); + _tmp19_ = self->priv->subset; + _tmp20_ = gee_sorted_set_last (_tmp19_); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "four") == 0, "subset.last () == \"four\""); + _g_free0 (_tmp21_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + GeeSortedSet* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + GeeSortedSet* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + _tmp22_ = self->priv->subset; + _tmp23_ = gee_sorted_set_first (_tmp22_); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "six") == 0, "subset.first () == \"six\""); + _g_free0 (_tmp24_); + _tmp25_ = self->priv->subset; + _tmp26_ = gee_sorted_set_last (_tmp25_); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "two") == 0, "subset.last () == \"two\""); + _g_free0 (_tmp27_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + GeeSortedSet* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + GeeSortedSet* _tmp31_; + gpointer _tmp32_ = NULL; + gchar* _tmp33_; + _tmp28_ = self->priv->subset; + _tmp29_ = gee_sorted_set_first (_tmp28_); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "four") == 0, "subset.first () == \"four\""); + _g_free0 (_tmp30_); + _tmp31_ = self->priv->subset; + _tmp32_ = gee_sorted_set_last (_tmp31_); + _tmp33_ = (gchar*) _tmp32_; + _vala_assert (g_strcmp0 (_tmp33_, "six") == 0, "subset.last () == \"six\""); + _g_free0 (_tmp33_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + gboolean _tmp34_ = FALSE; + gboolean _tmp38_ = FALSE; + _tmp34_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp34_) { + GeeSortedSet* _tmp35_; + gpointer _tmp36_ = NULL; + gchar* _tmp37_; + _tmp35_ = self->priv->subset; + _tmp36_ = gee_sorted_set_first (_tmp35_); + _tmp37_ = (gchar*) _tmp36_; + _g_free0 (_tmp37_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp38_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp38_) { + GeeSortedSet* _tmp39_; + gpointer _tmp40_ = NULL; + gchar* _tmp41_; + _tmp39_ = self->priv->subset; + _tmp40_ = gee_sorted_set_last (_tmp39_); + _tmp41_ = (gchar*) _tmp40_; + _g_free0 (_tmp41_); + exit (0); + } + g_test_trap_assert_failed (); + break; + } + default: + { + g_assert_not_reached (); + } + } +} + + +void sorted_set_tests_sub_set_test_iterator_at (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + gchar** contains = NULL; + gint contains_length1 = 0; + gint _contains_size_ = 0; + gchar** not_contains = NULL; + gint not_contains_length1 = 0; + gint _not_contains_size_ = 0; + SortedSetTestsSubSetType _tmp15_; + gchar** _tmp48_; + gint _tmp48__length1; + gchar** _tmp58_; + gint _tmp58__length1; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + gchar* _tmp16_; + gchar* _tmp17_; + gchar** _tmp18_ = NULL; + gchar* _tmp19_; + gchar* _tmp20_; + gchar* _tmp21_; + gchar* _tmp22_; + gchar** _tmp23_ = NULL; + _tmp16_ = g_strdup ("four"); + _tmp17_ = g_strdup ("five"); + _tmp18_ = g_new0 (gchar*, 2 + 1); + _tmp18_[0] = _tmp16_; + _tmp18_[1] = _tmp17_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp18_; + contains_length1 = 2; + _contains_size_ = contains_length1; + _tmp19_ = g_strdup ("one"); + _tmp20_ = g_strdup ("two"); + _tmp21_ = g_strdup ("three"); + _tmp22_ = g_strdup ("six"); + _tmp23_ = g_new0 (gchar*, 4 + 1); + _tmp23_[0] = _tmp19_; + _tmp23_[1] = _tmp20_; + _tmp23_[2] = _tmp21_; + _tmp23_[3] = _tmp22_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp23_; + not_contains_length1 = 4; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + gchar* _tmp24_; + gchar* _tmp25_; + gchar* _tmp26_; + gchar** _tmp27_ = NULL; + gchar* _tmp28_; + gchar* _tmp29_; + gchar* _tmp30_; + gchar** _tmp31_ = NULL; + _tmp24_ = g_strdup ("two"); + _tmp25_ = g_strdup ("three"); + _tmp26_ = g_strdup ("six"); + _tmp27_ = g_new0 (gchar*, 3 + 1); + _tmp27_[0] = _tmp24_; + _tmp27_[1] = _tmp25_; + _tmp27_[2] = _tmp26_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp27_; + contains_length1 = 3; + _contains_size_ = contains_length1; + _tmp28_ = g_strdup ("one"); + _tmp29_ = g_strdup ("four"); + _tmp30_ = g_strdup ("five"); + _tmp31_ = g_new0 (gchar*, 3 + 1); + _tmp31_[0] = _tmp28_; + _tmp31_[1] = _tmp29_; + _tmp31_[2] = _tmp30_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp31_; + not_contains_length1 = 3; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + gchar* _tmp32_; + gchar* _tmp33_; + gchar* _tmp34_; + gchar** _tmp35_ = NULL; + gchar* _tmp36_; + gchar* _tmp37_; + gchar* _tmp38_; + gchar** _tmp39_ = NULL; + _tmp32_ = g_strdup ("one"); + _tmp33_ = g_strdup ("four"); + _tmp34_ = g_strdup ("six"); + _tmp35_ = g_new0 (gchar*, 3 + 1); + _tmp35_[0] = _tmp32_; + _tmp35_[1] = _tmp33_; + _tmp35_[2] = _tmp34_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp35_; + contains_length1 = 3; + _contains_size_ = contains_length1; + _tmp36_ = g_strdup ("two"); + _tmp37_ = g_strdup ("three"); + _tmp38_ = g_strdup ("five"); + _tmp39_ = g_new0 (gchar*, 3 + 1); + _tmp39_[0] = _tmp36_; + _tmp39_[1] = _tmp37_; + _tmp39_[2] = _tmp38_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp39_; + not_contains_length1 = 3; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + gchar** _tmp40_ = NULL; + gchar* _tmp41_; + gchar* _tmp42_; + gchar* _tmp43_; + gchar* _tmp44_; + gchar* _tmp45_; + gchar* _tmp46_; + gchar** _tmp47_ = NULL; + _tmp40_ = g_new0 (gchar*, 0 + 1); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp40_; + contains_length1 = 0; + _contains_size_ = contains_length1; + _tmp41_ = g_strdup ("one"); + _tmp42_ = g_strdup ("two"); + _tmp43_ = g_strdup ("three"); + _tmp44_ = g_strdup ("four"); + _tmp45_ = g_strdup ("five"); + _tmp46_ = g_strdup ("six"); + _tmp47_ = g_new0 (gchar*, 6 + 1); + _tmp47_[0] = _tmp41_; + _tmp47_[1] = _tmp42_; + _tmp47_[2] = _tmp43_; + _tmp47_[3] = _tmp44_; + _tmp47_[4] = _tmp45_; + _tmp47_[5] = _tmp46_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp47_; + not_contains_length1 = 6; + _not_contains_size_ = not_contains_length1; + break; + } + default: + { + g_assert_not_reached (); + } + } + _tmp48_ = contains; + _tmp48__length1 = contains_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp48_; + s_collection_length1 = _tmp48__length1; + for (s_it = 0; s_it < _tmp48__length1; s_it = s_it + 1) { + gchar* _tmp49_; + gchar* s = NULL; + _tmp49_ = g_strdup (s_collection[s_it]); + s = _tmp49_; + { + GeeSortedSet* _tmp50_; + const gchar* _tmp51_; + GeeBidirIterator* _tmp52_ = NULL; + GeeBidirIterator* iter; + GeeBidirIterator* _tmp53_; + GeeBidirIterator* _tmp54_; + gpointer _tmp55_ = NULL; + gchar* _tmp56_; + const gchar* _tmp57_; + _tmp50_ = self->priv->subset; + _tmp51_ = s; + _tmp52_ = gee_sorted_set_iterator_at (_tmp50_, _tmp51_); + iter = _tmp52_; + _tmp53_ = iter; + _vala_assert (_tmp53_ != NULL, "iter != null"); + _tmp54_ = iter; + _tmp55_ = gee_iterator_get ((GeeIterator*) _tmp54_); + _tmp56_ = (gchar*) _tmp55_; + _tmp57_ = s; + _vala_assert (g_strcmp0 (_tmp56_, _tmp57_) == 0, "iter.get () == s"); + _g_free0 (_tmp56_); + _g_object_unref0 (iter); + _g_free0 (s); + } + } + } + _tmp58_ = not_contains; + _tmp58__length1 = not_contains_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp58_; + s_collection_length1 = _tmp58__length1; + for (s_it = 0; s_it < _tmp58__length1; s_it = s_it + 1) { + gchar* _tmp59_; + gchar* s = NULL; + _tmp59_ = g_strdup (s_collection[s_it]); + s = _tmp59_; + { + GeeSortedSet* _tmp60_; + const gchar* _tmp61_; + GeeBidirIterator* _tmp62_ = NULL; + GeeBidirIterator* iter; + GeeBidirIterator* _tmp63_; + _tmp60_ = self->priv->subset; + _tmp61_ = s; + _tmp62_ = gee_sorted_set_iterator_at (_tmp60_, _tmp61_); + iter = _tmp62_; + _tmp63_ = iter; + _vala_assert (_tmp63_ == NULL, "iter == null"); + _g_object_unref0 (iter); + _g_free0 (s); + } + } + } + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); +} + + +void sorted_set_tests_sub_set_test_lower (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + SortedSetTestsSubSetType _tmp15_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + GeeSortedSet* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + GeeSortedSet* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + GeeSortedSet* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + GeeSortedSet* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + _tmp16_ = self->priv->subset; + _tmp17_ = gee_sorted_set_lower (_tmp16_, "a"); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (_tmp18_ == NULL, "subset.lower (\"a\") == null"); + _g_free0 (_tmp18_); + _tmp19_ = self->priv->subset; + _tmp20_ = gee_sorted_set_lower (_tmp19_, "five"); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (_tmp21_ == NULL, "subset.lower (\"five\") == null"); + _g_free0 (_tmp21_); + _tmp22_ = self->priv->subset; + _tmp23_ = gee_sorted_set_lower (_tmp22_, "four"); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "five") == 0, "subset.lower (\"four\") == \"five\""); + _g_free0 (_tmp24_); + _tmp25_ = self->priv->subset; + _tmp26_ = gee_sorted_set_lower (_tmp25_, "six"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "four") == 0, "subset.lower (\"six\") == \"four\""); + _g_free0 (_tmp27_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + GeeSortedSet* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + GeeSortedSet* _tmp31_; + gpointer _tmp32_ = NULL; + gchar* _tmp33_; + GeeSortedSet* _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + GeeSortedSet* _tmp37_; + gpointer _tmp38_ = NULL; + gchar* _tmp39_; + GeeSortedSet* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + _tmp28_ = self->priv->subset; + _tmp29_ = gee_sorted_set_lower (_tmp28_, "one"); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (_tmp30_ == NULL, "subset.lower (\"one\") == null"); + _g_free0 (_tmp30_); + _tmp31_ = self->priv->subset; + _tmp32_ = gee_sorted_set_lower (_tmp31_, "six"); + _tmp33_ = (gchar*) _tmp32_; + _vala_assert (_tmp33_ == NULL, "subset.lower (\"six\") == null"); + _g_free0 (_tmp33_); + _tmp34_ = self->priv->subset; + _tmp35_ = gee_sorted_set_lower (_tmp34_, "three"); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "six") == 0, "subset.lower (\"three\") == \"six\""); + _g_free0 (_tmp36_); + _tmp37_ = self->priv->subset; + _tmp38_ = gee_sorted_set_lower (_tmp37_, "two"); + _tmp39_ = (gchar*) _tmp38_; + _vala_assert (g_strcmp0 (_tmp39_, "three") == 0, "subset.lower (\"two\") == \"three\""); + _g_free0 (_tmp39_); + _tmp40_ = self->priv->subset; + _tmp41_ = gee_sorted_set_lower (_tmp40_, "z"); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (g_strcmp0 (_tmp42_, "two") == 0, "subset.lower (\"z\") == \"two\""); + _g_free0 (_tmp42_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + GeeSortedSet* _tmp43_; + gpointer _tmp44_ = NULL; + gchar* _tmp45_; + GeeSortedSet* _tmp46_; + gpointer _tmp47_ = NULL; + gchar* _tmp48_; + GeeSortedSet* _tmp49_; + gpointer _tmp50_ = NULL; + gchar* _tmp51_; + GeeSortedSet* _tmp52_; + gpointer _tmp53_ = NULL; + gchar* _tmp54_; + GeeSortedSet* _tmp55_; + gpointer _tmp56_ = NULL; + gchar* _tmp57_; + _tmp43_ = self->priv->subset; + _tmp44_ = gee_sorted_set_lower (_tmp43_, "five"); + _tmp45_ = (gchar*) _tmp44_; + _vala_assert (_tmp45_ == NULL, "subset.lower (\"five\") == null"); + _g_free0 (_tmp45_); + _tmp46_ = self->priv->subset; + _tmp47_ = gee_sorted_set_lower (_tmp46_, "four"); + _tmp48_ = (gchar*) _tmp47_; + _vala_assert (_tmp48_ == NULL, "subset.lower (\"four\") == null"); + _g_free0 (_tmp48_); + _tmp49_ = self->priv->subset; + _tmp50_ = gee_sorted_set_lower (_tmp49_, "one"); + _tmp51_ = (gchar*) _tmp50_; + _vala_assert (g_strcmp0 (_tmp51_, "four") == 0, "subset.lower (\"one\") == \"four\""); + _g_free0 (_tmp51_); + _tmp52_ = self->priv->subset; + _tmp53_ = gee_sorted_set_lower (_tmp52_, "six"); + _tmp54_ = (gchar*) _tmp53_; + _vala_assert (g_strcmp0 (_tmp54_, "one") == 0, "subset.lower (\"six\") == \"one\""); + _g_free0 (_tmp54_); + _tmp55_ = self->priv->subset; + _tmp56_ = gee_sorted_set_lower (_tmp55_, "three"); + _tmp57_ = (gchar*) _tmp56_; + _vala_assert (g_strcmp0 (_tmp57_, "six") == 0, "subset.lower (\"three\") == \"six\""); + _g_free0 (_tmp57_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + GeeSortedSet* _tmp58_; + gpointer _tmp59_ = NULL; + gchar* _tmp60_; + _tmp58_ = self->priv->subset; + _tmp59_ = gee_sorted_set_lower (_tmp58_, "six"); + _tmp60_ = (gchar*) _tmp59_; + _vala_assert (_tmp60_ == NULL, "subset.lower (\"six\") == null"); + _g_free0 (_tmp60_); + break; + } + default: + { + g_assert_not_reached (); + } + } +} + + +void sorted_set_tests_sub_set_test_higher (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + SortedSetTestsSubSetType _tmp15_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + GeeSortedSet* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + GeeSortedSet* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + GeeSortedSet* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + GeeSortedSet* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + _tmp16_ = self->priv->subset; + _tmp17_ = gee_sorted_set_higher (_tmp16_, "a"); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "five") == 0, "subset.higher (\"a\") == \"five\""); + _g_free0 (_tmp18_); + _tmp19_ = self->priv->subset; + _tmp20_ = gee_sorted_set_higher (_tmp19_, "five"); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "four") == 0, "subset.higher (\"five\") == \"four\""); + _g_free0 (_tmp21_); + _tmp22_ = self->priv->subset; + _tmp23_ = gee_sorted_set_higher (_tmp22_, "four"); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (_tmp24_ == NULL, "subset.higher (\"four\") == null"); + _g_free0 (_tmp24_); + _tmp25_ = self->priv->subset; + _tmp26_ = gee_sorted_set_higher (_tmp25_, "six"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (_tmp27_ == NULL, "subset.higher (\"six\") == null"); + _g_free0 (_tmp27_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + GeeSortedSet* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + GeeSortedSet* _tmp31_; + gpointer _tmp32_ = NULL; + gchar* _tmp33_; + GeeSortedSet* _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + GeeSortedSet* _tmp37_; + gpointer _tmp38_ = NULL; + gchar* _tmp39_; + GeeSortedSet* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + _tmp28_ = self->priv->subset; + _tmp29_ = gee_sorted_set_higher (_tmp28_, "one"); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "six") == 0, "subset.higher (\"one\") == \"six\""); + _g_free0 (_tmp30_); + _tmp31_ = self->priv->subset; + _tmp32_ = gee_sorted_set_higher (_tmp31_, "six"); + _tmp33_ = (gchar*) _tmp32_; + _vala_assert (g_strcmp0 (_tmp33_, "three") == 0, "subset.higher (\"six\") == \"three\""); + _g_free0 (_tmp33_); + _tmp34_ = self->priv->subset; + _tmp35_ = gee_sorted_set_higher (_tmp34_, "three"); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "two") == 0, "subset.higher (\"three\") == \"two\""); + _g_free0 (_tmp36_); + _tmp37_ = self->priv->subset; + _tmp38_ = gee_sorted_set_higher (_tmp37_, "two"); + _tmp39_ = (gchar*) _tmp38_; + _vala_assert (_tmp39_ == NULL, "subset.higher (\"two\") == null"); + _g_free0 (_tmp39_); + _tmp40_ = self->priv->subset; + _tmp41_ = gee_sorted_set_higher (_tmp40_, "z"); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (_tmp42_ == NULL, "subset.higher (\"z\") == null"); + _g_free0 (_tmp42_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + GeeSortedSet* _tmp43_; + gpointer _tmp44_ = NULL; + gchar* _tmp45_; + GeeSortedSet* _tmp46_; + gpointer _tmp47_ = NULL; + gchar* _tmp48_; + GeeSortedSet* _tmp49_; + gpointer _tmp50_ = NULL; + gchar* _tmp51_; + GeeSortedSet* _tmp52_; + gpointer _tmp53_ = NULL; + gchar* _tmp54_; + GeeSortedSet* _tmp55_; + gpointer _tmp56_ = NULL; + gchar* _tmp57_; + _tmp43_ = self->priv->subset; + _tmp44_ = gee_sorted_set_higher (_tmp43_, "five"); + _tmp45_ = (gchar*) _tmp44_; + _vala_assert (g_strcmp0 (_tmp45_, "four") == 0, "subset.higher (\"five\") == \"four\""); + _g_free0 (_tmp45_); + _tmp46_ = self->priv->subset; + _tmp47_ = gee_sorted_set_higher (_tmp46_, "four"); + _tmp48_ = (gchar*) _tmp47_; + _vala_assert (g_strcmp0 (_tmp48_, "one") == 0, "subset.higher (\"four\") == \"one\""); + _g_free0 (_tmp48_); + _tmp49_ = self->priv->subset; + _tmp50_ = gee_sorted_set_higher (_tmp49_, "one"); + _tmp51_ = (gchar*) _tmp50_; + _vala_assert (g_strcmp0 (_tmp51_, "six") == 0, "subset.higher (\"one\") == \"six\""); + _g_free0 (_tmp51_); + _tmp52_ = self->priv->subset; + _tmp53_ = gee_sorted_set_higher (_tmp52_, "six"); + _tmp54_ = (gchar*) _tmp53_; + _vala_assert (_tmp54_ == NULL, "subset.higher (\"six\") == null"); + _g_free0 (_tmp54_); + _tmp55_ = self->priv->subset; + _tmp56_ = gee_sorted_set_higher (_tmp55_, "three"); + _tmp57_ = (gchar*) _tmp56_; + _vala_assert (_tmp57_ == NULL, "subset.higher (\"three\") == null"); + _g_free0 (_tmp57_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + GeeSortedSet* _tmp58_; + gpointer _tmp59_ = NULL; + gchar* _tmp60_; + _tmp58_ = self->priv->subset; + _tmp59_ = gee_sorted_set_higher (_tmp58_, "six"); + _tmp60_ = (gchar*) _tmp59_; + _vala_assert (_tmp60_ == NULL, "subset.higher (\"six\") == null"); + _g_free0 (_tmp60_); + break; + } + default: + { + g_assert_not_reached (); + } + } +} + + +void sorted_set_tests_sub_set_test_floor (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + SortedSetTestsSubSetType _tmp15_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + GeeSortedSet* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + GeeSortedSet* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + GeeSortedSet* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + GeeSortedSet* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + _tmp16_ = self->priv->subset; + _tmp17_ = gee_sorted_set_floor (_tmp16_, "a"); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (_tmp18_ == NULL, "subset.floor (\"a\") == null"); + _g_free0 (_tmp18_); + _tmp19_ = self->priv->subset; + _tmp20_ = gee_sorted_set_floor (_tmp19_, "five"); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "five") == 0, "subset.floor (\"five\") == \"five\""); + _g_free0 (_tmp21_); + _tmp22_ = self->priv->subset; + _tmp23_ = gee_sorted_set_floor (_tmp22_, "four"); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "four") == 0, "subset.floor (\"four\") == \"four\""); + _g_free0 (_tmp24_); + _tmp25_ = self->priv->subset; + _tmp26_ = gee_sorted_set_floor (_tmp25_, "six"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "four") == 0, "subset.floor (\"six\") == \"four\""); + _g_free0 (_tmp27_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + GeeSortedSet* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + GeeSortedSet* _tmp31_; + gpointer _tmp32_ = NULL; + gchar* _tmp33_; + GeeSortedSet* _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + GeeSortedSet* _tmp37_; + gpointer _tmp38_ = NULL; + gchar* _tmp39_; + GeeSortedSet* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + _tmp28_ = self->priv->subset; + _tmp29_ = gee_sorted_set_floor (_tmp28_, "one"); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (_tmp30_ == NULL, "subset.floor (\"one\") == null"); + _g_free0 (_tmp30_); + _tmp31_ = self->priv->subset; + _tmp32_ = gee_sorted_set_floor (_tmp31_, "six"); + _tmp33_ = (gchar*) _tmp32_; + _vala_assert (g_strcmp0 (_tmp33_, "six") == 0, "subset.floor (\"six\") == \"six\""); + _g_free0 (_tmp33_); + _tmp34_ = self->priv->subset; + _tmp35_ = gee_sorted_set_floor (_tmp34_, "three"); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "three") == 0, "subset.floor (\"three\") == \"three\""); + _g_free0 (_tmp36_); + _tmp37_ = self->priv->subset; + _tmp38_ = gee_sorted_set_floor (_tmp37_, "two"); + _tmp39_ = (gchar*) _tmp38_; + _vala_assert (g_strcmp0 (_tmp39_, "two") == 0, "subset.floor (\"two\") == \"two\""); + _g_free0 (_tmp39_); + _tmp40_ = self->priv->subset; + _tmp41_ = gee_sorted_set_floor (_tmp40_, "z"); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (g_strcmp0 (_tmp42_, "two") == 0, "subset.floor (\"z\") == \"two\""); + _g_free0 (_tmp42_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + GeeSortedSet* _tmp43_; + gpointer _tmp44_ = NULL; + gchar* _tmp45_; + GeeSortedSet* _tmp46_; + gpointer _tmp47_ = NULL; + gchar* _tmp48_; + GeeSortedSet* _tmp49_; + gpointer _tmp50_ = NULL; + gchar* _tmp51_; + GeeSortedSet* _tmp52_; + gpointer _tmp53_ = NULL; + gchar* _tmp54_; + GeeSortedSet* _tmp55_; + gpointer _tmp56_ = NULL; + gchar* _tmp57_; + _tmp43_ = self->priv->subset; + _tmp44_ = gee_sorted_set_floor (_tmp43_, "five"); + _tmp45_ = (gchar*) _tmp44_; + _vala_assert (_tmp45_ == NULL, "subset.floor (\"five\") == null"); + _g_free0 (_tmp45_); + _tmp46_ = self->priv->subset; + _tmp47_ = gee_sorted_set_floor (_tmp46_, "four"); + _tmp48_ = (gchar*) _tmp47_; + _vala_assert (g_strcmp0 (_tmp48_, "four") == 0, "subset.floor (\"four\") == \"four\""); + _g_free0 (_tmp48_); + _tmp49_ = self->priv->subset; + _tmp50_ = gee_sorted_set_floor (_tmp49_, "one"); + _tmp51_ = (gchar*) _tmp50_; + _vala_assert (g_strcmp0 (_tmp51_, "one") == 0, "subset.floor (\"one\") == \"one\""); + _g_free0 (_tmp51_); + _tmp52_ = self->priv->subset; + _tmp53_ = gee_sorted_set_floor (_tmp52_, "six"); + _tmp54_ = (gchar*) _tmp53_; + _vala_assert (g_strcmp0 (_tmp54_, "six") == 0, "subset.floor (\"six\") == \"six\""); + _g_free0 (_tmp54_); + _tmp55_ = self->priv->subset; + _tmp56_ = gee_sorted_set_floor (_tmp55_, "three"); + _tmp57_ = (gchar*) _tmp56_; + _vala_assert (g_strcmp0 (_tmp57_, "six") == 0, "subset.floor (\"three\") == \"six\""); + _g_free0 (_tmp57_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + GeeSortedSet* _tmp58_; + gpointer _tmp59_ = NULL; + gchar* _tmp60_; + _tmp58_ = self->priv->subset; + _tmp59_ = gee_sorted_set_floor (_tmp58_, "six"); + _tmp60_ = (gchar*) _tmp59_; + _vala_assert (_tmp60_ == NULL, "subset.floor (\"six\") == null"); + _g_free0 (_tmp60_); + break; + } + default: + { + g_assert_not_reached (); + } + } +} + + +void sorted_set_tests_sub_set_test_ceil (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + SortedSetTestsSubSetType _tmp15_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + GeeSortedSet* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + GeeSortedSet* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + GeeSortedSet* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + GeeSortedSet* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + _tmp16_ = self->priv->subset; + _tmp17_ = gee_sorted_set_ceil (_tmp16_, "a"); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "five") == 0, "subset.ceil (\"a\") == \"five\""); + _g_free0 (_tmp18_); + _tmp19_ = self->priv->subset; + _tmp20_ = gee_sorted_set_ceil (_tmp19_, "five"); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "five") == 0, "subset.ceil (\"five\") == \"five\""); + _g_free0 (_tmp21_); + _tmp22_ = self->priv->subset; + _tmp23_ = gee_sorted_set_ceil (_tmp22_, "four"); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "four") == 0, "subset.ceil (\"four\") == \"four\""); + _g_free0 (_tmp24_); + _tmp25_ = self->priv->subset; + _tmp26_ = gee_sorted_set_ceil (_tmp25_, "six"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (_tmp27_ == NULL, "subset.ceil (\"six\") == null"); + _g_free0 (_tmp27_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + GeeSortedSet* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + GeeSortedSet* _tmp31_; + gpointer _tmp32_ = NULL; + gchar* _tmp33_; + GeeSortedSet* _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + GeeSortedSet* _tmp37_; + gpointer _tmp38_ = NULL; + gchar* _tmp39_; + GeeSortedSet* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + _tmp28_ = self->priv->subset; + _tmp29_ = gee_sorted_set_ceil (_tmp28_, "one"); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "six") == 0, "subset.ceil (\"one\") == \"six\""); + _g_free0 (_tmp30_); + _tmp31_ = self->priv->subset; + _tmp32_ = gee_sorted_set_ceil (_tmp31_, "six"); + _tmp33_ = (gchar*) _tmp32_; + _vala_assert (g_strcmp0 (_tmp33_, "six") == 0, "subset.ceil (\"six\") == \"six\""); + _g_free0 (_tmp33_); + _tmp34_ = self->priv->subset; + _tmp35_ = gee_sorted_set_ceil (_tmp34_, "three"); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "three") == 0, "subset.ceil (\"three\") == \"three\""); + _g_free0 (_tmp36_); + _tmp37_ = self->priv->subset; + _tmp38_ = gee_sorted_set_ceil (_tmp37_, "two"); + _tmp39_ = (gchar*) _tmp38_; + _vala_assert (g_strcmp0 (_tmp39_, "two") == 0, "subset.ceil (\"two\") == \"two\""); + _g_free0 (_tmp39_); + _tmp40_ = self->priv->subset; + _tmp41_ = gee_sorted_set_ceil (_tmp40_, "z"); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (_tmp42_ == NULL, "subset.ceil (\"z\") == null"); + _g_free0 (_tmp42_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + GeeSortedSet* _tmp43_; + gpointer _tmp44_ = NULL; + gchar* _tmp45_; + GeeSortedSet* _tmp46_; + gpointer _tmp47_ = NULL; + gchar* _tmp48_; + GeeSortedSet* _tmp49_; + gpointer _tmp50_ = NULL; + gchar* _tmp51_; + GeeSortedSet* _tmp52_; + gpointer _tmp53_ = NULL; + gchar* _tmp54_; + GeeSortedSet* _tmp55_; + gpointer _tmp56_ = NULL; + gchar* _tmp57_; + _tmp43_ = self->priv->subset; + _tmp44_ = gee_sorted_set_ceil (_tmp43_, "five"); + _tmp45_ = (gchar*) _tmp44_; + _vala_assert (g_strcmp0 (_tmp45_, "four") == 0, "subset.ceil (\"five\") == \"four\""); + _g_free0 (_tmp45_); + _tmp46_ = self->priv->subset; + _tmp47_ = gee_sorted_set_ceil (_tmp46_, "four"); + _tmp48_ = (gchar*) _tmp47_; + _vala_assert (g_strcmp0 (_tmp48_, "four") == 0, "subset.ceil (\"four\") == \"four\""); + _g_free0 (_tmp48_); + _tmp49_ = self->priv->subset; + _tmp50_ = gee_sorted_set_ceil (_tmp49_, "one"); + _tmp51_ = (gchar*) _tmp50_; + _vala_assert (g_strcmp0 (_tmp51_, "one") == 0, "subset.ceil (\"one\") == \"one\""); + _g_free0 (_tmp51_); + _tmp52_ = self->priv->subset; + _tmp53_ = gee_sorted_set_ceil (_tmp52_, "six"); + _tmp54_ = (gchar*) _tmp53_; + _vala_assert (g_strcmp0 (_tmp54_, "six") == 0, "subset.ceil (\"six\") == \"six\""); + _g_free0 (_tmp54_); + _tmp55_ = self->priv->subset; + _tmp56_ = gee_sorted_set_ceil (_tmp55_, "three"); + _tmp57_ = (gchar*) _tmp56_; + _vala_assert (_tmp57_ == NULL, "subset.ceil (\"three\") == null"); + _g_free0 (_tmp57_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + GeeSortedSet* _tmp58_; + gpointer _tmp59_ = NULL; + gchar* _tmp60_; + _tmp58_ = self->priv->subset; + _tmp59_ = gee_sorted_set_ceil (_tmp58_, "six"); + _tmp60_ = (gchar*) _tmp59_; + _vala_assert (_tmp60_ == NULL, "subset.ceil (\"six\") == null"); + _g_free0 (_tmp60_); + break; + } + default: + { + g_assert_not_reached (); + } + } +} + + +void sorted_set_tests_sub_set_test_subsets (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + SortedSetTestsSubSetType _tmp15_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + GeeSortedSet* _tmp16_; + GeeSortedSet* _tmp17_ = NULL; + GeeSortedSet* subsubset; + GeeSortedSet* _tmp18_; + gint _tmp19_; + gint _tmp20_; + GeeSortedSet* _tmp21_; + GeeSortedSet* _tmp22_ = NULL; + GeeSortedSet* _tmp23_; + gint _tmp24_; + gint _tmp25_; + GeeSortedSet* _tmp26_; + GeeSortedSet* _tmp27_ = NULL; + GeeSortedSet* _tmp28_; + gint _tmp29_; + gint _tmp30_; + GeeSortedSet* _tmp31_; + GeeSortedSet* _tmp32_ = NULL; + GeeSortedSet* _tmp33_; + gint _tmp34_; + gint _tmp35_; + _tmp16_ = self->priv->subset; + _tmp17_ = gee_sorted_set_head_set (_tmp16_, "four"); + subsubset = _tmp17_; + _tmp18_ = subsubset; + _tmp19_ = gee_collection_get_size ((GeeCollection*) _tmp18_); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 1, "subsubset.size == 1"); + _tmp21_ = self->priv->subset; + _tmp22_ = gee_sorted_set_tail_set (_tmp21_, "four"); + _g_object_unref0 (subsubset); + subsubset = _tmp22_; + _tmp23_ = subsubset; + _tmp24_ = gee_collection_get_size ((GeeCollection*) _tmp23_); + _tmp25_ = _tmp24_; + _vala_assert (_tmp25_ == 1, "subsubset.size == 1"); + _tmp26_ = self->priv->subset; + _tmp27_ = gee_sorted_set_sub_set (_tmp26_, "four", "one"); + _g_object_unref0 (subsubset); + subsubset = _tmp27_; + _tmp28_ = subsubset; + _tmp29_ = gee_collection_get_size ((GeeCollection*) _tmp28_); + _tmp30_ = _tmp29_; + _vala_assert (_tmp30_ == 1, "subsubset.size == 1"); + _tmp31_ = self->priv->subset; + _tmp32_ = gee_sorted_set_sub_set (_tmp31_, "four", "four"); + _g_object_unref0 (subsubset); + subsubset = _tmp32_; + _tmp33_ = subsubset; + _tmp34_ = gee_collection_get_size ((GeeCollection*) _tmp33_); + _tmp35_ = _tmp34_; + _vala_assert (_tmp35_ == 0, "subsubset.size == 0"); + _g_object_unref0 (subsubset); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + GeeSortedSet* _tmp36_; + GeeSortedSet* _tmp37_ = NULL; + GeeSortedSet* subsubset; + GeeSortedSet* _tmp38_; + gint _tmp39_; + gint _tmp40_; + GeeSortedSet* _tmp41_; + GeeSortedSet* _tmp42_ = NULL; + GeeSortedSet* _tmp43_; + gint _tmp44_; + gint _tmp45_; + GeeSortedSet* _tmp46_; + GeeSortedSet* _tmp47_ = NULL; + GeeSortedSet* _tmp48_; + gint _tmp49_; + gint _tmp50_; + _tmp36_ = self->priv->subset; + _tmp37_ = gee_sorted_set_head_set (_tmp36_, "two"); + subsubset = _tmp37_; + _tmp38_ = subsubset; + _tmp39_ = gee_collection_get_size ((GeeCollection*) _tmp38_); + _tmp40_ = _tmp39_; + _vala_assert (_tmp40_ == 2, "subsubset.size == 2"); + _tmp41_ = self->priv->subset; + _tmp42_ = gee_sorted_set_tail_set (_tmp41_, "three"); + _g_object_unref0 (subsubset); + subsubset = _tmp42_; + _tmp43_ = subsubset; + _tmp44_ = gee_collection_get_size ((GeeCollection*) _tmp43_); + _tmp45_ = _tmp44_; + _vala_assert (_tmp45_ == 2, "subsubset.size == 2"); + _tmp46_ = self->priv->subset; + _tmp47_ = gee_sorted_set_sub_set (_tmp46_, "three", "two"); + _g_object_unref0 (subsubset); + subsubset = _tmp47_; + _tmp48_ = subsubset; + _tmp49_ = gee_collection_get_size ((GeeCollection*) _tmp48_); + _tmp50_ = _tmp49_; + _vala_assert (_tmp50_ == 1, "subsubset.size == 1"); + _g_object_unref0 (subsubset); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + GeeSortedSet* _tmp51_; + GeeSortedSet* _tmp52_ = NULL; + GeeSortedSet* subsubset; + GeeSortedSet* _tmp53_; + gint _tmp54_; + gint _tmp55_; + GeeSortedSet* _tmp56_; + GeeSortedSet* _tmp57_ = NULL; + GeeSortedSet* _tmp58_; + gint _tmp59_; + gint _tmp60_; + GeeSortedSet* _tmp61_; + GeeSortedSet* _tmp62_ = NULL; + GeeSortedSet* _tmp63_; + gint _tmp64_; + gint _tmp65_; + GeeSortedSet* _tmp66_; + GeeSortedSet* _tmp67_ = NULL; + GeeSortedSet* _tmp68_; + gint _tmp69_; + gint _tmp70_; + _tmp51_ = self->priv->subset; + _tmp52_ = gee_sorted_set_head_set (_tmp51_, "six"); + subsubset = _tmp52_; + _tmp53_ = subsubset; + _tmp54_ = gee_collection_get_size ((GeeCollection*) _tmp53_); + _tmp55_ = _tmp54_; + _vala_assert (_tmp55_ == 2, "subsubset.size == 2"); + _tmp56_ = self->priv->subset; + _tmp57_ = gee_sorted_set_tail_set (_tmp56_, "one"); + _g_object_unref0 (subsubset); + subsubset = _tmp57_; + _tmp58_ = subsubset; + _tmp59_ = gee_collection_get_size ((GeeCollection*) _tmp58_); + _tmp60_ = _tmp59_; + _vala_assert (_tmp60_ == 2, "subsubset.size == 2"); + _tmp61_ = self->priv->subset; + _tmp62_ = gee_sorted_set_sub_set (_tmp61_, "one", "six"); + _g_object_unref0 (subsubset); + subsubset = _tmp62_; + _tmp63_ = subsubset; + _tmp64_ = gee_collection_get_size ((GeeCollection*) _tmp63_); + _tmp65_ = _tmp64_; + _vala_assert (_tmp65_ == 1, "subsubset.size == 1"); + _tmp66_ = self->priv->subset; + _tmp67_ = gee_sorted_set_sub_set (_tmp66_, "five", "two"); + _g_object_unref0 (subsubset); + subsubset = _tmp67_; + _tmp68_ = subsubset; + _tmp69_ = gee_collection_get_size ((GeeCollection*) _tmp68_); + _tmp70_ = _tmp69_; + _vala_assert (_tmp70_ == 3, "subsubset.size == 3"); + _g_object_unref0 (subsubset); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + GeeSortedSet* _tmp71_; + GeeSortedSet* _tmp72_ = NULL; + GeeSortedSet* subsubset; + GeeSortedSet* _tmp73_; + gint _tmp74_; + gint _tmp75_; + GeeSortedSet* _tmp76_; + GeeSortedSet* _tmp77_ = NULL; + GeeSortedSet* _tmp78_; + gint _tmp79_; + gint _tmp80_; + GeeSortedSet* _tmp81_; + GeeSortedSet* _tmp82_ = NULL; + GeeSortedSet* _tmp83_; + gint _tmp84_; + gint _tmp85_; + _tmp71_ = self->priv->subset; + _tmp72_ = gee_sorted_set_head_set (_tmp71_, "six"); + subsubset = _tmp72_; + _tmp73_ = subsubset; + _tmp74_ = gee_collection_get_size ((GeeCollection*) _tmp73_); + _tmp75_ = _tmp74_; + _vala_assert (_tmp75_ == 0, "subsubset.size == 0"); + _tmp76_ = self->priv->subset; + _tmp77_ = gee_sorted_set_tail_set (_tmp76_, "three"); + _g_object_unref0 (subsubset); + subsubset = _tmp77_; + _tmp78_ = subsubset; + _tmp79_ = gee_collection_get_size ((GeeCollection*) _tmp78_); + _tmp80_ = _tmp79_; + _vala_assert (_tmp80_ == 0, "subsubset.size == 0"); + _tmp81_ = self->priv->subset; + _tmp82_ = gee_sorted_set_sub_set (_tmp81_, "one", "six"); + _g_object_unref0 (subsubset); + subsubset = _tmp82_; + _tmp83_ = subsubset; + _tmp84_ = gee_collection_get_size ((GeeCollection*) _tmp83_); + _tmp85_ = _tmp84_; + _vala_assert (_tmp85_ == 0, "subsubset.size == 0"); + _g_object_unref0 (subsubset); + break; + } + default: + { + g_assert_not_reached (); + } + } +} + + +static void sorted_set_tests_sub_set_class_init (SortedSetTestsSubSetClass * klass) { + sorted_set_tests_sub_set_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (SortedSetTestsSubSetPrivate)); + GEE_TEST_CASE_CLASS (klass)->set_up = sorted_set_tests_sub_set_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = sorted_set_tests_sub_set_real_tear_down; + G_OBJECT_CLASS (klass)->finalize = sorted_set_tests_sub_set_finalize; +} + + +static void sorted_set_tests_sub_set_instance_init (SortedSetTestsSubSet * self) { + self->priv = SORTED_SET_TESTS_SUB_SET_GET_PRIVATE (self); +} + + +static void sorted_set_tests_sub_set_finalize (GObject* obj) { + SortedSetTestsSubSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, SORTED_SET_TESTS_TYPE_SUB_SET, SortedSetTestsSubSet); + _g_object_unref0 (self->priv->master); + _g_object_unref0 (self->priv->subset); + _g_object_unref0 (self->priv->test); + G_OBJECT_CLASS (sorted_set_tests_sub_set_parent_class)->finalize (obj); +} + + +GType sorted_set_tests_sub_set_get_type (void) { + static volatile gsize sorted_set_tests_sub_set_type_id__volatile = 0; + if (g_once_init_enter (&sorted_set_tests_sub_set_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (SortedSetTestsSubSetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sorted_set_tests_sub_set_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SortedSetTestsSubSet), 0, (GInstanceInitFunc) sorted_set_tests_sub_set_instance_init, NULL }; + GType sorted_set_tests_sub_set_type_id; + sorted_set_tests_sub_set_type_id = g_type_register_static (GEE_TYPE_TEST_CASE, "SortedSetTestsSubSet", &g_define_type_info, 0); + g_once_init_leave (&sorted_set_tests_sub_set_type_id__volatile, sorted_set_tests_sub_set_type_id); + } + return sorted_set_tests_sub_set_type_id__volatile; +} + + +static void sorted_set_tests_class_init (SortedSetTestsClass * klass) { + sorted_set_tests_parent_class = g_type_class_peek_parent (klass); +} + + +static void sorted_set_tests_instance_init (SortedSetTests * self) { +} + + +GType sorted_set_tests_get_type (void) { + static volatile gsize sorted_set_tests_type_id__volatile = 0; + if (g_once_init_enter (&sorted_set_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (SortedSetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sorted_set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SortedSetTests), 0, (GInstanceInitFunc) sorted_set_tests_instance_init, NULL }; + GType sorted_set_tests_type_id; + sorted_set_tests_type_id = g_type_register_static (TYPE_SET_TESTS, "SortedSetTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&sorted_set_tests_type_id__volatile, sorted_set_tests_type_id); + } + return sorted_set_tests_type_id__volatile; +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + + diff --git a/tests/testsortedset.vala b/tests/testsortedset.vala new file mode 100644 index 0000000..a5172b4 --- /dev/null +++ b/tests/testsortedset.vala @@ -0,0 +1,979 @@ +/* testsortedset.vala + * + * Copyright (C) 2009 Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Maciej Piechotka + */ + +using GLib; +using Gee; + +public abstract class SortedSetTests : SetTests { + + public SortedSetTests (string name) { + base (name); + add_test ("[SortedSet] first", test_first); + add_test ("[SortedSet] last", test_last); + add_test ("[SortedSet] ordering", test_ordering); + add_test ("[SortedSet] iterator at", test_iterator_at); + add_test ("[SortedSet] lower", test_lower); + add_test ("[SortedSet] higher", test_higher); + add_test ("[SortedSet] floor", test_floor); + add_test ("[SortedSet] ceil", test_ceil); + add_test ("[SortedSet] bi-directional iterators can go backward", + test_bidir_iterator_can_go_backward); + add_test ("[SortedSet] bi-directional iterators are mutable", + test_mutable_bidir_iterator); + add_test ("[SortedSet] bi-directional iterators can to end", + test_bidir_iterator_last); + get_suite ().add_suite (new SubSet (this, SubSet.Type.HEAD).get_suite ()); + get_suite ().add_suite (new SubSet (this, SubSet.Type.TAIL).get_suite ()); + get_suite ().add_suite (new SubSet (this, SubSet.Type.SUB).get_suite ()); + get_suite ().add_suite (new SubSet (this, SubSet.Type.EMPTY).get_suite ()); + } + + public void test_ordering () { + var test_set = test_collection as SortedSet; + + // Check the set exists + assert (test_set != null); + + test_set.add ("one"); + test_set.add ("two"); + test_set.add ("three"); + test_set.add ("four"); + test_set.add ("five"); + test_set.add ("six"); + test_set.add ("seven"); + test_set.add ("eight"); + test_set.add ("nine"); + test_set.add ("ten"); + test_set.add ("eleven"); + test_set.add ("twelve"); + + Iterator iterator = test_set.iterator (); + assert (iterator.next ()); + assert (iterator.get () == "eight"); + assert (iterator.next ()); + assert (iterator.get () == "eleven"); + assert (iterator.next ()); + assert (iterator.get () == "five"); + assert (iterator.next ()); + assert (iterator.get () == "four"); + assert (iterator.next ()); + assert (iterator.get () == "nine"); + assert (iterator.next ()); + assert (iterator.get () == "one"); + assert (iterator.next ()); + assert (iterator.get () == "seven"); + assert (iterator.next ()); + assert (iterator.get () == "six"); + assert (iterator.next ()); + assert (iterator.get () == "ten"); + assert (iterator.next ()); + assert (iterator.get () == "three"); + assert (iterator.next ()); + assert (iterator.get () == "twelve"); + assert (iterator.next ()); + assert (iterator.get () == "two"); + assert (iterator.next () == false); + } + + public void test_first () { + var test_set = test_collection as SortedSet; + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_set.first (); + Posix.exit (0); + } + Test.trap_assert_failed (); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + assert (test_set.first () == "five"); + } + + public void test_last () { + var test_set = test_collection as SortedSet; + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_set.last (); + Posix.exit (0); + } + Test.trap_assert_failed (); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + assert (test_set.last () == "two"); + } + + public void test_iterator_at () { + var test_set = test_collection as SortedSet; + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + + var iter = test_set.iterator_at ("one"); + assert (iter != null); + assert (iter.get () == "one"); + + iter = test_set.iterator_at ("two"); + assert (iter != null); + assert (iter.get () == "two"); + + iter = test_set.iterator_at ("three"); + assert (iter != null); + assert (iter.get () == "three"); + + iter = test_set.iterator_at ("zero"); + assert (iter == null); + } + + public void test_lower () { + var test_set = test_collection as SortedSet; + + assert (test_set.lower ("one") == null); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + assert (test_set.lower ("one") == "four"); + assert (test_set.lower ("o") == "four"); + assert (test_set.lower ("two") == "three"); + assert (test_set.lower ("t") == "six"); + assert (test_set.lower ("three") == "six"); + assert (test_set.lower ("four") == "five"); + assert (test_set.lower ("f") == null); + assert (test_set.lower ("five") == null); + assert (test_set.lower ("six") == "one"); + assert (test_set.lower ("s") == "one"); + } + + public void test_higher () { + var test_set = test_collection as SortedSet; + + assert (test_set.higher ("one") == null); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + assert (test_set.higher ("one") == "six"); + assert (test_set.higher ("o") == "one"); + assert (test_set.higher ("two") == null); + assert (test_set.higher ("t") == "three"); + assert (test_set.higher ("three") == "two"); + assert (test_set.higher ("four") == "one"); + assert (test_set.higher ("f") == "five"); + assert (test_set.higher ("five") == "four"); + assert (test_set.higher ("six") == "three"); + assert (test_set.higher ("s") == "six"); + } + + public void test_floor () { + var test_set = test_collection as SortedSet; + + assert (test_set.floor ("one") == null); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + assert (test_set.floor ("one") == "one"); + assert (test_set.floor ("o") == "four"); + assert (test_set.floor ("two") == "two"); + assert (test_set.floor ("t") == "six"); + assert (test_set.floor ("three") == "three"); + assert (test_set.floor ("four") == "four"); + assert (test_set.floor ("f") == null); + assert (test_set.floor ("five") == "five"); + assert (test_set.floor ("six") == "six"); + assert (test_set.floor ("s") == "one"); + } + + public void test_ceil () { + var test_set = test_collection as SortedSet; + + assert (test_set.ceil ("one") == null); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + assert (test_set.ceil ("one") == "one"); + assert (test_set.ceil ("o") == "one"); + assert (test_set.ceil ("two") == "two"); + assert (test_set.ceil ("t") == "three"); + assert (test_set.ceil ("three") == "three"); + assert (test_set.ceil ("four") == "four"); + assert (test_set.ceil ("f") == "five"); + assert (test_set.ceil ("five") == "five"); + assert (test_set.ceil ("six") == "six"); + assert (test_set.ceil ("s") == "six"); + } + + public void test_bidir_iterator_can_go_backward () { + var test_set = test_collection as SortedSet; + + var iterator = test_set.bidir_iterator (); + assert (!iterator.has_previous ()); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + iterator = test_set.bidir_iterator (); + assert (iterator.next ()); + assert (iterator.get () == "five"); + assert (!iterator.has_previous ()); + assert (iterator.next ()); + assert (iterator.get () == "four"); + assert (iterator.has_previous ()); + assert (iterator.next ()); + assert (iterator.get () == "one"); + assert (iterator.has_previous ()); + assert (iterator.next ()); + assert (iterator.get () == "six"); + assert (iterator.has_previous ()); + assert (iterator.next ()); + assert (iterator.get () == "three"); + assert (iterator.has_previous ()); + assert (iterator.next ()); + assert (iterator.get () == "two"); + assert (iterator.has_previous ()); + assert (!iterator.next ()); + assert (iterator.previous ()); + assert (iterator.get () == "three"); + assert (iterator.previous ()); + assert (iterator.get () == "six"); + assert (iterator.previous ()); + assert (iterator.get () == "one"); + assert (iterator.previous ()); + assert (iterator.get () == "four"); + assert (iterator.previous ()); + assert (iterator.get () == "five"); + assert (!iterator.previous ()); + assert (iterator.get () == "five"); + } + + public void test_bidir_iterator_last () { + var test_set = test_collection as SortedSet; + + var iterator = test_set.bidir_iterator (); + + assert (!iterator.last ()); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + iterator = test_set.bidir_iterator (); + assert (iterator.last ()); + assert (iterator.get () == "two"); + } + + public void test_mutable_bidir_iterator () { + var test_set = test_collection as SortedSet; + + var iterator = test_set.bidir_iterator (); + assert (!iterator.has_previous ()); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + iterator = test_set.bidir_iterator (); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iterator.remove (); + Posix.exit (0); + } + Test.trap_assert_failed (); + + assert (iterator.next ()); + assert (iterator.get () == "five"); + iterator.remove (); + assert (!test_set.contains ("five")); + assert (iterator.has_next ()); + assert (!iterator.has_previous ()); + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iterator.get (); + Posix.exit (0); + } + assert (!iterator.previous ()); + + assert (iterator.next ()); + assert (iterator.get () == "four"); + assert (iterator.next ()); + assert (iterator.get () == "one"); + iterator.remove (); + assert (!test_set.contains ("one")); + assert (iterator.has_next ()); + assert (iterator.has_previous ()); + assert (iterator.previous ()); + assert (iterator.get () == "four"); + } + + public class SubSet : Gee.TestCase { + private SortedSet master; + private SortedSet subset; + private SortedSetTests test; + public enum Type { + HEAD, + TAIL, + SUB, + EMPTY; + public unowned string to_string () { + switch (this) { + case Type.HEAD: return "Head"; + case Type.TAIL: return "Tail"; + case Type.SUB: return "Range"; + case Type.EMPTY: return "Empty"; + default: assert_not_reached (); + } + } + } + private Type type; + + public SubSet (SortedSetTests test, Type type) { + base ("%s Subset".printf (type.to_string ())); + this.test = test; + this.type = type; + add_test ("[Collection] size", test_size); + add_test ("[Collection] contains", test_contains); + add_test ("[Collection] add", test_add); + add_test ("[Collection] remove", test_remove); + add_test ("[Collection] iterator", test_iterator); + add_test ("[Collection] clear", test_clear); + add_test ("[SortedSet] iterator at", test_iterator_at); + add_test ("[SortedSet] lower", test_lower); + add_test ("[SortedSet] higher", test_higher); + add_test ("[SortedSet] ceil", test_ceil); + add_test ("[SortedSet] floor", test_floor); + add_test ("[SortedSet] subsets", test_subsets); + add_test ("[SortedSet] boundaries", test_boundaries); + } + + public override void set_up () { + test.set_up (); + master = test.test_collection as SortedSet; + switch (type) { + case Type.HEAD: + subset = master.head_set ("one"); break; + case Type.TAIL: + subset = master.tail_set ("six"); break; + case Type.SUB: + subset = master.sub_set ("four", "three"); break; + case Type.EMPTY: + subset = master.sub_set ("three", "four"); break; + default: + assert_not_reached (); + } + } + + public override void tear_down () { + test.tear_down (); + } + + public void test_size () { + assert (subset.is_empty); + assert (subset.size == 0); + + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + switch (type) { + case Type.HEAD: + assert (!subset.is_empty); + assert (subset.size == 2); + break; + case Type.TAIL: + assert (!subset.is_empty); + assert (subset.size == 3); + break; + case Type.SUB: + assert (!subset.is_empty); + assert (subset.size == 3); + break; + case Type.EMPTY: + assert (subset.is_empty); + assert (subset.size == 0); + break; + default: + assert_not_reached (); + } + } + + public void test_contains () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + string[] contains, not_contains; + switch (type) { + case Type.HEAD: + contains = {"four", "five"}; + not_contains = {"one", "two", "three", "six"}; + break; + case Type.TAIL: + contains = {"two", "three", "six"}; + not_contains = {"one", "four", "five"}; + break; + case Type.SUB: + contains = {"one", "four", "six"}; + not_contains = {"two", "three", "five"}; + break; + case Type.EMPTY: + contains = {}; + not_contains = {"one", "two", "three", "four", "five", "six"}; + break; + default: + assert_not_reached (); + } + + foreach (var s in contains) + assert (subset.contains (s)); + foreach (var s in not_contains) + assert (!subset.contains (s)); + } + + public void test_add () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + string[] success, fail; + switch (type) { + case Type.HEAD: + success = {"a", "o"}; + fail = {"oz", "z"}; + break; + case Type.TAIL: + success = {"siz", "z"}; + fail = {"sia", "a"}; + break; + case Type.SUB: + success = {"o", "th"}; + fail = {"f", "u"}; + break; + case Type.EMPTY: + success = {}; + fail = {"o", "th", "f", "u"}; + break; + default: + assert_not_reached (); + } + + foreach (var s in success) { + assert (subset.add (s)); + assert (subset.contains (s)); + assert (master.contains (s)); + } + + foreach (var s in fail) { + assert (!subset.add (s)); + assert (!subset.contains (s)); + assert (!master.contains (s)); + } + + assert (master.size == 6 + success.length); + } + + public void test_remove () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + string[] contains, not_contains; + switch (type) { + case Type.HEAD: + contains = {"four", "five"}; + not_contains = {"one", "two", "three", "six"}; + break; + case Type.TAIL: + contains = {"two", "three", "six"}; + not_contains = {"one", "four", "five"}; + break; + case Type.SUB: + contains = {"one", "four", "six"}; + not_contains = {"two", "three", "five"}; + break; + case Type.EMPTY: + contains = {}; + not_contains = {"one", "two", "three", "four", "five", "six"}; + break; + default: + assert_not_reached (); + } + + foreach (var s in contains) { + assert (subset.remove (s)); + assert (!master.contains (s)); + } + foreach (var s in not_contains) { + assert (!subset.remove (s)); + assert (master.contains (s)); + } + + assert (master.size == 6 - contains.length); + } + + public void test_iterator () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + string[] contains; + switch (type) { + case Type.HEAD: + contains = {"five", "four"}; + break; + case Type.TAIL: + contains = {"six", "three", "two"}; + break; + case Type.SUB: + contains = {"four", "one", "six"}; + break; + case Type.EMPTY: + contains = {}; + break; + default: + assert_not_reached (); + } + + uint i = 0; + foreach (var e in subset) { + assert (e == contains[i++]); + } + assert (i == contains.length); + + + var iter = subset.bidir_iterator (); + if (type != Type.EMPTY) { + assert (iter.last ()); + assert (iter.get () == contains[contains.length - 1]); + assert (iter.first ()); + + assert (iter.get () == contains[0]); + assert (iter.has_next ()); + assert (iter.next ()); + assert (iter.get () == contains[1]); + assert (iter.has_previous ()); + iter.remove (); + assert (iter.has_previous ()); + if (type != Type.HEAD) + assert (iter.has_next ()); + else + assert (!iter.has_next ()); + assert (iter.previous ()); + assert (iter.get () == contains[0]); + } else { + assert (!iter.first ()); + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iter.remove (); + Posix.exit (0); + } + Test.trap_assert_failed (); + } + } + + public void test_clear () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + string[] contains, not_contains; + switch (type) { + case Type.HEAD: + contains = {"four", "five"}; + not_contains = {"one", "two", "three", "six"}; + break; + case Type.TAIL: + contains = {"two", "three", "six"}; + not_contains = {"one", "four", "five"}; + break; + case Type.SUB: + contains = {"one", "four", "six"}; + not_contains = {"two", "three", "five"}; + break; + case Type.EMPTY: + contains = {}; + not_contains = {"one", "two", "three", "four", "five", "six"}; + break; + default: + assert_not_reached (); + } + + subset.clear (); + foreach (var s in contains) + assert (!master.contains (s)); + foreach (var s in not_contains) + assert (master.contains (s)); + } + + public void test_boundaries () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + switch (type) { + case Type.HEAD: + assert (subset.first () == "five"); + assert (subset.last () == "four"); + break; + case Type.TAIL: + assert (subset.first () == "six"); + assert (subset.last () == "two"); + break; + case Type.SUB: + assert (subset.first () == "four"); + assert (subset.last () == "six"); + break; + case Type.EMPTY: + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + subset.first (); + Posix.exit (0); + } + Test.trap_assert_failed (); + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + subset.last (); + Posix.exit (0); + } + Test.trap_assert_failed (); + break; + default: + assert_not_reached (); + } + } + + public void test_iterator_at () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + string[] contains, not_contains; + switch (type) { + case Type.HEAD: + contains = {"four", "five"}; + not_contains = {"one", "two", "three", "six"}; + break; + case Type.TAIL: + contains = {"two", "three", "six"}; + not_contains = {"one", "four", "five"}; + break; + case Type.SUB: + contains = {"one", "four", "six"}; + not_contains = {"two", "three", "five"}; + break; + case Type.EMPTY: + contains = {}; + not_contains = {"one", "two", "three", "four", "five", "six"}; + break; + default: + assert_not_reached (); + } + + foreach (var s in contains) { + var iter = subset.iterator_at (s); + assert (iter != null); + assert (iter.get () == s); + } + foreach (var s in not_contains) { + var iter = subset.iterator_at (s); + assert (iter == null); + } + } + + public void test_lower () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + switch (type) { + case Type.HEAD: + assert (subset.lower ("a") == null); + assert (subset.lower ("five") == null); + assert (subset.lower ("four") == "five"); + assert (subset.lower ("six") == "four"); + break; + case Type.TAIL: + assert (subset.lower ("one") == null); + assert (subset.lower ("six") == null); + assert (subset.lower ("three") == "six"); + assert (subset.lower ("two") == "three"); + assert (subset.lower ("z") == "two"); + break; + case Type.SUB: + assert (subset.lower ("five") == null); + assert (subset.lower ("four") == null); + assert (subset.lower ("one") == "four"); + assert (subset.lower ("six") == "one"); + assert (subset.lower ("three") == "six"); + break; + case Type.EMPTY: + assert (subset.lower ("six") == null); + break; + default: + assert_not_reached (); + } + } + + public void test_higher () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + switch (type) { + case Type.HEAD: + assert (subset.higher ("a") == "five"); + assert (subset.higher ("five") == "four"); + assert (subset.higher ("four") == null); + assert (subset.higher ("six") == null); + break; + case Type.TAIL: + assert (subset.higher ("one") == "six"); + assert (subset.higher ("six") == "three"); + assert (subset.higher ("three") == "two"); + assert (subset.higher ("two") == null); + assert (subset.higher ("z") == null); + break; + case Type.SUB: + assert (subset.higher ("five") == "four"); + assert (subset.higher ("four") == "one"); + assert (subset.higher ("one") == "six"); + assert (subset.higher ("six") == null); + assert (subset.higher ("three") == null); + break; + case Type.EMPTY: + assert (subset.higher ("six") == null); + break; + default: + assert_not_reached (); + } + } + + public void test_floor () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + switch (type) { + case Type.HEAD: + assert (subset.floor ("a") == null); + assert (subset.floor ("five") == "five"); + assert (subset.floor ("four") == "four"); + assert (subset.floor ("six") == "four"); + break; + case Type.TAIL: + assert (subset.floor ("one") == null); + assert (subset.floor ("six") == "six"); + assert (subset.floor ("three") == "three"); + assert (subset.floor ("two") == "two"); + assert (subset.floor ("z") == "two"); + break; + case Type.SUB: + assert (subset.floor ("five") == null); + assert (subset.floor ("four") == "four"); + assert (subset.floor ("one") == "one"); + assert (subset.floor ("six") == "six"); + assert (subset.floor ("three") == "six"); + break; + case Type.EMPTY: + assert (subset.floor ("six") == null); + break; + default: + assert_not_reached (); + } + } + + public void test_ceil () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + switch (type) { + case Type.HEAD: + assert (subset.ceil ("a") == "five"); + assert (subset.ceil ("five") == "five"); + assert (subset.ceil ("four") == "four"); + assert (subset.ceil ("six") == null); + break; + case Type.TAIL: + assert (subset.ceil ("one") == "six"); + assert (subset.ceil ("six") == "six"); + assert (subset.ceil ("three") == "three"); + assert (subset.ceil ("two") == "two"); + assert (subset.ceil ("z") == null); + break; + case Type.SUB: + assert (subset.ceil ("five") == "four"); + assert (subset.ceil ("four") == "four"); + assert (subset.ceil ("one") == "one"); + assert (subset.ceil ("six") == "six"); + assert (subset.ceil ("three") == null); + break; + case Type.EMPTY: + assert (subset.ceil ("six") == null); + break; + default: + assert_not_reached (); + } + } + + public void test_subsets () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + switch (type) { + case Type.HEAD: + var subsubset = subset.head_set ("four"); + assert (subsubset.size == 1); + subsubset = subset.tail_set ("four"); + assert (subsubset.size == 1); + subsubset = subset.sub_set ("four", "one"); + assert (subsubset.size == 1); + subsubset = subset.sub_set ("four", "four"); + assert (subsubset.size == 0); + break; + case Type.TAIL: + var subsubset = subset.head_set ("two"); + assert (subsubset.size == 2); + subsubset = subset.tail_set ("three"); + assert (subsubset.size == 2); + subsubset = subset.sub_set ("three", "two"); + assert (subsubset.size == 1); + break; + case Type.SUB: + var subsubset = subset.head_set ("six"); + assert (subsubset.size == 2); + subsubset = subset.tail_set ("one"); + assert (subsubset.size == 2); + subsubset = subset.sub_set ("one", "six"); + assert (subsubset.size == 1); + subsubset = subset.sub_set ("five", "two"); + assert (subsubset.size == 3); + break; + case Type.EMPTY: + var subsubset = subset.head_set ("six"); + assert (subsubset.size == 0); + subsubset = subset.tail_set ("three"); + assert (subsubset.size == 0); + subsubset = subset.sub_set ("one", "six"); + assert (subsubset.size == 0); + break; + default: + assert_not_reached (); + } + } + } +} + diff --git a/tests/testtreemap.c b/tests/testtreemap.c new file mode 100644 index 0000000..6e5b107 --- /dev/null +++ b/tests/testtreemap.c @@ -0,0 +1,422 @@ +/* testtreemap.c generated by valac 0.18.0, the Vala compiler + * generated from testtreemap.vala, do not modify */ + +/* testtreemap.vala + * + * Copyright (C) 2008 Maciej Piechotka + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Julien Peeters + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_MAP_TESTS (map_tests_get_type ()) +#define MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAP_TESTS, MapTests)) +#define MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAP_TESTS, MapTestsClass)) +#define IS_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAP_TESTS)) +#define IS_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAP_TESTS)) +#define MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAP_TESTS, MapTestsClass)) + +typedef struct _MapTests MapTests; +typedef struct _MapTestsClass MapTestsClass; +typedef struct _MapTestsPrivate MapTestsPrivate; + +#define TYPE_TREE_MAP_TESTS (tree_map_tests_get_type ()) +#define TREE_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TREE_MAP_TESTS, TreeMapTests)) +#define TREE_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TREE_MAP_TESTS, TreeMapTestsClass)) +#define IS_TREE_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TREE_MAP_TESTS)) +#define IS_TREE_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TREE_MAP_TESTS)) +#define TREE_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TREE_MAP_TESTS, TreeMapTestsClass)) + +typedef struct _TreeMapTests TreeMapTests; +typedef struct _TreeMapTestsClass TreeMapTestsClass; +typedef struct _TreeMapTestsPrivate TreeMapTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _MapTests { + GeeTestCase parent_instance; + MapTestsPrivate * priv; + GeeMap* test_map; +}; + +struct _MapTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _TreeMapTests { + MapTests parent_instance; + TreeMapTestsPrivate * priv; +}; + +struct _TreeMapTestsClass { + MapTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer tree_map_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType map_tests_get_type (void) G_GNUC_CONST; +GType tree_map_tests_get_type (void) G_GNUC_CONST; +enum { + TREE_MAP_TESTS_DUMMY_PROPERTY +}; +TreeMapTests* tree_map_tests_new (void); +TreeMapTests* tree_map_tests_construct (GType object_type); +MapTests* map_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void tree_map_tests_test_selected_functions (TreeMapTests* self); +static void _tree_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +void tree_map_tests_test_gobject_properties (TreeMapTests* self); +static void _tree_map_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +void tree_map_tests_test_key_ordering (TreeMapTests* self); +static void _tree_map_tests_test_key_ordering_gee_test_case_test_method (gpointer self); +static void tree_map_tests_real_set_up (GeeTestCase* base); +static void tree_map_tests_real_tear_down (GeeTestCase* base); + + +static void _tree_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + tree_map_tests_test_selected_functions (self); +} + + +static void _tree_map_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + tree_map_tests_test_gobject_properties (self); +} + + +static void _tree_map_tests_test_key_ordering_gee_test_case_test_method (gpointer self) { + tree_map_tests_test_key_ordering (self); +} + + +TreeMapTests* tree_map_tests_construct (GType object_type) { + TreeMapTests * self = NULL; + self = (TreeMapTests*) map_tests_construct (object_type, "TreeMap"); + gee_test_case_add_test ((GeeTestCase*) self, "[TreeMap] selected functions", _tree_map_tests_test_selected_functions_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[TreeMap] GObject properties", _tree_map_tests_test_gobject_properties_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[TreeMap] key ordering", _tree_map_tests_test_key_ordering_gee_test_case_test_method, self); + return self; +} + + +TreeMapTests* tree_map_tests_new (void) { + return tree_map_tests_construct (TYPE_TREE_MAP_TESTS); +} + + +static void tree_map_tests_real_set_up (GeeTestCase* base) { + TreeMapTests * self; + GeeTreeMap* _tmp0_; + self = (TreeMapTests*) base; + _tmp0_ = gee_tree_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); + _g_object_unref0 (((MapTests*) self)->test_map); + ((MapTests*) self)->test_map = (GeeMap*) _tmp0_; +} + + +static void tree_map_tests_real_tear_down (GeeTestCase* base) { + TreeMapTests * self; + self = (TreeMapTests*) base; + _g_object_unref0 (((MapTests*) self)->test_map); + ((MapTests*) self)->test_map = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void tree_map_tests_test_selected_functions (TreeMapTests* self) { + GeeMap* _tmp0_; + GeeTreeMap* _tmp1_; + GeeTreeMap* test_tree_map; + GCompareFunc _tmp2_; + GCompareFunc _tmp3_; + GCompareFunc _tmp4_; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + GEqualFunc _tmp7_; + g_return_if_fail (self != NULL); + _tmp0_ = ((MapTests*) self)->test_map; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_TREE_MAP) ? ((GeeTreeMap*) _tmp0_) : NULL); + test_tree_map = _tmp1_; + _vala_assert (test_tree_map != NULL, "test_tree_map != null"); + _tmp2_ = gee_tree_map_get_key_compare_func (test_tree_map); + _tmp3_ = _tmp2_; + _tmp4_ = g_strcmp0; + _vala_assert (_tmp3_ == ((GCompareFunc) _tmp4_), "test_tree_map.key_compare_func == (CompareFunc) strcmp"); + _tmp5_ = gee_tree_map_get_value_equal_func (test_tree_map); + _tmp6_ = _tmp5_; + _tmp7_ = g_str_equal; + _vala_assert (_tmp6_ == _tmp7_, "test_tree_map.value_equal_func == str_equal"); + _g_object_unref0 (test_tree_map); +} + + +void tree_map_tests_test_gobject_properties (TreeMapTests* self) { + GeeMap* _tmp0_; + GeeTreeMap* _tmp1_; + GeeTreeMap* test_tree_map; + GValue value = {0}; + GValue _tmp2_ = {0}; + GValue _tmp3_; + void* _tmp4_ = NULL; + GCompareFunc _tmp5_; + GCompareFunc _tmp6_; + GValue _tmp7_ = {0}; + GValue _tmp8_; + void* _tmp9_ = NULL; + GEqualFunc _tmp10_; + GEqualFunc _tmp11_; + g_return_if_fail (self != NULL); + _tmp0_ = ((MapTests*) self)->test_map; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_TREE_MAP) ? ((GeeTreeMap*) _tmp0_) : NULL); + test_tree_map = _tmp1_; + _vala_assert (test_tree_map != NULL, "test_tree_map != null"); + g_value_init (&_tmp2_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp2_; + _tmp3_ = value; + g_object_get_property ((GObject*) test_tree_map, "key-compare-func", &value); + _tmp4_ = g_value_get_pointer (&value); + _tmp5_ = gee_tree_map_get_key_compare_func (test_tree_map); + _tmp6_ = _tmp5_; + _vala_assert (_tmp4_ == ((void*) _tmp6_), "value.get_pointer () == (void*) test_tree_map.key_compare_func"); + g_value_unset (&value); + g_value_init (&_tmp7_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp7_; + _tmp8_ = value; + g_object_get_property ((GObject*) test_tree_map, "value-equal-func", &value); + _tmp9_ = g_value_get_pointer (&value); + _tmp10_ = gee_tree_map_get_value_equal_func (test_tree_map); + _tmp11_ = _tmp10_; + _vala_assert (_tmp9_ == ((void*) _tmp11_), "value.get_pointer () == (void*) test_tree_map.value_equal_func"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + _g_object_unref0 (test_tree_map); +} + + +void tree_map_tests_test_key_ordering (TreeMapTests* self) { + GeeMap* _tmp0_; + GeeTreeMap* _tmp1_; + GeeTreeMap* test_tree_map; + GeeSet* _tmp2_; + GeeSet* _tmp3_; + GeeSet* _tmp4_; + GeeIterator* _tmp5_ = NULL; + GeeIterator* _tmp6_; + GeeIterator* iterator; + gboolean _tmp7_ = FALSE; + gpointer _tmp8_ = NULL; + gchar* _tmp9_; + gboolean _tmp10_ = FALSE; + gpointer _tmp11_ = NULL; + gchar* _tmp12_; + gboolean _tmp13_ = FALSE; + gpointer _tmp14_ = NULL; + gchar* _tmp15_; + gboolean _tmp16_ = FALSE; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + gboolean _tmp19_ = FALSE; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + gboolean _tmp22_ = FALSE; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + gboolean _tmp25_ = FALSE; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + gboolean _tmp28_ = FALSE; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + gboolean _tmp31_ = FALSE; + gpointer _tmp32_ = NULL; + gchar* _tmp33_; + gboolean _tmp34_ = FALSE; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + gboolean _tmp37_ = FALSE; + gpointer _tmp38_ = NULL; + gchar* _tmp39_; + gboolean _tmp40_ = FALSE; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + gboolean _tmp43_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((MapTests*) self)->test_map; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_TREE_MAP) ? ((GeeTreeMap*) _tmp0_) : NULL); + test_tree_map = _tmp1_; + _vala_assert (test_tree_map != NULL, "test_tree_map != null"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "one", "one"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "two", "two"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "three", "three"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "four", "four"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "five", "five"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "six", "six"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "seven", "seven"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "eight", "eight"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "nine", "nine"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "ten", "ten"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "eleven", "eleven"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "twelve", "twelve"); + _tmp2_ = gee_abstract_map_get_keys ((GeeMap*) test_tree_map); + _tmp3_ = _tmp2_; + _tmp4_ = _tmp3_; + _tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_); + _tmp6_ = _tmp5_; + _g_object_unref0 (_tmp4_); + iterator = _tmp6_; + _tmp7_ = gee_iterator_next (iterator); + _vala_assert (_tmp7_, "iterator.next ()"); + _tmp8_ = gee_iterator_get (iterator); + _tmp9_ = (gchar*) _tmp8_; + _vala_assert (g_strcmp0 (_tmp9_, "eight") == 0, "iterator.get () == \"eight\""); + _g_free0 (_tmp9_); + _tmp10_ = gee_iterator_next (iterator); + _vala_assert (_tmp10_, "iterator.next ()"); + _tmp11_ = gee_iterator_get (iterator); + _tmp12_ = (gchar*) _tmp11_; + _vala_assert (g_strcmp0 (_tmp12_, "eleven") == 0, "iterator.get () == \"eleven\""); + _g_free0 (_tmp12_); + _tmp13_ = gee_iterator_next (iterator); + _vala_assert (_tmp13_, "iterator.next ()"); + _tmp14_ = gee_iterator_get (iterator); + _tmp15_ = (gchar*) _tmp14_; + _vala_assert (g_strcmp0 (_tmp15_, "five") == 0, "iterator.get () == \"five\""); + _g_free0 (_tmp15_); + _tmp16_ = gee_iterator_next (iterator); + _vala_assert (_tmp16_, "iterator.next ()"); + _tmp17_ = gee_iterator_get (iterator); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "four") == 0, "iterator.get () == \"four\""); + _g_free0 (_tmp18_); + _tmp19_ = gee_iterator_next (iterator); + _vala_assert (_tmp19_, "iterator.next ()"); + _tmp20_ = gee_iterator_get (iterator); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "nine") == 0, "iterator.get () == \"nine\""); + _g_free0 (_tmp21_); + _tmp22_ = gee_iterator_next (iterator); + _vala_assert (_tmp22_, "iterator.next ()"); + _tmp23_ = gee_iterator_get (iterator); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp24_); + _tmp25_ = gee_iterator_next (iterator); + _vala_assert (_tmp25_, "iterator.next ()"); + _tmp26_ = gee_iterator_get (iterator); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "seven") == 0, "iterator.get () == \"seven\""); + _g_free0 (_tmp27_); + _tmp28_ = gee_iterator_next (iterator); + _vala_assert (_tmp28_, "iterator.next ()"); + _tmp29_ = gee_iterator_get (iterator); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "six") == 0, "iterator.get () == \"six\""); + _g_free0 (_tmp30_); + _tmp31_ = gee_iterator_next (iterator); + _vala_assert (_tmp31_, "iterator.next ()"); + _tmp32_ = gee_iterator_get (iterator); + _tmp33_ = (gchar*) _tmp32_; + _vala_assert (g_strcmp0 (_tmp33_, "ten") == 0, "iterator.get () == \"ten\""); + _g_free0 (_tmp33_); + _tmp34_ = gee_iterator_next (iterator); + _vala_assert (_tmp34_, "iterator.next ()"); + _tmp35_ = gee_iterator_get (iterator); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "three") == 0, "iterator.get () == \"three\""); + _g_free0 (_tmp36_); + _tmp37_ = gee_iterator_next (iterator); + _vala_assert (_tmp37_, "iterator.next ()"); + _tmp38_ = gee_iterator_get (iterator); + _tmp39_ = (gchar*) _tmp38_; + _vala_assert (g_strcmp0 (_tmp39_, "twelve") == 0, "iterator.get () == \"twelve\""); + _g_free0 (_tmp39_); + _tmp40_ = gee_iterator_next (iterator); + _vala_assert (_tmp40_, "iterator.next ()"); + _tmp41_ = gee_iterator_get (iterator); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (g_strcmp0 (_tmp42_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp42_); + _tmp43_ = gee_iterator_next (iterator); + _vala_assert (_tmp43_ == FALSE, "iterator.next () == false"); + _g_object_unref0 (iterator); + _g_object_unref0 (test_tree_map); +} + + +static void tree_map_tests_class_init (TreeMapTestsClass * klass) { + tree_map_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = tree_map_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = tree_map_tests_real_tear_down; +} + + +static void tree_map_tests_instance_init (TreeMapTests * self) { +} + + +GType tree_map_tests_get_type (void) { + static volatile gsize tree_map_tests_type_id__volatile = 0; + if (g_once_init_enter (&tree_map_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (TreeMapTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tree_map_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TreeMapTests), 0, (GInstanceInitFunc) tree_map_tests_instance_init, NULL }; + GType tree_map_tests_type_id; + tree_map_tests_type_id = g_type_register_static (TYPE_MAP_TESTS, "TreeMapTests", &g_define_type_info, 0); + g_once_init_leave (&tree_map_tests_type_id__volatile, tree_map_tests_type_id); + } + return tree_map_tests_type_id__volatile; +} + + + diff --git a/tests/testtreemap.vala b/tests/testtreemap.vala new file mode 100644 index 0000000..993c67e --- /dev/null +++ b/tests/testtreemap.vala @@ -0,0 +1,118 @@ +/* testtreemap.vala + * + * Copyright (C) 2008 Maciej Piechotka + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Julien Peeters + */ + +using Gee; + +public class TreeMapTests : MapTests { + + public TreeMapTests () { + base ("TreeMap"); + add_test ("[TreeMap] selected functions", test_selected_functions); + add_test ("[TreeMap] GObject properties", test_gobject_properties); + add_test ("[TreeMap] key ordering", test_key_ordering); + } + + public override void set_up () { + test_map = new TreeMap (); + } + + public override void tear_down () { + test_map = null; + } + + public void test_selected_functions () { + var test_tree_map = test_map as TreeMap; + + // Check the map exists + assert (test_tree_map != null); + + // Check the selected compare and equal functions + assert (test_tree_map.key_compare_func == (CompareFunc) strcmp); + assert (test_tree_map.value_equal_func == str_equal); + } + + public new void test_gobject_properties () { + var test_tree_map = test_map as TreeMap; + + // Check the list exists + assert (test_tree_map != null); + Value value; + + value = Value (typeof (CompareFunc)); + test_tree_map.get_property ("key-compare-func", ref value); + assert (value.get_pointer () == (void*) test_tree_map.key_compare_func); + value.unset (); + + value = Value (typeof (EqualFunc)); + test_tree_map.get_property ("value-equal-func", ref value); + assert (value.get_pointer () == (void*) test_tree_map.value_equal_func); + value.unset (); + } + + public void test_key_ordering () { + var test_tree_map = test_map as TreeMap; + + // Check the map exists + assert (test_tree_map != null); + + test_tree_map.set ("one", "one"); + test_tree_map.set ("two", "two"); + test_tree_map.set ("three", "three"); + test_tree_map.set ("four", "four"); + test_tree_map.set ("five", "five"); + test_tree_map.set ("six", "six"); + test_tree_map.set ("seven", "seven"); + test_tree_map.set ("eight", "eight"); + test_tree_map.set ("nine", "nine"); + test_tree_map.set ("ten", "ten"); + test_tree_map.set ("eleven", "eleven"); + test_tree_map.set ("twelve", "twelve"); + + Iterator iterator = test_tree_map.keys.iterator (); + assert (iterator.next ()); + assert (iterator.get () == "eight"); + assert (iterator.next ()); + assert (iterator.get () == "eleven"); + assert (iterator.next ()); + assert (iterator.get () == "five"); + assert (iterator.next ()); + assert (iterator.get () == "four"); + assert (iterator.next ()); + assert (iterator.get () == "nine"); + assert (iterator.next ()); + assert (iterator.get () == "one"); + assert (iterator.next ()); + assert (iterator.get () == "seven"); + assert (iterator.next ()); + assert (iterator.get () == "six"); + assert (iterator.next ()); + assert (iterator.get () == "ten"); + assert (iterator.next ()); + assert (iterator.get () == "three"); + assert (iterator.next ()); + assert (iterator.get () == "twelve"); + assert (iterator.next ()); + assert (iterator.get () == "two"); + assert (iterator.next () == false); + } +} diff --git a/tests/testtreemultimap.c b/tests/testtreemultimap.c new file mode 100644 index 0000000..6959a1a --- /dev/null +++ b/tests/testtreemultimap.c @@ -0,0 +1,212 @@ +/* testtreemultimap.c generated by valac 0.18.0, the Vala compiler + * generated from testtreemultimap.vala, do not modify */ + +/* testtreemultimap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes Villevalois + * Julien Peeters + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_MULTI_MAP_TESTS (multi_map_tests_get_type ()) +#define MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTests)) +#define MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass)) +#define IS_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_MAP_TESTS)) +#define IS_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_MAP_TESTS)) +#define MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass)) + +typedef struct _MultiMapTests MultiMapTests; +typedef struct _MultiMapTestsClass MultiMapTestsClass; +typedef struct _MultiMapTestsPrivate MultiMapTestsPrivate; + +#define TYPE_TREE_MULTI_MAP_TESTS (tree_multi_map_tests_get_type ()) +#define TREE_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TREE_MULTI_MAP_TESTS, TreeMultiMapTests)) +#define TREE_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TREE_MULTI_MAP_TESTS, TreeMultiMapTestsClass)) +#define IS_TREE_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TREE_MULTI_MAP_TESTS)) +#define IS_TREE_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TREE_MULTI_MAP_TESTS)) +#define TREE_MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TREE_MULTI_MAP_TESTS, TreeMultiMapTestsClass)) + +typedef struct _TreeMultiMapTests TreeMultiMapTests; +typedef struct _TreeMultiMapTestsClass TreeMultiMapTestsClass; +typedef struct _TreeMultiMapTestsPrivate TreeMultiMapTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _MultiMapTests { + GeeTestCase parent_instance; + MultiMapTestsPrivate * priv; + GeeMultiMap* test_multi_map; +}; + +struct _MultiMapTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _TreeMultiMapTests { + MultiMapTests parent_instance; + TreeMultiMapTestsPrivate * priv; +}; + +struct _TreeMultiMapTestsClass { + MultiMapTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer tree_multi_map_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType multi_map_tests_get_type (void) G_GNUC_CONST; +GType tree_multi_map_tests_get_type (void) G_GNUC_CONST; +enum { + TREE_MULTI_MAP_TESTS_DUMMY_PROPERTY +}; +TreeMultiMapTests* tree_multi_map_tests_new (void); +TreeMultiMapTests* tree_multi_map_tests_construct (GType object_type); +MultiMapTests* multi_map_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void tree_multi_map_tests_test_selected_functions (TreeMultiMapTests* self); +static void _tree_multi_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +static void tree_multi_map_tests_real_set_up (GeeTestCase* base); +static void tree_multi_map_tests_real_tear_down (GeeTestCase* base); + + +static void _tree_multi_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + tree_multi_map_tests_test_selected_functions (self); +} + + +TreeMultiMapTests* tree_multi_map_tests_construct (GType object_type) { + TreeMultiMapTests * self = NULL; + self = (TreeMultiMapTests*) multi_map_tests_construct (object_type, "TreeMultiMap"); + gee_test_case_add_test ((GeeTestCase*) self, "[TreeMultiMap] selected functions", _tree_multi_map_tests_test_selected_functions_gee_test_case_test_method, self); + return self; +} + + +TreeMultiMapTests* tree_multi_map_tests_new (void) { + return tree_multi_map_tests_construct (TYPE_TREE_MULTI_MAP_TESTS); +} + + +static void tree_multi_map_tests_real_set_up (GeeTestCase* base) { + TreeMultiMapTests * self; + GeeTreeMultiMap* _tmp0_; + self = (TreeMultiMapTests*) base; + _tmp0_ = gee_tree_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); + _g_object_unref0 (((MultiMapTests*) self)->test_multi_map); + ((MultiMapTests*) self)->test_multi_map = (GeeMultiMap*) _tmp0_; +} + + +static void tree_multi_map_tests_real_tear_down (GeeTestCase* base) { + TreeMultiMapTests * self; + self = (TreeMultiMapTests*) base; + _g_object_unref0 (((MultiMapTests*) self)->test_multi_map); + ((MultiMapTests*) self)->test_multi_map = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void tree_multi_map_tests_test_selected_functions (TreeMultiMapTests* self) { + GeeMultiMap* _tmp0_; + GeeTreeMultiMap* _tmp1_; + GeeTreeMultiMap* test_tree_multi_map; + GCompareFunc _tmp2_; + GCompareFunc _tmp3_; + GCompareFunc _tmp4_; + GCompareFunc _tmp5_; + GCompareFunc _tmp6_; + GCompareFunc _tmp7_; + g_return_if_fail (self != NULL); + _tmp0_ = ((MultiMapTests*) self)->test_multi_map; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_TREE_MULTI_MAP) ? ((GeeTreeMultiMap*) _tmp0_) : NULL); + test_tree_multi_map = _tmp1_; + _vala_assert (test_tree_multi_map != NULL, "test_tree_multi_map != null"); + _tmp2_ = gee_tree_multi_map_get_key_compare_func (test_tree_multi_map); + _tmp3_ = _tmp2_; + _tmp4_ = g_strcmp0; + _vala_assert (_tmp3_ == ((GCompareFunc) _tmp4_), "test_tree_multi_map.key_compare_func == (CompareFunc) strcmp"); + _tmp5_ = gee_tree_multi_map_get_value_compare_func (test_tree_multi_map); + _tmp6_ = _tmp5_; + _tmp7_ = g_strcmp0; + _vala_assert (_tmp6_ == ((GCompareFunc) _tmp7_), "test_tree_multi_map.value_compare_func == (CompareFunc) strcmp"); + _g_object_unref0 (test_tree_multi_map); +} + + +static void tree_multi_map_tests_class_init (TreeMultiMapTestsClass * klass) { + tree_multi_map_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = tree_multi_map_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = tree_multi_map_tests_real_tear_down; +} + + +static void tree_multi_map_tests_instance_init (TreeMultiMapTests * self) { +} + + +GType tree_multi_map_tests_get_type (void) { + static volatile gsize tree_multi_map_tests_type_id__volatile = 0; + if (g_once_init_enter (&tree_multi_map_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (TreeMultiMapTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tree_multi_map_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TreeMultiMapTests), 0, (GInstanceInitFunc) tree_multi_map_tests_instance_init, NULL }; + GType tree_multi_map_tests_type_id; + tree_multi_map_tests_type_id = g_type_register_static (TYPE_MULTI_MAP_TESTS, "TreeMultiMapTests", &g_define_type_info, 0); + g_once_init_leave (&tree_multi_map_tests_type_id__volatile, tree_multi_map_tests_type_id); + } + return tree_multi_map_tests_type_id__volatile; +} + + + diff --git a/tests/testtreemultimap.vala b/tests/testtreemultimap.vala new file mode 100644 index 0000000..34374a9 --- /dev/null +++ b/tests/testtreemultimap.vala @@ -0,0 +1,53 @@ +/* testtreemultimap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter + * Didier 'Ptitjes Villevalois + * Julien Peeters + */ + +using Gee; + +public class TreeMultiMapTests : MultiMapTests { + + public TreeMultiMapTests () { + base ("TreeMultiMap"); + add_test ("[TreeMultiMap] selected functions", test_selected_functions); + } + + public override void set_up () { + test_multi_map = new TreeMultiMap (); + } + + public override void tear_down () { + test_multi_map = null; + } + + private void test_selected_functions () { + var test_tree_multi_map = test_multi_map as TreeMultiMap; + + // Check the map exists + assert (test_tree_multi_map != null); + + // Check the selected compare functions + assert (test_tree_multi_map.key_compare_func == (CompareFunc) strcmp); + assert (test_tree_multi_map.value_compare_func == (CompareFunc) strcmp); + } +} diff --git a/tests/testtreemultiset.c b/tests/testtreemultiset.c new file mode 100644 index 0000000..212111f --- /dev/null +++ b/tests/testtreemultiset.c @@ -0,0 +1,223 @@ +/* testtreemultiset.c generated by valac 0.18.0, the Vala compiler + * generated from testtreemultiset.vala, do not modify */ + +/* testtreemultiset.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_MULTI_SET_TESTS (multi_set_tests_get_type ()) +#define MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_SET_TESTS, MultiSetTests)) +#define MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_SET_TESTS, MultiSetTestsClass)) +#define IS_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_SET_TESTS)) +#define IS_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_SET_TESTS)) +#define MULTI_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_SET_TESTS, MultiSetTestsClass)) + +typedef struct _MultiSetTests MultiSetTests; +typedef struct _MultiSetTestsClass MultiSetTestsClass; +typedef struct _MultiSetTestsPrivate MultiSetTestsPrivate; + +#define TYPE_TREE_MULTI_SET_TESTS (tree_multi_set_tests_get_type ()) +#define TREE_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TREE_MULTI_SET_TESTS, TreeMultiSetTests)) +#define TREE_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TREE_MULTI_SET_TESTS, TreeMultiSetTestsClass)) +#define IS_TREE_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TREE_MULTI_SET_TESTS)) +#define IS_TREE_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TREE_MULTI_SET_TESTS)) +#define TREE_MULTI_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TREE_MULTI_SET_TESTS, TreeMultiSetTestsClass)) + +typedef struct _TreeMultiSetTests TreeMultiSetTests; +typedef struct _TreeMultiSetTestsClass TreeMultiSetTestsClass; +typedef struct _TreeMultiSetTestsPrivate TreeMultiSetTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _MultiSetTests { + CollectionTests parent_instance; + MultiSetTestsPrivate * priv; +}; + +struct _MultiSetTestsClass { + CollectionTestsClass parent_class; +}; + +struct _TreeMultiSetTests { + MultiSetTests parent_instance; + TreeMultiSetTestsPrivate * priv; +}; + +struct _TreeMultiSetTestsClass { + MultiSetTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer tree_multi_set_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType multi_set_tests_get_type (void) G_GNUC_CONST; +GType tree_multi_set_tests_get_type (void) G_GNUC_CONST; +enum { + TREE_MULTI_SET_TESTS_DUMMY_PROPERTY +}; +TreeMultiSetTests* tree_multi_set_tests_new (void); +TreeMultiSetTests* tree_multi_set_tests_construct (GType object_type); +MultiSetTests* multi_set_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void tree_multi_set_tests_test_selected_functions (TreeMultiSetTests* self); +static void _tree_multi_set_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +static void tree_multi_set_tests_real_set_up (GeeTestCase* base); +static void tree_multi_set_tests_real_tear_down (GeeTestCase* base); + + +static void _tree_multi_set_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + tree_multi_set_tests_test_selected_functions (self); +} + + +TreeMultiSetTests* tree_multi_set_tests_construct (GType object_type) { + TreeMultiSetTests * self = NULL; + self = (TreeMultiSetTests*) multi_set_tests_construct (object_type, "TreeMultiSet"); + gee_test_case_add_test ((GeeTestCase*) self, "[TreeMultiSet] selected functions", _tree_multi_set_tests_test_selected_functions_gee_test_case_test_method, self); + return self; +} + + +TreeMultiSetTests* tree_multi_set_tests_new (void) { + return tree_multi_set_tests_construct (TYPE_TREE_MULTI_SET_TESTS); +} + + +static void tree_multi_set_tests_real_set_up (GeeTestCase* base) { + TreeMultiSetTests * self; + GeeTreeMultiSet* _tmp0_; + self = (TreeMultiSetTests*) base; + _tmp0_ = gee_tree_multi_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; +} + + +static void tree_multi_set_tests_real_tear_down (GeeTestCase* base) { + TreeMultiSetTests * self; + self = (TreeMultiSetTests*) base; + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void tree_multi_set_tests_test_selected_functions (TreeMultiSetTests* self) { + GeeCollection* _tmp0_; + GeeTreeMultiSet* _tmp1_; + GeeTreeMultiSet* test_multi_set; + GCompareFunc _tmp2_; + GCompareFunc _tmp3_; + GCompareFunc _tmp4_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_TREE_MULTI_SET) ? ((GeeTreeMultiSet*) _tmp0_) : NULL); + test_multi_set = _tmp1_; + _vala_assert (test_multi_set != NULL, "test_multi_set != null"); + _tmp2_ = gee_tree_multi_set_get_compare_func (test_multi_set); + _tmp3_ = _tmp2_; + _tmp4_ = g_strcmp0; + _vala_assert (_tmp3_ == ((GCompareFunc) _tmp4_), "test_multi_set.compare_func == (CompareFunc) strcmp"); + _g_object_unref0 (test_multi_set); +} + + +static void tree_multi_set_tests_class_init (TreeMultiSetTestsClass * klass) { + tree_multi_set_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = tree_multi_set_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = tree_multi_set_tests_real_tear_down; +} + + +static void tree_multi_set_tests_instance_init (TreeMultiSetTests * self) { +} + + +GType tree_multi_set_tests_get_type (void) { + static volatile gsize tree_multi_set_tests_type_id__volatile = 0; + if (g_once_init_enter (&tree_multi_set_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (TreeMultiSetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tree_multi_set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TreeMultiSetTests), 0, (GInstanceInitFunc) tree_multi_set_tests_instance_init, NULL }; + GType tree_multi_set_tests_type_id; + tree_multi_set_tests_type_id = g_type_register_static (TYPE_MULTI_SET_TESTS, "TreeMultiSetTests", &g_define_type_info, 0); + g_once_init_leave (&tree_multi_set_tests_type_id__volatile, tree_multi_set_tests_type_id); + } + return tree_multi_set_tests_type_id__volatile; +} + + + diff --git a/tests/testtreemultiset.vala b/tests/testtreemultiset.vala new file mode 100644 index 0000000..da86ca2 --- /dev/null +++ b/tests/testtreemultiset.vala @@ -0,0 +1,49 @@ +/* testtreemultiset.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +using Gee; + +public class TreeMultiSetTests : MultiSetTests { + + public TreeMultiSetTests () { + base ("TreeMultiSet"); + add_test ("[TreeMultiSet] selected functions", test_selected_functions); + } + + public override void set_up () { + test_collection = new TreeMultiSet (); + } + + public override void tear_down () { + test_collection = null; + } + + private void test_selected_functions () { + var test_multi_set = test_collection as TreeMultiSet; + + // Check the collection exists + assert (test_multi_set != null); + + // Check the selected compare functions + assert (test_multi_set.compare_func == (CompareFunc) strcmp); + } +} diff --git a/tests/testtreeset.c b/tests/testtreeset.c new file mode 100644 index 0000000..81d757b --- /dev/null +++ b/tests/testtreeset.c @@ -0,0 +1,720 @@ +/* testtreeset.c generated by valac 0.18.0, the Vala compiler + * generated from testtreeset.vala, do not modify */ + +/* testtreeset.vala + * + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + * Julien Peeters + */ + +#include +#include +#include +#include +#include + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_SET_TESTS (set_tests_get_type ()) +#define SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SET_TESTS, SetTests)) +#define SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SET_TESTS, SetTestsClass)) +#define IS_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SET_TESTS)) +#define IS_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SET_TESTS)) +#define SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SET_TESTS, SetTestsClass)) + +typedef struct _SetTests SetTests; +typedef struct _SetTestsClass SetTestsClass; +typedef struct _SetTestsPrivate SetTestsPrivate; + +#define TYPE_SORTED_SET_TESTS (sorted_set_tests_get_type ()) +#define SORTED_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SORTED_SET_TESTS, SortedSetTests)) +#define SORTED_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SORTED_SET_TESTS, SortedSetTestsClass)) +#define IS_SORTED_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SORTED_SET_TESTS)) +#define IS_SORTED_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SORTED_SET_TESTS)) +#define SORTED_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SORTED_SET_TESTS, SortedSetTestsClass)) + +typedef struct _SortedSetTests SortedSetTests; +typedef struct _SortedSetTestsClass SortedSetTestsClass; +typedef struct _SortedSetTestsPrivate SortedSetTestsPrivate; + +#define TYPE_TREE_SET_TESTS (tree_set_tests_get_type ()) +#define TREE_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TREE_SET_TESTS, TreeSetTests)) +#define TREE_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TREE_SET_TESTS, TreeSetTestsClass)) +#define IS_TREE_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TREE_SET_TESTS)) +#define IS_TREE_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TREE_SET_TESTS)) +#define TREE_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TREE_SET_TESTS, TreeSetTestsClass)) + +typedef struct _TreeSetTests TreeSetTests; +typedef struct _TreeSetTestsClass TreeSetTestsClass; +typedef struct _TreeSetTestsPrivate TreeSetTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _SetTests { + CollectionTests parent_instance; + SetTestsPrivate * priv; +}; + +struct _SetTestsClass { + CollectionTestsClass parent_class; + void (*test_duplicates_are_ignored) (SetTests* self); +}; + +struct _SortedSetTests { + SetTests parent_instance; + SortedSetTestsPrivate * priv; +}; + +struct _SortedSetTestsClass { + SetTestsClass parent_class; +}; + +struct _TreeSetTests { + SortedSetTests parent_instance; + TreeSetTestsPrivate * priv; +}; + +struct _TreeSetTestsClass { + SortedSetTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer tree_set_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType set_tests_get_type (void) G_GNUC_CONST; +GType sorted_set_tests_get_type (void) G_GNUC_CONST; +GType tree_set_tests_get_type (void) G_GNUC_CONST; +enum { + TREE_SET_TESTS_DUMMY_PROPERTY +}; +TreeSetTests* tree_set_tests_new (void); +TreeSetTests* tree_set_tests_construct (GType object_type); +SortedSetTests* sorted_set_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void tree_set_tests_test_selected_functions (TreeSetTests* self); +static void _tree_set_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +void tree_set_tests_test_gobject_properties (TreeSetTests* self); +static void _tree_set_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +void tree_set_tests_test_add_remove (TreeSetTests* self); +static void _tree_set_tests_test_add_remove_gee_test_case_test_method (gpointer self); +static void tree_set_tests_real_set_up (GeeTestCase* base); +static void tree_set_tests_real_tear_down (GeeTestCase* base); +void collection_tests_test_remove_all (CollectionTests* self); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); + + +static void _tree_set_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + tree_set_tests_test_selected_functions (self); +} + + +static void _tree_set_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + tree_set_tests_test_gobject_properties (self); +} + + +static void _tree_set_tests_test_add_remove_gee_test_case_test_method (gpointer self) { + tree_set_tests_test_add_remove (self); +} + + +TreeSetTests* tree_set_tests_construct (GType object_type) { + TreeSetTests * self = NULL; + self = (TreeSetTests*) sorted_set_tests_construct (object_type, "TreeSet"); + gee_test_case_add_test ((GeeTestCase*) self, "[TreeSet] selected functions", _tree_set_tests_test_selected_functions_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[TreeSet] GObject properties", _tree_set_tests_test_gobject_properties_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[TreeSet] add and remove", _tree_set_tests_test_add_remove_gee_test_case_test_method, self); + return self; +} + + +TreeSetTests* tree_set_tests_new (void) { + return tree_set_tests_construct (TYPE_TREE_SET_TESTS); +} + + +static void tree_set_tests_real_set_up (GeeTestCase* base) { + TreeSetTests * self; + GeeTreeSet* _tmp0_; + self = (TreeSetTests*) base; + _tmp0_ = gee_tree_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; +} + + +static void tree_set_tests_real_tear_down (GeeTestCase* base) { + TreeSetTests * self; + self = (TreeSetTests*) base; + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void tree_set_tests_test_selected_functions (TreeSetTests* self) { + GeeCollection* _tmp0_; + GeeTreeSet* _tmp1_; + GeeTreeSet* test_set; + GCompareFunc _tmp2_; + GCompareFunc _tmp3_; + GCompareFunc _tmp4_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_TREE_SET) ? ((GeeTreeSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _vala_assert (test_set != NULL, "test_set != null"); + _tmp2_ = gee_tree_set_get_compare_func (test_set); + _tmp3_ = _tmp2_; + _tmp4_ = g_strcmp0; + _vala_assert (_tmp3_ == ((GCompareFunc) _tmp4_), "test_set.compare_func == (CompareFunc) strcmp"); + _g_object_unref0 (test_set); +} + + +void tree_set_tests_test_gobject_properties (TreeSetTests* self) { + GeeCollection* _tmp0_; + GeeTreeSet* _tmp1_; + GeeTreeSet* test_set; + GValue value = {0}; + GValue _tmp2_ = {0}; + GValue _tmp3_; + void* _tmp4_ = NULL; + GCompareFunc _tmp5_; + GCompareFunc _tmp6_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_TREE_SET) ? ((GeeTreeSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _vala_assert (test_set != NULL, "test_set != null"); + g_value_init (&_tmp2_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp2_; + _tmp3_ = value; + g_object_get_property ((GObject*) test_set, "compare-func", &value); + _tmp4_ = g_value_get_pointer (&value); + _tmp5_ = gee_tree_set_get_compare_func (test_set); + _tmp6_ = _tmp5_; + _vala_assert (_tmp4_ == ((void*) _tmp6_), "value.get_pointer () == (void*) test_set.compare_func"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + _g_object_unref0 (test_set); +} + + +void tree_set_tests_test_add_remove (TreeSetTests* self) { + GeeCollection* _tmp0_; + GeeTreeSet* _tmp1_; + GeeTreeSet* test_set; + GeeTreeSet* _tmp2_; + gchar* _tmp3_; + gchar* _tmp4_; + gchar* _tmp5_; + gchar* _tmp6_; + gchar* _tmp7_; + gchar* _tmp8_; + gchar* _tmp9_; + gchar* _tmp10_; + gchar* _tmp11_; + gchar* _tmp12_; + gchar* _tmp13_; + gchar* _tmp14_; + gchar* _tmp15_; + gchar* _tmp16_; + gchar* _tmp17_; + gchar* _tmp18_; + gchar** _tmp19_ = NULL; + gchar** to_add; + gint to_add_length1; + gint _to_add_size_; + gchar* _tmp20_; + gchar* _tmp21_; + gchar* _tmp22_; + gchar* _tmp23_; + gchar* _tmp24_; + gchar* _tmp25_; + gchar* _tmp26_; + gchar* _tmp27_; + gchar* _tmp28_; + gchar* _tmp29_; + gchar* _tmp30_; + gchar* _tmp31_; + gchar* _tmp32_; + gchar* _tmp33_; + gchar* _tmp34_; + gchar* _tmp35_; + gchar** _tmp36_ = NULL; + gchar** to_remove; + gint to_remove_length1; + gint _to_remove_size_; + gchar** _tmp37_; + gint _tmp37__length1; + gchar** _tmp48_; + gint _tmp48__length1; + gchar* _tmp59_; + gchar* _tmp60_; + gchar* _tmp61_; + gchar* _tmp62_; + gchar* _tmp63_; + gchar* _tmp64_; + gchar* _tmp65_; + gchar* _tmp66_; + gchar* _tmp67_; + gchar* _tmp68_; + gchar* _tmp69_; + gchar* _tmp70_; + gchar* _tmp71_; + gchar* _tmp72_; + gchar* _tmp73_; + gchar* _tmp74_; + gchar** _tmp75_ = NULL; + gchar* _tmp76_; + gchar* _tmp77_; + gchar* _tmp78_; + gchar* _tmp79_; + gchar* _tmp80_; + gchar* _tmp81_; + gchar* _tmp82_; + gchar* _tmp83_; + gchar* _tmp84_; + gchar* _tmp85_; + gchar* _tmp86_; + gchar* _tmp87_; + gchar* _tmp88_; + gchar* _tmp89_; + gchar* _tmp90_; + gchar* _tmp91_; + gchar** _tmp92_ = NULL; + gchar** _tmp93_; + gint _tmp93__length1; + gchar** _tmp104_; + gint _tmp104__length1; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_TREE_SET) ? ((GeeTreeSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = test_set; + _vala_assert (_tmp2_ != NULL, "test_set != null"); + collection_tests_test_remove_all ((CollectionTests*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_SORTED_SET_TESTS, SortedSetTests)); + _tmp3_ = g_strdup ("3"); + _tmp4_ = g_strdup ("10"); + _tmp5_ = g_strdup ("5"); + _tmp6_ = g_strdup ("6"); + _tmp7_ = g_strdup ("13"); + _tmp8_ = g_strdup ("8"); + _tmp9_ = g_strdup ("12"); + _tmp10_ = g_strdup ("11"); + _tmp11_ = g_strdup ("1"); + _tmp12_ = g_strdup ("0"); + _tmp13_ = g_strdup ("9"); + _tmp14_ = g_strdup ("2"); + _tmp15_ = g_strdup ("14"); + _tmp16_ = g_strdup ("7"); + _tmp17_ = g_strdup ("15"); + _tmp18_ = g_strdup ("4"); + _tmp19_ = g_new0 (gchar*, 16 + 1); + _tmp19_[0] = _tmp3_; + _tmp19_[1] = _tmp4_; + _tmp19_[2] = _tmp5_; + _tmp19_[3] = _tmp6_; + _tmp19_[4] = _tmp7_; + _tmp19_[5] = _tmp8_; + _tmp19_[6] = _tmp9_; + _tmp19_[7] = _tmp10_; + _tmp19_[8] = _tmp11_; + _tmp19_[9] = _tmp12_; + _tmp19_[10] = _tmp13_; + _tmp19_[11] = _tmp14_; + _tmp19_[12] = _tmp15_; + _tmp19_[13] = _tmp16_; + _tmp19_[14] = _tmp17_; + _tmp19_[15] = _tmp18_; + to_add = _tmp19_; + to_add_length1 = 16; + _to_add_size_ = to_add_length1; + _tmp20_ = g_strdup ("11"); + _tmp21_ = g_strdup ("13"); + _tmp22_ = g_strdup ("1"); + _tmp23_ = g_strdup ("12"); + _tmp24_ = g_strdup ("4"); + _tmp25_ = g_strdup ("0"); + _tmp26_ = g_strdup ("2"); + _tmp27_ = g_strdup ("5"); + _tmp28_ = g_strdup ("6"); + _tmp29_ = g_strdup ("3"); + _tmp30_ = g_strdup ("14"); + _tmp31_ = g_strdup ("10"); + _tmp32_ = g_strdup ("7"); + _tmp33_ = g_strdup ("15"); + _tmp34_ = g_strdup ("8"); + _tmp35_ = g_strdup ("9"); + _tmp36_ = g_new0 (gchar*, 16 + 1); + _tmp36_[0] = _tmp20_; + _tmp36_[1] = _tmp21_; + _tmp36_[2] = _tmp22_; + _tmp36_[3] = _tmp23_; + _tmp36_[4] = _tmp24_; + _tmp36_[5] = _tmp25_; + _tmp36_[6] = _tmp26_; + _tmp36_[7] = _tmp27_; + _tmp36_[8] = _tmp28_; + _tmp36_[9] = _tmp29_; + _tmp36_[10] = _tmp30_; + _tmp36_[11] = _tmp31_; + _tmp36_[12] = _tmp32_; + _tmp36_[13] = _tmp33_; + _tmp36_[14] = _tmp34_; + _tmp36_[15] = _tmp35_; + to_remove = _tmp36_; + to_remove_length1 = 16; + _to_remove_size_ = to_remove_length1; + _tmp37_ = to_add; + _tmp37__length1 = to_add_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp37_; + s_collection_length1 = _tmp37__length1; + for (s_it = 0; s_it < _tmp37__length1; s_it = s_it + 1) { + gchar* _tmp38_; + gchar* s = NULL; + _tmp38_ = g_strdup (s_collection[s_it]); + s = _tmp38_; + { + GeeTreeSet* _tmp39_; + const gchar* _tmp40_; + gboolean _tmp41_ = FALSE; + GeeTreeSet* _tmp42_; + const gchar* _tmp43_; + gboolean _tmp44_ = FALSE; + GeeTreeSet* _tmp45_; + const gchar* _tmp46_; + gboolean _tmp47_ = FALSE; + _tmp39_ = test_set; + _tmp40_ = s; + _tmp41_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp39_, _tmp40_); + _vala_assert (!_tmp41_, "!test_set.contains (s)"); + _tmp42_ = test_set; + _tmp43_ = s; + _tmp44_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp42_, _tmp43_); + _vala_assert (_tmp44_, "test_set.add (s)"); + _tmp45_ = test_set; + _tmp46_ = s; + _tmp47_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp45_, _tmp46_); + _vala_assert (_tmp47_, "test_set.contains (s)"); + _g_free0 (s); + } + } + } + _tmp48_ = to_remove; + _tmp48__length1 = to_remove_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp48_; + s_collection_length1 = _tmp48__length1; + for (s_it = 0; s_it < _tmp48__length1; s_it = s_it + 1) { + gchar* _tmp49_; + gchar* s = NULL; + _tmp49_ = g_strdup (s_collection[s_it]); + s = _tmp49_; + { + GeeTreeSet* _tmp50_; + const gchar* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeTreeSet* _tmp53_; + const gchar* _tmp54_; + gboolean _tmp55_ = FALSE; + GeeTreeSet* _tmp56_; + const gchar* _tmp57_; + gboolean _tmp58_ = FALSE; + _tmp50_ = test_set; + _tmp51_ = s; + _tmp52_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp50_, _tmp51_); + _vala_assert (_tmp52_, "test_set.contains (s)"); + _tmp53_ = test_set; + _tmp54_ = s; + _tmp55_ = gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp53_, _tmp54_); + _vala_assert (_tmp55_, "test_set.remove (s)"); + _tmp56_ = test_set; + _tmp57_ = s; + _tmp58_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp56_, _tmp57_); + _vala_assert (!_tmp58_, "!test_set.contains (s)"); + _g_free0 (s); + } + } + } + _tmp59_ = g_strdup ("2"); + _tmp60_ = g_strdup ("9"); + _tmp61_ = g_strdup ("13"); + _tmp62_ = g_strdup ("7"); + _tmp63_ = g_strdup ("12"); + _tmp64_ = g_strdup ("14"); + _tmp65_ = g_strdup ("8"); + _tmp66_ = g_strdup ("1"); + _tmp67_ = g_strdup ("5"); + _tmp68_ = g_strdup ("6"); + _tmp69_ = g_strdup ("11"); + _tmp70_ = g_strdup ("15"); + _tmp71_ = g_strdup ("3"); + _tmp72_ = g_strdup ("10"); + _tmp73_ = g_strdup ("0"); + _tmp74_ = g_strdup ("4"); + _tmp75_ = g_new0 (gchar*, 16 + 1); + _tmp75_[0] = _tmp59_; + _tmp75_[1] = _tmp60_; + _tmp75_[2] = _tmp61_; + _tmp75_[3] = _tmp62_; + _tmp75_[4] = _tmp63_; + _tmp75_[5] = _tmp64_; + _tmp75_[6] = _tmp65_; + _tmp75_[7] = _tmp66_; + _tmp75_[8] = _tmp67_; + _tmp75_[9] = _tmp68_; + _tmp75_[10] = _tmp69_; + _tmp75_[11] = _tmp70_; + _tmp75_[12] = _tmp71_; + _tmp75_[13] = _tmp72_; + _tmp75_[14] = _tmp73_; + _tmp75_[15] = _tmp74_; + to_add = (_vala_array_free (to_add, to_add_length1, (GDestroyNotify) g_free), NULL); + to_add = _tmp75_; + to_add_length1 = 16; + _to_add_size_ = to_add_length1; + _tmp76_ = g_strdup ("11"); + _tmp77_ = g_strdup ("10"); + _tmp78_ = g_strdup ("14"); + _tmp79_ = g_strdup ("6"); + _tmp80_ = g_strdup ("13"); + _tmp81_ = g_strdup ("4"); + _tmp82_ = g_strdup ("3"); + _tmp83_ = g_strdup ("15"); + _tmp84_ = g_strdup ("8"); + _tmp85_ = g_strdup ("5"); + _tmp86_ = g_strdup ("7"); + _tmp87_ = g_strdup ("0"); + _tmp88_ = g_strdup ("12"); + _tmp89_ = g_strdup ("2"); + _tmp90_ = g_strdup ("9"); + _tmp91_ = g_strdup ("1"); + _tmp92_ = g_new0 (gchar*, 16 + 1); + _tmp92_[0] = _tmp76_; + _tmp92_[1] = _tmp77_; + _tmp92_[2] = _tmp78_; + _tmp92_[3] = _tmp79_; + _tmp92_[4] = _tmp80_; + _tmp92_[5] = _tmp81_; + _tmp92_[6] = _tmp82_; + _tmp92_[7] = _tmp83_; + _tmp92_[8] = _tmp84_; + _tmp92_[9] = _tmp85_; + _tmp92_[10] = _tmp86_; + _tmp92_[11] = _tmp87_; + _tmp92_[12] = _tmp88_; + _tmp92_[13] = _tmp89_; + _tmp92_[14] = _tmp90_; + _tmp92_[15] = _tmp91_; + to_remove = (_vala_array_free (to_remove, to_remove_length1, (GDestroyNotify) g_free), NULL); + to_remove = _tmp92_; + to_remove_length1 = 16; + _to_remove_size_ = to_remove_length1; + _tmp93_ = to_add; + _tmp93__length1 = to_add_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp93_; + s_collection_length1 = _tmp93__length1; + for (s_it = 0; s_it < _tmp93__length1; s_it = s_it + 1) { + gchar* _tmp94_; + gchar* s = NULL; + _tmp94_ = g_strdup (s_collection[s_it]); + s = _tmp94_; + { + GeeTreeSet* _tmp95_; + const gchar* _tmp96_; + gboolean _tmp97_ = FALSE; + GeeTreeSet* _tmp98_; + const gchar* _tmp99_; + gboolean _tmp100_ = FALSE; + GeeTreeSet* _tmp101_; + const gchar* _tmp102_; + gboolean _tmp103_ = FALSE; + _tmp95_ = test_set; + _tmp96_ = s; + _tmp97_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp95_, _tmp96_); + _vala_assert (!_tmp97_, "!test_set.contains (s)"); + _tmp98_ = test_set; + _tmp99_ = s; + _tmp100_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp98_, _tmp99_); + _vala_assert (_tmp100_, "test_set.add (s)"); + _tmp101_ = test_set; + _tmp102_ = s; + _tmp103_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp101_, _tmp102_); + _vala_assert (_tmp103_, "test_set.contains (s)"); + _g_free0 (s); + } + } + } + _tmp104_ = to_remove; + _tmp104__length1 = to_remove_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp104_; + s_collection_length1 = _tmp104__length1; + for (s_it = 0; s_it < _tmp104__length1; s_it = s_it + 1) { + gchar* _tmp105_; + gchar* s = NULL; + _tmp105_ = g_strdup (s_collection[s_it]); + s = _tmp105_; + { + GeeTreeSet* _tmp106_; + const gchar* _tmp107_; + gboolean _tmp108_ = FALSE; + GeeTreeSet* _tmp109_; + const gchar* _tmp110_; + gboolean _tmp111_ = FALSE; + GeeTreeSet* _tmp112_; + const gchar* _tmp113_; + gboolean _tmp114_ = FALSE; + _tmp106_ = test_set; + _tmp107_ = s; + _tmp108_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp106_, _tmp107_); + _vala_assert (_tmp108_, "test_set.contains (s)"); + _tmp109_ = test_set; + _tmp110_ = s; + _tmp111_ = gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp109_, _tmp110_); + _vala_assert (_tmp111_, "test_set.remove (s)"); + _tmp112_ = test_set; + _tmp113_ = s; + _tmp114_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp112_, _tmp113_); + _vala_assert (!_tmp114_, "!test_set.contains (s)"); + _g_free0 (s); + } + } + } + to_remove = (_vala_array_free (to_remove, to_remove_length1, (GDestroyNotify) g_free), NULL); + to_add = (_vala_array_free (to_add, to_add_length1, (GDestroyNotify) g_free), NULL); + _g_object_unref0 (test_set); +} + + +static void tree_set_tests_class_init (TreeSetTestsClass * klass) { + tree_set_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = tree_set_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = tree_set_tests_real_tear_down; +} + + +static void tree_set_tests_instance_init (TreeSetTests * self) { +} + + +GType tree_set_tests_get_type (void) { + static volatile gsize tree_set_tests_type_id__volatile = 0; + if (g_once_init_enter (&tree_set_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (TreeSetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tree_set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TreeSetTests), 0, (GInstanceInitFunc) tree_set_tests_instance_init, NULL }; + GType tree_set_tests_type_id; + tree_set_tests_type_id = g_type_register_static (TYPE_SORTED_SET_TESTS, "TreeSetTests", &g_define_type_info, 0); + g_once_init_leave (&tree_set_tests_type_id__volatile, tree_set_tests_type_id); + } + return tree_set_tests_type_id__volatile; +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + + diff --git a/tests/testtreeset.vala b/tests/testtreeset.vala new file mode 100644 index 0000000..6d754bc --- /dev/null +++ b/tests/testtreeset.vala @@ -0,0 +1,111 @@ +/* testtreeset.vala + * + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois + * Julien Peeters + */ + +using Gee; + +public class TreeSetTests : SortedSetTests { + + public TreeSetTests () { + base ("TreeSet"); + add_test ("[TreeSet] selected functions", test_selected_functions); + add_test ("[TreeSet] GObject properties", test_gobject_properties); + add_test ("[TreeSet] add and remove", test_add_remove); + } + + public override void set_up () { + test_collection = new TreeSet (); + } + + public override void tear_down () { + test_collection = null; + } + + public void test_selected_functions () { + var test_set = test_collection as TreeSet; + + // Check the set exists + assert (test_set != null); + + // Check the selected compare function + assert (test_set.compare_func == (CompareFunc) strcmp); + } + + public new void test_gobject_properties () { + var test_set = test_collection as TreeSet; + + // Check the set exists + assert (test_set != null); + Value value; + + value = Value (typeof (CompareFunc)); + test_set.get_property ("compare-func", ref value); + assert (value.get_pointer () == (void*) test_set.compare_func); + value.unset (); + } + + public new void test_add_remove () { + var test_set = test_collection as TreeSet; + + // Check the set exists + assert (test_set != null); + + base.test_remove_all (); + + var to_add = new string[] { + "3", "10", "5", "6", "13", "8", "12", "11", "1", "0", "9", "2", "14", "7", "15", "4" + }; + var to_remove = new string[] { + "11", "13", "1", "12", "4", "0", "2", "5", "6", "3", "14", "10", "7", "15", "8", "9" + }; + + foreach (var s in to_add) { + assert (!test_set.contains (s)); + assert (test_set.add (s)); + assert (test_set.contains (s)); + } + foreach (var s in to_remove) { + assert (test_set.contains (s)); + assert (test_set.remove (s)); + + assert (!test_set.contains (s)); + } + + to_add = new string[] { + "2", "9", "13", "7", "12", "14", "8", "1", "5", "6", "11", "15", "3", "10", "0", "4" + }; + to_remove = new string[] { + "11", "10", "14", "6", "13", "4", "3", "15", "8", "5", "7", "0", "12", "2", "9", "1" + }; + + foreach (var s in to_add) { + assert (!test_set.contains (s)); + assert (test_set.add (s)); + assert (test_set.contains (s)); + } + foreach (var s in to_remove) { + assert (test_set.contains (s)); + assert (test_set.remove (s)); + assert (!test_set.contains (s)); + } + } +} -- 2.7.4