git-svn-id: https://svn.apache.org/repos/asf/activemq/activemq-cpp/tags/activemq-cpp-2.1.1@589815 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/decaf/KEYS b/src/decaf/KEYS
deleted file mode 100644
index 8369607..0000000
--- a/src/decaf/KEYS
+++ /dev/null
@@ -1,102 +0,0 @@
-pub 1024D/CCD6F801 2006-11-15
-uid Nathan Mittler <nathan.mittler@gmail.com>
-sig 3 CCD6F801 2006-11-15 Nathan Mittler <nathan.mittler@gmail.com>
-sub 2048g/F5B8EA6A 2006-11-15
-sig CCD6F801 2006-11-15 Nathan Mittler <nathan.mittler@gmail.com>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1.4.2.2 (FreeBSD)
-
-mQGiBEVbpV0RBADJcRJLaDaspQfYql0ok3H/8FKeosZ5zuy37QLICwB9wpqXkeGI
-QEemsKV+6Y0Tv9KVVyBDvMOYu8ZKdqTOkodf6Qd85ZcyMPXQpavcdhKnSnux8d4K
-CoPJtNRogomxi1G/haGJnXl5s1WlZ4ME5ijnaF2UbPYP+5flIW2iv0movwCgzOOl
-ImfG9K9kxmHDXyKrmr8stCUD/3z8cyrkhQ47twFwhBzMuSKhfhsZR78L/tfVajjl
-BSDzu4MUORnm7nx/cnMge9b1Kt0bFWpcalIbUQP/iGLQSyG49S77JrKEaxonQhQF
-Z7zXZMPkm1Y54t9KSPtpgRrV0GSObKj9slQ5FYabhoE/6RW+zwPvTDgJftmyCSIQ
-znlMA/4uhhuXoYJo0Jus3o2rqbQfj9dcEdL502BqKz2kITCKr+2U8DBAaY5xVGUW
-ETUmueKHSrZSXDqPkL5QeVMuASJVas7VmTheLXk5Kr+kc5/X5Sl10oCZoqSgx6Lq
-81bjcbMrHvFWLOmQG/E0zM10EOWw6fEVaFZQUz504UStZm7JqrQpTmF0aGFuIE1p
-dHRsZXIgPG5hdGhhbi5taXR0bGVyQGdtYWlsLmNvbT6IYAQTEQIAIAUCRVulXQIb
-AwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEMGEfSvM1vgBX+AAnRQbwrVjW+P+
-6ERiJ1ezS8EjJsgXAJ97jIS7CVD+DKp5u4gS4SfidmsxNLkCDQRFW6ViEAgA7ytH
-Cl5uvL7SMuOdt9YRZyR7QkhfgBkkJhIUk2MyKqZ/zXhTS9Qgx/D7ulS4auUjdRNe
-YzzuiFhv5qQS/KQB4Bi+FbvxisaR8fh9Yt+8cHZdUiDHhI49c/qhxyJea1ByJ3AP
-Clyr2aCEYLRb+475rYzp43rQLb7SqboWG4ajVmeEQTPqWwM77XqnTTOyTs4MZEJs
-ZO5by+ud23VOG7EF5VL5l8kgNzN8+HHk0q8KU9G0Cir4XMi8vtMtPqXsDSDTsyQU
-Lu9pEdMznY4m4ozFdnT1vxvy5bfoXtfhYNG+161MZbikuEwcLVknXB5fzyfZNZeq
-LHEDbMo4McR/Y/da7wADBQf9GAm5486yFNc1VeMtUs7JUgJVdMdK1hxtgyMpy6i3
-xKdgReV7Nw6Vk1vKhKD53rLXfy5fk8PycSLKC63A/vhO1mHydW6pXtumILOtYdZw
-9FUNRfZIUTPyqnbPx+PZi3jmkK63qIfu8DFzfjxV9RxjhmRVgrzuBvEKqo5dAHM0
-9JOMwumE8nmYM0jrUt40IAozkLorWxnZZVZx1zsZGsLj4+0V7IurWMEYmWnmd/iF
-nDZi6CggW9om4NJJ72rNAYiEgZjLL9xBBjYplhqMQBHR+pZ8Jl56i78ZA8DfPejx
-LM/E931dZyTMAakFsTnFmRf4+DN+PKF4zd3lQuFhxk17QYhJBBgRAgAJBQJFW6Vi
-AhsMAAoJEMGEfSvM1vgBuWgAnjqmxSJjNF84pGejBbEAgPHYOlWyAJ4vpBTlolF0
-1tcyAF4QTEDQbKvJwg==
-=ssQm
------END PGP PUBLIC KEY BLOCK-----
-pub 1024D/5E4119DD 2007-04-06
-uid Timothy Bish <tabish121@gmail.com>
-sig 3 5E4119DD 2007-04-06 Timothy Bish <tabish121@gmail.com>
-sub 2048g/5D0D0993 2007-04-06
-sig 5E4119DD 2007-04-06 Timothy Bish <tabish121@gmail.com>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1.4.7 (GNU/Linux)
-
-mQGiBEYWrAMRBADIah561RTKg4Fcp9DRzLLz2lPZekB1QefjaJMpuA5hrs5otN+I
-N3DOa4eM1q2Tq4GDoo14qMWv1Xxrp3MQskYIXzFwiju6JUQ92I76BG0qutr4eJPv
-ySIIOUElo96Y+7ye9iWRmBKDjM3mFNpCZsJ+eXJyuYeJ3bPDGR3EE+jkUwCgwjCC
-IUTdsAv2osu0ddJdTgTeicMEAJphtRFabJy5+5B/idMCWQW4RldF4Dus7N+wnWR3
-zkAw77DxQfno4Y29HKFo6omvMM5rM35ZXX58oGwYAhkTUUp47zglmKBCvptKDxOK
-zr+F1lDpulEfP/bOtXE4SkPCVI+FBBSrRPEBOq9JSgZnaJcL9RRVZtIn/hFDHm/h
-DXsKA/9sRQWz6UBfKncju7co+TIqE0hf3SSfCfkFqzhZSmJl/oLR4rbC5xuSppXx
-tQP6YEZahU+6iHbbJeIIkthIO6zqXeK0QThmc6EV5cuhA2PMHUuF/w4XikA38ZSA
-jP5EBLLSTGxQHPfhdUBnV4t8yvooFR1cDjPA5a2dlnw1sX04MrQiVGltb3RoeSBC
-aXNoIDx0YWJpc2gxMjFAZ21haWwuY29tPohgBBMRAgAgBQJGFqwDAhsDBgsJCAcD
-AgQVAggDBBYCAwECHgECF4AACgkQ2iSmy15BGd09RwCffbz/I4fIKFEvnzNV1eXc
-iWIVcAEAn32HrMifDJn1ZC1msgf6gw8gCMwbuQINBEYWrAMQCADwuFOY2t5pClQm
-dNBYG8YsvaRb80FUsNmGxx32EnPv0DljWSzpLtt+JdV0Nm2RVEDXkrqV1fzVMK0v
-Ei2KR0gOwus7E/AmFFG27legqSnlMjqtB+IQyx1VUxtfQIhAR6GZt3chTtgtjSPJ
-uCksKllz9fljIc3nqem4EP63m/w6LkAWuku9zEbBmBeeT9Ac06lxCXBXNlraciRD
-MUpbCraB6zmns2C1/DaiYbK5CHhHYwzHt+M3MZOf7olRBNdl/2I6NCJY0sZwUTrp
-QqYtCSZMOC6pSrsYq0KR5Y+yUTa/VpN3DV8wzTpJbvaBuSc4zz8pQtcS6WoJlrOJ
-Jvx89WCzAAMFCAC/SkYlTw+NVqbhisi8GNqT+Jq9y2q81jpQWVBz/ELaM5mzkBlr
-tVBLLJuB5dazlGMZV5JQ5/COHQ1Z3iw5KIqnRZAnxhn8D0xDsOaT3b2voCWyM9Dp
-BqY1WPvWsTD8oFJPm9y8Wvv8iACzTUIVysG7xCig73a5KbOuNF8cYmYrHqpb6H6U
-oAUFbm0ybwagAIw6eiQuxUPWhlKpx22Le4hS9jmlDO3CQXQCqkqpEIiIsrMeiS4L
-EkaTgGy8AvkLcbzmTF5mbB3nKfiHInTY1rVXhdGM8LLnfKJazhH6AbQwrptJCsnf
-gYpsSlm9oNW4fAvB852SN+zJrly0Jl/+tsdciEkEGBECAAkFAkYWrAMCGwwACgkQ
-2iSmy15BGd0F6QCeLKexEs2tW7uJK5FkSD4c+JGzhdEAoIUj6K6rjNNbbd4gq4L7
-dnc+3S9/
-=ASER
------END PGP PUBLIC KEY BLOCK-----
-pub 1024D/70AE7D08 2007-04-04
-uid Nathan Mittler <nathan.mittler@gmail.com>
-sig 3 70AE7D08 2007-04-04 Nathan Mittler <nathan.mittler@gmail.com>
-sub 1024g/A1255264 2007-04-04
-sig 70AE7D08 2007-04-04 Nathan Mittler <nathan.mittler@gmail.com>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1.4.7 (Darwin)
-
-mQGiBEYTksURBADfn9FYnPKtlRhC0o6ScnPJLePomEpd22F2b8uuC+q+0A6YwvLz
-aDz9k0pEnvFFHdWjTZPUzDXEb4CjRjnoGz5hnZUNG8bJxgkwKt1nUawjYnOgy17b
-ekYmhLtyS2T6jtHx2qIHw/B9Xu0TfHZTBht1H8kFPliteJf46PTxXX3k6wCg9Dls
-YoKoV4cPodpJUiN8AmaKdh8EAKqfQEn4mkwUkBw4Th4KxIl3/YfnNeH4kL1ejp/m
-Pwdf3u7EhEcyCc2i9iNDgvjaUO0SZVD0cJShWq3Us8PT6vAB+WYvk4LWywc6tSTe
-G80Ma0KWX6CXuvFKjlS0K17PqS2G4kb8kUjgSJto/NqC6TBY7/R+X1rrXcx6NtWA
-a/cNBADAGSMJTJGUpPFXBrcncBAlfBLtXVfGGknplyjlfewi7FXopy3K3+otYune
-VHk6V/A/xULLRuGgx+GwytJRTGcNc84tuIDm2iiI4JT4E+a6Ghi5A+xucUpLLi2f
-6OMYDz2QH6IAbLXjSLUcSwW/YNg+1wFotQCKkQR5dmZgghM2PLQpTmF0aGFuIE1p
-dHRsZXIgPG5hdGhhbi5taXR0bGVyQGdtYWlsLmNvbT6IYAQTEQIAIAUCRhOSxQIb
-IwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEII00zVwrn0IlEgAoN+ULhiUYtPx
-MhMGj+i9NOtJqOKoAKDmic8ZTi3HDUpyEsOvV/FeUaBrIbkBDQRGE5LFEAQAt2cH
-aKxpQyewpsCupoC24FIdtPOxtK0fr1pM4n7zyCcjiEFVM5RzylyZg00IRcDxHE6N
-E6n6ydshZ3oM+UabvgltLpeEdJI02p0YccE7FA6iQ80ChMm4bjLUwsBW1Lw2zKza
-oDk0A8PNlmgjwHJi9yrw2nje8QH+aTvvtMj+WucAAwcD/05X6+YplQb4NPjUP7uG
-LzXuGOOS7msDBtqi3zOMzFbfY7H7OtF/SZmDzWDsZiQwq/nlTfernHCKe+/kUHTt
-9pJ7+5cGKFy5chgzVmCbYW6s8+IiaZVFLc5iWASqGhd/a9tEItughEK3pOt3kjud
-o0WcDTFOe9+YGbFAZg8kuMsbiEkEGBECAAkFAkYTksUCGwwACgkQgjTTNXCufQjL
-qQCeKZi8Gs8h9qS511FdlWnV0J6C2U4An0p+wQBKYckIUy5Fif3uWaHsSpa1
-=uYcU
------END PGP PUBLIC KEY BLOCK-----
diff --git a/src/decaf/LICENSE.txt b/src/decaf/LICENSE.txt
deleted file mode 100755
index 6b0b127..0000000
--- a/src/decaf/LICENSE.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
diff --git a/src/decaf/Makefile.am b/src/decaf/Makefile.am
deleted file mode 100644
index 52e34b5..0000000
--- a/src/decaf/Makefile.am
+++ /dev/null
@@ -1,39 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-# Since we don't strictly follow the GNU standard of having 'NEWS README AUTHORS ChangeLog' files
-AUTOMAKE_OPTIONS = foreign
-
-SUBDIRS = src/main src/examples
-if BUILD_CPPUNIT_TESTS
- SUBDIRS += src/test
- SUBDIRS += src/test-benchmarks
-endif
-
-#Distribute these directories:
-DIST_SUBDIRS = src/main
-
-bin_SCRIPTS = decaf-config
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = decaf.pc
-
-ACLOCAL_AMFLAGS = -I m4
-
-include doxygen-include.am
-
-EXTRA_DIST=autogen.sh $(DX_CONFIG) doc/html
diff --git a/src/decaf/NOTICE.txt b/src/decaf/NOTICE.txt
deleted file mode 100644
index 9c0a44e..0000000
--- a/src/decaf/NOTICE.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-=========================================================================
-== NOTICE file corresponding to the section 4 d of ==
-== the Apache License, Version 2.0, ==
-== in this case for the Apache ActiveMQ distribution. ==
-=========================================================================
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
-=========================================================================
-== Doxygen Automake Macro Notice ==
-=========================================================================
-
-This product includes software developed by the Oren Ben-Kiki
-http://ben-kiki.org/oren/doxample/
diff --git a/src/decaf/README.txt b/src/decaf/README.txt
deleted file mode 100644
index 0cc54b9..0000000
--- a/src/decaf/README.txt
+++ /dev/null
@@ -1,197 +0,0 @@
---------------------------------------------------------------------------
-DECAF CPP Library
---------------------------------------------------------------------------
-
-Decaf is a CPP based SDK that provides classes simmilar to that of the
-Java SDK.
-
-
-1 Dependencies
---------------------------------------------------------------------------
-
-1.1 libuuid
---------------------------------------------------------------------------
-
-The build requires the *libuuid* library that is part of the e2fsprogs
-package and is available from http://e2fsprogs.sourceforge.net/ which is
-not always installed by default.
-
-On Fedora, type the following:
-
- sudo yum install e2fsprogs-devel
-
-On Debian/Ubuntu, type the following:
-
- sudo apt-get install uuid-dev
-
-
-1.2 CppUnit
---------------------------------------------------------------------------
-
-The package contains a complete set of CppUnit tests. In order for you to
-build an run the tests, you will need to download and install the CppUnit
-suite. See http://cppunit.sourceforge.net/cppunit-wiki
-
-On Fedora, type the following:
-
- sudo yum install cppunit
-
-On Debian/Ubuntu, type the following:
-
- sudo apt-get install libcppunit-dev
-
-Make sure that the paths to the installed CppUnit library and includes are
-visible in your current shell before you try building the tests.
-
-Windows users will need to build the CppUnit library using the CPPUnit
-MSVC project files. A discussion of the build process can be found
-on the CPPUnit wiki under
-http://cppunit.sourceforge.net/cppunit-wiki/BuildingCppUnit1 this covers
-both MSVC along with many other platforms and tool suites.
-
-
-1.3 GNU Build System (for building on Unix/Linux/OS X/Cygwin)
---------------------------------------------------------------------------
-
-To Generate the ./configure script use to create the Makefiles, you need
-the following software installed:
-
-Tool Recommended Version
--------------------------------
-autoconf >= 2.59
-automake >= 1.9.6
-libtool >= 1.5.22
-
-On Debian/Ubuntu, multiple versions of autoconf and automake are available
-in separate packages. If you have multiple versions of autoconf or automake
-installed on your system, you may have to configure the versions to use
-using /usr/sbin/update-alternatives.
-
-2 Building on Unix/Linux/OS X/Cygwin
---------------------------------------------------------------------------
-
-This assumes you have all of the project dependencies installed. We're
-now ready to create the configure script. To do this, run:
-
- ./autogen.sh
-
- -----------------------------------------------------------------------
- |NOTE: You may see the following warnings when running this command: |
- | |
- | src/test-integration/Makefile.am:44: `CXXFLAGS' is a user variable,|
- |you should not override it; |
- | src/test-integration/Makefile.am:44: use `AM_CXXFLAGS' instead. |
- | src/test/Makefile.am:104: `CXXFLAGS' is a user variable, you |
- |should not override it; |
- | src/test/Makefile.am:104: use `AM_CXXFLAGS' instead. |
- | |
- |These can be ignored. We override CXXFLAGS in the makefiles for |
- |the unit and integration tests in order to suppress compiler |
- |warnings. |
- -----------------------------------------------------------------------
-
-This should be run the first time and anytime you change configure.ac or
-any of the Makefile.am files.
-
- -----------------------------------------------------------------------
- |Solaris 10 Note: CppUnit might not build until you correct the file |
- | libstdc++.la to contain the correct data, see this discussion: |
- | http://forum.sun.com/jive/thread.jspa?threadID=73150 |
- -----------------------------------------------------------------------
-
-The configure script will customize the way the software is built and
-installed into your system along with detecting the available libraries
-that have been installed. To use the default configuration just run:
-
- ./configure
-
-For more help on how to customize the build configuration, run:
-
- ./configure --help
-
-Once the configure script has run successfully, you are ready to build.
-Run:
-
- make
-
-This will build all of the core ActiveMQ CPP source code. To build and
-install the code into the system directories, run:
-
- make install
-
-You will have to become the superuser in order to be able to install the
-files.
-
-3 Doxygen
---------------------------------------------------------------------------
-
-To generate the doxygen documentation for the project, just run:
-
- make doxygen-run
-
-
-4 Running Tests
---------------------------------------------------------------------------
-
-4.1 Unit Tests
---------------------------------------------------------------------------
-In order to build and run the suite of unit tests, run:
-
- make check
-
-This will verify that the library is functioning correctly on the target
-platform. In addition, it will generate the integration tests binary.
-
-4.2 Integration Tests
---------------------------------------------------------------------------
-The library also contains a set of tests that are run against a real AMQ
-broker. These allow you to validate this distribution of ActiveMQ CPP
-against your broker. Running these without a broker will result in failed
-tests. The tests currently hard-code the broker url to be
-tcp://localhost:61613 for stomp and tcp://localhost:61616 for openwire.
-
-The integration tests are built via "make check". To run them, first
-start a broker and then
-
- cd src/test-integration
- ./activemq-test-integration
-
-This will take quite some time to complete, so be patient.
-
-5 Example
---------------------------------------------------------------------------
-There is an example application that ships with the distribution in
-src/examples. The example is compiled by default with the "make"
-command, but can easily be compiled manually using the command:
-
- g++ -o main -pthread -I ../main main.cpp ../../out/libactivemq-cpp-2_0.a -luuid
-
-6 Notes for Windows users
---------------------------------------------------------------------------
-We support using the GNU compiler on Windows, using the Cygwin package.
-However we also support using the MSVC compiler on Windows.
-
-There are a couple or things that you will need to setup to ensure that
-the MSVC compile succeeds.
-
-* You need to download and install the Platform SDK if you don't have it
- installed already.
-
-* Ensure that the path to you MSVC install is set in the PATH env variable.
- You can test this by typing cl.exe at the command line, if you get an
- error complaining that its not found, then you'll need to fix your PATH.
-* Set the INCLUDE env variable to include the path to your MSVC includes,
- and the platform SDK includes. For example:
-
- INCLUDE = D:\Program Files\Microsoft Visual Studio 8\VC\include;D:\Program Files\Microsoft Platform SDK\Include\*
-
-* Set the LIB env variable to include the path to your MSVC libs, and the
- Platform SDK libs. For example:
-
- LIB = D:\Program Files\Microsoft Visual Studio 8\VC\lib;D:\Program Files\Microsoft Platform SDK\Lib
-
-* The Project files reference the CPPUnit libraries for the Integration and
- Unit tests builds. In order for these to build correctly you must
- either place the CPPUnit libraries in a directory listed in the project
- settings, or add a new location for your install of CPPUnit.
-
diff --git a/src/decaf/RELEASE_NOTES.txt b/src/decaf/RELEASE_NOTES.txt
deleted file mode 100644
index 868e340..0000000
--- a/src/decaf/RELEASE_NOTES.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-=========================================================================
-== Release Notes for DECAF 1.0 ==
-=========================================================================
-
-== Overview ==
-== Issues Resolved ==
-
diff --git a/src/decaf/autogen.sh b/src/decaf/autogen.sh
deleted file mode 100755
index 57ea46d..0000000
--- a/src/decaf/autogen.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-#!/bin/sh
-autoreconf --force --install -I config -I m4
diff --git a/src/decaf/configure.ac b/src/decaf/configure.ac
deleted file mode 100644
index c69f5f6..0000000
--- a/src/decaf/configure.ac
+++ /dev/null
@@ -1,171 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-## --------------------------------
-## Initialization macros.
-## --------------------------------
-AC_INIT(decaf, 1, activemq-dev@geronimo.apache.org)
-AC_CONFIG_AUX_DIR(config)
-AC_CONFIG_SRCDIR(src/main/decaf/lang/Thread.cpp)
-
-## -----------------------------------------------
-## Define the Version variables
-## -----------------------------------------------
-DECAF_LIBRARY_NAME=decaf
-DECAF_VERSION=1.0-SNAPSHOT
-DECAF_LIBRARY_VERSION=1:0:0
-DECAF_RELEASE=1.0
-DECAF_API_VERSION=${DECAF_VERSION}
-
-AC_SUBST(DECAF_LIBRARY_NAME)
-AC_SUBST(DECAF_VERSION)
-AC_SUBST(DECAF_LIBRARY_VERSION)
-AC_SUBST(DECAF_RELEASE)
-AC_SUBST(DECAF_API_VERSION)
-
-PACKAGE=$DECAF_LIBRARY_NAME
-VERSION=$DECAF_VERSION
-
-AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
-AM_CONFIG_HEADER(config.h)
-
-# Gives us access to the host_os environment variable
-AC_CANONICAL_HOST
-
-## -----------------------------------------------
-## Checks for programs.
-## -----------------------------------------------
-
-AC_PROG_CC
-AC_PROG_CXX
-AC_LIBTOOL_WIN32_DLL
-AC_PROG_LIBTOOL
-AC_SUBST([LIBTOOL_DEPS])
-
-AM_SANITY_CHECK
-AC_LANG_CPLUSPLUS
-
-AC_C_BIGENDIAN
-AC_CHECK_SIZEOF(short)
-AC_CHECK_SIZEOF(int)
-AC_CHECK_SIZEOF(long)
-
-AC_CHECK_SIZEOF(char, 1)
-AC_CHECK_SIZEOF(short, 2)
-AC_CHECK_SIZEOF(int, 4)
-AC_CHECK_SIZEOF(long long, 8)
-AC_CHECK_SIZEOF(float, 4)
-AC_CHECK_SIZEOF(double, 8)
-
-AC_CHECK_HEADERS([uuid.h uuid/uuid.h], [AC_DEFINE([HAVE_UUID_T], [1], [Define if uuid_t exists.])])
-AC_CHECK_HEADERS([objbase.h])
-AC_CHECK_HEADERS([repcdce.h])
-AC_CHECK_HEADERS([sys/filio.h])
-AC_CHECK_HEADERS([sys/ioctl.h])
-AC_CHECK_HEADERS([sys/select.h])
-AC_CHECK_HEADERS([sys/time.h])
-AC_CHECK_HEADERS([sys/timeb.h])
-AC_CHECK_HEADERS([pthread.h])
-
-AC_CHECK_FUNCS([ioctl select gettimeofday time ftime])
-
-AM_PATH_CPPUNIT(1.10.2, cppunit=yes, cppunit=no; AC_MSG_RESULT([no. Unit and Integration tests disabled]))
-AM_CONDITIONAL(BUILD_CPPUNIT_TESTS, test x$cppunit = xyes)
-
-## find and configure the APR, and ARP Utils
-DECAF_CONFIGURE_APR
-
-PLAT_CXXFLAGS=
-PLAT_LIBS=
-
-case "${host_os}" in
-
- *darwin* ) ## Mac OS X configuration
- PLAT_CXXFLAGS="-ansi -pedantic"
- ;;
-
- *cygwin* ) ## Cygwin configuration
- PLAT_CXXFLAGS="-Wno-uninitialized"
- PLAT_LIBS="-lm -lpthread -luuid -lrpcrt4"
- ;;
-
- *solaris* ) ## Solaris configuration
- AC_CHECK_LIB(pthread, pthread_create,[have_pthread="yes"],
- AC_MSG_ERROR([libpthread not found!]))
-
- PLAT_CXXFLAGS="-ansi -pedantic"
- PLAT_LIBS="-lm -lpthread -luuid -lsocket -lrt"
- ;;
-
- *) ## Unix configuration
-
- AC_CHECK_LIB(pthread, pthread_create,[have_pthread="yes"],
- AC_MSG_ERROR([libpthread not found!]))
-
- PLAT_CXXFLAGS="-ansi -pedantic"
- PLAT_LIBS="-lm -lpthread -luuid"
-esac
-
-## Flags for building the decaf cpp library
-AC_SUBST([DECAF_CXXFLAGS])
-AC_SUBST([DECAF_LIBS])
-DECAF_CXXFLAGS="$PLAT_CXXFLAGS -W -Wall -fPIC -fstrict-aliasing -Wstrict-aliasing=2 -Wno-long-long"
-DECAF_LIBS="$PLAT_LIBS"
-
-## Flags for building the test applications.
-AC_SUBST([DECAF_TEST_CXXFLAGS])
-AC_SUBST([DECAF_TEST_LIBS])
-DECAF_TEST_CXXFLAGS="$DECAF_CXXFLAGS -Wno-non-virtual-dtor -Wno-unused-parameter -Wno-uninitialized"
-DECAF_TEST_LIBS="../main/libdecaf.la"
-
-# Check to see if the compiler supports the visibility flags.
-# If so, define HAVE_VISIBILITY_OPTIONS
-CHECK_VISIBILITY()
-
-## Not all platforms define addrinfo and related functions. If this platform
-## supports addrinfo, defines HAVE_STRUCT_ADDRINFO.
-CHECK_ADDRINFO()
-
-## Execute Doxygen macros
-DX_HTML_FEATURE(ON)
-DX_CHM_FEATURE(OFF)
-DX_CHI_FEATURE(OFF)
-DX_MAN_FEATURE(OFF)
-DX_RTF_FEATURE(OFF)
-DX_XML_FEATURE(OFF)
-DX_PDF_FEATURE(OFF)
-DX_PS_FEATURE(OFF)
-DX_INIT_DOXYGEN(decaf, doxygen.cfg, doc)
-
-## -----------------------------------------------------
-## configuration
-## Generates Makefile's, configuration files and scripts
-## -----------------------------------------------------
-
-AC_CONFIG_FILES(Makefile)
-AC_CONFIG_FILES(decaf.pc)
-AC_CONFIG_FILES(src/main/Makefile)
-AC_CONFIG_FILES(src/examples/Makefile)
-AC_CONFIG_FILES(decaf-config)
-
-if test x$cppunit = xyes
-then
- AC_CONFIG_FILES(src/test/Makefile)
- AC_CONFIG_FILES(src/test-benchmarks/Makefile)
-fi
-
-AC_OUTPUT
diff --git a/src/decaf/decaf-config.in b/src/decaf/decaf-config.in
deleted file mode 100644
index befe745..0000000
--- a/src/decaf/decaf-config.in
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/bin/sh
-
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-exec_prefix_set=no
-includedir=@includedir@
-
-usage()
-{
- cat <<EOF
-Usage: decaf-config [OPTION] ...
-
-Generic options
- --version output Decaf version information.
- --help display this help and exit.
-
-Compilation support options
- --cflags print pre-processor and compiler flags
- --libs print library linking information
-
-Install directories Decaf Library was configured to
- --prefix[=DIR]
- --exec-prefix[=DIR]
-
-EOF
- exit $1
-}
-
-if test $# -eq 0; then
- usage 1 1>&2
-fi
-
-while test $# -gt 0; do
- case "$1" in
- -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- case $1 in
- --prefix=*)
- prefix=$optarg
- if test $exec_prefix_set = no ; then
- exec_prefix=$optarg
- fi
- ;;
- --prefix)
- echo_prefix=yes
- ;;
- --exec-prefix=*)
- exec_prefix=$optarg
- exec_prefix_set=yes
- ;;
- --exec-prefix)
- echo_exec_prefix=yes
- ;;
- --version)
- echo @DECAF_VERSION@
- ;;
- --help)
- usage 0
- ;;
- --cflags)
- echo_cflags=yes
- ;;
- --libs)
- echo_libs=yes
- ;;
- *)
- usage 1 1>&2
- ;;
- esac
- shift
-done
-
-if test "$echo_prefix" = "yes"; then
- echo $prefix
-fi
-
-if test "$echo_exec_prefix" = "yes"; then
- echo $exec_prefix
-fi
-
-if test "$echo_cflags" = "yes"; then
- if test "$includedir" != "/usr/include" ; then
- echo -I$includedir
- fi
-fi
-
-if test "$echo_libs" = "yes"; then
- if test @libdir@ != /usr/lib ; then
- my_linker_flags="-L@libdir@"
- fi
- echo ${my_linker_flags} -ldecaf
-fi
-
-
-
-
diff --git a/src/decaf/decaf.pc.in b/src/decaf/decaf.pc.in
deleted file mode 100644
index 2227142..0000000
--- a/src/decaf/decaf.pc.in
+++ /dev/null
@@ -1,27 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: Decaf C++ Library
-Description: Decaf C++ Java-like API library.
-Version: @VERSION@
-Libs: -L${libdir} -l@DECAF_LIBRARY_NAME@-@DECAF_API_VERSION@ -lpthread -ldl -luuid
-Cflags: -I${includedir}/@DECAF_LIBRARY_NAME@-@DECAF_API_VERSION@ -I${libdir}/@DECAF_LIBRARY_NAME@-@DECAF_API_VERSION@/include
diff --git a/src/decaf/doxygen-include.am b/src/decaf/doxygen-include.am
deleted file mode 100644
index ab87a45..0000000
--- a/src/decaf/doxygen-include.am
+++ /dev/null
@@ -1,203 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-# Copyright (C) 2004 Oren Ben-Kiki
-# This file is distributed under the same terms as the Automake macro files.
-
-# Generate automatic documentation using Doxygen. Goals and variables values
-# are controlled by the various DX_COND_??? conditionals set by autoconf.
-#
-# The provided goals are:
-# doxygen-doc: Generate all doxygen documentation.
-# doxygen-run: Run doxygen, which will generate some of the documentation
-# (HTML, CHM, CHI, MAN, RTF, XML) but will not do the post
-# processing required for the rest of it (PS, PDF, and some MAN).
-# doxygen-man: Rename some doxygen generated man pages.
-# doxygen-ps: Generate doxygen PostScript documentation.
-# doxygen-pdf: Generate doxygen PDF documentation.
-#
-# Note that by default these are not integrated into the automake goals. If
-# doxygen is used to generate man pages, you can achieve this integration by
-# setting man3_MANS to the list of man pages generated and then adding the
-# dependency:
-#
-# $(man3_MANS): doxygen-doc
-#
-# This will cause make to run doxygen and generate all the documentation.
-#
-# The following variable is intended for use in Makefile.am:
-#
-# DX_CLEANFILES = everything to clean.
-#
-# This is usually added to MOSTLYCLEANFILES.
-
-## --------------------------------- ##
-## Format-independent Doxygen rules. ##
-## --------------------------------- ##
-
-if DX_COND_doc
-
-## ------------------------------- ##
-## Rules specific for HTML output. ##
-## ------------------------------- ##
-
-if DX_COND_html
-
-DX_CLEAN_HTML = @DX_DOCDIR@/html
-
-endif DX_COND_html
-
-## ------------------------------ ##
-## Rules specific for CHM output. ##
-## ------------------------------ ##
-
-if DX_COND_chm
-
-DX_CLEAN_CHM = @DX_DOCDIR@/chm
-
-if DX_COND_chi
-
-DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
-
-endif DX_COND_chi
-
-endif DX_COND_chm
-
-## ------------------------------ ##
-## Rules specific for MAN output. ##
-## ------------------------------ ##
-
-if DX_COND_man
-
-DX_CLEAN_MAN = @DX_DOCDIR@/man
-
-endif DX_COND_man
-
-## ------------------------------ ##
-## Rules specific for RTF output. ##
-## ------------------------------ ##
-
-if DX_COND_rtf
-
-DX_CLEAN_RTF = @DX_DOCDIR@/rtf
-
-endif DX_COND_rtf
-
-## ------------------------------ ##
-## Rules specific for XML output. ##
-## ------------------------------ ##
-
-if DX_COND_xml
-
-DX_CLEAN_XML = @DX_DOCDIR@/xml
-
-endif DX_COND_xml
-
-## ----------------------------- ##
-## Rules specific for PS output. ##
-## ----------------------------- ##
-
-if DX_COND_ps
-
-DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
-
-DX_PS_GOAL = doxygen-ps
-
-doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
-
-@DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
- cd @DX_DOCDIR@/latex; \
- rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
- $(DX_LATEX) refman.tex; \
- $(MAKEINDEX_PATH) refman.idx; \
- $(DX_LATEX) refman.tex; \
- countdown=5; \
- while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
- refman.log > /dev/null 2>&1 \
- && test $$countdown -gt 0; do \
- $(DX_LATEX) refman.tex; \
- countdown=`expr $$countdown - 1`; \
- done; \
- $(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
-
-endif DX_COND_ps
-
-## ------------------------------ ##
-## Rules specific for PDF output. ##
-## ------------------------------ ##
-
-if DX_COND_pdf
-
-DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
-
-DX_PDF_GOAL = doxygen-pdf
-
-doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
-
-@DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
- cd @DX_DOCDIR@/latex; \
- rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
- $(DX_PDFLATEX) refman.tex; \
- $(DX_MAKEINDEX) refman.idx; \
- $(DX_PDFLATEX) refman.tex; \
- countdown=5; \
- while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
- refman.log > /dev/null 2>&1 \
- && test $$countdown -gt 0; do \
- $(DX_PDFLATEX) refman.tex; \
- countdown=`expr $$countdown - 1`; \
- done; \
- mv refman.pdf ../@PACKAGE@.pdf
-
-endif DX_COND_pdf
-
-## ------------------------------------------------- ##
-## Rules specific for LaTeX (shared for PS and PDF). ##
-## ------------------------------------------------- ##
-
-if DX_COND_latex
-
-DX_CLEAN_LATEX = @DX_DOCDIR@/latex
-
-endif DX_COND_latex
-
-.PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
-
-.INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
-
-doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
-
-doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
-
-@DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS)
- rm -rf @DX_DOCDIR@
- $(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
-
-DX_CLEANFILES = \
- @DX_DOCDIR@/@PACKAGE@.tag \
- -r \
- $(DX_CLEAN_HTML) \
- $(DX_CLEAN_CHM) \
- $(DX_CLEAN_CHI) \
- $(DX_CLEAN_MAN) \
- $(DX_CLEAN_RTF) \
- $(DX_CLEAN_XML) \
- $(DX_CLEAN_PS) \
- $(DX_CLEAN_PDF) \
- $(DX_CLEAN_LATEX)
-
-endif DX_COND_doc
diff --git a/src/decaf/doxygen.cfg b/src/decaf/doxygen.cfg
deleted file mode 100644
index c7b526a..0000000
--- a/src/decaf/doxygen.cfg
+++ /dev/null
@@ -1,228 +0,0 @@
-# Doxyfile 1.3.7
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = $(PROJECT)-$(VERSION)
-PROJECT_NUMBER =
-OUTPUT_DIRECTORY = $(DOCDIR)
-CREATE_SUBDIRS = NO
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ABBREVIATE_BRIEF =
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-STRIP_FROM_INC_PATH = $(SRCDIR)
-FULL_PATH_NAMES = YES
-STRIP_FROM_PATH = $(SRCDIR)
-SHORT_NAMES = NO
-JAVADOC_AUTOBRIEF = YES
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = YES
-INHERIT_DOCS = YES
-DISTRIBUTE_GROUP_DOC = NO
-TAB_SIZE = 8
-ALIASES =
-OPTIMIZE_OUTPUT_FOR_C = YES
-OPTIMIZE_OUTPUT_JAVA = NO
-SUBGROUPING = YES
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = YES
-EXTRACT_PRIVATE = NO
-EXTRACT_STATIC = NO
-EXTRACT_LOCAL_CLASSES = YES
-EXTRACT_LOCAL_METHODS = NO
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-INTERNAL_DOCS = NO
-CASE_SENSE_NAMES = NO
-HIDE_SCOPE_NAMES = NO
-SHOW_INCLUDE_FILES = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = YES
-SORT_BRIEF_DOCS = NO
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-SHOW_USED_FILES = YES
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = YES
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = YES
-WARN_IF_DOC_ERROR = YES
-WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = $(SRCDIR)
-FILE_PATTERNS = *.c *.h
-RECURSIVE = YES
-EXCLUDE =
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH = $(SRCDIR)
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-VERBATIM_HEADERS = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = NO
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = $(GENERATE_HTML)
-HTML_OUTPUT = html
-HTML_FILE_EXTENSION = .html
-HTML_HEADER =
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = $(GENERATE_CHM)
-CHM_FILE = ../$(PROJECT).chm
-HHC_LOCATION = $(HHC_PATH)
-GENERATE_CHI = $(GENERATE_CHI)
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = YES
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = $(GENERATE_LATEX)
-LATEX_OUTPUT = latex
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = $(PAPER_SIZE)
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = YES
-LATEX_HIDE_INDICES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = $(GENERATE_RTF)
-RTF_OUTPUT = rtf
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = $(GENERATE_MAN)
-MAN_OUTPUT = man
-MAN_EXTENSION = .1
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = $(GENERATE_XML)
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-XML_PROGRAMLISTING = YES
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE = $(DOCDIR)/$(PROJECT).tag
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH = $(PERL_PATH)
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = YES
-HIDE_UNDOC_RELATIONS = YES
-HAVE_DOT = $(HAVE_DOT)
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-UML_LOOK = NO
-TEMPLATE_RELATIONS = NO
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-CALL_GRAPH = NO
-GRAPHICAL_HIERARCHY = YES
-DOT_IMAGE_FORMAT = png
-DOT_PATH = $(DOT_PATH)
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 0
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
diff --git a/src/decaf/m4/ac_doxygen.m4 b/src/decaf/m4/ac_doxygen.m4
deleted file mode 100644
index 5248d71..0000000
--- a/src/decaf/m4/ac_doxygen.m4
+++ /dev/null
@@ -1,324 +0,0 @@
-#
-# Copyright 2007 Oren Ben-Kiki
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-#
-
-
-# Generate automatic documentation using Doxygen. Works in concert with the
-# aminclude.m4 file and a compatible doxygen configuration file. Defines the
-# following public macros:
-#
-# DX_???_FEATURE(ON|OFF) - control the default setting fo a Doxygen feature.
-# Supported features are 'DOXYGEN' itself, 'DOT' for generating graphics,
-# 'HTML' for plain HTML, 'CHM' for compressed HTML help (for MS users), 'CHI'
-# for generating a seperate .chi file by the .chm file, and 'MAN', 'RTF',
-# 'XML', 'PDF' and 'PS' for the appropriate output formats. The environment
-# variable DOXYGEN_PAPER_SIZE may be specified to override the default 'a4wide'
-# paper size.
-#
-# By default, HTML, PDF and PS documentation is generated as this seems to be
-# the most popular and portable combination. MAN pages created by Doxygen are
-# usually problematic, though by picking an appropriate subset and doing some
-# massaging they might be better than nothing. CHM and RTF are specific for MS
-# (note that you can't generate both HTML and CHM at the same time). The XML is
-# rather useless unless you apply specialized post-processing to it.
-#
-# The macro mainly controls the default state of the feature. The use can
-# override the default by specifying --enable or --disable. The macros ensure
-# that contradictory flags are not given (e.g., --enable-doxygen-html and
-# --enable-doxygen-chm, --enable-doxygen-anything with --disable-doxygen, etc.)
-# Finally, each feature will be automatically disabled (with a warning) if the
-# required programs are missing.
-#
-# Once all the feature defaults have been specified, call DX_INIT_DOXYGEN with
-# the following parameters: a one-word name for the project for use as a
-# filename base etc., an optional configuration file name (the default is
-# 'Doxyfile', the same as Doxygen's default), and an optional output directory
-# name (the default is 'doxygen-doc').
-
-## ----------##
-## Defaults. ##
-## ----------##
-
-DX_ENV=""
-AC_DEFUN([DX_FEATURE_doc], ON)
-AC_DEFUN([DX_FEATURE_dot], ON)
-AC_DEFUN([DX_FEATURE_man], OFF)
-AC_DEFUN([DX_FEATURE_html], ON)
-AC_DEFUN([DX_FEATURE_chm], OFF)
-AC_DEFUN([DX_FEATURE_chi], OFF)
-AC_DEFUN([DX_FEATURE_rtf], OFF)
-AC_DEFUN([DX_FEATURE_xml], OFF)
-AC_DEFUN([DX_FEATURE_pdf], ON)
-AC_DEFUN([DX_FEATURE_ps], ON)
-
-## --------------- ##
-## Private macros. ##
-## --------------- ##
-
-# DX_ENV_APPEND(VARIABLE, VALUE)
-# ------------------------------
-# Append VARIABLE="VALUE" to DX_ENV for invoking doxygen.
-AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])])
-
-# DX_DIRNAME_EXPR
-# ---------------
-# Expand into a shell expression prints the directory part of a path.
-AC_DEFUN([DX_DIRNAME_EXPR],
- [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']])
-
-# DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF)
-# -------------------------------------
-# Expands according to the M4 (static) status of the feature.
-AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])])
-
-# DX_REQUIRE_PROG(VARIABLE, PROGRAM)
-# ----------------------------------
-# Require the specified program to be found for the DX_CURRENT_FEATURE to work.
-AC_DEFUN([DX_REQUIRE_PROG], [
-AC_PATH_TOOL([$1], [$2])
-if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then
- AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION])
- AC_SUBST([DX_FLAG_[]DX_CURRENT_FEATURE], 0)
-fi
-])
-
-# DX_TEST_FEATURE(FEATURE)
-# ------------------------
-# Expand to a shell expression testing whether the feature is active.
-AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1])
-
-# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE)
-# -------------------------------------------------
-# Verify that a required features has the right state before trying to turn on
-# the DX_CURRENT_FEATURE.
-AC_DEFUN([DX_CHECK_DEPEND], [
-test "$DX_FLAG_$1" = "$2" \
-|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1,
- requires, contradicts) doxygen-DX_CURRENT_FEATURE])
-])
-
-# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE)
-# ----------------------------------------------------------
-# Turn off the DX_CURRENT_FEATURE if the required feature is off.
-AC_DEFUN([DX_CLEAR_DEPEND], [
-test "$DX_FLAG_$1" = "$2" || AC_SUBST([DX_FLAG_[]DX_CURRENT_FEATURE], 0)
-])
-
-# DX_FEATURE_ARG(FEATURE, DESCRIPTION,
-# CHECK_DEPEND, CLEAR_DEPEND,
-# REQUIRE, DO-IF-ON, DO-IF-OFF)
-# --------------------------------------------
-# Parse the command-line option controlling a feature. CHECK_DEPEND is called
-# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND),
-# otherwise CLEAR_DEPEND is called to turn off the default state if a required
-# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional
-# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and
-# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature.
-AC_DEFUN([DX_ARG_ABLE], [
- AC_DEFUN([DX_CURRENT_FEATURE], [$1])
- AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2])
- AC_ARG_ENABLE(doxygen-$1,
- [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1],
- [--enable-doxygen-$1]),
- DX_IF_FEATURE([$1], [don't $2], [$2]))],
- [
-case "$enableval" in
-#(
-y|Y|yes|Yes|YES)
- AC_SUBST([DX_FLAG_$1], 1)
- $3
-;; #(
-n|N|no|No|NO)
- AC_SUBST([DX_FLAG_$1], 0)
-;; #(
-*)
- AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1])
-;;
-esac
-], [
-AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)])
-$4
-])
-if DX_TEST_FEATURE([$1]); then
- $5
- :
-fi
-if DX_TEST_FEATURE([$1]); then
- AM_CONDITIONAL(DX_COND_$1, :)
- $6
- :
-else
- AM_CONDITIONAL(DX_COND_$1, false)
- $7
- :
-fi
-])
-
-## -------------- ##
-## Public macros. ##
-## -------------- ##
-
-# DX_XXX_FEATURE(DEFAULT_STATE)
-# -----------------------------
-AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])])
-AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])])
-AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])])
-AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])])
-AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])])
-AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])])
-AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
-AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
-AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])])
-AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])])
-
-# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR])
-# ---------------------------------------------------------
-# PROJECT also serves as the base name for the documentation files.
-# The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doxygen-doc".
-AC_DEFUN([DX_INIT_DOXYGEN], [
-
-# Files:
-AC_SUBST([DX_PROJECT], [$1])
-AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])])
-AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])])
-
-# Environment variables used inside doxygen.cfg:
-DX_ENV_APPEND(SRCDIR, $srcdir)
-DX_ENV_APPEND(PROJECT, $DX_PROJECT)
-DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
-DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
-
-# Doxygen itself:
-DX_ARG_ABLE(doc, [generate any doxygen documentation],
- [],
- [],
- [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen)
- DX_REQUIRE_PROG([DX_PERL], perl)],
- [DX_ENV_APPEND(PERL_PATH, $DX_PERL)])
-
-# Dot for graphics:
-DX_ARG_ABLE(dot, [generate graphics for doxygen documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [DX_REQUIRE_PROG([DX_DOT], dot)],
- [DX_ENV_APPEND(HAVE_DOT, YES)
- DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])],
- [DX_ENV_APPEND(HAVE_DOT, NO)])
-
-# Man pages generation:
-DX_ARG_ABLE(man, [generate doxygen manual pages],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [],
- [DX_ENV_APPEND(GENERATE_MAN, YES)],
- [DX_ENV_APPEND(GENERATE_MAN, NO)])
-
-# RTF file generation:
-DX_ARG_ABLE(rtf, [generate doxygen RTF documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [],
- [DX_ENV_APPEND(GENERATE_RTF, YES)],
- [DX_ENV_APPEND(GENERATE_RTF, NO)])
-
-# XML file generation:
-DX_ARG_ABLE(xml, [generate doxygen XML documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [],
- [DX_ENV_APPEND(GENERATE_XML, YES)],
- [DX_ENV_APPEND(GENERATE_XML, NO)])
-
-# (Compressed) HTML help generation:
-DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [DX_REQUIRE_PROG([DX_HHC], hhc)],
- [DX_ENV_APPEND(HHC_PATH, $DX_HHC)
- DX_ENV_APPEND(GENERATE_HTML, YES)
- DX_ENV_APPEND(GENERATE_HTMLHELP, YES)],
- [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)])
-
-# Seperate CHI file generation.
-DX_ARG_ABLE(chi, [generate doxygen seperate compressed HTML help index file],
- [DX_CHECK_DEPEND(chm, 1)],
- [DX_CLEAR_DEPEND(chm, 1)],
- [],
- [DX_ENV_APPEND(GENERATE_CHI, YES)],
- [DX_ENV_APPEND(GENERATE_CHI, NO)])
-
-# Plain HTML pages generation:
-DX_ARG_ABLE(html, [generate doxygen plain HTML documentation],
- [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)],
- [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)],
- [],
- [DX_ENV_APPEND(GENERATE_HTML, YES)],
- [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)])
-
-# PostScript file generation:
-DX_ARG_ABLE(ps, [generate doxygen PostScript documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [DX_REQUIRE_PROG([DX_LATEX], latex)
- DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
- DX_REQUIRE_PROG([DX_DVIPS], dvips)
- DX_REQUIRE_PROG([DX_EGREP], egrep)])
-
-# PDF file generation:
-DX_ARG_ABLE(pdf, [generate doxygen PDF documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex)
- DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
- DX_REQUIRE_PROG([DX_EGREP], egrep)])
-
-# LaTeX generation for PS and/or PDF:
-if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then
- AM_CONDITIONAL(DX_COND_latex, :)
- DX_ENV_APPEND(GENERATE_LATEX, YES)
-else
- AM_CONDITIONAL(DX_COND_latex, false)
- DX_ENV_APPEND(GENERATE_LATEX, NO)
-fi
-
-# Paper size for PS and/or PDF:
-AC_ARG_VAR(DOXYGEN_PAPER_SIZE,
- [a4wide (default), a4, letter, legal or executive])
-case "$DOXYGEN_PAPER_SIZE" in
-#(
-"")
- AC_SUBST(DOXYGEN_PAPER_SIZE, "")
-;; #(
-a4wide|a4|letter|legal|executive)
- DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE)
-;; #(
-*)
- AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'])
-;;
-esac
-
-#For debugging:
-#echo DX_FLAG_doc=$DX_FLAG_doc
-#echo DX_FLAG_dot=$DX_FLAG_dot
-#echo DX_FLAG_man=$DX_FLAG_man
-#echo DX_FLAG_html=$DX_FLAG_html
-#echo DX_FLAG_chm=$DX_FLAG_chm
-#echo DX_FLAG_chi=$DX_FLAG_chi
-#echo DX_FLAG_rtf=$DX_FLAG_rtf
-#echo DX_FLAG_xml=$DX_FLAG_xml
-#echo DX_FLAG_pdf=$DX_FLAG_pdf
-#echo DX_FLAG_ps=$DX_FLAG_ps
-#echo DX_ENV=$DX_ENV
-])
diff --git a/src/decaf/m4/apr_tools.m4 b/src/decaf/m4/apr_tools.m4
deleted file mode 100644
index c0aeedb..0000000
--- a/src/decaf/m4/apr_tools.m4
+++ /dev/null
@@ -1,96 +0,0 @@
-dnl -------------------------------------------------------- -*- autoconf -*-
-dnl Licensed to the Apache Software Foundation (ASF) under one or more
-dnl contributor license agreements. See the NOTICE file distributed with
-dnl this work for additional information regarding copyright ownership.
-dnl The ASF licenses this file to You under the Apache License, Version 2.0
-dnl (the "License"); you may not use this file except in compliance with
-dnl the License. You may obtain a copy of the License at
-dnl
-dnl http://www.apache.org/licenses/LICENSE-2.0
-dnl
-dnl Unless required by applicable law or agreed to in writing, software
-dnl distributed under the License is distributed on an "AS IS" BASIS,
-dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-dnl See the License for the specific language governing permissions and
-dnl limitations under the License.
-dnl -------------------------------------------------------- -*- autoconf -*-
-dnl
-dnl This Macro File defines functions that help to manage the libraries
-dnl dependance on the Apache Portable Runtime.
-dnl
-dnl DECAF_CONFIGURE_APR()
-dnl
-dnl Check configure options and assign variables related to
-dnl the Apache Portable Runtime (APR) library.
-dnl
-
-AC_DEFUN([DECAF_CONFIGURE_APR],
-[
- AC_MSG_NOTICE([Apache Portable Runtime (APR) library configuration])
- APR_FIND_APR([], [], 1, [0 1])
- APR_FIND_APU([], [], 1, [0 1])
-
- if test $apr_found = "no"; then
- AC_MSG_WARN([APR not found])
- DECAF_DOWNLOAD_APR
- fi
-
- if test $apu_found = "no"; then
- AC_MSG_WARN([APR Utils not found])
- DECAF_DOWNLOAD_APU
- fi
-
- dnl Get build information from APR
-
- CPPFLAGS="$CPPFLAGS `$apr_config --cppflags --includes`"
- if test $? -ne 0; then
- AC_MSG_ERROR([apr-config --cppflags failed])
- fi
-
- CFLAGS="$CFLAGS `$apr_config --cflags --includes`"
- if test $? -ne 0; then
- AC_MSG_ERROR([apr-config --cflags failed])
- fi
-
- LDFLAGS="$LDFLAGS `$apr_config --ldflags`"
- if test $? -ne 0; then
- AC_MSG_ERROR([apr-config --ldflags failed])
- fi
- LDFLAGS="$LDFLAGS `$apu_config --ldflags`"
- if test $? -ne 0; then
- AC_MSG_ERROR([apu-config --ldflags failed])
- fi
-
- APR_LIBS="`$apr_config --link-libtool --libs`"
- if test $? -ne 0; then
- AC_MSG_ERROR([apr-config --link-libtool --libs failed])
- fi
- APR_LIBS="`$apu_config --link-libtool --libs`"
- if test $? -ne 0; then
- AC_MSG_ERROR([apu-config --link-libtool --libs failed])
- fi
-
- AC_SUBST([APR_LIBS])
-])
-
-dnl DECAF_DOWNLOAD_APR()
-dnl no apr found, print out a message telling the user what to do
-AC_DEFUN([DECAF_DOWNLOAD_APR],
-[
- echo "The Apache Portable Runtime (APR) library cannot be found."
- echo "Please install APR on this system and supply the appropriate"
- echo "--with-apr option to 'configure'"
-
- AC_MSG_ERROR([no suitable APR found])
-])
-
-dnl DECAF_DOWNLOAD_APU()
-dnl no apr-utils found, print out a message telling the user what to do
-AC_DEFUN([DECAF_DOWNLOAD_APU],
-[
- echo "The Apache Portable Runtime (APR) Utils library cannot be found."
- echo "Please install APR Utils on this system and supply the appropriate"
- echo "--with-apr option to 'configure'"
-
- AC_MSG_ERROR([no suitable APR Utils found])
-])
diff --git a/src/decaf/m4/check_addrinfo.m4 b/src/decaf/m4/check_addrinfo.m4
deleted file mode 100644
index 13eb272..0000000
--- a/src/decaf/m4/check_addrinfo.m4
+++ /dev/null
@@ -1,48 +0,0 @@
-dnl -------------------------------------------------------- -*- autoconf -*-
-dnl Licensed to the Apache Software Foundation (ASF) under one or more
-dnl contributor license agreements. See the NOTICE file distributed with
-dnl this work for additional information regarding copyright ownership.
-dnl The ASF licenses this file to You under the Apache License, Version 2.0
-dnl (the "License"); you may not use this file except in compliance with
-dnl the License. You may obtain a copy of the License at
-dnl
-dnl http://www.apache.org/licenses/LICENSE-2.0
-dnl
-dnl Unless required by applicable law or agreed to in writing, software
-dnl distributed under the License is distributed on an "AS IS" BASIS,
-dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-dnl See the License for the specific language governing permissions and
-dnl limitations under the License.
-
-dnl
-dnl check_addrinfo.m4 - checks support for addrinfo structure
-dnl
-dnl This macro determines if the platform supports the addrinfo structure.
-dnl If this platform supports addrinfo, defines HAVE_STRUCT_ADDRINFO.
-dnl
-
-AC_DEFUN([CHECK_ADDRINFO], [
- AC_MSG_CHECKING([whether struct addrinfo is defined])
- AC_TRY_COMPILE(
- [ #include <stdio.h>
- #ifdef HAVE_UNISTD_H
- # include <unistd.h>
- #endif
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netdb.h>
- ],
- [
- do {
- struct addrinfo a;
- (void) a.ai_flags;
- } while(0)
- ],
- [
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_STRUCT_ADDRINFO,, [define if you have struct addrinfo])
- ],
- [
- AC_MSG_RESULT(no)
- ])
-])
diff --git a/src/decaf/m4/check_visibility.m4 b/src/decaf/m4/check_visibility.m4
deleted file mode 100644
index dd1c3b3..0000000
--- a/src/decaf/m4/check_visibility.m4
+++ /dev/null
@@ -1,45 +0,0 @@
-dnl -------------------------------------------------------- -*- autoconf -*-
-dnl Licensed to the Apache Software Foundation (ASF) under one or more
-dnl contributor license agreements. See the NOTICE file distributed with
-dnl this work for additional information regarding copyright ownership.
-dnl The ASF licenses this file to You under the Apache License, Version 2.0
-dnl (the "License"); you may not use this file except in compliance with
-dnl the License. You may obtain a copy of the License at
-dnl
-dnl http://www.apache.org/licenses/LICENSE-2.0
-dnl
-dnl Unless required by applicable law or agreed to in writing, software
-dnl distributed under the License is distributed on an "AS IS" BASIS,
-dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-dnl See the License for the specific language governing permissions and
-dnl limitations under the License.
-
-dnl
-dnl check_visibility.m4 - checks support for visibility family of CXX flags
-dnl
-dnl This macro determines whether or not the CXX flags -fvisibility and
-dnl -fvisibility-inlines-hidden are allowed with the compiler.
-dnl
-dnl If so, the result is "yes" and HAVE_VISIBILITY_OPTIONS is defined. Else, the
-dnl result is "no".
-dnl
-
-AC_DEFUN([CHECK_VISIBILITY], [
- AC_MSG_CHECKING([whether -fvisibility flags work])
-
- OLDCXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS -Werror -fvisibility=hidden -fvisibility-inlines-hidden"
-
- AC_TRY_COMPILE([],
- [
- ],
- [
- AC_MSG_RESULT(yes)
- AC_DEFINE([HAVE_VISIBILITY_OPTIONS],[], [define if you have -fvisibility options])
- ],
- [
- AC_MSG_RESULT(no)
- ])
-
- CXXFLAGS="$OLDCXXFLAGS"
-])
diff --git a/src/decaf/m4/find_apr.m4 b/src/decaf/m4/find_apr.m4
deleted file mode 100644
index e437534..0000000
--- a/src/decaf/m4/find_apr.m4
+++ /dev/null
@@ -1,167 +0,0 @@
-dnl -------------------------------------------------------- -*- autoconf -*-
-dnl Licensed to the Apache Software Foundation (ASF) under one or more
-dnl contributor license agreements. See the NOTICE file distributed with
-dnl this work for additional information regarding copyright ownership.
-dnl The ASF licenses this file to You under the Apache License, Version 2.0
-dnl (the "License"); you may not use this file except in compliance with
-dnl the License. You may obtain a copy of the License at
-dnl
-dnl http://www.apache.org/licenses/LICENSE-2.0
-dnl
-dnl Unless required by applicable law or agreed to in writing, software
-dnl distributed under the License is distributed on an "AS IS" BASIS,
-dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-dnl See the License for the specific language governing permissions and
-dnl limitations under the License.
-dnl -------------------------------------------------------- -*- autoconf -*-
-dnl
-dnl find_apr.m4 : locate the APR include files and libraries
-dnl
-dnl This macro file can be used by applications to find and use the APR
-dnl library. It provides a standardized mechanism for using APR. It supports
-dnl embedding APR into the application source, or locating an installed
-dnl copy of APR.
-dnl
-dnl APR_FIND_APR(srcdir, builddir, implicit-install-check, acceptable-majors)
-dnl
-dnl where srcdir is the location of the bundled APR source directory, or
-dnl empty if source is not bundled.
-dnl
-dnl where builddir is the location where the bundled APR will will be built,
-dnl or empty if the build will occur in the srcdir.
-dnl
-dnl where implicit-install-check set to 1 indicates if there is no
-dnl --with-apr option specified, we will look for installed copies.
-dnl
-dnl where acceptable-majors is a space separated list of acceptable major
-dnl version numbers. Often only a single major version will be acceptable.
-dnl If multiple versions are specified, and --with-apr=PREFIX or the
-dnl implicit installed search are used, then the first (leftmost) version
-dnl in the list that is found will be used. Currently defaults to [0 1].
-dnl
-dnl Sets the following variables on exit:
-dnl
-dnl apr_found : "yes", "no", "reconfig"
-dnl
-dnl apr_config : If the apr-config tool exists, this refers to it. If
-dnl apr_found is "reconfig", then the bundled directory
-dnl should be reconfigured *before* using apr_config.
-dnl
-dnl Note: this macro file assumes that apr-config has been installed; it
-dnl is normally considered a required part of an APR installation.
-dnl
-dnl If a bundled source directory is available and needs to be (re)configured,
-dnl then apr_found is set to "reconfig". The caller should reconfigure the
-dnl (passed-in) source directory, placing the result in the build directory,
-dnl as appropriate.
-dnl
-dnl If apr_found is "yes" or "reconfig", then the caller should use the
-dnl value of apr_config to fetch any necessary build/link information.
-dnl
-
-AC_DEFUN([APR_FIND_APR], [
- apr_found="no"
-
- if test "$target_os" = "os2-emx"; then
- # Scripts don't pass test -x on OS/2
- TEST_X="test -f"
- else
- TEST_X="test -x"
- fi
-
- ifelse([$4], [], [
- ifdef(AC_WARNING,AC_WARNING([$0: missing argument 4 (acceptable-majors): Defaulting to APR 0.x then APR 1.x]))
- acceptable_majors="0 1"],
- [acceptable_majors="$4"])
-
- apr_temp_acceptable_apr_config=""
- for apr_temp_major in $acceptable_majors
- do
- case $apr_temp_major in
- 0)
- apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-config"
- ;;
- *)
- apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-$apr_temp_major-config"
- ;;
- esac
- done
-
- AC_MSG_CHECKING(for APR)
- AC_ARG_WITH(apr,
- [ --with-apr=PATH prefix for installed APR, path to APR build tree,
- or the full path to apr-config],
- [
- if test "$withval" = "no" || test "$withval" = "yes"; then
- AC_MSG_ERROR([--with-apr requires a directory or file to be provided])
- fi
-
- for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config
- do
- for lookdir in "$withval/bin" "$withval"
- do
- if $TEST_X "$lookdir/$apr_temp_apr_config_file"; then
- apr_found="yes"
- apr_config="$lookdir/$apr_temp_apr_config_file"
- break 2
- fi
- done
- done
-
- if test "$apr_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then
- apr_found="yes"
- apr_config="$withval"
- fi
-
- dnl if --with-apr is used, it is a fatal error for its argument
- dnl to be invalid
- if test "$apr_found" != "yes"; then
- AC_MSG_ERROR([the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.])
- fi
- ],[
- dnl If we allow installed copies, check those before using bundled copy.
- if test -n "$3" && test "$3" = "1"; then
- for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config
- do
- if $apr_temp_apr_config_file --help > /dev/null 2>&1 ; then
- apr_found="yes"
- apr_config="$apr_temp_apr_config_file"
- break
- else
- dnl look in some standard places
- for lookdir in /usr /usr/local /usr/local/apr /opt/apr; do
- if $TEST_X "$lookdir/bin/$apr_temp_apr_config_file"; then
- apr_found="yes"
- apr_config="$lookdir/bin/$apr_temp_apr_config_file"
- break 2
- fi
- done
- fi
- done
- fi
- dnl if we have not found anything yet and have bundled source, use that
- if test "$apr_found" = "no" && test -d "$1"; then
- apr_temp_abs_srcdir="`cd $1 && pwd`"
- apr_found="reconfig"
- apr_bundled_major="`sed -n '/#define.*APR_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/apr_version.h\"`"
- case $apr_bundled_major in
- "")
- AC_MSG_ERROR([failed to find major version of bundled APR])
- ;;
- 0)
- apr_temp_apr_config_file="apr-config"
- ;;
- *)
- apr_temp_apr_config_file="apr-$apr_bundled_major-config"
- ;;
- esac
- if test -n "$2"; then
- apr_config="$2/$apr_temp_apr_config_file"
- else
- apr_config="$1/$apr_temp_apr_config_file"
- fi
- fi
- ])
-
- AC_MSG_RESULT($apr_found)
-])
diff --git a/src/decaf/m4/find_apu.m4 b/src/decaf/m4/find_apu.m4
deleted file mode 100644
index e29bc60..0000000
--- a/src/decaf/m4/find_apu.m4
+++ /dev/null
@@ -1,176 +0,0 @@
-dnl -------------------------------------------------------- -*- autoconf -*-
-dnl Copyright 2002-2005 The Apache Software Foundation or its licensors, as
-dnl applicable.
-dnl
-dnl Licensed under the Apache License, Version 2.0 (the "License");
-dnl you may not use this file except in compliance with the License.
-dnl You may obtain a copy of the License at
-dnl
-dnl http://www.apache.org/licenses/LICENSE-2.0
-dnl
-dnl Unless required by applicable law or agreed to in writing, software
-dnl distributed under the License is distributed on an "AS IS" BASIS,
-dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-dnl See the License for the specific language governing permissions and
-dnl limitations under the License.
-
-dnl
-dnl find_apu.m4 : locate the APR-util (APU) include files and libraries
-dnl
-dnl This macro file can be used by applications to find and use the APU
-dnl library. It provides a standardized mechanism for using APU. It supports
-dnl embedding APU into the application source, or locating an installed
-dnl copy of APU.
-dnl
-dnl APR_FIND_APU(srcdir, builddir, implicit-install-check, acceptable-majors)
-dnl
-dnl where srcdir is the location of the bundled APU source directory, or
-dnl empty if source is not bundled.
-dnl
-dnl where builddir is the location where the bundled APU will be built,
-dnl or empty if the build will occur in the srcdir.
-dnl
-dnl where implicit-install-check set to 1 indicates if there is no
-dnl --with-apr-util option specified, we will look for installed copies.
-dnl
-dnl where acceptable-majors is a space separated list of acceptable major
-dnl version numbers. Often only a single major version will be acceptable.
-dnl If multiple versions are specified, and --with-apr-util=PREFIX or the
-dnl implicit installed search are used, then the first (leftmost) version
-dnl in the list that is found will be used. Currently defaults to [0 1].
-dnl
-dnl Sets the following variables on exit:
-dnl
-dnl apu_found : "yes", "no", "reconfig"
-dnl
-dnl apu_config : If the apu-config tool exists, this refers to it. If
-dnl apu_found is "reconfig", then the bundled directory
-dnl should be reconfigured *before* using apu_config.
-dnl
-dnl Note: this macro file assumes that apr-config has been installed; it
-dnl is normally considered a required part of an APR installation.
-dnl
-dnl Note: At this time, we cannot find *both* a source dir and a build dir.
-dnl If both are available, the build directory should be passed to
-dnl the --with-apr-util switch.
-dnl
-dnl Note: the installation layout is presumed to follow the standard
-dnl PREFIX/lib and PREFIX/include pattern. If the APU config file
-dnl is available (and can be found), then non-standard layouts are
-dnl possible, since it will be described in the config file.
-dnl
-dnl If a bundled source directory is available and needs to be (re)configured,
-dnl then apu_found is set to "reconfig". The caller should reconfigure the
-dnl (passed-in) source directory, placing the result in the build directory,
-dnl as appropriate.
-dnl
-dnl If apu_found is "yes" or "reconfig", then the caller should use the
-dnl value of apu_config to fetch any necessary build/link information.
-dnl
-
-AC_DEFUN([APR_FIND_APU], [
- apu_found="no"
-
- if test "$target_os" = "os2-emx"; then
- # Scripts don't pass test -x on OS/2
- TEST_X="test -f"
- else
- TEST_X="test -x"
- fi
-
- ifelse([$4], [],
- [
- ifdef(AC_WARNING,([$0: missing argument 4 (acceptable-majors): Defaulting to APU 0.x then APU 1.x]))
- acceptable_majors="0 1"
- ], [acceptable_majors="$4"])
-
- apu_temp_acceptable_apu_config=""
- for apu_temp_major in $acceptable_majors
- do
- case $apu_temp_major in
- 0)
- apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-config"
- ;;
- *)
- apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-$apu_temp_major-config"
- ;;
- esac
- done
-
- AC_MSG_CHECKING(for APR-util)
- AC_ARG_WITH(apr-util,
- [ --with-apr-util=PATH prefix for installed APU, path to APU build tree,
- or the full path to apu-config],
- [
- if test "$withval" = "no" || test "$withval" = "yes"; then
- AC_MSG_ERROR([--with-apr-util requires a directory or file to be provided])
- fi
-
- for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config
- do
- for lookdir in "$withval/bin" "$withval"
- do
- if $TEST_X "$lookdir/$apu_temp_apu_config_file"; then
- apu_found="yes"
- apu_config="$lookdir/$apu_temp_apu_config_file"
- break 2
- fi
- done
- done
-
- if test "$apu_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then
- apu_found="yes"
- apu_config="$withval"
- fi
-
- dnl if --with-apr-util is used, it is a fatal error for its argument
- dnl to be invalid
- if test "$apu_found" != "yes"; then
- AC_MSG_ERROR([the --with-apr-util parameter is incorrect. It must specify an install prefix, a build directory, or an apu-config file.])
- fi
- ],[
- if test -n "$3" && test "$3" = "1"; then
- for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config
- do
- if $apu_temp_apu_config_file --help > /dev/null 2>&1 ; then
- apu_found="yes"
- apu_config="$apu_temp_apu_config_file"
- break
- else
- dnl look in some standard places (apparently not in builtin/default)
- for lookdir in /usr /usr/local /usr/local/apr /opt/apr /usr/local/apache2 ; do
- if $TEST_X "$lookdir/bin/$apu_temp_apu_config_file"; then
- apu_found="yes"
- apu_config="$lookdir/bin/$apu_temp_apu_config_file"
- break 2
- fi
- done
- fi
- done
- fi
- dnl if we have not found anything yet and have bundled source, use that
- if test "$apu_found" = "no" && test -d "$1"; then
- apu_temp_abs_srcdir="`cd $1 && pwd`"
- apu_found="reconfig"
- apu_bundled_major="`sed -n '/#define.*APU_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/apu_version.h\"`"
- case $apu_bundled_major in
- "")
- AC_MSG_ERROR([failed to find major version of bundled APU])
- ;;
- 0)
- apu_temp_apu_config_file="apu-config"
- ;;
- *)
- apu_temp_apu_config_file="apu-$apu_bundled_major-config"
- ;;
- esac
- if test -n "$2"; then
- apu_config="$2/$apu_temp_apu_config_file"
- else
- apu_config="$1/$apu_temp_apu_config_file"
- fi
- fi
- ])
-
- AC_MSG_RESULT($apu_found)
-])
diff --git a/src/decaf/src/examples/Makefile.am b/src/decaf/src/examples/Makefile.am
deleted file mode 100644
index e8ce980..0000000
--- a/src/decaf/src/examples/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-cc_sources = main.cpp
-
-##
-## Compiler / Linker Info
-##
-
-INCLUDES = -I$(srcdir)/../main
-
-bin_PROGRAMS = example
-example_SOURCES = $(cc_sources)
-
-example_LDADD= ../main/libdecaf.la
diff --git a/src/decaf/src/examples/main.cpp b/src/decaf/src/examples/main.cpp
deleted file mode 100644
index d357bdb..0000000
--- a/src/decaf/src/examples/main.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// START SNIPPET: demo
-
-#include <decaf/lang/Thread.h>
-#include <decaf/lang/Runnable.h>
-#include <decaf/lang/Integer.h>
-#include <decaf/util/concurrent/CountDownLatch.h>
-#include <decaf/util/Config.h>
-#include <decaf/io/ByteArrayInputStream.h>
-#include <decaf/io/ByteArrayOutputStream.h>
-#include <decaf/io/DataInputStream.h>
-#include <decaf/io/DataOutputStream.h>
-#include <decaf/util/Date.h>
-
-#include <stdlib.h>
-#include <iostream>
-
-using namespace decaf::lang;
-using namespace decaf::io;
-using namespace decaf::util;
-using namespace decaf::util::concurrent;
-using namespace std;
-
-////////////////////////////////////////////////////////////////////////////////
-void testDataInputStream() {
-
- std::cout << "-----------------------------------------------------\n";
- std::cout << "Testing performance of the DataInputStream:" << std::endl;
- std::cout << "-----------------------------------------------------\n";
-
- const int bufferSize = 1024 * 2000;
- const int totalRuns = 100;
-
- unsigned char* buffer = new unsigned char[bufferSize];
-
- // init to full String Buffer
- for( int ix = 0; ix < bufferSize - 1; ++ix ) {
- buffer[ix] = 'z';
- }
- buffer[bufferSize-1] = '\0';
-
- long long startTime = 0LL;
- long long endTime = 0LL;
- long long totalDelta = 0LL;
- long long average = 0LL;
- std::vector<long long> deltaTs;
-
- ByteArrayInputStream bis( buffer, bufferSize );
- DataInputStream dis( &bis );
-
- for( int i = 0; i < totalRuns; ++i ) {
-
- startTime = Date::getCurrentTimeMilliseconds();
-
- long long result = 0;
- for( size_t iy = 0; iy < bufferSize / sizeof( result ); ++iy ){
- result = dis.readLong();
- }
-
- endTime = Date::getCurrentTimeMilliseconds();
-
- // Save the result
- deltaTs.push_back( endTime - startTime );
-
- bis.reset();
- }
-
- // Sum the Time Deltas for all runs.
- for( int j = 0; j < totalRuns; ++j ) {
- totalDelta += deltaTs[j];
- }
-
- average = totalDelta / totalRuns;
-
- std::cout << "Averqage time of competion was: "
- << average << " Milliseconds." << std::endl;
-
- delete [] buffer;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void testDataOutputStream() {
-
- std::cout << "-----------------------------------------------------\n";
- std::cout << "Testing performance of the DataOutputStream:" << std::endl;
- std::cout << "-----------------------------------------------------\n";
-
- long long totalRuns = 2000LL;
- long long startTime = 0LL;
- long long endTime = 0LL;
- long long totalDelta = 0LL;
- long long average = 0LL;
- std::vector<long long> deltaTs;
- std::vector<unsigned char> outputBuffer;
-
- std::string testString;
- for( size_t i = 0; i < totalRuns * 10; ++i ) {
- testString += 'a';
- }
-
- ByteArrayOutputStream bos( outputBuffer );
- DataOutputStream dos( &bos );
-
- for( int i = 0; i < totalRuns; ++i ) {
-
- startTime = Date::getCurrentTimeMilliseconds();
-
- for( int iy = 0; iy < totalRuns * 10; ++iy ){
- dos.writeLong( 0xFF00FF00FF00FF00LL );
- }
- for( int iy = 0; iy < totalRuns * 10; ++iy ){
- dos.writeInt( 312568 );
- }
- for( int iy = 0; iy < totalRuns * 10; ++iy ){
- dos.writeShort( 12568 );
- }
- for( int iy = 0; iy < totalRuns * 10; ++iy ){
- dos.writeUnsignedShort( 12568 );
- }
- for( int iy = 0; iy < totalRuns * 10; ++iy ){
- dos.writeBoolean( true );
- }
- for( int iy = 0; iy < totalRuns * 10; ++iy ){
- dos.writeDouble( 10.34235234 );
- }
- for( int iy = 0; iy < totalRuns; ++iy ){
- dos.writeFloat( 32.4f );
- }
-
- dos.writeChars( testString );
- dos.writeBytes( testString );
- dos.writeUTF( testString );
-
- endTime = Date::getCurrentTimeMilliseconds();
-
- // Save the result
- deltaTs.push_back( endTime - startTime );
-
- outputBuffer.clear();
- }
-
- // Sum the Time Deltas for all runs.
- for( int j = 0; j < totalRuns; ++j ) {
- totalDelta += deltaTs[j];
- }
-
- average = totalDelta / totalRuns;
-
- std::cout << "Averqage time of competion was: "
- << average << " Milliseconds." << std::endl;
-}
-
-int main(int argc DECAF_UNUSED, char* argv[] DECAF_UNUSED) {
-
- std::cout << "=====================================================\n";
- std::cout << "Starting the example:" << std::endl;
- std::cout << "-----------------------------------------------------\n";
-
- //testDataInputStream();
- testDataOutputStream();
-
- std::cout << "-----------------------------------------------------\n";
- std::cout << "Finished with the example\n";
- std::cout << "=====================================================\n";
-}
-
-// END SNIPPET: demo
diff --git a/src/decaf/src/main/Makefile.am b/src/decaf/src/main/Makefile.am
deleted file mode 100644
index e11f284..0000000
--- a/src/decaf/src/main/Makefile.am
+++ /dev/null
@@ -1,194 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-cc_sources = \
- decaf/net/ServerSocket.cpp \
- decaf/net/SocketOutputStream.cpp \
- decaf/net/BufferedSocket.cpp \
- decaf/net/SocketInputStream.cpp \
- decaf/net/SocketError.cpp \
- decaf/net/TcpSocket.cpp \
- decaf/net/SocketFactory.cpp \
- decaf/net/URI.cpp \
- decaf/net/URL.cpp \
- decaf/net/URLEncoder.cpp \
- decaf/net/URLDecoder.cpp \
- decaf/lang/Exception.cpp \
- decaf/lang/Thread.cpp \
- decaf/lang/Byte.cpp \
- decaf/lang/Character.cpp \
- decaf/lang/Boolean.cpp \
- decaf/lang/Short.cpp \
- decaf/lang/Integer.cpp \
- decaf/lang/Long.cpp \
- decaf/lang/Float.cpp \
- decaf/lang/Double.cpp \
- decaf/lang/Math.cpp \
- decaf/lang/System.cpp \
- decaf/io/BufferedOutputStream.cpp \
- decaf/io/BufferedInputStream.cpp \
- decaf/io/ByteArrayInputStream.cpp \
- decaf/io/DataInputStream.cpp \
- decaf/io/DataOutputStream.cpp \
- decaf/io/ByteArrayOutputStream.cpp \
- decaf/io/BlockingByteArrayInputStream.cpp \
- decaf/util/concurrent/Mutex.cpp \
- decaf/util/concurrent/CountDownLatch.cpp \
- decaf/util/concurrent/PooledThread.cpp \
- decaf/util/concurrent/ThreadPool.cpp \
- decaf/util/Date.cpp \
- decaf/util/UUID.cpp \
- decaf/util/StringTokenizer.cpp \
- decaf/util/Random.cpp \
- decaf/util/logging/LoggerHierarchy.cpp \
- decaf/util/logging/Logger.cpp \
- decaf/util/logging/LogWriter.cpp \
- decaf/util/logging/SimpleLogger.cpp \
- decaf/util/logging/LogManager.cpp \
- decaf/util/Config.cpp \
- decaf/internal/AprPool.cpp \
- decaf/internal/util/BigInt.cpp \
- decaf/internal/util/BitOps.cpp \
- decaf/internal/util/NumberConverter.cpp \
- decaf/internal/util/FloatingPointParser.cpp \
- decaf/internal/util/HexStringParser.cpp
-
-h_sources = \
- decaf/net/BindException.h \
- decaf/net/ConnectException.h \
- decaf/net/HttpRetryException.h \
- decaf/net/MalformedURLException.h \
- decaf/net/NoRouteToHostException.h \
- decaf/net/PortUnreachableException.h \
- decaf/net/ProtocolException.h \
- decaf/net/SocketException.h \
- decaf/net/SocketTimeoutException.h \
- decaf/net/UnknownHostException.h \
- decaf/net/UnknownServiceException.h \
- decaf/net/URISyntaxException.h \
- decaf/net/BufferedSocket.h \
- decaf/net/TcpSocket.h \
- decaf/net/SocketError.h \
- decaf/net/SocketOutputStream.h \
- decaf/net/Socket.h \
- decaf/net/SocketInputStream.h \
- decaf/net/ServerSocket.h \
- decaf/net/SocketFactory.h \
- decaf/net/URI.h \
- decaf/net/URL.h \
- decaf/net/URLEncoder.h \
- decaf/net/URLDecoder.h \
- decaf/lang/Throwable.h \
- decaf/lang/Exception.h \
- decaf/lang/Byte.h \
- decaf/lang/Character.h \
- decaf/lang/Short.h \
- decaf/lang/Integer.h \
- decaf/lang/Long.h \
- decaf/lang/Float.h \
- decaf/lang/Double.h \
- decaf/lang/Thread.h \
- decaf/lang/Number.h \
- decaf/lang/Runnable.h \
- decaf/lang/Math.h \
- decaf/lang/System.h \
- decaf/lang/exceptions/NoSuchElementException.h \
- decaf/lang/exceptions/RuntimeException.h \
- decaf/lang/exceptions/IndexOutOfBoundsException.h \
- decaf/lang/exceptions/NullPointerException.h \
- decaf/lang/exceptions/IllegalStateException.h \
- decaf/lang/exceptions/IllegalMonitorStateException.h \
- decaf/lang/exceptions/InvalidStateException.h \
- decaf/lang/exceptions/ExceptionDefines.h \
- decaf/lang/exceptions/IllegalArgumentException.h \
- decaf/lang/exceptions/UnsupportedOperationException.h \
- decaf/lang/exceptions/InterruptedException.h \
- decaf/io/BufferedOutputStream.h \
- decaf/io/StandardErrorOutputStream.h \
- decaf/io/OutputStream.h \
- decaf/io/Writer.h \
- decaf/io/ByteArrayOutputStream.h \
- decaf/io/Closeable.h \
- decaf/io/DataOutputStream.h \
- decaf/io/ByteArrayInputStream.h \
- decaf/io/FilterInputStream.h \
- decaf/io/Reader.h \
- decaf/io/BlockingByteArrayInputStream.h \
- decaf/io/DataInputStream.h \
- decaf/io/EOFException.h \
- decaf/io/FilterOutputStream.h \
- decaf/io/BufferedInputStream.h \
- decaf/io/InputStream.h \
- decaf/io/IOException.h \
- decaf/io/InterruptedIOException.h \
- decaf/util/concurrent/Lock.h \
- decaf/util/concurrent/Concurrent.h \
- decaf/util/concurrent/CountDownLatch.h \
- decaf/util/concurrent/Synchronizable.h \
- decaf/util/concurrent/Mutex.h \
- decaf/util/concurrent/PooledThread.h \
- decaf/util/concurrent/PooledThreadListener.h \
- decaf/util/concurrent/TaskListener.h \
- decaf/util/concurrent/ThreadPool.h \
- decaf/util/Date.h \
- decaf/util/UUID.h \
- decaf/util/Iterator.h \
- decaf/util/Collection.h \
- decaf/util/Comparator.h \
- decaf/util/Map.h \
- decaf/util/Properties.h \
- decaf/util/Queue.h \
- decaf/util/Set.h \
- decaf/util/Random.h \
- decaf/util/StringTokenizer.h \
- decaf/util/logging/Handler.h \
- decaf/util/logging/Logger.h \
- decaf/util/logging/LoggerCommon.h \
- decaf/util/logging/ConsoleHandler.h \
- decaf/util/logging/SimpleFormatter.h \
- decaf/util/logging/Formatter.h \
- decaf/util/logging/LoggerHierarchy.h \
- decaf/util/logging/LogManager.h \
- decaf/util/logging/MarkBlockLogger.h \
- decaf/util/logging/StreamHandler.h \
- decaf/util/logging/LoggerDefines.h \
- decaf/util/logging/Filter.h \
- decaf/util/logging/LogRecord.h \
- decaf/util/logging/LogWriter.h \
- decaf/util/logging/SimpleLogger.h \
- decaf/util/logging/PropertiesChangeListener.h \
- decaf/internal/AprPool.h \
- decaf/internal/util/NumberConverter.h \
- decaf/internal/util/FloatingPointParser.h \
- decaf/internal/util/HexStringParser.h \
- decaf/internal/util/BitOps.h \
- decaf/internal/util/BigInt.h
-
-##
-## LibTool build step
-##
-lib_LTLIBRARIES= libdecaf.la
-libdecaf_la_SOURCES= $(h_sources) $(cc_sources)
-libdecaf_la_CXXFLAGS= $(DECAF_CXXFLAGS)
-libdecaf_la_LDFLAGS= -version-info $(DECAF_LIBRARY_VERSION) -release $(DECAF_VERSION)
-libdecaf_la_LIBADD= $(DECAF_LIBS) $(APR_LIBS)
-
-##
-## Packaging Info
-##
-library_includedir=$(includedir)/$(DECAF_LIBRARY_NAME)-$(DECAF_VERSION)
-nobase_library_include_HEADERS = $(h_sources)
diff --git a/src/decaf/src/main/decaf/internal/AprPool.cpp b/src/decaf/src/main/decaf/internal/AprPool.cpp
deleted file mode 100644
index 656e9de..0000000
--- a/src/decaf/src/main/decaf/internal/AprPool.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "AprPool.h"
-
-using namespace decaf;
-using namespace decaf::internal;
-
-////////////////////////////////////////////////////////////////////////////////
-AprPool::AprPool() {
- apr_pool_create( &aprPool, NULL );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-AprPool::~AprPool() {
- apr_pool_destroy( aprPool );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void AprPool::cleanup() {
- apr_pool_clear( aprPool );
-}
diff --git a/src/decaf/src/main/decaf/internal/AprPool.h b/src/decaf/src/main/decaf/internal/AprPool.h
deleted file mode 100644
index 069d03f..0000000
--- a/src/decaf/src/main/decaf/internal/AprPool.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_INTERNAL_APRPOOL_H_
-#define _DECAF_INTERNAL_APRPOOL_H_
-
-#include <decaf/util/Config.h>
-#include <apr_pools.h>
-
-namespace decaf{
-namespace internal{
-
- /**
- * Wraps an APR pool object so that classes in decaf can create a static
- * member for use in static methods where apr function calls that need a pool
- * are made.
- */
- class AprPool {
- private:
-
- apr_pool_t* aprPool;
-
- public:
-
- AprPool();
- virtual ~AprPool();
-
- /**
- * Gets the internal APR Pool.
- * @returns the internal APR pool
- */
- apr_pool_t* getAprPool() const {
- return aprPool;
- }
-
- /**
- * Clears data that was allocated by this pool. Users should call this
- * after getting the data from the APR functions and copying it to
- * someplace safe.
- */
- void cleanup();
-
- };
-
-}}
-
-#endif /*_DECAF_INTERNAL_APRPOOL_H_*/
diff --git a/src/decaf/src/main/decaf/internal/net/URIEncoderDecoder.cpp b/src/decaf/src/main/decaf/internal/net/URIEncoderDecoder.cpp
deleted file mode 100644
index 451aeb6..0000000
--- a/src/decaf/src/main/decaf/internal/net/URIEncoderDecoder.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "URIEncoderDecoder.h"
-
-#include <decaf/lang/Character.h>
-
-using namespace decaf;
-using namespace decaf::internal;
-using namespace decaf::internal::net
-
-////////////////////////////////////////////////////////////////////////////////
-const std::string URIEncoderDecoder::digits = "0123456789ABCDEF";
-
-////////////////////////////////////////////////////////////////////////////////
-URIEncoderDecoder::URIEncoderDecoder() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void URIEncoderDecoder::validate( const std::string& s, const std::string& legal)
- throw ( URISyntaxException ) {
-
- std::string::const_iterator itr = s.begin();
-
- for( int i = 0; itr != s.end(); ++i, ++iter ) {
-
- if( ch == '%' ) {
- if( i + 2 >= s.length() ) {
- throw URISyntaxException(
- __FILE__, __LINE__, s,
- "invalid Encoded data", i );
- }
-
- int d1 = Character::digit( *(++iter), 16 );
- int d2 = Character::digit( *(++iter), 16 );
-
- if( d1 == -1 || d2 == -1 ) {
- throw URISyntaxException(
- __FILE__, __LINE__, s,
- "Invalid Hex Digit in char", i );
- }
-
- i += 2;
-
- continue;
- }
-
- if( !Charactor::isLetterOrDigit( *itr ) &&
- !Character::isSpaceChar( *itr ) &&
- !Character::isISOControl( *itr ) ) {
-
- throw URISyntaxException(
- __FILE__, __LINE__, s,
- "string contains Invalid Character", i );
- }
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void URIEncoderDecoder::validateSimple( const std::string& s,
- const std::string& legal )
- throw ( URISyntaxException ) {
-
- std::string::const_iterator itr = s.begin();
-
- for( int i = 0; itr != s.end(); ++i, ++itr ) {
- if( !Character::isLetterOrDigit( *itr ) ||
- !legal.find_first_of( *itr ) > std::string::npos ) {
-
- throw URISyntaxException(
- __FILE__, __LINE__, s,
- "string contains invalid ASCII chars", i );
- }
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string URIEncoderDecoder::quoteIllegal( const std::string& s,
- const std::string& legal );
-
- std::string buf = "";
- std::string::const_iterator iter = s.begin();
-
- for( ; iter != s.end(); ++iter ) {
-
- char ch = *iter;
-
- if( Character::isLetterOrDigit( ch ) ||
- legal.find( ch ) > string::npos ||
- ( (unsigned char)ch > 127 &&
- !Character.isSpaceChar(ch) &&
- !Character.isISOControl(ch) ) ) {
-
- buf.append(ch);
- } else {
- buf.append('%');
- buf.append( digits.at( ( ch & 0xf0 ) >> 4 ) );
- buf.append( digits.at( bytes[j] & 0xf ) );
- }
- }
-
- return buf;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string URIEncoderDecoder::encodeOthers( const std::string& s ) {
- std::string buf = "";
- for( int i = 0; i < s.length(); i++ ) {
- char ch = s.at(i);
- if( ch <= 127 ) {
- buf.append( ch );
- } else {
- buf.append('%');
- buf.append( digits.at( ( ch & 0xf0 ) >> 4 ) );
- buf.append( digits.at( ch & 0xf ) );
- }
- }
- return buf;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string URIEncoderDecoder::decode( const std::string& s ) {
-
- std::string result = "";
- for( int i = 0; i < s.length(); ) {
- char c = s.charAt(i);
- if( c == '%' ) {
-
- do {
- if( i + 2 >= s.length() ) {
- throw IllegalArgumentException(
- __FILE__, __LINE__,
- "String has invalid encoding: %s", s.c_str() );
- }
-
- int d1 = Character.digit( s.at(i + 1), 16);
- int d2 = Character.digit( s.at(i + 2), 16);
-
- if( d1 == -1 || d2 == -1 ) {
- throw IllegalArgumentException(
- __FILE__, __LINE__,
- "URIEncoderDecoder::decode - Bad hex encoding in: ",
- s.c_str() );
- }
-
- result.append( (unsigned char)( ( d1 << 4 ) + d2 ) );
- i += 3;
-
- } while( i < s.length() && s.at(i) == '%' );
-
- continue;
- }
-
- result.append(c);
- i++;
- }
-
- return result;
-}
diff --git a/src/decaf/src/main/decaf/internal/net/URIEncoderDecoder.h b/src/decaf/src/main/decaf/internal/net/URIEncoderDecoder.h
deleted file mode 100644
index 24bf982..0000000
--- a/src/decaf/src/main/decaf/internal/net/URIEncoderDecoder.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_INTERNAL_NET_URIENCODERDECODER_H_
-#define _DECAF_INTERNAL_NET_URIENCODERDECODER_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/net/URISyntaxException>
-#include <string>
-
-namespace decaf{
-namespace internal{
-namespace net{
-
- class URIEncoderDecoder {
- private:
-
- static const std::string digits;
-
- public:
-
- URIEncoderDecoder();
- virtual ~URIEncoderDecoder() {}
-
- /**
- * Validate a string by checking if it contains any characters other than:
- *
- * 1. letters ('a'..'z', 'A'..'Z')
- * 2. numbers ('0'..'9')
- * 3. characters in the legalset parameter
- * 4. characters that are not ISO Control or are not ISO Space characters)
- *
- * @param s - the string to be validated
- * @param legal - the characters allowed in the string s
- */
- static void validate( const std::string& s, const std::string& legal )
- throw ( URISyntaxException );
-
- /**
- * Validate a string by checking if it contains any characters other than:
- *
- * 1. letters ('a'..'z', 'A'..'Z')
- * 2. numbers ('0'..'9')
- * 3. characters in the legalset parameter
- *
- * @param s - the string to be validated
- * @param legal - the characters allowed in the string s
- */
- static void validateSimple( const std::string& s, const std::string& legal )
- throw ( URISyntaxException );
-
- /**
- * All characters except letters ('a'..'z', 'A'..'Z') and numbers ('0'..'9')
- * and legal characters are converted into their hexidecimal value prepended
- * by '%'.
- * <p>
- * For example: '#' -> %23
- * <p>
- * Other characters, which are chars that are not US-ASCII, and are
- * not ISO Control or are not ISO Space chars, are preserved.
- * @param s - the string to be converted
- * @param legal - the characters allowed to be preserved in the string s
- * @return converted string
- */
- static std::string quoteIllegal( const std::string& s,
- const std::string& legal );
-
- /**
- * Other characters, which are chars that are not US-ASCII, and are
- * not ISO Control or are not ISO Space chars are not preserved. They are
- * converted into their hexidecimal value prepended by '%'.
- * <p>
- * For example: Euro currency symbol -> "%E2%82%AC".
- * @param s - the string to be converted
- * @return the converted string
- */
- static std::string encodeOthers( const std::string& s );
-
- /**
- * Decodes the string argument which is assumed to be encoded in the
- * <code>x-www-form-urlencoded</code> MIME content type using the UTF-8
- * encoding scheme.
- * <p>
- * '%' and two following hex digit characters are converted to the
- * equivalent byte value. All other characters are passed through
- * unmodified.
- * <p>
- * e.g. "A%20B%20C %24%25" -> "A B C $%"
- * @param s - The encoded string.
- * @return The decoded version.
- */
- static std::string decode( const std::string& s );
-
- };
-
-}}}
-
-#endif /*_DECAF_INTERNAL_NET_URIENCODERDECODER_H_*/
diff --git a/src/decaf/src/main/decaf/internal/util/BigInt.cpp b/src/decaf/src/main/decaf/internal/util/BigInt.cpp
deleted file mode 100644
index 6e6d2cd..0000000
--- a/src/decaf/src/main/decaf/internal/util/BigInt.cpp
+++ /dev/null
@@ -1,756 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BigInt.h"
-
-#include <decaf/lang/Double.h>
-#include <decaf/lang/Float.h>
-#include <decaf/internal/util/BitOps.h>
-
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::internal;
-using namespace decaf::internal::util;
-
-////////////////////////////////////////////////////////////////////////////////
-BigInt::BigInt() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BigInt::multiplyHighPrecision( unsigned long long* arg1,
- int length1,
- unsigned long long* arg2,
- int length2,
- unsigned long long* result,
- int length ) {
-
- // assumes result is large enough to hold product
- unsigned long long *temp;
- unsigned int *resultIn32;
- int count, index;
-
- if( length1 < length2 ) {
- temp = arg1;
- arg1 = arg2;
- arg2 = temp;
- count = length1;
- length1 = length2;
- length2 = count;
- }
-
- memset( result, 0, sizeof(unsigned long long) * length );
-
- // length1 > length2
- resultIn32 = (unsigned int*)result;
- index = -1;
- for( count = 0; count < length2; ++count ) {
- simpleMultiplyAddHighPrecision( arg1, length1,
- arg2[count] & BitOps::LONG_LO_MASK,
- resultIn32 + (++index) );
- simpleMultiplyAddHighPrecision( arg1, length1,
- ( arg2[count] >> 32 ),
- resultIn32 + (++index) );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned int BigInt::simpleAppendDecimalDigitHighPrecision(
- unsigned long long* arg1, int length, unsigned long long digit ) {
-
- // assumes digit is less than 32 bits
- unsigned long long arg = 0;
- int index = 0;
-
- digit <<= 32;
- do {
-
- arg = arg1[index] & BitOps::LONG_LO_MASK;
- digit = ( digit >> 32 ) + BitOps::TIMES_TEN( arg );
- arg1[index] = ( arg1[index] & BitOps::LONG_LO_MASK ) |
- ( digit & BitOps::LONG_LO_MASK );
-
- arg = arg1[index] >> 32;
- digit = ( digit >> 32 ) + BitOps::TIMES_TEN( arg );
- arg1[index] = ( arg1[index] & BitOps::LONG_HI_MASK ) |
- ( digit & BitOps::LONG_LO_MASK );
-
- } while( ++index < length );
-
- return digit >> 32;
-}
-
-/*
-U_32 simpleAppendDecimalDigitHighPrecision (U_64 * arg1, IDATA length, U_64 digit)
-{
- // assumes digit is less than 32 bits
- U_64 arg;
- IDATA index = 0;
-
- digit <<= 32;
- do
- {
- arg = LOW_IN_U64 (arg1[index]);
- digit = HIGH_IN_U64 (digit) + TIMES_TEN (arg);
- LOW_U32_FROM_PTR (arg1 + index) = LOW_U32_FROM_VAR (digit);
-
- arg = HIGH_IN_U64 (arg1[index]);
- digit = HIGH_IN_U64 (digit) + TIMES_TEN (arg);
- HIGH_U32_FROM_PTR (arg1 + index) = LOW_U32_FROM_VAR (digit);
- }
- while (++index < length);
-
- return HIGH_U32_FROM_VAR (digit);
-}
-*/
-////////////////////////////////////////////////////////////////////////////////
-double BigInt::toDoubleHighPrecision( unsigned long long* arg, int length ) {
-
- int highBit;
- unsigned long long mantissa = 0;
- unsigned long long test64 = 0;
- unsigned int test;
- long long result;
-
- while( length > 0 && arg[length - 1] == 0 ) {
- --length;
- }
-
- if( length == 0 ) {
- return 0.0;
- } else if( length > 16 ) {
- result = BitOps::EXPONENT_MASK;
- } else if( length == 1 ) {
-
- highBit = highestSetBit (arg);
- if( highBit <= 53 ) {
- highBit = 53 - highBit;
- mantissa = *arg << highBit;
- result = BitOps::CREATE_DOUBLE_BITS( mantissa, -highBit );
- } else {
- highBit -= 53;
- mantissa = *arg >> highBit;
- result = BitOps::CREATE_DOUBLE_BITS( mantissa, highBit );
-
- // perform rounding, round to even in case of tie
- test = ( BitOps::LOW_U32_FROM_LONG64_PTR( arg ) << ( 11 - highBit ) ) & 0x7FF;
- if( test > 0x400 || ((test == 0x400) && (mantissa & 1)) ) {
- result = result + 1;
- }
- }
- } else {
- highBit = highestSetBit (arg + (--length));
- if( highBit <= 53 ) {
- highBit = 53 - highBit;
- if( highBit > 0 ) {
- mantissa = (arg[length] << highBit) |
- (arg[length - 1] >> (64 - highBit));
- } else {
- mantissa = arg[length];
- }
- result = BitOps::CREATE_DOUBLE_BITS( mantissa, length * 64 - highBit );
-
- // perform rounding, round to even in case of tie
- test64 = arg[--length] << highBit;
- if( test64 > BitOps::SIGN_MASK || ((test64 == BitOps::SIGN_MASK) && (mantissa & 1)) ) {
- result = result + 1;
- } else if( test64 == BitOps::SIGN_MASK ) {
- while( --length >= 0 ) {
- if( arg[length] != 0 ) {
- result = result + 1;
- break;
- }
- }
- }
- } else {
- highBit -= 53;
- mantissa = arg[length] >> highBit;
- result = BitOps::CREATE_DOUBLE_BITS( mantissa, length * 64 + highBit );
-
- // perform rounding, round to even in case of tie
- test = ( BitOps::LOW_U32_FROM_LONG64_PTR( arg + length ) << ( 11 - highBit ) ) & 0x7FF;
- if( test > 0x400 || ((test == 0x400) && (mantissa & 1)) ) {
- result = result + 1;
- } else if( test == 0x400 ) {
- do {
- if( arg[--length] != 0 ) {
- result = result + 1;
- break;
- }
- } while( length > 0 );
- }
- }
- }
-
- return Double::longBitsToDouble( result );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int BigInt::tenToTheEHighPrecision( unsigned long long * result,
- int length, int e ) {
-
- // size test
- if( length < ((e / 19) + 1) ) {
- return 0;
- }
-
- memset( result, 0, length * sizeof(unsigned long long) );
- *result = 1;
-
- if( e == 0 ) {
- return 1;
- }
-
- length = 1;
- length = timesTenToTheEHighPrecision( result, length, e );
-
- return length;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned long long BigInt::doubleMantissa( double z ) {
-
- unsigned long long m = Double::doubleToLongBits( z );
-
- if ((m & BitOps::EXPONENT_MASK) != 0)
- m = (m & BitOps::MANTISSA_MASK) | BitOps::NORMAL_MASK;
- else
- m = (m & BitOps::MANTISSA_MASK);
-
- return m;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int BigInt::compareHighPrecision( unsigned long long* arg1,
- int length1,
- unsigned long long* arg2,
- int length2 ) {
-
- while( --length1 >= 0 && arg1[length1] == 0 );
- while( --length2 >= 0 && arg2[length2] == 0 );
-
- if( length1 > length2 ) {
- return 1;
- } else if( length1 < length2 ) {
- return -1;
- } else if( length1 > -1 ) {
- do {
- if( arg1[length1] > arg2[length1] ) {
- return 1;
- } else if( arg1[length1] < arg2[length1] ) {
- return -1;
- }
- } while( --length1 >= 0 );
- }
-
- return 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int BigInt::highestSetBitHighPrecision( unsigned long long* arg, int length ) {
-
- int highBit;
-
- while( --length >= 0 ) {
- highBit = highestSetBit( arg + length );
- if( highBit ) {
- return highBit + 64 * length;
- }
- }
-
- return 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BigInt::subtractHighPrecision( unsigned long long* arg1,
- int length1,
- unsigned long long* arg2,
- int length2 ) {
-
- // assumes arg1 > arg2
- for( int index = 0; index < length1; ++index ) {
- arg1[index] = ~arg1[index];
- }
-
- simpleAddHighPrecision( arg1, length1, 1 );
-
- while( length2 > 0 && arg2[length2 - 1] == 0 ) {
- --length2;
- }
-
- addHighPrecision( arg1, length1, arg2, length2 );
-
- for( int index = 0; index < length1; ++index ) {
- arg1[index] = ~arg1[index];
- }
-
- simpleAddHighPrecision( arg1, length1, 1 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int BigInt::doubleExponent( double z ) {
-
- // assumes positive double
- int k = ( (unsigned long long )Double::doubleToLongBits( z ) >> 52 );
-
- if( k ) {
- k -= BitOps::E_OFFSET;
- } else {
- k = 1 - BitOps::E_OFFSET;
- }
-
- return k;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned int BigInt::simpleMultiplyHighPrecision(
- unsigned long long* arg1, int length, unsigned long long arg2 ) {
-
- // assumes arg2 only holds 32 bits of information
- unsigned long long product = 0;
- int index = 0;
-
- do {
-
- product = ( product >> 32 ) + arg2 * BitOps::LOW_U32_FROM_LONG64_PTR( arg1 + index );
- BitOps::LOW_U32_FROM_LONG64_PTR( arg1 + index ) = BitOps::LOW_U32_FROM_LONG64( product );
-
- product = ( product >> 32 ) + arg2 * BitOps::HIGH_U32_FROM_LONG64_PTR( arg1 + index );
- BitOps::HIGH_U32_FROM_LONG64_PTR( arg1 + index ) = BitOps::LOW_U32_FROM_LONG64( product );
-
- } while( ++index < length );
-
- return ( product >> 32 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int BigInt::addHighPrecision( unsigned long long* arg1,
- int length1,
- unsigned long long* arg2,
- int length2 ) {
-
- // addition is limited by length of arg1 as it this function is
- // storing the result in arg1
- //
- // fix for cc (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7): code generated does not
- // do the temp1 + temp2 + carry addition correct. carry is 64 bit because gcc has
- // subtle issues when you mix 64 / 32 bit maths.
- unsigned long long temp1, temp2, temp3; /* temporary variables to help the SH-4, and gcc */
- unsigned long long carry;
- int index;
-
- if( length1 == 0 || length2 == 0 ) {
- return 0;
- } else if( length1 < length2 ) {
- length2 = length1;
- }
-
- carry = 0;
- index = 0;
-
- do {
-
- temp1 = arg1[index];
- temp2 = arg2[index];
- temp3 = temp1 + temp2;
- arg1[index] = temp3 + carry;
-
- if( arg2[index] < arg1[index] ) {
- carry = 0;
- } else if( arg2[index] != arg1[index] ) {
- carry = 1;
- }
-
- } while( ++index < length2 );
-
- if( !carry ) {
- return 0;
- } else if( index == length1 ) {
- return 1;
- }
-
- while( ++arg1[index] == 0 && ++index < length1 );
-
- return (int)( index == length1 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int BigInt::lowestSetBit( unsigned long long* y ) {
-
- unsigned int x;
- int result;
-
- if( *y == 0 ) {
- return 0;
- }
-
- if( *y & 0x00000000FFFFFFFFULL ) {
- x = BitOps::LOW_U32_FROM_LONG64_PTR( y );
- result = 0;
- } else {
- x = BitOps::HIGH_U32_FROM_LONG64_PTR( y );
- result = 32;
- }
-
- if( !( x & 0xFFFF ) ) {
- x = BitOps::bitSection( x, 0xFFFF0000, 16 );
- result += 16;
- }
-
- if( !( x & 0xFF) ) {
- x = BitOps::bitSection( x, 0xFF00, 8 );
- result += 8;
- }
- if( !( x & 0xF ) ) {
- x = BitOps::bitSection( x, 0xF0, 4 );
- result += 4;
- }
-
- if( x & 0x1 ) {
- return result + 1;
- } else if( x & 0x2 ) {
- return result + 2;
- } else if( x & 0x4 ) {
- return result + 3;
- }
-
- return result + 4;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int BigInt::timesTenToTheEHighPrecision(
- unsigned long long* result, int length, int e ) {
-
- // assumes result can hold value
- unsigned long long overflow;
- int exp10 = e;
-
- if( e == 0 ) {
- return length;
- }
-
- // Replace the current implementaion which performs a
- // "multiplication" by 10 e number of times with an actual
- // mulitplication. 10e19 is the largest exponent to the power of ten
- // that will fit in a 64-bit integer, and 10e9 is the largest exponent to
- // the power of ten that will fit in a 64-bit integer. Not sure where the
- // break-even point is between an actual multiplication and a
- // simpleAappendDecimalDigit() so just pick 10e3 as that point for
- // now.
- while( exp10 >= 19 ) {
- overflow = simpleMultiplyHighPrecision64( result, length, BitOps::TEN_E19 );
- if( overflow ) {
- result[length++] = overflow;
- }
- exp10 -= 19;
- }
-
- while( exp10 >= 9 ) {
- overflow = simpleMultiplyHighPrecision( result, length, BitOps::TEN_E9 );
- if( overflow ) {
- result[length++] = overflow;
- }
- exp10 -= 9;
- }
-
- if( exp10 == 0 ) {
- return length;
- } else if( exp10 == 1 ) {
- overflow = simpleAppendDecimalDigitHighPrecision( result, length, 0 );
- if( overflow ) {
- result[length++] = overflow;
- }
- } else if( exp10 == 2 ) {
- overflow = simpleAppendDecimalDigitHighPrecision( result, length, 0 );
- if( overflow ) {
- result[length++] = overflow;
- }
- overflow = simpleAppendDecimalDigitHighPrecision( result, length, 0 );
- if( overflow ) {
- result[length++] = overflow;
- }
- } else if( exp10 == 3 ) {
- overflow = simpleMultiplyHighPrecision( result, length, BitOps::TEN_E3 );
- if( overflow ) {
- result[length++] = overflow;
- }
- } else if( exp10 == 4 ) {
- overflow = simpleMultiplyHighPrecision( result, length, BitOps::TEN_E4 );
- if( overflow ) {
- result[length++] = overflow;
- }
- } else if( exp10 == 5 ) {
- overflow = simpleMultiplyHighPrecision( result, length, BitOps::TEN_E5 );
- if( overflow ) {
- result[length++] = overflow;
- }
- } else if( exp10 == 6 ) {
- overflow = simpleMultiplyHighPrecision( result, length, BitOps::TEN_E6);
- if( overflow ) {
- result[length++] = overflow;
- }
- } else if( exp10 == 7 ) {
- overflow = simpleMultiplyHighPrecision( result, length, BitOps::TEN_E7 );
- if( overflow ) {
- result[length++] = overflow;
- }
- } else if( exp10 == 8 ) {
- overflow = simpleMultiplyHighPrecision( result, length, BitOps::TEN_E8 );
- if( overflow ) {
- result[length++] = overflow;
- }
- }
-
- return length;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BigInt::simpleMultiplyAddHighPrecision(
- unsigned long long* arg1, int length,
- unsigned long long arg2, unsigned int* result ) {
-
- // Assumes result can hold the product and arg2 only holds 32 bits
- // of information
- unsigned long long product = 0;
- int index = 0;
- int resultIndex = 0;
-
- do {
-
- product =
- ( product >> 32 ) + result[BitOps::at( resultIndex )] +
- arg2 * BitOps::LOW_U32_FROM_LONG64_PTR( arg1 + index );
- result[BitOps::at( resultIndex )] = BitOps::LOW_U32_FROM_LONG64( product );
- ++resultIndex;
-
- product =
- ( product >> 32 ) + result[BitOps::at( resultIndex )] +
- arg2 * BitOps::HIGH_U32_FROM_LONG64_PTR( arg1 + index );
- result[BitOps::at( resultIndex )] = BitOps::LOW_U32_FROM_LONG64( product );
- ++resultIndex;
-
- } while( ++index < length );
-
- result[BitOps::at( resultIndex )] += BitOps::HIGH_U32_FROM_LONG64( product );
- if( result[BitOps::at( resultIndex )] < BitOps::HIGH_U32_FROM_LONG64( product ) ) {
- // must be careful with ++ operator and macro expansion
- ++resultIndex;
- while( ++result[BitOps::at( resultIndex )] == 0 ) {
- ++resultIndex;
- }
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int BigInt::highestSetBit(unsigned long long* y ) {
-
- unsigned int x = 0;
- int result = 0;
-
- if( *y == 0 ) {
- return 0;
- }
-
- if( *y & 0xFFFFFFFF00000000LL ) {
- x = BitOps::HIGH_U32_FROM_LONG64_PTR(y);
- result = 32;
- } else {
- x = BitOps::LOW_U32_FROM_LONG64_PTR(y);
- result = 0;
- }
-
- if( x & 0xFFFF0000 )
- {
- x = BitOps::bitSection( x, 0xFFFF0000, 16 );
- result += 16;
- }
-
- if( x & 0xFF00 ) {
- x = BitOps::bitSection( x, 0xFF00, 8 );
- result += 8;
- }
-
- if( x & 0xF0 ) {
- x = BitOps::bitSection( x, 0xF0, 4 );
- result += 4;
- }
-
- if( x > 0x7 ) {
- return result + 4;
- } else if( x > 0x3 ) {
- return result + 3;
- } else if( x > 0x1 ) {
- return result + 2;
- } else {
- return result + 1;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int BigInt::lowestSetBitHighPrecision( unsigned long long* arg, int length ) {
-
- int lowBit, index = -1;
-
- while( ++index < length ) {
- lowBit = lowestSetBit( arg + index );
- if( lowBit ) {
- return lowBit + 64 * index;
- }
- }
-
- return 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BigInt::simpleShiftLeftHighPrecision( unsigned long long* arg1,
- int length, int arg2 ) {
-
- // assumes length > 0
- int index, offset = 0;
-
- if( arg2 >= 64 ) {
-
- offset = arg2 >> 6;
- index = length;
-
- while( --index - offset >= 0 ) {
- arg1[index] = arg1[index - offset];
- }
-
- do {
- arg1[index] = 0;
- } while (--index >= 0);
-
- arg2 &= 0x3F;
- }
-
- if( arg2 == 0 ) {
- return;
- }
-
- while( --length > 0 ) {
- arg1[length] = arg1[length] << arg2 | arg1[length - 1] >> (64 - arg2);
- }
-
- *arg1 <<= arg2;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned int BigInt::floatMantissa( float z ) {
-
- unsigned int m = (unsigned int)Float::floatToIntBits( z );
-
- if( ( m & BitOps::FLOAT_EXPONENT_MASK ) != 0 )
- m = ( m & BitOps::FLOAT_MANTISSA_MASK ) | BitOps::FLOAT_NORMAL_MASK;
- else
- m = ( m & BitOps::FLOAT_MANTISSA_MASK );
-
- return m;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned long long BigInt::simpleMultiplyHighPrecision64(
- unsigned long long* arg1, int length, unsigned long long arg2 ) {
-
- unsigned long long intermediate = 0;
- unsigned long long* pArg1 = NULL;
- unsigned long long carry1 = 0;
- unsigned long long carry2 = 0;
- unsigned long long prod1 = 0;
- unsigned long long prod2 = 0;
- unsigned long long sum = 0;
- int index = 0;
- unsigned int buf32 = 0;
-
- // set the starting position
- pArg1 = &( arg1[index] );
-
- do {
-
- if( (*pArg1 != 0) || (intermediate != 0) ) {
-
- prod1 = (unsigned long long)BitOps::LOW_U32_FROM_LONG64(arg2) *
- (unsigned long long)BitOps::LOW_U32_FROM_LONG64_PTR(pArg1);
-
- sum = intermediate + prod1;
- if( (sum < prod1) || (sum < intermediate) ) {
- carry1 = 1;
- } else {
- carry1 = 0;
- }
-
- prod1 = (unsigned long long)BitOps::LOW_U32_FROM_LONG64(arg2) *
- (unsigned long long)BitOps::HIGH_U32_FROM_LONG64_PTR(pArg1);
- prod2 = (unsigned long long)BitOps::HIGH_U32_FROM_LONG64(arg2) *
- (unsigned long long)BitOps::LOW_U32_FROM_LONG64_PTR(pArg1);
-
- intermediate = carry2 + ( sum >> 32 ) + prod1 + prod2;
-
- if( (intermediate < prod1) || (intermediate < prod2) ) {
- carry2 = 1;
- } else {
- carry2 = 0;
- }
-
- BitOps::LOW_U32_FROM_LONG64_PTR(pArg1) = BitOps::LOW_U32_FROM_LONG64(sum);
- buf32 = BitOps::HIGH_U32_FROM_LONG64_PTR (pArg1);
- BitOps::HIGH_U32_FROM_LONG64_PTR(pArg1) = BitOps::LOW_U32_FROM_LONG64(intermediate);
- intermediate = carry1 + ( intermediate >> 32 ) +
- (unsigned long long)BitOps::HIGH_U32_FROM_LONG64 (arg2) *
- (unsigned long long)buf32;
- }
-
- pArg1++;
-
- } while( ++index < length );
-
- return intermediate;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int BigInt::simpleAddHighPrecision( unsigned long long* arg1,
- int length,
- unsigned long long arg2 ) {
-
- // assumes length > 0
- int index = 1;
-
- *arg1 += arg2;
- if( arg2 <= *arg1 ) {
- return 0;
- } else if (length == 1) {
- return 1;
- }
-
- while( ++arg1[index] == 0 && ++index < length );
-
- return (int)( index == length );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int BigInt::floatExponent( float z ) {
-
- // assumes positive float
- int k = Float::floatToIntBits( z ) >> 23;
-
- if( k ) {
- k -= BitOps::FLOAT_E_OFFSET;
- } else {
- k = 1 - BitOps::FLOAT_E_OFFSET;
- }
-
- return k;
-}
diff --git a/src/decaf/src/main/decaf/internal/util/BigInt.h b/src/decaf/src/main/decaf/internal/util/BigInt.h
deleted file mode 100644
index bdcbb72..0000000
--- a/src/decaf/src/main/decaf/internal/util/BigInt.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_INTERNAL_UTIL_BIGINT_H_
-#define _DECAF_INTERNAL_UTIL_BIGINT_H_
-
-#include <decaf/util/Config.h>
-#include <apr.h>
-
-namespace decaf{
-namespace internal{
-namespace util{
-
- class BigInt {
- public:
-
- BigInt();
- virtual ~BigInt() {}
-
- static void multiplyHighPrecision( unsigned long long* arg1,
- int length1,
- unsigned long long* arg2,
- int length2,
- unsigned long long* result,
- int length );
-
- static unsigned int simpleAppendDecimalDigitHighPrecision(
- unsigned long long* arg1, int length, unsigned long long digit );
-
- static double toDoubleHighPrecision( unsigned long long* arg, int length );
-
- static int tenToTheEHighPrecision( unsigned long long * result,
- int length,
- int e );
-
- static unsigned long long doubleMantissa( double z );
-
- static int compareHighPrecision( unsigned long long* arg1,
- int length1,
- unsigned long long* arg2,
- int length2 );
-
- static int highestSetBitHighPrecision( unsigned long long* arg, int length );
-
- static void subtractHighPrecision( unsigned long long* arg1,
- int length1,
- unsigned long long* arg2,
- int length2 );
-
- static int doubleExponent( double z );
-
- static unsigned int simpleMultiplyHighPrecision(
- unsigned long long* arg1, int length, unsigned long long arg2 );
-
- static int addHighPrecision( unsigned long long* arg1,
- int length1,
- unsigned long long* arg2,
- int length2 );
-
- static int lowestSetBit( unsigned long long* y );
-
- static int timesTenToTheEHighPrecision(
- unsigned long long* result, int length, int e );
-
- static void simpleMultiplyAddHighPrecision(
- unsigned long long* arg1, int length,
- unsigned long long arg2, unsigned int* result );
-
- static int highestSetBit( unsigned long long* y );
-
- static int lowestSetBitHighPrecision( unsigned long long* arg, int length );
-
- static void simpleShiftLeftHighPrecision( unsigned long long* arg1,
- int length, int arg2 );
-
- static unsigned int floatMantissa( float z );
-
- static unsigned long long simpleMultiplyHighPrecision64(
- unsigned long long* arg1, int length, unsigned long long arg2 );
-
- static int simpleAddHighPrecision( unsigned long long* arg1,
- int length,
- unsigned long long arg2 );
-
- static int floatExponent( float z );
-
- };
-
-}}}
-
-#endif /*_DECAF_INTERNAL_UTIL_BIGINT_H_*/
diff --git a/src/decaf/src/main/decaf/internal/util/BitOps.cpp b/src/decaf/src/main/decaf/internal/util/BitOps.cpp
deleted file mode 100644
index d4ecc47..0000000
--- a/src/decaf/src/main/decaf/internal/util/BitOps.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BitOps.h"
-
-using namespace decaf;
-using namespace decaf::internal;
-using namespace decaf::internal::util;
-
-////////////////////////////////////////////////////////////////////////////////
-BitOps::BitOps() {
-}
diff --git a/src/decaf/src/main/decaf/internal/util/BitOps.h b/src/decaf/src/main/decaf/internal/util/BitOps.h
deleted file mode 100644
index 318042e..0000000
--- a/src/decaf/src/main/decaf/internal/util/BitOps.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_INTERNAL_UTIL_BITOPS_H_
-#define _DECAF_INTERNAL_UTIL_BITOPS_H_
-
-#include <decaf/util/Config.h>
-#include <apr.h>
-
-namespace decaf{
-namespace internal{
-namespace util{
-
- /**
- * Class with static methods for operation on values in bit patterns.
- */
- class BitOps {
- public:
-
- // Used to make masking easier
- typedef union {
- unsigned long long longValue;
- unsigned int intValue[2];
- int sintValue[2];
- double doubleValue;
- } LONG_UNION;
-
- #ifdef APR_IS_BIGENDIAN
- static const int HiWord = 0;
- static const int LoWord = 1;
- #else
- static const int HiWord = 1;
- static const int LoWord = 0;
- #endif
-
- static const unsigned long long LONG_HI_MASK = 0xFFFFFFFF00000000ULL;
- static const unsigned long long LONG_LO_MASK = 0x00000000FFFFFFFFULL;
- static const long long TEN_E1 = 0xALL;
- static const long long TEN_E2 = 0x64LL;
- static const long long TEN_E3 = 0x3E8LL;
- static const long long TEN_E4 = 0x2710LL;
- static const long long TEN_E5 = 0x186A0LL;
- static const long long TEN_E6 = 0xF4240LL;
- static const long long TEN_E7 = 0x989680LL;
- static const long long TEN_E8 = 0x5F5E100LL;
- static const long long TEN_E9 = 0x3B9ACA00LL;
- static const long long TEN_E19 = 0x8AC7230489E80000LL;
-
- static const int E_OFFSET = 1075;
-
- static const long long INFINITE_LONGBITS = 0x7FF0000000000000LL;
- static const int INFINITE_INTBITS = 0x7F800000;
- static const int MINIMUM_INTBITS = 1;
-
- static const unsigned int DOUBLE_SIGN_MASK_HI = 0x80000000;
- static const unsigned int DOUBLE_EXPONENT_MASK_HI = 0x7FF00000;
- static const unsigned int DOUBLE_MANTISSA_MASK_LO = 0xFFFFFFFF;
- static const unsigned int DOUBLE_MANTISSA_MASK_HI = 0x000FFFFF;
- static const unsigned int SINGLE_SIGN_MASK = 0x80000000;
- static const unsigned int SINGLE_EXPONENT_MASK = 0x7F800000;
- static const unsigned int SINGLE_MANTISSA_MASK = 0x007FFFFF;
- static const unsigned int SINGLE_NAN_BITS = (SINGLE_EXPONENT_MASK | 0x00400000);
-
- static const unsigned long long MANTISSA_MASK = 0x000FFFFFFFFFFFFFULL;
- static const unsigned long long EXPONENT_MASK = 0x7FF0000000000000ULL;
- static const unsigned long long NORMAL_MASK = 0x0010000000000000ULL;
- static const unsigned long long SIGN_MASK = 0x8000000000000000ULL;
- static const unsigned int FLOAT_MANTISSA_MASK = 0x007FFFFF;
- static const unsigned int FLOAT_EXPONENT_MASK = 0x7F800000;
- static const unsigned int FLOAT_NORMAL_MASK = 0x00800000;
- static const unsigned int FLOAT_E_OFFSET = 150;
-
- public:
-
- BitOps();
- virtual ~BitOps() {}
-
- public: // Statics
-
- static unsigned int TIMES_TEN( unsigned int x ) {
- return ((x) << 3) + ((x) << 1);
- }
-
- static unsigned long long TIMES_TEN( unsigned long long x ) {
- return ((x) << 3) + ((x) << 1);
- }
-
- static unsigned long long CREATE_DOUBLE_BITS(
- unsigned long long normalizedM, unsigned long long e ) {
-
- return ( normalizedM & MANTISSA_MASK ) | ( ( e + E_OFFSET ) << 52 );
- }
-
- static unsigned long long CREATE_DOUBLE_BITS(
- unsigned long long* normalizedM, int index, unsigned long long e ) {
-
- return ( normalizedM[index] & MANTISSA_MASK ) | ( ( e + E_OFFSET ) << 52 );
- }
-
- static unsigned long long bitSection(
- unsigned long long x, unsigned long long mask, int shift ) {
-
- return ( x & mask ) >> shift;
- }
- static unsigned int bitSection(
- unsigned int x, unsigned int mask, int shift ) {
-
- return ( x & mask ) >> shift;
- }
-
- static unsigned int& LOW_U32_FROM_LONG64( unsigned long long long64 ) {
- return LOW_U32_FROM_LONG64_PTR( &long64 );
- }
-
- static unsigned int& HIGH_U32_FROM_LONG64( unsigned long long long64 ) {
- return HIGH_U32_FROM_LONG64_PTR( &long64 );
- }
-
- static int& LOW_I32_FROM_LONG64( unsigned long long long64 ) {
- return LOW_I32_FROM_LONG64_PTR( &long64 );
- }
-
- static int& HIGH_I32_FROM_LONG64( unsigned long long long64 ) {
- return HIGH_I32_FROM_LONG64_PTR( &long64 );
- }
-
- static unsigned int& LOW_U32_FROM_LONG64_PTR( unsigned long long* long64ptr ) {
- return ( (LONG_UNION*)long64ptr )->intValue[LoWord];
- }
-
- static unsigned int& HIGH_U32_FROM_LONG64_PTR( unsigned long long* long64ptr ) {
- return ( (LONG_UNION*)long64ptr )->intValue[HiWord];
- }
-
- static int& LOW_I32_FROM_LONG64_PTR( unsigned long long* long64ptr ) {
- return ( (LONG_UNION*)long64ptr )->sintValue[LoWord];
- }
-
- static int& HIGH_I32_FROM_LONG64_PTR( unsigned long long* long64ptr ) {
- return ( (LONG_UNION*)long64ptr )->sintValue[HiWord];
- }
-
- static bool IS_DENORMAL_DBL( double dbl ) {
- return IS_DENORMAL_DBL_PTR( &dbl );
- }
-
- static bool IS_DENORMAL_DBL_PTR(double* dblptr ) {
- return (((HIGH_U32_FROM_DBL_PTR(dblptr) & DOUBLE_EXPONENT_MASK_HI) == 0) &&
- ((HIGH_U32_FROM_DBL_PTR(dblptr) & DOUBLE_MANTISSA_MASK_HI) != 0 ||
- (LOW_U32_FROM_DBL_PTR(dblptr) != 0)));
- }
-
- static unsigned int& LOW_U32_FROM_DBL_PTR( double* dblptr ) {
- return ( ( (LONG_UNION*)dblptr )->intValue[LoWord] );
- }
-
- static unsigned int& HIGH_U32_FROM_DBL_PTR( double* dblptr ) {
- return ( ( (LONG_UNION*)dblptr )->intValue[HiWord] );
- }
-
- static int& LOW_I32_FROM_DBL_PTR( double* dblptr ) {
- return ( ( (LONG_UNION*)dblptr )->sintValue[LoWord] );
- }
-
- static int& HIGH_I32_FROM_DBL_PTR( double* dblptr ) {
- return ( ( (LONG_UNION*)dblptr )->sintValue[HiWord] );
- }
-
- static unsigned int& LOW_U32_FROM_DBL( double dbl ) {
- return LOW_U32_FROM_DBL_PTR( &dbl );
- }
-
- static unsigned int& HIGH_U32_FROM_DBL( double dbl ) {
- return HIGH_U32_FROM_DBL_PTR( &dbl );
- }
-
- static int& LOW_I32_FROM_DBL( double dbl ) {
- return LOW_I32_FROM_DBL_PTR( &dbl );
- }
-
- static int& HIGH_I32_FROM_DBL( double dbl ) {
- return HIGH_I32_FROM_DBL_PTR( &dbl );
- }
-
- static unsigned int at( unsigned int i ) {
- #ifdef APR_IS_BIGENDIAN
- return i^1;
- #else
- return i;
- #endif
- }
-
- };
-
-}}}
-
-#endif /*_DECAF_INTERNAL_UTIL_BITOPS_H_*/
diff --git a/src/decaf/src/main/decaf/internal/util/FloatingPointParser.cpp b/src/decaf/src/main/decaf/internal/util/FloatingPointParser.cpp
deleted file mode 100644
index c720d86..0000000
--- a/src/decaf/src/main/decaf/internal/util/FloatingPointParser.cpp
+++ /dev/null
@@ -1,846 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "FloatingPointParser.h"
-#include <decaf/lang/Math.h>
-#include <decaf/lang/Integer.h>
-#include <decaf/lang/Long.h>
-#include <decaf/lang/Float.h>
-#include <decaf/lang/Double.h>
-#include <decaf/lang/Character.h>
-#include <decaf/internal/util/HexStringParser.h>
-#include <decaf/internal/util/BigInt.h>
-#include <decaf/internal/util/BitOps.h>
-#include <decaf/lang/exceptions/NumberFormatException.h>
-#include <apr_lib.h>
-#include <errno.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::internal;
-using namespace decaf::internal::util;
-
-////////////////////////////////////////////////////////////////////////////////
-const int FloatingPointParser::tens[11] = {
- 0x3f800000,
- 0x41200000,
- 0x42c80000,
- 0x447a0000,
- 0x461c4000,
- 0x47c35000,
- 0x49742400,
- 0x4b189680,
- 0x4cbebc20,
- 0x4e6e6b28,
- 0x501502f9 /* 10 ^ 10 in float */
-};
-
-////////////////////////////////////////////////////////////////////////////////
-double FloatingPointParser::parseDblImpl( const std::string& value, int exp )
- throw ( exceptions::NumberFormatException ) {
-
- // assumes s is a null terminated string with at least one
- // character in it
- unsigned long long def[17] = {0};
- unsigned long long defBackup[17] = {0};
- unsigned long long* f = def;
- unsigned long long* fNoOverflow = defBackup;
- unsigned long long* tempBackup = NULL;
- unsigned int overflow = 0;
- unsigned long long result = 0;
- int index = 1;
- int unprocessedDigits = 0;
- std::string::const_iterator valItr = value.begin();
-
- do {
-
- if( Character::isDigit( *valItr ) ) {
-
- // Make a back up of f before appending, so that we can
- // back out of it if there is no more room, i.e. index >
- // MAX_ACCURACY_WIDTH.
-
- memcpy( fNoOverflow, f, sizeof(unsigned long long) * index );
- overflow = BigInt::simpleAppendDecimalDigitHighPrecision(
- f, index, *valItr - '0' );
-
- if( overflow ) {
- f[index++] = overflow;
- /* There is an overflow, but there is no more room
- * to store the result. We really only need the top 52
- * bits anyway, so we must back out of the overflow,
- * and ignore the rest of the string.
- */
- if( index >= MAX_ACCURACY_WIDTH ) {
- index--;
- memcpy( f, fNoOverflow, sizeof(unsigned long long) * index);
- break;
- }
-
- if( tempBackup ) {
- fNoOverflow = tempBackup;
- }
- }
- } else {
- // Bad chars in the string
- BitOps::LOW_I32_FROM_LONG64( result ) = -1;
- BitOps::HIGH_I32_FROM_LONG64( result ) = -1;
- return Double::longBitsToDouble( result );
- }
-
- } while( ++valItr != value.end() );
-
- // We've broken out of the parse loop either because we've reached
- // the end of the string or we've overflowed the maximum accuracy
- // limit of a double. If we still have unprocessed digits in the
- // given string, then there are three possible results:
- // 1. (unprocessed digits + e) == 0, in which case we simply
- // convert the existing bits that are already parsed
- // 2. (unprocessed digits + e) < 0, in which case we simply
- // convert the existing bits that are already parsed along
- // with the given e
- // 3. (unprocessed digits + e) > 0 indicates that the value is
- // simply too big to be stored as a double, so return Infinity
- if( ( unprocessedDigits = value.length() ) > 0 ) {
-
- exp += unprocessedDigits;
- if( exp == 0 ) {
- return BigInt::toDoubleHighPrecision( f, index );
- } else if( exp < 0 ) {
- return BitOps::CREATE_DOUBLE_BITS( f, index, exp );
- } else {
- result = BitOps::INFINITE_LONGBITS;
- }
-
- } else {
-
- if( exp == 0 ) {
- return BigInt::toDoubleHighPrecision( f, index );
- } else {
- return BitOps::CREATE_DOUBLE_BITS( f, index, exp );
- }
- }
-
- return Double::longBitsToDouble( result );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-float FloatingPointParser::parseFltImpl( const std::string& value, int exp )
- throw ( exceptions::NumberFormatException ) {
-
- float result = FloatingPointParser::createFloat( value, exp );
-
-std::cout << std::endl
- << "DEBUG - FloatingPointParser::parseFltImpl - "
- << "createFloat returned = " << result << std::endl;
-
- if( Float::floatToIntBits( result ) >= 0 ) {
- return result;
- } else if( Float::floatToIntBits( result ) == -1 ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "FloatingPointParser::parseFltImpl - Not a valid float string",
- value.c_str() );
- }
-
- return result;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-FloatingPointParser::StringExponentPair FloatingPointParser::initialParse(
- const std::string& value, int length ) throw ( exceptions::NumberFormatException ){
-
- std::string newValue = value;
- bool negative = false;
- char c;
- int start = 0;
- int end = 0;
- int decimal = 0;
- int e = 0;
-
- if( length == 0 ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "FloatingPointParser::initialParse - Invalid zero length string");
- }
-
- c = newValue[length - 1];
- if( c == 'D' || c == 'd' || c == 'F' || c == 'f') {
- length--;
- if( length == 0 ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "FloatingPointParser::initialParse - Invalid zero length string");
- }
- }
-
- end = Math::max( (int)newValue.find_first_of( 'E' ),
- (int)newValue.find_first_of( 'e' ) );
-
- if( (std::size_t)end != string::npos ) {
-
- if( end + 1 == length ) {
- if( length == 0 ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "FloatingPointParser::initialParse - Invalid no data after e",
- newValue.c_str() );
- }
- }
-
- int exponent_offset = end + 1;
-
- if( newValue[exponent_offset] == '+' ) {
- if( newValue[exponent_offset + 1] == '-' ) {
- if( length == 0 ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "FloatingPointParser::initialParse - "
- "Invalid length string");
- }
- }
- exponent_offset++; // skip the plus sign
- }
-
- try {
- e = Integer::parseInt( newValue.substr( exponent_offset, length ) );
- } catch( exceptions::NumberFormatException ex ) {
- // ex contains the exponent substring only so throw a
- // new exception with the correct string
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "FloatingPointParser::initialParse - "
- "exponent string is not valid" );
- }
-
- } else {
- end = length;
- }
-
- if( length == 0 ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "FloatingPointParser::initialParse - "
- "invalid length string", newValue.c_str() );
- }
-
- c = newValue[start];
-
- if( c == '-') {
- ++start;
- --length;
- negative = true;
- } else if( c == '+' ) {
- ++start;
- --length;
- }
-
- if( length == 0 ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "FloatingPointParser::initialParse - "
- "invalid length string", newValue.c_str() );
- }
-
- decimal = newValue.find_first_of( '.' );
- if( decimal > -1 ) {
- e -= end - decimal - 1;
- newValue = newValue.substr( start, decimal ) + newValue.substr( decimal + 1, end );
- } else {
- newValue = newValue.substr( start, end );
- }
-
- if( ( length = newValue.length() ) == 0 ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "FloatingPointParser::initialParse - "
- "invalid length string", newValue.c_str() );
- }
-
- end = length;
- while( end > 1 && newValue[end - 1] == '0' ) {
- --end;
- }
-
- start = 0;
- while( start < end - 1 && newValue[start] == '0' ) {
- start++;
- }
-
- if( end != length || start != 0 ) {
- e += length - end;
- newValue = newValue.substr( start, end );
- }
-
- return StringExponentPair( newValue, e, negative );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double FloatingPointParser::parseDblName(
- const std::string& namedDouble, int length )
- throw( exceptions::NumberFormatException ) {
-
- // Valid strings are only +Nan, NaN, -Nan, +Infinity, Infinity,
- // -Infinity.
- if( (length != 3) && ( length != 4) && ( length != 8) && ( length != 9 ) ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "FloatingPointParser::parseDblName - "
- "invalid name string", namedDouble.c_str() );
- }
-
- bool negative = namedDouble.at(0) == '-' ? true : false;
-
- if( namedDouble.find( "Infinity" ) != string::npos ) {
- return negative ? Double::NEGATIVE_INFINITY : Float::POSITIVE_INFINITY;
- }
-
- if( namedDouble.find( "NaN" ) != string::npos ) {
- return Double::NaN;
- }
-
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "FloatingPointParser::parseDblName - "
- "invalid name string", namedDouble.c_str() );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-float FloatingPointParser::parseFltName(
- const std::string& namedFloat, int length )
- throw( exceptions::NumberFormatException ) {
-
- // Valid strings are only +Nan, NaN, -Nan, +Infinity, Infinity,
- // -Infinity.
- if( ( length != 3 ) && ( length != 4 ) && ( length != 8 ) && ( length != 9 ) ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "FloatingPointParser::parseFltName - "
- "invalid name string", namedFloat.c_str() );
- }
-
- bool negative = namedFloat.at(0) == '-' ? true : false;
-
- if( namedFloat.find( "Infinitiy" ) != string::npos ) {
- return negative ? Float::NEGATIVE_INFINITY : Float::POSITIVE_INFINITY;
- }
-
- if( namedFloat.find( "NaN" ) != string::npos ) {
- return Float::NaN;
- }
-
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "FloatingPointParser::parseFltName - "
- "invalid name string", namedFloat.c_str() );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double FloatingPointParser::parseDouble( const std::string& value )
- throw( exceptions::NumberFormatException ) {
-
- std::string newValue = value;
- FloatingPointParser::trim( newValue );
- int length = newValue.length();
-
- if( length == 0 ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "FloatingPointParser::parseDouble - "
- "invalid length string", value.c_str() );
- }
-
- // See if this could be a named double
- char last = newValue[length - 1];
-
- if( (last == 'y') || (last == 'N') ) {
- return parseDblName( newValue, length );
- }
-
- // See if it could be a hexadecimal representation
- if( toLowerCase( newValue ).find( "0x" ) != string::npos ) {
- return HexStringParser::parseDouble(value);
- }
-
- StringExponentPair info = initialParse(value, length);
-
- double result = parseDblImpl( info.value, info.exp );
-
- if( info.negative ) {
- result = -result;
- }
-
- return result;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-float FloatingPointParser::parseFloat( const std::string& value )
- throw( exceptions::NumberFormatException ) {
-
- std::string newValue = value;
- FloatingPointParser::trim( newValue );
-
- int length = newValue.length();
-
- if( length == 0 ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "FloatingPointParser::parseFloat - "
- "invalid length string", value.c_str() );
- }
-
- // See if this could be a named float
- char last = newValue[length - 1];
- if( (last == 'y') || (last == 'N') ) {
- return parseFltName( value, length );
- }
-
- // See if it could be a hexadecimal representation
- if( toLowerCase( newValue ).find( "0x" ) != string::npos ) {
- return HexStringParser::parseFloat( newValue );
- }
-
- StringExponentPair info = initialParse( newValue, length );
-
-std::cout << std::endl
- << "DEBUG - FloatingPointParser::parseFloat - "
- << "newValue = " << newValue << ", length = " << length;
-
- float result = parseFltImpl( info.value, info.exp );
- if( info.negative ) {
- result = -result;
- }
-
- return result;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string& FloatingPointParser::trim( std::string& value ) {
-
- // trim leading whitespace
- string::size_type notwhite = value.find_first_not_of( " \t\r\n" );
- value.erase( 0, notwhite );
-
- // trim trailing whitespace
- notwhite = value.find_last_not_of( " \t\r\n" );
- value.erase( notwhite+1 );
-
- return value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string& FloatingPointParser::toLowerCase( std::string& value ) {
-
- string::size_type index = 0;
-
- for( ; index < value.size(); ++index ) {
- if( Character::isLetter( value[index] ) ) {
- value[index] = apr_tolower( value[index] );
- }
- }
-
- return value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-float FloatingPointParser::createFloat( const std::string&s, int exp ) {
-
- // assumes s is a null terminated string with at least one
- // character in it
- unsigned long long def[DEFAULT_WIDTH] = {0};
- unsigned long long defBackup[DEFAULT_WIDTH] = {0};
- unsigned long long* f = def;
- unsigned long long* fNoOverflow = defBackup;
- unsigned long long* tempBackup = NULL;
- unsigned int overflow = 0;
- unsigned int result = 0;
- int index = 1;
- int unprocessedDigits = 0;
- std::string::const_iterator sIter = s.begin();
-
- do {
-
- if( Character::isDigit( *sIter ) ) {
-
-std::cout << std::endl
- << "DEBUG - FloatingPointParser::createFloat - "
- << "current digint ASCII = " << *sIter
- << ", value = " << *sIter - '0';
-
- // Make a back up of f before appending, so that we can
- // back out of it if there is no more room, i.e. index >
- // MAX_ACCURACY_WIDTH.
- memcpy( fNoOverflow, f, sizeof(unsigned long long) * index );
- overflow = BigInt::simpleAppendDecimalDigitHighPrecision(
- f, index, *sIter - '0' );
-
-std::cout << std::endl
- << "DEBUG - FloatingPointParser::createFloat - "
- << "f[index] = " << f[index]
- << ", overflow ? = " << overflow;
-
- if( overflow ) {
-
- f[index++] = overflow;
-
- // There is an overflow, but there is no more room
- // to store the result. We really only need the top 52
- // bits anyway, so we must back out of the overflow,
- // and ignore the rest of the string.
- if( index >= MAX_ACCURACY_WIDTH ) {
- index--;
- memcpy( f, fNoOverflow, sizeof(unsigned long long)* index );
- break;
- }
-
- if( tempBackup ) {
- fNoOverflow = tempBackup;
- }
- }
- } else {
- // String contained invalid characters
- return -1;
- }
- } while( ++sIter != s.end() );
-
- // We've broken out of the parse loop either because we've reached
- // the end of the string or we've overflowed the maximum accuracy
- // limit of a double. If we still have unprocessed digits in the
- // given string, then there are three possible results:
- // 1. (unprocessed digits + e) == 0, in which case we simply
- // convert the existing bits that are already parsed
- // 2. (unprocessed digits + e) < 0, in which case we simply
- // convert the existing bits that are already parsed along
- // with the given e
- // 3. (unprocessed digits + e) > 0 indicates that the value is
- // simply too big to be stored as a double, so return Infinity
- if( ( unprocessedDigits = std::distance( sIter, s.end() ) ) > 0 ) {
-
- exp += unprocessedDigits;
-
- if( exp <= 0 ) {
- return createFloat1( f, index, exp );
- } else {
- result = BitOps::INFINITE_INTBITS;
- }
-
- } else {
- return createFloat1( f, index, exp );
- }
-
- return Float::intBitsToFloat( result );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-float FloatingPointParser::createFloat1( unsigned long long* f, int length, int exp ) {
-
- int numBits = BigInt::highestSetBitHighPrecision( f, length ) + 1;
- double dresult = 0.0;
- int result = 0;
-
- numBits -= BigInt::lowestSetBitHighPrecision( f, length );
-
- if( numBits < 25 && exp >= 0 && exp < LOG5_OF_TWO_TO_THE_N ) {
- return Float::intBitsToFloat( BitOps::LOW_I32_FROM_LONG64_PTR( f ) ) *
- Float::intBitsToFloat( tenToTheE( exp ) );
- } else if( numBits < 25 && exp < 0 && (-exp) < LOG5_OF_TWO_TO_THE_N ) {
- return Float::intBitsToFloat( BitOps::LOW_I32_FROM_LONG64_PTR( f ) ) *
- Float::intBitsToFloat( tenToTheE( -exp ) );
- } else if (exp >= 0 && exp < 39) {
- result = Float::floatToIntBits(
- (float)( BigInt::toDoubleHighPrecision( f, length ) * Math::pow( 10.0, exp ) ) );
- } else if( exp >= 39 ) {
- // Convert the partial result to make sure that the
- // non-exponential part is not zero. This check fixes the case
- // where the user enters 0.0e309!
- dresult = BigInt::toDoubleHighPrecision( f, length );
-
- if( dresult == 0.0 ) {
- result = BitOps::MINIMUM_INTBITS;
- } else {
- result = BitOps::INFINITE_INTBITS;
- }
-
- } else if( exp > -309 ) {
-
- int dexp;
- unsigned int fmant, fovfl;
- unsigned long long dmant;
- dresult = BigInt::toDoubleHighPrecision( f, length ) / Math::pow( 10.0, -exp );
-
- if( BitOps::IS_DENORMAL_DBL( dresult ) ) {
- return 0.0f;
- }
-
- dexp = BigInt::doubleExponent( dresult ) + 51;
- dmant = BigInt::doubleMantissa( dresult );
-
- // Is it too small to be represented by a single-precision
- // float?
- if( dexp <= -155 ) {
- return 0.0f;
- }
-
- // Is it a denormalized single-precision float?
- if( (dexp <= -127) && (dexp > -155) ) {
-
- // Only interested in 24 msb bits of the 53-bit double mantissa
- fmant = (unsigned int) (dmant >> 29);
- fovfl = ((unsigned int) (dmant & 0x1FFFFFFF)) << 3;
-
- while( (dexp < -127) && ((fmant | fovfl) != 0) ) {
- if( (fmant & 1) != 0 ) {
- fovfl |= 0x80000000;
- }
- fovfl >>= 1;
- fmant >>= 1;
- dexp++;
- }
-
- if( (fovfl & 0x80000000) != 0) {
- if( (fovfl & 0x7FFFFFFC) != 0 ) {
- fmant++;
- } else if( (fmant & 1) != 0 ) {
- fmant++;
- }
- } else if( (fovfl & 0x40000000) != 0 ) {
-
- if( (fovfl & 0x3FFFFFFC) != 0 ) {
- fmant++;
- }
- }
-
- result = fmant;
- } else {
- result = Float::floatToIntBits( (float)dresult );
- }
- }
-
- // Don't go straight to zero as the fact that x*0 = 0 independent
- // of x might cause the algorithm to produce an incorrect result.
- // Instead try the min value first and let it fall to zero if need be.
- if( exp <= -309 || result == 0 ) {
- result = BitOps::MINIMUM_INTBITS;
- }
-
- return floatAlgorithm( f, length, exp, Float::intBitsToFloat( result ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-float FloatingPointParser::floatAlgorithm(
- unsigned long long* f, int length, int exp, float z ) {
-
- unsigned long long m = 0;
- int k = 0;
- int comparison = 0;
- int comparison2 = 0;
- unsigned long long* x = NULL;
- unsigned long long* y = NULL;
- unsigned long long* D = NULL;
- unsigned long long* D2 = NULL;
- int xLength = 0;
- int yLength = 0;
- int DLength = 0;
- int D2Length = 0;
- int decApproxCount = 0;
- int incApproxCount = 0;
- int result = Float::floatToIntBits( z );
-
- do {
-
- m = BigInt::floatMantissa( z );
- k = BigInt::floatExponent( z );
-
- if( exp >= 0 && k >= 0 ) {
-
- xLength = sizeOfTenToTheE( exp ) + length;
- x = new unsigned long long[xLength];
- memset( x + length, 0, sizeof(unsigned long long) * (xLength - length) );
- memcpy( x, f, sizeof(unsigned long long) * length );
- BigInt::timesTenToTheEHighPrecision( x, xLength, exp );
-
- yLength = (k >> 6) + 2;
- y = new unsigned long long[yLength];
- memset( y + 1, 0, sizeof(unsigned long long) * (yLength - 1) );
- *y = m;
- BigInt::simpleShiftLeftHighPrecision (y, yLength, k);
-
- } else if( exp >= 0 ) {
-
- xLength = sizeOfTenToTheE (exp) + length + ((-k) >> 6) + 1;
- x = new unsigned long long[xLength];
- memset( x + length, 0, sizeof(unsigned long long) * (xLength - length) );
- memcpy( x, f, sizeof(unsigned long long) * length );
- BigInt::timesTenToTheEHighPrecision( x, xLength, exp );
- BigInt::simpleShiftLeftHighPrecision( x, xLength, -k );
-
- yLength = 1;
- y = new unsigned long long[yLength];
- *y = m;
-
- } else if( k >= 0 ) {
-
- xLength = length;
- x = f;
-
- yLength = sizeOfTenToTheE( -exp ) + 2 + ( k >> 6 );
- y = new unsigned long long[yLength];
- memset( y + 1, 0, sizeof(unsigned long long) * (yLength - 1)) ;
- *y = m;
- BigInt::timesTenToTheEHighPrecision( y, yLength, -exp );
- BigInt::simpleShiftLeftHighPrecision( y, yLength, k );
-
- } else {
-
- xLength = length + ((-k) >> 6) + 1;
- x = new unsigned long long[xLength];
- memset( x + length, 0, sizeof(unsigned long long) * (xLength - length) );
- memcpy( x, f, sizeof(unsigned long long) * length );
- BigInt::simpleShiftLeftHighPrecision( x, xLength, -k );
-
- yLength = sizeOfTenToTheE( -exp ) + 1;
- y = new unsigned long long[yLength];
- memset( y + 1, 0, sizeof(unsigned long long) * (yLength - 1) );
- *y = m;
- BigInt::timesTenToTheEHighPrecision( y, yLength, -exp );
- }
-
- comparison = BigInt::compareHighPrecision( x, xLength, y, yLength );
- if( comparison > 0 ) {
- // x > y
- DLength = xLength;
- D = new unsigned long long[DLength];
- memcpy( D, x, DLength * sizeof(unsigned long long) );
- BigInt::subtractHighPrecision( D, DLength, y, yLength );
- } else if( comparison ) {
- // y > x
- DLength = yLength;
- D = new unsigned long long[DLength];
- memcpy (D, y, DLength * sizeof (unsigned long long));
- BigInt::subtractHighPrecision( D, DLength, x, xLength );
- } else {
- /* y == x */
- DLength = 1;
- D = new unsigned long long[DLength];
- *D = 0;
- }
-
- D2Length = DLength + 1;
- D = new unsigned long long[DLength];
- m <<= 1;
- BigInt::multiplyHighPrecision( D, DLength, &m, 1, D2, D2Length );
- m >>= 1;
-
- comparison2 = BigInt::compareHighPrecision( D2, D2Length, y, yLength );
- if( comparison2 < 0 ) {
- if( comparison < 0 && m == BitOps::NORMAL_MASK ) {
-
- BigInt::simpleShiftLeftHighPrecision( D2, D2Length, 1 );
- if( BigInt::compareHighPrecision( D2, D2Length, y, yLength) > 0 ) {
- --result;
- decApproxCount++;
- if( ( incApproxCount > 2 ) && ( decApproxCount > 2 ) ) {
- if( decApproxCount > incApproxCount ) {
- result += decApproxCount - incApproxCount;
- } else if( incApproxCount > decApproxCount ) {
- result -= incApproxCount - decApproxCount;
- }
- break;
- }
- } else {
- break;
- }
- } else {
- break;
- }
- } else if( comparison2 == 0 ) {
-
- if( (m & 1) == 0 ) {
- if( comparison < 0 && m == BitOps::NORMAL_MASK ) {
- --result;
- decApproxCount++;
- if( ( incApproxCount > 2 ) && ( decApproxCount > 2 ) ) {
- if( decApproxCount > incApproxCount ) {
- result += decApproxCount - incApproxCount;
- } else if( incApproxCount > decApproxCount ) {
- result -= incApproxCount - decApproxCount;
- }
- break;
- }
- } else {
- break;
- }
- } else if( comparison < 0 ) {
- --result;
- decApproxCount++;
- if( ( incApproxCount > 2 ) && ( decApproxCount > 2 ) ) {
- if( decApproxCount > incApproxCount ) {
- result += decApproxCount - incApproxCount;
- } else if( incApproxCount > decApproxCount ) {
- result -= incApproxCount - decApproxCount;
- }
- break;
- }
- break;
- } else {
- ++result;
- incApproxCount++;
- if( ( incApproxCount > 2 ) && ( decApproxCount > 2 ) ) {
- if( decApproxCount > incApproxCount ) {
- result += decApproxCount - incApproxCount;
- } else if( incApproxCount > decApproxCount ) {
- result -= incApproxCount - decApproxCount;
- }
- }
- break;
- }
- } else if( comparison < 0 ) {
- --result;
- decApproxCount++;
- if( ( incApproxCount > 2 ) && ( decApproxCount > 2 ) ) {
- if( decApproxCount > incApproxCount ) {
- result += decApproxCount - incApproxCount;
- } else if( incApproxCount > decApproxCount ) {
- result -= incApproxCount - decApproxCount;
- }
- break;
- }
- } else {
- if( (unsigned int)result == BitOps::FLOAT_EXPONENT_MASK ) {
- break;
- }
-
- if( ( incApproxCount > 2 ) && ( decApproxCount > 2 ) ) {
- if( decApproxCount > incApproxCount ) {
- result += decApproxCount - incApproxCount;
- } else if( incApproxCount > decApproxCount ) {
- result -= incApproxCount - decApproxCount;
- }
- break;
- }
- }
- }
- while( true );
-
- delete x;
- delete y;
- delete D;
- delete D2;
-
- return Float::intBitsToFloat( result );
-}
diff --git a/src/decaf/src/main/decaf/internal/util/FloatingPointParser.h b/src/decaf/src/main/decaf/internal/util/FloatingPointParser.h
deleted file mode 100644
index f30d5ad..0000000
--- a/src/decaf/src/main/decaf/internal/util/FloatingPointParser.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_INTERNAL_UTIL_FLOATINGPOINTPARSER_H_
-#define _DECAF_INTERNAL_UTIL_FLOATINGPOINTPARSER_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/lang/exceptions/NumberFormatException.h>
-#include <string>
-
-namespace decaf{
-namespace internal{
-namespace util{
-
- /**
- * Used to parse a string and return either a single or double precision
- * floating point number.
- */
- class FloatingPointParser {
- private:
-
- class StringExponentPair {
- public:
-
- std::string value;
- int exp;
- bool negative;
-
- StringExponentPair( const std::string value, int exp, bool negative ) {
- this->value = value;
- this->exp = exp;
- this->negative = negative;
- }
- };
-
- static const int MAX_ACCURACY_WIDTH = 17;
- static const int DEFAULT_WIDTH = MAX_ACCURACY_WIDTH;
- static const int LOG5_OF_TWO_TO_THE_N = 11;
-
- static const int tens[11];
-
- public:
-
- virtual ~FloatingPointParser() {}
-
- public:
-
- /**
- * Returns the closest double value to the real number in the string.
- * @param value - the String that will be parsed to a floating point
- * @return the double closest to the real number
- * @exception NumberFormatException if value is not a valid Number
- */
- static double parseDouble( const std::string& value )
- throw ( lang::exceptions::NumberFormatException );
-
- /**
- * Returns the closest float value to the real number in the string.
- * @param value - the String that will be parsed to a floating point
- * @return the float closest to the real number
- * @exception NumberFormatException if value is not a valid Number
- */
- static float parseFloat( const std::string& value )
- throw ( lang::exceptions::NumberFormatException );
-
- private:
-
- static int sizeOfTenToTheE( int e) {
- return ( e / 19 ) + 1;
- }
-
- /**
- * Takes a String and an integer exponent. The String should hold a positive
- * integer value (or zero). The exponent will be used to calculate the
- * floating point number by taking the positive integer the String
- * represents and multiplying by 10 raised to the power of the of the
- * exponent. Returns the closest double value to the real number
- * @param value - the String that will be parsed to a floating point
- * @param exp - an int represent the 10 to part
- * @return the double closest to the real number
- * @exception NumberFormatException if string isn't a valid number
- */
- static double parseDblImpl( const std::string& value, int exp )
- throw ( lang::exceptions::NumberFormatException );
-
- /**
- * Takes a String and an integer exponent. The String should hold a positive
- * integer value (or zero). The exponent will be used to calculate the
- * floating point number by taking the positive integer the String
- * represents and multiplying by 10 raised to the power of the of the
- * exponent. Returns the closest float value to the real number
- * @param value - the String that will be parsed to a floating point
- * @param exp - an int represent the 10 to part
- * @return the float closest to the real number
- * @exception NumberFormatException fi the string is not a valid number
- */
- static float parseFltImpl( const std::string& value, int exp )
- throw ( lang::exceptions::NumberFormatException );
-
- /**
- * Takes a String and does some initial parsing. Should return a
- * StringExponentPair containing a String with no leading or trailing white
- * space and trailing zeroes eliminated. The exponent of the
- * StringExponentPair will be used to calculate the floating point number by
- * taking the positive integer the String represents and multiplying by 10
- * raised to the power of the of the exponent.
- * @param value - the String that will be parsed to a floating point
- * @param length - the length of s
- * @return a StringExponentPair with necessary values
- * @exception NumberFormatException
- */
- static StringExponentPair initialParse( const std::string& value, int length )
- throw ( lang::exceptions::NumberFormatException );
-
- /*
- * Assumes the string is trimmed.
- * @param value - the String that will be parsed to a floating point
- * @param length - the length of s
- * @return the parsed double
- * @exception NumberFormatException
- */
- static double parseDblName( const std::string& namedDouble, int length )
- throw ( lang::exceptions::NumberFormatException );
-
- /*
- * Assumes the string is trimmed.
- * @param value - the String that will be parsed to a floating point
- * @param length - the length of s
- * @return the parsed double
- * @exception NumberFormatException
- */
- static float parseFltName( const std::string& namedFloat, int length )
- throw ( lang::exceptions::NumberFormatException );
-
- /**
- * Trims the leading and trailing whitespace from a string
- * @param value - reference to the string to trim
- * @param returns a reference to the string passed for chaining
- */
- static std::string& trim( std::string& value );
-
- /**
- * Turns all letters in the string into lowercase.
- * @param value - reference to the string to trim
- * @param returns a reference to the string passed for chaining
- */
- static std::string& toLowerCase( std::string& value );
-
- /**
- * Create a float from the given string and exponent
- */
- static float createFloat( const std::string& s, int exp );
-
- /**
- * Create a float from the given long long array and exponent
- */
- static float createFloat1( unsigned long long* f, int length, int exp );
-
- /**
- * The algorithm for the function floatAlgorithm() below can be found
- * in:
- *
- * "How to Read Floating-Point Numbers Accurately", William D.
- * Clinger, Proceedings of the ACM SIGPLAN '90 Conference on
- * Programming Language Design and Implementation, June 20-22,
- * 1990, pp. 92-101.
- *
- * There is a possibility that the function will end up in an endless
- * loop if the given approximating floating-point number (a very small
- * floating-point whose value is very close to zero) straddles between
- * two approximating integer values. We modified the algorithm slightly
- * to detect the case where it oscillates back and forth between
- * incrementing and decrementing the floating-point approximation. It
- * is currently set such that if the oscillation occurs more than twice
- * then return the original approximation.
- * @returns a newly parse float.
- */
- static float floatAlgorithm( unsigned long long* f, int length,
- int e, float z );
-
- static int tenToTheE( int exp ) {
- return *(tens + exp);
- }
-
- };
-
-}}}
-
-#endif /*_DECAF_INTERNAL_UTIL_FLOATINGPOINTPARSER_H_*/
diff --git a/src/decaf/src/main/decaf/internal/util/HexStringParser.cpp b/src/decaf/src/main/decaf/internal/util/HexStringParser.cpp
deleted file mode 100644
index 66fe9de..0000000
--- a/src/decaf/src/main/decaf/internal/util/HexStringParser.cpp
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "HexStringParser.h"
-
-#include <decaf/lang/Character.h>
-#include <decaf/lang/Integer.h>
-#include <decaf/lang/Long.h>
-#include <decaf/lang/Double.h>
-#include <decaf/lang/Float.h>
-#include <decaf/util/StringTokenizer.h>
-#include <decaf/lang/exceptions/NumberFormatException.h>
-#include <apr_pools.h>
-#include <apr_strmatch.h>
-
-using namespace decaf;
-using namespace decaf::util;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-using namespace decaf::internal;
-using namespace decaf::internal::util;
-
-////////////////////////////////////////////////////////////////////////////////
-const std::string HexStringParser::HEX_SIGNIFICANT =
- "0[xX](\\p{XDigit}+\\.?|\\p{XDigit}*\\.\\p{XDigit}+)";
-const std::string HexStringParser::BINARY_EXPONENT =
- "[pP]([+-]?\\d+)";
-const std::string HexStringParser::FLOAT_TYPE_SUFFIX =
- "[fFdD]?";
-const std::string HexStringParser::HEX_PATTERN =
- "[\\x00-\\x20]*([+-]?)" + HEX_SIGNIFICANT + BINARY_EXPONENT + FLOAT_TYPE_SUFFIX + "[\\x00-\\x20]*";
-
-////////////////////////////////////////////////////////////////////////////////
-HexStringParser::HexStringParser( int exponentWidth, int mantissaWidth ) {
-
- this->EXPONENT_WIDTH = exponentWidth;
- this->MANTISSA_WIDTH = mantissaWidth;
-
- this->EXPONENT_BASE = ~( -1 << (exponentWidth - 1) );
- this->MAX_EXPONENT = ~( -1 << exponentWidth );
- this->MIN_EXPONENT = -( MANTISSA_WIDTH + 1 );
- this->MANTISSA_MASK = ~( -1 << mantissaWidth );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double HexStringParser::parseDouble( const std::string& hexString ) {
-
- HexStringParser parser( DOUBLE_EXPONENT_WIDTH, DOUBLE_MANTISSA_WIDTH );
- long long result = parser.parse( hexString );
- return Double::longBitsToDouble( result );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-float HexStringParser::parseFloat( const std::string& hexString ) {
-
- HexStringParser parser( FLOAT_EXPONENT_WIDTH, FLOAT_MANTISSA_WIDTH );
- int result = (int)parser.parse( hexString );
- return Float::intBitsToFloat( result );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long HexStringParser::parse( const std::string& hexString ) {
-
- std::string* hexSegments = getSegmentsFromHexString( hexString );
- std::string signStr = hexSegments[0];
- std::string significantStr = hexSegments[1];
- std::string exponentStr = hexSegments[2];
- delete hexSegments;
-
- parseHexSign( signStr );
- parseExponent( exponentStr );
- parseMantissa( significantStr );
-
- sign <<= ( MANTISSA_WIDTH + EXPONENT_WIDTH );
- exponent <<= MANTISSA_WIDTH;
- return sign | exponent | mantissa;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string* HexStringParser::getSegmentsFromHexString( const std::string& hexString ) {
-
-// apr_pool_t* thePool = NULL;
-// apr_pool_create( &thePool, NULL );
-// apr_strmatch_pattern* pattern =
-// apr_strmatch_precompile( thePool, HEX_PATTERN.c_str(), 0 );
-//
-// std::vector<std::string> hexSegments;
-//
-
-
- // TODO
-// Matcher matcher = PATTERN.matcher(hexString);
-// if( !matcher.matches() ) {
-// throw NumberFormatException(
-// __FILE__, __LINE__,
-// "HexStringParser::getSegmentsFromHexString"
-// "Invalid hex string:", hexString.c_str() );
-// }
-//
-// std::string* hexSegments = new std::string[3];
-// hexSegments[0] = matcher.group(1);
-// hexSegments[1] = matcher.group(2);
-// hexSegments[2] = matcher.group(3);
-//
-// return hexSegments;
-
- return NULL;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void HexStringParser::parseExponent(const std::string& exponentStr) {
-
- std::string newExponentStr = exponentStr;
-
- char leadingChar = newExponentStr.at(0);
- int expSign = ( leadingChar == '-' ? -1 : 1 );
- if( !Character::isDigit( leadingChar ) ) {
- newExponentStr = newExponentStr.substr( 1, newExponentStr.size() );
- }
-
- try {
- exponent = expSign * Long::parseLong( exponentStr );
- checkedAddExponent( EXPONENT_BASE );
- } catch( exceptions::NumberFormatException& e ) {
- exponent = expSign * Long::MAX_VALUE;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void HexStringParser::parseMantissa(const std::string& significantStr) {
-
- StringTokenizer tokenizer( significantStr, "\\." );
- std::vector<std::string> strings;
-
- tokenizer.toArray( strings );
-
- std::string strIntegerPart = strings[0];
- std::string strDecimalPart = strings.size() > 1 ? strings[1] : "";
-
- std::string significand =
- getNormalizedSignificand( strIntegerPart, strDecimalPart) ;
-
- if( significand == "0" ) {
- setZero();
- return;
- }
-
- int offset = getOffset( strIntegerPart, strDecimalPart );
- checkedAddExponent( offset );
-
- if( exponent >= MAX_EXPONENT ) {
- setInfinite();
- return;
- }
-
- if( exponent <= MIN_EXPONENT ) {
- setZero();
- return;
- }
-
- if( significand.length() > MAX_SIGNIFICANT_LENGTH ) {
- abandonedNumber = significand.substr( MAX_SIGNIFICANT_LENGTH );
- significand = significand.substr( 0, MAX_SIGNIFICANT_LENGTH );
- }
-
- mantissa = Long::parseLong( significand, HEX_RADIX );
-
- if( exponent >= 1 ) {
- processNormalNumber();
- } else{
- processSubNormalNumber();
- }
-
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void HexStringParser::checkedAddExponent( long long offset ) {
-
- long long result = exponent + offset;
- int expSign = Long::signum( exponent );
-
- if( expSign * Long::signum( offset ) > 0 &&
- expSign * Long::signum( result ) < 0 ) {
-
- exponent = expSign * Long::MAX_VALUE;
- } else {
- exponent = result;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void HexStringParser::processNormalNumber() {
- int desiredWidth = MANTISSA_WIDTH + 2;
- fitMantissaInDesiredWidth( desiredWidth );
- round();
- mantissa = mantissa & MANTISSA_MASK;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void HexStringParser::processSubNormalNumber() {
- int desiredWidth = MANTISSA_WIDTH + 1;
- desiredWidth += (int)exponent;//lends bit from mantissa to exponent
- exponent = 0;
- fitMantissaInDesiredWidth( desiredWidth );
- round();
- mantissa = mantissa & MANTISSA_MASK;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void HexStringParser::fitMantissaInDesiredWidth(int desiredWidth){
- int bitLength = countBitsLength( mantissa );
- if( bitLength > desiredWidth ) {
- discardTrailingBits( bitLength - desiredWidth );
- } else {
- mantissa <<= ( desiredWidth - bitLength );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void HexStringParser::discardTrailingBits( long long num ) {
- long long mask = ~( -1L << num );
- abandonedNumber += ( mantissa & mask );
- mantissa >>= num;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void HexStringParser::round() {
-
- std::string result = abandonedNumber;
- replaceAll( result, "0+", "" );
-
- bool moreThanZero = ( result.length() > 0 ? true : false );
-
- int lastDiscardedBit = (int)( mantissa & 1L );
- mantissa >>= 1;
- int tailBitInMantissa = (int)( mantissa & 1L );
-
- if( lastDiscardedBit == 1 && ( moreThanZero || tailBitInMantissa == 1 ) ) {
-
- int oldLength = countBitsLength( mantissa );
- mantissa += 1L;
- int newLength = countBitsLength( mantissa );
-
- //Rounds up to exponent when whole bits of mantissa are one-bits.
- if( oldLength >= MANTISSA_WIDTH && newLength > oldLength ) {
- checkedAddExponent( 1 );
- }
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string HexStringParser::getNormalizedSignificand(
- const std::string& strIntegerPart, const std::string& strDecimalPart ) {
-
- std::string significand = strIntegerPart + strDecimalPart;
-
- replaceFirst( significand, "^0x", "" );
-
- if( significand.length() == 0 ) {
- significand = "0";
- }
- return significand;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int HexStringParser::getOffset(
- const std::string& strIntegerPart, const std::string& strDecimalPart ) {
-
- std::string strIntegerPart2 = strIntegerPart;
-
- replaceFirst( strIntegerPart2, "^0+", "" );
-
- //If the Interger part is a nonzero number.
- if( strIntegerPart.length() != 0 ) {
- std::string leadingNumber = strIntegerPart.substr( 0, 1 );
- return ( strIntegerPart.length() - 1) * 4 +
- countBitsLength(Long::parseLong( leadingNumber,HEX_RADIX ) ) - 1;
- }
-
- //If the Interger part is a zero number.
- int i;
- for( i = 0; (std::size_t)i < strDecimalPart.length() && strDecimalPart.at(i) == '0'; i++ );
-
- if( (std::size_t)i == strDecimalPart.length() ) {
- return 0;
- }
-
- std::string leadingNumber = strDecimalPart.substr( i,i + 1 );
-
- return (-i - 1) * 4 +
- countBitsLength( Long::parseLong( leadingNumber, HEX_RADIX) ) - 1;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int HexStringParser::countBitsLength(long long value) {
- int leadingZeros = Long::numberOfLeadingZeros( value );
- return Long::SIZE - leadingZeros;
-}
diff --git a/src/decaf/src/main/decaf/internal/util/HexStringParser.h b/src/decaf/src/main/decaf/internal/util/HexStringParser.h
deleted file mode 100644
index cfbe648..0000000
--- a/src/decaf/src/main/decaf/internal/util/HexStringParser.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_INTERNAL_UTIL_HEXSTRINGPARSER_H_
-#define _DECAF_INTERNAL_UTIL_HEXSTRINGPARSER_H_
-
-#include <decaf/util/Config.h>
-#include <string>
-
-namespace decaf{
-namespace internal{
-namespace util{
-
- class HexStringParser {
- private:
-
- static const unsigned int DOUBLE_EXPONENT_WIDTH = 11;
- static const unsigned int DOUBLE_MANTISSA_WIDTH = 52;
- static const unsigned int FLOAT_EXPONENT_WIDTH = 8;
- static const unsigned int FLOAT_MANTISSA_WIDTH = 23;
- static const unsigned int HEX_RADIX = 16;
- static const unsigned int MAX_SIGNIFICANT_LENGTH = 15;
-
- static const std::string HEX_SIGNIFICANT;
- static const std::string BINARY_EXPONENT;
- static const std::string FLOAT_TYPE_SUFFIX;
- static const std::string HEX_PATTERN;
-
- // TODO
- //static final Pattern PATTERN = Pattern.compile(HEX_PATTERN);
-
- private:
-
- int EXPONENT_WIDTH;
- int MANTISSA_WIDTH;
- long EXPONENT_BASE;
- long MAX_EXPONENT;
- long MIN_EXPONENT;
- long MANTISSA_MASK;
- long sign;
- long exponent;
- long mantissa;
- std::string abandonedNumber;
-
- public:
-
- /**
- * Create a new HexParser
- * @param exponentWidth - Width of the exponent for the type to parse
- * @param mantissaWidth - Width of the mantissa for the type to parse
- */
- HexStringParser( int exponentWidth, int mantissaWidth );
-
- virtual ~HexStringParser() {}
-
- /**
- * Parses a hex string using the specs given in the constructor
- * and returns a long long with the bits of the parsed string, the
- * caller can then convert those to a float or doulbe as needed.
- * @param hexString - string to parse
- * @returns the bits parsed from the string
- */
- long long parse( const std::string& hexString );
-
- private:
-
- /*
- * Parses the sign field.
- * @param sign string to parse
- */
- void parseHexSign( const std::string& signStr ) {
- this->sign = signStr.compare("-") == 0 ? 1 : 0;
- }
-
- /*
- * Parses the exponent field.
- * @param exponent string to parse
- */
- void parseExponent( const std::string& exponentStr );
-
- /*
- * Parses the mantissa field.
- * @param mantissa string to parse
- */
- void parseMantissa( const std::string& significantStr );
-
- void setInfinite() {
- exponent = MAX_EXPONENT;
- mantissa = 0;
- }
-
- void setZero() {
- exponent = 0;
- mantissa = 0;
- }
-
- /*
- * Sets the exponent variable to Long::MAX_VALUE or -Long::MAX_VALUE if
- * overflow or underflow happens.
- * @param the offset to set
- */
- void checkedAddExponent( long long offset );
-
- void processNormalNumber();
- void processSubNormalNumber();
- int countBitsLength( long long value );
-
- /*
- * Adjusts the mantissa to desired width for further analysis.
- */
- void fitMantissaInDesiredWidth( int desiredWidth );
-
- /*
- * Stores the discarded bits to abandonedNumber.
- */
- void discardTrailingBits( long long num );
-
- /*
- * The value is rounded up or down to the nearest infinitely precise result.
- * If the value is exactly halfway between two infinitely precise results,
- * then it should be rounded up to the nearest infinitely precise even.
- */
- void round();
-
- /*
- * Returns the normalized significand after removing the leading zeros.
- */
- std::string getNormalizedSignificand( const std::string& strIntegerPart,
- const std::string& strDecimalPart );
-
- /*
- * Calculates the offset between the normalized number and unnormalized
- * number. In a normalized representation, significand is represented by the
- * characters "0x1." followed by a lowercase hexadecimal representation of
- * the rest of the significand as a fraction.
- */
- int getOffset( const std::string& strIntegerPart,
- const std::string& strDecimalPart );
-
- public: // Statics
-
- /*
- * Parses the hex string to a double number.
- * @param hexString - string to parse
- * @returns the parsed double value
- */
- static double parseDouble( const std::string& hexString );
-
- /*
- * Parses the hex string to a float number.
- * @param hexString - string to parse
- * @returns the parsed float value
- */
- static float parseFloat( const std::string& hexString );
-
-
- private: // Static
-
- /*
- * Analyzes the hex string and extracts the sign and digit segments.
- * @param hexString - string to parse
- * @returns array of three strings holding the segments caller owns
- */
- static std::string* getSegmentsFromHexString( const std::string& hexString );
-
- std::string& replaceFirst( std::string& target,
- const std::string& find,
- const std::string& replace ) {
-
- std::string::size_type pos = std::string::npos;
-
- if( ( pos = target.find_first_of( find, 0 ) ) != std::string::npos ) {
- return target.replace( pos, find.length(), replace );
- }
-
- return target;
- }
-
- std::string& replaceAll( std::string& target,
- const std::string& find,
- const std::string& replace ) {
-
- std::string::size_type pos = std::string::npos;
- while( ( pos = target.find( find ) ) != std::string::npos ) {
- target.replace( pos, find.length(), replace );
- }
-
- return target;
- }
-
- };
-
-}}}
-
-#endif /*_DECAF_INTERNAL_UTIL_HEXSTRINGPARSER_H_*/
diff --git a/src/decaf/src/main/decaf/internal/util/NumberConverter.cpp b/src/decaf/src/main/decaf/internal/util/NumberConverter.cpp
deleted file mode 100644
index 21580ff..0000000
--- a/src/decaf/src/main/decaf/internal/util/NumberConverter.cpp
+++ /dev/null
@@ -1,508 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "NumberConverter.h"
-
-#include <decaf/lang/Math.h>
-#include <decaf/lang/Float.h>
-#include <decaf/lang/Double.h>
-#include <decaf/lang/Integer.h>
-
-#include <decaf/internal/util/BigInt.h>
-#include <decaf/internal/util/BitOps.h>
-
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::internal;
-using namespace decaf::internal::util;
-
-////////////////////////////////////////////////////////////////////////////////
-const double NumberConverter::invLogOfTenBaseTwo =
- Math::log(2.0) / Math::log(10.0);
-NumberConverter::StaticInitializer NumberConverter::init;
-std::vector<long long> NumberConverter::TEN_TO_THE;
-
-////////////////////////////////////////////////////////////////////////////////
-NumberConverter::StaticInitializer::StaticInitializer() {
-
- NumberConverter::TEN_TO_THE.resize(20);
- NumberConverter::TEN_TO_THE[0] = 1L;
-
- for( std::size_t i = 1; i < TEN_TO_THE.size(); ++i ) {
- long long previous = TEN_TO_THE[i - 1];
- TEN_TO_THE[i] = ( previous << 1 ) + ( previous << 3 );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-NumberConverter::NumberConverter() {
-
- this->getCount = 0;
- this->setCount = 0;
- this->firstK = 0;
- this->uArray.resize(64);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string NumberConverter::convertD( double value ) {
-
- unsigned int p = 1023 + 52; // the power offset (precision)
-
- // the mask to get the sign of the number
- unsigned long long signMask = 0x8000000000000000ULL;
- // the mask to get the power bits
- unsigned long long eMask = 0x7FF0000000000000ULL;
- // the mask to get the significand bits
- unsigned long long fMask = 0x000FFFFFFFFFFFFFULL;
-
- unsigned long long inputNumberBits = Double::doubleToLongBits( value );
- // the value of the sign... 0 is positive, ~0 is negative
- std::string signString = ( inputNumberBits & signMask ) == 0 ? "" : "-";
- // the value of the 'power bits' of the value
- unsigned int e = (int)(( inputNumberBits & eMask ) >> 52 );
- // the value of the 'significand bits' of the value
- unsigned long long f = inputNumberBits & fMask;
- bool mantissaIsZero = (f == 0);
- int pow = 0, numBits = 52;
-
- if( e == 2047 ) {
- return mantissaIsZero ? signString + "Infinity" : "NaN";
- }
-
- if( e == 0 ) {
-
- if( mantissaIsZero ) {
- return signString + "0.0";
- }
-
- if( f == 1 ) {
- // special case to increase precision even though 2 *
- // Double::MIN_VALUE is 1.0e-323
- return signString + "4.9E-324";
- }
-
- pow = 1 - p; // a denormalized number
- long long ff = f;
- while( (ff & 0x0010000000000000ULL ) == 0 ) {
- ff = ff << 1;
- numBits--;
- }
- } else {
- // 0 < e < 2047
- // a "normalized" number
- f = f | 0x0010000000000000ULL;
- pow = e - p;
- }
-
- if( -59 < pow && pow < 6 || (pow == -59 && !mantissaIsZero) ) {
- longDigitGenerator( f, pow, e == 0, mantissaIsZero, numBits );
- } else {
- bigIntDigitGeneratorInstImpl( f, pow, e == 0, mantissaIsZero, numBits );
- }
-
- if( value >= 1e7 || value <= -1e7 ||
- ( value > -1e-3 && value < 1e-3 ) ) {
- return signString + freeFormatExponential();
- }
-
- return signString + freeFormat();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string NumberConverter::convertF(float value) {
-
- unsigned int p = 127 + 23; // the power offset (precision)
- unsigned int signMask = 0x80000000; // the mask to get the sign of the number
- unsigned int eMask = 0x7F800000; // the mask to get the power bits
- unsigned int fMask = 0x007FFFFF; // the mask to get the significand bits
-
- unsigned int inputNumberBits = Float::floatToIntBits(value);
- // the value of the sign... 0 is positive, ~0 is negative
- std::string signString = (inputNumberBits & signMask) == 0 ? "" : "-";
- // the value of the 'power bits' of the value
- unsigned int e = (inputNumberBits & eMask) >> 23;
- // the value of the 'significand bits' of the value
- unsigned int f = inputNumberBits & fMask;
- bool mantissaIsZero = ( f == 0 );
- int pow = 0, numBits = 23;
-
- if( e == 255 ) {
- return mantissaIsZero ? signString + "Infinity" : "NaN";
- }
-
- if( e == 0 ) {
-
- if( mantissaIsZero ) {
- return signString + "0.0";
- }
-
- pow = 1 - p; // a denormalized number
- if( f < 8 ) { // want more precision with smallest values
- f = f << 2;
- pow -= 2;
- }
- int ff = f;
- while( (ff & 0x00800000) == 0) {
- ff = ff << 1;
- numBits--;
- }
- } else {
- // 0 < e < 255
- // a "normalized" number
- f = f | 0x00800000;
- pow = e - p;
- }
-
- if( -59 < pow && pow < 35 || (pow == -59 && !mantissaIsZero) ) {
- longDigitGenerator( f, pow, e == 0, mantissaIsZero, numBits );
- } else {
- bigIntDigitGeneratorInstImpl( f, pow, e == 0, mantissaIsZero, numBits);
- }
-
- if( value >= 1e7f || value <= -1e7f ||
- ( value > -1e-3f && value < 1e-3f ) ) {
- return signString + freeFormatExponential();
- }
-
- return signString + freeFormat();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string NumberConverter::freeFormatExponential() {
-
- // corresponds to process "Free-Format Exponential"
- char formattedDecimal[25] = {0};
- formattedDecimal[0] = (char)( '0' + uArray[getCount++] );
- formattedDecimal[1] = '.';
- // the position the next character is to be inserted into
- // formattedDecimal
- int charPos = 2;
-
- int k = firstK;
- int expt = k;
- while( true ) {
- k--;
- if( getCount >= setCount) {
- break;
- }
-
- formattedDecimal[charPos++] = (char)( '0' + uArray[getCount++] );
- }
-
- if( k == expt - 1 ) {
- formattedDecimal[charPos++] = '0';
- }
- formattedDecimal[charPos++] = 'E';
-
- return std::string( formattedDecimal, 0, charPos ) + Integer::toString( expt );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string NumberConverter::freeFormat() {
-
- // corresponds to process "Free-Format"
- char formattedDecimal[25] = {0};
- // the position the next character is to be inserted into
- // formattedDecimal
- int charPos = 0;
- int k = firstK;
- if( k < 0 ) {
- formattedDecimal[0] = '0';
- formattedDecimal[1] = '.';
- charPos += 2;
- for( int i = k + 1; i < 0; i++ ) {
- formattedDecimal[charPos++] = '0';
- }
- }
-
- int U = uArray[getCount++];
- do{
- if( U != -1 ) {
- formattedDecimal[charPos++] = (char) ('0' + U);
- } else if (k >= -1) {
- formattedDecimal[charPos++] = '0';
- }
-
- if( k == 0 ) {
- formattedDecimal[charPos++] = '.';
- }
-
- k--;
- U = getCount < setCount ? uArray[getCount++] : -1;
-
- } while( U != -1 || k >= -1 );
-
- return std::string( formattedDecimal, 0, charPos );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void NumberConverter::bigIntDigitGeneratorInstImpl(
- long long f, int e, bool isDenormalized, bool mantissaIsZero, int p ) {
-
- static const std::size_t RM_SIZE = 21;
- static const std::size_t STemp_SIZE = 22;
-
- unsigned int RLength, SLength, TempLength, mplus_Length, mminus_Length;
- int high, low, i;
- int k, U;
-
- unsigned long long R[RM_SIZE] = {0};
- unsigned long long S[STemp_SIZE] = {0};
- unsigned long long mplus[RM_SIZE] = {0};
- unsigned long long mminus[RM_SIZE] = {0};
- unsigned long long Temp[STemp_SIZE] = {0};
-
- if( e >= 0 ) {
-
- *R = f;
- *mplus = *mminus = 1;
- BigInt::simpleShiftLeftHighPrecision( mminus, RM_SIZE, e );
-
- if( f != (2 << (p - 1)) ) {
-
- BigInt::simpleShiftLeftHighPrecision( R, RM_SIZE, e + 1 );
- *S = 2;
-
- /*
- * m+ = m+ << e results in 1.0e23 to be printed as
- * 0.9999999999999999E23
- * m+ = m+ << e+1 results in 1.0e23 to be printed as
- * 1.0e23 (caused too much rounding)
- * 470fffffffffffff = 2.0769187434139308E34
- * 4710000000000000 = 2.076918743413931E34
- */
- BigInt::simpleShiftLeftHighPrecision(mplus, RM_SIZE, e);
-
- } else {
-
- BigInt::simpleShiftLeftHighPrecision( R, RM_SIZE, e + 2 );
- *S = 4;
- BigInt::simpleShiftLeftHighPrecision( mplus, RM_SIZE, e + 1 );
- }
-
- } else {
-
- if( isDenormalized || (f != (2 << (p - 1))) ) {
-
- *R = f << 1;
- *S = 1;
- BigInt::simpleShiftLeftHighPrecision( S, STemp_SIZE, 1 - e );
- *mplus = *mminus = 1;
-
- } else {
-
- *R = f << 2;
- *S = 1;
- BigInt::simpleShiftLeftHighPrecision( S, STemp_SIZE, 2 - e );
- *mplus = 2;
- *mminus = 1;
- }
- }
-
- k = (int)Math::ceil( (e + p - 1) * invLogOfTenBaseTwo - 1e-10 );
-
- if( k > 0 ) {
- BigInt::timesTenToTheEHighPrecision( S, STemp_SIZE, k );
- } else {
- BigInt::timesTenToTheEHighPrecision( R, RM_SIZE, -k );
- BigInt::timesTenToTheEHighPrecision( mplus, RM_SIZE, -k );
- BigInt::timesTenToTheEHighPrecision( mminus, RM_SIZE, -k );
- }
-
- RLength = mplus_Length = mminus_Length = RM_SIZE;
- SLength = TempLength = STemp_SIZE;
-
- memset( Temp + RM_SIZE, 0, (STemp_SIZE - RM_SIZE) * sizeof (unsigned long long) );
- memcpy( Temp, R, RM_SIZE * sizeof (unsigned long long) );
-
- while( RLength > 1 && R[RLength - 1] == 0 ) {
- --RLength;
- }
- while( mplus_Length > 1 && mplus[mplus_Length - 1] == 0 ) {
- --mplus_Length;
- }
- while( mminus_Length > 1 && mminus[mminus_Length - 1] == 0 ) {
- --mminus_Length;
- }
- while( SLength > 1 && S[SLength - 1] == 0 ) {
- --SLength;
- }
-
- TempLength = (RLength > mplus_Length ? RLength : mplus_Length) + 1;
- BigInt::addHighPrecision( Temp, TempLength, mplus, mplus_Length );
-
- if( BigInt::compareHighPrecision (Temp, TempLength, S, SLength) >= 0 ) {
- firstK = k;
- } else {
-
- firstK = k - 1;
- BigInt::simpleAppendDecimalDigitHighPrecision( R, ++RLength, 0 );
- BigInt::simpleAppendDecimalDigitHighPrecision( mplus, ++mplus_Length, 0 );
- BigInt::simpleAppendDecimalDigitHighPrecision( mminus, ++mminus_Length, 0 );
- while( RLength > 1 && R[RLength - 1] == 0 ) {
- --RLength;
- }
- while( mplus_Length > 1 && mplus[mplus_Length - 1] == 0 ) {
- --mplus_Length;
- }
- while( mminus_Length > 1 && mminus[mminus_Length - 1] == 0 ) {
- --mminus_Length;
- }
- }
-
- getCount = setCount = 0;
- do{
-
- U = 0;
- for( i = 3; i >= 0; --i ) {
- TempLength = SLength + 1;
- Temp[SLength] = 0;
- memcpy( Temp, S, SLength * sizeof(unsigned long long) );
- BigInt::simpleShiftLeftHighPrecision( Temp, TempLength, i );
- if( BigInt::compareHighPrecision( R, RLength, Temp, TempLength ) >= 0 ) {
- BigInt::subtractHighPrecision( R, RLength, Temp, TempLength );
- U += 1 << i;
- }
- }
-
- low = BigInt::compareHighPrecision( R, RLength, mminus, mminus_Length ) <= 0;
-
- memset( Temp + RLength, 0, (STemp_SIZE - RLength) * sizeof(unsigned long long) );
- memcpy( Temp, R, RLength * sizeof(unsigned long long) );
- TempLength = (RLength > mplus_Length ? RLength : mplus_Length) + 1;
- BigInt::addHighPrecision( Temp, TempLength, mplus, mplus_Length );
-
- high = BigInt::compareHighPrecision( Temp, TempLength, S, SLength ) >= 0;
-
- if( low || high ) {
- break;
- }
-
- BigInt::simpleAppendDecimalDigitHighPrecision( R, ++RLength, 0 );
- BigInt::simpleAppendDecimalDigitHighPrecision( mplus, ++mplus_Length, 0 );
- BigInt::simpleAppendDecimalDigitHighPrecision( mminus, ++mminus_Length, 0 );
- while( RLength > 1 && R[RLength - 1] == 0 ) {
- --RLength;
- }
- while( mplus_Length > 1 && mplus[mplus_Length - 1] == 0 ) {
- --mplus_Length;
- }
- while( mminus_Length > 1 && mminus[mminus_Length - 1] == 0 ) {
- --mminus_Length;
- }
- uArray[setCount++] = U;
- }
- while( true );
-
- BigInt::simpleShiftLeftHighPrecision( R, ++RLength, 1 );
-
- if( low && !high ) {
- uArray[setCount++] = U;
- } else if( high && !low ) {
- uArray[setCount++] = U + 1;
- } else if( BigInt::compareHighPrecision( R, RLength, S, SLength) < 0 ) {
- uArray[setCount++] = U;
- } else {
- uArray[setCount++] = U + 1;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void NumberConverter::longDigitGenerator(
- long long f, int e, bool isDenormalized, bool mantissaIsZero, int p ) {
-
- unsigned long long R, S, M;
-
- if( e >= 0 ) {
- M = 1l << e;
- if( !mantissaIsZero ) {
- R = f << (e + 1);
- S = 2;
- } else {
- R = f << (e + 2);
- S = 4;
- }
- } else {
- M = 1;
- if( isDenormalized || !mantissaIsZero ) {
- R = f << 1;
- S = 1l << (1 - e);
- } else {
- R = f << 2;
- S = 1l << (2 - e);
- }
- }
-
- int k = (int)Math::ceil( (e + p - 1) * invLogOfTenBaseTwo - 1e-10 );
-
- if( k > 0 ) {
- S = S * TEN_TO_THE[k];
- } else if( k < 0 ) {
- long long scale = TEN_TO_THE[-k];
- R = R * scale;
- M = M == 1 ? scale : M * scale;
- }
-
- if( R + M > S ) { // was M_plus
- firstK = k;
- } else {
- firstK = k - 1;
- R = R * 10;
- M = M * 10;
- }
-
- getCount = setCount = 0; // reset indices
- bool low, high;
- int U;
- long long Si[4] = { S, S << 1, S << 2, S << 3 };
- while( true ) {
- // set U to be floor (R / S) and R to be the remainder
- // using a kind of "binary search" to find the answer.
- // It's a lot quicker than actually dividing since we know
- // the answer will be between 0 and 10
- U = 0;
- long long remainder;
- for( int i = 3; i >= 0; i-- ) {
- remainder = R - Si[i];
- if( remainder >= 0 ) {
- R = remainder;
- U += 1 << i;
- }
- }
-
- low = R < M; // was M_minus
- high = R + M > S; // was M_plus
-
- if( low || high ) {
- break;
- }
-
- R = R * 10;
- M = M * 10;
- uArray[setCount++] = U;
- }
-
- if( low && !high ) {
- uArray[setCount++] = U;
- } else if( high && !low ) {
- uArray[setCount++] = U + 1;
- } else if( ( R << 1 ) < S ) {
- uArray[setCount++] = U;
- } else {
- uArray[setCount++] = U + 1;
- }
-}
diff --git a/src/decaf/src/main/decaf/internal/util/NumberConverter.h b/src/decaf/src/main/decaf/internal/util/NumberConverter.h
deleted file mode 100644
index 05a6fd8..0000000
--- a/src/decaf/src/main/decaf/internal/util/NumberConverter.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_INTERNAL_UTIL_NUMBERCONVERTER_H_
-#define _DECAF_INTERNAL_UTIL_NUMBERCONVERTER_H_
-
-#include <decaf/util/Config.h>
-#include <vector>
-#include <string>
-
-namespace decaf{
-namespace internal{
-namespace util{
-
- class NumberConverter {
- private:
-
- int setCount;
- int getCount;
- int firstK;
- std::vector<int> uArray;
-
- static std::vector<long long> TEN_TO_THE;
- static const double invLogOfTenBaseTwo;
-
- // Internal class used to init static arrays
- struct StaticInitializer {
- StaticInitializer();
- };
-
- static StaticInitializer init;
-
- public:
-
- NumberConverter();
- virtual ~NumberConverter() {}
-
- /**
- * @param value - the double to convert
- * @returns the string representation of value
- */
- std::string convertD( double value );
-
- /**
- * @param value - the float to convert
- * @returns the string representation of value
- */
- std::string convertF( float value );
-
- public: // Statics
-
- /**
- * @param value to convert to a string
- * @returns the value converted to a string
- */
- static std::string convert( double value ) {
- return NumberConverter().convertD( value );
- }
-
- /**
- * @param value to convert to a string
- * @returns the value converted to a string
- */
- static std::string convert( float value ) {
- return NumberConverter().convertF( value );
- }
-
- private:
-
- std::string freeFormatExponential();
- std::string freeFormat();
-
- void bigIntDigitGeneratorInstImpl(
- long long f, int e, bool isDenormalized, bool mantissaIsZero, int p );
- void longDigitGenerator(
- long long f, int e, bool isDenormalized, bool mantissaIsZero, int p );
-
- };
-
-}}}
-
-#endif /*_DECAF_INTERNAL_UTIL_NUMBERCONVERTER_H_*/
diff --git a/src/decaf/src/main/decaf/io/BlockingByteArrayInputStream.cpp b/src/decaf/src/main/decaf/io/BlockingByteArrayInputStream.cpp
deleted file mode 100644
index c7c2475..0000000
--- a/src/decaf/src/main/decaf/io/BlockingByteArrayInputStream.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BlockingByteArrayInputStream.h"
-#include <algorithm>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::io;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-BlockingByteArrayInputStream::BlockingByteArrayInputStream(){
- pos = buffer.end();
- closing = false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-BlockingByteArrayInputStream::BlockingByteArrayInputStream(
- const unsigned char* buffer,
- std::size_t bufferSize ){
-
- closing = false;
- setByteArray( buffer, bufferSize );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-BlockingByteArrayInputStream::~BlockingByteArrayInputStream(){
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BlockingByteArrayInputStream::setByteArray( const unsigned char* lbuffer,
- std::size_t lbufferSize ){
- synchronized( this ){
-
- // Remove old data
- buffer.clear();
- buffer.reserve( lbufferSize );
-
- // Copy data to internal buffer.
- std::back_insert_iterator< std::vector<unsigned char> > iter( buffer );
- std::copy( lbuffer, lbuffer + lbufferSize, iter );
-
- // Begin at the Beginning.
- pos = this->buffer.begin();
-
- // Notify any listening threds that there is now data available.
- notifyAll();
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BlockingByteArrayInputStream::close() throw ( lang::Exception ){
-
- synchronized( this ){
-
- // Indicate that we're shutting down.
- closing = true;
-
- // Clear out the buffer.
- buffer.clear();
-
- // Notify that this stream is shutting down.
- notifyAll();
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned char BlockingByteArrayInputStream::read() throw ( IOException ){
-
- synchronized( this ){
-
- while( !closing ){
-
- if( pos != buffer.end() ){
- return *(pos++);
- }
-
- // Wait for more data
- wait();
- }
-
- throw IOException( __FILE__, __LINE__, "close occurred during read" );
- }
-
- return 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int BlockingByteArrayInputStream::read( unsigned char* buffer,
- std::size_t bufferSize )
- throw ( IOException ){
- synchronized( this ){
-
- std::size_t ix = 0;
-
- for( ; ix < bufferSize && !closing; ++ix, ++pos)
- {
- if(pos == this->buffer.end())
- {
- // Wait for more data to come in.
- wait();
- }
-
- if( !closing ){
- buffer[ix] = *(pos);
- }
- }
-
- if( closing ){
- throw IOException(
- __FILE__, __LINE__, "close occurred during read" );
- }
-
- return ix;
- }
-
- return 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::size_t BlockingByteArrayInputStream::skip( std::size_t num )
- throw ( io::IOException, lang::exceptions::UnsupportedOperationException ){
-
- std::size_t ix = 0;
-
- synchronized( this ){
-
- // Increment the pos until we'v skipped the desired num
- // or we've hit the end of the buffer.
- for( ; ix < num && !closing && pos != buffer.end(); ++ix, ++pos) {}
- }
-
- return ix;
-}
-
-
diff --git a/src/decaf/src/main/decaf/io/BlockingByteArrayInputStream.h b/src/decaf/src/main/decaf/io/BlockingByteArrayInputStream.h
deleted file mode 100644
index c4ca129..0000000
--- a/src/decaf/src/main/decaf/io/BlockingByteArrayInputStream.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_BLOCKINGBYTEARRAYINPUTSTREAM_H_
-#define _DECAF_IO_BLOCKINGBYTEARRAYINPUTSTREAM_H_
-
-#include <decaf/io/InputStream.h>
-#include <decaf/util/concurrent/Mutex.h>
-#include <vector>
-
-namespace decaf{
-namespace io{
-
- /**
- * This is a blocking version of a byte buffer stream. Read operations
- * block until the requested data becomes available in the internal
- * buffer via a call to setByteArray.
- */
- class DECAF_API BlockingByteArrayInputStream : public InputStream
- {
- private:
-
- /**
- * Default buffer to use, if none provided.
- */
- std::vector<unsigned char> buffer;
-
- /**
- * iterator to current position in buffer.
- */
- std::vector<unsigned char>::const_iterator pos;
-
- /**
- * Synchronization object.
- */
- util::concurrent::Mutex mutex;
-
- /**
- * Indicates that this stream is in the process of shutting
- * down.
- */
- bool closing;
-
- public:
-
- /**
- * Default Constructor - uses a default internal buffer
- */
- BlockingByteArrayInputStream();
-
- /**
- * Constructor that initializes the internal buffer.
- * @see setByteArray.
- */
- BlockingByteArrayInputStream( const unsigned char* buffer,
- std::size_t bufferSize );
-
- /**
- * Destructor
- */
- virtual ~BlockingByteArrayInputStream();
-
- /**
- * Sets the data that this reader uses. Replaces any existing
- * data and resets the read index to the beginning of the buffer.
- * When this method is called, it notifies any other threads that
- * data is now available to be read.
- * @param buffer The new data to be copied to the internal buffer.
- * @param bufferSize The size of the new buffer.
- */
- virtual void setByteArray( const unsigned char* buffer,
- std::size_t bufferSize );
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void lock() throw( lang::Exception ){
- mutex.lock();
- }
-
- /**
- * Unlocks the object.
- * @throws Exception
- */
- virtual void unlock() throw( lang::Exception ){
- mutex.unlock();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void wait() throw( lang::Exception ){
- mutex.wait();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param time in millisecsonds to wait, or WAIT_INIFINITE
- * @throws Exception
- */
- virtual void wait( unsigned long millisecs ) throw( lang::Exception ){
- mutex.wait(millisecs);
- }
-
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notify() throw( lang::Exception ){
- mutex.notify();
- }
-
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notifyAll() throw( lang::Exception ){
- mutex.notifyAll();
- }
-
- /**
- * Indicates the number of bytes available to be read without
- * blocking.
- * @return the data available in the internal buffer.
- * @throws IOException if an error occurs.
- */
- virtual std::size_t available() const throw ( IOException ){
- return std::distance( pos, buffer.end() );
- }
-
- /**
- * Reads a single byte from the buffer. This operation will
- * block until data has been added to the buffer via a call
- * to setByteArray.
- * @return the next byte.
- * @throws IOException if an error occurs.
- */
- virtual unsigned char read() throw ( IOException );
-
- /**
- * Reads an array of bytes from the buffer. If the desired amount
- * of data is not currently available, this operation
- * will block until the appropriate amount of data is available
- * in the buffer via a call to setByteArray.
- * @param buffer (out) the target buffer
- * @param bufferSize the size of the output buffer.
- * @return the number of bytes read. or -1 if EOF
- * @throws IOException f an error occurs.
- */
- virtual int read( unsigned char* buffer, std::size_t bufferSize )
- throw ( IOException );
-
- /**
- * Closes the target input stream.
- * @throws IOException if an error occurs.
- */
- virtual void close() throw ( lang::Exception );
-
- /**
- * Skips over and discards n bytes of data from this input stream. The
- * skip method may, for a variety of reasons, end up skipping over some
- * smaller number of bytes, possibly 0. This may result from any of a
- * number of conditions; reaching end of file before n bytes have been
- * skipped is only one possibility. The actual number of bytes skipped
- * is returned. If n is negative, no bytes are skipped.
- * <p>
- * The skip method of InputStream creates a byte array and then
- * repeatedly reads into it until n bytes have been read or the end
- * of the stream has been reached. Subclasses are encouraged to
- * provide a more efficient implementation of this method.
- * @param num - the number of bytes to skip
- * @returns total butes skipped
- * @throws IOException if an error occurs
- */
- virtual std::size_t skip( std::size_t num )
- throw ( io::IOException, lang::exceptions::UnsupportedOperationException );
-
- };
-
-}}
-
-#endif /*_DECAF_IO_BLOCKINGBYTEARRAYINPUTSTREAM_H_*/
diff --git a/src/decaf/src/main/decaf/io/BufferedInputStream.cpp b/src/decaf/src/main/decaf/io/BufferedInputStream.cpp
deleted file mode 100644
index 349eb53..0000000
--- a/src/decaf/src/main/decaf/io/BufferedInputStream.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BufferedInputStream.h"
-#include <algorithm>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::io;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-BufferedInputStream::BufferedInputStream( InputStream* stream, bool own )
-: FilterInputStream( stream, own )
-{
- // Default to a 1k buffer.
- init( 1024 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-BufferedInputStream::BufferedInputStream( InputStream* stream,
- std::size_t bufferSize,
- bool own )
-: FilterInputStream( stream, own )
-{
- init( bufferSize );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-BufferedInputStream::~BufferedInputStream()
-{
- // Destroy the buffer.
- if( buffer != NULL ){
- delete [] buffer;
- buffer = NULL;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BufferedInputStream::init( std::size_t bufferSize ){
-
- this->bufferSize = bufferSize;
-
- // Create the buffer and initialize the head and tail positions.
- buffer = new unsigned char[bufferSize];
- head = 0;
- tail = 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned char BufferedInputStream::read() throw ( IOException ){
-
- try{
- // If there's no data left, reset to pointers to the beginning of the
- // buffer.
- normalizeBuffer();
-
- // If we don't have any data buffered yet - read as much as
- // we can.
- if( isEmpty() ){
-
- // If we hit EOF without getting any Data, then throw IOException
- if( bufferData() == -1 ){
- throw IOException(
- __FILE__, __LINE__,
- "BufferedInputStream::read - EOF has been Reached");
- }
- }
-
- // Get the next character.
- char returnValue = buffer[head++];
-
- return returnValue;
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int BufferedInputStream::read( unsigned char* targetBuffer,
- std::size_t targetBufferSize ) throw ( IOException ){
-
- try{
-
- // For zero, do nothing
- if( targetBufferSize == 0 ) {
- return 0;
- }
-
- // If there's no data left, reset to pointers to the beginning of the
- // buffer.
- normalizeBuffer();
-
- // If we still haven't filled the output buffer AND there is data
- // on the input stream to be read, read a buffer's worth from the stream.
- std::size_t totalRead = 0;
- while( totalRead < targetBufferSize ){
-
- // Get the remaining bytes to copy.
- std::size_t bytesToCopy = min( tail-head, (targetBufferSize-totalRead) );
-
- // Copy the data to the output buffer.
- memcpy( targetBuffer+totalRead, this->buffer+head, bytesToCopy );
-
- // Increment the total bytes read.
- totalRead += bytesToCopy;
-
- // Increment the head position.
- head += bytesToCopy;
-
- // If the buffer is now empty, reset the positions to the
- // head of the buffer.
- normalizeBuffer();
-
- // If we still haven't satisified the request,
- // read more data.
- if( totalRead < targetBufferSize ){
-
- // Buffer as much data as we can, return EOF if we hit it.
- if( bufferData() == -1 ) {
- return -1;
- }
- }
- }
-
- // Return the total number of bytes read.
- return totalRead;
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::size_t BufferedInputStream::skip( std::size_t num )
- throw ( IOException, lang::exceptions::UnsupportedOperationException ){
-
- try{
- // If there's no data left, reset to pointers to the beginning of the
- // buffer.
- normalizeBuffer();
-
- // loop until we've skipped the desired number of bytes
- std::size_t totalSkipped = 0;
- while( totalSkipped < num ){
-
- // Get the remaining bytes to copy.
- std::size_t bytesToSkip = min( tail-head, num-totalSkipped );
-
- // Increment the head position.
- head += bytesToSkip;
-
- // If the buffer is now empty, reset the positions to the
- // head of the buffer.
- normalizeBuffer();
-
- // If we still haven't satisified the request,
- // read more data.
- if( totalSkipped < num ){
-
- // Buffer as much data as we can.
- bufferData();
- }
- }
-
- // Return the total number of bytes read.
- return totalSkipped;
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int BufferedInputStream::bufferData() throw ( IOException ){
-
- try{
- if( getUnusedBytes() == 0 ){
- throw IOException( __FILE__, __LINE__,
- "BufferedInputStream::bufferData - buffer full" );
- }
-
- // Get the number of bytes currently available on the input stream
- // that could be read without blocking.
- std::size_t available = inputStream->available();
-
- // Calculate the number of bytes that we can read. Always >= 1 byte!
- std::size_t bytesToRead = max( (std::size_t)1, min( available, getUnusedBytes() ) );
-
- // Read the bytes from the input stream.
- int bytesRead = inputStream->read( getTail(), bytesToRead );
- if( bytesRead == 0 ){
- throw IOException( __FILE__, __LINE__,
- "BufferedInputStream::read() - failed reading bytes from stream");
- }
-
- // Dont add -1 to tail if we hit EOF
- if( bytesRead == -1 ) {
- return bytesRead;
- }
-
- // Increment the tail to the new end position.
- tail += bytesRead;
-
- return bytesRead;
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
diff --git a/src/decaf/src/main/decaf/io/BufferedInputStream.h b/src/decaf/src/main/decaf/io/BufferedInputStream.h
deleted file mode 100644
index c840a50..0000000
--- a/src/decaf/src/main/decaf/io/BufferedInputStream.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_BUFFEREDINPUTSTREAM_H_
-#define _DECAF_IO_BUFFEREDINPUTSTREAM_H_
-
-#include <decaf/io/FilterInputStream.h>
-#include <assert.h>
-
-namespace decaf{
-namespace io{
-
- /**
- * A wrapper around another input stream that performs
- * a buffered read, where it reads more data than it needs
- * in order to reduce the number of io operations on the
- * input stream.
- */
- class DECAF_API BufferedInputStream : public FilterInputStream
- {
- private:
-
- /**
- * The internal buffer.
- */
- unsigned char* buffer;
-
- /**
- * The buffer size.
- */
- std::size_t bufferSize;
-
- /**
- * The current head of the buffer.
- */
- std::size_t head;
-
- /**
- * The current tail of the buffer.
- */
- std::size_t tail;
-
- public:
-
- /**
- * Constructor
- * @param stream The target input stream.
- * @param own indicates if we own the stream object, defaults to false
- */
- BufferedInputStream( InputStream* stream, bool own = false );
-
- /**
- * Constructor
- * @param stream the target input stream
- * @param bufferSize the size for the internal buffer.
- * @param own indicates if we own the stream object, defaults to false.
- */
- BufferedInputStream( InputStream* stream,
- std::size_t bufferSize,
- bool own = false);
-
- virtual ~BufferedInputStream();
-
- /**
- * Indcates the number of bytes avaialable.
- * @return the sum of the amount of data avalable
- * in the buffer and the data available on the target
- * input stream.
- */
- virtual std::size_t available() const throw ( IOException ) {
- return ( tail - head ) + inputStream->available();
- }
-
- /**
- * Reads a single byte from the buffer. Blocks until
- * the data is available.
- * @return The next byte.
- * @throws IOException thrown if an error occurs.
- */
- virtual unsigned char read() throw ( IOException );
-
- /**
- * Reads an array of bytes from the buffer. Blocks
- * until the requested number of bytes are available.
- * @param buffer (out) the target buffer.
- * @param bufferSize the size of the output buffer.
- * @return The number of bytes read or -1 if EOF
- * @throws IOException thrown if an error occurs.
- */
- virtual int read( unsigned char* buffer, std::size_t bufferSize )
- throw ( IOException );
-
- /**
- * Skips over and discards n bytes of data from this input stream. The
- * skip method may, for a variety of reasons, end up skipping over some
- * smaller number of bytes, possibly 0. This may result from any of a
- * number of conditions; reaching end of file before n bytes have been
- * skipped is only one possibility. The actual number of bytes skipped
- * is returned. If n is negative, no bytes are skipped.
- * <p>
- * The skip method of InputStream creates a byte array and then
- * repeatedly reads into it until n bytes have been read or the end
- * of the stream has been reached. Subclasses are encouraged to
- * provide a more efficient implementation of this method.
- * @param num - the number of bytes to skip
- * @returns total butes skipped
- * @throws IOException if an error occurs
- */
- virtual std::size_t skip( std::size_t num )
- throw ( io::IOException, lang::exceptions::UnsupportedOperationException );
-
- private:
-
- /**
- * Initializes the internal structures.
- * @param size of buffer to allocate
- */
- void init( std::size_t bufferSize );
-
- /**
- * Populates the buffer with as much data as possible
- * from the target input stream.
- * @returns total bytes read, or -1 if EOF.
- * @throws CMSException
- */
- int bufferData() throw ( IOException );
-
- /**
- * Returns the number of bytes that are currently unused
- * in the buffer.
- */
- std::size_t getUnusedBytes() const{
- return bufferSize - tail;
- }
-
- /**
- * Returns the current tail position of the buffer.
- */
- unsigned char* getTail(){
- return buffer + tail;
- }
-
- /**
- * Initializes the head and tail indicies to the beginning
- * of the buffer.
- */
- void clear(){
- head = tail = 0;
- }
-
- /**
- * Inidicates whether or not the buffer is empty.
- */
- bool isEmpty() const{
- return head == tail;
- }
-
- /**
- * Clears the buffer if there is no data remaining.
- */
- void normalizeBuffer(){
- if( isEmpty() ){
- clear();
- }
- }
-
- };
-
-}}
-
-#endif /*_DECAF_IO_BUFFEREDINPUTSTREAM_H_*/
diff --git a/src/decaf/src/main/decaf/io/BufferedOutputStream.cpp b/src/decaf/src/main/decaf/io/BufferedOutputStream.cpp
deleted file mode 100644
index 741ccde..0000000
--- a/src/decaf/src/main/decaf/io/BufferedOutputStream.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BufferedOutputStream.h"
-#include <algorithm>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::io;
-
-////////////////////////////////////////////////////////////////////////////////
-BufferedOutputStream::BufferedOutputStream( OutputStream* stream, bool own )
-: FilterOutputStream( stream, own )
-{
- // Default to 1k buffer.
- init( 1024 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-BufferedOutputStream::BufferedOutputStream( OutputStream* stream,
- std::size_t bufSize,
- bool own )
-: FilterOutputStream( stream, own )
-{
- init( bufSize );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-BufferedOutputStream::~BufferedOutputStream()
-{
- // Destroy the buffer.
- if( buffer != NULL ){
- delete [] buffer;
- buffer = NULL;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BufferedOutputStream::init( std::size_t bufSize ){
-
- this->bufferSize = bufSize;
-
- buffer = new unsigned char[bufSize];
- head = tail = 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BufferedOutputStream::close() throw( lang::Exception ){
-
- // Flush this stream.
- flush();
-
- // Close the delegate stream.
- outputStream->close();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BufferedOutputStream::emptyBuffer() throw ( IOException ){
-
- if( head != tail ){
- outputStream->write( buffer+head, tail-head );
- }
- head = tail = 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BufferedOutputStream::flush() throw ( IOException ){
-
- // Empty the contents of the buffer to the output stream.
- emptyBuffer();
-
- // Flush the output stream.
- outputStream->flush();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BufferedOutputStream::write( const unsigned char c ) throw ( IOException ){
-
- if( tail >= bufferSize ){
- emptyBuffer();
- }
-
- buffer[tail++] = c;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BufferedOutputStream::write( const unsigned char* buffer, std::size_t len )
- throw ( IOException )
-{
- // Iterate until all the data is written.
- for( std::size_t pos=0; pos < len; ){
-
- if( tail >= bufferSize ){
- emptyBuffer();
- }
-
- // Get the number of bytes left to write.
- std::size_t bytesToWrite = min( (int)bufferSize-tail, len-pos );
-
- // Copy the data.
- memcpy( this->buffer+tail, buffer+pos, bytesToWrite );
-
- // Increase the tail position.
- tail += bytesToWrite;
-
- // Decrease the number of bytes to write.
- pos += bytesToWrite;
- }
-}
diff --git a/src/decaf/src/main/decaf/io/BufferedOutputStream.h b/src/decaf/src/main/decaf/io/BufferedOutputStream.h
deleted file mode 100644
index 07e6b66..0000000
--- a/src/decaf/src/main/decaf/io/BufferedOutputStream.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_BUFFEREDOUTPUTSTREAM_H_
-#define _DECAF_IO_BUFFEREDOUTPUTSTREAM_H_
-
-#include <decaf/io/FilterOutputStream.h>
-#include <assert.h>
-
-namespace decaf{
-namespace io{
-
- /**
- * Wrapper around another output stream that buffers
- * output before writing to the target output stream.
- */
- class DECAF_API BufferedOutputStream : public FilterOutputStream
- {
- private:
-
- /**
- * The internal buffer.
- */
- unsigned char* buffer;
-
- /**
- * The size of the internal buffer.
- */
- std::size_t bufferSize;
-
- /**
- * The current head of the buffer.
- */
- std::size_t head;
-
- /**
- * The current tail of the buffer.
- */
- std::size_t tail;
-
- public:
-
- /**
- * Constructor.
- * @param stream the target output stream.
- */
- BufferedOutputStream( OutputStream* stream, bool own = false );
-
- /**
- * Constructor
- * @param stream the target output stream.
- * @param bufSize the size for the internal buffer.
- */
- BufferedOutputStream( OutputStream* stream,
- std::size_t bufSize,
- bool own = false);
-
- virtual ~BufferedOutputStream();
-
- /**
- * Writes a single byte to the output stream.
- * @param c the byte.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( unsigned char c ) throw ( IOException );
-
- /**
- * Writes an array of bytes to the output stream.
- * @param buffer The array of bytes to write.
- * @param len The number of bytes from the buffer to be written.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( const unsigned char* buffer, std::size_t len )
- throw ( IOException );
-
- /**
- * Invokes flush on the target output stream.
- * @throws IOException thrown if an error occurs.
- */
- virtual void flush() throw ( IOException );
-
- /**
- * Invokes close on the target output stream.
- * @throws CMSException thrown if an error occurs.
- */
- void close() throw( lang::Exception );
-
- private:
-
- /**
- * Initializes the internal structures.
- */
- void init( std::size_t bufSize );
-
- /**
- * Writes the contents of the buffer to the output stream.
- */
- void emptyBuffer() throw ( IOException );
-
- };
-
-}}
-
-#endif /*_DECAF_IO_BUFFEREDOUTPUTSTREAM_H_*/
diff --git a/src/decaf/src/main/decaf/io/ByteArrayInputStream.cpp b/src/decaf/src/main/decaf/io/ByteArrayInputStream.cpp
deleted file mode 100644
index ca2e035..0000000
--- a/src/decaf/src/main/decaf/io/ByteArrayInputStream.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "ByteArrayInputStream.h"
-#include <algorithm>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::io;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-ByteArrayInputStream::ByteArrayInputStream(){
-}
-
-////////////////////////////////////////////////////////////////////////////////
-ByteArrayInputStream::ByteArrayInputStream( const vector<unsigned char>& buffer ){
- setBuffer(buffer);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-ByteArrayInputStream::ByteArrayInputStream( const unsigned char* buffer,
- std::size_t bufferSize ){
- setByteArray( buffer, bufferSize );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-ByteArrayInputStream::~ByteArrayInputStream(){
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ByteArrayInputStream::setBuffer( const vector<unsigned char>& buffer ){
-
- // We're using the default buffer.
- activeBuffer = &buffer;
-
- // Begin at the Beginning.
- reset();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ByteArrayInputStream::setByteArray( const unsigned char* lbuffer,
- std::size_t lbufferSize ){
- // We're using the default buffer.
- activeBuffer = &defaultBuffer;
-
- // Remove old data
- defaultBuffer.clear();
- defaultBuffer.reserve( lbufferSize );
-
- // Copy data to internal buffer.
- std::back_insert_iterator< std::vector<unsigned char> > iter( defaultBuffer );
- std::copy( lbuffer, lbuffer + lbufferSize, iter );
-
- // Begin at the Beginning.
- reset();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ByteArrayInputStream::reset() throw ( lang::Exception){
- if( activeBuffer == NULL ){
- throw IOException( __FILE__, __LINE__, "Buffer has not been initialized" );
- }
-
- // Begin at the Beginning.
- pos = activeBuffer->begin();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned char ByteArrayInputStream::read() throw ( IOException ){
- if( pos == activeBuffer->end() ){
- throw IOException( __FILE__, __LINE__, "Buffer is empty" );
- }
-
- return *(pos++);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int ByteArrayInputStream::read( unsigned char* buffer,
- std::size_t bufferSize )
- throw ( IOException ){
- std::size_t ix = 0;
-
- if( pos == activeBuffer->end() ) {
- return -1;
- }
-
- // How far are we from end
- std::size_t remaining = (std::size_t)distance( pos, activeBuffer->end() );
-
- // We only read as much as is left if the amount remaining is less than
- // the amount of data asked for.
- bufferSize = remaining < bufferSize ? remaining : bufferSize;
-
- for( ; ix < bufferSize; ++ix, ++pos) {
- buffer[ix] = *(pos);
- }
-
- return ix;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::size_t ByteArrayInputStream::skip( std::size_t num )
- throw ( IOException, lang::exceptions::UnsupportedOperationException ){
-
- std::size_t ix = 0;
-
- // Increment the position until we've skipped the desired number
- // or we've hit the end of the buffer.
- for( ; ix < num && pos != activeBuffer->end(); ++ix, ++pos) {}
-
- return ix;
-}
diff --git a/src/decaf/src/main/decaf/io/ByteArrayInputStream.h b/src/decaf/src/main/decaf/io/ByteArrayInputStream.h
deleted file mode 100644
index e735bab..0000000
--- a/src/decaf/src/main/decaf/io/ByteArrayInputStream.h
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_BYTEARRAYINPUTSTREAM_H_
-#define _DECAF_IO_BYTEARRAYINPUTSTREAM_H_
-
-#include <decaf/io/InputStream.h>
-#include <decaf/util/concurrent/Mutex.h>
-#include <vector>
-#include <algorithm>
-
-namespace decaf{
-namespace io{
-
- /**
- * Simple implementation of InputStream that wraps around
- * a std::vector<unsigned char>.
- */
- class DECAF_API ByteArrayInputStream : public InputStream
- {
- private:
-
- /**
- * Default buffer to use, if none provided.
- */
- std::vector<unsigned char> defaultBuffer;
-
- /**
- * Reference to the buffer being used by this stream.
- */
- const std::vector<unsigned char>* activeBuffer;
-
- /**
- * iterator to current position in buffer.
- */
- std::vector<unsigned char>::const_iterator pos;
-
- /**
- * Synchronization object.
- */
- util::concurrent::Mutex mutex;
-
- public:
-
- /**
- * Default Constructor
- */
- ByteArrayInputStream();
-
- /**
- * Creates the input stream and calls setBuffer with the
- * specified buffer object.
- * @param buffer The buffer to be used.
- */
- ByteArrayInputStream( const std::vector<unsigned char>& buffer );
-
- /**
- * Constructor
- * @param buffer initial byte array to use to read from
- * @param bufferSize the size of the buffer
- */
- ByteArrayInputStream( const unsigned char* buffer,
- std::size_t bufferSize );
-
- virtual ~ByteArrayInputStream();
-
- /**
- * Sets the internal buffer. The input stream will wrap around
- * this buffer and will perform all read operations on it. The
- * position will be reinitialized to the beginning of the specified
- * buffer. This class will not own the given buffer - it is the
- * caller's responsibility to free the memory of the given buffer
- * as appropriate.
- * @param buffer The buffer to be used.
- */
- virtual void setBuffer( const std::vector<unsigned char>& buffer );
-
- /**
- * Sets the data that this reader uses, replaces any existing
- * data and resets to beginning of the buffer.
- * @param buffer initial byte array to use to read from
- * @param bufferSize the size of the buffer
- */
- virtual void setByteArray( const unsigned char* buffer,
- std::size_t bufferSize );
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void lock() throw( lang::Exception ){
- mutex.lock();
- }
-
- /**
- * Unlocks the object.
- * @throws Exception
- */
- virtual void unlock() throw( lang::Exception ){
- mutex.unlock();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void wait() throw( lang::Exception ){
- mutex.wait();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param millisecs the time in millisecsonds to wait, or
- * WAIT_INIFINITE
- * @throws Exception
- */
- virtual void wait( unsigned long millisecs ) throw( lang::Exception ){
- mutex.wait(millisecs);
- }
-
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notify() throw( lang::Exception ){
- mutex.notify();
- }
-
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notifyAll() throw( lang::Exception ){
- mutex.notifyAll();
- }
-
- /**
- * Indcates the number of bytes avaialable.
- * @return The number of bytes until the end of the internal buffer.
- */
- virtual std::size_t available() const throw ( IOException ) {
- if( activeBuffer == NULL ){
- throw IOException(
- __FILE__, __LINE__,
- "buffer has not been initialized");
- }
-
- return std::distance( pos, activeBuffer->end() );
- }
-
- /**
- * Reads a single byte from the buffer.
- * @return The next byte.
- * @throws IOException thrown if an error occurs.
- */
- virtual unsigned char read() throw ( IOException );
-
- /**
- * Reads an array of bytes from the buffer.
- * @param buffer (out) the target buffer.
- * @param bufferSize the size of the output buffer.
- * @return The number of bytes read.
- * @throws IOException thrown if an error occurs.
- */
- virtual int read( unsigned char* buffer, std::size_t bufferSize )
- throw ( IOException );
-
- /**
- * Closes the target input stream.
- * @throws IOException thrown if an error occurs.
- */
- virtual void close() throw( lang::Exception ){ /* do nothing */ }
-
- /**
- * Resets the read index to the beginning of the byte
- * array.
- */
- virtual void reset() throw ( lang::Exception);
-
- /**
- * Skips over and discards n bytes of data from this input stream. The
- * skip method may, for a variety of reasons, end up skipping over some
- * smaller number of bytes, possibly 0. This may result from any of a
- * number of conditions; reaching end of file before n bytes have been
- * skipped is only one possibility. The actual number of bytes skipped
- * is returned. If n is negative, no bytes are skipped.
- * <p>
- * The skip method of InputStream creates a byte array and then
- * repeatedly reads into it until n bytes have been read or the end
- * of the stream has been reached. Subclasses are encouraged to
- * provide a more efficient implementation of this method.
- * @param num - the number of bytes to skip
- * @returns total butes skipped
- * @throws IOException if an error occurs
- */
- virtual std::size_t skip( std::size_t num )
- throw ( io::IOException, lang::exceptions::UnsupportedOperationException );
-
- };
-
-}}
-
-#endif /*_DECAF_IO_BYTEARRAYINPUTSTREAM_H_*/
diff --git a/src/decaf/src/main/decaf/io/ByteArrayOutputStream.cpp b/src/decaf/src/main/decaf/io/ByteArrayOutputStream.cpp
deleted file mode 100644
index 0be3354..0000000
--- a/src/decaf/src/main/decaf/io/ByteArrayOutputStream.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "ByteArrayOutputStream.h"
-#include <algorithm>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::io;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-ByteArrayOutputStream::ByteArrayOutputStream()
-{
- activeBuffer = &defaultBuffer;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-ByteArrayOutputStream::ByteArrayOutputStream( vector<unsigned char>& buffer)
-{
- setBuffer( buffer );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ByteArrayOutputStream::setBuffer( vector<unsigned char>& buffer)
-{
- activeBuffer = &buffer;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ByteArrayOutputStream::clear() throw ( IOException )
-{
- // Empty the contents of the buffer to the output stream.
- activeBuffer->clear();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ByteArrayOutputStream::write( unsigned char c )
- throw ( IOException )
-{
- activeBuffer->push_back( c );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ByteArrayOutputStream::write( const unsigned char* buffer,
- std::size_t len )
- throw ( IOException )
-{
- std::back_insert_iterator< std::vector<unsigned char> > iter( *activeBuffer );
- std::copy( buffer, buffer + len, iter );
-}
-
diff --git a/src/decaf/src/main/decaf/io/ByteArrayOutputStream.h b/src/decaf/src/main/decaf/io/ByteArrayOutputStream.h
deleted file mode 100644
index a8ae484..0000000
--- a/src/decaf/src/main/decaf/io/ByteArrayOutputStream.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_BYTEARRAYOUTPUTSTREAM_H_
-#define _DECAF_IO_BYTEARRAYOUTPUTSTREAM_H_
-
-#include <decaf/io/OutputStream.h>
-#include <decaf/util/concurrent/Mutex.h>
-#include <vector>
-
-namespace decaf{
-namespace io{
-
- class DECAF_API ByteArrayOutputStream : public OutputStream
- {
- private:
-
- /**
- * Default buffer to use, if none provided.
- */
- std::vector<unsigned char> defaultBuffer;
-
- /**
- * Reference to the buffer being used by this stream.
- */
- std::vector<unsigned char>* activeBuffer;
-
- /**
- * Synchronization object.
- */
- util::concurrent::Mutex mutex;
-
- public:
-
- /**
- * Default Constructor - uses a default internal buffer
- */
- ByteArrayOutputStream();
-
- /**
- * Uses the given buffer as the target. Calls setBuffer.
- * @param buffer the target buffer.
- */
- ByteArrayOutputStream( std::vector<unsigned char>& buffer );
-
- /**
- * Destructor
- */
- virtual ~ByteArrayOutputStream() {};
-
- /**
- * Sets the internal buffer. This input stream will wrap around
- * the given buffer and all writes will be performed directly on
- * the buffer. This object does not retain control of the buffer's
- * lifetime however - this is the job of the caller.
- * @param buffer The target buffer.
- */
- virtual void setBuffer( std::vector<unsigned char>& buffer );
-
- /**
- * Get a snapshot of the data
- * @return pointer to the data
- */
- virtual const unsigned char* getByteArray() const {
- if( activeBuffer->size() == 0 ){
- return NULL;
- }
-
- return &(*activeBuffer)[0];
- }
-
- /**
- * Get the Size of the Internal Buffer
- * @return size of the internal buffer
- */
- virtual std::size_t getByteArraySize() const {
- return activeBuffer->size();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void lock() throw( lang::Exception ){
- mutex.lock();
- }
-
- /**
- * Unlocks the object.
- * @throws Exception
- */
- virtual void unlock() throw( lang::Exception ){
- mutex.unlock();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void wait() throw( lang::Exception ){
- mutex.wait();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param time in millisecsonds to wait, or WAIT_INIFINITE
- * @throws Exception
- */
- virtual void wait( unsigned long millisecs ) throw( lang::Exception ){
- mutex.wait(millisecs);
- }
-
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notify() throw( lang::Exception ){
- mutex.notify();
- }
-
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notifyAll() throw( lang::Exception ){
- mutex.notifyAll();
- }
-
- /**
- * Writes a single byte to the output stream.
- * @param c the byte.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( unsigned char c )
- throw ( IOException );
-
- /**
- * Writes an array of bytes to the output stream.
- * @param buffer The array of bytes to write.
- * @param len The number of bytes from the buffer to be written.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( const unsigned char* buffer, std::size_t len )
- throw ( IOException );
-
- /**
- * Invokes flush on the target output stream, has no affect.
- * @throws IOException
- */
- virtual void flush() throw ( IOException ){ /* do nothing */ }
-
- /**
- * Clear current Stream contents
- * @throws IOException
- */
- virtual void clear() throw ( IOException );
-
- /**
- * Invokes close on the target output stream.
- * @throws CMSException
- */
- void close() throw( lang::Exception ){ /* do nothing */ }
-
- };
-
-}}
-
-#endif /*_DECAF_IO_BYTEARRAYOUTPUTSTREAM_H_*/
diff --git a/src/decaf/src/main/decaf/io/Closeable.h b/src/decaf/src/main/decaf/io/Closeable.h
deleted file mode 100644
index f3e8d3e..0000000
--- a/src/decaf/src/main/decaf/io/Closeable.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_CLOSEABLE_H_
-#define _DECAF_IO_CLOSEABLE_H_
-
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace io{
-
- /**
- * Interface for a class that implements the close method.
- */
- class DECAF_API Closeable{
-
- public:
-
- virtual ~Closeable(){}
-
- /**
- * Closes this object and deallocates the appropriate resources.
- * The object is generally no longer usable after calling close.
- * @throws CMSException
- */
- virtual void close() throw( lang::Exception ) = 0;
-
- };
-
-}}
-
-#endif /*_DECAF_IO_CLOSEABLE_H_*/
diff --git a/src/decaf/src/main/decaf/io/DataInputStream.cpp b/src/decaf/src/main/decaf/io/DataInputStream.cpp
deleted file mode 100644
index e0ebc10..0000000
--- a/src/decaf/src/main/decaf/io/DataInputStream.cpp
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <decaf/io/DataInputStream.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::io;
-using namespace decaf::util;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-DataInputStream::DataInputStream( InputStream* inputStream, bool own )
- : FilterInputStream( inputStream, own ) {}
-
-////////////////////////////////////////////////////////////////////////////////
-DataInputStream::~DataInputStream() {}
-
-////////////////////////////////////////////////////////////////////////////////
-int DataInputStream::read( std::vector<unsigned char>& buffer )
- throw ( io::IOException ) {
-
- try {
- return this->read( &buffer[0], 0, buffer.size() );
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int DataInputStream::read( unsigned char* buffer,
- std::size_t offset,
- std::size_t length )
- throw ( IOException, IndexOutOfBoundsException, NullPointerException ) {
-
- try {
-
- if( buffer == NULL ) {
- throw NullPointerException(
- __FILE__, __LINE__,
- "DataInputStream::read - Buffer is null" );
- }
-
- return inputStream->read( &buffer[offset], length );
- }
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_RETHROW( NullPointerException )
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool DataInputStream::readBoolean()
- throw( IOException, EOFException ) {
-
- try {
- unsigned char value = 0;
- readAllData( &value, sizeof(value) );
- return (bool)( value != 0 );
- }
- DECAF_CATCH_RETHROW( EOFException )
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-char DataInputStream::readByte()
- throw ( IOException, EOFException ) {
-
- try {
- unsigned char value = 0;
- readAllData( &value, sizeof(value) );
- return (char)( value );
- }
- DECAF_CATCH_RETHROW( EOFException )
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned char DataInputStream::readUnsignedByte()
- throw ( IOException, EOFException ) {
-
- try {
- unsigned char value = 0;
- readAllData( &value, sizeof(value) );
- return value;
- }
- DECAF_CATCH_RETHROW( EOFException )
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-char DataInputStream::readChar() throw ( IOException, EOFException ) {
- try {
- unsigned char value = 0;
- readAllData( &value, sizeof(value) );
- return (char)( value );
- }
- DECAF_CATCH_RETHROW( EOFException )
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-short DataInputStream::readShort() throw ( io::IOException, io::EOFException ) {
- try {
- short value = 0;
- unsigned char buffer[sizeof(value)] = {0};
- readAllData( buffer, sizeof(value) );
- value |= (buffer[0] << 8 | buffer[1] << 0);
- return value;
- }
- DECAF_CATCH_RETHROW( EOFException )
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned short DataInputStream::readUnsignedShort()
- throw ( io::IOException, io::EOFException ) {
- try {
- unsigned short value = 0;
- unsigned char buffer[sizeof(value)] = {0};
- readAllData( buffer, sizeof(value) );
- value |= (buffer[0] << 8 | buffer[1] << 0);
- return value;
- }
- DECAF_CATCH_RETHROW( EOFException )
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int DataInputStream::readInt() throw ( io::IOException, io::EOFException ) {
- try {
- unsigned int value = 0;
- unsigned char buffer[sizeof(value)] = {0};
- readAllData( buffer, sizeof(value) );
- value |= (buffer[0] << 24 | buffer[1] << 16 |
- buffer[2] << 8 | buffer[3] << 0);
- return value;
- }
- DECAF_CATCH_RETHROW( EOFException )
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double DataInputStream::readDouble() throw ( io::IOException, io::EOFException ) {
- try {
- unsigned long long lvalue = this->readLong();
- double value = 0.0;
- memcpy( &value, &lvalue, sizeof( unsigned long long ) );
- return value;
- }
- DECAF_CATCH_RETHROW( EOFException )
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-float DataInputStream::readFloat() throw ( io::IOException, io::EOFException ) {
- try {
- unsigned int lvalue = this->readInt();
- float value = 0.0f;
- memcpy( &value, &lvalue, sizeof( unsigned int ) );
- return value;
- }
- DECAF_CATCH_RETHROW( EOFException )
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long DataInputStream::readLong()
- throw ( io::IOException, io::EOFException ) {
- try {
- unsigned long long value = 0;
- unsigned char buffer[sizeof(value)] = {0};
- readAllData( buffer, sizeof(value) );
-
- // Have to do it this way because on Solaris and Cygwin we get all
- // kinds of warnings when shifting a byte up into a long long.
- unsigned long long byte1 = buffer[0] & 0x00000000000000FFULL;
- unsigned long long byte2 = buffer[1] & 0x00000000000000FFULL;
- unsigned long long byte3 = buffer[2] & 0x00000000000000FFULL;
- unsigned long long byte4 = buffer[3] & 0x00000000000000FFULL;
- unsigned long long byte5 = buffer[4] & 0x00000000000000FFULL;
- unsigned long long byte6 = buffer[5] & 0x00000000000000FFULL;
- unsigned long long byte7 = buffer[6] & 0x00000000000000FFULL;
- unsigned long long byte8 = buffer[7] & 0x00000000000000FFULL;
-
- value = ( byte1 << 56 | byte2 << 48 | byte3 << 40 | byte4 << 32 |
- byte5 << 24 | byte6 << 16 | byte7 << 8 | byte8 << 0 );
-
- return value;
- }
- DECAF_CATCH_RETHROW( EOFException )
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string DataInputStream::readString()
- throw ( io::IOException, io::EOFException ) {
- try {
- size_t size = 1024;
- std::vector<char> buffer;
- buffer.resize( size );
- size_t pos = 0;
-
- while( true ) {
-
- if( inputStream->read( (unsigned char*)( &buffer[pos] ), 1 ) == -1 ) {
- throw EOFException(
- __FILE__, __LINE__,
- "DataInputStream::readString - Reached EOF" );
- }
-
- // if null is found we are done
- if( buffer[pos] == '\0' ){
- break;
- }
-
- // Resize to hold more if we exceed current size
- if( ++pos > size ) {
- buffer.resize( (size *= 2) );
- }
- }
-
- return &buffer[0];
- }
- DECAF_CATCH_RETHROW( EOFException )
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string DataInputStream::readUTF()
- throw ( io::IOException, io::EOFException ) {
- try {
- std::vector<unsigned char> buffer;
- unsigned short length = readUnsignedShort();
- buffer.resize(length + 1); // Add one for a null charactor.
-
- std::size_t n = 0;
- while( n < length ) {
- int count = inputStream->read( &buffer[n], (length - n) );
- if( count == -1 ) {
- throw EOFException(
- __FILE__, __LINE__,
- "DataInputStream::readUTF - Reached EOF" );
- }
- n += count;
- }
-
- return (char*)&buffer[0];
- }
- DECAF_CATCH_RETHROW( EOFException )
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataInputStream::readFully( std::vector< unsigned char >& buffer )
- throw ( io::IOException, io::EOFException ) {
- try {
- if( buffer.empty() ) {
- return;
- }
- this->readFully( &buffer[0], 0, buffer.size() );
- }
- DECAF_CATCH_RETHROW( EOFException )
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataInputStream::readFully( unsigned char* buffer,
- std::size_t offset,
- std::size_t length )
- throw ( io::IOException,
- io::EOFException,
- lang::exceptions::IndexOutOfBoundsException,
- lang::exceptions::NullPointerException )
-{
- try {
-
- if( buffer == NULL ) {
- throw NullPointerException(
- __FILE__, __LINE__,
- "DataInputStream::readFully - Buffer is null" );
- }
-
- std::size_t n = 0;
- while( n < length ) {
- int count = inputStream->read( &buffer[offset + n], (length - n) );
- if( count == -1 ) {
- throw EOFException(
- __FILE__, __LINE__,
- "DataInputStream::readFully - Reached EOF" );
- }
- n += count;
- }
- }
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_RETHROW( NullPointerException )
- DECAF_CATCH_RETHROW( EOFException )
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::size_t DataInputStream::skip( std::size_t num )
- throw( io::IOException, lang::exceptions::UnsupportedOperationException ) {
- try {
- std::size_t total = 0;
- std::size_t cur = 0;
-
- while( ( total < num ) &&
- ( ( cur = inputStream->skip( num-total ) ) > 0 ) ) {
- total += cur;
- }
-
- return total;
- }
- DECAF_CATCH_RETHROW( UnsupportedOperationException )
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
diff --git a/src/decaf/src/main/decaf/io/DataInputStream.h b/src/decaf/src/main/decaf/io/DataInputStream.h
deleted file mode 100644
index 8f58898..0000000
--- a/src/decaf/src/main/decaf/io/DataInputStream.h
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_DATAINPUTSTREAM_H_
-#define _DECAF_IO_DATAINPUTSTREAM_H_
-
-#include <decaf/io/FilterInputStream.h>
-#include <decaf/io/IOException.h>
-#include <decaf/io/EOFException.h>
-#include <decaf/lang/exceptions/NullPointerException.h>
-#include <decaf/lang/exceptions/IndexOutOfBoundsException.h>
-
-namespace decaf{
-namespace io{
-
- /**
- * A data input stream lets an application read primitive Java data
- * types from an underlying input stream in a machine-independent way.
- * An application uses a data output stream to write data that can
- * later be read by a data input stream.
- *
- * Due to the lack of garbage collection in C++ a design decision was
- * made to add a boolean parameter to the constructor indicating if the
- * wrapped <code>InputStream</code> is owned by this object. That way
- * creation of the underlying stream can occur in a Java like way. Ex:
- *
- * DataInputStream os = new DataInputStream( new InputStream(), true )
- */
- class DECAF_API DataInputStream : public FilterInputStream
- {
- public:
-
- /**
- * Creates a DataInputStream that uses the specified underlying
- * InputStream.
- * @param inputStream the InputStream instance to wrap.
- * @param own, indicates if this class owns the wrapped string
- * defaults to false.
- */
- DataInputStream( InputStream* inputStream, bool own = false );
-
- virtual ~DataInputStream();
-
- /**
- * Reads some number of bytes from the contained input stream and
- * stores them into the buffer array b. The number of bytes actually
- * read is returned as an integer. This method blocks until input
- * data is available, end of file is detected, or an exception is
- * thrown.
- * <p>
- * If the length of buffer is zero, then no bytes are read and 0 is
- * returned; otherwise, there is an attempt to read at least one
- * byte. If no byte is available because the stream is at end of
- * file, the value -1 is returned; otherwise, at least one byte is
- * read and stored into buffer.
- * <p>
- * The first byte read is stored into element buffer[0], the next one
- * into buffer[1], and so on. The number of bytes read is, at most,
- * equal to the length of buffer. Let k be the number of bytes actually
- * read; these bytes will be stored in elements b[0] through b[k-1],
- * leaving elements buffer[k] through buffer[buffer.length-1]
- * unaffected.
- * <p>
- * If the first byte cannot be read for any reason other than end
- * of file, then an IOException is thrown. In particular, an
- * IOException is thrown if the input stream has been closed.
- * <p>
- * The read( buffer ) method has the same effect as:
- * read( buffer, 0, b.length )
- * @param buffer - byte array to insert read data into
- * @returns the total number of bytes read, or -1 if there is no
- * more data because the stream is EOF.
- * @throws IOException
- */
- virtual int read( std::vector< unsigned char >& buffer )
- throw ( io::IOException );
-
- /**
- * Reads up to len bytes of data from the contained input stream
- * into an array of bytes. An attempt is made to read as many as
- * len bytes, but a smaller number may be read, possibly zero. The
- * number of bytes actually read is returned as an integer.
- * <p>
- * This method blocks until input data is available, end of file is
- * detected, or an exception is thrown.
- * <p>
- * If buffer is null, a NullPointerException is thrown.
- * <p>
- * If off is negative, or len is negative then an
- * IndexOutOfBoundsException is thrown, if off + len is greater that
- * the allocated length of the array, an IOException will result
- * depending on the platform and compiler settings.
- * <p>
- * If len is zero, then no bytes are read and 0 is returned;
- * otherwise, there is an attempt to read at least one byte. If no
- * byte is available because the stream is at end of file, the
- * value -1 is returned; otherwise, at least one byte is read and
- * stored into buffer.
- * <p>
- * The first byte read is stored into element b[off], the next one
- * into buffer[off+1], and so on. The number of bytes read is, at most,
- * equal to len. Let k be the number of bytes actually read; these
- * bytes will be stored in elements buffer[off] through buffer[off+k-1],
- * leaving elements buffer[off+k] through buffer[off+len-1] unaffected.
- * <p>
- * In every case, elements buffer[0] through buffer[off] and elements
- * buffer[off+len] through buffer[buffer.length-1] are unaffected.
- * <p>
- * If the first byte cannot be read for any reason other than end of
- * file, then an IOException is thrown. In particular, an IOException
- * is thrown if the input stream has been closed.
- * @param buffer - byte array to insert read data into
- * @param offset - location in buffer to start writing
- * @param length - number of bytes to read
- * @returns the total number of bytes read, or -1 if there is no
- * more data because the stream is EOF.
- * @throws IOException
- */
- virtual int read( unsigned char* buffer,
- std::size_t offset,
- std::size_t length )
- throw ( io::IOException,
- lang::exceptions::IndexOutOfBoundsException,
- lang::exceptions::NullPointerException );
-
- /**
- * Reads one input byte and returns true if that byte is nonzero,
- * false if that byte is zero.
- * @returns the boolean value read.
- * @throws IOException
- * @throws EOFException
- */
- virtual bool readBoolean()
- throw( io::IOException, io::EOFException );
-
- /**
- * Reads and returns one input byte. The byte is treated as a
- * signed value in the range -128 through 127, inclusive.
- * @returns the 8-bit value read.
- * @throws IOException
- * @throws EOFException
- */
- virtual char readByte()
- throw ( io::IOException, io::EOFException );
-
- /**
- * Reads one input byte, zero-extends it to type int, and returns
- * the result, which is therefore in the range 0 through 255.
- * @returns the 8 bit unsigned value read
- * @throws IOException
- * @throws EOFException
- */
- virtual unsigned char readUnsignedByte()
- throw ( io::IOException, io::EOFException );
-
- /**
- * Reads an input char and returns the char value. A ascii char
- * is made up of one bytes. This returns the same result as
- * <code>readByte</code>
- * @returns the 8 bit char read
- * @throws IOException
- * @throws EOFException
- */
- virtual char readChar() throw ( io::IOException, io::EOFException );
-
- /**
- * Reads eight input bytes and returns a double value. It does this
- * by first constructing a long long value in exactly the manner of
- * the readlong method, then converting this long value to a double
- * in exactly the manner of the method Double.longBitsToDouble.
- * @returns the double value read
- * @throws IOException
- * @throws EOFException
- */
- virtual double readDouble()
- throw ( io::IOException, io::EOFException );
-
- /**
- * Reads four input bytes and returns a float value. It does this
- * by first constructing an int value in exactly the manner of the
- * readInt method, then converting this int value to a float in
- * exactly the manner of the method Float.intBitsToFloat.
- * @returns the float value read
- * @throws IOException
- * @throws EOFException
- */
- virtual float readFloat() throw ( io::IOException, io::EOFException );
-
- /**
- * Reads four input bytes and returns an int value. Let a be the
- * first byte read, b be the second byte, c be the third byte, and
- * d be the fourth byte. The value returned is: <p>
- * (((a & 0xff) << 24) | ((b & 0xff) << 16) |
- * ((c & 0xff) << 8) | (d & 0xff))
- * @returns the int value read
- * @throws IOException
- * @throws EOFException
- */
- virtual int readInt() throw ( io::IOException, io::EOFException );
-
- /**
- * Reads eight input bytes and returns a long value. Let a be the
- * first byte read, b be the second byte, c be the third byte, d
- * be the fourth byte, e be the fifth byte, f be the sixth byte,
- * g be the seventh byte, and h be the eighth byte. The value
- * returned is:
- * (((long)(a & 0xff) << 56) |
- * ((long)(b & 0xff) << 48) |
- * ((long)(c & 0xff) << 40) |
- * ((long)(d & 0xff) << 32) |
- * ((long)(e & 0xff) << 24) |
- * ((long)(f & 0xff) << 16) |
- * ((long)(g & 0xff) << 8) |
- * ((long)(h & 0xff)))
- * @returns the 64 bit long long read
- * @throws IOException
- * @throws EOFException
- */
- virtual long long readLong()
- throw ( io::IOException, io::EOFException );
-
- /**
- * Reads two input bytes and returns a short value. Let a be the
- * first byte read and b be the second byte. The value returned is:
- * (short)((a << 8) | (b & 0xff))
- * @returns the 16 bit short value read
- * @throws IOException
- * @throws EOFException
- */
- virtual short readShort() throw ( io::IOException, io::EOFException );
-
- /**
- * Reads two input bytes and returns an int value in the range 0
- * through 65535. Let a be the first byte read and b be the
- * second byte. The value returned is:
- * (((a & 0xff) << 8) | (b & 0xff))
- * @returns the 16 bit unsigned short read
- * @throws IOException
- * @throws EOFException
- */
- virtual unsigned short readUnsignedShort()
- throw ( io::IOException, io::EOFException );
-
- /**
- * Reads an null terminated ASCII string to the stream and returns the
- * string to the caller.
- * @returns string object containing the string read.
- * @throws IOException
- * @throws EOFException
- */
- virtual std::string readString()
- throw ( io::IOException, io::EOFException );
-
- /**
- * Reads a UTF8 encoded string in ASCII format and returns it, this is
- * only useful if you know for sure that the string that is to be read
- * was a string that contained all ascii values, and not uncide chars.
- * @returns string read from stream.
- * @throws IOException
- * @throws EOFException
- */
- virtual std::string readUTF()
- throw ( io::IOException, io::EOFException );
-
- /**
- * Reads some bytes from an input stream and stores them into the
- * buffer array buffer. The number of bytes read is equal to the length
- * of buffer.<p>
- * This method blocks until one of the following conditions occurs:
- * * buffer.size() bytes of input data are available, in which case
- * a normal return is made.
- * * End of file is detected, in which case an EOFException is
- * thrown.
- * * An I/O error occurs, in which case an IOException other than
- * EOFException is thrown.
- * <p>
- * If buffer.size() is zero, then no bytes are read. Otherwise, the
- * first byte read is stored into element b[0], the next one into
- * buffer[1], and so on. If an exception is thrown from this method,
- * then it may be that some but not all bytes of buffer have been
- * updated with data from the input stream.
- * @param buffer - vector of char that is read to its size()
- * @throws IOException
- * @throws EOFException
- */
- virtual void readFully( std::vector< unsigned char >& buffer )
- throw ( io::IOException, io::EOFException );
-
- /**
- * Reads length bytes from an input stream.
- * <p>
- * This method blocks until one of the following conditions occurs:
- * * length bytes of input data are available, in which case a
- * normal return is made.
- * * End of file is detected, in which case an EOFException is
- * thrown.
- * * An I/O error occurs, in which case an IOException other
- * than EOFException is thrown.
- * <p>
- * If buffer is null, a NullPointerException is thrown. If offset is
- * negative, or len is negative, or offset+length is greater than the
- * length of the array buffer, then an IndexOutOfBoundsException is
- * thrown. If len is zero, then no bytes are read. Otherwise, the
- * first byte read is stored into element buffer[off], the next one into
- * buffer[offset+1], and so on. The number of bytes read is, at most,
- * equal to len.
- * @param buffer - byte array to insert read data into
- * @param offset - location in buffer to start writing
- * @param length - number of bytes to read
- * @throws IOException
- * @throws EOFException
- */
- virtual void readFully( unsigned char* buffer,
- std::size_t offset,
- std::size_t length )
- throw ( io::IOException,
- io::EOFException,
- lang::exceptions::IndexOutOfBoundsException,
- lang::exceptions::NullPointerException );
-
- /**
- * Makes an attempt to skip over n bytes of data from the input
- * stream, discarding the skipped bytes. However, it may skip over
- * some smaller number of bytes, possibly zero. This may result from
- * any of a number of conditions; reaching end of file before n
- * bytes have been skipped is only one possibility. This method
- * never throws an EOFException. The actual number of bytes skipped
- * is returned.
- * @param num - number of bytes to skip
- * @return the total number of bytes skipped
- */
- virtual std::size_t skip( std::size_t num )
- throw( io::IOException,
- lang::exceptions::UnsupportedOperationException );
-
- private:
-
- // Used internally to reliable get data from the underlying stream
- inline void readAllData( unsigned char* buffer,
- std::size_t length )
- throw ( io::IOException,
- io::EOFException ) {
-
- std::size_t n = 0;
- do{
- int count = inputStream->read( &buffer[n], length - n );
- if( count == -1 ) {
- throw EOFException(
- __FILE__, __LINE__,
- "DataInputStream::readLong - Reached EOF" );
- }
- n += count;
- } while( n < length );
- }
-
- };
-
-}}
-
-#endif /*_DECAF_IO_DATAINPUTSTREAM_H_*/
diff --git a/src/decaf/src/main/decaf/io/DataOutputStream.cpp b/src/decaf/src/main/decaf/io/DataOutputStream.cpp
deleted file mode 100644
index cc3a31b..0000000
--- a/src/decaf/src/main/decaf/io/DataOutputStream.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <decaf/io/DataOutputStream.h>
-#include <decaf/util/Config.h>
-
-using namespace decaf;
-using namespace decaf::io;
-using namespace decaf::util;
-
-////////////////////////////////////////////////////////////////////////////////
-DataOutputStream::DataOutputStream( OutputStream* outputStream, bool own )
- : FilterOutputStream( outputStream, own )
-{
- // Init the written count
- written = 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-DataOutputStream::~DataOutputStream()
-{
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::write( const unsigned char c ) throw ( IOException ) {
- try {
- outputStream->write( c );
- written++;
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::write( const std::vector<unsigned char>& buffer )
- throw ( IOException ) {
-
- try {
-
- if( buffer.size() == 0 ){
- // nothing to write.
- return;
- }
-
- outputStream->write( &buffer[0], buffer.size() );
- written += buffer.size();
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::write( const unsigned char* buffer, std::size_t len )
- throw ( IOException ) {
-
- try {
- outputStream->write( buffer, len );
- written += len;
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::write( const unsigned char* buffer,
- std::size_t offset,
- std::size_t len ) throw ( IOException )
-{
-
- try {
- outputStream->write( buffer+offset, len );
- written += len;
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeBoolean( bool value ) throw ( IOException ) {
- try {
- unsigned char ivalue = 0;
- value == true ? ivalue = 1 : ivalue = 0;
-
- outputStream->write( ivalue );
- written++;
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeByte( unsigned char value ) throw ( IOException ) {
- try {
- outputStream->write( value );
- written++;
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeChar( char value ) throw ( IOException ) {
- try {
- outputStream->write( value );
- written++;
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeShort( short value ) throw ( IOException ) {
- try {
- unsigned char buffer[sizeof(value)];
-
- buffer[0] = (value & 0xFF00) >> 8;
- buffer[1] = (value & 0x00FF) >> 0;
-
- outputStream->write( buffer, sizeof(value) );
- written += sizeof( value );
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeUnsignedShort( unsigned short value )
- throw ( IOException )
-{
- try {
- unsigned char buffer[sizeof(value)];
-
- buffer[0] = (value & 0xFF00) >> 8;
- buffer[1] = (value & 0x00FF) >> 0;
-
- outputStream->write( buffer, sizeof(value) );
- written += sizeof( value );
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeInt( int value ) throw ( IOException ) {
- try {
- unsigned char buffer[sizeof(value)];
-
- buffer[0] = (value & 0xFF000000) >> 24;
- buffer[1] = (value & 0x00FF0000) >> 16;
- buffer[2] = (value & 0x0000FF00) >> 8;
- buffer[3] = (value & 0x000000FF) >> 0;
-
- outputStream->write( buffer, sizeof(value) );
- written += sizeof( value );
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeLong( long long value ) throw ( IOException ) {
- try {
- unsigned char buffer[sizeof(value)];
-
- buffer[0] = (unsigned char)((value & 0xFF00000000000000ULL) >> 56);
- buffer[1] = (unsigned char)((value & 0x00FF000000000000ULL) >> 48);
- buffer[2] = (unsigned char)((value & 0x0000FF0000000000ULL) >> 40);
- buffer[3] = (unsigned char)((value & 0x000000FF00000000ULL) >> 32);
- buffer[4] = (unsigned char)((value & 0x00000000FF000000ULL) >> 24);
- buffer[5] = (unsigned char)((value & 0x0000000000FF0000ULL) >> 16);
- buffer[6] = (unsigned char)((value & 0x000000000000FF00ULL) >> 8);
- buffer[7] = (unsigned char)((value & 0x00000000000000FFULL) >> 0);
-
- outputStream->write( buffer, sizeof(value) );
- written += sizeof( value );
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeFloat( float value ) throw ( IOException ) {
- try {
- unsigned int lvalue = 0;
- memcpy( &lvalue, &value, sizeof( float ) );
- this->writeInt( lvalue );
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeDouble( double value ) throw ( IOException ) {
- try {
- unsigned long long lvalue = 0;
- memcpy( &lvalue, &value, sizeof( double ) );
- this->writeLong( lvalue );
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeBytes( const std::string& value ) throw ( IOException ) {
- try {
- // do not add one so that we don't write the NULL
- this->write( (const unsigned char*)value.c_str(), value.length() );
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeChars( const std::string& value ) throw ( IOException ) {
- try {
- // add one so that we write the NULL
- this->write( (const unsigned char*)value.c_str(), value.length() + 1 );
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeUTF( const std::string& value ) throw ( IOException ) {
- try {
- this->writeUnsignedShort( (unsigned short)value.length() );
- this->write( (const unsigned char*)value.c_str(), value.length() );
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
-}
diff --git a/src/decaf/src/main/decaf/io/DataOutputStream.h b/src/decaf/src/main/decaf/io/DataOutputStream.h
deleted file mode 100644
index e6e7f3c..0000000
--- a/src/decaf/src/main/decaf/io/DataOutputStream.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_DATAOUTPUTSTREAM_H_
-#define _DECAF_IO_DATAOUTPUTSTREAM_H_
-
-#include <decaf/io/FilterOutputStream.h>
-
-namespace decaf{
-namespace io{
-
- /**
- * A data output stream lets an application write primitive Java data
- * types to an output stream in a portable way. An application can then
- * use a data input stream to read the data back in.
- */
- class DECAF_API DataOutputStream : public FilterOutputStream
- {
- protected:
-
- // The number of bytes written to the data output stream so far.
- std::size_t written;
-
- public:
-
- /**
- * Creates a new data output stream to write data to the specified
- * underlying output stream.
- * @param outputStream a stream to wrap with this one.
- * @param own true if this objects owns the stream that it wraps.
- */
- DataOutputStream( OutputStream* outputStream, bool own = false );
-
- virtual ~DataOutputStream();
-
- /**
- * Returns the current value of the counter written, the number of
- * bytes written to this data output stream so far. If the counter
- * overflows, it will be wrapped to Integer.MAX_VALUE.
- * @return the value of the written field.
- */
- virtual std::size_t size() const {
- return written;
- }
-
- /**
- * Writes a single byte to the output stream. If no exception is
- * thrown, the counter written is incremented by 1.
- * @param c the byte.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( unsigned char c ) throw ( IOException );
-
- /**
- * Writes an array of bytes to the output stream. the counter
- * written is incremented by len.
- * @param buffer The array of bytes to write.
- * @param len The number of bytes from the buffer to be written.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( const unsigned char* buffer, std::size_t len )
- throw ( IOException );
-
- /**
- * Writes an array of bytes to the output stream. the counter
- * written is incremented by len.
- * @param buffer The array of bytes to write.
- * @param len The number of bytes from the buffer to be written.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( const unsigned char* buffer,
- std::size_t offset,
- std::size_t len ) throw ( IOException );
-
- /**
- * Writes an array of bytes to the output stream.
- * @param buffer The bytes to write.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( const std::vector<unsigned char>& buffer )
- throw ( IOException );
-
- /**
- * Writes a boolean to the underlying output stream as a 1-byte value. The
- * value true is written out as the value (byte)1; the value false
- * is written out as the value (byte)0. If no exception is thrown,
- * the counter written is incremented by 1.
- * @param value the boolean to write.
- * @throws IOException
- *
- */
- virtual void writeBoolean( bool value ) throw ( IOException );
-
- /**
- * Writes out a byte to the underlying output stream as a 1-byte
- * value. If no exception is thrown, the counter written is
- * incremented by 1.
- * @param value the unsigned char value to write.
- * @throws IOException
- */
- virtual void writeByte( unsigned char value ) throw ( IOException );
-
- /**
- * Writes a short to the underlying output stream as two bytes, high
- * byte first. If no exception is thrown, the counter written is
- * incremented by 2.
- * @param value the value to write.
- * @throws IOException
- */
- virtual void writeShort( short value ) throw ( IOException );
-
- /**
- * Writes a unsigned short to the bytes message stream as a 2 byte value
- * @param value - unsigned short to write to the stream
- * @throws IOException
- */
- virtual void writeUnsignedShort( unsigned short value ) throw ( IOException );
-
- /**
- * Writes out a char to the underlying output stream as a one byte
- * value If no exception is thrown, the counter written is
- * incremented by 1.
- * @param value the value to write.
- * @throws IOException
- */
- virtual void writeChar( char value ) throw ( IOException );
-
- /**
- * Writes an int to the underlying output stream as four bytes, high
- * byte first. If no exception is thrown, the counter written is
- * incremented by 4.
- * @param value the value to write.
- * @throws IOException
- */
- virtual void writeInt( int value ) throw ( IOException );
-
- /**
- * Writes an 64 bit long to the underlying output stream as eight
- * bytes, high byte first. If no exception is thrown, the counter
- * written is incremented by 8.
- * @param value the value to write.
- * @throws IOException
- */
- virtual void writeLong( long long value ) throw ( IOException );
-
- /**
- * Converts the float argument to an int using the floatToIntBits
- * method in class Float, and then writes that int value to the
- * underlying output stream as a 4-byte quantity, high byte first.
- * If no exception is thrown, the counter written is incremented
- * by 4.
- * @param value the value to write.
- * @throws IOException
- */
- virtual void writeFloat( float value ) throw ( IOException );
-
- /**
- * Converts the double argument to a long using the doubleToLongBits
- * method in class Double, and then writes that long value to the
- * underlying output stream as an 8-byte quantity, high byte first.
- * If no exception is thrown, the counter written is incremented
- * by 8.
- * @param value the value to write.
- * @throws IOException
- */
- virtual void writeDouble( double value ) throw ( IOException );
-
- /**
- * Writes out the string to the underlying output stream as a
- * sequence of bytes. Each character in the string is written out,
- * in sequence, by discarding its high eight bits. If no exception
- * is thrown, the counter written is incremented by the length of
- * value. The value written does not include a trailing null as that
- * is not part of the sequence of bytes, if the null is needed, then use
- * the writeChars method.
- * @param value the value to write.
- * @throws IOException
- */
- virtual void writeBytes( const std::string& value ) throw ( IOException );
-
- /**
- * Writes a string to the underlying output stream as a sequence of
- * characters. Each character is written to the data output stream
- * as if by the writeChar method. If no exception is thrown, the
- * counter written is incremented by the length of value. The trailing
- * NULL charactor is written by this method.
- * @param value the value to write.
- * @throws IOException
- */
- virtual void writeChars( const std::string& value ) throw ( IOException );
-
- /**
- * Writes out the string to the underlying output stream as a
- * unsigned short indicating its length followed by the rest of
- * the string.
- * @param value the value to write.
- * @throws IOException
- */
- virtual void writeUTF( const std::string& value ) throw ( IOException );
- };
-
-}}
-
-#endif /*_DECAF_IO_DATAOUTPUTSTREAM_H_*/
diff --git a/src/decaf/src/main/decaf/io/EOFException.h b/src/decaf/src/main/decaf/io/EOFException.h
deleted file mode 100644
index 736f1a1..0000000
--- a/src/decaf/src/main/decaf/io/EOFException.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_EOFEXCEPTION_H
-#define _DECAF_IO_EOFEXCEPTION_H
-
-#include <decaf/io/IOException.h>
-
-namespace decaf{
-namespace io{
-
- /*
- * Signals that an End of File exception has occurred.
- */
- class DECAF_API EOFException : public io::IOException
- {
- public:
-
- /**
- * Default Constructor
- */
- EOFException() throw(){}
-
- /**
- * Copy Constructor
- * @param ex the exception to copy
- */
- EOFException( const lang::Exception& ex ) throw()
- : IOException()
- {
- *(lang::Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- * @param ex the exception to copy, which is an instance of this type
- */
- EOFException( const EOFException& ex ) throw()
- : IOException()
- {
- *(lang::Exception*)this = ex;
- }
-
- /**
- * Consturctor
- * @param file name of the file were the exception occured.
- * @param lineNumber line where the exception occured
- * @param msg the message that was generated
- */
- EOFException( const char* file, const int lineNumber,
- const char* msg, ... ) throw()
- : IOException()
- {
- va_list vargs;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual EOFException* clone() const{
- return new EOFException( *this );
- }
-
- virtual ~EOFException() throw(){}
-
- };
-
-}}
-
-#endif /*_DECAF*/
diff --git a/src/decaf/src/main/decaf/io/FilterInputStream.h b/src/decaf/src/main/decaf/io/FilterInputStream.h
deleted file mode 100644
index 4929f41..0000000
--- a/src/decaf/src/main/decaf/io/FilterInputStream.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_FILTERINPUTSTREAM_H_
-#define _DECAF_IO_FILTERINPUTSTREAM_H_
-
-#include <decaf/io/InputStream.h>
-#include <decaf/io/IOException.h>
-#include <decaf/util/concurrent/Mutex.h>
-
-namespace decaf{
-namespace io{
-
- /**
- * A FilterInputStream contains some other input stream, which it uses
- * as its basic source of data, possibly transforming the data along the
- * way or providing additional functionality. The class FilterInputStream
- * itself simply overrides all methods of InputStream with versions
- * that pass all requests to the contained input stream. Subclasses of
- * FilterInputStream may further override some of these methods and may
- * also provide additional methods and fields.
- */
- class DECAF_API FilterInputStream : public InputStream
- {
- protected:
-
- // The input stream to wrap
- InputStream* inputStream;
-
- // Synchronization object.
- util::concurrent::Mutex mutex;
-
- // Indicates if we own the wrapped stream
- bool own;
-
- public:
-
- /**
- * Constructor to create a wrapped InputStream
- * @param inputStream the stream to wrap and filter
- * @param own indicates if we own the stream object, defaults to false
- */
- FilterInputStream( InputStream* inputStream, bool own = false ) {
- this->inputStream = inputStream;
- this->own = own;
- }
-
- virtual ~FilterInputStream() {
- try {
- if( own == true ) delete inputStream;
- }
- DECAF_CATCH_NOTHROW( IOException )
- DECAF_CATCHALL_NOTHROW( )
- }
-
- /**
- * Returns the number of bytes that can be read from this input stream
- * without blocking. This method simply performs in.available() and
- * returns the result.
- * @return the number of bytes available without blocking.
- */
- virtual std::size_t available() const throw ( IOException ) {
- try {
- return inputStream->available();
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
- }
-
- /**
- * Reads the next byte of data from this input stream. The value byte
- * is returned as an unsigned char in the range 0 to 255. If no byte is
- * available because the end of the stream has been reached, the value
- * -1 is returned. This method blocks until input data is available,
- * the end of the stream is detected, or an exception is thrown.
- * This method simply performs in.read() and returns the result.
- * @return The next byte.
- * @throws IOException thrown if an error occurs.
- */
- virtual unsigned char read() throw ( IOException ) {
- try {
- return inputStream->read();
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
- }
-
- /**
- * Reads up to len bytes of data from this input stream into an array
- * of bytes. This method blocks until some input is available.
- * This method simply performs in.read(b, len) and returns the result.
- * @param buffer (out) the target buffer.
- * @param bufferSize the size of the output buffer.
- * @return The number of bytes read or -1 if EOF is detected
- * @throws IOException thrown if an error occurs.
- */
- virtual int read( unsigned char* buffer, std::size_t bufferSize )
- throw ( IOException )
- {
- try {
- return inputStream->read( buffer, bufferSize );
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
- }
-
- /**
- * Close the Stream, the FilterOutputStream simply calls the close
- * method of the underlying stream
- * @throws Exception
- */
- virtual void close() throw ( lang::Exception ) {
- try {
- inputStream->close();
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
- }
-
- /**
- * Skips over and discards n bytes of data from this input stream. The
- * skip method may, for a variety of reasons, end up skipping over some
- * smaller number of bytes, possibly 0. This may result from any of a
- * number of conditions; reaching end of file before n bytes have been
- * skipped is only one possibility. The actual number of bytes skipped
- * is returned. If n is negative, no bytes are skipped.
- * <p>
- * The skip method of InputStream creates a byte array and then
- * repeatedly reads into it until n bytes have been read or the end
- * of the stream has been reached. Subclasses are encouraged to
- * provide a more efficient implementation of this method.
- * @param num - the number of bytes to skip
- * @returns total butes skipped
- * @throws IOException if an error occurs
- */
- virtual std::size_t skip( std::size_t num ) throw ( io::IOException, lang::exceptions::UnsupportedOperationException ) {
- try {
- return inputStream->skip(num);
- }
- DECAF_CATCH_RETHROW( lang::exceptions::UnsupportedOperationException )
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
- }
-
- public: // Synchronizable
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void lock() throw( lang::Exception ){
- mutex.lock();
- }
-
- /**
- * Unlocks the object.
- * @throws Exception
- */
- virtual void unlock() throw( lang::Exception ){
- mutex.unlock();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void wait() throw( lang::Exception ){
- mutex.wait();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param millisecs the time in millisecsonds to wait, or WAIT_INIFINITE
- * @throws Exception
- */
- virtual void wait( unsigned long millisecs ) throw( lang::Exception ){
- mutex.wait(millisecs);
- }
-
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notify() throw( lang::Exception ){
- mutex.notify();
- }
-
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notifyAll() throw( lang::Exception ){
- mutex.notifyAll();
- }
-
- };
-
-}}
-
-#endif /*_DECAF_IO_FILTERINPUTSTREAM_H_*/
diff --git a/src/decaf/src/main/decaf/io/FilterOutputStream.h b/src/decaf/src/main/decaf/io/FilterOutputStream.h
deleted file mode 100644
index 3dd2651..0000000
--- a/src/decaf/src/main/decaf/io/FilterOutputStream.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_FILTEROUTPUTSTREAM_H_
-#define _DECAF_IO_FILTEROUTPUTSTREAM_H_
-
-#include <decaf/io/OutputStream.h>
-#include <decaf/io/IOException.h>
-#include <decaf/util/concurrent/Mutex.h>
-
-namespace decaf{
-namespace io{
-
- /**
- * This class is the superclass of all classes that filter output
- * streams. These streams sit on top of an already existing output
- * stream (the underlying output stream) which it uses as its basic
- * sink of data, but possibly transforming the data along the way or
- * providing additional functionality.
- *
- * The class FilterOutputStream itself simply overrides all methods of
- * OutputStream with versions that pass all requests to the underlying
- * output stream. Subclasses of FilterOutputStream may further override
- * some of these methods as well as provide additional methods and
- * fields.
- *
- * Due to the lack of garbage collection in C++ a design decision was
- * made to add a boolean parameter to the constructor indicating if the
- * wrapped <code>InputStream</code> is owned by this object. That way
- * creation of the underlying stream can occur in a Java like way. Ex:
- *
- * DataOutputStream os = new DataOutputStream( new OutputStream(), true )
- */
- class DECAF_API FilterOutputStream : public OutputStream
- {
- protected:
-
- // The output Stream to wrap
- OutputStream* outputStream;
-
- // Synchronization object.
- util::concurrent::Mutex mutex;
-
- // Indicates if we own the wrapped stream
- bool own;
-
- public:
-
- /**
- * Constructor, creates a wrapped output stream
- * @param outputStream the OutputStream to wrap
- * @param own If true, this object will control the lifetime of the
- * output stream that it encapsulates.
- */
- FilterOutputStream( OutputStream* outputStream, bool own = false ){
- this->outputStream = outputStream;
- this->own = own;
- }
-
- virtual ~FilterOutputStream() {
- try {
- if( own == true ) delete outputStream;
- }
- DECAF_CATCH_NOTHROW( IOException )
- DECAF_CATCHALL_NOTHROW( )
- }
-
- /**
- * Writes a single byte to the output stream. The write method of
- * FilterOutputStream calls the write method of its underlying output
- * stream, that is, it performs out.write(b).
- * @param c the byte.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( unsigned char c ) throw ( IOException ) {
- try {
- outputStream->write( c );
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
- }
-
- /**
- * Writes an array of bytes to the output stream. The write method of
- * FilterOutputStream calls the write method of one argument on each
- * byte to output.
- * @param buffer The array of bytes to write.
- * @param len The number of bytes from the buffer to be written.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( const unsigned char* buffer, std::size_t len ) throw ( IOException ) {
- try {
- for( std::size_t ix = 0; ix < len; ++ix )
- {
- outputStream->write( buffer[ix] );
- }
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
- }
-
- /**
- * Flushes any pending writes in this output stream.
- * The flush method of FilterOutputStream calls the flush method
- * of its underlying output stream
- * @throws IOException
- */
- virtual void flush() throw ( IOException ) {
- try {
- outputStream->flush();
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
- }
-
- /**
- * Close the Stream, the FilterOutputStream simply calls the close
- * method of the underlying stream
- * @throws CMSException
- */
- virtual void close() throw ( lang::Exception ) {
- try {
- outputStream->close();
- }
- DECAF_CATCH_RETHROW( IOException )
- DECAF_CATCHALL_THROW( IOException )
- }
-
- public: // Synchronizable
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void lock() throw( lang::Exception ){
- mutex.lock();
- }
-
- /**
- * Unlocks the object.
- * @throws Exception
- */
- virtual void unlock() throw( lang::Exception ){
- mutex.unlock();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void wait() throw( lang::Exception ){
- mutex.wait();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param millisecs the time in millisecsonds to wait, or WAIT_INIFINITE
- * @throws Exception
- */
- virtual void wait( unsigned long millisecs ) throw( lang::Exception ){
- mutex.wait( millisecs );
- }
-
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notify() throw( lang::Exception ){
- mutex.notify();
- }
-
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notifyAll() throw( lang::Exception ){
- mutex.notifyAll();
- }
-
- };
-
-}}
-
-#endif /*_DECAF_IO_FILTEROUTPUTSTREAM_H_*/
diff --git a/src/decaf/src/main/decaf/io/IOException.h b/src/decaf/src/main/decaf/io/IOException.h
deleted file mode 100644
index 24e553a..0000000
--- a/src/decaf/src/main/decaf/io/IOException.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_IO_IOEXCEPTION_H
-#define _DECAF_IO_IOEXCEPTION_H
-
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace io{
-
- /*
- * Signals that an I/O exception of some sort has occurred.
- */
- class DECAF_API IOException : public lang::Exception {
- public:
-
- /**
- * Default Constructor
- */
- IOException() throw() {}
-
- /**
- * Copy Constructor
- * @param ex the exception to copy
- */
- IOException( const lang::Exception& ex ) throw()
- : lang::Exception() {
- *(lang::Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- * @param ex the exception to copy, which is an instance of this type
- */
- IOException( const IOException& ex ) throw()
- : lang::Exception() {
- *(lang::Exception*)this = ex;
- }
-
- /**
- * Consturctor
- * @param file name of the file were the exception occured.
- * @param lineNumber line where the exception occured
- * @param msg the message that was generated
- */
- IOException( const char* file, const int lineNumber,
- const char* msg, ... ) throw()
- : lang::Exception() {
- va_list vargs;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual IOException* clone() const {
- return new IOException( *this );
- }
-
- virtual ~IOException() throw() {}
-
- };
-
-}}
-
-#endif /*_DECAF_IO_IOEXCEPTION_H*/
diff --git a/src/decaf/src/main/decaf/io/InputStream.h b/src/decaf/src/main/decaf/io/InputStream.h
deleted file mode 100644
index e560b52..0000000
--- a/src/decaf/src/main/decaf/io/InputStream.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_INPUTSTREAM_H_
-#define _DECAF_IO_INPUTSTREAM_H_
-
-#include <decaf/io/IOException.h>
-#include <decaf/io/Closeable.h>
-#include <decaf/util/concurrent/Synchronizable.h>
-#include <decaf/lang/exceptions/UnsupportedOperationException.h>
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace io{
-
- /**
- * Base interface for an input stream.
- */
- class DECAF_API InputStream : public Closeable,
- public util::concurrent::Synchronizable
- {
- public:
-
- virtual ~InputStream(){}
-
- /**
- * Indcates the number of bytes avaialable.
- * @return the number of bytes available on this input stream.
- * @throws IOException if an error occurs.
- */
- virtual std::size_t available() const throw ( IOException ) = 0;
-
- /**
- * Reads a single byte from the buffer. Blocks until
- * data is available.
- * @return The next byte.
- * @throws IOException thrown if an error occurs.
- */
- virtual unsigned char read() throw ( IOException ) = 0;
-
- /**
- * Reads an array of bytes from the buffer. Blocks until
- * the requested number of bytes are available.
- * @param buffer (out) the target buffer.
- * @param bufferSize the size of the output buffer.
- * @return The number of bytes read or -1 if EOF is detected
- * @throws IOException thrown if an error occurs.
- */
- virtual int read( unsigned char* buffer, std::size_t bufferSize )
- throw ( IOException ) = 0;
-
- /**
- * Skips over and discards n bytes of data from this input stream. The
- * skip method may, for a variety of reasons, end up skipping over some
- * smaller number of bytes, possibly 0. This may result from any of a
- * number of conditions; reaching end of file before n bytes have been
- * skipped is only one possibility. The actual number of bytes skipped
- * is returned. If n is negative, no bytes are skipped.
- * <p>
- * The skip method of InputStream creates a byte array and then
- * repeatedly reads into it until n bytes have been read or the end
- * of the stream has been reached. Subclasses are encouraged to
- * provide a more efficient implementation of this method.
- * @param num - the number of bytes to skip
- * @returns total butes skipped
- * @throws IOException if an error occurs
- */
- virtual std::size_t skip( std::size_t num )
- throw ( io::IOException, lang::exceptions::UnsupportedOperationException ) = 0;
-
- };
-
-}}
-
-#endif /*_DECAF_IO_INPUTSTREAM_H_*/
diff --git a/src/decaf/src/main/decaf/io/InterruptedIOException.h b/src/decaf/src/main/decaf/io/InterruptedIOException.h
deleted file mode 100644
index f891822..0000000
--- a/src/decaf/src/main/decaf/io/InterruptedIOException.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_IO_INTERRUPTEDIOEXCEPTION_H
-#define _DECAF_IO_INTERRUPTEDIOEXCEPTION_H
-
-#include <decaf/lang/Exception.h>
-#include <decaf/io/IOException.h>
-
-namespace decaf{
-namespace io{
-
- /*
- * Signals that an I/O exception of some sort has occurred.
- */
- class DECAF_API InterruptedIOException : public io::IOException {
- public:
-
- /**
- * Default Constructor
- */
- InterruptedIOException() throw() {}
-
- /**
- * Copy Constructor
- * @param ex the exception to copy
- */
- InterruptedIOException( const lang::Exception& ex ) throw()
- : IOException() {
- *(lang::Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- * @param ex the exception to copy, which is an instance of this type
- */
- InterruptedIOException( const InterruptedIOException& ex ) throw()
- : IOException() {
- *(lang::Exception*)this = ex;
- }
-
- /**
- * Consturctor
- * @param file name of the file were the exception occured.
- * @param lineNumber line where the exception occured
- * @param msg the message that was generated
- */
- InterruptedIOException( const char* file, const int lineNumber,
- const char* msg, ... ) throw()
- : IOException() {
- va_list vargs;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual InterruptedIOException* clone() const {
- return new IOException( *this );
- }
-
- virtual ~InterruptedIOException() throw() {}
-
- };
-
-}}
-
-#endif /*_DECAF_IO_INTERRUPTEDIOEXCEPTION_H*/
diff --git a/src/decaf/src/main/decaf/io/OutputStream.h b/src/decaf/src/main/decaf/io/OutputStream.h
deleted file mode 100644
index 08d14bc..0000000
--- a/src/decaf/src/main/decaf/io/OutputStream.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_OUTPUTSTREAM_H
-#define _DECAF_IO_OUTPUTSTREAM_H
-
-#include <decaf/io/Closeable.h>
-#include <decaf/io/IOException.h>
-#include <decaf/util/concurrent/Synchronizable.h>
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace io{
-
- /**
- * Base interface for an output stream.
- */
- class DECAF_API OutputStream : public Closeable,
- public util::concurrent::Synchronizable
- {
- public:
-
- virtual ~OutputStream(){}
-
- /**
- * Writes a single byte to the output stream.
- * @param c the byte.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( unsigned char c ) throw ( IOException ) = 0;
-
- /**
- * Writes an array of bytes to the output stream.
- * @param buffer The array of bytes to write.
- * @param len The number of bytes from the buffer to be written.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( const unsigned char* buffer, std::size_t len )
- throw ( IOException ) = 0;
-
- /**
- * Flushes any pending writes in this output stream.
- * @throws IOException
- */
- virtual void flush() throw ( IOException ) = 0;
- };
-
-}}
-
-#endif /*_DECAF_IO_OUTPUTSTREAM_H*/
diff --git a/src/decaf/src/main/decaf/io/Reader.h b/src/decaf/src/main/decaf/io/Reader.h
deleted file mode 100644
index 10b365a..0000000
--- a/src/decaf/src/main/decaf/io/Reader.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_IO_READER_H
-#define _DECAF_IO_READER_H
-
-#include <string>
-#include <decaf/io/IOException.h>
-#include <decaf/io/InputStream.h>
-
-namespace decaf{
-namespace io{
-
- /*
- * Reader interface that wraps around an input stream and provides
- * an interface for extracting the data from the input stream.
- */
- class DECAF_API Reader
- {
- public:
-
- virtual ~Reader(){};
-
- /**
- * Sets the target input stream.
- */
- virtual void setInputStream( InputStream* is ) = 0;
-
- /**
- * Gets the target input stream.
- */
- virtual InputStream* getInputStream() = 0;
-
- /**
- * Attempts to read an array of bytes from the stream.
- * @param buffer The target byte buffer.
- * @param count The number of bytes to read.
- * @return The number of bytes read.
- * @throws IOException thrown if an error occurs.
- */
- virtual std::size_t read( unsigned char* buffer, std::size_t count )
- throw( IOException ) = 0;
-
- /**
- * Attempts to read a byte from the input stream
- * @return The byte.
- * @throws IOException thrown if an error occurs.
- */
- virtual unsigned char readByte() throw( IOException ) = 0;
-
- };
-
-}}
-
-#endif /*_DECAF_IO_READER_H*/
diff --git a/src/decaf/src/main/decaf/io/StandardErrorOutputStream.h b/src/decaf/src/main/decaf/io/StandardErrorOutputStream.h
deleted file mode 100644
index 57e9bdb..0000000
--- a/src/decaf/src/main/decaf/io/StandardErrorOutputStream.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_IO_STANDARDERROROUTPUTSTREAM_H_
-#define _DECAF_IO_STANDARDERROROUTPUTSTREAM_H_
-
-#include <decaf/io/OutputStream.h>
-#include <decaf/util/concurrent/Mutex.h>
-
-#include <iostream>
-
-namespace decaf{
-namespace io{
-
- class DECAF_API StandardErrorOutputStream : public OutputStream
- {
- private:
-
- /**
- * Synchronization object.
- */
- util::concurrent::Mutex mutex;
-
- public:
-
- /**
- * Default Constructor
- */
- StandardErrorOutputStream(void) {}
-
- virtual ~StandardErrorOutputStream(void) {}
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void lock() throw( Exception ){
- mutex.lock();
- }
-
- /**
- * Unlocks the object.
- * @throws Exception
- */
- virtual void unlock() throw( lang::Exception ){
- mutex.unlock();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void wait() throw( lang::Exception ){
- mutex.wait();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param time in millisecsonds to wait, or WAIT_INIFINITE
- * @throws Exception
- */
- virtual void wait( unsigned long millisecs ) throw( lang::Exception ){
- mutex.wait( millisecs );
- }
-
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notify() throw( lang::Exception ){
- mutex.notify();
- }
-
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notifyAll() throw( lang::Exception ){
- mutex.notifyAll();
- }
-
- /**
- * Writes a single byte to the output stream.
- * @param c the byte.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( unsigned char c )
- throw ( IOException )
- {
- std::cerr << c;
- }
-
- /**
- * Writes an array of bytes to the output stream.
- * @param buffer The array of bytes to write.
- * @param len The number of bytes from the buffer to be written.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( const unsigned char* buffer, int len )
- throw ( IOException )
- {
- for(int i = 0; i < len; ++i)
- {
- std::cerr << buffer[i];
- }
- }
-
- /**
- * Invokes flush on the target output stream.
- * throws IOException if an error occurs
- */
- virtual void flush() throw ( IOException ){
- std::cerr.flush();
- }
-
- /**
- * Invokes close on the target output stream.
- * throws CMSException if an error occurs
- */
- void close() throw( lang::Exception ){
- std::cerr.flush();
- }
-
- };
-
-}
-
-#endif /*_DECAF_IO_STANDARDERROROUTPUTSTREAM_H_*/
diff --git a/src/decaf/src/main/decaf/io/Writer.h b/src/decaf/src/main/decaf/io/Writer.h
deleted file mode 100644
index b691093..0000000
--- a/src/decaf/src/main/decaf/io/Writer.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_IO_WRITER_H
-#define _DECAF_IO_WRITER_H
-
-#include <string>
-#include <decaf/io/IOException.h>
-#include <decaf/io/OutputStream.h>
-
-namespace decaf{
-namespace io{
-
- /*
- * Writer interface for an object that wraps around an output
- * stream
- */
- class DECAF_API Writer
- {
- public:
-
- virtual ~Writer(){};
-
- /**
- * Sets the target output stream.
- * @param Outputstream to use
- */
- virtual void setOutputStream( OutputStream* os ) = 0;
-
- /**
- * Gets the target output stream.
- * @returns the output stream currently being used
- */
- virtual OutputStream* getOutputStream() = 0;
-
- /**
- * Writes a byte array to the output stream.
- * @param buffer a byte array
- * @param count the number of bytes in the array to write.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( const unsigned char* buffer,
- std::size_t count ) throw( IOException ) = 0;
-
- /**
- * Writes a byte to the output stream.
- * @param v The value to be written.
- * @throws IOException thrown if an error occurs.
- */
- virtual void writeByte( unsigned char v ) throw( IOException ) = 0;
- };
-
-}}
-
-#endif /*_DECAF_IO_WRITER_H*/
diff --git a/src/decaf/src/main/decaf/lang/Boolean.cpp b/src/decaf/src/main/decaf/lang/Boolean.cpp
deleted file mode 100644
index 79c7cf2..0000000
--- a/src/decaf/src/main/decaf/lang/Boolean.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Boolean.h"
-#include <sstream>
-
-using namespace decaf;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-const Boolean Boolean::_FALSE( false );
-const Boolean Boolean::_TRUE( true );
-
-////////////////////////////////////////////////////////////////////////////////
-Boolean::Boolean( bool value ) {
- this->value = value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Boolean::Boolean( const std::string& value ) {
- this->value = parseBoolean( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Boolean::compareTo( const Boolean& b ) const {
- if( this->value == b.value ) {
- return 0;
- } else if( this->value && !b.value ) {
- return 1;
- } else {
- return -1;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Boolean::operator==( const Boolean& b ) const {
- return this->value == b.value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Boolean::operator<( const Boolean& b ) const {
- return this->value < b.value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Boolean::compareTo( const bool& b ) const {
- if( this->value == b ) {
- return 0;
- } else if( this->value && !b ) {
- return 1;
- } else {
- return -1;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Boolean::operator==( const bool& b ) const {
- return this->value == b;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Boolean::operator<( const bool& b ) const {
- return this->value < b;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Boolean::toString() const {
- return this->value ? "true" : "false";
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Boolean Boolean::valueOf( const std::string& value ) {
- return Boolean( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Boolean Boolean::valueOf( bool value ) {
- return Boolean( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Boolean::parseBoolean( const std::string& value ) {
- bool ret = 0;
- std::istringstream istream( value );
- istream.clear();
- istream >> std::boolalpha >> ret;
- return ret;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Boolean::toString( bool value ) {
- return value ? "true" : "false";
-}
diff --git a/src/decaf/src/main/decaf/lang/Boolean.h b/src/decaf/src/main/decaf/lang/Boolean.h
deleted file mode 100644
index a989dec..0000000
--- a/src/decaf/src/main/decaf/lang/Boolean.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_BOOLEAN_H_
-#define _DECAF_LANG_BOOLEAN_H_
-
-#include <string>
-#include <decaf/lang/Comparable.h>
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace lang{
-
- class DECAF_API Boolean : public Comparable<Boolean>,
- public Comparable<bool> {
- private:
-
- // This objects boolean value
- bool value;
-
- public:
-
- /**
- * The Class object representing the primitive false boolean.
- */
- static const Boolean _FALSE;
-
- /**
- * The Class object representing the primitive type boolean.
- */
- static const Boolean _TRUE;
-
- public:
-
- /**
- * @param value - primitive boolean to wrap.
- */
- Boolean( bool value );
-
- /**
- * @param value - String value to convert to a boolean.
- */
- Boolean( const std::string& value );
-
- virtual ~Boolean() {}
-
- /**
- * @returns the primitive boolean value of this object
- */
- bool booleanValue() const {
- return value;
- }
-
- /**
- * @returns the string representation of this Booleans value.
- */
- std::string toString() const;
-
- /**
- * Compares this Boolean instance with another.
- * @param b - the Boolean instance to be compared
- * @return zero if this object represents the same boolean value as the
- * argument; a positive value if this object represents true and the
- * argument represents false; and a negative value if this object
- * represents false and the argument represents true
- */
- virtual int compareTo( const Boolean& b ) const;
-
- /**
- * Compares equality between this object and the one passed.
- * @param value - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const Boolean& value ) const;
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param value - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const Boolean& value ) const;
-
- /**
- * @returns true if the two Boolean Objects have the same value.
- */
- bool equals( const Boolean& b ) const {
- return this->value == b.value;
- }
-
- /**
- * Compares this Boolean instance with another.
- * @param b - the Boolean instance to be compared
- * @return zero if this object represents the same boolean value as the
- * argument; a positive value if this object represents true and the
- * argument represents false; and a negative value if this object
- * represents false and the argument represents true
- */
- virtual int compareTo( const bool& b ) const;
-
- /**
- * Compares equality between this object and the one passed.
- * @param value - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const bool& value ) const;
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param value - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const bool& value ) const;
-
- /**
- * @returns true if the two Boolean Objects have the same value.
- */
- bool equals( const bool& b ) const {
- return this->value == b;
- }
-
- public: // Statics
-
- /**
- * @returns a Boolean instance of the primitive boolean value
- */
- static Boolean valueOf( bool value );
-
- /**
- * @returns a Boolean instance of the string value
- */
- static Boolean valueOf( const std::string& value );
-
- /**
- * Parses the String passed and extracts an bool.
- * @param String to parse
- * @return bool value
- */
- static bool parseBoolean( const std::string& value );
-
- /**
- * Converts the bool to a String representation
- * @param bool to convert
- * @return string representation
- */
- static std::string toString( bool value );
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_BOOLEAN_H_*/
diff --git a/src/decaf/src/main/decaf/lang/Byte.cpp b/src/decaf/src/main/decaf/lang/Byte.cpp
deleted file mode 100644
index addd8be..0000000
--- a/src/decaf/src/main/decaf/lang/Byte.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Byte.h"
-#include <decaf/lang/Integer.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-Byte::Byte( unsigned char value ) {
- this->value = value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Byte::Byte( const std::string& value ) throw( exceptions::NumberFormatException ) {
- this->value = parseByte( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Byte::toString() const {
- return string( 1, this->value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Byte::toString( unsigned char value ) {
- return Integer::toString( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned char Byte::parseByte( const std::string& s, int radix )
- throw ( exceptions::NumberFormatException ) {
-
- int intValue = Integer::parseInt( s, radix );
- unsigned char result = (unsigned char)intValue;
- if( result != intValue ) {
- throw NumberFormatException(
- __FILE__, __LINE__,
- "Byte::parseByte - Not a valid unsigned char encoded string.");
- }
-
- return result;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned char Byte::parseByte( const std::string& s )
- throw ( exceptions::NumberFormatException ) {
-
- return parseByte( s, 10 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Byte Byte::decode( const std::string& value )
- throw ( exceptions::NumberFormatException ) {
-
- int intValue = Integer::decode( value ).intValue();
- unsigned char result = (unsigned char)intValue;
- if( result != intValue ) {
- throw NumberFormatException(
- __FILE__, __LINE__,
- "Byte::decode - Not a valid unsigned char encoded string.");
- }
-
- return Byte( result );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Byte Byte::valueOf( const std::string& value )
- throw ( exceptions::NumberFormatException ) {
-
- return Byte( parseByte( value, 10 ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Byte Byte::valueOf( const std::string& value, int radix )
- throw ( exceptions::NumberFormatException ) {
-
- return Byte( parseByte( value, radix ) );
-}
diff --git a/src/decaf/src/main/decaf/lang/Byte.h b/src/decaf/src/main/decaf/lang/Byte.h
deleted file mode 100644
index 9762bf5..0000000
--- a/src/decaf/src/main/decaf/lang/Byte.h
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_BYTE_H_
-#define _DECAF_LANG_BYTE_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/lang/Number.h>
-#include <decaf/lang/Comparable.h>
-#include <decaf/lang/exceptions/NumberFormatException.h>
-#include <string>
-
-namespace decaf{
-namespace lang{
-
- class DECAF_API Byte : public Number,
- public Comparable<Byte>,
- public Comparable<unsigned char> {
- private:
-
- unsigned char value;
-
- public:
-
- /** The minimum value that a unsigned char can take on. */
- static const unsigned char MIN_VALUE = 0x7F;
-
- /** The maximum value that a unsigned char can take on. */
- static const unsigned char MAX_VALUE = 0x80;
-
- /** The size of the primitive charactor in bits. */
- static const int SIZE = 8;
-
- public:
-
- /**
- * @param value - the primitive value to wrap
- */
- Byte( unsigned char value );
-
- /**
- * @param value - the string to convert to an unsigned char
- * @throws NumberFormatException
- */
- Byte( const std::string& value ) throw( exceptions::NumberFormatException );
-
- virtual ~Byte() {}
-
- /**
- * Compares this Byte instance with another.
- * @param c - the Byte instance to be compared
- * @return zero if this object represents the same char value as the
- * argument; a positive value if this object represents a value greater
- * than the passed in value, and -1 if this object repesents a value
- * less than the passed in value.
- */
- virtual int compareTo( const Byte& c ) const {
- return this->value < c.value ? -1 : (this->value > c.value) ? 1 : 0;
- }
-
- /**
- * Compares equality between this object and the one passed.
- * @param c - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const Byte& c ) const {
- return this->value == c.value;
- }
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param c - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const Byte& c ) const {
- return this->value < c.value;
- }
-
- /**
- * Compares this Byte instance with a char type.
- * @param c - the char instance to be compared
- * @return zero if this object represents the same char value as the
- * argument; a positive value if this object represents a value greater
- * than the passed in value, and -1 if this object repesents a value
- * less than the passed in value.
- */
- virtual int compareTo( const unsigned char& c ) const {
- return this->value < c ? -1 : (this->value > c) ? 1 : 0;
- }
-
- /**
- * Compares equality between this object and the one passed.
- * @param c - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const unsigned char& c ) const {
- return this->value == c;
- }
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param c - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const unsigned char& c ) const {
- return this->value < c;
- }
-
- /**
- * @returns true if the two Byte Objects have the same value.
- */
- bool equals( const Byte& c ) const {
- return this->value == c.value;
- }
-
- /**
- * @returns true if the two Bytes have the same value.
- */
- bool equals( const unsigned char& c ) const {
- return this->value == c;
- }
-
- /**
- * @returns this Byte Object as a String Representation
- */
- std::string toString() const;
-
- /**
- * Answers the double value which the receiver represents
- * @return double the value of the receiver.
- */
- virtual double doubleValue() const {
- return (double)this->value;
- }
-
- /**
- * Answers the float value which the receiver represents
- * @return float the value of the receiver.
- */
- virtual float floatValue() const {
- return (float)this->value;
- }
-
- /**
- * Answers the byte value which the receiver represents
- * @return byte the value of the receiver.
- */
- virtual unsigned char byteValue() const {
- return this->value;
- }
-
- /**
- * Answers the short value which the receiver represents
- * @return short the value of the receiver.
- */
- virtual short shortValue() const {
- return (short)this->value;
- }
-
- /**
- * Answers the int value which the receiver represents
- * @return int the value of the receiver.
- */
- virtual int intValue() const {
- return (int)this->value;
- }
-
- /**
- * Answers the long value which the receiver represents
- * @return long long the value of the receiver.
- */
- virtual long long longValue() const {
- return (long long)this->value;
- }
-
- public: // statics
-
- /**
- * @returns a string representing the primitive value as Base 10
- */
- static std::string toString( unsigned char value );
-
- /**
- * Decodes a String into a Byte. Accepts decimal, hexadecimal, and octal
- * numbers given by the following grammar:
- *
- * The sequence of characters following an (optional) negative sign and/or
- * radix specifier ("0x", "0X", "#", or leading zero) is parsed as by the
- * Byte::parseByte method with the indicated radix (10, 16, or 8). This
- * sequence of characters must represent a positive value or a
- * NumberFormatException will be thrown. The result is negated if first
- * character of the specified String is the minus sign. No whitespace
- * characters are permitted in the string.
- * @param value - The string to decode
- * @returns a Byte object containing the decoded value
- * @throws NumberFomatException if the string is not formatted correctly.
- */
- static Byte decode( const std::string& value )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Parses the string argument as a signed unsigned char in the radix specified by
- * the second argument. The characters in the string must all be digits,
- * of the specified radix (as determined by whether
- * Character.digit(char, int) returns a nonnegative value) except that the
- * first character may be an ASCII minus sign '-' ('\u002D') to indicate
- * a negative value. The resulting byte value is returned.
- *
- * An exception of type NumberFormatException is thrown if any of the
- * following situations occurs:
- * * The first argument is null or is a string of length zero.
- * * The radix is either smaller than Character.MIN_RADIX or larger than
- * Character::MAX_RADIX.
- * * Any character of the string is not a digit of the specified radix,
- * except that the first character may be a minus sign '-' provided
- * that the string is longer than length 1.
- * * The value represented by the string is not a value of type unsigned char.
- *
- * @param s - the String containing the unsigned char to be parsed
- * @param radix - the radix to be used while parsing s
- * @return the unsigned char represented by the string argument in the
- * specified radix.
- * @throws NumberFormatException - If String does not contain a parsable
- * unsigned char.
- */
- static unsigned char parseByte( const std::string& s, int radix )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Parses the string argument as a signed decimal unsigned char. The
- * characters in the string must all be decimal digits, except that the
- * first character may be an ASCII minus sign '-' ('\u002D') to indicate a
- * negative value. The resulting unsigned char value is returned, exactly as
- * if the argument and the radix 10 were given as arguments to the
- * parseByte( const std::string, int ) method.
- * @param s - String to convert to a unsigned char
- * @returns the converted unsigned char value
- * @throws NumberFormatException if the string is not a unsigned char.
- */
- static unsigned char parseByte( const std::string& s )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Returns a Character instance representing the specified char value.
- * @param value - the primitive char to wrap.
- * @returns a new Charactor instance that wraps this value.
- */
- static Byte valueOf( unsigned char value ) {
- return Byte( value );
- }
-
- /**
- * Returns a Byte object holding the value given by the specified std::string.
- * The argument is interpreted as representing a signed decimal unsigned char,
- * exactly as if the argument were given to the parseByte( std::string )
- * method. The result is a Byte object that represents the unsigned char value
- * specified by the string.
- * @param value - std::string to parse as base 10
- * @return new Byte Object wrapping the primitive
- * @throws NumberFormatException if the string is not a decimal unsigned char.
- */
- static Byte valueOf( const std::string& value )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Returns a Byte object holding the value extracted from the specified
- * std::string when parsed with the radix given by the second argument.
- * The first argument is interpreted as representing a signed unsigned char
- * in the radix specified by the second argument, exactly as if the argument
- * were given to the parseByte( std::string, int ) method. The result is a
- * Byte object that represents the unsigned char value specified by the
- * string.
- * @param value - std::string to parse as base ( radix )
- * @param radix - base of the string to parse.
- * @return new Byte Object wrapping the primitive
- * @throws NumberFormatException if the string is not a valid unsigned char.
- */
- static Byte valueOf( const std::string& value, int radix )
- throw ( exceptions::NumberFormatException );
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_BYTE_H_*/
diff --git a/src/decaf/src/main/decaf/lang/Character.cpp b/src/decaf/src/main/decaf/lang/Character.cpp
deleted file mode 100644
index e387808..0000000
--- a/src/decaf/src/main/decaf/lang/Character.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <decaf/lang/Character.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-Character::Character( char value ) {
- this->value = value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Character::toString() const {
- return string( 1, this->value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Character::digit( char c, int radix ) {
- if( radix >= MIN_RADIX && radix <= MAX_RADIX ) {
- int result = -1;
- if( '0' <= c && c <= '9' ) {
- result = c - '0';
- } else if( 'a' <= c && c <= 'z' ) {
- result = c - ('a' - 10);
- } else if( 'A' <= c && c <= 'Z' ) {
- result = c - ('A' - 10);
- }
- return result < radix ? result : -1;
- }
- return -1;
-}
diff --git a/src/decaf/src/main/decaf/lang/Character.h b/src/decaf/src/main/decaf/lang/Character.h
deleted file mode 100644
index f39e611..0000000
--- a/src/decaf/src/main/decaf/lang/Character.h
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_CHARACTER_H_
-#define _DECAF_LANG_CHARACTER_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/lang/Number.h>
-#include <decaf/lang/Comparable.h>
-#include <string>
-
-namespace decaf{
-namespace lang{
-
- class DECAF_API Character : public Number,
- public Comparable<Character>,
- public Comparable<char> {
- private:
-
- // The primitive Char value
- char value;
-
- public:
-
- /** The minimum radix available for conversion to and from strings. */
- static const int MIN_RADIX = 2;
-
- /** The maximum radix available for conversion to and from strings. */
- static const int MAX_RADIX = 36;
-
- /** The minimum value that a signed char can take on. */
- static const char MIN_VALUE = (char)0x7F;
-
- /** The maximum value that a signed char can take on. */
- static const char MAX_VALUE = (char)0x80;
-
- /** The size of the primitive charactor in bits. */
- static const int SIZE = 8;
-
- public:
-
- /**
- * @param value - char to wrap.
- */
- Character( char value );
-
- /**
- * Compares this Character instance with another.
- * @param c - the Character instance to be compared
- * @return zero if this object represents the same char value as the
- * argument; a positive value if this object represents a value greater
- * than the passed in value, and -1 if this object repesents a value
- * less than the passed in value.
- */
- virtual int compareTo( const Character& c ) const {
- return this->value < c.value ? -1 : (this->value > c.value) ? 1 : 0;
- }
-
- /**
- * Compares equality between this object and the one passed.
- * @param c - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const Character& c ) const {
- return this->value == c.value;
- }
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param c - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const Character& c ) const {
- return this->value < c.value;
- }
-
- /**
- * Compares this Character instance with a char type.
- * @param c - the char instance to be compared
- * @return zero if this object represents the same char value as the
- * argument; a positive value if this object represents a value greater
- * than the passed in value, and -1 if this object repesents a value
- * less than the passed in value.
- */
- virtual int compareTo( const char& c ) const {
- return this->value < c ? -1 : (this->value > c) ? 1 : 0;
- }
-
- /**
- * Compares equality between this object and the one passed.
- * @param c - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const char& c ) const {
- return this->value == c;
- }
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param c - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const char& c ) const {
- return this->value < c;
- }
-
- /**
- * @returns true if the two Character Objects have the same value.
- */
- bool equals( const Character& c ) const {
- return this->value == c.value;
- }
-
- /**
- * @returns true if the two Characters have the same value.
- */
- bool equals( const char& c ) const {
- return this->value == c;
- }
-
- /**
- * @returns this Character Object as a String Representation
- */
- std::string toString() const;
-
- /**
- * Answers the double value which the receiver represents
- * @return double the value of the receiver.
- */
- virtual double doubleValue() const {
- return (double)this->value;
- }
-
- /**
- * Answers the float value which the receiver represents
- * @return float the value of the receiver.
- */
- virtual float floatValue() const {
- return (float)this->value;
- }
-
- /**
- * Answers the byte value which the receiver represents
- * @return int the value of the receiver.
- */
- virtual unsigned char byteValue() const {
- return (unsigned char)this->value;
- }
-
- /**
- * Answers the short value which the receiver represents
- * @return int the value of the receiver.
- */
- virtual short shortValue() const {
- return (short)this->value;
- }
-
- /**
- * Answers the int value which the receiver represents
- * @return int the value of the receiver.
- */
- virtual int intValue() const {
- return (int)this->value;
- }
-
- /**
- * Answers the long value which the receiver represents
- * @return long the value of the receiver.
- */
- virtual long long longValue() const {
- return (long long)this->value;
- }
-
- public: // statics
-
- /**
- * Returns a Character instance representing the specified char value.
- * @param value - the primitive char to wrap.
- * @returns a new Charactor instance that wraps this value.
- */
- static Character valueOf( char value ) {
- return Character( value );
- }
-
- /**
- * Indicates whether or not the given character is considered
- * whitespace.
- */
- static bool isWhitespace( char c ){
- switch ( c )
- {
- case '\n':
- case '\t':
- case '\r':
- case '\f':
- case ' ':
- return true;
- }
-
- return false;
- }
-
- /**
- * Indicates whether or not the given character is
- * a digit.
- */
- static bool isDigit( char c ){
- return c >= '0' && c <= '9';
- }
-
- /**
- * Indicates whether or not the given character is
- * a lower case character.
- */
- static bool isLowerCase( char c ){
- return c >= 'a' && c <= 'z';
- }
-
- /**
- * Indicates whether or not the given character is
- * a upper case character.
- */
- static bool isUpperCase( char c ){
- return c >= 'A' && c <= 'Z';
- }
-
- /**
- * Indicates whether or not the given character is
- * a letter.
- */
- static bool isLetter( char c ){
- return isUpperCase(c) || isLowerCase(c);
- }
-
- /**
- * Indicates whether or not the given character is
- * either a letter or a digit.
- */
- static bool isLetterOrDigit( char c ){
- return isLetter(c) || isDigit(c);
- }
-
- /**
- * Answers whether the character is an ISO control character, which
- * is a char that lays in the range of 0 to 1f and 7f to 9f
- * @param c - the character, including supplementary characters
- * @return true if the char is an ISO control character
- */
- static bool isISOControl( char c ) {
- return ( c >= 0 && c <= 0x1f ) ||
- ( (unsigned char)c >= 0x7f && (unsigned char)c <= 0x9f );
- }
-
- /**
- * Returns the numeric value of the character ch in the specified radix.
- *
- * If the radix is not in the range MIN_RADIX <= radix <= MAX_RADIX or if
- * the value of ch is not a valid digit in the specified radix, -1 is
- * returned. A character is a valid digit if at least one of the following
- * is true:
- *
- * * The method isDigit is true of the character and the single-character
- * decomposition is less than the specified radix. In this case the
- * decimal digit value is returned.
- * * The character is one of the uppercase Latin letters 'A' through 'Z'
- * and its code is less than radix + 'A' - 10. In this case,
- * ch - 'A' + 10 is returned.
- * * The character is one of the lowercase Latin letters 'a' through 'z'
- * and its code is less than radix + 'a' - 10. In this case,
- * ch - 'a' + 10 is returned.
- *
- * @param c - the char to be converted
- * @param radix - the radix of the number
- * @returns the numeric value of the number represented in the given radix
- */
- static int digit( char c, int radix );
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_CHARACTER_H_*/
diff --git a/src/decaf/src/main/decaf/lang/Comparable.h b/src/decaf/src/main/decaf/lang/Comparable.h
deleted file mode 100644
index 3ccfc76..0000000
--- a/src/decaf/src/main/decaf/lang/Comparable.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_COMPARABLE_H_
-#define _DECAF_LANG_COMPARABLE_H_
-
-namespace decaf{
-namespace lang{
-
- /**
- * This interface imposes a total ordering on the objects of each class that
- * implements it. This ordering is referred to as the class's natural
- * ordering, and the class's compareTo method is referred to as its natural
- * comparison method.
- */
- template< typename T >
- class Comparable{
- public:
-
- virtual ~Comparable() {}
-
- /**
- * Compares this object with the specified object for order. Returns a
- * negative integer, zero, or a positive integer as this object is less
- * than, equal to, or greater than the specified object.
- *
- * In the foregoing description, the notation sgn(expression) designates
- * the mathematical signum function, which is defined to return one of
- * -1, 0, or 1 according to whether the value of expression is negative,
- * zero or positive. The implementor must ensure sgn(x.compareTo(y)) ==
- * -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y)
- * must throw an exception iff y.compareTo(x) throws an exception.)
- *
- * The implementor must also ensure that the relation is transitive:
- * (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.
- *
- * Finally, the implementer must ensure that x.compareTo(y)==0 implies
- * that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z.
- *
- * It is strongly recommended, but not strictly required that
- * (x.compareTo(y)==0) == (x.equals(y)). Generally speaking, any class
- * that implements the Comparable interface and violates this condition
- * should clearly indicate this fact. The recommended language is
- * "Note: this class has a natural ordering that is inconsistent with
- * equals."
- * @param value - the Object to be compared.
- * @returns a negative integer, zero, or a positive integer as this
- * object is less than, equal to, or greater than the specified object.
- */
- virtual int compareTo( const T& value ) const = 0;
-
- /**
- * @return true if this value is considered equal to the passed value.
- */
- virtual bool equals( const T& value ) const = 0;
-
- /**
- * Compares equality between this object and the one passed.
- * @param value - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const T& value ) const = 0;
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param value - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const T& value ) const = 0;
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_COMPARABLE_H_*/
diff --git a/src/decaf/src/main/decaf/lang/Double.cpp b/src/decaf/src/main/decaf/lang/Double.cpp
deleted file mode 100644
index c0f6a4b..0000000
--- a/src/decaf/src/main/decaf/lang/Double.cpp
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Double.h"
-#include <decaf/lang/Long.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-const double Double::MAX_VALUE = 1.7976931348623157e+308;
-const double Double::MIN_VALUE = 5e-324;
-const double Double::NaN = 0.0f / 0.0f;
-const double Double::POSITIVE_INFINITY = 1.0f / 0.0f;
-const double Double::NEGATIVE_INFINITY = -1.0f / 0.0f;
-
-////////////////////////////////////////////////////////////////////////////////
-Double::Double( double value ) {
- this->value = value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Double::Double( const std::string& value ) throw( exceptions::NumberFormatException ) {
- this->value = Double::parseDouble( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Double::compareTo( const Double& d ) const {
- return Double::compare( this->value, d.value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Double::compareTo( const double& d ) const {
- return Double::compare( this->value, d );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Double::toString() const {
- return Double::toString( this->value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Double::isInfinite() const {
- return Double::isInfinite( this->value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Double::isNaN() const {
- return Double::isNaN( this->value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Double::compare( double d1, double d2 ) {
-
- long long l1, l2 = 0;
- long NaNbits = Double::doubleToLongBits( Double::NaN );
-
- if( ( l1 = Double::doubleToLongBits( d1 ) ) == NaNbits ) {
- if( Double::doubleToLongBits( d2 ) == NaNbits ) {
- return 0;
- }
- return 1;
- }
-
- if( ( l2 = Double::doubleToLongBits( d2 ) ) == NaNbits ) {
- return -1;
- }
-
- if( d1 == d2 ) {
- if( l1 == l2 ) {
- return 0;
- }
-
- // check for -0
- return l1 > l2 ? 1 : -1;
- }
-
- return d1 > d2 ? 1 : -1;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long Double::doubleToLongBits( double value ) {
-
- long long longValue = 0;
- memcpy( &longValue, &value, sizeof( double ) );
-
- if( ( longValue & DOUBLE_EXPONENT_MASK ) == DOUBLE_EXPONENT_MASK ) {
- if( longValue & DOUBLE_MANTISSA_MASK ) {
- return DOUBLE_NAN_BITS;
- }
- }
-
- return longValue;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long Double::doubleToRawLongBits( double value ) {
-
- long long longValue = 0;
- memcpy( &longValue, &value, sizeof( double ) );
- return longValue;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Double::isInfinite( double value ) {
- return ( value == POSITIVE_INFINITY ) || ( value == NEGATIVE_INFINITY );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Double::isNaN( double value ) {
- return value != value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Double::longBitsToDouble( long long bits ) {
- double result = 0;
- memcpy( &result, &bits, sizeof( long long ) );
- return result;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Double::parseDouble( const std::string value )
- throw ( exceptions::NumberFormatException ) {
-
- return 0; // TODO
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Double::toHexString( double value ) {
- /*
- * Reference: http://en.wikipedia.org/wiki/IEEE_754
- */
- if( value != value ) {
- return "NaN";
- }
- if( value == POSITIVE_INFINITY ) {
- return "Infinity";
- }
- if( value == NEGATIVE_INFINITY ) {
- return "-Infinity";
- }
-
- unsigned long long bitValue = Double::doubleToLongBits( value );
-
- bool negative = ( bitValue & 0x8000000000000000LL ) != 0;
- // mask exponent bits and shift down
- unsigned long long exponent = ( bitValue & 0x7FF0000000000000LL ) >> 52;
- // mask significand bits and shift up
- unsigned long long significand = bitValue & 0x000FFFFFFFFFFFFFLL;
-
- if( exponent == 0 && significand == 0 ) {
- return ( negative ? "-0x0.0p0" : "0x0.0p0" );
- }
-
- // Start with sign and hex indicator
- std::string hexString( negative ? "-0x" : "0x" );
-
- if( exponent == 0 ) {
- // denormal (subnormal) value
- hexString.append("0.");
- // significand is 52-bits, so there can be 13 hex digits
- unsigned int fractionDigits = 13;
- // remove trailing hex zeros, so Integer.toHexString() won't print
- // them
- while( ( significand != 0 ) && ( ( significand & 0xF ) == 0 ) ) {
- significand >>= 4;
- fractionDigits--;
- }
- // this assumes Integer.toHexString() returns lowercase characters
- std::string hexSignificand = Long::toHexString( significand );
-
- // if there are digits left, then insert some '0' chars first
- if( significand != 0 && fractionDigits > hexSignificand.length() ) {
- int digitDiff = fractionDigits - hexSignificand.length();
- while( digitDiff-- != 0 ) {
- hexString.append( "0" );
- }
- }
-
- hexString.append( hexSignificand );
- hexString.append( "p-1022" );
- } else {
- // normal value
- hexString.append( "1." );
- // significand is 52-bits, so there can be 13 hex digits
- unsigned int fractionDigits = 13;
- // remove trailing hex zeros, so Integer.toHexString() won't print
- // them
- while( (significand != 0 ) && ( ( significand & 0xF ) == 0 ) ) {
- significand >>= 4;
- fractionDigits--;
- }
- // this assumes Integer.toHexString() returns lowercase characters
- std::string hexSignificand = Long::toHexString( significand );
-
- // if there are digits left, then insert some '0' chars first
- if( significand != 0 && fractionDigits > hexSignificand.length() ) {
- int digitDiff = fractionDigits - hexSignificand.length();
- while( digitDiff-- != 0 ) {
- hexString.append( "0" );
- }
- }
-
- hexString.append( hexSignificand );
- hexString.append( "p" );
- // remove exponent's 'bias' and convert to a string
- hexString.append( Long::toString( exponent - 1023 ) );
- }
-
- return hexString;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Double::toString( double value ) {
- return ""; //TODO
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Double Double::valueOf( double value ) {
- return Double( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Double Double::valueOf( const std::string& value )
- throw ( exceptions::NumberFormatException ) {
-
- return valueOf( parseDouble( value ) );
-}
diff --git a/src/decaf/src/main/decaf/lang/Double.h b/src/decaf/src/main/decaf/lang/Double.h
deleted file mode 100644
index 39b8b21..0000000
--- a/src/decaf/src/main/decaf/lang/Double.h
+++ /dev/null
@@ -1,412 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_DOUBLE_H_
-#define _DECAF_LANG_DOUBLE_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/lang/Comparable.h>
-#include <decaf/lang/Number.h>
-#include <decaf/lang/exceptions/NumberFormatException.h>
-#include <string>
-
-namespace decaf{
-namespace lang{
-
- class DECAF_API Double : public Number,
- public Comparable<Double>,
- public Comparable<double> {
- private:
-
- double value;
-
- public:
-
- /** The size in bits of the primitive int type */
- static const int SIZE = 64;
-
- /** The maximum value that the primitive type can hold */
- static const double MAX_VALUE;
-
- /** The minimum value that the primitive type can hold */
- static const double MIN_VALUE;
-
- /** Constant for the Not a Number Value */
- static const double NaN;
-
- /** Constant for Positive Infinity */
- static const double POSITIVE_INFINITY;
-
- /** Constant for Negative Infinitiy */
- static const double NEGATIVE_INFINITY;
-
- public:
-
- /**
- * @param value - the primitve type to wrap
- */
- Double( double value );
-
- /**
- * @param value - the string to convert to a primitve type to wrap
- */
- Double( const std::string& value ) throw( exceptions::NumberFormatException );
-
- virtual ~Double() {}
-
- /**
- * Compares this Double instance with another.
- * @param d - the Double instance to be compared
- * @return zero if this object represents the same integer value as the
- * argument; a positive value if this object represents a value greater
- * than the passed in value, and -1 if this object repesents a value
- * less than the passed in value.
- */
- virtual int compareTo( const Double& d ) const;
-
- /**
- * @param d - the Double object to compare against.
- * @returns true if the two Double Objects have the same value.
- */
- bool equals( const Double& d ) const {
- return this->value == d.value;
- }
-
- /**
- * Compares equality between this object and the one passed.
- * @param d - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const Double& d ) const {
- return this->value == d.value;
- }
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param d - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const Double& d ) const {
- return this->value < d.value;
- }
-
- /**
- * Compares this Double instance with another.
- * @param d - the Double instance to be compared
- * @return zero if this object represents the same integer value as the
- * argument; a positive value if this object represents a value greater
- * than the passed in value, and -1 if this object repesents a value
- * less than the passed in value.
- */
- virtual int compareTo( const double& d ) const;
-
- /**
- * @param d - the Double object to compare against.
- * @returns true if the two Double Objects have the same value.
- */
- bool equals( const double& d ) const {
- return this->value == d;
- }
-
- /**
- * Compares equality between this object and the one passed.
- * @param d - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const double& d ) const {
- return this->value == d;
- }
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param d - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const double& d ) const {
- return this->value < d;
- }
-
- /**
- * @returns this Double Object as a String Representation
- */
- std::string toString() const;
-
- /**
- * Answers the double value which the receiver represents
- * @return double the value of the receiver.
- */
- virtual double doubleValue() const {
- return this->value;
- }
-
- /**
- * Answers the float value which the receiver represents
- * @return float the value of the receiver.
- */
- virtual float floatValue() const {
- return (float)this->value;
- }
-
- /**
- * Answers the byte value which the receiver represents
- * @return byte the value of the receiver.
- */
- virtual unsigned char byteValue() const {
- return (unsigned char)this->value;
- }
-
- /**
- * Answers the short value which the receiver represents
- * @return short the value of the receiver.
- */
- virtual short shortValue() const {
- return (short)this->value;
- }
-
- /**
- * Answers the int value which the receiver represents
- * @return int the value of the receiver.
- */
- virtual int intValue() const {
- return (int)this->value;
- }
-
- /**
- * Answers the long value which the receiver represents
- * @return long the value of the receiver.
- */
- virtual long long longValue() const {
- return (long long)this->value;
- }
-
- /**
- * @returns true if the double is equal to positive infinity.
- */
- bool isInfinite() const;
-
- /**
- * @returns true if the double is equal to NaN.
- */
- bool isNaN() const;
-
- public: // Statics
-
- /**
- * Compares the two specified double values. The sign of the integer value
- * returned is the same as that of the integer that would be returned by the
- * call:
- * new Double(d1).compareTo(new Double(d2))
- * @param d1 - the first double to compare
- * @param d2 - the second double to compare
- * @returns the value 0 if d1 is numerically equal to d2; a value less than
- * 0 if d1 is numerically less than d2; and a value greater than 0 if d1 is
- * numerically greater than d2.
- */
- static int compare( double d1, double d2 );
-
- /**
- * Returns a representation of the specified floating-point value according
- * to the IEEE 754 floating-point "double format" bit layout.
- *
- * Bit 63 (the bit that is selected by the mask 0x8000000000000000L)
- * represents the sign of the floating-point number. Bits 62-52 (the bits
- * that are selected by the mask 0x7ff0000000000000L) represent the exponent.
- * Bits 51-0 (the bits that are selected by the mask 0x000fffffffffffffL)
- * represent the significand (sometimes called the mantissa) of the
- * floating-point number.
- *
- * If the argument is positive infinity, the result is 0x7ff0000000000000L.
- * If the argument is negative infinity, the result is 0xfff0000000000000L.
- * If the argument is NaN, the result is 0x7ff8000000000000L.
- *
- * In all cases, the result is a long integer that, when given to the
- * longBitsToDouble(long) method, will produce a floating-point value the
- * same as the argument to doubleToLongBits (except all NaN values are
- * collapsed to a single "canonical" NaN value).
- * @param value - double to be converted
- * @returns the long long bits that make up the double
- */
- static long long doubleToLongBits( double value );
-
- /**
- * Returns a representation of the specified floating-point value according
- * to the IEEE 754 floating-point "double format" bit layout, preserving
- * Not-a-Number (NaN) values.
- *
- * Bit 63 (the bit that is selected by the mask 0x8000000000000000LL)
- * represents the sign of the floating-point number. Bits 62-52 (the bits
- * that are selected by the mask 0x7ff0000000000000L) represent the exponent.
- * Bits 51-0 (the bits that are selected by the mask 0x000fffffffffffffL)
- * represent the significand (sometimes called the mantissa) of the
- * floating-point number.
- *
- * If the argument is positive infinity, the result is 0x7ff0000000000000LL.
- * If the argument is negative infinity, the result is 0xfff0000000000000LL.
- * If the argument is NaN, the result is the long integer representing the
- * actual NaN value. Unlike the doubleToLongBits method, doubleToRawLongBits
- * does not collapse all the bit patterns encoding a NaN to a single
- * "canonical" NaN value.
- *
- * In all cases, the result is a long integer that, when given to the
- * longBitsToDouble(long) method, will produce a floating-point value the
- * same as the argument to doubleToRawLongBits.
- * @param value - double to be converted
- * @returns the long long bits that make up the double
- */
- static long long doubleToRawLongBits( double value );
-
- /**
- * @param value - The double to check.
- * @returns true if the double is equal to infinity.
- */
- static bool isInfinite( double value );
-
- /**
- * @param value - The double to check.
- * @returns true if the double is equal to NaN.
- */
- static bool isNaN( double value );
-
- /**
- * Returns the double value corresponding to a given bit representation.
- * The argument is considered to be a representation of a floating-point
- * value according to the IEEE 754 floating-point "double format" bit layout.
- *
- * If the argument is 0x7ff0000000000000L, the result is positive infinity.
- * If the argument is 0xfff0000000000000L, the result is negative infinity.
- * If the argument is any value in the range 0x7ff0000000000001L through
- * 0x7fffffffffffffffL or in the range 0xfff0000000000001L through
- * 0xffffffffffffffffL, the result is a NaN. No IEEE 754 floating-point
- * operation provided by C++ can distinguish between two NaN values of the
- * same type with different bit patterns. Distinct values of NaN are only
- * distinguishable by use of the Double.doubleToRawLongBits method.
- * @param bits - the long long bits to convert to double
- * @return the double converted from the bits
- */
- static double longBitsToDouble( long long bits );
-
- /**
- * Returns a new double initialized to the value represented by the
- * specified string, as performed by the valueOf method of class Double.
- * @param value - The string to parse to an double
- * @returns a double parsed from the passed string
- * @throws NumberFormatException
- */
- static double parseDouble( const std::string value )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Returns a hexadecimal string representation of the double argument. All
- * characters mentioned below are ASCII characters.
- *
- * * If the argument is NaN, the result is the string "NaN".
- * * Otherwise, the result is a string that represents the sign and magnitude
- * (absolute value) of the argument. If the sign is negative, the first
- * character of the result is '-'; if the sign is positive, no sign
- * character appears in the result. As for the magnitude m:
- * o If m is infinity, it is represented by the string "Infinity"; thus,
- * positive infinity produces the result "Infinity" and negative
- * infinity produces the result "-Infinity".
- * o If m is zero, it is represented by the string "0x0.0p0"; thus,
- * negative zero produces the result "-0x0.0p0" and positive zero
- * produces the result "0x0.0p0".
- * o If m is a double value with a normalized representation, substrings
- * are used to represent the significand and exponent fields. The
- * significand is represented by the characters "0x1." followed by a
- * lowercase hexadecimal representation of the rest of the
- * significand as a fraction. Trailing zeros in the hexadecimal
- * representation are removed unless all the digits are zero, in which
- * case a single zero is used. Next, the exponent is represented by
- * "p" followed by a decimal string of the unbiased exponent as if
- * produced by a call to Integer.toString on the exponent value.
- * o If m is a double value with a subnormal representation, the
- * significand is represented by the characters "0x0." followed by a
- * hexadecimal representation of the rest of the significand as a
- * fraction. Trailing zeros in the hexadecimal representation are
- * removed. Next, the exponent is represented by "p-126". Note that
- * there must be at least one nonzero digit in a subnormal significand.
- *
- * @param value - The double to convert to a string
- * @returns the Hex formatted double string.
- */
- static std::string toHexString( double value );
-
- /**
- * Returns a string representation of the double argument. All characters
- * mentioned below are ASCII characters.
- *
- * If the argument is NaN, the result is the string "NaN".
- * Otherwise, the result is a string that represents the sign and magnitude
- * (absolute value) of the argument. If the sign is negative, the first
- * character of the result is '-'; if the sign is positive, no
- * sign character appears in the result. As for the magnitude m:
- * o If m is infinity, it is represented by the characters "Infinity"; thus,
- * positive infinity produces the result "Infinity" and negative infinity
- * produces the result "-Infinity".
- * o If m is zero, it is represented by the characters "0.0"; thus, negative
- * zero produces the result "-0.0" and positive zero produces the result
- * "0.0".
- * o If m is greater than or equal to 10-3 but less than 107, then it is
- * represented as the integer part of m, in decimal form with no leading
- * zeroes, followed by '.', followed by one or more decimal digits
- * representing the fractional part of m.
- * o If m is less than 10-3 or greater than or equal to 107, then it is
- * represented in so-called "computerized scientific notation." Let n be
- * the unique integer such that 10n <= m < 10n+1; then let a be the
- * mathematically exact quotient of m and 10n so that 1 <= a < 10.
- * The magnitude is then represented as the integer part of a, as a
- * single decimal digit, followed by '.', followed by decimal digits
- * representing the fractional part of a, followed by the letter 'E',
- * followed by a representation of n as a decimal integer, as produced
- * by the method Integer.toString(int).
- * @param value - The double to convert to a string
- * @returns the formatted double string.
- */
- static std::string toString( double value );
-
- /**
- * Returns a Double instance representing the specified double value.
- * @param value - double to wrap
- * @returns new Double instance wrapping the primitive value
- */
- static Double valueOf( double value );
-
- /**
- * Returns a Double instance that wraps a primtive double which is parsed
- * from the string value passed.
- * @param value - the string to parse
- * @returns a new Double instance wrapping the double parsed from value
- * @throws NumberFormatException on error.
- */
- static Double valueOf( const std::string& value )
- throw ( exceptions::NumberFormatException );
-
- private:
-
- static const long long DOUBLE_SIGN_MASK = 0x8000000000000000LL;
- static const long long DOUBLE_EXPONENT_MASK = 0x7FF0000000000000LL;
- static const long long DOUBLE_MANTISSA_MASK = 0x000FFFFFFFFFFFFFLL;
- static const long long DOUBLE_NAN_BITS =
- DOUBLE_EXPONENT_MASK | 0x0008000000000000LL;
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_DOUBLE_H_*/
diff --git a/src/decaf/src/main/decaf/lang/Exception.cpp b/src/decaf/src/main/decaf/lang/Exception.cpp
deleted file mode 100644
index b4d3974..0000000
--- a/src/decaf/src/main/decaf/lang/Exception.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stdio.h>
-#include "Exception.h"
-#include <decaf/util/logging/LoggerDefines.h>
-#include <sstream>
-
-#include <apr_pools.h>
-#include <apr_strings.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::util::logging;
-
-////////////////////////////////////////////////////////////////////////////////
-Exception::Exception() throw(){
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Exception::Exception( const Exception& ex ) throw() : Throwable() {
- *this = ex;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Exception::Exception( const char* file, const int lineNumber,
- const char* msg, ... ) throw() {
- va_list vargs;
- va_start( vargs, msg ) ;
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Exception::~Exception() throw(){
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Exception::setMessage( const char* msg, ... ){
- va_list vargs;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Exception::buildMessage( const char* format, va_list& vargs ) {
-
- // Allocate buffer with a guess of it's size
- apr_pool_t* pool = NULL;
- apr_pool_create( &pool, NULL );
-
- // Allocate a buffer of the specified size.
- char* buffer = apr_pvsprintf( pool, format, vargs );
-
- // Guessed size was enough. Assign the string.
- message.assign( buffer, strlen( buffer ) );
-
- // assign isn't passing ownership, just copying, delete
- // the allocated buffer.
- apr_pool_destroy( pool );
-
- //decaf::util::logger::SimpleLogger logger("com.yadda1");
- //logger.log( message );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Exception::setMark( const char* file, const int lineNumber ) {
-
- // Add this mark to the end of the stack trace.
- stackTrace.push_back( std::make_pair( (std::string)file, (int)lineNumber ) );
-
- std::ostringstream stream;
- stream << "\tFILE: " << stackTrace[stackTrace.size()-1].first;
- stream << ", LINE: " << stackTrace[stackTrace.size()-1].second;
-
- //decaf::util::logger::SimpleLogger logger("com.yadda2");
- //logger.log( stream.str() );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Exception* Exception::clone() const {
- return new Exception( *this );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::vector< std::pair< std::string, int> > Exception::getStackTrace() const {
- return stackTrace;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Exception::printStackTrace() const {
- printStackTrace( std::cerr );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Exception::printStackTrace( std::ostream& stream ) const {
- stream << getStackTraceString();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Exception::getStackTraceString() const {
-
- // Create the output stream.
- std::ostringstream stream;
-
- // Write the message and each stack entry.
- stream << message << std::endl;
- for( unsigned int ix=0; ix<stackTrace.size(); ++ix ){
- stream << "\tFILE: " << stackTrace[ix].first;
- stream << ", LINE: " << stackTrace[ix].second;
- stream << std::endl;
- }
-
- // Return the string from the output stream.
- return stream.str();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Exception& Exception::operator =( const Exception& ex ){
- this->message = ex.message;
- this->stackTrace = ex.stackTrace;
- return *this;
-}
diff --git a/src/decaf/src/main/decaf/lang/Exception.h b/src/decaf/src/main/decaf/lang/Exception.h
deleted file mode 100644
index ac567c6..0000000
--- a/src/decaf/src/main/decaf/lang/Exception.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_LANG_EXCEPTION_EXCEPTION_H_
-#define _DECAF_LANG_EXCEPTION_EXCEPTION_H_
-
-#include <decaf/lang/Throwable.h>
-#include <decaf/lang/exceptions/ExceptionDefines.h>
-#include <decaf/util/Config.h>
-#include <stdarg.h>
-#include <sstream>
-
-namespace decaf{
-namespace lang{
-
- /*
- * Base class for all exceptions.
- */
- class DECAF_API Exception : public Throwable
- {
- private:
-
- /**
- * The cause of this exception.
- */
- std::string message;
-
- /**
- * The stack trace.
- */
- std::vector< std::pair< std::string, int> > stackTrace;
-
- public:
-
- /**
- * Default Constructor
- */
- Exception() throw();
-
- /**
- * Copy Constructor
- */
- Exception( const Exception& ex ) throw();
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- Exception( const char* file, const int lineNumber,
- const char* msg, ... ) throw();
-
- virtual ~Exception() throw();
-
- /**
- * Gets the message for this exception.
- * @return Text formatted error message
- */
- virtual std::string getMessage() const{
- return message;
- }
-
- /**
- * Implement method from std::exception
- * @return the const char* of <code>getMessage()</code>.
- */
- virtual const char* what() const throw (){
- return message.c_str();
- }
-
- /**
- * Sets the cause for this exception.
- * @param msg the format string for the msg.
- * @param variable - params to format into the string
- */
- virtual void setMessage( const char* msg, ... );
-
- /**
- * Adds a file/line number to the stack trace.
- * @param file The name of the file calling this method (use __FILE__).
- * @param lineNumber The line number in the calling file (use __LINE__).
- */
- virtual void setMark( const char* file, const int lineNumber );
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- * @return Copy of this Exception object
- */
- virtual Exception* clone() const;
-
- /**
- * Provides the stack trace for every point where
- * this exception was caught, marked, and rethrown. The first
- * item in the returned vector is the first point where the mark
- * was set (e.g. where the exception was created).
- * @return the stack trace.
- */
- virtual std::vector< std::pair< std::string, int> > getStackTrace() const;
-
- /**
- * Prints the stack trace to std::err
- */
- virtual void printStackTrace() const;
-
- /**
- * Prints the stack trace to the given output stream.
- * @param stream the target output stream.
- */
- virtual void printStackTrace( std::ostream& stream ) const;
-
- /**
- * Gets the stack trace as one contiguous string.
- * @return string with formatted stack trace data
- */
- virtual std::string getStackTraceString() const;
-
- /**
- * Assignment operator.
- * @param const reference to another Exception
- */
- virtual Exception& operator =( const Exception& ex );
-
- protected:
-
- virtual void buildMessage( const char* format, va_list& vargs );
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_EXCEPTION_EXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/lang/Float.cpp b/src/decaf/src/main/decaf/lang/Float.cpp
deleted file mode 100644
index aa13ade..0000000
--- a/src/decaf/src/main/decaf/lang/Float.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Float.h"
-#include <decaf/lang/Integer.h>
-#include <decaf/internal/util/FloatingPointParser.h>
-#include <decaf/internal/util/NumberConverter.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-const float Float::MAX_VALUE = 3.40282346638528860e+38f;
-const float Float::MIN_VALUE = 1.40129846432481707e-45f;
-const float Float::NaN = 0.0f / 0.0f;
-const float Float::POSITIVE_INFINITY = 1.0f / 0.0f;
-const float Float::NEGATIVE_INFINITY = -1.0f / 0.0f;
-
-////////////////////////////////////////////////////////////////////////////////
-Float::Float( float value ) {
- this->value = value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Float::Float( double value ) {
- this->value = (float)value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Float::Float( const std::string& value ) throw( exceptions::NumberFormatException ) {
- this->value = Float::parseFloat( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Float::compareTo( const Float& f ) const {
- return Float::compare( this->value, f.value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Float::compareTo( const float& f ) const {
- return Float::compare( this->value, f );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Float::toString() const {
- return Float::toString( this->value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Float::isInfinite() const {
- return Float::isInfinite( this->value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Float::isNaN() const {
- return Float::isNaN( this->value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Float::compare( float f1, float f2 ) {
-
- int i1, i2 = 0;
- long NaNbits = Float::floatToIntBits( Float::NaN );
-
- if( ( i1 = Float::floatToIntBits( f1 ) ) == NaNbits ) {
- if( Float::floatToIntBits( f2 ) == NaNbits ) {
- return 0;
- }
- return 1;
- }
-
- if( ( i2 = Float::floatToIntBits( f2 ) ) == NaNbits ) {
- return -1;
- }
-
- if( f1 == f2 ) {
- if( i1 == i2 ) {
- return 0;
- }
-
- // check for -0
- return i1 > i2 ? 1 : -1;
- }
-
- return f1 > f2 ? 1 : -1;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Float::floatToIntBits( float value ) {
-
- int intValue = 0;
- memcpy( &intValue, &value, sizeof( float ) );
-
- if( ( intValue & SINGLE_EXPONENT_MASK ) == SINGLE_EXPONENT_MASK )
- {
- if( intValue & SINGLE_MANTISSA_MASK )
- {
- return SINGLE_NAN_BITS;
- }
- }
-
- return intValue;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Float::floatToRawIntBits( float value ) {
-
- int intValue = 0;
- memcpy( &intValue, &value, sizeof( float ) );
- return intValue;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-float Float::intBitsToFloat( int bits ) {
-
- float floatValue = 0;
- memcpy( &floatValue, &bits, sizeof( int ) );
- return floatValue;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Float::isInfinite( float value ) {
- return ( value == POSITIVE_INFINITY ) || ( value == NEGATIVE_INFINITY );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Float::isNaN( float value ) {
- return value != value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-float Float::parseFloat( const std::string& value )
- throw ( exceptions::NumberFormatException ) {
-
- return internal::util::FloatingPointParser::parseFloat( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Float::toHexString( float value ) {
- /*
- * Reference: http://en.wikipedia.org/wiki/IEEE_754
- */
- if( value != value ) {
- return "NaN";
- }
- if( value == POSITIVE_INFINITY ) {
- return "Infinity";
- }
- if( value == NEGATIVE_INFINITY ) {
- return "-Infinity";
- }
-
- unsigned int bitValue = Float::floatToIntBits( value );
-
- bool negative = ( bitValue & 0x80000000 ) != 0;
- // mask exponent bits and shift down
- unsigned int exponent = ( bitValue & 0x7f800000 ) >> 23;
- // mask significand bits and shift up
- // significand is 23-bits, so we shift to treat it like 24-bits
- unsigned int significand = ( bitValue & 0x007FFFFF ) << 1;
-
- if( exponent == 0 && significand == 0 ) {
- return ( negative ? "-0x0.0p0" : "0x0.0p0" );
- }
-
- // Start with the correct sign and Hex indicator
- std::string hexString( negative ? "-0x" : "0x" );
-
- if( exponent == 0 ) {
- // denormal (subnormal) value
- hexString.append( "0." );
- // significand is 23-bits, so there can be 6 hex digits
- unsigned int fractionDigits = 6;
- // remove trailing hex zeros, so Integer.toHexString() won't print
- // them
- while( ( significand != 0 ) && ( ( significand & 0xF ) == 0 ) ) {
- significand >>= 4;
- fractionDigits--;
- }
- // this assumes Integer.toHexString() returns lowercase characters
- std::string hexSignificand = Integer::toHexString( significand );
-
- // if there are digits left, then insert some '0' chars first
- if( significand != 0 && fractionDigits > hexSignificand.length() ) {
- unsigned int digitDiff = fractionDigits - hexSignificand.length();
- while( digitDiff-- != 0 ) {
- hexString.append( "0" );
- }
- }
- hexString.append( hexSignificand );
- hexString.append( "p-126" );
- } else {
- // normal value
- hexString.append( "1." );
- // significand is 23-bits, so there can be 6 hex digits
- unsigned int fractionDigits = 6;
- // remove trailing hex zeros, so Integer.toHexString() won't print
- // them
- while( (significand != 0) && ((significand & 0xF ) == 0 ) ) {
- significand >>= 4;
- fractionDigits--;
- }
- // this assumes Integer.toHexString() returns lowercase characters
- std::string hexSignificand = Integer::toHexString( significand );
-
- // if there are digits left, then insert some '0' chars first
- if( significand != 0 && fractionDigits > hexSignificand.length() ) {
- unsigned int digitDiff = fractionDigits - hexSignificand.length();
- while( digitDiff-- != 0 ) {
- hexString.append( "0" );
- }
- }
- hexString.append( hexSignificand );
- hexString.append( "p" );
- // remove exponent's 'bias' and convert to a string
- hexString.append( Integer::toString( exponent - 127 ) );
- }
-
- return hexString;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Float::toString( float value ) {
- return internal::util::NumberConverter::convert( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Float Float::valueOf( float value ) {
- return Float( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Float Float::valueOf( const std::string& value )
- throw ( exceptions::NumberFormatException ) {
-
- return valueOf( parseFloat( value ) );
-}
diff --git a/src/decaf/src/main/decaf/lang/Float.h b/src/decaf/src/main/decaf/lang/Float.h
deleted file mode 100644
index 0abd8ed..0000000
--- a/src/decaf/src/main/decaf/lang/Float.h
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_FLOAT_H_
-#define _DECAF_LANG_FLOAT_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/lang/Number.h>
-#include <decaf/lang/Comparable.h>
-#include <decaf/lang/exceptions/NumberFormatException.h>
-#include <string>
-
-namespace decaf{
-namespace lang{
-
- class DECAF_API Float : public Number,
- public Comparable<Float>,
- public Comparable<float> {
- private:
-
- float value;
-
- public:
-
- /** The size in bits of the primitive int type */
- static const int SIZE = 32;
-
- /** The maximum value that the primitive type can hold */
- static const float MAX_VALUE;
-
- /** The minimum value that the primitive type can hold */
- static const float MIN_VALUE;
-
- /** Constant for the Not a Number Value */
- static const float NaN;
-
- /** Constant for Positive Infinity */
- static const float POSITIVE_INFINITY;
-
- /** Constant for Negative Infinitiy */
- static const float NEGATIVE_INFINITY;
-
- public:
-
- /**
- * @param value - the primitve type to wrap
- */
- Float( float value );
-
- /**
- * @param value - the primitve type to wrap
- */
- Float( double value );
-
- /**
- * @param value - the string to convert to a primitve type to wrap
- */
- Float( const std::string& value ) throw( exceptions::NumberFormatException );
-
- virtual ~Float() {}
-
- /**
- * Compares this Float instance with another.
- * @param f - the Float instance to be compared
- * @return zero if this object represents the same integer value as the
- * argument; a positive value if this object represents a value greater
- * than the passed in value, and -1 if this object repesents a value
- * less than the passed in value.
- */
- virtual int compareTo( const Float& f ) const;
-
- /**
- * @param f - the Float object to compare against.
- * @returns true if the two Float Objects have the same value.
- */
- bool equals( const Float& f ) const {
- return this->value == f.value;
- }
-
- /**
- * Compares equality between this object and the one passed.
- * @param f - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const Float& f ) const {
- return this->value == f.value;
- }
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param f - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const Float& f ) const {
- return this->value < f.value;
- }
-
- /**
- * Compares this Float instance with another.
- * @param f - the Float instance to be compared
- * @return zero if this object represents the same integer value as the
- * argument; a positive value if this object represents a value greater
- * than the passed in value, and -1 if this object repesents a value
- * less than the passed in value.
- */
- virtual int compareTo( const float& f ) const;
-
- /**
- * @param f - the Float object to compare against.
- * @returns true if the two Float Objects have the same value.
- */
- bool equals( const float& f ) const {
- return this->value == f;
- }
-
- /**
- * Compares equality between this object and the one passed.
- * @param f - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const float& f ) const {
- return this->value == f;
- }
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param f - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const float& f ) const {
- return this->value < f;
- }
-
- /**
- * @returns this Float Object as a String Representation
- */
- std::string toString() const;
-
- /**
- * Answers the double value which the receiver represents
- * @return double the value of the receiver.
- */
- virtual double doubleValue() const {
- return (double)this->value;
- }
-
- /**
- * Answers the float value which the receiver represents
- * @return float the value of the receiver.
- */
- virtual float floatValue() const {
- return this->value;
- }
-
- /**
- * Answers the byte value which the receiver represents
- * @return byte the value of the receiver.
- */
- virtual unsigned char byteValue() const {
- return (unsigned char)this->value;
- }
-
- /**
- * Answers the short value which the receiver represents
- * @return short the value of the receiver.
- */
- virtual short shortValue() const {
- return (short)this->value;
- }
-
- /**
- * Answers the int value which the receiver represents
- * @return int the value of the receiver.
- */
- virtual int intValue() const {
- return (int)this->value;
- }
-
- /**
- * Answers the long value which the receiver represents
- * @return long the value of the receiver.
- */
- virtual long long longValue() const {
- return (long long)this->value;
- }
-
- /**
- * @returns true if the float is equal to positive infinity.
- */
- bool isInfinite() const;
-
- /**
- * @returns true if the float is equal to NaN.
- */
- bool isNaN() const;
-
- public: // Statics
-
- /**
- * Compares the two specified double values. The sign of the integer value
- * returned is the same as that of the integer that would be returned by the
- * call: Float( f1 ).compareTo( Float( f2) )
- * @param f1 - the first double to compare
- * @param f2 - the second double to compare
- * @returns the value 0 if d1 is numerically equal to f2; a value less than
- * 0 if f1 is numerically less than f2; and a value greater than 0 if f1 is
- * numerically greater than f2.
- */
- static int compare( float f1, float f2 );
-
- /**
- * Returns a representation of the specified floating-point value according
- * to the IEEE 754 floating-point "single format" bit layout.
- *
- * Bit 31 (the bit that is selected by the mask 0x80000000) represents the
- * sign of the floating-point number. Bits 30-23 (the bits that are selected
- * by the mask 0x7f800000) represent the exponent. Bits 22-0 (the bits that
- * are selected by the mask 0x007fffff) represent the significand (sometimes
- * called the mantissa) of the floating-point number.
- *
- * If the argument is positive infinity, the result is 0x7f800000.
- * If the argument is negative infinity, the result is 0xff800000.
- * If the argument is NaN, the result is 0x7fc00000.
- *
- * In all cases, the result is an integer that, when given to the
- * intBitsToFloat(int) method, will produce a floating-point value the
- * same as the argument to floatToIntBits (except all NaN values are
- * collapsed to a single "canonical" NaN value).
- * @param value - the float to convert to int bits
- * @returns the int that holds the float's value
- */
- static int floatToIntBits( float value );
-
- /**
- * Returns a representation of the specified floating-point value according
- * to the IEEE 754 floating-point "single format" bit layout, preserving
- * Not-a-Number (NaN) values.
- *
- * Bit 31 (the bit that is selected by the mask 0x80000000) represents the
- * sign of the floating-point number. Bits 30-23 (the bits that are selected
- * by the mask 0x7f800000) represent the exponent. Bits 22-0 (the bits that
- * are selected by the mask 0x007fffff) represent the significand (sometimes
- * called the mantissa) of the floating-point number.
- *
- * If the argument is positive infinity, the result is 0x7f800000.
- * If the argument is negative infinity, the result is 0xff800000.
- * If the argument is NaN, the result is the integer representing the
- * actual NaN value. Unlike the floatToIntBits method, intToRawIntBits
- * does not collapse all the bit patterns encoding a NaN to a single
- * "canonical" NaN value.
- *
- * In all cases, the result is an integer that, when given to the
- * intBitsToFloat(int) method, will produce a floating-point value the same
- * as the argument to floatToRawIntBits.
- * @param the float to convert to a raw int
- * @returns the raw int value of the float
- */
- static int floatToRawIntBits( float value );
-
- /**
- * Returns the float value corresponding to a given bit representation. The
- * argument is considered to be a representation of a floating-point value
- * according to the IEEE 754 floating-point "single format" bit layout.
- *
- * If the argument is 0x7f800000, the result is positive infinity.
- * If the argument is 0xff800000, the result is negative infinity.
- * If the argument is any value in the range 0x7f800001 through 0x7fffffff
- * or in the range 0xff800001 through 0xffffffff, the result is a NaN. No
- * IEEE 754 floating-point operation provided by C++ can distinguish
- * between two NaN values of the same type with different bit patterns.
- * Distinct values of NaN are only distinguishable by use of the
- * Float::floatToRawIntBits method.
- *
- * @param bits - the bits of the float encoded as a float
- * @return a new float created from the int bits.
- */
- static float intBitsToFloat( int bits );
-
- /**
- * @param value - The float to check.
- * @returns true if the float is equal to infinity.
- */
- static bool isInfinite( float value );
-
- /**
- * @param value - The float to check.
- * @returns true if the float is equal to NaN.
- */
- static bool isNaN( float value );
-
- /**
- * Returns a new float initialized to the value represented by the
- * specified string, as performed by the valueOf method of class Float.
- * @param value - the string to parse
- * @returns a float parsed from the string
- * @throw NumberFormatException
- */
- static float parseFloat( const std::string& value )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Returns a hexadecimal string representation of the float argument. All
- * characters mentioned below are ASCII characters.
- *
- * * If the argument is NaN, the result is the string "NaN".
- * * Otherwise, the result is a string that represents the sign and magnitude
- * (absolute value) of the argument. If the sign is negative, the first
- * character of the result is '-'; if the sign is positive, no sign
- * character appears in the result. As for the magnitude m:
- * o If m is infinity, it is represented by the string "Infinity"; thus,
- * positive infinity produces the result "Infinity" and negative
- * infinity produces the result "-Infinity".
- * o If m is zero, it is represented by the string "0x0.0p0"; thus,
- * negative zero produces the result "-0x0.0p0" and positive zero
- * produces the result "0x0.0p0".
- * o If m is a float value with a normalized representation, substrings
- * are used to represent the significand and exponent fields. The
- * significand is represented by the characters "0x1." followed by a
- * lowercase hexadecimal representation of the rest of the
- * significand as a fraction. Trailing zeros in the hexadecimal
- * representation are removed unless all the digits are zero, in which
- * case a single zero is used. Next, the exponent is represented by
- * "p" followed by a decimal string of the unbiased exponent as if
- * produced by a call to Integer.toString on the exponent value.
- * o If m is a float value with a subnormal representation, the
- * significand is represented by the characters "0x0." followed by a
- * hexadecimal representation of the rest of the significand as a
- * fraction. Trailing zeros in the hexadecimal representation are
- * removed. Next, the exponent is represented by "p-126". Note that
- * there must be at least one nonzero digit in a subnormal significand.
- *
- * @param value - The float to convert to a string
- * @returns the Hex formatted float string.
- */
- static std::string toHexString( float value );
-
- /**
- * Returns a string representation of the float argument. All characters
- * mentioned below are ASCII characters.
- *
- * If the argument is NaN, the result is the string "NaN".
- * Otherwise, the result is a string that represents the sign and magnitude
- * (absolute value) of the argument. If the sign is negative, the first
- * character of the result is '-'; if the sign is positive, no
- * sign character appears in the result. As for the magnitude m:
- * o If m is infinity, it is represented by the characters "Infinity"; thus,
- * positive infinity produces the result "Infinity" and negative infinity
- * produces the result "-Infinity".
- * o If m is zero, it is represented by the characters "0.0"; thus, negative
- * zero produces the result "-0.0" and positive zero produces the result
- * "0.0".
- * o If m is greater than or equal to 10-3 but less than 107, then it is
- * represented as the integer part of m, in decimal form with no leading
- * zeroes, followed by '.', followed by one or more decimal digits
- * representing the fractional part of m.
- * o If m is less than 10-3 or greater than or equal to 107, then it is
- * represented in so-called "computerized scientific notation." Let n be
- * the unique integer such that 10n <= m < 10n+1; then let a be the
- * mathematically exact quotient of m and 10n so that 1 <= a < 10.
- * The magnitude is then represented as the integer part of a, as a
- * single decimal digit, followed by '.', followed by decimal digits
- * representing the fractional part of a, followed by the letter 'E',
- * followed by a representation of n as a decimal integer, as produced
- * by the method Integer.toString(int).
- * @param value - The float to convert to a string
- * @returns the formatted float string.
- */
- static std::string toString( float value );
-
- /**
- * Returns a Float instance representing the specified float value.
- * @param value - float to wrap
- * @returns new Float instance wrapping the primitive value
- */
- static Float valueOf( float value );
-
- /**
- * Returns a Float instance that wraps a primtive float which is parsed
- * from the string value passed.
- *
- * @param value - the string to parse
- * @returns a new Float instance wrapping the float parsed from value
- * @throws NumberFormatException on error.
- */
- static Float valueOf( const std::string& value )
- throw ( exceptions::NumberFormatException );
-
- private:
-
- static const unsigned int SINGLE_EXPONENT_MASK = 0x7F800000;
- static const unsigned int SINGLE_MANTISSA_MASK = 0x007FFFFF;
- static const unsigned int SINGLE_NAN_BITS = (SINGLE_EXPONENT_MASK | 0x00400000);
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_FLOAT_H_*/
diff --git a/src/decaf/src/main/decaf/lang/Integer.cpp b/src/decaf/src/main/decaf/lang/Integer.cpp
deleted file mode 100644
index 439d2b0..0000000
--- a/src/decaf/src/main/decaf/lang/Integer.cpp
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <decaf/lang/Integer.h>
-#include <decaf/lang/Character.h>
-#include <sstream>
-
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-Integer::Integer( int value ) {
- this->value = value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Integer::Integer( const std::string& value ) throw( exceptions::NumberFormatException ) {
- this->value = parseInt( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Integer::compareTo( const Integer& i ) const {
- return this->value < i.value ? -1 : this->value == i.value ? 0 : 1;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Integer::compareTo( const int& i ) const {
- return this->value < i ? -1 : this->value == i ? 0 : 1;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Integer::bitCount( int value ) {
-
- if( value == 0 ) {
- return 0;
- }
-
- unsigned int uvalue = (unsigned int)value;
-
- // 32-bit recursive reduction using SWAR...
- // but first step is mapping 2-bit values
- // into sum of 2 1-bit values in sneaky way
- uvalue -= ((uvalue >> 1) & 0x55555555);
- uvalue = (((uvalue >> 2) & 0x33333333) + (uvalue & 0x33333333));
- uvalue = (((uvalue >> 4) + uvalue) & 0x0F0F0F0F);
- uvalue += (uvalue >> 8);
- uvalue += (uvalue >> 16);
- return(uvalue & 0x0000003F);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Integer::reverseBytes( int value ) {
-
- if( value == 0 ) {
- return 0;
- }
-
- unsigned int uvalue = (unsigned int)value;
-
- unsigned int b3 = uvalue >> 24;
- unsigned int b2 = (uvalue >> 8) & 0xFF00;
- unsigned int b1 = (uvalue & 0xFF00) << 8;
- unsigned int b0 = uvalue << 24;
- return (b0 | b1 | b2 | b3);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Integer::reverse( int value ) {
-
- if( value == 0 ) {
- return 0;
- }
-
- unsigned int uvalue = (unsigned int)value;
-
- uvalue = (((uvalue & 0xAAAAAAAA) >> 1) | ((uvalue & 0x55555555) << 1));
- uvalue = (((uvalue & 0xCCCCCCCC) >> 2) | ((uvalue & 0x33333333) << 2));
- uvalue = (((uvalue & 0xF0F0F0F0) >> 4) | ((uvalue & 0x0F0F0F0F) << 4));
- uvalue = (((uvalue & 0xFF00FF00) >> 8) | ((uvalue & 0x00FF00FF) << 8));
- return ((uvalue >> 16) | (uvalue << 16));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Integer::toString() const {
- return Integer::toString( this->value, 10 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Integer::toString( int value ) {
- return Integer::toString( value, 10 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Integer::toString( int value, int radix ) {
-
- if( radix < Character::MIN_RADIX || radix > Character::MAX_RADIX ) {
- radix = 10;
- }
-
- if( value == 0 ) {
- return "0";
- }
-
- int count = 2, j = value;
- bool negative = value < 0;
- if( !negative ) {
- count = 1;
- j = -value;
- }
-
- while( (value /= radix) != 0 ) {
- count++;
- }
-
- // Save length and allocate a new buffer for the string, add one
- // more for the null character.
- int length = count;
- char* buffer = new char[length + 1];
-
- do {
- int ch = 0 - ( j % radix );
- if( ch > 9 ) {
- ch = ch - 10 + 'a';
- } else {
- ch += '0';
- }
- buffer[--count] = (char)ch;
- } while( (j /= radix) != 0 );
-
- if( negative ) {
- buffer[0] = '-';
- }
-
- // Ensure there's a null
- buffer[length] = 0;
- std::string result( &buffer[0] );
- delete [] buffer;
-
- return result;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Integer::toBinaryString( int value ) {
-
- int count = 1;
- int j = value;
-
- if( value < 0 ) {
- count = 32;
- } else {
- while ( (j >>= 1) != 0) {
- count++;
- }
- }
-
- // Save length and allocate a new buffer for the string, add one
- // more for the null character.
- int length = count;
- char* buffer = new char[length + 1];
-
- do {
- buffer[--count] = (char)( (value & 1) + '0' );
- value >>= 1;
- } while( count > 0 );
-
- // Ensure there's a null
- buffer[length] = 0;
- std::string result( &buffer[0] );
- delete [] buffer;
-
- return result;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Integer::toOctalString( int value ) {
-
- int count = 1, j = value;
-
- if( value < 0 ) {
- count = 11;
- } else {
- while ( (j >>= 3) != 0 ) {
- count++;
- }
- }
-
- // Save length and allocate a new buffer for the string, add one
- // more for the null character.
- int length = count;
- char* buffer = new char[length + 1];
-
- do {
- buffer[--count] = (char)( (value & 7) + '0' );
- value >>= 3;
- } while( count > 0 );
-
- // Ensure there's a null
- buffer[length] = 0;
- std::string result( &buffer[0] );
- delete [] buffer;
-
- return result;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Integer::toHexString( int value ) {
-
- int count = 1;
- int j = value;
-
- if( value < 0 ) {
- count = 8;
- } else {
- while( (j >>= 4) != 0 ) {
- count++;
- }
- }
-
- // Save length and allocate a new buffer for the string, add one
- // more for the null character.
- int length = count;
- char* buffer = new char[length + 1];
-
- do {
- int t = value & 15;
- if( t > 9 ) {
- t = t - 10 + 'a';
- } else {
- t += '0';
- }
- buffer[--count] = (char)t;
- value >>= 4;
- } while( count > 0 );
-
- // Ensure there's a null
- buffer[length] = 0;
- std::string result( &buffer[0] );
- delete [] buffer;
-
- return result;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Integer::parseInt( const std::string& value )
- throw ( exceptions::NumberFormatException ) {
-
- return Integer::parseInt( value, 10 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Integer::parseInt( const std::string& value, int radix )
- throw ( exceptions::NumberFormatException ) {
-
- if( radix < Character::MIN_RADIX ||
- radix > Character::MAX_RADIX ) {
- throw NumberFormatException(
- __FILE__, __LINE__,
- "Integer:decode - Invalid radix" );
- }
-
- int length = value.length(), i = 0;
- if( length == 0 ) {
- throw NumberFormatException(
- __FILE__, __LINE__,
- "Integer:decode - Invalid: zero length string");
- }
-
- bool negative = value[i] == '-';
- if( negative && ++i == length ) {
- throw NumberFormatException(
- __FILE__, __LINE__,
- "Integer:decode - Invalid only a minus sign given");
- }
-
- return Integer::parse( value, i, radix, negative );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Integer Integer::valueOf( const std::string& value )
- throw ( exceptions::NumberFormatException ) {
-
- return Integer( Integer::parseInt( value ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Integer Integer::valueOf( const std::string& value, int radix )
- throw ( exceptions::NumberFormatException ) {
-
- return Integer( Integer::parseInt( value, radix ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Integer Integer::decode( const std::string& value )
- throw ( exceptions::NumberFormatException ) {
-
- int length = value.length(), i = 0;
- if( length == 0 ) {
- throw NumberFormatException(
- __FILE__, __LINE__,
- "Integer:decode - Invalid zero size string");
- }
-
- char firstDigit = value[i];
- bool negative = firstDigit == '-';
- if( negative ) {
- if( length == 1 ) {
- throw NumberFormatException(
- __FILE__, __LINE__,
- "Integer:decode - Invalid zero string, minus only");
- }
-
- firstDigit = value[++i];
- }
-
- int base = 10;
- if( firstDigit == '0' ) {
- if( ++i == length ) {
- return valueOf( 0 );
- }
-
- if( ( firstDigit = value[i] ) == 'x' || firstDigit == 'X' ) {
- if( i == length ) {
- throw NumberFormatException(
- __FILE__, __LINE__,
- "Integer:decode - Invalid zero string, minus only");
- }
- i++;
- base = 16;
- } else {
- base = 8;
- }
- } else if( firstDigit == '#' ) {
- if( i == length ) {
- throw NumberFormatException(
- __FILE__, __LINE__,
- "Integer:decode - Invalid zero string, minus only");
- }
- i++;
- base = 16;
- }
-
- int result = parse( value, i, base, negative );
- return valueOf( result );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Integer::parse( const std::string& value, int offset,
- int radix, bool negative )
- throw ( exceptions::NumberFormatException ) {
-
- int max = Integer::MIN_VALUE / radix;
- int result = 0, length = value.size();
-
- while( offset < length ) {
- int digit = Character::digit( value[offset++], radix );
- if( digit == -1 ) {
- throw NumberFormatException(
- __FILE__, __LINE__,
- "Integer::parse - number string is invalid: ",
- value.c_str() );
- }
- if( max > result ) {
- throw NumberFormatException(
- __FILE__, __LINE__,
- "Integer::parse - number string is invalid: ",
- value.c_str() );
- }
- int next = result * radix - digit;
- if( next > result ) {
- throw NumberFormatException(
- __FILE__, __LINE__,
- "Integer::parse - number string is invalid: ",
- value.c_str() );
- }
- result = next;
- }
- if( !negative ) {
- result = -result;
- if( result < 0 ) {
- throw NumberFormatException(
- __FILE__, __LINE__,
- "Integer::parse - number string is invalid: ",
- value.c_str() );
- }
- }
- return result;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Integer::highestOneBit( int value ) {
-
- if( value == 0 ) {
- return 0;
- }
-
- unsigned int uvalue = (unsigned int)value;
-
- uvalue |= (uvalue >> 1);
- uvalue |= (uvalue >> 2);
- uvalue |= (uvalue >> 4);
- uvalue |= (uvalue >> 8);
- uvalue |= (uvalue >> 16);
- return ( uvalue & ~(uvalue >> 1));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Integer::lowestOneBit( int value ) {
- if( value == 0 ) {
- return 0;
- }
-
- unsigned int uvalue = (unsigned int)value;
- return ( uvalue & (-uvalue) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Integer::numberOfLeadingZeros( int value ) {
-
- if( value == 0 ) {
- return 0;
- }
-
- unsigned int uvalue = (unsigned int)value;
-
- value |= value >> 1;
- value |= value >> 2;
- value |= value >> 4;
- value |= value >> 8;
- value |= value >> 16;
- return Integer::bitCount( ~uvalue );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Integer::numberOfTrailingZeros( int value ) {
- if( value == 0 ) {
- return 0;
- }
-
- unsigned int uvalue = (unsigned int)value;
- return bitCount( (uvalue & -uvalue) - 1 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Integer::rotateLeft( int value, int distance ) {
- unsigned int i = (unsigned int)value;
- int j = distance & 0x1F;
- return ( i << j ) | ( i >> (-j & 0x1F ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Integer::rotateRight( int value, int distance ) {
- unsigned int i = (unsigned int)value;
- int j = distance & 0x1F;
- return ( i >> j ) | ( i << (-j & 0x1F ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Integer::signum( int value ) {
- return ( value == 0 ? 0 : ( value < 0 ? -1 : 1 ) );
-}
diff --git a/src/decaf/src/main/decaf/lang/Integer.h b/src/decaf/src/main/decaf/lang/Integer.h
deleted file mode 100644
index 77c8edc..0000000
--- a/src/decaf/src/main/decaf/lang/Integer.h
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_INTEGER_H_
-#define _DECAF_LANG_INTEGER_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/lang/Number.h>
-#include <decaf/lang/Comparable.h>
-#include <string>
-#include <decaf/lang/exceptions/NumberFormatException.h>
-
-namespace decaf{
-namespace lang{
-
- class DECAF_API Integer : public Number,
- public Comparable<Integer>,
- public Comparable<int> {
- private:
-
- // The primitve Integer value.
- int value;
-
- public:
-
- /** The size in bits of the primitive int type */
- static const int SIZE = 32;
-
- /** The maximum value that the primitive type can hold */
- static const int MAX_VALUE = (int)0x7FFFFFFF;
-
- /** The minimum value that the primitive type can hold */
- static const int MIN_VALUE = (int)0x80000000;
-
- public:
-
- /**
- * @param the primitive value to wrap
- */
- Integer( int value );
-
- /**
- * @param the base 10 encoded string to decode to sn int and wrap.
- * @throws NumberFormatException
- */
- Integer( const std::string& value ) throw( exceptions::NumberFormatException );
-
- virtual ~Integer() {}
-
- /**
- * Compares this Integer instance with another.
- * @param i - the Integer instance to be compared
- * @return zero if this object represents the same integer value as the
- * argument; a positive value if this object represents a value greater
- * than the passed in value, and -1 if this object repesents a value
- * less than the passed in value.
- */
- virtual int compareTo( const Integer& i ) const;
-
- /**
- * @param i - the Integer object to compare against.
- * @returns true if the two Integer Objects have the same value.
- */
- bool equals( const Integer& i ) const {
- return this->value == i.value;
- }
-
- /**
- * Compares equality between this object and the one passed.
- * @param i - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const Integer& i ) const {
- return this->value == i.value;
- }
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param i - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const Integer& i ) const {
- return this->value < i.value;
- }
-
- /**
- * Compares this Integer instance with another.
- * @param i - the Integer instance to be compared
- * @return zero if this object represents the same integer value as the
- * argument; a positive value if this object represents a value greater
- * than the passed in value, and -1 if this object repesents a value
- * less than the passed in value.
- */
- virtual int compareTo( const int& i ) const;
-
- /**
- * @param i - the Integer object to compare against.
- * @returns true if the two Integer Objects have the same value.
- */
- bool equals( const int& i ) const {
- return this->value == i;
- }
-
- /**
- * Compares equality between this object and the one passed.
- * @param i - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const int& i ) const {
- return this->value == i;
- }
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param i - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const int& i ) const {
- return this->value < i;
- }
-
- /**
- * @returns this Interger Object as a String Representation
- */
- std::string toString() const;
-
- /**
- * Answers the double value which the receiver represents
- * @return double the value of the receiver.
- */
- virtual double doubleValue() const {
- return (double)this->value;
- }
-
- /**
- * Answers the float value which the receiver represents
- * @return float the value of the receiver.
- */
- virtual float floatValue() const {
- return (float)this->value;
- }
-
- /**
- * Answers the byte value which the receiver represents
- * @return int the value of the receiver.
- */
- virtual unsigned char byteValue() const {
- return (unsigned char)this->value;
- }
-
- /**
- * Answers the short value which the receiver represents
- * @return int the value of the receiver.
- */
- virtual short shortValue() const {
- return (short)this->value;
- }
-
- /**
- * Answers the int value which the receiver represents
- * @return int the value of the receiver.
- */
- virtual int intValue() const {
- return this->value;
- }
-
- /**
- * Answers the long value which the receiver represents
- * @return long the value of the receiver.
- */
- virtual long long longValue() const {
- return (long long)this->value;
- }
-
- public: // Statics
-
- /**
- * Decodes a String into a Integer. Accepts decimal, hexadecimal, and octal
- * numbers given by the following grammar:
- *
- * The sequence of characters following an (optional) negative sign and/or
- * radix specifier ("0x", "0X", "#", or leading zero) is parsed as by the
- * Integer.parseInteger method with the indicated radix (10, 16, or 8). This
- * sequence of characters must represent a positive value or a
- * NumberFormatException will be thrown. The result is negated if first
- * character of the specified String is the minus sign. No whitespace
- * characters are permitted in the string.
- * @param value - The string to decode
- * @returns a Integer object containing the decoded value
- * @throws NumberFomatException if the string is not formatted correctly.
- */
- static Integer decode( const std::string& value )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Returns the value obtained by reversing the order of the bytes in the
- * two's complement representation of the specified int value.
- * @param value - the int whose bytes we are to reverse
- * @return the reversed int.
- */
- static int reverseBytes( int value );
-
- /**
- * Returns the value obtained by reversing the order of the bits in the
- * two's complement binary representation of the specified int value.
- * @param value - the value whose bits are to be reversed
- * @returns the reversed bits int.
- */
- static int reverse( int value );
-
- /**
- * Parses the string argument as a signed int in the radix specified by
- * the second argument. The characters in the string must all be digits,
- * of the specified radix (as determined by whether
- * Character.digit(char, int) returns a nonnegative value) except that the
- * first character may be an ASCII minus sign '-' to indicate a negative
- * value. The resulting byte value is returned.
- *
- * An exception of type NumberFormatException is thrown if any of the
- * following situations occurs:
- * * The first argument is null or is a string of length zero.
- * * The radix is either smaller than Character.MIN_RADIX or larger than
- * Character.MAX_RADIX.
- * * Any character of the string is not a digit of the specified radix,
- * except that the first character may be a minus sign '-' ('\u002D')
- * provided that the string is longer than length 1.
- * * The value represented by the string is not a value of type int.
- *
- * @param s - the String containing the int representation to be parsed
- * @param radix - the radix to be used while parsing s
- * @return the int represented by the string argument in the specified radix.
- * @throws NumberFormatException - If String does not contain a parsable int.
- */
- static int parseInt( const std::string& s, int radix )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Parses the string argument as a signed decimal int. The characters
- * in the string must all be decimal digits, except that the first
- * character may be an ASCII minus sign '-' ('\u002D') to indicate a
- * negative value. The resulting int value is returned, exactly as if
- * the argument and the radix 10 were given as arguments to the
- * parseInteger( const std::string, int ) method.
- * @param s - String to convert to a int
- * @returns the converted int value
- * @throws NumberFormatException if the string is not a int.
- */
- static int parseInt( const std::string& s )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Returns a Integer instance representing the specified int value.
- * @param value - the int to wrap
- * @return the new Integer object wrapping value.
- */
- static Integer valueOf( int value ) {
- return Integer( value );
- }
-
- /**
- * Returns a Integer object holding the value given by the specified
- * std::string. The argument is interpreted as representing a signed
- * decimal int, exactly as if the argument were given to the
- * parseInt( std::string ) method. The result is a Integer object that
- * represents the int value specified by the string.
- * @param value - std::string to parse as base 10
- * @return new Integer Object wrapping the primitive
- * @throws NumberFormatException if the string is not a decimal int.
- */
- static Integer valueOf( const std::string& value )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Returns a Integer object holding the value extracted from the specified
- * std::string when parsed with the radix given by the second argument.
- * The first argument is interpreted as representing a signed int in the
- * radix specified by the second argument, exactly as if the argument were
- * given to the parseInt( std::string, int ) method. The result is a
- * Integer object that represents the int value specified by the string.
- * @param value - std::string to parse as base ( radix )
- * @param radix - base of the string to parse.
- * @return new Integer Object wrapping the primitive
- * @throws NumberFormatException if the string is not a valid int.
- */
- static Integer valueOf( const std::string& value, int radix )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Returns the number of one-bits in the two's complement binary
- * representation of the specified int value. This function is sometimes
- * referred to as the population count.
- * @param value - the int to count
- * @return the number of one-bits in the two's complement binary
- * representation of the specified int value.
- */
- static int bitCount( int value );
-
- /**
- * Converts the int to a String representation
- * @param int to convert
- * @return string representation
- */
- static std::string toString( int value );
-
- /**
- * Returns a string representation of the first argument in the radix
- * specified by the second argument.
- *
- * If the radix is smaller than Character.MIN_RADIX or larger than
- * Character.MAX_RADIX, then the radix 10 is used instead.
- *
- * If the first argument is negative, the first element of the result is
- * the ASCII minus character '-'. If the first argument is not
- * negative, no sign character appears in the result.
- *
- * The remaining characters of the result represent the magnitude of the
- * first argument. If the magnitude is zero, it is represented by a single
- * zero character '0'; otherwise, the first character of the
- * representation of the magnitude will not be the zero character. The
- * following ASCII characters are used as digits:
- *
- * 0123456789abcdefghijklmnopqrstuvwxyz
- *
- * @param value - the int to convert to a string
- * @param radix - the radix to format the string in
- * @returns an int formatted to the string value of the radix given.
- */
- static std::string toString( int value, int radix );
-
- /**
- * Returns a string representation of the integer argument as an unsigned
- * integer in base 16.
- *
- * The unsigned integer value is the argument plus 2^32 if the argument is
- * negative; otherwise, it is equal to the argument. This value is converted
- * to a string of ASCII digits in hexadecimal (base 16) with no extra leading
- * 0s. If the unsigned magnitude is zero, it is represented by a single zero
- * character '0'; otherwise, the first character of the representation of the
- * unsigned magnitude will not be the zero character. The following characters
- * are used as hexadecimal digits:
- *
- * 0123456789abcdef
- *
- * If uppercase letters are desired, the toUpperCase() method may be called
- * on the result:
- * @param value - the int to be translated to an Octal string
- * @returns the unsigned int value as a Octal string
- */
- static std::string toHexString( int value );
-
- /**
- * Returns a string representation of the integer argument as an unsigned
- * integer in base 8.
- *
- * The unsigned integer value is the argument plus 2^32 if the argument is
- * negative; otherwise, it is equal to the argument. This value is converted
- * to a string of ASCII digits in octal (base 8) with no extra leading 0s.
- *
- * If the unsigned magnitude is zero, it is represented by a single zero
- * character '0'; otherwise, the first character of the representation
- * of the unsigned magnitude will not be the zero character. The following
- * characters are used as octal digits:
- *
- * 01234567
- *
- * @param value - the int to be translated to an Octal string
- * @returns the unsigned int value as a Octal string
- */
- static std::string toOctalString( int value );
-
- /**
- * Returns a string representation of the integer argument as an unsigned
- * integer in base 2.
- *
- * The unsigned integer value is the argument plus 2^32 if the argument is
- * negative; otherwise it is equal to the argument. This value is converted
- * to a string of ASCII digits in binary (base 2) with no extra leading 0s.
- * If the unsigned magnitude is zero, it is represented by a single zero
- * character '0' ('\u0030'); otherwise, the first character of the
- * representation of the unsigned magnitude will not be the zero character.
- * The characters '0' ('\u0030') and '1' ('\u0031') are used as binary
- * digits.
- * @param value - the int to be translated to a binary string
- * @returns the unsigned int value as a binary string
- */
- static std::string toBinaryString( int value );
-
- /**
- * Returns an int value with at most a single one-bit, in the position of
- * the highest-order ("leftmost") one-bit in the specified int value.
- * Returns zero if the specified value has no one-bits in its two's
- * complement binary representation, that is, if it is equal to zero.
- * @param value - the int to be inspected
- * @return an int value with a single one-bit, in the position of the
- * highest-order one-bit in the specified value, or zero if the specified
- * value is itself equal to zero.
- */
- static int highestOneBit( int value );
-
- /**
- * Returns an int value with at most a single one-bit, in the position of
- * the lowest-order ("rightmost") one-bit in the specified int value.
- * Returns zero if the specified value has no one-bits in its two's
- * complement binary representation, that is, if it is equal to zero.
- * @param value - the int to be inspected
- * @return an int value with a single one-bit, in the position of the
- * lowest-order one-bit in the specified value, or zero if the specified
- * value is itself equal to zero.
- */
- static int lowestOneBit( int value );
-
- /**
- * Returns the number of zero bits preceding the highest-order ("leftmost")
- * one-bit in the two's complement binary representation of the specified
- * int value. Returns 32 if the specified value has no one-bits in its two's
- * complement representation, in other words if it is equal to zero.
- *
- * Note that this method is closely related to the logarithm base 2. For
- * all positive int values x:
- *
- * * floor( log2(x)) = 31 - numberOfLeadingZeros(x)
- * * ceil( log2(x)) = 32 - numberOfLeadingZeros(x - 1)
- *
- * @param value - the int to be inspected
- * @return the number of zero bits preceding the highest-order ("leftmost")
- * one-bit in the two's complement binary representation of the specified
- * int value, or 32 if the value is equal to zero.
- */
- static int numberOfLeadingZeros( int value );
-
- /**
- * Returns the number of zero bits following the lowest-order ("rightmost")
- * one-bit in the two's complement binary representation of the specified
- * int value. Returns 32 if the specified value has no one-bits in its
- * two's complement representation, in other words if it is equal to zero.
- * @param value - the int to be inspected
- * @return the number of zero bits following the lowest-order ("rightmost")
- * one-bit in the two's complement binary representation of the specified
- * int value, or 32 if the value is equal to zero.
- */
- static int numberOfTrailingZeros( int value );
-
- /**
- * Returns the value obtained by rotating the two's complement binary
- * representation of the specified int value left by the specified number
- * of bits. (Bits shifted out of the left hand, or high-order, side reenter
- * on the right, or low-order.)
- *
- * Note that left rotation with a negative distance is equivalent to right
- * rotation: rotateLeft(val, -distance) == rotateRight(val, distance). Note
- * also that rotation by any multiple of 32 is a no-op, so all but the last
- * five bits of the rotation distance can be ignored, even if the distance
- * is negative: rotateLeft(val, distance) == rotateLeft(val, distance & 0x1F).
- * @param value - the int to be inspected
- * @param distance - the number of bits to rotate
- * @return the value obtained by rotating the two's complement binary
- * representation of the specified int value left by the specified number
- * of bits.
- */
- static int rotateLeft( int value, int distance );
-
- /**
- * Returns the value obtained by rotating the two's complement binary
- * representation of the specified int value right by the specified number
- * of bits. (Bits shifted out of the right hand, or low-order, side reenter
- * on the left, or high-order.)
- *
- * Note that right rotation with a negative distance is equivalent to left
- * rotation: rotateRight(val, -distance) == rotateLeft(val, distance). Note
- * also that rotation by any multiple of 32 is a no-op, so all but the last
- * five bits of the rotation distance can be ignored, even if the distance is
- * negative: rotateRight(val, distance) == rotateRight(val, distance & 0x1F).
- * @param value - the int to be inspected
- * @param distance - the number of bits to rotate
- * @return the value obtained by rotating the two's complement binary
- * representation of the specified int value right by the specified number
- * of bits.
- */
- static int rotateRight( int value, int distance );
-
- /**
- * Returns the signum function of the specified int value. (The return value
- * is -1 if the specified value is negative; 0 if the specified value is zero;
- * and 1 if the specified value is positive.)
- * @param value - the int to be inspected
- * @return the signum function of the specified int value.
- */
- static int signum( int value );
-
- private:
-
- static int parse( const std::string& value, int offset,
- int radix, bool negative )
- throw ( exceptions::NumberFormatException );
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_INTEGER_H_*/
diff --git a/src/decaf/src/main/decaf/lang/Iterable.h b/src/decaf/src/main/decaf/lang/Iterable.h
deleted file mode 100644
index e602117..0000000
--- a/src/decaf/src/main/decaf/lang/Iterable.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_ITERABLE_H_
-#define _DECAF_LANG_ITERABLE_H_
-
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace lang{
-
- /**
- * Implementing this interface allows an object to be cast to an Iterable
- * type for generic collections API calls.
- */
- template< typename T >
- class DECAF_API Iterable {
- public:
-
- virtual ~Iterable() {}
-
- /**
- * @returns an iterator over a set of elements of type T.
- */
- T iterator() = 0;
- const T iterator() = 0;
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_ITERABLE_H_*/
diff --git a/src/decaf/src/main/decaf/lang/Long.cpp b/src/decaf/src/main/decaf/lang/Long.cpp
deleted file mode 100644
index 0dba951..0000000
--- a/src/decaf/src/main/decaf/lang/Long.cpp
+++ /dev/null
@@ -1,493 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Long.h"
-#include <decaf/lang/Character.h>
-#include <sstream>
-
-using namespace decaf;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-Long::Long( long long value ) {
- this->value = value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Long::Long( const std::string& value ) throw( exceptions::NumberFormatException ) {
- this->value = parseLong( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Long::compareTo( const Long& l ) const {
- return this->value < l.value ? -1 : this->value == l.value ? 0 : 1;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Long::compareTo( const long long& l ) const {
- return this->value < l ? -1 : this->value == l ? 0 : 1;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Long::bitCount( long long value ) {
-
- if( value == 0 ) {
- return 0;
- }
-
- unsigned long long uvalue = (unsigned long long)value;
-
- uvalue = (uvalue & 0x5555555555555555LL) + ((uvalue >> 1) & 0x5555555555555555LL);
- uvalue = (uvalue & 0x3333333333333333LL) + ((uvalue >> 2) & 0x3333333333333333LL);
- // adjust for 64-bit integer
- unsigned int i = (unsigned int)( (uvalue >> 32) + uvalue );
- i = (i & 0x0F0F0F0F) + ((i >> 4) & 0x0F0F0F0F);
- i = (i & 0x00FF00FF) + ((i >> 8) & 0x00FF00FF);
- i = (i & 0x0000FFFF) + ((i >> 16) & 0x0000FFFF);
- return i;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Long Long::decode( const std::string& value )
- throw ( exceptions::NumberFormatException ) {
-
- int length = value.length(), i = 0;
- if( length == 0 ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "Long::decode - Zero length string given." );
- }
-
- char firstDigit = value[i];
- bool negative = firstDigit == '-';
- if( negative ) {
- if( length == 1 ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "Long::decode - Invalid length string given.",
- value.c_str() );
- }
- firstDigit = value[++i];
- }
-
- int base = 10;
- if( firstDigit == '0' ) {
- if( ++i == length ) {
- return valueOf( 0LL );
- }
- if( ( firstDigit = value[i] ) == 'x' || firstDigit == 'X' ) {
- if ( i == length ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "Long::decode - Invalid length string given.",
- value.c_str() );
- }
- i++;
- base = 16;
- } else {
- base = 8;
- }
- } else if( firstDigit == '#' ) {
- if( i == length ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "Long::decode - Invalid length string given.",
- value.c_str() );
- }
- i++;
- base = 16;
- }
-
- long long result = parse( value, i, base, negative );
- return valueOf( result );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long Long::highestOneBit( long long value ) {
-
- if( value == 0 ) {
- return 0;
- }
-
- unsigned long long uvalue = (unsigned long long)value;
-
- uvalue |= (uvalue >> 1);
- uvalue |= (uvalue >> 2);
- uvalue |= (uvalue >> 4);
- uvalue |= (uvalue >> 8);
- uvalue |= (uvalue >> 16);
- uvalue |= (uvalue >> 32);
- return ( uvalue & ~( uvalue >> 1 ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long Long::lowestOneBit( long long value ) {
- if( value == 0 ) {
- return 0;
- }
-
- unsigned long long uvalue = (unsigned long long)value;
- return ( uvalue & (-uvalue) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Long::numberOfLeadingZeros( long long value ) {
-
- if( value == 0 ) {
- return 0;
- }
-
- unsigned long long uvalue = (unsigned long long)value;
-
- value |= value >> 1;
- value |= value >> 2;
- value |= value >> 4;
- value |= value >> 8;
- value |= value >> 16;
- value |= value >> 32;
- return Long::bitCount( ~uvalue );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Long::numberOfTrailingZeros( long long value ) {
- if( value == 0 ) {
- return 0;
- }
-
- unsigned long long uvalue = (unsigned long long)value;
- return Long::bitCount( (uvalue & -uvalue) - 1 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long Long::parseLong( const std::string& value )
- throw ( exceptions::NumberFormatException ) {
-
- return Long::parseLong( value, 10 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long Long::parseLong( const std::string& value, int radix )
- throw ( exceptions::NumberFormatException ) {
-
- if( radix < Character::MIN_RADIX ||
- radix > Character::MAX_RADIX ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "Long::parseLong - Given Radix is out of range." );
- }
-
- int length = value.length();
- int i = 0;
-
- if( length == 0 ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "Long::parseLong - Zero length string is illegal." );
- }
-
- bool negative = value[i] == '-';
- if( negative && ++i == length ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "Long::parseLong - Only a minus given, string is invalid." );
- }
-
- return Long::parse( value, i, radix, negative );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long Long::parse( const std::string& value, int offset,
- int radix, bool negative )
- throw ( exceptions::NumberFormatException ) {
-
- long long max = Long::MIN_VALUE / radix;
- long long result = 0;
- long long length = value.length();
-
- while( offset < length ) {
- int digit = Character::digit( value[offset++], radix );
-
- if( digit == -1 ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "Long::parseLong - String contains no digit characters." );
- }
-
- if( max > result ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "Long::parseLong - Parsed value greater than max for radix." );
- }
-
- long long next = result * radix - digit;
-
- if( next > result ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "Long::parseLong - Only a minus given, string is invalid." );
- }
-
- result = next;
- }
-
- if( !negative ) {
- result = -result;
- if( result < 0 ) {
- throw exceptions::NumberFormatException(
- __FILE__, __LINE__,
- "Long::parseLong - Value less than zero, but no minus sign." );
- }
- }
-
- return result;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long Long::reverseBytes( long long value ) {
-
- if( value == 0 ) {
- return 0;
- }
-
- unsigned long long uvalue = (unsigned long long)value;
-
- long long b7 = (uvalue >> 56);
- long long b6 = (uvalue >> 40) & 0xFF00ULL;
- long long b5 = (uvalue >> 24) & 0xFF0000ULL;
- long long b4 = (uvalue >> 8) & 0xFF000000ULL;
- long long b3 = (uvalue & 0xFF000000ULL) << 8;
- long long b2 = (uvalue & 0xFF0000ULL) << 24;
- long long b1 = (uvalue & 0xFF00ULL) << 40;
- long long b0 = (uvalue << 56);
- return ( b0 | b1 | b2 | b3 | b4 | b5 | b6 | b7 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long Long::reverse( long long value ) {
-
- if( value == 0 ) {
- return 0;
- }
-
- unsigned long long uvalue = (unsigned long long)value;
-
- // From Hacker's Delight, 7-1, Figure 7-1
- uvalue = ( uvalue & 0x5555555555555555ULL ) << 1 | (uvalue >> 1) &
- 0x5555555555555555ULL;
- uvalue = ( uvalue & 0x3333333333333333ULL ) << 2 | (uvalue >> 2) &
- 0x3333333333333333ULL;
- uvalue = ( uvalue & 0x0F0F0F0F0F0F0F0FULL ) << 4 | (uvalue >> 4) &
- 0x0F0F0F0F0F0F0F0FULL;
-
- return reverseBytes( uvalue );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long Long::rotateLeft( long long value, int distance ) {
- unsigned long long i = (unsigned long long)value;
- int j = distance & 0x1F;
- return ( i << j ) | ( i >> (-j & 0x1F ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long Long::rotateRight( long long value, int distance ) {
- unsigned long long i = (unsigned long long)value;
- int j = distance & 0x1F;
- return ( i >> j ) | ( i << (-j & 0x1F ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Long::signum( long long value ) {
- return ( value == 0 ? 0 : ( value < 0 ? -1 : 1 ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Long::toString() const {
- return Long::toString( this->value, 10 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Long::toString( long long value ) {
- return Long::toString( value, 10 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Long::toString( long long value, int radix ) {
-
- if( radix < Character::MIN_RADIX || radix > Character::MAX_RADIX ) {
- radix = 10;
- }
-
- if( value == 0 ) {
- return "0";
- }
-
- int count = 2;
- long long j = value;
- bool negative = value < 0;
-
- if( !negative ) {
- count = 1;
- j = -value;
- }
-
- while( (value /= radix) != 0 ) {
- count++;
- }
-
- // Save length and allocate a new buffer for the string, add one
- // more for the null character.
- int length = count;
- char* buffer = new char[length + 1];
-
- do {
- int ch = 0 - ( j % radix );
- if( ch > 9 ) {
- ch = ch - 10 + 'a';
- } else {
- ch += '0';
- }
- buffer[--count] = (char)ch;
- } while( (j /= radix) != 0 );
-
- if( negative ) {
- buffer[0] = '-';
- }
-
- // Ensure there's a null
- buffer[length] = 0;
- std::string result( &buffer[0] );
- delete [] buffer;
-
- return result;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Long::toBinaryString( long long value ) {
-
- int count = 1;
- long long j = value;
-
- if( value < 0 ) {
- count = 32;
- } else {
- while ( (j >>= 1) != 0) {
- count++;
- }
- }
-
- // Save length and allocate a new buffer for the string, add one
- // more for the null character.
- int length = count;
- char* buffer = new char[length + 1];
-
- do {
- buffer[--count] = (char)( (value & 1) + '0' );
- value >>= 1;
- } while( count > 0 );
-
- // Ensure there's a null
- buffer[length] = 0;
- std::string result( &buffer[0] );
- delete [] buffer;
-
- return result;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Long::toOctalString( long long value ) {
-
- int count = 1;
- long long j = value;
-
- if( value < 0 ) {
- count = 11;
- } else {
- while ( (j >>= 3) != 0 ) {
- count++;
- }
- }
-
- // Save length and allocate a new buffer for the string, add one
- // more for the null character.
- int length = count;
- char* buffer = new char[length + 1];
-
- do {
- buffer[--count] = (char)( (value & 7) + '0' );
- value >>= 3;
- } while( count > 0 );
-
- // Ensure there's a null
- buffer[length] = 0;
- std::string result( &buffer[0] );
- delete [] buffer;
-
- return result;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Long::toHexString( long long value ) {
-
- int count = 1;
- long long j = value;
-
- if( value < 0 ) {
- count = 8;
- } else {
- while( (j >>= 4) != 0 ) {
- count++;
- }
- }
-
- // Save length and allocate a new buffer for the string, add one
- // more for the null character.
- int length = count;
- char* buffer = new char[length + 1];
-
- do {
- int t = value & 15;
- if( t > 9 ) {
- t = t - 10 + 'a';
- } else {
- t += '0';
- }
- buffer[--count] = (char)t;
- value >>= 4;
- } while( count > 0 );
-
- // Ensure there's a null
- buffer[length] = 0;
- std::string result( &buffer[0] );
- delete [] buffer;
-
- return result;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Long Long::valueOf( const std::string& value )
- throw ( exceptions::NumberFormatException ) {
-
- return Long( Long::parseLong( value ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Long Long::valueOf( const std::string& value, int radix )
- throw ( exceptions::NumberFormatException ) {
-
- return Long( Long::parseLong( value, radix ) );
-}
diff --git a/src/decaf/src/main/decaf/lang/Long.h b/src/decaf/src/main/decaf/lang/Long.h
deleted file mode 100644
index a715cd1..0000000
--- a/src/decaf/src/main/decaf/lang/Long.h
+++ /dev/null
@@ -1,506 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_LONG_H_
-#define _DECAF_LANG_LONG_H_
-
-#include <decaf/lang/Number.h>
-#include <decaf/lang/Comparable.h>
-#include <decaf/lang/exceptions/NumberFormatException.h>
-#include <string>
-
-namespace decaf{
-namespace lang{
-
- class DECAF_API Long : public Number,
- public Comparable<Long>,
- public Comparable<long long> {
- private:
-
- // The primitive long long value
- long long value;
-
- public:
-
- /** The size in bits of the primitive long long type */
- static const int SIZE = 64;
-
- /** The maximum value that the primitive type can hold */
- static const long long MAX_VALUE = (long long)0x7FFFFFFFFFFFFFFFLL;
-
- /** The minimum value that the primitive type can hold */
- static const long long MIN_VALUE = (long long)0x8000000000000000LL;
-
- public:
-
- /**
- * @param value - the primitive long long to wrap
- */
- Long( long long value );
-
- /**
- * @param value - the long long formated string to wrap
- * @thorw NumberFormatException
- */
- Long( const std::string& value ) throw( exceptions::NumberFormatException );
-
- virtual ~Long() {}
-
- /**
- * Compares this Long instance with another.
- * @param l - the Long instance to be compared
- * @return zero if this object represents the same integer value as the
- * argument; a positive value if this object represents a value greater
- * than the passed in value, and -1 if this object repesents a value
- * less than the passed in value.
- */
- virtual int compareTo( const Long& l ) const;
-
- /**
- * @param l - the Long object to compare against.
- * @returns true if the two Integer Objects have the same value.
- */
- bool equals( const Long& l ) const {
- return this->value == l.value;
- }
-
- /**
- * Compares equality between this object and the one passed.
- * @param l - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const Long& l ) const {
- return this->value == l.value;
- }
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param l - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const Long& l ) const {
- return this->value < l.value;
- }
-
- /**
- * Compares this Long instance with another.
- * @param l - the Integer instance to be compared
- * @return zero if this object represents the same integer value as the
- * argument; a positive value if this object represents a value greater
- * than the passed in value, and -1 if this object repesents a value
- * less than the passed in value.
- */
- virtual int compareTo( const long long& l ) const;
-
- /**
- * @param l - the Long object to compare against.
- * @returns true if the two Integer Objects have the same value.
- */
- bool equals( const long long& l ) const {
- return this->value == l;
- }
-
- /**
- * Compares equality between this object and the one passed.
- * @param l - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const long long& l ) const {
- return this->value == l;
- }
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param l - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const long long& l ) const {
- return this->value < l;
- }
-
- /**
- * @returns this Long Object as a String Representation
- */
- std::string toString() const;
-
- /**
- * Answers the double value which the receiver represents
- * @return double the value of the receiver.
- */
- virtual double doubleValue() const {
- return (double)this->value;
- }
-
- /**
- * Answers the float value which the receiver represents
- * @return float the value of the receiver.
- */
- virtual float floatValue() const {
- return (float)this->value;
- }
-
- /**
- * Answers the byte value which the receiver represents
- * @return int the value of the receiver.
- */
- virtual unsigned char byteValue() const {
- return (unsigned char)this->value;
- }
-
- /**
- * Answers the short value which the receiver represents
- * @return int the value of the receiver.
- */
- virtual short shortValue() const {
- return (short)this->value;
- }
-
- /**
- * Answers the int value which the receiver represents
- * @return int the value of the receiver.
- */
- virtual int intValue() const {
- return (int)this->value;
- }
-
- /**
- * Answers the long value which the receiver represents
- * @return long the value of the receiver.
- */
- virtual long long longValue() const {
- return this->value;
- }
-
- public:
-
- /**
- * Returns the number of one-bits in the two's complement binary
- * representation of the specified int value. This function is sometimes
- * referred to as the population count.
- * @param value - the long long to count
- * @return the number of one-bits in the two's complement binary
- * representation of the specified long long value.
- */
- static int bitCount( long long value );
-
- /**
- * Decodes a String into a Long. Accepts decimal, hexadecimal, and octal
- * numbers given by the following grammar:
- *
- * The sequence of characters following an (optional) negative sign and/or
- * radix specifier ("0x", "0X", "#", or leading zero) is parsed as by the
- * Integer.parseInteger method with the indicated radix (10, 16, or 8). This
- * sequence of characters must represent a positive value or a
- * NumberFormatException will be thrown. The result is negated if first
- * character of the specified String is the minus sign. No whitespace
- * characters are permitted in the string.
- * @param value - The string to decode
- * @returns a Long object containing the decoded value
- * @throws NumberFomatException if the string is not formatted correctly.
- */
- static Long decode( const std::string& value )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Returns an long long value with at most a single one-bit, in the position
- * of the highest-order ("leftmost") one-bit in the specified int value.
- * Returns zero if the specified value has no one-bits in its two's
- * complement binary representation, that is, if it is equal to zero.
- * @param value - the long long to be inspected
- * @return an long long value with a single one-bit, in the position of the
- * highest-order one-bit in the specified value, or zero if the specified
- * value is itself equal to zero.
- */
- static long long highestOneBit( long long value );
-
- /**
- * Returns an long long value with at most a single one-bit, in the position
- * of the lowest-order ("rightmost") one-bit in the specified int value.
- * Returns zero if the specified value has no one-bits in its two's
- * complement binary representation, that is, if it is equal to zero.
- * @param value - the long long to be inspected
- * @return an long long value with a single one-bit, in the position of the
- * lowest-order one-bit in the specified value, or zero if the specified
- * value is itself equal to zero.
- */
- static long long lowestOneBit( long long value );
-
- /**
- * Returns the number of zero bits preceding the highest-order ("leftmost")
- * one-bit in the two's complement binary representation of the specified
- * long long value. Returns 64 if the specified value has no one-bits in its
- * two's complement representation, in other words if it is equal to zero.
- *
- * Note that this method is closely related to the logarithm base 2. For
- * all positive int values x:
- *
- * * floor( log2(x)) = 63 - numberOfLeadingZeros(x)
- * * ceil( log2(x)) = 64 - numberOfLeadingZeros(x - 1)
- *
- * @param value - the long long to be inspected
- * @return the number of zero bits preceding the highest-order ("leftmost")
- * one-bit in the two's complement binary representation of the specified
- * long long value, or 64 if the value is equal to zero.
- */
- static int numberOfLeadingZeros( long long value );
-
- /**
- * Returns the number of zero bits following the lowest-order ("rightmost")
- * one-bit in the two's complement binary representation of the specified
- * long long value. Returns 64 if the specified value has no one-bits in its
- * two's complement representation, in other words if it is equal to zero.
- * @param value - the int to be inspected
- * @return the number of zero bits following the lowest-order ("rightmost")
- * one-bit in the two's complement binary representation of the specified
- * long long value, or 64 if the value is equal to zero.
- */
- static int numberOfTrailingZeros( long long value );
-
- /**
- * Parses the string argument as a signed decimal long. The characters in the
- * string must all be decimal digits, except that the first character may be
- * an ASCII minus sign '-' to indicate a negative value. The resulting long
- * value is returned, exactly as if the argument and the radix 10 were given
- * as arguments to the parseLong(java.lang.String, int) method.
- *
- * Note that the characters LL or ULL are not permitted to appear at the end
- * of this string as would normally be permitted in a C++ program.
- * @param value - String to parse
- * @return long long value
- * @throws NumberFormatException on invalid string value
- */
- static long long parseLong( const std::string& value )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Returns a Long object holding the value extracted from the specified
- * string when parsed with the radix given by the second argument. The
- * first argument is interpreted as representing a signed long in the radix
- * specified by the second argument, exactly as if the arguments were
- * given to the parseLong(std::string, int) method. The result is a
- * Long object that represents the long long value specified by the string.
- * @param value - String to parse
- * @param radix - the base encoding of the string
- * @return long long value
- * @throws NumberFormatException on invalid string value
- */
- static long long parseLong( const std::string& value, int radix )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Returns the value obtained by reversing the order of the bytes in the
- * two's complement representation of the specified long long value.
- * @param value - the long long whose bytes we are to reverse
- * @return the reversed long long.
- */
- static long long reverseBytes( long long value );
-
- /**
- * Returns the value obtained by reversing the order of the bits in the
- * two's complement binary representation of the specified long long value.
- * @param value - the value whose bits are to be reversed
- * @returns the reversed bits long long.
- */
- static long long reverse( long long value );
-
- /**
- * Returns the value obtained by rotating the two's complement binary
- * representation of the specified value left by the specified number
- * of bits. (Bits shifted out of the left hand, or high-order, side reenter
- * on the right, or low-order.)
- *
- * Note that left rotation with a negative distance is equivalent to right
- * rotation: rotateLeft(val, -distance) == rotateRight(val, distance). Note
- * also that rotation by any multiple of 32 is a no-op, so all but the last
- * five bits of the rotation distance can be ignored, even if the distance
- * is negative: rotateLeft(val, distance) == rotateLeft(val, distance & 0x1F).
- * @param value - the long long to be inspected
- * @param distance - the number of bits to rotate
- * @return the value obtained by rotating the two's complement binary
- * representation of the specified value left by the specified number
- * of bits.
- */
- static long long rotateLeft( long long value, int distance );
-
- /**
- * Returns the value obtained by rotating the two's complement binary
- * representation of the specified value right by the specified number
- * of bits. (Bits shifted out of the right hand, or low-order, side reenter
- * on the left, or high-order.)
- *
- * Note that right rotation with a negative distance is equivalent to left
- * rotation: rotateRight(val, -distance) == rotateLeft(val, distance). Note
- * also that rotation by any multiple of 32 is a no-op, so all but the last
- * five bits of the rotation distance can be ignored, even if the distance is
- * negative: rotateRight(val, distance) == rotateRight(val, distance & 0x1F).
- * @param value - the long long to be inspected
- * @param distance - the number of bits to rotate
- * @return the value obtained by rotating the two's complement binary
- * representation of the specified value right by the specified number
- * of bits.
- */
- static long long rotateRight( long long value, int distance );
-
- /**
- * Returns the signum function of the specified value. (The return value
- * is -1 if the specified value is negative; 0 if the specified value is zero;
- * and 1 if the specified value is positive.)
- * @param value - the long long to be inspected
- * @return the signum function of the specified long long value.
- */
- static int signum( long long value );
-
- /**
- * Converts the long to a String representation
- * @param long to convert
- * @return string representation
- */
- static std::string toString( long long value );
-
- /*
- * Returns a string representation of the first argument in the radix
- * specified by the second argument.
- *
- * If the radix is smaller than Character.MIN_RADIX or larger than
- * Character.MAX_RADIX, then the radix 10 is used instead.
- *
- * If the first argument is negative, the first element of the result is
- * the ASCII minus character '-'. If the first argument is not
- * negative, no sign character appears in the result.
- *
- * The remaining characters of the result represent the magnitude of the
- * first argument. If the magnitude is zero, it is represented by a single
- * zero character '0'; otherwise, the first character of the
- * representation of the magnitude will not be the zero character. The
- * following ASCII characters are used as digits:
- *
- * 0123456789abcdefghijklmnopqrstuvwxyz
- *
- * @param value - the long long to convert to a string
- * @param radix - the radix to format the string in
- * @returns an long long formatted to the string value of the radix given.
- */
- static std::string toString( long long value, int radix );
-
- /**
- * Returns a string representation of the integer argument as an unsigned
- * integer in base 16.
- *
- * The unsigned integer value is the argument plus 2^32 if the argument is
- * negative; otherwise, it is equal to the argument. This value is converted
- * to a string of ASCII digits in hexadecimal (base 16) with no extra leading
- * 0s. If the unsigned magnitude is zero, it is represented by a single zero
- * character '0'; otherwise, the first character of the representation of the
- * unsigned magnitude will not be the zero character. The following characters
- * are used as hexadecimal digits:
- *
- * 0123456789abcdef
- *
- * If uppercase letters are desired, the toUpperCase() method may be called
- * on the result:
- * @param value - the long long to be translated to an Octal string
- * @returns the unsigned long long value as a Octal string
- */
- static std::string toHexString( long long value );
-
- /**
- * Returns a string representation of the long long argument as an unsigned
- * long long in base 8.
- *
- * The unsigned long long value is the argument plus 2^32 if the argument is
- * negative; otherwise, it is equal to the argument. This value is converted
- * to a string of ASCII digits in octal (base 8) with no extra leading 0s.
- *
- * If the unsigned magnitude is zero, it is represented by a single zero
- * character '0'; otherwise, the first character of the representation
- * of the unsigned magnitude will not be the zero character. The following
- * characters are used as octal digits:
- *
- * 01234567
- *
- * @param value - the long long to be translated to an Octal string
- * @returns the unsigned long long value as a Octal string
- */
- static std::string toOctalString( long long value );
-
- /**
- * Returns a string representation of the long long argument as an unsigned
- * long long in base 2.
- *
- * The unsigned long long value is the argument plus 2^32 if the argument is
- * negative; otherwise it is equal to the argument. This value is converted
- * to a string of ASCII digits in binary (base 2) with no extra leading 0s.
- * If the unsigned magnitude is zero, it is represented by a single zero
- * character '0'; otherwise, the first character of the
- * representation of the unsigned magnitude will not be the zero character.
- * The characters '0' and '1' are used as binary
- * digits.
- * @param value - the long long to be translated to a binary string
- * @returns the unsigned long long value as a binary string
- */
- static std::string toBinaryString( long long value );
-
- /**
- * Returns a Long instance representing the specified int value.
- * @param value - the long long to wrap
- * @return the new Integer object wrapping value.
- */
- static Long valueOf( long long value ) {
- return Long( value );
- }
-
- /**
- * Returns a Long object holding the value given by the specified
- * std::string. The argument is interpreted as representing a signed
- * decimal long long, exactly as if the argument were given to the
- * parseLong( std::string ) method. The result is a Integer object that
- * represents the long long value specified by the string.
- * @param value - std::string to parse as base 10
- * @return new Long Object wrapping the primitive
- * @throws NumberFormatException if the string is not a decimal long long.
- */
- static Long valueOf( const std::string& value )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Returns a Long object holding the value extracted from the specified
- * std::string when parsed with the radix given by the second argument.
- * The first argument is interpreted as representing a signed long long in the
- * radix specified by the second argument, exactly as if the argument were
- * given to the parseLong( std::string, int ) method. The result is a
- * Long object that represents the long long value specified by the string.
- * @param value - std::string to parse as base ( radix )
- * @param radix - base of the string to parse.
- * @return new Long Object wrapping the primitive
- * @throws NumberFormatException if the string is not a valid long long.
- */
- static Long valueOf( const std::string& value, int radix )
- throw ( exceptions::NumberFormatException );
-
- private:
-
- static long long parse( const std::string& value, int offset,
- int radix, bool negative )
- throw ( exceptions::NumberFormatException );
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_LONG_H_*/
diff --git a/src/decaf/src/main/decaf/lang/Math.cpp b/src/decaf/src/main/decaf/lang/Math.cpp
deleted file mode 100644
index 0e0f978..0000000
--- a/src/decaf/src/main/decaf/lang/Math.cpp
+++ /dev/null
@@ -1,502 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <decaf/lang/Math.h>
-#include <decaf/lang/Double.h>
-#include <decaf/lang/Float.h>
-#include <decaf/lang/Integer.h>
-#include <decaf/lang/Long.h>
-#include <decaf/util/Random.h>
-
-using namespace decaf;
-using namespace decaf::lang;
-
-#include <cmath>
-#include <cstdlib>
-
-////////////////////////////////////////////////////////////////////////////////
-const double Math::E = 2.718281828459045;
-const double Math::PI = 3.141592653589793;
-
-////////////////////////////////////////////////////////////////////////////////
-float Math::abs( float value ) {
- return Float::intBitsToFloat( Float::floatToIntBits( value ) & 0x7FFFFFFF );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::abs( double value ) {
- return Double::longBitsToDouble( Double::doubleToLongBits( value ) & 0x7FFFFFFFFFFFFFFFULL );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::acos( double value ) {
- return std::acos( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::asin( double value ) {
- return std::asin( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::atan( double value ) {
- return std::atan( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::atan2( double x, double y ) {
- return std::atan2( x, y );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::random() {
- static util::Random random;
- return random.nextDouble();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::cbrt( double value ) {
-
- if( Double::isNaN( value ) ) {
- return Double::NaN;
- } else if( Double::isInfinite( value ) ) {
- return value;
- } else if( !( value < 0 || value > 0 ) ) {
- return value;
- }
-
- return ::cbrt( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::cos( double value ) {
-
- if( Double::isNaN( value ) || Double::isInfinite( value ) ) {
- return Double::NaN;
- }
-
- return std::cos( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::cosh( double value ) {
-
- if( Double::isNaN( value ) ) {
- return Double::NaN;
- } else if( Double::isInfinite( value ) ) {
- return Double::POSITIVE_INFINITY;
- } else if( value == 0.0 ) {
- return 1.0;
- }
-
- return std::cosh( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::sin( double value ) {
-
- if( Double::isNaN( value ) || Double::isInfinite( value ) ) {
- return Double::NaN;
- } else if( !( value < 0 || value > 0 ) ) {
- return value;
- }
-
- return std::sin( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::sinh( double value ) {
-
- if( Double::isNaN( value ) ) {
- return Double::NaN;
- } else if( Double::isInfinite( value ) ) {
- return value;
- } else if( !( value < 0 || value > 0 ) ) {
- return value;
- }
-
- return std::sinh( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::tan( double value ) {
-
- if( Double::isNaN( value ) || value < -1.0 ) {
- return Double::NaN;
- } else if( !( value < 0 || value > 0 ) ) {
- return value;
- }
-
- return std::tan( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::tanh( double value ) {
-
- if( Double::isNaN( value ) ) {
- return Double::NaN;
- } else if( value == Double::POSITIVE_INFINITY ) {
- return 1.0;
- } else if( value == Double::NEGATIVE_INFINITY ) {
- return -1.0;
- } else if( !( value < 0 || value > 0 ) ) {
- return value;
- }
-
- return std::tanh( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::sqrt( double value ) {
-
- if( Double::isNaN( value ) || value < 0.0 ) {
- return Double::NaN;
- } else if( value == Double::POSITIVE_INFINITY ) {
- return Double::POSITIVE_INFINITY;
- } else if( value == 0.0 || value == -0.0 ) {
- return Double::NEGATIVE_INFINITY;
- }
-
- return std::sqrt( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::rint( double value ) {
-
- if( Double::isNaN( value ) || Double::isInfinite( value ) ) {
- return value;
- } else if( value == 0.0 || value == -0.0 ) {
- return value;
- }
-
- return ::rint( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::exp( double value ) {
-
- if( Double::isNaN( value ) ) {
- return Double::NaN;
- } else if( value == Double::POSITIVE_INFINITY ) {
- return Double::POSITIVE_INFINITY;
- } else if( value == Double::NEGATIVE_INFINITY ) {
- return 0.0;
- }
-
- return std::exp( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::expm1( double value ) {
-
- if( Double::isNaN( value ) ) {
- return Double::NaN;
- } else if( value == Double::POSITIVE_INFINITY ) {
- return Double::POSITIVE_INFINITY;
- } else if( value == Double::NEGATIVE_INFINITY ) {
- return -1.0;
- } else if( !( value > 0 || value < 0 ) ) {
- return value;
- }
-
- return ::expm1( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-float Math::min( float a, float b ) {
-
- if( a > b ) {
- return b;
- } else if( a < b ) {
- return a;
- }
-
- // if either arg is NaN, return NaN
- if( a != b ) {
- return Float::NaN;
- }
-
- // min( +0.0,-0.0) == -0.0
- if( a == 0.0f &&
- ( (Float::floatToIntBits( a ) | Float::floatToIntBits( b )) & 0x80000000) != 0) {
-
- return 0.0f * (-1.0f);
- }
-
- return a;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::min( double a, double b ) {
-
- if( a > b ) {
- return b;
- } else if( a < b ) {
- return a;
- }
-
- // if either arg is NaN, return NaN
- if( a != b ) {
- return Double::NaN;
- }
-
- // min( +0.0,-0.0) == -0.0
- if( a == 0.0 &&
- ( (Double::doubleToLongBits( a ) | Double::doubleToLongBits( b )) & 0x8000000000000000ULL) != 0 ) {
- return 0.0 * (-1.0);
- }
-
- return a;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-float Math::max( float a, float b ) {
-
- if( a > b ) {
- return a;
- } else if( a < b ) {
- return b;
- }
-
- // if either arg is NaN, return NaN
- if( a != b ) {
- return Float::NaN;
- }
- // max( +0.0,-0.0) == +0.0
- if( a == 0.0f &&
- ( (Float::floatToIntBits( a ) & Float::floatToIntBits( b ) ) & 0x80000000 ) == 0 ) {
-
- return 0.0f;
- }
-
- return a;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::max( double a, double b ) {
-
- if( a > b ) {
- return a;
- } else if( a < b ) {
- return b;
- }
-
- // if either arg is NaN, return NaN
- if( a != b ) {
- return Double::NaN;
- }
- // max( +0.0,-0.0) == +0.0
- if( a == 0.0f &&
- ( (Double::doubleToLongBits( a ) & Double::doubleToLongBits( b ) ) & 0x80000000 ) == 0 ) {
-
- return 0.0f;
- }
-
- return a;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::log( double value ) {
-
- if( Double::isNaN( value ) || value < 0.0 ) {
- return Double::NaN;
- } else if( value == Double::POSITIVE_INFINITY ) {
- return Double::POSITIVE_INFINITY;
- } else if( !( value < 0 || value > 0 ) ) {
- return Double::NEGATIVE_INFINITY;
- }
-
- return std::log( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::log10( double value ) {
-
- if( Double::isNaN( value ) || value < 0 ) {
- return Double::NaN;
- } else if( value == Double::POSITIVE_INFINITY ) {
- return Double::POSITIVE_INFINITY;
- } else if( !( value < 0 || value > 0 ) ) {
- return Double::NEGATIVE_INFINITY;
- }
-
- return std::log10( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::log1p( double value ) {
-
- if( Double::isNaN( value ) || value < -1.0 ) {
- return Double::NaN;
- } else if( value == Double::POSITIVE_INFINITY ) {
- return Double::POSITIVE_INFINITY;
- } else if( value == -1.0 ) {
- return Double::NEGATIVE_INFINITY;
- } else if( !( value < 0 || value > 0 ) ) {
- return value;
- }
-
- return ::log1p( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::ceil( double value ) {
-
- if( Double::isNaN( value ) || Double::isInfinite( value ) ) {
- return value;
- } else if( !( value < 0 || value > 0 ) ) {
- return value;
- } else if( value > -1.0 && value < 0.0 ) {
- return -0.0;
- }
-
- return std::ceil( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::floor( double value ) {
-
- if( Double::isNaN( value ) || Double::isInfinite( value ) ) {
- return value;
- } else if( value > 0 || value < 0 ) {
- return std::floor( value );
- }
-
- // +-0.0
- return value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Math::round( float value ) {
-
- if( Float::isNaN( value ) ) {
- return 0;
- }
-
- return (int)Math::floor( value + 0.5f );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long Math::round( double value ) {
-
- if( Double::isNaN( value ) ) {
- return 0;
- }
-
- return (long long)Math::floor( value + 0.5 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::IEEEremainder( double f1, double f2 ) {
-
- if( Double::isNaN( f1 ) || Double::isNaN( f2 ) ||
- Double::isInfinite( f1 ) || !( f2 < 0 || f2 > 0 ) ) {
- return Double::NaN;
- } else if( Double::isInfinite( f2 ) ) {
- return f1;
- }
-
- return ::remainder( f1, f2 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-float Math::signum( float value ) {
-
- if( Float::isNaN( value ) ) {
- return Float::NaN;
- } else if( value > 0 ) {
- return 1.0;
- } else if( value < 0 ) {
- return -1.0;
- }
-
- return value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::signum( double value ) {
-
- if( Double::isNaN( value ) ) {
- return Double::NaN;
- } else if( value > 0 ) {
- return 1.0;
- } else if( value < 0 ) {
- return -1.0;
- }
-
- return value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::hypot( double x, double y ) {
-
- if( Double::isInfinite( x ) || Double::isInfinite( y ) ) {
- return Double::POSITIVE_INFINITY;
- } else if( Double::isNaN( x ) || Double::isNaN( y ) ) {
- return Double::NaN;
- }
-
- return ::hypot( x, y );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::pow( double base, double exp ) {
-
- if( !( exp < 0 || exp > 0 ) ) {
- return 1.0;
- } else if( Double::isNaN( exp ) ) {
- return Double::NaN;
- } else if( Double::isNaN( base ) && ( exp < 0 || exp > 0 ) ) {
- return Double::NaN;
- }
-
- return std::pow( base, exp );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-float Math::ulp( float value ) {
-
- if( Float::isNaN( value ) ) {
- return Float::NaN;
- } else if( Float::isInfinite( value ) ) {
- return Float::POSITIVE_INFINITY;
- } else if( value == Float::MAX_VALUE || value == -Float::MAX_VALUE ) {
- return (float)pow( 2, 104 );
- } else if( !( value < 0 || value > 0 ) ) {
- return Float::MIN_VALUE;
- }
-
- value = abs( value );
- return ::nextafterf( value, Float::MAX_VALUE ) - value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Math::ulp( double value ) {
-
- if( Double::isNaN( value ) ) {
- return Double::NaN;
- } else if( Double::isInfinite( value ) ) {
- return Double::POSITIVE_INFINITY;
- } else if( value == Double::MAX_VALUE || value == -Double::MAX_VALUE ) {
- return pow( 2, 971 );
- } else if( !( value < 0 || value > 0 ) ) {
- return Double::MIN_VALUE;
- }
-
- value = abs( value );
- return ::nextafter( value, Double::MAX_VALUE ) - value;
-}
diff --git a/src/decaf/src/main/decaf/lang/Math.h b/src/decaf/src/main/decaf/lang/Math.h
deleted file mode 100644
index 744a53d..0000000
--- a/src/decaf/src/main/decaf/lang/Math.h
+++ /dev/null
@@ -1,761 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_MATH_H_
-#define _DECAF_LANG_MATH_H_
-
-#include <decaf/util/Config.h>
-
-// On some systems there is a min and max macro defined.
-#undef min
-#undef max
-
-namespace decaf{
-namespace lang{
-
- /**
- * The class <code>Math</code> contains methods for performing basic
- * numeric operations such as the elementary exponential, logarithm,
- * square root, and trigonometric functions.
- */
- class DECAF_API Math {
- public:
-
- static const double E;
- static const double PI;
-
- public:
-
- Math() {}
- virtual ~Math() {}
-
- public:
-
- /**
- * Returns the absolute value of an int value. If the argument is not
- * negative, the argument is returned. If the argument is negative, the
- * negation of the argument is returned.
- * @param value - the value to return the abs of
- * @returns the value if positive, otherwise the negative of value
- */
- static int abs( int value ) {
- return value < 0 ? -value : value;
- }
-
- /**
- * Returns the absolute value of an long long value. If the argument is not
- * negative, the argument is returned. If the argument is negative, the
- * negation of the argument is returned.
- * @param value - the value to return the abs of
- * @returns the value if positive, otherwise the negative of value
- */
- static long long abs( long long value ) {
- return value < 0 ? -value : value;
- }
-
- /**
- * Returns the absolute value of a float value. If the argument is not
- * negative, the argument is returned. If the argument is negative,
- * the negation of the argument is returned. Special cases:
- *
- * o If the argument is positive zero or negative zero, the result is
- * positive zero.
- * o If the argument is infinite, the result is positive infinity.
- * o If the argument is NaN, the result is NaN.
- *
- * In other words, the result is the same as the value of the expression:
- * Float::intBitsToFloat( 0x7fffffff & Float::floatToIntBits( value ) )
- *
- * @param value - the value to return the abs of
- * @returns the value if positive, otherwise the negative of value
- */
- static float abs( float value );
-
- /**
- * Returns the absolute value of a double value. If the argument is not
- * negative, the argument is returned. If the argument is negative,
- * the negation of the argument is returned. Special cases:
- *
- * o If the argument is positive zero or negative zero, the result is
- * positive zero.
- * o If the argument is infinite, the result is positive infinity.
- * o If the argument is NaN, the result is NaN.
- *
- * In other words, the result is the same as the value of the expression:
- * Double::longBitsToDouble( 0x7fffffffffffffffULL &
- * Double::doubleToLongBits( value ) )
- *
- * @param value - the value to return the abs of
- * @returns the value if positive, otherwise the negative of value
- */
- static double abs( double value );
-
- /**
- * Returns the arc cosine of an angle, in the range of 0.0 through pi.
- * Special case:
- *
- * o If the argument is NaN or its absolute value is greater than 1, then
- * the result is NaN.
- *
- * @param value - the value to return the arc cosine of.
- * @returns arc cosine of value in radians.
- */
- static double acos( double value );
-
- /**
- * Returns the arc sine of an angle, in the range of -pi/2 through pi/2.
- * Special cases:
- *
- * o If the argument is NaN or its absolute value is greater than 1, then
- * the result is NaN.
- * o If the argument is zero, then the result is a zero with the same sign
- * as the argument.
- *
- * @param value - the value to return the arc cosine of.
- * @returns arc cosine of value in radians.
- */
- static double asin( double value );
-
- /**
- * Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.
- * Special cases:
- *
- * o If the argument is NaN, then the result is NaN.
- * o If the argument is zero, then the result is a zero with the same sign
- * as the argument.
- *
- * @param value - the value to return the arc cosine of.
- * @returns arc tangent of value in radians.
- */
- static double atan( double value );
-
- /**
- * Converts rectangular coordinates (x, y) to polar (r, theta). This method
- * computes the phase theta by computing an arc tangent of y/x in the range
- * of -pi to pi. Special cases:
- *
- * o If either argument is NaN, then the result is NaN.
- * o If the first argument is positive zero and the second argument is
- * positive, or the first argument is positive and finite and the second
- * argument is positive infinity, then the result is positive zero.
- * o If the first argument is negative zero and the second argument is
- * positive, or the first argument is negative and finite and the second
- * argument is positive infinity, then the result is negative zero.
- * o If the first argument is positive zero and the second argument is
- * negative, or the first argument is positive and finite and the second
- * argument is negative infinity, then the result is the double value
- * closest to pi.
- * o If the first argument is negative zero and the second argument is
- * negative, or the first argument is negative and finite and the second
- * argument is negative infinity, then the result is the double value
- * closest to -pi.
- * o If the first argument is positive and the second argument is positive
- * zero or negative zero, or the first argument is positive infinity and
- * the second argument is finite, then the result is the double value
- * closest to pi/2.
- * o If the first argument is negative and the second argument is positive
- * zero or negative zero, or the first argument is negative infinity and
- * the second argument is finite, then the result is the double value
- * closest to -pi/2.
- * o If both arguments are positive infinity, then the result is the double
- * value closest to pi/4.
- * o If the first argument is positive infinity and the second argument is
- * negative infinity, then the result is the double value closest to 3*pi/4.
- * o If the first argument is negative infinity and the second argument is
- * positive infinity, then the result is the double value closest to -pi/4.
- * o If both arguments are negative infinity, then the result is the double
- * value closest to -3*pi/4.
- *
- * @param y - the ordinate coordinate
- * @param x - the abscissa coordinate
- * @returns the theta component of the point (r, theta) in polar coordinates
- * that corresponds to the point (x, y) in Cartesian coordinates.
- */
- static double atan2( double x, double y );
-
- /**
- * Returns the cube root of a double value. For positive finite x,
- * cbrt(-x) == -cbrt(x); that is, the cube root of a negative value is the
- * negative of the cube root of that value's magnitude. Special cases:
- *
- * o If the argument is NaN, then the result is NaN.
- * o If the argument is infinite, then the result is an infinity with the
- * same sign as the argument.
- * o If the argument is zero, then the result is a zero with the same sign
- * as the argument.
- *
- * @param value - the double to compute the cube root of
- * @returns the cube root of value
- */
- static double cbrt( double value );
-
- /**
- * Returns the trigonometric cosine of an angle. Special cases:
- *
- * o If the argument is NaN or an infinity, then the result is NaN.
- *
- * @param value - an value in radians
- * @returns the cosine of the argument.
- */
- static double cos( double value );
-
- /**
- * Returns the hyperbolic cosine of a double value. The hyperbolic cosine
- * of x is defined to be (ex + e-x)/2 where e is Euler's number.
- * Special cases:
- *
- * o If the argument is NaN, then the result is NaN.
- * o If the argument is infinite, then the result is positive infinity.
- * o If the argument is zero, then the result is 1.0.
- *
- * @param value - the number whose hyperbolic cosine is to be found
- * @return the hyperbolic cosine of value
- */
- static double cosh( double value );
-
- /**
- * Returns the trigonometric sine of an angle. Special case:
- *
- * o If the argument is NaN or an infinity, then the result is NaN.
- * o If the argument is zero, then the result is a zero with the same sign
- * as the argument.
- *
- * @param value - the number whose sin is to be found
- * @return the sine of value
- */
- static double sin( double value );
-
- /**
- * Returns the hyperbolic sine of a double value. The hyperbolic sine of x
- * is defined to be (ex - e-x)/2 where e is Euler's number.
- * Special cases:
- *
- * o If the argument is NaN, then the result is NaN.
- * o If the argument is infinite, then the result is an infinity with
- * the same sign as the argument.
- * o If the argument is zero, then the result is a zero with the same
- * sign as the argument.
- *
- * @param value - the number whose hyperbolic sin is to be found
- * @return the hyperbolic sine of value
- */
- static double sinh( double value );
-
- /**
- * Returns the trigonometric tangent of an angle. Special cases:
- *
- * o If the argument is NaN or an infinity, then the result is NaN.
- * o If the argument is zero, then the result is a zero with the same
- * sign as the argument.
- *
- * @param value - the number whose tangent is to be found
- * @return the tangent of value
- */
- static double tan( double value );
-
- /**
- * Returns the hyperbolic tangent of a double value. The hyperbolic
- * tangent of x is defined to be (ex - e-x)/(ex + e-x), in other words,
- * sinh(x)/cosh(x). Note that the absolute value of the exact tanh is
- * always less than 1. Special cases:
- *
- * o If the argument is NaN, then the result is NaN.
- * o If the argument is zero, then the result is a zero with the same
- * sign as the argument.
- * o If the argument is positive infinity, then the result is +1.0.
- * o If the argument is negative infinity, then the result is -1.0.
- *
- * @param value - the number whose hyperbolic tangent is to be found
- * @return the hyperbolic cosine of value
- */
- static double tanh( double value );
-
- /**
- * Returns the correctly rounded positive square root of a double value.
- * Special cases:
- *
- * o If the argument is NaN or less than zero, then the result is NaN.
- * o If the argument is positive infinity, then the result is positive infinity.
- * o If the argument is positive zero or negative zero, then the result is
- * the same as the argument.
- *
- * Otherwise, the result is the double value closest to the true mathematical
- * square root of the argument value.
- * @param value - the value to find the square root of
- * @param the square root of the argument.
- */
- static double sqrt( double value );
-
- /**
- * Returns the value of the first argument raised to the power of the second
- * argument. Special cases:
- *
- * o If the second argument is positive or negative zero, then the result
- * is 1.0.
- * o If the second argument is 1.0, then the result is the same as the first
- * argument.
- * o If the second argument is NaN, then the result is NaN.
- * o If the first argument is NaN and the second argument is nonzero,
- * then the result is NaN.
- *
- * @param base - the base
- * @param exp - the exponent
- * @return the base raised to the power of exp.
- */
- static double pow( double base, double exp );
-
- /**
- * Returns the double value that is closest in value to the argument and
- * is equal to a mathematical integer. If two double values that are
- * mathematical integers are equally close, the result is the integer
- * value that is even. Special cases:
- *
- * o If the argument value is already equal to a mathematical integer,
- * then the result is the same as the argument.
- * o If the argument is NaN or an infinity or positive zero or negative
- * zero, then the result is the same as the argument.
- *
- * @param value - the value to round to the nearest integer
- * @returns the rounded value
- */
- static double rint( double value );
-
- /**
- * Returns the smaller of two <code>short</code> values. That is,
- * the result the argument closer to the value of
- * <code>Short::MIN_VALUE</code>. If the arguments have the same
- * value, the result is that same value.
- * @param a - an argument.
- * @param b - another argument.
- * @return the smaller of <code>a</code> and <code>b</code>.
- */
- static short min( short a, short b ) {
- return ( a <= b ? a : b );
- }
-
- /**
- * Returns the smaller of two <code>int</code> values. That is,
- * the result the argument closer to the value of
- * <code>Integer::MIN_VALUE</code>. If the arguments have the same
- * value, the result is that same value.
- * @param a - an argument.
- * @param b - another argument.
- * @return the smaller of <code>a</code> and <code>b</code>.
- */
- static int min( int a, int b ) {
- return ( a <= b ? a : b );
- }
-
- /**
- * Returns the smaller of two <code>long long</code> values. That is,
- * the result the argument closer to the value of
- * <code>Long::MIN_VALUE</code>. If the arguments have the same
- * value, the result is that same value.
- * @param a - an argument.
- * @param b - another argument.
- * @return the smaller of <code>a</code> and <code>b</code>.
- */
- static long long min( long long a, long long b ) {
- return ( a <= b ? a : b );
- }
-
- /**
- * Returns the smaller of two float values. That is, the result is the
- * value closer to negative infinity. If the arguments have the same value,
- * the result is that same value. If either value is NaN, then the result
- * is NaN. Unlike the numerical comparison operators, this method considers
- * negative zero to be strictly smaller than positive zero. If one argument
- * is positive zero and the other is negative zero, the result is negative
- * zero.
- * @param a - an argument.
- * @param b - another argument.
- * @return the smaller of <code>a</code> and <code>b</code>.
- */
- static float min( float a, float b );
-
- /**
- * Returns the smaller of two double values. That is, the result is the
- * value closer to negative infinity. If the arguments have the same value,
- * the result is that same value. If either value is NaN, then the result
- * is NaN. Unlike the numerical comparison operators, this method considers
- * negative zero to be strictly smaller than positive zero. If one argument
- * is positive zero and the other is negative zero, the result is negative
- * zero.
- * @param a - an argument.
- * @param b - another argument.
- * @return the smaller of <code>a</code> and <code>b</code>.
- */
- static double min( double a, double b );
-
- /**
- * Returns the larger of two <code>short</code> values. That is,
- * the result the argument closer to the value of
- * <code>Short::MAX_VALUE</code>. If the arguments have the same
- * value, the result is that same value.
- * @param a - an argument.
- * @param b - another argument.
- * @return the larger of <code>a</code> and <code>b</code>.
- */
- static short max( short a, short b ) {
- return ( a >= b ? a : b );
- }
-
- /**
- * Returns the larger of two <code>int</code> values. That is,
- * the result the argument closer to the value of
- * <code>Integer::MAX_VALUE</code>. If the arguments have the same
- * value, the result is that same value.
- * @param a - an argument.
- * @param b - another argument.
- * @return the larger of <code>a</code> and <code>b</code>.
- */
- static int max( int a, int b ) {
- return ( a >= b ? a : b );
- }
-
- /**
- * Returns the larger of two <code>long long</code> values. That is,
- * the result the argument closer to the value of
- * <code>Long::MAX_VALUE</code>. If the arguments have the same
- * value, the result is that same value.
- * @param a - an argument.
- * @param b - another argument.
- * @return the larger of <code>a</code> and <code>b</code>.
- */
- static long long max( long long a, long long b ) {
- return ( a >= b ? a : b );
- }
-
- /**
- * Returns the greater of two float values. That is, the result is the
- * argument closer to positive infinity. If the arguments have the same
- * value, the result is that same value. If either value is NaN, then the
- * result is NaN. Unlike the numerical comparison operators, this method
- * considers negative zero to be strictly smaller than positive zero. If
- * one argument is positive zero and the other negative zero, the result
- * is positive zero.
- * @param a - an argument.
- * @param b - another argument.
- * @return the larger of <code>a</code> and <code>b</code>.
- */
- static float max( float a, float b );
-
- /**
- * Returns the greater of two double values. That is, the result is the
- * argument closer to positive infinity. If the arguments have the same value,
- * the result is that same value. If either value is NaN, then the result is
- * NaN. Unlike the numerical comparison operators, this method considers
- * negative zero to be strictly smaller than positive zero. If one argument
- * is positive zero and the other negative zero, the result is positive zero.
- * @param a - an argument.
- * @param b - another argument.
- * @return the larger of <code>a</code> and <code>b</code>.
- */
- static double max( double a, double b );
-
- /**
- * Returns the natural logarithm (base e) of a double value. Special cases:
- *
- * o If the argument is NaN or less than zero, then the result is NaN.
- * o If the argument is positive infinity, then the result is
- * positive infinity.
- * o If the argument is positive zero or negative zero, then the result
- * is negative infinity.
- *
- * @param value the value to compute the natural log of.
- * @returns the natural log of value.
- */
- static double log( double value );
-
- /**
- * Returns the base 10 logarithm of a double value. Special cases:
- *
- * o If the argument is NaN or less than zero, then the result is NaN.
- * o If the argument is positive infinity, then the result is positive
- * infinity.
- * o If the argument is positive zero or negative zero, then the result is
- * negative infinity.
- * o If the argument is equal to 10n for integer n, then the result is n.
- *
- * @param value - the value to operate on
- * @returns the long base 10 of value
- */
- static double log10( double value );
-
- /**
- * Returns the natural logarithm of the sum of the argument and 1. Note that
- * for small values x, the result of log1p(x) is much closer to the true
- * result of ln(1 + x) than the floating-point evaluation of log(1.0+x).
- *
- * Special cases:
- *
- * o If the argument is NaN or less than -1, then the result is NaN.
- * o If the argument is positive infinity, then the result is positive
- * infinity.
- * o If the argument is negative one, then the result is negative infinity.
- * o If the argument is zero, then the result is a zero with the same sign
- * as the argument.
- *
- * @param value - the value to operate on
- * @returns the the value ln(x + 1), the natural log of x + 1
- */
- static double log1p( double value );
-
- /**
- * Returns the smallest (closest to negative infinity) double value that is
- * greater than or equal to the argument and is equal to a mathematical
- * integer. Special cases:
- *
- * o If the argument value is already equal to a mathematical integer,
- * then the result is the same as the argument.
- * o If the argument is NaN or an infinity or positive zero or negative
- * zero, then the result is the same as the argument.
- * o If the argument value is less than zero but greater than -1.0, then
- * the result is negative zero.
- *
- * Note that the value of Math.ceil(x) is exactly the value of -Math.floor(-x).
- * @param value - the value to find the ceiling of
- * @returns the smallest (closest to negative infinity) floating-point value
- * that is greater than or equal to the argument and is equal to a
- * mathematical integer.
- */
- static double ceil( double value );
-
- /**
- * Returns the largest (closest to positive infinity) double value that is
- * less than or equal to the argument and is equal to a mathematical integer.
- * Special cases:
- *
- * o If the argument value is already equal to a mathematical integer,
- * then the result is the same as the argument.
- * o If the argument is NaN or an infinity or positive zero or negative
- * zero, then the result is the same as the argument.
- *
- * @param value - the value to find the floor of
- * @returns the largest (closest to positive infinity) floating-point value
- * that less than or equal to the argument and is equal to a mathematical
- * integer.
- */
- static double floor( double value );
-
- /**
- * Returns the closest int to the argument. The result is rounded to an
- * integer by adding 1/2, taking the floor of the result, and casting the
- * result to type int. In other words, the result is equal to the value
- * of the expression: (int)Math.floor( a + 0.5f )
- *
- * o If the argument is NaN, the result is 0.
- * o If the argument is negative infinity or any value less than or equal
- * to the value of Integer::MIN_VALUE, the result is equal to the value of
- * Integer::MIN_VALUE.
- * o If the argument is positive infinity or any value greater than or equal
- * to the value of Integer::MAX_VALUE, the result is equal to the value of
- * Integer::MAX_VALUE.
- *
- * @param value - the value to round
- * @returns the value of the argument rounded to the nearest integral value.
- */
- static int round( float value );
-
- /**
- * Returns the closest long long to the argument. The result is rounded to
- * an integer by adding 1/2, taking the floor of the result, and casting the
- * result to type long long. In other words, the result is equal to the value
- * of the expression: (long long)Math.floor(a + 0.5d)
- *
- * o If the argument is NaN, the result is 0.
- * o If the argument is negative infinity or any value less than or equal
- * to the value of Long::MIN_VALUE, the result is equal to the value of
- * Long::MIN_VALUE.
- * o If the argument is positive infinity or any value greater than or equal
- * to the value of Long::MAX_VALUE, the result is equal to the value of
- * Long::MAX_VALUE.
- *
- * @param value - the value to round
- * @returns the value of the argument rounded to the nearest integral value.
- */
- static long long round( double value );
-
- /**
- * Computes the remainder operation on two arguments as prescribed by the
- * IEEE 754 standard. The remainder value is mathematically equal to
- * f1 - f2 × n, where n is the mathematical integer closest to the exact
- * mathematical value of the quotient f1/f2, and if two mathematical
- * integers are equally close to f1/f2, then n is the integer that is even.
- * If the remainder is zero, its sign is the same as the sign of the first
- * argument. Special cases:
- *
- * o If either argument is NaN, or the first argument is infinite, or the
- * second argument is positive zero or negative zero, then the result is
- * NaN.
- * o If the first argument is finite and the second argument is infinite,
- * then the result is the same as the first argument.
- *
- * @param f1 - the dividend.
- * @param f2 - the divisor
- * @return the IEEE remainder of value
- */
- static double IEEEremainder( double f1, double f2 );
-
- /**
- * Returns a double value with a positive sign, greater than or equal to 0.0
- * and less than 1.0. Returned values are chosen pseudorandomly with
- * (approximately) uniform distribution from that range.
- *
- * When this method is first called, it creates a single new pseudorandom-number
- * generator; This new pseudorandom-number generator is used thereafter for all
- * calls to this method and is used nowhere else.
- *
- * This method is properly synchronized to allow correct use by more than
- * one thread. However, if many threads need to generate pseudorandom numbers
- * at a great rate, it may reduce contention for each thread to have its
- * own pseudorandom-number generator.
- * @returns a pseudorandom double greater than or equal to 0.0 and
- * less than 1.0.
- */
- static double random();
-
- /**
- * Returns Euler's number e raised to the power of a double value.
- * Special cases:
- *
- * o If the argument is NaN, the result is NaN.
- * o If the argument is positive infinity, then the result is positive infinity.
- * o If the argument is negative infinity, then the result is positive zero.
- *
- * @param value - the exponent to raise e to
- * @returns the value e^a, where e is the base of the natural logarithms.
- */
- static double exp( double value );
-
- /**
- * Returns e^x - 1. Note that for values of x near 0, the exact sum of
- * expm1(x) + 1 is much closer to the true result of ex than exp(x).
- * Special cases:
- *
- * o If the argument is NaN, the result is NaN.
- * o If the argument is positive infinity, then the result is positive infinity.
- * o If the argument is negative infinity, then the result is -1.0.
- * o If the argument is zero, then the result is a zero with the same sign as
- * the argument.
- *
- * @param the value to raise e^x - 1
- * @returns the value ex - 1.
- */
- static double expm1( double value );
-
- /**
- * Returns sqrt(x^2 + y^2) without intermediate overflow or underflow.
- * Special cases:
- *
- * If either argument is infinite, then the result is positive infinity.
- * If either argument is NaN and neither argument is infinite, then the
- * result is NaN.
- *
- * @param x - an argument
- * @param y - another argument
- * @returns the sqrt(x^2 + y^2) without intermediate overflow or underflow
- */
- static double hypot( double x, double y );
-
- /**
- * Returns the signum function of the argument; zero if the argument is zero,
- * 1.0f if the argument is greater than zero, -1.0f if the argument is less
- * than zero. Special Cases:
- *
- * o If the argument is NaN, then the result is NaN.
- * o If the argument is positive zero or negative zero, then the result is
- * the same as the argument.
- *
- * @param value - the floating-point value whose signum is to be returned
- * @returns the signum function of the argument
- */
- static float signum( float value );
-
- /**
- * Returns the signum function of the argument; zero if the argument is zero,
- * 1.0f if the argument is greater than zero, -1.0f if the argument is less
- * than zero. Special Cases:
- *
- * o If the argument is NaN, then the result is NaN.
- * o If the argument is positive zero or negative zero, then the result is
- * the same as the argument.
- *
- * @param value - the floating-point value whose signum is to be returned
- * @returns the signum function of the argument
- */
- static double signum( double value );
-
- /**
- * Returns the measure in radians of the supplied degree angle
- * @param angdeg - an angle in degrees
- * @return the radian measure of the angle.
- */
- static double toRadians( double angdeg ) {
- return angdeg / 180 * PI;
- }
-
- /**
- * Returns the measure in degrees of the supplied radian angle
- * @param angrad - an angle in radians
- * @return the degree measure of the angle.
- */
- static double toDegrees( double angrad ) {
- return angrad * 180 / PI;
- }
-
- /**
- * Returns the size of an ulp of the argument. An ulp of a float value is
- * the positive distance between this floating-point value and the float
- * value next larger in magnitude. Note that for non-NaN x, ulp(-x) == ulp(x).
- * Special Cases:
- *
- * o If the argument is NaN, then the result is NaN.
- * o If the argument is positive or negative infinity, then the result is
- * positive infinity.
- * o If the argument is positive or negative zero, then the result is
- * Float::MIN_VALUE.
- * o If the argument is ±Float::MAX_VALUE, then the result is equal to 2^104.
- *
- * @param value - the floating-point value whose ulp is to be returned
- * @returns the size of an ulp of the argument
- */
- static float ulp( float value );
-
- /**
- * Returns the size of an ulp of the argument. An ulp of a double value is
- * the positive distance between this floating-point value and the double
- * value next larger in magnitude. Note that for non-NaN x, ulp(-x) == ulp(x).
- * Special Cases:
- *
- * o If the argument is NaN, then the result is NaN.
- * o If the argument is positive or negative infinity, then the result is
- * positive infinity.
- * o If the argument is positive or negative zero, then the result is
- * Double::MIN_VALUE.
- * o If the argument is ±Float::MAX_VALUE, then the result is equal to 2^971.
- *
- * @param value - the floating-point value whose ulp is to be returned
- * @returns the size of an ulp of the argument
- */
- static double ulp( double value );
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_MATH_H_*/
diff --git a/src/decaf/src/main/decaf/lang/Number.h b/src/decaf/src/main/decaf/lang/Number.h
deleted file mode 100644
index e50d850..0000000
--- a/src/decaf/src/main/decaf/lang/Number.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_NUMBER_H_
-#define _DECAF_LANG_NUMBER_H_
-
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace lang{
-
- /**
- * The abstract class Number is the superclass of classes Byte, Double,
- * Float, Integer, Long, and Short.
- *
- * Subclasses of Number must provide methods to convert the represented
- * numeric value to byte, double, float, int, long, and short.
- */
- class DECAF_API Number {
- public:
-
- virtual ~Number() {}
-
- /**
- * Answers the byte value which the receiver represents
- * @return byte the value of the receiver.
- */
- virtual unsigned char byteValue() const {
- return (unsigned char)intValue();
- }
-
- /**
- * Answers the double value which the receiver represents
- * @return double the value of the receiver.
- */
- virtual double doubleValue() const = 0;
-
- /**
- * Answers the float value which the receiver represents
- * @return float the value of the receiver.
- */
- virtual float floatValue() const = 0;
-
- /**
- * Answers the int value which the receiver represents
- * @return int the value of the receiver.
- */
- virtual int intValue() const = 0;
-
- /**
- * Answers the long value which the receiver represents
- * @return long long the value of the receiver.
- */
- virtual long long longValue() const = 0;
-
- /**
- * Answers the short value which the receiver represents
- * @return short the value of the receiver.
- */
- virtual short shortValue() const {
- return (short) intValue();
- }
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_NUMBER_H_*/
diff --git a/src/decaf/src/main/decaf/lang/Runnable.h b/src/decaf/src/main/decaf/lang/Runnable.h
deleted file mode 100644
index ebc5613..0000000
--- a/src/decaf/src/main/decaf/lang/Runnable.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_LANG_RUNNABLE_H_
-#define _DECAF_LANG_RUNNABLE_H_
-
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace lang{
-
- /**
- * Interface for a runnable object - defines a task
- * that can be run by a thread.
- */
- class DECAF_API Runnable{
- public:
-
- virtual ~Runnable(){}
-
- /**
- * Run method - called by the Thread class in the context
- * of the thread.
- */
- virtual void run() = 0;
- };
-
-}}
-
-#endif /*_DECAF_LANG_RUNNABLE_H_*/
diff --git a/src/decaf/src/main/decaf/lang/Short.cpp b/src/decaf/src/main/decaf/lang/Short.cpp
deleted file mode 100644
index c0cc798..0000000
--- a/src/decaf/src/main/decaf/lang/Short.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Short.h"
-#include "Integer.h"
-
-#include <sstream>
-
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-Short::Short( short value ) {
- this->value = value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Short::Short( const std::string& value ) throw( exceptions::NumberFormatException ) {
- this->value = value.size(); //Short::parseShort( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Short::compareTo( const Short& s ) const {
- return value == s.value ? 0 : ( value > s.value ? 1 : -1 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Short::compareTo( const short& s ) const {
- return value == s ? 0 : ( value > s ? 1 : -1 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Short::toString() const {
- return Integer::toString( this->value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Short::toString( short value ) {
- return Integer::toString( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-short Short::parseShort( const std::string& s, int radix )
- throw ( exceptions::NumberFormatException ) {
-
- int intValue = Integer::parseInt( s, radix );
- short result = (short)intValue;
- if( result != intValue ) {
- throw NumberFormatException(
- __FILE__, __LINE__,
- "Short::parseShort - Not a valid short encoded string.");
- }
-
- return result;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-short Short::parseShort( const std::string& s )
- throw ( exceptions::NumberFormatException ) {
- return parseShort( s, 10 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Short Short::decode( const std::string& value )
- throw ( exceptions::NumberFormatException ) {
-
- int intValue = Integer::decode( value ).intValue();
- short result = (short)intValue;
- if( result != intValue ) {
- throw NumberFormatException(
- __FILE__, __LINE__,
- "Short::decode - Not a valid short encoded string.");
- }
-
- return Short( result );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-short Short::reverseBytes( short value ) {
- unsigned short temp = value;
- temp = ( ( temp & 0xFF00 ) >> 8 ) | ( ( temp & 0x00FF ) << 8 );
- return temp;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Short Short::valueOf( short value ) {
- return Short( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Short Short::valueOf( const std::string& value )
- throw ( exceptions::NumberFormatException ) {
-
- return Short( parseShort( value, 10 ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Short Short::valueOf( const std::string& value, int radix )
- throw ( exceptions::NumberFormatException ) {
-
- return Short( parseShort( value, radix ) );
-}
diff --git a/src/decaf/src/main/decaf/lang/Short.h b/src/decaf/src/main/decaf/lang/Short.h
deleted file mode 100644
index 43e84bf..0000000
--- a/src/decaf/src/main/decaf/lang/Short.h
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_SHORT_H_
-#define _DECAF_LANG_SHORT_H_
-
-#include <decaf/lang/Number.h>
-#include <decaf/lang/Comparable.h>
-#include <decaf/lang/exceptions/NumberFormatException.h>
-#include <string>
-
-namespace decaf{
-namespace lang{
-
- class Short : public Number,
- public Comparable<Short>,
- public Comparable<short> {
- private:
-
- // The short value
- short value;
-
- public:
-
- /** Size of this objects primitive type in bits */
- static const int SIZE = 16;
-
- /** Max Value for this Object's primitive type */
- static const short MAX_VALUE = (short)0x7FFF;
-
- /** Max Value for this Object's primitive type */
- static const short MIN_VALUE = (short)0x8000;
-
- public:
-
- /**
- * @param value - short to wrap
- */
- Short( short value );
-
- /**
- * @param value - string value to convert to short and wrap
- * @throws NumberFormatException
- */
- Short( const std::string& value ) throw( exceptions::NumberFormatException );
-
- virtual ~Short() {}
-
- /**
- * Compares this Short instance with another.
- * @param s - the Short instance to be compared
- * @return zero if this object represents the same short value as the
- * argument; a positive value if this object represents a value greater
- * than the passed in value, and -1 if this object repesents a value
- * less than the passed in value.
- */
- virtual int compareTo( const Short& s ) const;
-
- /**
- * @returns true if the two Short Objects have the same value.
- */
- bool equals( const Short& s ) const {
- return this->value == s.value;
- }
-
- /**
- * Compares equality between this object and the one passed.
- * @param s - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const Short& s ) const {
- return this->value == s.value;
- }
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param s - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const Short& s ) const {
- return this->value < s.value;
- }
-
- /**
- * Compares this Short instance with another.
- * @param s - the Short instance to be compared
- * @return zero if this object represents the same short value as the
- * argument; a positive value if this object represents a value greater
- * than the passed in value, and -1 if this object repesents a value
- * less than the passed in value.
- */
- virtual int compareTo( const short& s ) const;
-
- /**
- * @returns true if the two Short Objects have the same value.
- */
- bool equals( const short& s ) const {
- return this->value == s;
- }
-
- /**
- * Compares equality between this object and the one passed.
- * @param s - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const short& s ) const {
- return this->value == s;
- }
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param s - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const short& s ) const {
- return this->value < s;
- }
-
- /**
- * @returns this Short Object as a String Representation
- */
- std::string toString() const;
-
- /**
- * Answers the double value which the receiver represents
- * @return double the value of the receiver.
- */
- virtual double doubleValue() const {
- return (double)this->value;
- }
-
- /**
- * Answers the float value which the receiver represents
- * @return float the value of the receiver.
- */
- virtual float floatValue() const {
- return (float)this->value;
- }
-
- /**
- * Answers the byte value which the receiver represents
- * @return int the value of the receiver.
- */
- virtual unsigned char byteValue() const {
- return (unsigned char)this->value;
- }
-
- /**
- * Answers the short value which the receiver represents
- * @return int the value of the receiver.
- */
- virtual short shortValue() const {
- return this->value;
- }
-
- /**
- * Answers the int value which the receiver represents
- * @return int the value of the receiver.
- */
- virtual int intValue() const {
- return (int)this->value;
- }
-
- /**
- * Answers the long value which the receiver represents
- * @return long the value of the receiver.
- */
- virtual long long longValue() const {
- return (long long)this->value;
- }
-
- public: // statics
-
- /**
- * @returns a string representing the primitive value as Base 10
- */
- static std::string toString( short value );
-
- /**
- * Decodes a String into a Short. Accepts decimal, hexadecimal, and octal
- * numbers given by the following grammar:
- *
- * The sequence of characters following an (optional) negative sign and/or
- * radix specifier ("0x", "0X", "#", or leading zero) is parsed as by the
- * Short.parseShort method with the indicated radix (10, 16, or 8). This
- * sequence of characters must represent a positive value or a
- * NumberFormatException will be thrown. The result is negated if first
- * character of the specified String is the minus sign. No whitespace
- * characters are permitted in the string.
- * @param value - The string to decode
- * @returns a Short object containing the decoded value
- * @throws NumberFomatException if the string is not formatted correctly.
- */
- static Short decode( const std::string& value )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Returns the value obtained by reversing the order of the bytes in the
- * two's complement representation of the specified short value.
- * @param value - the short whose bytes we are to reverse
- * @return the reversed short.
- */
- static short reverseBytes( short value );
-
- /**
- * Parses the string argument as a signed short in the radix specified by
- * the second argument. The characters in the string must all be digits,
- * of the specified radix (as determined by whether
- * Character.digit(char, int) returns a nonnegative value) except that the
- * first character may be an ASCII minus sign '-' ('\u002D') to indicate
- * a negative value. The resulting byte value is returned.
- *
- * An exception of type NumberFormatException is thrown if any of the
- * following situations occurs:
- * * The first argument is null or is a string of length zero.
- * * The radix is either smaller than Character.MIN_RADIX or larger than
- * Character.MAX_RADIX.
- * * Any character of the string is not a digit of the specified radix,
- * except that the first character may be a minus sign '-' ('\u002D')
- * provided that the string is longer than length 1.
- * * The value represented by the string is not a value of type short.
- *
- * @param s - the String containing the short representation to be parsed
- * @param radix - the radix to be used while parsing s
- * @return the short represented by the string argument in the specified radix.
- * @throws NumberFormatException - If String does not contain a parsable short.
- */
- static short parseShort( const std::string& s, int radix )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Parses the string argument as a signed decimal short. The characters
- * in the string must all be decimal digits, except that the first
- * character may be an ASCII minus sign '-' ('\u002D') to indicate a
- * negative value. The resulting short value is returned, exactly as if
- * the argument and the radix 10 were given as arguments to the
- * parseShort( const std::string, int ) method.
- * @param s - String to convert to a short
- * @returns the converted short value
- * @throws NumberFormatException if the string is not a short.
- */
- static short parseShort( const std::string& s )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Returns a Short instance representing the specified short value.
- * @param value - the short to wrap
- * @return the new Short object wrapping value.
- */
- static Short valueOf( short value );
-
- /**
- * Returns a Short object holding the value given by the specified std::string.
- * The argument is interpreted as representing a signed decimal short,
- * exactly as if the argument were given to the parseShort( std::string )
- * method. The result is a Short object that represents the short value
- * specified by the string.
- * @param value - std::string to parse as base 10
- * @return new Short Object wrapping the primitive
- * @throws NumberFormatException if the string is not a decimal short.
- */
- static Short valueOf( const std::string& value )
- throw ( exceptions::NumberFormatException );
-
- /**
- * Returns a Short object holding the value extracted from the specified
- * std::string when parsed with the radix given by the second argument.
- * The first argument is interpreted as representing a signed short in the
- * radix specified by the second argument, exactly as if the argument were
- * given to the parseShort( std::string, int ) method. The result is a
- * Short object that represents the short value specified by the string.
- * @param value - std::string to parse as base ( radix )
- * @param radix - base of the string to parse.
- * @return new Short Object wrapping the primitive
- * @throws NumberFormatException if the string is not a valid short.
- */
- static Short valueOf( const std::string& value, int radix )
- throw ( exceptions::NumberFormatException );
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_SHORT_H_*/
diff --git a/src/decaf/src/main/decaf/lang/System.cpp b/src/decaf/src/main/decaf/lang/System.cpp
deleted file mode 100644
index 00e6615..0000000
--- a/src/decaf/src/main/decaf/lang/System.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "System.h"
-
-#include <decaf/lang/exceptions/NullPointerException.h>
-#include <decaf/lang/exceptions/IllegalArgumentException.h>
-#include <decaf/lang/exceptions/RuntimeException.h>
-#include <decaf/util/Date.h>
-#include <decaf/util/StringTokenizer.h>
-#include <apr.h>
-#include <apr_errno.h>
-#include <apr_env.h>
-
-#ifdef APR_HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <cstdlib>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::util;
-using namespace decaf::internal;
-using namespace decaf::lang::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-AprPool System::aprPool;
-
-////////////////////////////////////////////////////////////////////////////////
-System::System() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void System::unsetenv( const std::string& name ) throw ( lang::Exception ) {
-
- apr_status_t result = APR_SUCCESS;
-
- // Clear the value, errors are thrown out as an exception
- result = apr_env_delete( name.c_str(), aprPool.getAprPool() );
- aprPool.cleanup();
-
- if( result != APR_SUCCESS ) {
-
- char buffer[256] = {0};
-
- throw NullPointerException(
- __FILE__, __LINE__,
- "System::getenv - ",
- apr_strerror( result, buffer, 255 ) );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string System::getenv( const std::string& name ) throw ( Exception ) {
-
- char* value = NULL;
- apr_status_t result = APR_SUCCESS;
-
- // Read the value, errors are thrown out as an exception
- result = apr_env_get( &value, name.c_str(), aprPool.getAprPool() );
-
- if( result != APR_SUCCESS ) {
-
- char buffer[256] = {0};
-
- throw NullPointerException(
- __FILE__, __LINE__,
- "System::getenv - ",
- apr_strerror( result, buffer, 255 ) );
- }
-
- // Copy and cleanup
- if( value == NULL ) {
- return "";
- }
-
- std::string envVal( value );
- aprPool.cleanup();
-
- return value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void System::setenv( const std::string& name, const std::string& value )
- throw ( lang::Exception ) {
-
- apr_status_t result = APR_SUCCESS;
-
- // Write the value, errors are thrown out as an exception
- result = apr_env_set( name.c_str(), value.c_str(), aprPool.getAprPool() );
- aprPool.cleanup();
-
- if( result != APR_SUCCESS ) {
-
- char buffer[256] = {0};
-
- throw NullPointerException(
- __FILE__, __LINE__,
- "System::getenv - ",
- apr_strerror( result, buffer, 255 ) );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long System::currentTimeMillis() {
- return Date::getCurrentTimeMilliseconds();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Map<string, string> System::getenv() throw ( Exception ) {
-
- Map<string, string> values;
- StringTokenizer tokenizer( "" );
- string key = "";
- string value = "";
- int tokens = 0;
- std::vector<std::string> env = getEnvArray();
-
- for( std::size_t i = 0; i < env.size(); i++ ){
- tokenizer.reset( env[i], "=" );
-
- tokens = tokenizer.countTokens();
-
- if( tokens == 1 ) {
- // special case, no value set, store empty string as value
- key = tokenizer.nextToken();
- value = string("");
- } else if( tokens > 2 ) {
- // special case: first equals delimits the key value, the rest are
- // part of the variable
- int pos = env[i].find( "=" );
- key = env[i].substr( 0, pos );
- value = env[i].substr( pos + 1, string::npos );
- } else if( tokens == 0 ) {
- // Odd case, got a string with no equals sign.
- throw IllegalArgumentException(
- __FILE__, __LINE__,
- "System::getenv - Invalid env string. %s",
- env[i].c_str() );
- } else {
- // Normal case.
- key = tokenizer.nextToken();
- value = tokenizer.nextToken();
- }
-
- // Store the env var
- values.setValue( key, value );
- }
-
- return values;
-}
-
-#if defined(_WIN32)
-
-#include <windows.h>
-
-////////////////////////////////////////////////////////////////////////////////
-std::vector<std::string> System::getEnvArray() {
-
- std::vector<std::string> buffer;
- int count = 0;
- LPTSTR lpszVars;
- LPVOID lpvEnv;
-
- lpvEnv = GetEnvironmentStrings();
- if( NULL == lpvEnv ){
- return NULL;
- }
-
- lpszVars = (LPTSTR)lpvEnv;
- while( *lpszVars != NULL ) {
- count++;
- lpszVars += strlen(lpszVars)+1;
- }
-
- lpszVars = (LPTSTR)lpvEnv;
- int index = 0;
- while( *lpszVars != NULL ) {
- buffer.push_back( lpszVars );
- lpszVars += strlen(lpszVars)+1;
- }
-
- FreeEnvironmentStrings( (LPTCH)lpvEnv );
- return buffer;
-}
-
-#else
-
-////////////////////////////////////////////////////////////////////////////////
-extern char** environ;
-
-////////////////////////////////////////////////////////////////////////////////
-std::vector<std::string> System::getEnvArray() {
-
- std::vector<std::string> buffer;
- int count = 0;
-
- for( int i = 0; *(environ + i); i++ ){
- count++;
- }
-
- for( int i = 0; *(environ + i); i++ ){
- buffer.push_back( environ[i] );
- }
-
- return buffer;
-}
-
-#endif
diff --git a/src/decaf/src/main/decaf/lang/System.h b/src/decaf/src/main/decaf/lang/System.h
deleted file mode 100644
index 4e48dd8..0000000
--- a/src/decaf/src/main/decaf/lang/System.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_SYSTEM_H_
-#define _DECAF_LANG_SYSTEM_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/util/Map.h>
-#include <decaf/lang/Exception.h>
-#include <decaf/internal/AprPool.h>
-#include <string>
-
-namespace decaf{
-namespace lang{
-
- class DECAF_API System {
- private:
-
- static internal::AprPool aprPool;
-
- public:
-
- System();
- virtual ~System() {}
-
- public: // Static Methods
-
- /**
- * Enumerates the system environment and returns a map of env variable
- * names to the string values they hold.
- * @return A Map of all environment variables.
- * @throw Exception if an error occurs
- */
- static util::Map<std::string, std::string> getenv()
- throw ( lang::Exception );
-
- /**
- * Reads an environment value from the system and returns it as a
- * string object
- * @param name - the env var to read
- * @return a string with the value from the var or ""
- * @throws an Exception if an error occurs while reading the Env.
- */
- static std::string getenv( const std::string& name )
- throw ( lang::Exception );
-
- /**
- * Clears a set env value if one is set.
- * @param name - the env var to clear
- * @throws an Exception if an error occurs while reading the Env.
- */
- static void unsetenv( const std::string& name )
- throw ( lang::Exception );
-
- /**
- * Sets the specified system property to the value given
- * @param name - name of the env val to set
- * @param value - value to assign to name
- * @throws an Exception if an error occurs
- */
- static void setenv( const std::string& name, const std::string& value )
- throw ( lang::Exception );
-
- /**
- * @returns the current system time in Milliseconds
- */
- static long long currentTimeMillis();
-
- private:
-
- /**
- * Enumerates the environment and return an array of strings
- * with the values. Caller owns the array. The array is terminated
- * by an element that holds the value NULL
- * @returns a vector of env name=value paris.
- */
- static std::vector< std::string > getEnvArray();
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_SYSTEM_H_*/
diff --git a/src/decaf/src/main/decaf/lang/Thread.cpp b/src/decaf/src/main/decaf/lang/Thread.cpp
deleted file mode 100644
index 978f077..0000000
--- a/src/decaf/src/main/decaf/lang/Thread.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Thread.h"
-
-#include <apr_time.h>
-#include <apr_portable.h>
-
-#include <decaf/lang/Exception.h>
-#include <decaf/lang/exceptions/RuntimeException.h>
-
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-Thread::Thread() {
- this->task = this;
- this->started = false;
- this->joined = false;
- this->pool = NULL;
- this->threadHandle = NULL;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Thread::Thread( Runnable* task ) {
- this->task = task;
- this->started = false;
- this->joined = false;
- this->pool = NULL;
- this->threadHandle = NULL;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Thread::~Thread(){
- if( pool != NULL ) {
- apr_pool_destroy( pool );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Thread::start() throw ( Exception )
-{
- if( this->started ) {
- throw Exception(
- __FILE__, __LINE__,
- "Thread::start - Thread already started");
- }
-
- apr_pool_create( &pool, NULL );
- apr_status_t err = apr_thread_create(
- &this->threadHandle,
- NULL,
- runCallback,
- this,
- pool );
-
- if( err != APR_SUCCESS ) {
- throw Exception(
- __FILE__, __LINE__,
- "Thread::start - Coud not start thread");
- }
-
- // Mark the thread as started.
- started = true;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Thread::join() throw( Exception )
-{
- if( !this->started ) {
- throw Exception( __FILE__, __LINE__,
- "Thread::join() called without having called Thread::start()");
- }
-
- if( !this->joined ) {
- apr_status_t threadReturn;
- if( apr_thread_join( &threadReturn, this->threadHandle ) != APR_SUCCESS ) {
- throw Exception( __FILE__, __LINE__,
- "Thread::join() - Failed to Join the Thread");
- }
- }
- this->joined = true;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Thread::sleep( int millisecs ) {
- apr_sleep( (apr_interval_time_t)(millisecs * 1000) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned long Thread::getId() {
- return (long)( apr_os_thread_current() );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void* APR_THREAD_FUNC Thread::runCallback( apr_thread_t* self, void* param ) {
-
- // Get the instance.
- Thread* thread = (Thread*)param;
-
- // Invoke run on the task.
- try{
- thread->task->run();
- } catch( ... ){
- RuntimeException ex(
- __FILE__, __LINE__,
- "unhandled exception bubbled up to Thread::run");
- ex.printStackTrace();
- }
-
- // Indicate we are done.
- apr_thread_exit( self, APR_SUCCESS );
- return NULL;
-}
diff --git a/src/decaf/src/main/decaf/lang/Thread.h b/src/decaf/src/main/decaf/lang/Thread.h
deleted file mode 100644
index fcbcbf7..0000000
--- a/src/decaf/src/main/decaf/lang/Thread.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_LANG_THREAD_H_
-#define _DECAF_LANG_THREAD_H_
-
-#include <decaf/lang/Exception.h>
-#include <decaf/lang/Runnable.h>
-#include <decaf/util/Config.h>
-#include <stdexcept>
-#include <assert.h>
-
-#include <apr_pools.h>
-#include <apr_thread_proc.h>
-
-namespace decaf{
-namespace lang{
-
- /**
- * Basic thread class - mimics the Java Thread. Derived classes may
- * implement the run method, or this class can be used as is with
- * a provided Runnable delegate.
- */
- class DECAF_API Thread : public Runnable
- {
- private:
-
- /**
- * The task to be run by this thread, defaults to
- * this thread object.
- */
- Runnable* task;
-
- /**
- * APR Pool to allocate thread from
- */
- apr_pool_t* pool;
-
- /**
- * APR Thread Handle
- */
- apr_thread_t* threadHandle;
-
- /**
- * Started state of this thread.
- */
- bool started;
-
- /**
- * Indicates whether the thread has already been
- * joined.
- */
- bool joined;
-
- public:
-
- /**
- * default Constructor
- */
- Thread();
-
- /**
- * Constructor
- * @param task the Runnable that this thread manages
- */
- Thread( Runnable* task );
-
- virtual ~Thread();
-
- /**
- * Creates a system thread and starts it in a joinable mode.
- * Upon creation, the
- * run() method of either this object or the provided Runnable
- * object will be invoked in the context of this thread.
- * @exception runtime_error is thrown if the system could
- * not start the thread.
- */
- virtual void start() throw ( Exception );
-
- /**
- * Wait til the thread exits. This is when the run()
- * method has returned or has thrown an exception.
- */
- virtual void join() throw ( Exception );
-
- /**
- * Default implementation of the run method - does nothing.
- */
- virtual void run(){};
-
- public:
-
- /**
- * Halts execution of the calling thread for a specified no of millisec.
- *
- * Note that this method is a static method that applies to the
- * calling thread and not to the thread object.
- * @param millisecs time in milliseconds to sleep
- */
- static void sleep( int millisecs );
-
- /**
- * Obtains the Thread Id of the current thread
- * @return Thread Id
- */
- static unsigned long getId();
-
- private:
-
- // Internal thread handling
- static void* APR_THREAD_FUNC runCallback( apr_thread_t* self, void* param );
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_THREAD_H_*/
diff --git a/src/decaf/src/main/decaf/lang/Throwable.h b/src/decaf/src/main/decaf/lang/Throwable.h
deleted file mode 100644
index b22a8d7..0000000
--- a/src/decaf/src/main/decaf/lang/Throwable.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_THROWABLE_H_
-#define _DECAF_LANG_THROWABLE_H_
-
-// Includes
-#include <string>
-#include <vector>
-#include <iostream>
-#include <exception>
-
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace lang{
-
- /**
- * This class represents an error that has occurred.
- */
- class DECAF_API Throwable : public std::exception {
-
- public:
-
- Throwable() throw() {}
-
- virtual ~Throwable() throw() {}
-
- /**
- * Gets the cause of the error.
- * @return string errors message
- */
- virtual std::string getMessage() const = 0;
-
- /**
- * Adds a file/line number to the stack trace.
- * @param file The name of the file calling this method (use __FILE__).
- * @param lineNumber The line number in the calling file (use __LINE__).
- */
- virtual void setMark( const char* file, const int lineNumber ) = 0;
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- * @return Copy of this Exception object
- */
- virtual Throwable* clone() const = 0;
-
- /**
- * Provides the stack trace for every point where
- * this exception was caught, marked, and rethrown.
- * @return vector containing stack trace strings
- */
- virtual std::vector< std::pair< std::string, int> > getStackTrace() const = 0;
-
- /**
- * Prints the stack trace to std::err
- */
- virtual void printStackTrace() const = 0;
-
- /**
- * Prints the stack trace to the given output stream.
- * @param stream the target output stream.
- */
- virtual void printStackTrace( std::ostream& stream ) const = 0;
-
- /**
- * Gets the stack trace as one contiguous string.
- * @return string with formatted stack trace data
- */
- virtual std::string getStackTraceString() const = 0;
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_THROWABLE_H_*/
diff --git a/src/decaf/src/main/decaf/lang/exceptions/ExceptionDefines.h b/src/decaf/src/main/decaf/lang/exceptions/ExceptionDefines.h
deleted file mode 100644
index f82fd2a..0000000
--- a/src/decaf/src/main/decaf/lang/exceptions/ExceptionDefines.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_EXCEPTIONS_EXCEPTIONDEFINES_H_
-#define _DECAF_LANG_EXCEPTIONS_EXCEPTIONDEFINES_H_
-
-/**
- * Macro for catching and rethrowing an exception of
- * a given type.
- * @param type The type of the exception to throw
- * (e.g. Exception ).
- */
-#define DECAF_CATCH_RETHROW( type ) \
- catch( type& ex ){ \
- ex.setMark( __FILE__, __LINE__ ); \
- throw ex; \
- }
-
-/**
- * Macro for catching an exception of one type and then rethrowing
- * as another type.
- * @param sourceType the type of the exception to be caught.
- * @param targetType the type of the exception to be thrown.
- */
-#define DECAF_CATCH_EXCEPTION_CONVERT( sourceType, targetType ) \
- catch( sourceType& ex ){ \
- targetType target( ex ); \
- target.setMark( __FILE__, __LINE__ ); \
- throw target; \
- }
-
-/**
- * A catch-all that throws a known exception.
- * @param type the type of exception to be thrown.
- */
-#define DECAF_CATCHALL_THROW( type ) \
- catch( ... ){ \
- type ex( __FILE__, __LINE__, \
- "caught unknown exception" ); \
- throw ex; \
- }
-
-/**
- * A catch-all that does not throw an exception, one use would
- * be to catch any exception in a destructor and mark it, but not
- * throw so that cleanup would continue as normal.
- */
-#define DECAF_CATCHALL_NOTHROW( ) \
- catch( ... ){ \
- lang::Exception ex( __FILE__, __LINE__, \
- "caught unknown exception, not rethrowing" ); \
- }
-
-/**
- * Macro for catching and rethrowing an exception of
- * a given type.
- * @param type The type of the exception to throw
- * (e.g. Exception ).
- */
-#define DECAF_CATCH_NOTHROW( type ) \
- catch( type& ex ){ \
- ex.setMark( __FILE__, __LINE__ ); \
- }
-
-#endif /*_DECAF_LANG_EXCEPTIONS_EXCEPTIONDEFINES_H_*/
diff --git a/src/decaf/src/main/decaf/lang/exceptions/IllegalArgumentException.h b/src/decaf/src/main/decaf/lang/exceptions/IllegalArgumentException.h
deleted file mode 100644
index bc95f1b..0000000
--- a/src/decaf/src/main/decaf/lang/exceptions/IllegalArgumentException.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_LANG_EXCEPTIONS_ILLEGALARGUMENTEXCEPTION_H_
-#define _DECAF_LANG_EXCEPTIONS_ILLEGALARGUMENTEXCEPTION_H_
-
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace lang{
-namespace exceptions{
-
- /*
- * Thrown when an illegal argument was passed into a method.
- */
- class DECAF_API IllegalArgumentException : public Exception
- {
- public:
-
- /**
- * Default Constructor
- */
- IllegalArgumentException() throw() {}
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- IllegalArgumentException( const Exception& ex ) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- IllegalArgumentException( const IllegalArgumentException& ex ) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- IllegalArgumentException(const char* file, const int lineNumber,
- const char* msg, ...) throw()
- : Exception()
- {
- va_list vargs ;
- va_start(vargs, msg) ;
- buildMessage(msg, vargs) ;
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual Exception* clone() const{
- return new IllegalArgumentException( *this );
- }
-
- /**
- * Destructor
- */
- virtual ~IllegalArgumentException() throw() {}
-
- };
-
-}}}
-
-#endif /*_DECAF_LANG_EXCEPTIONS_ILLEGALARGUMENTEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/lang/exceptions/IllegalMonitorStateException.h b/src/decaf/src/main/decaf/lang/exceptions/IllegalMonitorStateException.h
deleted file mode 100644
index bbdb4a2..0000000
--- a/src/decaf/src/main/decaf/lang/exceptions/IllegalMonitorStateException.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_LANG_EXCEPTIONS_ILLEGALMONITORSTATEEXCEPTION_H_
-#define _DECAF_LANG_EXCEPTIONS_ILLEGALMONITORSTATEEXCEPTION_H_
-
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace lang{
-namespace exceptions{
-
- /*
- * Thrown when an error occurs from calling a method from syncronizable
- * and the caller doesn't hold a lock on the object.
- */
- class DECAF_API IllegalMonitorStateException : public Exception
- {
- public:
-
- /**
- * Default Constructor
- */
- IllegalMonitorStateException() throw() {};
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- IllegalMonitorStateException(const Exception& ex) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- IllegalMonitorStateException(const IllegalMonitorStateException& ex) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- IllegalMonitorStateException( const char* file,
- const int lineNumber,
- const char* msg, ...) throw()
- {
- va_list vargs;
- va_start(vargs, msg);
- buildMessage(msg, vargs);
-
- // Set the first mark for this exception.
- setMark(file, lineNumber);
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual IllegalMonitorStateException* clone() const{
- return new IllegalMonitorStateException(*this);
- }
-
- virtual ~IllegalMonitorStateException() throw() {}
-
- };
-
-}}}
-
-#endif /*_DECAF_LANG_EXCEPTIONS_ILLEGALMONITORSTATEEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/lang/exceptions/IllegalStateException.h b/src/decaf/src/main/decaf/lang/exceptions/IllegalStateException.h
deleted file mode 100644
index 810e2eb..0000000
--- a/src/decaf/src/main/decaf/lang/exceptions/IllegalStateException.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_LANG_EXCEPTIONS_ILLEGALSTATEEXCEPTION_H_
-#define _DECAF_LANG_EXCEPTIONS_ILLEGALSTATEEXCEPTION_H_
-
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace lang{
-namespace exceptions{
-
- /*
- * Thrown when an error occurs from calling a method from syncronizable
- * and the caller doesn't hold a lock on the object.
- */
- class DECAF_API IllegalStateException : public Exception
- {
- public:
-
- /**
- * Default Constructor
- */
- IllegalStateException() throw() {};
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- IllegalStateException(const Exception& ex) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- IllegalStateException(const IllegalStateException& ex) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- IllegalStateException( const char* file,
- const int lineNumber,
- const char* msg, ...) throw()
- : Exception()
- {
- va_list vargs;
- va_start(vargs, msg);
- buildMessage(msg, vargs);
-
- // Set the first mark for this exception.
- setMark(file, lineNumber);
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual IllegalStateException* clone() const{
- return new IllegalStateException(*this);
- }
-
- virtual ~IllegalStateException() throw() {}
-
- };
-
-}}}
-
-#endif /*_DECAF_LANG_EXCEPTIONS_ILLEGALSTATEEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/lang/exceptions/IndexOutOfBoundsException.h b/src/decaf/src/main/decaf/lang/exceptions/IndexOutOfBoundsException.h
deleted file mode 100644
index 1e7a61b..0000000
--- a/src/decaf/src/main/decaf/lang/exceptions/IndexOutOfBoundsException.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_LANG_EXCEPTIONS_INDEXOUTOFBOUNDSEXCEPTION_H_
-#define _DECAF_LANG_EXCEPTIONS_INDEXOUTOFBOUNDSEXCEPTION_H_
-
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace lang{
-namespace exceptions{
-
- /*
- * Thrown when an illegal argument was passed into a method.
- */
- class DECAF_API IndexOutOfBoundsException : public Exception
- {
- public:
-
- /**
- * Default Constructor
- */
- IndexOutOfBoundsException() throw() {}
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- IndexOutOfBoundsException( const Exception& ex ) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- IndexOutOfBoundsException( const IndexOutOfBoundsException& ex ) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- IndexOutOfBoundsException(const char* file, const int lineNumber,
- const char* msg, ...) throw()
- : Exception()
- {
- va_list vargs ;
- va_start(vargs, msg) ;
- buildMessage(msg, vargs) ;
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual IndexOutOfBoundsException* clone() const{
- return new IndexOutOfBoundsException( *this );
- }
-
- /**
- * Destructor
- */
- virtual ~IndexOutOfBoundsException() throw() {}
-
- };
-
-}}}
-
-#endif /*_DECAF_LANG_EXCEPTIONS_INDEXOUTOFBOUNDSEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/lang/exceptions/InterruptedException.h b/src/decaf/src/main/decaf/lang/exceptions/InterruptedException.h
deleted file mode 100644
index 7818933..0000000
--- a/src/decaf/src/main/decaf/lang/exceptions/InterruptedException.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_LANG_EXCEPTIONS_INTERRUPTEDENTEXCEPTION_H_
-#define _DECAF_LANG_EXCEPTIONS_INTERRUPTEDENTEXCEPTION_H_
-
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace lang{
-namespace exceptions{
-
- /*
- * Thrown when an Thread is interrupted during a wait.
- */
- class DECAF_API InterruptedException : public Exception
- {
- public:
-
- /**
- * Default Constructor
- */
- InterruptedException() throw() {};
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- InterruptedException(const Exception& ex) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- InterruptedException(const InterruptedException& ex) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- InterruptedException( const char* file,
- const int lineNumber,
- const char* msg, ... ) throw()
- : Exception()
- {
- va_list vargs;
- va_start(vargs, msg);
- buildMessage(msg, vargs);
-
- // Set the first mark for this exception.
- setMark(file, lineNumber);
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual InterruptedException* clone() const{
- return new InterruptedException(*this);
- }
-
- virtual ~InterruptedException() throw() {}
-
- };
-
-}}}
-
-#endif /*_DECAF_LANG_EXCEPTIONS_INTERRUPTEDENTEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/lang/exceptions/InvalidStateException.h b/src/decaf/src/main/decaf/lang/exceptions/InvalidStateException.h
deleted file mode 100644
index 3e64469..0000000
--- a/src/decaf/src/main/decaf/lang/exceptions/InvalidStateException.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_LANG_EXCEPTIONS_INVALIDSTATEEXCEPTION_H_
-#define _DECAF_LANG_EXCEPTIONS_INVALIDSTATEEXCEPTION_H_
-
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace lang{
-namespace exceptions{
-
- /*
- * Thrown when an operation is requested, but the state of the object
- * servicing the request is not correct for that request.
- */
- class DECAF_API InvalidStateException : public Exception
- {
- public:
-
- /**
- * Default Constructor
- */
- InvalidStateException() throw() {}
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- InvalidStateException(const Exception& ex) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- InvalidStateException( const InvalidStateException& ex ) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- InvalidStateException( const char* file,
- const int lineNumber,
- const char* msg, ... ) throw()
- : Exception()
- {
- va_list vargs;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual InvalidStateException* clone() const{
- return new InvalidStateException(*this);
- }
-
- virtual ~InvalidStateException() throw() {}
-
- };
-
-}}}
-
-#endif /*_DECAF_LANG_EXCEPTIONS_INVALIDSTATEEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/lang/exceptions/NoSuchElementException.h b/src/decaf/src/main/decaf/lang/exceptions/NoSuchElementException.h
deleted file mode 100644
index 5dcc04d..0000000
--- a/src/decaf/src/main/decaf/lang/exceptions/NoSuchElementException.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_LANG_EXCEPTIONS_NOSUCHELEMENTEXCEPTION_H_
-#define _DECAF_LANG_EXCEPTIONS_NOSUCHELEMENTEXCEPTION_H_
-
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace lang{
-namespace exceptions{
-
- /*
- * Thrown from an operation that attempts to access some element that does
- * not exist.
- */
- class DECAF_API NoSuchElementException : public Exception
- {
- public:
-
- /**
- * Default Constructor
- */
- NoSuchElementException() throw() {};
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- NoSuchElementException( const Exception& ex ) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- NoSuchElementException( const NoSuchElementException& ex ) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- NoSuchElementException( const char* file,
- const int lineNumber,
- const char* msg, ... ) throw()
- : Exception()
- {
- va_list vargs;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual NoSuchElementException* clone() const{
- return new NoSuchElementException(*this);
- }
-
- virtual ~NoSuchElementException() throw() {}
-
- };
-
-}}}
-
-#endif /*_DECAF_LANG_EXCEPTIONS_NOSUCHELEMENTEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/lang/exceptions/NullPointerException.h b/src/decaf/src/main/decaf/lang/exceptions/NullPointerException.h
deleted file mode 100644
index ce97fc5..0000000
--- a/src/decaf/src/main/decaf/lang/exceptions/NullPointerException.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_EXCEPTIONS_NULLPOINTERENTEXCEPTION_H_
-#define _DECAF_LANG_EXCEPTIONS_NULLPOINTERENTEXCEPTION_H_
-
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace lang{
-namespace exceptions{
-
- /*
- * Thrown when an error occurs that involves a pointer being NULL
- */
- class DECAF_API NullPointerException : public Exception
- {
- public:
-
- /**
- * Default Constructor
- */
- NullPointerException() throw() {};
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- NullPointerException( const Exception& ex ) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- NullPointerException(const NullPointerException& ex) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- NullPointerException( const char* file,
- const int lineNumber,
- const char* msg, ... ) throw()
- : Exception()
- {
- va_list vargs;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual NullPointerException* clone() const{
- return new NullPointerException( *this );
- }
-
- virtual ~NullPointerException() throw() {}
-
- };
-
-}}}
-
-#endif /*_DECAF_LANG_EXCEPTIONS_NULLPOINTERENTEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/lang/exceptions/NumberFormatException.h b/src/decaf/src/main/decaf/lang/exceptions/NumberFormatException.h
deleted file mode 100644
index 56d9bfd..0000000
--- a/src/decaf/src/main/decaf/lang/exceptions/NumberFormatException.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_EXCEPTIONS_NUMBERFORMATEXCEPTION_H_
-#define _DECAF_LANG_EXCEPTIONS_NUMBERFORMATEXCEPTION_H_
-
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace lang{
-namespace exceptions{
-
- /*
- * Thrown when an error occurs that involves a conversion to a Number from
- * a string and the string is not a valid number.
- */
- class NumberFormatException : public Exception
- {
- public:
-
- /**
- * Default Constructor
- */
- NumberFormatException() {}
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- NumberFormatException( const Exception& ex ) throw()
- : Exception() {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- NumberFormatException(const NumberFormatException& ex) throw()
- : Exception() {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- NumberFormatException( const char* file,
- const int lineNumber,
- const char* msg, ... ) throw()
- : Exception() {
- va_list vargs;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual NumberFormatException* clone() const {
- return new NumberFormatException( *this );
- }
-
- virtual ~NumberFormatException() throw () {}
-
- };
-
-}}}
-
-#endif /*_DECAF_LANG_EXCEPTIONS_NUMBERFORMATEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/lang/exceptions/RuntimeException.h b/src/decaf/src/main/decaf/lang/exceptions/RuntimeException.h
deleted file mode 100644
index 7c24f7b..0000000
--- a/src/decaf/src/main/decaf/lang/exceptions/RuntimeException.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_LANG_EXCEPTIONS_RUNTIMEENTEXCEPTION_H_
-#define _DECAF_LANG_EXCEPTIONS_RUNTIMEENTEXCEPTION_H_
-
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace lang{
-namespace exceptions{
-
- /*
- * Thrown when an error occurs that involves something in the run time
- * This could be a memory allocation exception or some other generally
- * unrecoverable exception.
- */
- class DECAF_API RuntimeException : public Exception
- {
- public:
-
- /**
- * Default Constructor
- */
- RuntimeException() throw() {};
-
- /**
- * Conversion Constructor from some other ActiveMQException
- * @param An exception that should become this type of Exception
- */
- RuntimeException( const Exception& ex ) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- RuntimeException( const RuntimeException& ex ) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- RuntimeException( const char* file,
- const int lineNumber,
- const char* msg, ... ) throw()
- : Exception()
- {
- va_list vargs;
- va_start(vargs, msg);
- buildMessage(msg, vargs);
-
- // Set the first mark for this exception.
- setMark(file, lineNumber);
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual RuntimeException* clone() const{
- return new RuntimeException( *this );
- }
-
- virtual ~RuntimeException() throw() {}
-
- };
-
-}}}
-
-#endif /*_DECAF_LANG_EXCEPTIONS_RUNTIMEENTEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/lang/exceptions/UnsupportedOperationException.h b/src/decaf/src/main/decaf/lang/exceptions/UnsupportedOperationException.h
deleted file mode 100644
index 0ce3831..0000000
--- a/src/decaf/src/main/decaf/lang/exceptions/UnsupportedOperationException.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_LANG_EXCEPTIONS_UNSUPPORTEDOPERATIONEXCEPTION_H_
-#define _DECAF_LANG_EXCEPTIONS_UNSUPPORTEDOPERATIONEXCEPTION_H_
-
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace lang{
-namespace exceptions{
-
- /*
- * Thrown when an unsupported method is called.
- */
- class DECAF_API UnsupportedOperationException : public lang::Exception
- {
- public:
-
- /**
- * Default Constructor
- */
- UnsupportedOperationException() throw() {};
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- UnsupportedOperationException( const Exception& ex ) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- UnsupportedOperationException( const UnsupportedOperationException& ex ) throw()
- : Exception()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- UnsupportedOperationException( const char* file,
- const int lineNumber,
- const char* msg, ... ) throw()
- : Exception()
- {
- va_list vargs;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual UnsupportedOperationException* clone() const{
- return new UnsupportedOperationException( *this );
- }
-
- virtual ~UnsupportedOperationException() throw() {}
-
- };
-
-}}}
-
-#endif /*_DECAF_LANG_EXCEPTIONS_UNSUPPORTEDOPERATIONEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/net/BindException.h b/src/decaf/src/main/decaf/net/BindException.h
deleted file mode 100644
index a1fa5e9..0000000
--- a/src/decaf/src/main/decaf/net/BindException.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_BINDEXCEPTION_H_
-#define _DECAF_NET_BINDEXCEPTION_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/net/SocketException.h>
-
-namespace decaf{
-namespace net{
-
- class DECAF_API BindException : public SocketException {
- public:
-
- /**
- * Default Constructor
- */
- BindException() throw() {}
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- BindException( const Exception& ex ) throw()
- : SocketException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- BindException( const BindException& ex ) throw()
- : SocketException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- BindException( const char* file, const int lineNumber,
- const char* msg, ... ) throw ()
- : SocketException()
- {
- va_list vargs ;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual BindException* clone() const {
- return new BindException( *this );
- }
-
- /**
- * Destructor
- */
- virtual ~BindException() throw() {}
-
- };
-
-}}
-
-#endif /*_DECAF_NET_BINDEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/net/BufferedSocket.cpp b/src/decaf/src/main/decaf/net/BufferedSocket.cpp
deleted file mode 100644
index 8f0f7a0..0000000
--- a/src/decaf/src/main/decaf/net/BufferedSocket.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BufferedSocket.h"
-
-#include <decaf/lang/exceptions/IllegalArgumentException.h>
-
-using namespace decaf;
-using namespace decaf::net;
-using namespace decaf::io;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-BufferedSocket::BufferedSocket( Socket* socket,
- int inputBufferSize,
- int outputBufferSize,
- bool own ) :
- socket(NULL),
- own(false),
- inputStream(NULL),
- outputStream(NULL),
- inputBufferSize(0),
- outputBufferSize(0)
-{
- if(inputBufferSize < 0 || outputBufferSize < 0 ) {
- throw IllegalArgumentException(
- __FILE__, __LINE__,
- "BufferedSocket::BufferedSocket - buffer sizes must be >=0! "
- "Given input buffer size: %d, Given output buffer size: %d",
- inputBufferSize,
- outputBufferSize );
- }
-
- if(socket == NULL) {
- throw IllegalArgumentException(
- __FILE__, __LINE__,
- "BufferedSocket::BufferedSocket - Constructed with NULL Socket");
- }
-
- this->socket = socket;
- this->inputBufferSize = inputBufferSize;
- this->outputBufferSize = outputBufferSize;
- this->own = own;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-BufferedSocket::~BufferedSocket() {
- try {
- close();
- }
- DECAF_CATCH_NOTHROW( Exception )
- DECAF_CATCHALL_NOTHROW()
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BufferedSocket::connect( const char* host, int port )
- throw( SocketException ) {
-
- try {
-
- if( socket->isConnected() ) {
- throw SocketException( __FILE__, __LINE__,
- "BufferedSocket::connect() - socket already connected" );
- }
-
- // Connect the socket.
- socket->connect( host, port );
-
- // Now create the buffered streams that wrap around the socket.
- inputStream = new BufferedInputStream(
- socket->getInputStream(), (std::size_t)inputBufferSize );
- outputStream = new BufferedOutputStream(
- socket->getOutputStream(), (std::size_t)outputBufferSize );
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BufferedSocket::close() throw( lang::Exception ) {
-
- try {
-
- if( outputStream != NULL ) {
- // Ensure all data is written
- outputStream->flush();
-
- delete outputStream;
- outputStream = NULL;
- }
-
- if( inputStream != NULL ){
- delete inputStream;
- inputStream = NULL;
- }
-
- if( socket != NULL ){
- // Close the socket
- try{
- socket->close();
- } catch( lang::Exception& ex ){ /* Absorb */ }
-
- // if we own it, delete it.
- if( own ) {
- delete socket;
- }
- socket = NULL;
- }
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
diff --git a/src/decaf/src/main/decaf/net/BufferedSocket.h b/src/decaf/src/main/decaf/net/BufferedSocket.h
deleted file mode 100644
index 313b79c..0000000
--- a/src/decaf/src/main/decaf/net/BufferedSocket.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_NET_BUFFEREDSOCKET_H_
-#define _DECAF_NET_BUFFEREDSOCKET_H_
-
-#include <decaf/net/Socket.h>
-#include <decaf/net/SocketException.h>
-#include <decaf/io/BufferedInputStream.h>
-#include <decaf/io/BufferedOutputStream.h>
-
-namespace decaf{
-namespace net{
-
- /**
- * Buffered Socket class that wraps a <code>Socket</code> derived
- * object and provides Buffered input and Output Streams to improce
- * the efficiency of the reads and writes.
- */
- class DECAF_API BufferedSocket : public Socket
- {
- private:
-
- // Socket that this class wraps to provide buffering
- Socket* socket;
-
- // Indicates if the lifetime of the Socket is controlled by this
- // class. If true Socket is deleted at destruction.
- bool own;
-
- // Buffered Input stream to wrap the Socket input stream
- io::BufferedInputStream* inputStream;
-
- // Buffered Output stream to wrap the Socket input stream
- io::BufferedOutputStream* outputStream;
-
- // Sizes for the Buffered Streams
- int inputBufferSize;
- int outputBufferSize;
-
- public:
-
- /**
- * Constructs a new Buffered socket object
- * @param socket the socket to buffer
- * @param inputBufferSize size of the input buffer
- * @param outputBufferSize size of the output buffer
- * @param own does this object own the passed socket
- */
- BufferedSocket( Socket* socket,
- int inputBufferSize = 1000,
- int outputBufferSize = 1000,
- bool own = true );
-
- virtual ~BufferedSocket();
-
- /**
- * Connects to the specified destination. Closes this socket if
- * connected to another destination.
- * @param host The host of the server to connect to.
- * @param port The port of the server to connect to.
- * @throws IOException Thrown if a failure occurred in the connect.
- */
- virtual void connect( const char* host, int port )
- throw( SocketException );
-
- /**
- * Closes this object and deallocates the appropriate resources.
- * @throws CMSException
- */
- virtual void close() throw( lang::Exception );
-
- /**
- * Indicates whether or not this socket is connected to a destination.
- * @return true if connected
- */
- virtual bool isConnected() const{
- if( socket == NULL ){
- return false;
- }
-
- return socket->isConnected();
- }
-
- /**
- * Gets the InputStream for this socket.
- * @return The InputStream for this socket. NULL if not connected.
- */
- virtual io::InputStream* getInputStream(){
- return inputStream;
- }
-
- /**
- * Gets the OutputStream for this socket.
- * @return the OutputStream for this socket. NULL if not connected.
- */
- virtual io::OutputStream* getOutputStream(){
- return outputStream;
- }
-
- /**
- * Gets the linger time.
- * @return The linger time in seconds.
- * @throws SocketException if the operation fails.
- */
- virtual int getSoLinger() const throw( SocketException ){
- checkSocket();
- return socket->getSoLinger();
- }
-
- /**
- * Sets the linger time.
- * @param linger The linger time in seconds. If 0, linger is off.
- * @throws SocketException if the operation fails.
- */
- virtual void setSoLinger( int linger ) throw( SocketException ){
- checkSocket();
- socket->setSoLinger( linger );
- }
-
- /**
- * Gets the keep alive flag.
- * @return True if keep alive is enabled.
- * @throws SocketException if the operation fails.
- */
- virtual bool getKeepAlive() const throw( SocketException ){
- checkSocket();
- return socket->getKeepAlive();
- }
-
- /**
- * Enables/disables the keep alive flag.
- * @param keepAlive If true, enables the flag.
- * @throws SocketException if the operation fails.
- */
- virtual void setKeepAlive( bool keepAlive ) throw( SocketException ){
- checkSocket();
- socket->setKeepAlive( keepAlive );
- }
-
- /**
- * Gets the receive buffer size.
- * @return the receive buffer size in bytes.
- * @throws SocketException if the operation fails.
- */
- virtual int getReceiveBufferSize() const throw( SocketException ){
- checkSocket();
- return socket->getReceiveBufferSize();
- }
-
- /**
- * Sets the recieve buffer size.
- * @param size Number of bytes to set the receive buffer to.
- * @throws SocketException if the operation fails.
- */
- virtual void setReceiveBufferSize( int size ) throw( SocketException ){
- checkSocket();
- socket->setReceiveBufferSize( size );
- }
-
- /**
- * Gets the reuse address flag.
- * @return True if the address can be reused.
- * @throws SocketException if the operation fails.
- */
- virtual bool getReuseAddress() const throw( SocketException ){
- checkSocket();
- return socket->getReuseAddress();
- }
-
- /**
- * Sets the reuse address flag.
- * @param reuse If true, sets the flag.
- * @throws SocketException if the operation fails.
- */
- virtual void setReuseAddress( bool reuse ) throw( SocketException ){
- checkSocket();
- socket->setReuseAddress( reuse );
- }
-
- /**
- * Gets the send buffer size.
- * @return the size in bytes of the send buffer.
- * @throws SocketException if the operation fails.
- */
- virtual int getSendBufferSize() const throw( SocketException ){
- checkSocket();
- return socket->getSendBufferSize();
- }
-
- /**
- * Sets the send buffer size.
- * @param size The number of bytes to set the send buffer to.
- * @throws SocketException if the operation fails.
- */
- virtual void setSendBufferSize( int size ) throw( SocketException ){
- checkSocket();
- socket->setSendBufferSize( size );
- }
-
- /**
- * Gets the timeout for socket operations.
- * @return The timeout in milliseconds for socket operations.
- * @throws SocketException Thrown if unable to retrieve the information.
- */
- virtual int getSoTimeout() const throw( SocketException ){
- checkSocket();
- return socket->getSoTimeout();
- }
-
- /**
- * Sets the timeout for socket operations.
- * @param timeout The timeout in milliseconds for socket operations.<p>
- * @throws SocketException Thrown if unable to set the information.
- */
- virtual void setSoTimeout( int timeout ) throw( SocketException ){
- checkSocket();
- socket->setSoTimeout( timeout );
- }
-
- private:
-
- void checkSocket() const throw ( SocketException ) {
- if( socket == NULL ) {
- throw SocketException( __FILE__, __LINE__, "socket is NULL" );
- }
- }
-
- };
-
-}}
-
-#endif /*_DECAF_NET_BUFFEREDSOCKET_H_*/
diff --git a/src/decaf/src/main/decaf/net/ConnectException.h b/src/decaf/src/main/decaf/net/ConnectException.h
deleted file mode 100644
index e6f87ea..0000000
--- a/src/decaf/src/main/decaf/net/ConnectException.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_CONNECTEXCEPTION_H_
-#define _DECAF_NET_CONNECTEXCEPTION_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/net/SocketException.h>
-
-namespace decaf{
-namespace net{
-
- class DECAF_API ConnectException : public SocketException {
- public:
-
- /**
- * Default Constructor
- */
- ConnectException() throw() {}
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- ConnectException( const Exception& ex ) throw()
- : SocketException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- ConnectException( const ConnectException& ex ) throw()
- : SocketException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- ConnectException( const char* file, const int lineNumber,
- const char* msg, ... ) throw ()
- : SocketException()
- {
- va_list vargs ;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual ConnectException* clone() const {
- return new ConnectException( *this );
- }
-
- /**
- * Destructor
- */
- virtual ~ConnectException() throw() {}
-
- };
-
-}}
-
-#endif /*_DECAF_NET_CONNECTEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/net/HttpRetryException.h b/src/decaf/src/main/decaf/net/HttpRetryException.h
deleted file mode 100644
index 0074cbc..0000000
--- a/src/decaf/src/main/decaf/net/HttpRetryException.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_HTTPRETRYEXCEPTION_H_
-#define _DECAF_NET_HTTPRETRYEXCEPTION_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/io/IOException.h>
-
-namespace decaf{
-namespace net{
-
- class DECAF_API HttpRetryException : public io::IOException {
- public:
-
- /**
- * Default Constructor
- */
- HttpRetryException() throw() {}
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- HttpRetryException( const Exception& ex ) throw()
- : io::IOException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- HttpRetryException( const HttpRetryException& ex ) throw()
- : io::IOException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- HttpRetryException( const char* file, const int lineNumber,
- const char* msg, ... ) throw ()
- : io::IOException()
- {
- va_list vargs ;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual HttpRetryException* clone() const {
- return new HttpRetryException( *this );
- }
-
- /**
- * Destructor
- */
- virtual ~HttpRetryException() throw() {}
-
- };
-
-}}
-
-#endif /*_DECAF_NET_HTTPRETRYEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/net/MalformedURLException.h b/src/decaf/src/main/decaf/net/MalformedURLException.h
deleted file mode 100644
index e24acd4..0000000
--- a/src/decaf/src/main/decaf/net/MalformedURLException.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_MALFORMEDURLEXCEPTION_H_
-#define _DECAF_NET_MALFORMEDURLEXCEPTION_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/io/IOException.h>
-
-namespace decaf{
-namespace net{
-
- class DECAF_API MalformedURLException : public io::IOException {
- public:
-
- /**
- * Default Constructor
- */
- MalformedURLException() throw() {}
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- MalformedURLException( const Exception& ex ) throw()
- : io::IOException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- MalformedURLException( const MalformedURLException& ex ) throw()
- : io::IOException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- MalformedURLException( const char* file, const int lineNumber,
- const char* msg, ... ) throw ()
- : io::IOException()
- {
- va_list vargs ;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual MalformedURLException* clone() const {
- return new MalformedURLException( *this );
- }
-
- /**
- * Destructor
- */
- virtual ~MalformedURLException() throw() {}
-
- };
-
-}}
-
-#endif /*_DECAF_NET_MALFORMEDURLEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/net/NoRouteToHostException.h b/src/decaf/src/main/decaf/net/NoRouteToHostException.h
deleted file mode 100644
index e8b2b85..0000000
--- a/src/decaf/src/main/decaf/net/NoRouteToHostException.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_NOROUTETOHOSTEXCEPTION_H_
-#define _DECAF_NET_NOROUTETOHOSTEXCEPTION_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/net/SocketException.h>
-
-namespace decaf{
-namespace net{
-
- class DECAF_API NoRouteToHostException : public SocketException {
- public:
-
- /**
- * Default Constructor
- */
- NoRouteToHostException() throw() {}
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- NoRouteToHostException( const Exception& ex ) throw()
- : SocketException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- NoRouteToHostException( const NoRouteToHostException& ex ) throw()
- : SocketException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- NoRouteToHostException( const char* file, const int lineNumber,
- const char* msg, ... ) throw ()
- : SocketException()
- {
- va_list vargs ;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual NoRouteToHostException* clone() const {
- return new NoRouteToHostException( *this );
- }
-
- /**
- * Destructor
- */
- virtual ~NoRouteToHostException() throw() {}
-
- };
-
-}}
-
-#endif /*_DECAF_NET_NOROUTETOHOSTEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/net/PortUnreachableException.h b/src/decaf/src/main/decaf/net/PortUnreachableException.h
deleted file mode 100644
index 937e842..0000000
--- a/src/decaf/src/main/decaf/net/PortUnreachableException.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_PORTUNREACHABLEEXCEPTION_H_
-#define _DECAF_NET_PORTUNREACHABLEEXCEPTION_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/net/SocketException.h>
-
-namespace decaf{
-namespace net{
-
- class DECAF_API PortUnreachableException : public SocketException {
- public:
-
- /**
- * Default Constructor
- */
- PortUnreachableException() throw() {}
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- PortUnreachableException( const Exception& ex ) throw()
- : SocketException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- PortUnreachableException( const PortUnreachableException& ex ) throw()
- : SocketException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- PortUnreachableException( const char* file, const int lineNumber,
- const char* msg, ... ) throw ()
- : SocketException()
- {
- va_list vargs ;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual PortUnreachableException* clone() const {
- return new PortUnreachableException( *this );
- }
-
- /**
- * Destructor
- */
- virtual ~PortUnreachableException() throw() {}
-
- };
-
-}}
-
-#endif /*_DECAF_NET_PORTUNREACHABLEEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/net/ProtocolException.h b/src/decaf/src/main/decaf/net/ProtocolException.h
deleted file mode 100644
index d422bc8..0000000
--- a/src/decaf/src/main/decaf/net/ProtocolException.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_PROTOCOLEXCEPTION_H_
-#define _DECAF_NET_PROTOCOLEXCEPTION_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/io/IOException.h>
-
-namespace decaf{
-namespace net{
-
- class DECAF_API ProtocolException : public io::IOException {
- public:
-
- /**
- * Default Constructor
- */
- ProtocolException() throw() {}
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- ProtocolException( const Exception& ex ) throw()
- : io::IOException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- ProtocolException( const ProtocolException& ex ) throw()
- : io::IOException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- ProtocolException( const char* file, const int lineNumber,
- const char* msg, ... ) throw ()
- : io::IOException()
- {
- va_list vargs ;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual ProtocolException* clone() const {
- return new ProtocolException( *this );
- }
-
- /**
- * Destructor
- */
- virtual ~ProtocolException() throw() {}
-
- };
-
-}}
-
-#endif /*_DECAF_NET_PROTOCOLEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/net/ServerSocket.cpp b/src/decaf/src/main/decaf/net/ServerSocket.cpp
deleted file mode 100644
index 23511fa..0000000
--- a/src/decaf/src/main/decaf/net/ServerSocket.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "ServerSocket.h"
-#include "SocketError.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <assert.h>
-#include <string>
-
-using namespace decaf;
-using namespace decaf::net;
-
-////////////////////////////////////////////////////////////////////////////////
-ServerSocket::ServerSocket() {
- socketHandle = (apr_socket_t*)Socket::INVALID_SOCKET_HANDLE;
- apr_pool_create( &apr_pool, NULL );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-ServerSocket::~ServerSocket() {
- // No shutdown, just close - dont want blocking destructor.
- close();
-
- // Free up the APR pool, this will release any remaining data we
- // allocated but have deallocated.
- apr_pool_destroy( apr_pool );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ServerSocket::bind( const char* host, int port ) throw ( SocketException ) {
- this->bind( host, port, SOMAXCONN );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ServerSocket::bind( const char* host,
- int port,
- int backlog ) throw ( SocketException ) {
-
- apr_status_t result = APR_SUCCESS;
-
- if( isBound() ) {
- throw SocketException ( __FILE__, __LINE__,
- "ServerSocket::bind - Socket already bound" );
- }
-
- // Verify the port value.
- if( port <= 0 || port > 65535 ) {
- throw SocketException(
- __FILE__, __LINE__,
- "ServerSocket::bind - Port out of range: %d", port );
- }
-
- // Create the Address Info for the Socket
- result = apr_sockaddr_info_get(
- &socketAddress, host, APR_INET, port, 0, apr_pool );
-
- if( result != APR_SUCCESS ) {
- socketHandle = (apr_socket_t*)Socket::INVALID_SOCKET_HANDLE;
- throw SocketException(
- __FILE__, __LINE__,
- SocketError::getErrorString().c_str() );
- }
-
- // Create the socket.
- result = apr_socket_create(
- &socketHandle, APR_INET, SOCK_STREAM, APR_PROTO_TCP, apr_pool );
-
- if( result != APR_SUCCESS ) {
- socketHandle = (apr_socket_t*)Socket::INVALID_SOCKET_HANDLE;
- throw SocketException(
- __FILE__, __LINE__,
- SocketError::getErrorString().c_str() );
- }
-
- // Set the socket to reuse the address and default as blocking
- apr_socket_opt_set( socketHandle, APR_SO_REUSEADDR, 1 );
- apr_socket_opt_set( socketHandle, APR_SO_NONBLOCK, 0);
- apr_socket_timeout_set( socketHandle, -1 );
-
- // Bind to the Socket, this may be where we find out if the port is in use.
- result = apr_socket_bind( socketHandle, socketAddress );
-
- if( result != APR_SUCCESS ) {
- close();
- throw SocketException(
- __FILE__, __LINE__,
- "ServerSocket::bind - %s",
- SocketError::getErrorString().c_str() );
- }
-
- // Setup the listen for incoming connection requests
- result = apr_socket_listen( socketHandle, backlog );
-
- if( result != APR_SUCCESS ) {
- close();
- throw SocketException(
- __FILE__, __LINE__,
- "ServerSocket::bind - %s",
- SocketError::getErrorString().c_str() );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ServerSocket::close() throw ( lang::Exception ){
-
- if( isBound() ) {
- apr_socket_close( socketHandle );
- socketHandle = (apr_socket_t*)Socket::INVALID_SOCKET_HANDLE;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool ServerSocket::isBound() const {
- return this->socketHandle != (apr_socket_t*)Socket::INVALID_SOCKET_HANDLE;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Socket* ServerSocket::accept() throw (SocketException)
-{
- SocketHandle incoming = NULL;
- apr_status_t result = APR_SUCCESS;
-
- // Loop to ignore any signal interruptions that occur during the operation.
- do {
- result = apr_socket_accept( &incoming, socketHandle, apr_pool );
- } while( result == APR_EINTR );
-
- if( result != APR_SUCCESS ) {
- std::cout << "Failed to accept New Connection:" << std::endl;
- throw SocketException(
- __FILE__, __LINE__,
- "ServerSocket::accept - %s",
- SocketError::getErrorString().c_str() );
- }
-
- return new TcpSocket( incoming );
-}
diff --git a/src/decaf/src/main/decaf/net/ServerSocket.h b/src/decaf/src/main/decaf/net/ServerSocket.h
deleted file mode 100644
index ccff54e..0000000
--- a/src/decaf/src/main/decaf/net/ServerSocket.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_NET_SERVERSOCKETIMPL_H_
-#define _DECAF_NET_SERVERSOCKETIMPL_H_
-
-#include <decaf/net/TcpSocket.h>
-#include <decaf/net/SocketException.h>
-#include <decaf/util/Config.h>
-
-#include <apr_pools.h>
-#include <apr_network_io.h>
-
-namespace decaf{
-namespace net{
-
- /**
- * A server socket class (for testing purposes).
- */
- class DECAF_API ServerSocket
- {
- public:
-
- typedef apr_socket_t* SocketHandle;
- typedef apr_sockaddr_t* SocketAddress;
-
- private:
-
- SocketHandle socketHandle;
- SocketAddress socketAddress;
- apr_pool_t* apr_pool;
-
- public:
-
- /**
- * Constructor.
- * Creates a non-bound server socket.
- */
- ServerSocket();
-
- /**
- * Destructor.
- * Releases socket handle if close() hasn't been called.
- */
- virtual ~ServerSocket();
-
- public:
-
- /**
- * Bind and listen to given IP/dns and port.
- * @param host IP address or host name.
- * @param port TCP port between 1..655535
- */
- virtual void bind( const char* host, int port ) throw ( SocketException );
-
- /**
- * Bind and listen to given IP/dns and port.
- * @param host IP address or host name.
- * @param port TCP port between 1..655535
- * @param backlog Size of listen backlog.
- */
- virtual void bind( const char* host,
- int port,
- int backlog ) throw ( SocketException );
-
- /**
- * Blocks until a client connects to the bound socket.
- * @return new socket. Never returns NULL.
- */
- virtual Socket* accept () throw ( SocketException );
-
- /**
- * Closes the server socket.
- */
- virtual void close() throw( lang::Exception );
-
- /**
- * @return true of the server socket is bound.
- */
- virtual bool isBound() const;
-
- };
-
-}}
-
-#endif // _DECAF_NET_SERVERSOCKETIMPL_H_
-
diff --git a/src/decaf/src/main/decaf/net/Socket.h b/src/decaf/src/main/decaf/net/Socket.h
deleted file mode 100644
index 106428d..0000000
--- a/src/decaf/src/main/decaf/net/Socket.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_NET_SOCKET_H_
-#define _DECAF_NET_SOCKET_H_
-
-#include <decaf/net/SocketException.h>
-#include <decaf/io/InputStream.h>
-#include <decaf/io/OutputStream.h>
-#include <decaf/io/Closeable.h>
-#include <decaf/util/Config.h>
-
-#include <apr_network_io.h>
-
-namespace decaf{
-namespace net{
-
- class DECAF_API Socket : public decaf::io::Closeable
- {
- public:
-
- /**
- * Define the SocketHandle type.
- */
- typedef apr_socket_t* SocketHandle;
-
- /**
- * Define the SocketAddress type
- */
- typedef apr_sockaddr_t* SocketAddress;
-
- /**
- * Defines a constant for an invalid socket handle.
- */
- static const int INVALID_SOCKET_HANDLE = 0;
-
- public:
-
- virtual ~Socket() {}
-
- /**
- * Connects to the specified destination. Closes this socket if
- * connected to another destination.
- * @param host The host of the server to connect to.
- * @param port The port of the server to connect to.
- * @throws IOException Thrown if a failure occurred in the connect.
- */
- virtual void connect( const char* host, int port )
- throw(SocketException) = 0;
-
- /**
- * Indicates whether or not this socket is connected to a destination.
- * @returns true if connected
- */
- virtual bool isConnected() const = 0;
-
- /**
- * Gets the InputStream for this socket.
- * @return The InputStream for this socket. NULL if not connected.
- */
- virtual io::InputStream* getInputStream() = 0;
-
- /**
- * Gets the OutputStream for this socket.
- * @return the OutputStream for this socket. NULL if not connected.
- */
- virtual io::OutputStream* getOutputStream() = 0;
-
- /**
- * Gets the linger time.
- * @return The linger time in seconds.
- * @throws SocketException if the operation fails.
- */
- virtual int getSoLinger() const throw( SocketException ) = 0;
-
- /**
- * Sets the linger time.
- * @param linger The linger time in seconds. If 0, linger is off.
- * @throws SocketException if the operation fails.
- */
- virtual void setSoLinger( int linger ) throw( SocketException ) = 0;
-
- /**
- * Gets the keep alive flag.
- * @return True if keep alive is enabled.
- * @throws SocketException if the operation fails.
- */
- virtual bool getKeepAlive() const throw( SocketException ) = 0;
-
- /**
- * Enables/disables the keep alive flag.
- * @param keepAlive If true, enables the flag.
- * @throws SocketException if the operation fails.
- */
- virtual void setKeepAlive( bool keepAlive ) throw( SocketException ) = 0;
-
- /**
- * Gets the receive buffer size.
- * @return the receive buffer size in bytes.
- * @throws SocketException if the operation fails.
- */
- virtual int getReceiveBufferSize() const throw( SocketException ) = 0;
-
- /**
- * Sets the recieve buffer size.
- * @param size Number of bytes to set the receive buffer to.
- * @throws SocketException if the operation fails.
- */
- virtual void setReceiveBufferSize( int size ) throw( SocketException ) = 0;
-
- /**
- * Gets the reuse address flag.
- * @return True if the address can be reused.
- * @throws SocketException if the operation fails.
- */
- virtual bool getReuseAddress() const throw( SocketException ) = 0;
-
- /**
- * Sets the reuse address flag.
- * @param reuse If true, sets the flag.
- * @throws SocketException if the operation fails.
- */
- virtual void setReuseAddress( bool reuse ) throw( SocketException ) = 0;
-
- /**
- * Gets the send buffer size.
- * @return the size in bytes of the send buffer.
- * @throws SocketException if the operation fails.
- */
- virtual int getSendBufferSize() const throw( SocketException ) = 0;
-
- /**
- * Sets the send buffer size.
- * @param size The number of bytes to set the send buffer to.
- * @throws SocketException if the operation fails.
- */
- virtual void setSendBufferSize( int size ) throw( SocketException ) = 0;
-
- /**
- * Gets the timeout for socket operations.
- * @return The timeout in milliseconds for socket operations.
- * @throws SocketException Thrown if unable to retrieve the information.
- */
- virtual int getSoTimeout() const throw( SocketException ) = 0;
-
- /**
- * Sets the timeout for socket operations.
- * @param timeout The timeout in milliseconds for socket operations.<p>
- * @throws SocketException Thrown if unable to set the information.
- */
- virtual void setSoTimeout( int timeout ) throw( SocketException ) = 0;
-
- };
-
-}}
-
-#endif /*_DECAF_NET_SOCKET_H_*/
diff --git a/src/decaf/src/main/decaf/net/SocketError.cpp b/src/decaf/src/main/decaf/net/SocketError.cpp
deleted file mode 100644
index e601b0d..0000000
--- a/src/decaf/src/main/decaf/net/SocketError.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "SocketError.h"
-#include <decaf/util/Config.h>
-
-using namespace decaf;
-using namespace decaf::net;
-
-////////////////////////////////////////////////////////////////////////////////
-int SocketError::getErrorCode() {
- return apr_get_netos_error();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string SocketError::getErrorString() {
-
- std::string returnValue;
-
- // Get the error code.
- apr_status_t errorCode = apr_get_netos_error();
-
- // Create a buffer and get the error
- char buffer[256];
- return apr_strerror( errorCode, buffer, sizeof( buffer ) );
-}
diff --git a/src/decaf/src/main/decaf/net/SocketError.h b/src/decaf/src/main/decaf/net/SocketError.h
deleted file mode 100644
index e9152aa..0000000
--- a/src/decaf/src/main/decaf/net/SocketError.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_SOCKETERROR_H_
-#define _DECAF_NET_SOCKETERROR_H_
-
-#include <string>
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace net{
-
- /**
- * Static utility class to simplify handling of error codes
- * for socket operations.
- */
- class DECAF_API SocketError {
- public:
-
- /**
- * Gets the last error appropriate for the platform.
- */
- static int getErrorCode();
-
- /**
- * Gets the string description for the last error.
- */
- static std::string getErrorString();
- };
-
-}}
-
-#endif /*_DECAF_NET_SOCKETERROR_H_*/
diff --git a/src/decaf/src/main/decaf/net/SocketException.h b/src/decaf/src/main/decaf/net/SocketException.h
deleted file mode 100644
index 8933f31..0000000
--- a/src/decaf/src/main/decaf/net/SocketException.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_NET_SOCKETEXCEPTION_H_
-#define _DECAF_NET_SOCKETEXCEPTION_H_
-
-#include <decaf/io/IOException.h>
-
-namespace decaf{
-namespace net{
-
- /**
- * Exception for errors when manipulating sockets.
- */
- class DECAF_API SocketException : public io::IOException
- {
- public:
-
- SocketException() throw() {}
-
- SocketException( const lang::Exception& ex ) throw()
- : io::IOException() {
- *(lang::Exception*)this = ex;
- }
-
- SocketException( const SocketException& ex ) throw()
- : io::IOException() {
- *(lang::Exception*)this = ex;
- }
-
- SocketException( const char* file, const int lineNumber,
- const char* msg, ...) throw()
- : io::IOException() {
- va_list vargs;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual SocketException* clone() const {
- return new SocketException( *this );
- }
-
- virtual ~SocketException() throw() {}
-
- };
-
-}}
-
-
-#endif // _DECAF_NET_SOCKETEXCEPTION_H_
-
diff --git a/src/decaf/src/main/decaf/net/SocketFactory.cpp b/src/decaf/src/main/decaf/net/SocketFactory.cpp
deleted file mode 100644
index c00d320..0000000
--- a/src/decaf/src/main/decaf/net/SocketFactory.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <decaf/net/SocketFactory.h>
-#include <decaf/net/BufferedSocket.h>
-#include <decaf/net/TcpSocket.h>
-#include <decaf/util/Properties.h>
-#include <stdio.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::util;
-using namespace decaf::net;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-Socket* SocketFactory::createSocket(
- const std::string& uri,
- const Properties& properties)
- throw ( SocketException ) {
-
- try {
-
- // Ensure something is actually passed in for the URI
- if( uri == "" ) {
- throw SocketException( __FILE__, __LINE__,
- "SocketTransport::start() - uri not provided" );
- }
-
- string dummy = uri;
-
- // Extract the port.
- std::size_t portIx = dummy.find( ':' );
- if( portIx == string::npos ) {
- throw SocketException( __FILE__, __LINE__,
- "SocketTransport::start() - uri malformed - port not specified: %s", uri.c_str() );
- }
- string host = dummy.substr( 0, portIx );
- string portString = dummy.substr( portIx + 1 );
- int port;
- if( sscanf( portString.c_str(), "%d", &port) != 1 ) {
- throw SocketException( __FILE__, __LINE__,
- "SocketTransport::start() - unable to extract port from uri: %s", uri.c_str() );
- }
-
- // Get the read buffer size.
- int inputBufferSize = 10000;
- dummy = properties.getProperty( "inputBufferSize", "10000" );
- sscanf( dummy.c_str(), "%d", &inputBufferSize );
-
- // Get the write buffer size.
- int outputBufferSize = 10000;
- dummy = properties.getProperty( "outputBufferSize", "10000" );
- sscanf( dummy.c_str(), "%d", &outputBufferSize );
-
- // Get the linger flag.
- int soLinger = 0;
- dummy = properties.getProperty( "soLinger", "0" );
- sscanf( dummy.c_str(), "%d", &soLinger );
-
- // Get the keepAlive flag.
- bool soKeepAlive =
- properties.getProperty( "soKeepAlive", "false" ) == "true";
-
- // Get the socket receive buffer size.
- int soReceiveBufferSize = -1;
- dummy = properties.getProperty( "soReceiveBufferSize", "-1" );
- sscanf( dummy.c_str(), "%d", &soReceiveBufferSize );
-
- // Get the socket send buffer size.
- int soSendBufferSize = -1;
- dummy = properties.getProperty( "soSendBufferSize", "-1" );
- sscanf( dummy.c_str(), "%d", &soSendBufferSize );
-
- // Get the socket TCP_NODELAY flag.
- bool tcpNoDelay =
- properties.getProperty( "tcpNoDelay", "true" ) == "true";
-
- // Now that we have all the elements that we wanted - let's do it!
- // Create a TCP Socket and then Wrap it in a buffered socket
- // so that users get the benefit of buffered reads and writes.
- // The buffered socket will own the TcpSocket instance, and will
- // clean it up when it is cleaned up.
- TcpSocket* tcpSocket = new TcpSocket();
-
- try {
-
- // Connect the socket.
- tcpSocket->connect( host.c_str(), port );
-
- // Set the socket options.
- tcpSocket->setSoLinger( soLinger );
- tcpSocket->setKeepAlive( soKeepAlive );
- tcpSocket->setTcpNoDelay( tcpNoDelay );
-
- if( soReceiveBufferSize > 0 ){
- tcpSocket->setReceiveBufferSize( soReceiveBufferSize );
- }
-
- if( soSendBufferSize > 0 ){
- tcpSocket->setSendBufferSize( soSendBufferSize );
- }
- } catch ( SocketException& ex ) {
- ex.setMark( __FILE__, __LINE__ );
- try{
- delete tcpSocket;
- } catch( SocketException& ex2 ){ /* Absorb */ }
-
- throw ex;
- }
-
- return tcpSocket;
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
diff --git a/src/decaf/src/main/decaf/net/SocketFactory.h b/src/decaf/src/main/decaf/net/SocketFactory.h
deleted file mode 100644
index ce5c5e3..0000000
--- a/src/decaf/src/main/decaf/net/SocketFactory.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_NET_SOCKETFACTORY_H_
-#define _DECAF_NET_SOCKETFACTORY_H_
-
-#include <decaf/net/SocketException.h>
-#include <decaf/util/Properties.h>
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace net{
-
- class Socket;
-
- /**
- * Socket Factory implementation for use in Creating Sockets
- * <p>
- * <p>
- * Property Options: <p>
- * Name Value <p>
- * ------------------------------------- <p>
- * inputBufferSize size in bytes of the buffered input stream buffer. Defaults to 10000.<p>
- * outputBufferSize size in bytes of the buffered output stream buffer. Defaults to 10000.<p>
- * soLinger linger time for the socket (in microseconds). Defaults to 0.<p>
- * soKeepAlive keep alive flag for the socket (true/false). Defaults to false.<p>
- * soReceiveBufferSize The size of the socket receive buffer (in bytes). Defaults to 2MB.<p>
- * soSendBufferSize The size of the socket send buffer (in bytes). Defaults to 2MB.<p>
- * soTimeout The timeout of socket IO operations (in microseconds). Defaults to 10000<p>
- *
- * @see <code>Socket</code>
- */
- class DECAF_API SocketFactory
- {
- public:
-
- virtual ~SocketFactory();
-
- /**
- * Creates and returns a Socket dervied Object based on the values
- * defined in the Properties Object that is passed in.
- * @param the URI for the Socket Connection.
- * @param properties a IProperties pointer.
- * @throws SocketException.
- */
- static Socket* createSocket( const std::string& uri,
- const util::Properties& properties )
- throw ( SocketException );
-
- };
-
-}}
-
-#endif /*_DECAF_NET_SOCKETFACTORY_H_*/
diff --git a/src/decaf/src/main/decaf/net/SocketInputStream.cpp b/src/decaf/src/main/decaf/net/SocketInputStream.cpp
deleted file mode 100644
index 9219768..0000000
--- a/src/decaf/src/main/decaf/net/SocketInputStream.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <decaf/util/Config.h>
-
-#if !defined(HAVE_WINSOCK2_H)
- #include <sys/select.h>
- #include <sys/socket.h>
-#else
- #include <Winsock2.h>
-#endif
-
-#ifdef HAVE_SYS_IOCTL_H
-#define BSD_COMP /* Get FIONREAD on Solaris2. */
-#include <sys/ioctl.h>
-#endif
-
-// Pick up FIONREAD on Solaris 2.5.
-#ifdef HAVE_SYS_FILIO_H
-#include <sys/filio.h>
-#endif
-
-#include <decaf/net/SocketInputStream.h>
-#include <decaf/net/SocketError.h>
-#include <decaf/io/IOException.h>
-#include <decaf/lang/Character.h>
-#include <decaf/lang/exceptions/UnsupportedOperationException.h>
-#include <stdlib.h>
-#include <string>
-#include <stdio.h>
-#include <iostream>
-
-#include <apr_portable.h>
-
-using namespace decaf;
-using namespace decaf::net;
-using namespace decaf::io;
-using namespace decaf::util;
-using namespace decaf::lang;
-using namespace std;
-
-////////////////////////////////////////////////////////////////////////////////
-SocketInputStream::SocketInputStream( net::Socket::SocketHandle socket ) {
- this->socket = socket;
- this->closed = false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-SocketInputStream::~SocketInputStream(){}
-
-////////////////////////////////////////////////////////////////////////////////
-void SocketInputStream::close() throw( lang::Exception ){
- this->closed = true;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::size_t SocketInputStream::available() const throw ( io::IOException ){
-
- // Convert to an OS level socket.
- apr_os_sock_t* oss = NULL;
- apr_os_sock_get( oss, socket );
-
-// The windows version
-#if defined(HAVE_WINSOCK2_H)
-
- unsigned long numBytes = 0;
-
- if( ::ioctlsocket( *oss, FIONREAD, &numBytes ) == SOCKET_ERROR ){
- throw SocketException( __FILE__, __LINE__, "ioctlsocket failed" );
- }
-
- return (std::size_t)numBytes;
-
-#else // !defined(HAVE_WINSOCK2_H)
-
- // If FIONREAD is defined - use ioctl to find out how many bytes
- // are available.
- #if defined(FIONREAD)
-
- std::size_t numBytes = 0;
- if( ::ioctl( *oss, FIONREAD, &numBytes ) != -1 ){
- return numBytes;
- }
-
- #endif
-
- // If we didn't get anything we can use select. This is a little
- // less functional. We will poll on the socket - if there is data
- // available, we'll return 1, otherwise we'll return zero.
- #if defined(HAVE_SELECT)
-
- fd_set rd;
- FD_ZERO(&rd);
- FD_SET( *oss, &rd );
- struct timeval tv;
- tv.tv_sec = 0;
- tv.tv_usec = 0;
- int returnCode = ::select( *oss+1, &rd, NULL, NULL, &tv );
- if( returnCode == -1 ){
- throw IOException(
- __FILE__, __LINE__,
- SocketError::getErrorString().c_str() );
- }
- return (returnCode == 0) ? 0 : 1;
-
- #else
-
- return 0;
-
- #endif /* HAVE_SELECT */
-
-#endif // !defined(HAVE_WINSOCK2_H)
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned char SocketInputStream::read() throw ( IOException ){
-
- apr_status_t result = APR_SUCCESS;
- char c;
- apr_size_t size = 1;
-
- result = apr_socket_recv( socket, &c, &size );
-
- if( ( size != sizeof(c) && !closed ) || result != APR_SUCCESS ){
- throw IOException( __FILE__, __LINE__,
- "activemq::io::SocketInputStream::read - failed reading a byte");
- }
-
- return c;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int SocketInputStream::read( unsigned char* buffer,
- std::size_t bufferSize ) throw ( IOException )
-{
- apr_size_t size = (apr_size_t)bufferSize;
- apr_status_t result = APR_SUCCESS;
-
- // Read data from the socket, size on input is size of buffer, when done
- // size is the number of bytes actually read, can be <= bufferSize.
- result = apr_socket_recv( socket, (char*)buffer, &size );
-
- // Check for EOF, on windows we only get size==0 so check that to, if we
- // were closed though then we throw an IOException so the caller knows we
- // aren't usable anymore.
- if( ( APR_STATUS_IS_EOF( result ) || size == 0 ) && !closed ) {
- return -1;
- }
-
- // Check for a closed call from socket class, if closed then this read fails.
- if( closed ){
- throw IOException(
- __FILE__, __LINE__,
- "activemq::io::SocketInputStream::read - The connection is broken" );
- }
-
- // Check for error.
- if( result != APR_SUCCESS ){
- throw IOException(
- __FILE__, __LINE__,
- "decaf::net::SocketInputStream::read - %s",
- SocketError::getErrorString().c_str() );
- }
-
- return size;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::size_t SocketInputStream::skip( std::size_t num DECAF_UNUSED )
- throw ( io::IOException, lang::exceptions::UnsupportedOperationException ) {
-
- throw lang::exceptions::UnsupportedOperationException(
- __FILE__, __LINE__,
- "SocketInputStream::skip() method is not supported");
-}
-
diff --git a/src/decaf/src/main/decaf/net/SocketInputStream.h b/src/decaf/src/main/decaf/net/SocketInputStream.h
deleted file mode 100644
index ae3bbd0..0000000
--- a/src/decaf/src/main/decaf/net/SocketInputStream.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_SOCKETINPUTSTREAM_H_
-#define _DECAF_NET_SOCKETINPUTSTREAM_H_
-
-#include <decaf/io/InputStream.h>
-#include <decaf/net/Socket.h>
-#include <decaf/util/concurrent/Mutex.h>
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace net{
-
- /**
- * Input stream for performing reads on a socket. This
- * class will only work properly for blocking sockets.
- */
- class DECAF_API SocketInputStream : public io::InputStream {
- private:
-
- // The socket handle.
- Socket::SocketHandle socket;
- util::concurrent::Mutex mutex;
- bool closed;
-
- public:
-
- /**
- * Constructor.
- * @param socket the socket handle.
- */
- SocketInputStream( Socket::SocketHandle socket );
-
- /**
- * Destructor.
- */
- virtual ~SocketInputStream();
-
- /**
- * Locks the object.
- * @throws Exception
- */
- virtual void lock() throw( lang::Exception ){
- mutex.lock();
- }
-
- /**
- * Unlocks the object.
- * @throws Exception
- */
- virtual void unlock() throw( lang::Exception ){
- mutex.unlock();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void wait() throw( lang::Exception ){
- mutex.wait();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param millisecs time in millisecsonds to wait, or WAIT_INIFINITE
- * @throws Exception
- */
- virtual void wait( unsigned long millisecs )
- throw( lang::Exception ) {
-
- mutex.wait( millisecs );
- }
-
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notify() throw( lang::Exception ){
- mutex.notify();
- }
-
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notifyAll() throw( lang::Exception ){
- mutex.notifyAll();
- }
-
- /**
- * Returns the number of bytes available on the socket to
- * be read right now.
- * @return The number of bytes currently available to
- * be read on the socket.
- */
- virtual std::size_t available() const throw ( io::IOException );
-
- /**
- * Reads a single byte from the buffer. If no data
- * is available, blocks until their is.
- * @return The next byte.
- * @throws IOException thrown if an error occurs.
- */
- virtual unsigned char read() throw ( io::IOException );
-
- /**
- * Reads an array of bytes from the buffer. If no data
- * is available, blocks until there is.
- * @param buffer (out) the target buffer.
- * @param bufferSize the size of the output buffer.
- * @return The number of bytes read.
- * @throws IOException thrown if an error occurs.
- */
- virtual int read( unsigned char* buffer,
- std::size_t bufferSize )
- throw ( io::IOException );
-
- /**
- * Close - does nothing. It is the responsibility of the owner
- * of the socket object to close it.
- * @throws CMSException
- */
- virtual void close() throw( lang::Exception );
-
- /**
- * Not supported.
- * @throws an UnsupportedOperationException.
- */
- virtual std::size_t skip( std::size_t num )
- throw ( io::IOException,
- lang::exceptions::UnsupportedOperationException );
-
- };
-
-}}
-
-#endif /*_DECAF_NET_SOCKETINPUTSTREAM_H_*/
diff --git a/src/decaf/src/main/decaf/net/SocketOutputStream.cpp b/src/decaf/src/main/decaf/net/SocketOutputStream.cpp
deleted file mode 100644
index fde0aa1..0000000
--- a/src/decaf/src/main/decaf/net/SocketOutputStream.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "SocketOutputStream.h"
-#include <decaf/util/Config.h>
-#include <decaf/lang/Character.h>
-#include "SocketError.h"
-
-using namespace decaf;
-using namespace decaf::net;
-using namespace decaf::io;
-using namespace decaf::util;
-using namespace std;
-
-////////////////////////////////////////////////////////////////////////////////
-SocketOutputStream::SocketOutputStream( Socket::SocketHandle socket ) {
- this->socket = socket;
- this->closed = false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-SocketOutputStream::~SocketOutputStream() {
- close();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SocketOutputStream::close() throw( lang::Exception ) {
- this->closed = true;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SocketOutputStream::write( unsigned char c ) throw ( IOException ) {
- write( &c, 1 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SocketOutputStream::write( const unsigned char* buffer, std::size_t len )
- throw ( IOException ) {
-
- apr_size_t remaining = (apr_size_t)len;
- apr_status_t result = APR_SUCCESS;
-
- while( remaining > 0 && !closed ) {
- // On input remaining is the bytes to send, after return remaining
- // is the amount actually sent.
- result = apr_socket_send( socket, (const char*)buffer, &remaining );
-
- if( result != APR_SUCCESS || closed ) {
- throw IOException(
- __FILE__, __LINE__,
- "decaf::net::SocketOutputStream::write - %s",
- SocketError::getErrorString().c_str() );
- }
-
- // move us to next position to write, or maybe end.
- buffer += remaining;
- remaining = len - remaining;
- }
-}
diff --git a/src/decaf/src/main/decaf/net/SocketOutputStream.h b/src/decaf/src/main/decaf/net/SocketOutputStream.h
deleted file mode 100644
index 49e1e2d..0000000
--- a/src/decaf/src/main/decaf/net/SocketOutputStream.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_SOCKETOUTPUTSTREAM_H_
-#define _DECAF_NET_SOCKETOUTPUTSTREAM_H_
-
-#include <decaf/io/OutputStream.h>
-#include <decaf/net/Socket.h>
-#include <decaf/util/concurrent/Mutex.h>
-
-namespace decaf{
-namespace net{
-
- /**
- * Output stream for performing write operations
- * on a socket.
- */
- class DECAF_API SocketOutputStream : public io::OutputStream {
- private:
-
- // The socket.
- Socket::SocketHandle socket;
- util::concurrent::Mutex mutex;
- bool closed;
-
- public:
-
- /**
- * Constructor.
- * @param socket the socket handle.
- */
- SocketOutputStream( Socket::SocketHandle socket );
-
- virtual ~SocketOutputStream();
-
- /**
- * Locks the object.
- * @throws Exception
- */
- virtual void lock() throw( lang::Exception ){
- mutex.lock();
- }
-
- /**
- * Unlocks the object.
- * @throws Exception
- */
- virtual void unlock() throw( lang::Exception ){
- mutex.unlock();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void wait() throw( lang::Exception ){
- mutex.wait();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param millisecs time in millisecsonds to wait, or WAIT_INIFINITE
- * @throws Exception
- */
- virtual void wait( unsigned long millisecs )
- throw( lang::Exception ) {
-
- mutex.wait( millisecs );
- }
-
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notify() throw( lang::Exception ){
- mutex.notify();
- }
-
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- */
- virtual void notifyAll() throw( lang::Exception ){
- mutex.notifyAll();
- }
-
- /**
- * Writes a single byte to the output stream.
- * @param c the byte.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( unsigned char c ) throw ( io::IOException );
-
- /**
- * Writes an array of bytes to the output stream.
- * @param buffer The array of bytes to write.
- * @param len The number of bytes from the buffer to be written.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( const unsigned char* buffer,
- std::size_t len ) throw ( io::IOException );
-
- /**
- * Flush - does nothing.
- * @throws IOException
- */
- virtual void flush() throw ( io::IOException ){};
-
- /**
- * Close - does nothing. It is the responsibility of the owner
- * of the socket object to close it.
- * @throws CMSException
- */
- virtual void close() throw( lang::Exception );
-
- };
-
-}}
-
-#endif /*_DECAF_NET_SOCKETOUTPUTSTREAM_H_*/
diff --git a/src/decaf/src/main/decaf/net/SocketTimeoutException.h b/src/decaf/src/main/decaf/net/SocketTimeoutException.h
deleted file mode 100644
index 16e23b2..0000000
--- a/src/decaf/src/main/decaf/net/SocketTimeoutException.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_SOCKETTIMEOUTEXCEPTION_H_
-#define _DECAF_NET_SOCKETTIMEOUTEXCEPTION_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/io/InterruptedIOException.h>
-
-namespace decaf{
-namespace net{
-
- class DECAF_API SocketTimeoutException : public io::InterruptedIOException {
- public:
-
- /**
- * Default Constructor
- */
- SocketTimeoutException() throw() {}
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- SocketTimeoutException( const Exception& ex ) throw()
- : io::InterruptedIOException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- SocketTimeoutException( const SocketTimeoutException& ex ) throw()
- : io::InterruptedIOException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- SocketTimeoutException( const char* file, const int lineNumber,
- const char* msg, ... ) throw ()
- : io::InterruptedIOException()
- {
- va_list vargs ;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual SocketTimeoutException* clone() const {
- return new SocketTimeoutException( *this );
- }
-
- /**
- * Destructor
- */
- virtual ~SocketTimeoutException() throw() {}
-
- };
-
-}}
-
-#endif /*_DECAF_NET_SOCKETTIMEOUTEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/net/TcpSocket.cpp b/src/decaf/src/main/decaf/net/TcpSocket.cpp
deleted file mode 100644
index 9eb0195..0000000
--- a/src/decaf/src/main/decaf/net/TcpSocket.cpp
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <decaf/util/Config.h>
-
-#include "TcpSocket.h"
-#include "SocketInputStream.h"
-#include "SocketOutputStream.h"
-#include "SocketError.h"
-
-using namespace decaf;
-using namespace decaf::net;
-using namespace decaf::io;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-TcpSocket::TcpSocket() throw ( SocketException )
- : apr_pool( NULL ),
- socketHandle( INVALID_SOCKET_HANDLE ),
- inputStream( NULL ),
- outputStream( NULL ) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-TcpSocket::TcpSocket( SocketHandle socketHandle )
- : apr_pool( NULL ),
- socketHandle( INVALID_SOCKET_HANDLE ),
- inputStream( NULL ),
- outputStream( NULL ) {
-
- try {
-
- this->socketHandle = socketHandle;
- this->inputStream = new SocketInputStream( socketHandle );
- this->outputStream = new SocketOutputStream( socketHandle );
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-TcpSocket::~TcpSocket() {
- // No shutdown, just close - dont want blocking destructor.
- close();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-InputStream* TcpSocket::getInputStream(){
- return inputStream;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-OutputStream* TcpSocket::getOutputStream(){
- return outputStream;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::connect(const char* host, int port) throw ( SocketException ) {
-
- try{
-
- if( isConnected() ) {
- throw SocketException( __FILE__, __LINE__,
- "Socket::connect - Socket already connected. host: %s, port: %d", host, port );
- }
-
- // Create the APR Pool
- apr_pool_create( &apr_pool, NULL );
-
- // Create the Address data
- checkResult( apr_sockaddr_info_get(
- &socketAddress, host, APR_INET, port, 0, apr_pool ) );
-
- // Create the actual socket.
- checkResult( apr_socket_create(
- &socketHandle, socketAddress->family, SOCK_STREAM, APR_PROTO_TCP, apr_pool ) );
-
- // it is a good idea to specify socket options explicitly. in this
- // case, we make a blocking socket with system timeout, this should allow us
- // the time needed to connect to the socket before returning, but not
- // block us forever waiting if there isn't anyone there. Some poeple
- // say that you shouldn't use this mode as its an OS timeout that is not
- // controllable, if this becomes an issue, we should decide on what a
- // reasonable timeout should be and set it here.
- apr_socket_opt_set( socketHandle, APR_SO_NONBLOCK, 0 );
- apr_socket_timeout_set( socketHandle, -1 );
-
- checkResult( apr_socket_connect( socketHandle, socketAddress ) );
-
- // Now that we are connected, we want to set ourself up as a blocking
- // socket by default.
- apr_socket_opt_set( socketHandle, APR_SO_NONBLOCK, 0 );
- apr_socket_timeout_set( socketHandle, -1 );
-
- // Create an input/output stream for this socket.
- inputStream = new SocketInputStream( socketHandle );
- outputStream = new SocketOutputStream( socketHandle );
-
- } catch( SocketException& ex ) {
- ex.setMark( __FILE__, __LINE__);
- try{ close(); } catch( lang::Exception& cx){ /* Absorb */ }
- throw ex;
- } catch( ... ) {
- try{ close(); } catch( lang::Exception& cx){ /* Absorb */ }
- throw SocketException(
- __FILE__, __LINE__,
- "TcpSocket::connect() - caught unknown exception" );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::close() throw( lang::Exception )
-{
- // Destroy the input stream.
- if( inputStream != NULL ){
- delete inputStream;
- inputStream = NULL;
- }
-
- // Destroy the output stream.
- if( outputStream != NULL ){
- delete outputStream;
- outputStream = NULL;
- }
-
- // When connected we first shutdown, which breaks our reads and writes
- // then we close to free APR resources.
- if( isConnected() ) {
- apr_socket_close( socketHandle );
- socketHandle = INVALID_SOCKET_HANDLE;
- }
-
- // Destroy the APR Pool
- if( apr_pool != NULL ) {
- apr_pool_destroy( apr_pool );
- apr_pool = NULL;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int TcpSocket::getSoLinger() const throw( SocketException ){
-
- try{
- int value = 0;
- checkResult( apr_socket_opt_get( socketHandle, APR_SO_LINGER, &value ) );
- return value;
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setSoLinger( int dolinger ) throw( SocketException ){
-
- try{
- checkResult( apr_socket_opt_set( socketHandle, APR_SO_LINGER, dolinger ) );
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool TcpSocket::getKeepAlive() const throw( SocketException ){
-
- try{
- int value = 0;
- checkResult( apr_socket_opt_get( socketHandle, APR_SO_KEEPALIVE, &value ) );
- return value != 0;
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setKeepAlive( const bool keepAlive ) throw( SocketException ){
-
- try{
- int value = keepAlive ? 1 : 0;
- checkResult( apr_socket_opt_set( socketHandle, APR_SO_KEEPALIVE, value ) );
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int TcpSocket::getReceiveBufferSize() const throw( SocketException ){
-
- try{
- int value;
- checkResult( apr_socket_opt_get( socketHandle, APR_SO_RCVBUF, &value ) );
- return value;
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setReceiveBufferSize( int size ) throw( SocketException ){
-
- try{
- checkResult( apr_socket_opt_set( socketHandle, APR_SO_RCVBUF, size ) );
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool TcpSocket::getReuseAddress() const throw( SocketException ){
-
- try{
- int value;
- checkResult( apr_socket_opt_get( socketHandle, APR_SO_REUSEADDR, &value ) );
- return value != 0;
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setReuseAddress( bool reuse ) throw( SocketException ){
-
- try{
- int value = reuse ? 1 : 0;
- checkResult( apr_socket_opt_set( socketHandle, APR_SO_REUSEADDR, value ) );
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int TcpSocket::getSendBufferSize() const throw( SocketException ){
-
- try{
- int value;
- checkResult( apr_socket_opt_get( socketHandle, APR_SO_SNDBUF, &value ) );
- return value;
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setSendBufferSize( int size ) throw( SocketException ){
-
- try{
- checkResult( apr_socket_opt_set( socketHandle, APR_SO_SNDBUF, size ) );
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setSoTimeout ( const int millisecs ) throw ( SocketException )
-{
- try{
- // Time is in microseconds so multiply by 1000.
- checkResult( apr_socket_timeout_set( socketHandle, millisecs * 1000 ) );
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int TcpSocket::getSoTimeout() const throw( SocketException )
-{
- try{
- // Time is in microseconds so divide by 1000.
- apr_interval_time_t value = 0;
- checkResult( apr_socket_timeout_get( socketHandle, &value ) );
- return value / 1000;
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool TcpSocket::getTcpNoDelay() const throw ( lang::Exception ) {
-
- try{
- int value;
- checkResult( apr_socket_opt_get( socketHandle, APR_TCP_NODELAY, &value ) );
- return value != 0;
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setTcpNoDelay( bool value ) throw ( lang::Exception ) {
-
- try{
- int ivalue = value ? 1 : 0;
- checkResult( apr_socket_opt_set( socketHandle, APR_TCP_NODELAY, ivalue ) );
- }
- DECAF_CATCH_RETHROW( SocketException )
- DECAF_CATCHALL_THROW( SocketException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::checkResult( apr_status_t value ) const throw (SocketException) {
-
- if( value != APR_SUCCESS ){
- throw SocketException(
- __FILE__, __LINE__,
- SocketError::getErrorString().c_str() );
- }
-}
diff --git a/src/decaf/src/main/decaf/net/TcpSocket.h b/src/decaf/src/main/decaf/net/TcpSocket.h
deleted file mode 100644
index 0c35988..0000000
--- a/src/decaf/src/main/decaf/net/TcpSocket.h
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_NET_TCPSOCKET_H_
-#define _DECAF_NET_TCPSOCKET_H_
-
-#include <decaf/net/SocketException.h>
-#include <decaf/net/Socket.h>
-#include <decaf/io/InputStream.h>
-#include <decaf/io/OutputStream.h>
-#include <decaf/util/Config.h>
-
-#include <apr_pools.h>
-
-namespace decaf{
-namespace net{
-
- // Forward declarations
- class SocketInputStream;
- class SocketOutputStream;
-
- /**
- * Platform-independent implementation of the socket interface.
- */
- class DECAF_API TcpSocket : public Socket {
- private:
-
- /**
- * APR Socket Pool to allocate from
- */
- apr_pool_t* apr_pool;
-
- /**
- * The handle for this socket.
- */
- SocketHandle socketHandle;
-
- /**
- * The Address info for this Socket
- */
- SocketAddress socketAddress;
-
- /**
- * The input stream for reading this socket.
- */
- SocketInputStream* inputStream;
-
- /**
- * The output stream for writing to this socket.
- */
- SocketOutputStream* outputStream;
-
- public:
-
- /**
- * Construct a non-connected socket.
- * @throws SocketException thrown one windows if the static initialization
- * call to WSAStartup was not successful.
- */
- TcpSocket() throw ( SocketException );
-
- /**
- * Construct a connected or bound socket based on given
- * socket handle.
- * @param socketHandle a socket handle to wrap in the object
- */
- TcpSocket( SocketHandle socketHandle );
-
- /**
- * Destruct.
- * Releases the socket handle but not
- * gracefully shut down the connection.
- */
- virtual ~TcpSocket();
-
- /**
- * Gets the handle for the socket.
- * @return SocketHabler for this Socket, can be NULL
- */
- SocketHandle getSocketHandle () {
- return socketHandle;
- }
-
- /**
- * Connects to the specified destination. Closes this socket if
- * connected to another destination.
- * @param host The host of the server to connect to.
- * @param port The port of the server to connect to.
- * @throws IOException Thrown if a failure occurred in the connect.
- */
- virtual void connect( const char* host, int port ) throw( SocketException );
-
- /**
- * Indicates whether or not this socket is connected to a destination.
- * @return true if connected
- */
- virtual bool isConnected() const{
- return socketHandle != INVALID_SOCKET_HANDLE;
- }
-
- /**
- * Gets the InputStream for this socket.
- * @return The InputStream for this socket. NULL if not connected.
- */
- virtual io::InputStream* getInputStream();
-
- /**
- * Gets the OutputStream for this socket.
- * @return the OutputStream for this socket. NULL if not connected.
- */
- virtual io::OutputStream* getOutputStream();
-
- /**
- * Gets the linger time.
- * @return The linger time in seconds.
- * @throws SocketException if the operation fails.
- */
- virtual int getSoLinger() const throw( SocketException );
-
- /**
- * Sets the linger time.
- * @param linger The linger time in seconds. If 0, linger is off.
- * @throws SocketException if the operation fails.
- */
- virtual void setSoLinger( int linger ) throw( SocketException );
-
- /**
- * Gets the keep alive flag.
- * @return True if keep alive is enabled.
- * @throws SocketException if the operation fails.
- */
- virtual bool getKeepAlive() const throw( SocketException );
-
- /**
- * Enables/disables the keep alive flag.
- * @param keepAlive If true, enables the flag.
- * @throws SocketException if the operation fails.
- */
- virtual void setKeepAlive( bool keepAlive ) throw( SocketException );
-
- /**
- * Gets the receive buffer size.
- * @return the receive buffer size in bytes.
- * @throws SocketException if the operation fails.
- */
- virtual int getReceiveBufferSize() const throw( SocketException );
-
- /**
- * Sets the recieve buffer size.
- * @param size Number of bytes to set the receive buffer to.
- * @throws SocketException if the operation fails.
- */
- virtual void setReceiveBufferSize( int size ) throw( SocketException );
-
- /**
- * Gets the reuse address flag.
- * @return True if the address can be reused.
- * @throws SocketException if the operation fails.
- */
- virtual bool getReuseAddress() const throw( SocketException );
-
- /**
- * Sets the reuse address flag.
- * @param reuse If true, sets the flag.
- * @throws SocketException if the operation fails.
- */
- virtual void setReuseAddress( bool reuse ) throw( SocketException );
-
- /**
- * Gets the send buffer size.
- * @return the size in bytes of the send buffer.
- * @throws SocketException if the operation fails.
- */
- virtual int getSendBufferSize() const throw( SocketException );
-
- /**
- * Sets the send buffer size.
- * @param size The number of bytes to set the send buffer to.
- * @throws SocketException if the operation fails.
- */
- virtual void setSendBufferSize( int size ) throw( SocketException );
-
- /**
- * Gets the timeout for socket operations.
- * @return The timeout in milliseconds for socket operations.
- * @throws SocketException Thrown if unable to retrieve the information.
- */
- virtual int getSoTimeout() const throw( SocketException );
-
- /**
- * Sets the timeout for socket operations.
- * @param timeout The timeout in milliseconds for socket operations.<p>
- * @throws SocketException Thrown if unable to set the information.
- */
- virtual void setSoTimeout( int timeout ) throw(SocketException);
-
- /**
- * Closes this object and deallocates the appropriate resources.
- * @throws CMSException
- */
- virtual void close() throw( lang::Exception );
-
- public:
-
- /**
- * Gets the Status of the TCP_NODELAY param for this socket as a Bool
- * @returns true if TCP_NODELAY is enabled
- * @throws CMSException
- */
- virtual bool getTcpNoDelay() const throw ( lang::Exception );
-
- /**
- * Sets the Status of the TCP_NODELAY param for this socket as a Bool
- * @param value - true if TCP_NODELAY is to be enabled
- * @throws CMSException
- */
- virtual void setTcpNoDelay( bool value ) throw ( lang::Exception );
-
- protected:
-
- void checkResult( apr_status_t value ) const throw (SocketException);
-
- };
-
-}}
-
-#endif /*_DECAF_NET_TCPSOCKET_H_*/
diff --git a/src/decaf/src/main/decaf/net/URI.cpp b/src/decaf/src/main/decaf/net/URI.cpp
deleted file mode 100644
index 9293027..0000000
--- a/src/decaf/src/main/decaf/net/URI.cpp
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "URI.h"
-
-#include <apr_strings.h>
-#include <decaf/lang/Integer.h>
-
-using namespace decaf;
-using namespace decaf::net;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-const std::string URI::unreserved = "_-!.~\'()*";
-const std::string URI::punct = ",;:$&+=";
-const std::string URI::reserved = punct + "?/[]@";
-const std::string URI::someLegal = unreserved + punct;
-const std::string URI::allLegal = unreserved + reserved;
-
-////////////////////////////////////////////////////////////////////////////////
-URI::URI( const std::string& uri ) throw ( URISyntaxException) {
-
- this->uriString = NULL;
- this->parseURI( uri );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-URI::URI( const std::string& scheme,
- const std::string& ssp,
- const std::string& fragment ) throw ( URISyntaxException ) {
-
- std::string uri = "";
-
- if( scheme != "" ) {
- uri.append( scheme );
- uri.append( ":" );
- }
-
- if( ssp != "" ) {
- // QUOTE ILLEGAL CHARACTERS
- uri.append( quoteComponent( ssp, allLegal ) );
- }
-
- if( fragment != "" ) {
- uri.append( "#" );
- // QUOTE ILLEGAL CHARACTERS
- uri.append( quoteComponent( fragment, allLegal ) );
- }
-
- // Now hand of to the main parse function.
- this->parseURI( uri );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-URI::URI( const std::string& scheme, const std::string& userInfo,
- const std::string& host, int port,
- const std::string& path, const std::string& query,
- const std::string& fragment ) throw ( URISyntaxException ) {
-
- this->uriString = NULL;
-
- if( scheme == "" && userInfo == "" && host == "" &&
- path == "" && query == "" && fragment == "" ) {
-
- this->uri.path = "";
- return;
- }
-
- if( scheme != "" && path.length() > 0 && path.at(0) != '/') {
-
- throw URISyntaxException(
- __FILE__, __LINE__, path,
- "URI::URI - Path string: %s starts with invalid char '/'" );
- }
-
- std::string uri = "";
- if( scheme != "" ) {
- uri.append( scheme );
- uri.append( ":" );
- }
-
- if( userInfo != "" || host != "" || port != -1 ) {
- uri.append( "//" );
- }
-
- if( userInfo != "" ) {
- // QUOTE ILLEGAL CHARACTERS in userinfo
- uri.append(quoteComponent( userInfo, someLegal ) );
- uri.append( "@" );
- }
-
- if( host != "" ) {
- std::string newHost = host;
-
- // check for ipv6 addresses that hasn't been enclosed
- // in square brackets
- if( host.find( ":" ) != std::string::npos &&
- host.find( "]" ) == std::string::npos &&
- host.find( "[" ) == std::string::npos ) {
-
- newHost = std::string( "[" ) + host + "]";
- }
-
- uri.append( newHost );
- }
-
- if( port != -1 ) {
- uri.append( ":" );
- uri.append( Integer::toString( port ) );
- }
-
- if( path != "" ) {
- // QUOTE ILLEGAL CHARS
- uri.append( quoteComponent( path, "/@" + someLegal ) );
- }
-
- if( query != "" ) {
- uri.append( "?" );
- // QUOTE ILLEGAL CHARS
- uri.append( quoteComponent( query, allLegal ) );
- }
-
- if( fragment != "" ) {
- // QUOTE ILLEGAL CHARS
- uri.append( "#" );
- uri.append( quoteComponent( fragment, allLegal ) );
- }
-
- this->parseURI( uri );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-URI::URI( const std::string& scheme, const std::string& host,
- const std::string& path, const std::string& fragment )
- throw ( URISyntaxException ) {
-
- this->uriString = NULL;
-
- URI::URI( scheme, "", host, -1, path, "", fragment );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-URI::URI( const std::string& scheme, const std::string& authority,
- const std::string& path, const std::string& query,
- const std::string& fragment ) throw ( URISyntaxException ) {
-
- this->uriString = NULL;
-
- if( scheme != "" && path.length() > 0 && path.at(0) != '/' ) {
- throw URISyntaxException(
- __FILE__, __LINE__, path,
- "URI::URI - Path String %s must start with a '/'" );
- }
-
- std::string uri = "";
- if( scheme != "" ) {
- uri.append( scheme );
- uri.append( ":" );
- }
- if( authority != "" ) {
- uri.append("//");
- // QUOTE ILLEGAL CHARS
- uri.append( quoteComponent( authority, "@[]" + someLegal ) );
- }
-
- if( path != "" ) {
- // QUOTE ILLEGAL CHARS
- uri.append( quoteComponent( path, "/@" + someLegal ) );
- }
- if( query != "" ) {
- // QUOTE ILLEGAL CHARS
- uri.append( "?" );
- uri.append( quoteComponent( query, allLegal ) );
- }
- if( fragment != "" ) {
- // QUOTE ILLEGAL CHARS
- uri.append( "#" );
- uri.append( quoteComponent( fragment, allLegal ) );
- }
-
- this->parseURI( uri );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void URI::parseURI( const std::string& uri ) throw ( URISyntaxException ) {
-
- // Use APR to perform the main parse.
- apr_status_t result = apr_uri_parse( pool.getAprPool(),
- uri.c_str(), &this->uri );
-
- if( result != APR_SUCCESS ) {
- throw URISyntaxException(
- __FILE__, __LINE__, uri,
- "URI::praseURI - URI String %s invalid." );
- }
-
- std::cout << "\n";
- std::cout << "Original URI String: " << uri << std::endl;
- std::cout << "\n";
- std::cout << "Scheme: "
- << ( this->uri.scheme ? this->uri.scheme : "" ) << std::endl;
- std::cout << "Host: "
- << ( this->uri.hostinfo ? this->uri.hostinfo : "" ) << std::endl;
- std::cout << "User: "
- << ( this->uri.user ? this->uri.user : "" ) << std::endl;
- std::cout << "Passwrod: "
- << ( this->uri.password ? this->uri.password : "" ) << std::endl;
- std::cout << "Host Name: "
- << ( this->uri.hostname ? this->uri.hostname : "" ) << std::endl;
- std::cout << "Port Str: "
- << ( this->uri.port_str ? this->uri.port_str : "" ) << std::endl;
- std::cout << "Path: "
- << ( this->uri.path ? this->uri.path : "" ) << std::endl;
- std::cout << "Query: "
- << ( this->uri.query ? this->uri.query : "" ) << std::endl;
- std::cout << "Fragment: "
- << ( this->uri.fragment ? this->uri.fragment : "" ) << std::endl;
- std::cout << "Port: " << this->uri.port << std::endl;
- std::cout << "Is Initialized: " << this->uri.is_initialized << std::endl;
- std::cout << "DNS Looked Up: " << this->uri.dns_looked_up << std::endl;
- std::cout << "DNS Resolved: " << this->uri.dns_resolved << std::endl;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int URI::compareTo( const URI& value ) const {
- return 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool URI::equals( const URI& value ) const {
- return compareTo( value ) == 0 ? true : false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool URI::operator==( const URI& value ) const {
- return compareTo( value ) == 0 ? true : false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool URI::operator<( const URI& value ) const {
- return compareTo( value ) == -1 ? true : false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-URI URI::create( const std::string uri )
- throw ( lang::exceptions::IllegalArgumentException ) {
-
- try {
- return URI( uri );
- } catch( URISyntaxException& e ) {
- throw IllegalArgumentException( e );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string URI::quoteComponent( const std::string& component,
- const std::string& legalset ) {
-// try {
- /*
- * Use a different encoder than URLEncoder since: 1. chars like "/",
- * "#", "@" etc needs to be preserved instead of being encoded, 2.
- * UTF-8 char set needs to be used for encoding instead of default
- * platform one
- */
-// return URIEncoderDecoder.quoteIllegal(component, legalset);
-// } catch( UnsupportedEncodingException e ) {
-// throw RuntimeException( e );
-// }
-}
diff --git a/src/decaf/src/main/decaf/net/URI.h b/src/decaf/src/main/decaf/net/URI.h
deleted file mode 100644
index cbc3114..0000000
--- a/src/decaf/src/main/decaf/net/URI.h
+++ /dev/null
@@ -1,433 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_URI_H_
-#define _DECAF_NET_URI_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/lang/Comparable.h>
-#include <decaf/lang/exceptions/IllegalArgumentException.h>
-#include <decaf/net/URISyntaxException.h>
-#include <decaf/net/MalformedURLException.h>
-#include <decaf/net/URL.h>
-#include <string>
-#include <apr_uri.h>
-#include <decaf/internal/AprPool.h>
-
-namespace decaf{
-namespace net{
-
- /**
- * This class represents an instance of a URI as defined by RFC 2396.
- */
- class DECAF_API URI : public lang::Comparable<URI> {
- private:
-
- // Apr Data for parsing the uri.
- apr_uri_t uri;
- internal::AprPool pool;
-
- // The original string entered from URI( string ), empty if not set.
- const char* uriString;
-
- static const std::string unreserved;
- static const std::string punct;
- static const std::string reserved;
- static const std::string someLegal;
- static const std::string allLegal;
-
- public:
-
- /**
- * Constructs a URI from the given string
- * @param uri - string uri to parse.
- */
- URI( const std::string& uri ) throw ( URISyntaxException );
-
- /**
- * Constructs a URI from the given components.
- * @param scheme - the uri scheme
- * @param ssp - Scheme specific part
- * @param fragment - Fragment
- */
- URI( const std::string& scheme,
- const std::string& ssp,
- const std::string& fragment) throw ( URISyntaxException );
-
- /**
- * Constructs a URI from the given components.
- * @param scheme - Scheme name
- * @param userInfo - User name and authorization information
- * @param host - Host name
- * @param port - Port number
- * @param path - Path
- * @param query - Query
- * @param fragment - Fragment
- */
- URI( const std::string& scheme, const std::string& userInfo,
- const std::string& host, int port,
- const std::string& path, const std::string& query,
- const std::string& fragment ) throw ( URISyntaxException );
-
- /**
- * Constructs a URI from the given components.
- * @param scheme - Scheme name
- * @param host - Host name
- * @param path - Path
- * @param fragment - Fragment
- */
- URI( const std::string& scheme, const std::string& host,
- const std::string& path, const std::string& fragment )
- throw ( URISyntaxException );
-
- /**
- * Constructs a URI from the given components.
- * @param scheme - Scheme name
- * @param authority - Authority
- * @param path - Path
- * @param query - Query
- * @param fragment - Fragment
- */
- URI( const std::string& scheme, const std::string& authority,
- const std::string& path, const std::string& query,
- const std::string& fragment ) throw ( URISyntaxException);
-
- virtual ~URI() {}
-
- /**
- * Compares this object with the specified object for order. Returns a
- * negative integer, zero, or a positive integer as this object is less
- * than, equal to, or greater than the specified object.
- * @param value - the value to compare to this one.
- * @returns zero if equal minus one if less than and one if greater than.
- */
- virtual int compareTo( const URI& value ) const;
-
- /**
- * @return true if this value is considered equal to the passed value.
- */
- virtual bool equals( const URI& value ) const;
-
- /**
- * Compares equality between this object and the one passed.
- * @param value - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const URI& value ) const;
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param value - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const URI& value ) const;
-
- /**
- * @eturns the decoded authority component of this URI.
- */
- std::string getAuthority() const;
-
- /**
- * @returns the decoded fragment component of this URI.
- */
- std::string getFragment() const;
-
- /**
- * @returns the host component of this URI.
- */
- std::string getHost() const;
-
- /**
- * @returns the path component of this URI.
- */
- std::string getPath() const;
-
- /**
- * @returns the port component of this URI.
- */
- int getPort() const;
-
- /**
- * @returns the query component of this URI.
- */
- std::string getQuery() const;
-
- /**
- * @returns the scheme component of this URI
- */
- std::string getScheme() const;
-
- /**
- * @returns the user info component of this URI
- */
- std::string getUserInfo() const;
-
- /**
- * Returns the raw authority component of this URI.
- *
- * The authority component of a URI, if defined, only contains the
- * commercial-at character ('@') and characters in the unreserved, punct,
- * escaped, and other categories. If the authority is server-based then
- * it is further constrained to have valid user-information, host, and
- * port components.
- * @returns the raw authority component of the URI
- */
- std::string getRawAuthority() const;
-
- /**
- * Returns the raw fragment component of this URI.
- *
- * The fragment component of a URI, if defined, only contains legal URI
- * characters.
- * @returns the raw fragment component of this URI
- */
- std::string getRawFragment() const;
-
- /**
- * Returns the raw path component of this URI.
- *
- * The path component of a URI, if defined, only contains the slash
- * character ('/'), the commercial-at character ('@'), and characters
- * in the unreserved, punct, escaped, and other categories.
- * @returns the raw path component of this URI
- */
- std::string getRawPath() const;
-
- /**
- * Returns the raw query component of this URI.
- * The query component of a URI, if defined, only contains legal URI characters.
- * @returns the raw query component of the URI.
- */
- std::string getRawQuery() const;
-
- /**
- * Returns the raw scheme-specific part of this URI. The scheme-specific
- * part is never undefined, though it may be empty.
- * The scheme-specific part of a URI only contains legal URI characters.
- * @returns the raw scheme special part of the uri
- */
- std::string getRawSchemeSpecificPart() const;
-
- /**
- * Returns the decoded scheme-specific part of this URI.
- * The string returned by this method is equal to that returned by the
- * getRawSchemeSpecificPart method except that all sequences of escaped
- * octets are decoded.
- * @returns the raw scheme specific part of the uri.
- */
- std::string getSchemeSpecificPart() const;
-
- /**
- * Returns the raw user-information component of this URI.
- * The user-information component of a URI, if defined, only contains
- * characters in the unreserved, punct, escaped, and other categories.
- * @returns the raw user-information component of the URI
- */
- std::string getRawUserInfo() const;
-
- /**
- * Tells whether or not this URI is absolute. A URI is absolute if,
- * and only if, it has a scheme component.
- * @returns true if, and only if, this URI is absolute
- */
- bool isAbsolute() const;
-
- /**
- * Tells whether or not this URI is opaque. A URI is opaque if, and only
- * if, it is absolute and its scheme-specific part does not begin with a
- * slash character ('/'). An opaque URI has a scheme, a scheme-specific
- * part, and possibly a fragment; all other components are undefined.
- * @returns true if, and only if, this URI is opaque
- */
- bool isOpaque() const;
-
- /**
- * Normalizes this URI's path. If this URI is opaque, or if its path is
- * already in normal form, then this URI is returned. Otherwise a new URI
- * is constructed that is identical to this URI except that its path is
- * computed by normalizing this URI's path in a manner consistent with
- * RFC 2396, section 5.2, step 6, sub-steps c through f; that is:
- *
- * 1. All "." segments are removed.
- * 2. If a ".." segment is preceded by a non-".." segment then both of t
- * hese segments are removed. This step is repeated until it is no
- * longer applicable.
- * 3. If the path is relative, and if its first segment contains a colon
- * character (':'), then a "." segment is prepended. This prevents a
- * relative URI with a path such as "a:b/c/d" from later being re-parsed
- * as an opaque URI with a scheme of "a" and a scheme-specific part of
- * "b/c/d". (Deviation from RFC 2396)
- *
- * A normalized path will begin with one or more ".." segments if there were
- * insufficient non-".." segments preceding them to allow their removal. A
- * normalized path will begin with a "." segment if one was inserted by step
- * 3 above. Otherwise, a normalized path will not contain any "." or ".."
- * segments.
- * @returns A URI equivalent to this URI, but whose path is in normal form
- */
- URI normalize() const;
-
- /**
- * Attempts to parse this URI's authority component, if defined, into
- * user-information, host, and port components.
- *
- * If this URI's authority component has already been recognized as being
- * server-based then it will already have been parsed into user-information,
- * host, and port components. In this case, or if this URI has no authority
- * component, this method simply returns this URI.
- *
- * Otherwise this method attempts once more to parse the authority component
- * into user-information, host, and port components, and throws an exception
- * describing why the authority component could not be parsed in that way.
- * @returns A URI whose authority field has been parsed as a server-based
- * authority
- * @throws URISyntaxException - If the authority component of this URI is
- * defined but cannot be parsed as a server-based authority.
- */
- URI parseServerAuthority() const throw ( URISyntaxException );
-
- /**
- * Relativizes the given URI against this URI. The relativization of the
- * given URI against this URI is computed as follows:
- *
- * 1. If either this URI or the given URI are opaque, or if the scheme and
- * authority components of the two URIs are not identical, or if the path
- * of this URI is not a prefix of the path of the given URI, then the
- * given URI is returned.
- * 2. Otherwise a new relative hierarchical URI is constructed with query
- * and fragment components taken from the given URI and with a path
- * component computed by removing this URI's path from the beginning of
- * the given URI's path.
- *
- * @param uri - The URI to be relativized against this URI
- * @returns The resulting URI
- */
- URI relativize( const URI& uri ) const;
-
- /**
- * Constructs a new URI by parsing the given string and then resolving it
- * against this URI.
- *
- * This convenience method works as if invoking it were equivalent to
- * evaluating the expression resolve( URI::create( str ) ).
- * @param str - The string to be parsed into a URI
- * @returns The resulting URI
- * @throws IllegalArgumentException - If the given string violates RFC 2396
- */
- URI resolve( const std::string& str )
- throw ( lang::exceptions::IllegalArgumentException );
-
- /**
- * Resolves the given URI against this URI.
- *
- * If the given URI is already absolute, or if this URI is opaque, then a
- * copy of the given URI is returned.
- *
- * If the given URI's fragment component is defined, its path component is
- * empty, and its scheme, authority, and query components are undefined, then
- * a URI with the given fragment but with all other components equal to those
- * of this URI is returned. This allows a URI representing a standalone
- * fragment reference, such as "#foo", to be usefully resolved against a base
- * URI.
- *
- * Otherwise this method constructs a new hierarchical URI in a manner
- * consistent with RFC 2396, section 5.2; that is:
- *
- * 1. A new URI is constructed with this URI's scheme and the given URI's
- * query and fragment components.
- * 2. If the given URI has an authority component then the new URI's authority
- * and path are taken from the given URI.
- * 3. Otherwise the new URI's authority component is copied from this URI,
- * and its path is computed as follows:
- *
- * 1. If the given URI's path is absolute then the new URI's path is
- * taken from the given URI.
- * 2. Otherwise the given URI's path is relative, and so the new URI's
- * path is computed by resolving the path of the given URI against the
- * path of this URI. This is done by concatenating all but the last
- * segment of this URI's path, if any, with the given URI's path and
- * then normalizing the result as if by invoking the normalize method.
- *
- * The result of this method is absolute if, and only if, either this URI is
- * absolute or the given URI is absolute.
- * @param uri - The URI to be resolved against this URI
- * @returns The resulting URI
- */
- URI resolve( const URI& uri );
-
- /**
- * Returns the content of this URI as a string.
- *
- * If this URI was created by invoking one of the constructors in this class
- * then a string equivalent to the original input string, or to the string
- * computed from the originally-given components, as appropriate, is returned.
- * Otherwise this URI was created by normalization, resolution, or
- * relativization, and so a string is constructed from this URI's components
- * according to the rules specified in RFC 2396, section 5.2, step 7.
- * @returns the string form of this URI
- */
- std::string toString() const;
-
- /**
- * Constructs a URL from this URI.
- *
- * This convenience method works as if invoking it were equivalent to
- * evaluating the expression new URL(this.toString()) after first checking
- * that this URI is absolute.
- * @returns A URL constructed from this URI
- * @throws IllegalArgumentException - If this URL is not absolute
- * @throws MalformedURLException - If a protocol handler for the URL could not
- * be found, or if some other error occurred while constructing the URL
- */
- URL toURL() const
- throw ( MalformedURLException, lang::exceptions::IllegalArgumentException );
-
- public: // Static Methods
-
- /**
- * Creates a URI by parsing the given string.
- * This convenience factory method works as if by invoking the URI(string)
- * constructor; any URISyntaxException thrown by the constructor is caught
- * and wrapped in a new IllegalArgumentException object, which is then thrown.
- * @param uri - URI string to parse
- * @throws IllegalArgumentException
- */
- static URI create( const std::string uri )
- throw ( lang::exceptions::IllegalArgumentException );
-
- private:
-
- // Parses a URI string and fills in the member data, throws a
- // URISyntaxException if things fail
- void parseURI( const std::string& uri ) throw ( URISyntaxException );
-
- /*
- * Quote illegal chars for each component, but not the others
- *
- * @param component java.lang.String the component to be converted @param
- * legalset java.lang.String the legal character set allowed in the
- * component s @return java.lang.String the converted string
- */
- std::string quoteComponent( const std::string& component,
- const std::string& legalset );
-
- };
-
-}}
-
-#endif /*_DECAF_NET_URI_H_*/
diff --git a/src/decaf/src/main/decaf/net/URISyntaxException.h b/src/decaf/src/main/decaf/net/URISyntaxException.h
deleted file mode 100644
index f50e9c6..0000000
--- a/src/decaf/src/main/decaf/net/URISyntaxException.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_URISYNTAXEXCEPTION_H_
-#define _DECAF_NET_URISYNTAXEXCEPTION_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace net{
-
- class DECAF_API URISyntaxException : public lang::Exception {
- private:
-
- std::string reason;
- std::string input;
- int index;
-
- public:
-
- /**
- * Default Constructor
- */
- URISyntaxException() throw() {
- this->reason = "";
- this->input = "";
- this->index = -1;
- }
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- URISyntaxException( const Exception& ex ) throw() : Exception() {
-
- *(Exception*)this = ex;
- this->reason = "";
- this->input = "";
- this->index = -1;
- }
-
- /**
- * Copy Constructor
- */
- URISyntaxException( const URISyntaxException& ex ) throw() : Exception() {
-
- *(Exception*)this = ex;
- this->reason = ex.getReason();
- this->input = ex.getInput();
- this->index = ex.getIndex();
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the input string that caused the error
- * and the reason for the error.
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param input uri string
- * @param reason string for the failure.
- * @param list of primitives that are formatted into the message
- */
- URISyntaxException( const char* file, const int lineNumber,
- const std::string& input,
- const std::string& reason ) throw () : Exception() {
-
- this->reason = reason;
- this->input = input;
- this->index = -1;
-
- const char * message = "Input: %s, Reason it failed: %s";
- this->setMessage( message, input.c_str(), reason.c_str() );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the input string that caused the error
- * and the reason for the error.
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param input uri string
- * @param reason string for the failure.
- * @param index in the uri string where the error occured.
- */
- URISyntaxException( const char* file, const int lineNumber,
- const std::string& input,
- const std::string& reason,
- int index ) throw () : Exception() {
-
- this->reason = reason;
- this->input = input;
- this->index = index;
-
- const char * message = "Input: %s, Index %d resulted in this error: %s";
- this->setMessage( message, input.c_str(), index, reason.c_str() );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual URISyntaxException* clone() const {
- return new URISyntaxException( *this );
- }
-
- /**
- * Destructor
- */
- virtual ~URISyntaxException() throw() {}
-
- /**
- * @returns the Input string that cause this exception or ""
- */
- std::string getInput() const {
- return input;
- }
-
- /**
- * @returns the Reason given for this failure, or ""
- */
- std::string getReason() const {
- return reason;
- }
-
- /**
- * @returns the index in the input string where the error occured or -1
- */
- int getIndex() const {
- return index;
- }
-
- };
-
-}}
-
-#endif /*_DECAF_NET_URISYNTAXEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/net/URL.cpp b/src/decaf/src/main/decaf/net/URL.cpp
deleted file mode 100644
index f1595fe..0000000
--- a/src/decaf/src/main/decaf/net/URL.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "URL.h"
-
-using namespace decaf;
-using namespace decaf::net;
-
-////////////////////////////////////////////////////////////////////////////////
-URL::URL() {
-}
diff --git a/src/decaf/src/main/decaf/net/URL.h b/src/decaf/src/main/decaf/net/URL.h
deleted file mode 100644
index fb4b0d9..0000000
--- a/src/decaf/src/main/decaf/net/URL.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_URL_H_
-#define _DECAF_NET_URL_H_
-
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace net{
-
- class DECAF_API URL {
- public:
-
- URL();
- virtual ~URL() {}
-
- };
-
-}}
-
-#endif /*_DECAF_NET_URL_H_*/
diff --git a/src/decaf/src/main/decaf/net/URLDecoder.cpp b/src/decaf/src/main/decaf/net/URLDecoder.cpp
deleted file mode 100644
index edb0d8c..0000000
--- a/src/decaf/src/main/decaf/net/URLDecoder.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "URLDecoder.h"
-
-using namespace decaf;
-using namespace decaf::net;
-
-////////////////////////////////////////////////////////////////////////////////
-URLDecoder::URLDecoder() {
-}
diff --git a/src/decaf/src/main/decaf/net/URLDecoder.h b/src/decaf/src/main/decaf/net/URLDecoder.h
deleted file mode 100644
index 5ef665e..0000000
--- a/src/decaf/src/main/decaf/net/URLDecoder.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_URLDECODER_H_
-#define _DECAF_NET_URLDECODER_H_
-
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace net{
-
- class DECAF_API URLDecoder {
- public:
-
- URLDecoder();
- virtual ~URLDecoder() {}
-
- };
-
-}}
-
-#endif /*_DECAF_NET_URLDECODER_H_*/
diff --git a/src/decaf/src/main/decaf/net/URLEncoder.cpp b/src/decaf/src/main/decaf/net/URLEncoder.cpp
deleted file mode 100644
index 5bd0654..0000000
--- a/src/decaf/src/main/decaf/net/URLEncoder.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "URLEncoder.h"
-
-using namespace decaf;
-using namespace decaf::net;
-
-////////////////////////////////////////////////////////////////////////////////
-URLEncoder::URLEncoder() {
-}
diff --git a/src/decaf/src/main/decaf/net/URLEncoder.h b/src/decaf/src/main/decaf/net/URLEncoder.h
deleted file mode 100644
index fa7e0b0..0000000
--- a/src/decaf/src/main/decaf/net/URLEncoder.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_URLENCODER_H_
-#define _DECAF_NET_URLENCODER_H_
-
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace net{
-
- class DECAF_API URLEncoder {
- public:
-
- URLEncoder();
- virtual ~URLEncoder() {}
-
- };
-
-}}
-
-#endif /*_DECAF_NET_URLENCODER_H_*/
diff --git a/src/decaf/src/main/decaf/net/UnknownHostException.h b/src/decaf/src/main/decaf/net/UnknownHostException.h
deleted file mode 100644
index 40e9e23..0000000
--- a/src/decaf/src/main/decaf/net/UnknownHostException.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_UNKNOWNHOSTEXCEPTION_H_
-#define _DECAF_NET_UNKNOWNHOSTEXCEPTION_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/io/IOException.h>
-
-namespace decaf{
-namespace net{
-
- class DECAF_API UnknownHostException : public io::IOException {
- public:
-
- /**
- * Default Constructor
- */
- UnknownHostException() throw() {}
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- UnknownHostException( const Exception& ex ) throw()
- : io::IOException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- UnknownHostException( const UnknownHostException& ex ) throw()
- : io::IOException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- UnknownHostException( const char* file, const int lineNumber,
- const char* msg, ... ) throw ()
- : io::IOException()
- {
- va_list vargs ;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual UnknownHostException* clone() const {
- return new UnknownHostException( *this );
- }
-
- /**
- * Destructor
- */
- virtual ~UnknownHostException() throw() {}
-
- };
-
-}}
-
-#endif /*_DECAF_NET_UNKNOWNHOSTEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/net/UnknownServiceException.h b/src/decaf/src/main/decaf/net/UnknownServiceException.h
deleted file mode 100644
index a97d0fe..0000000
--- a/src/decaf/src/main/decaf/net/UnknownServiceException.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_UNKNOWNSERVICEEXCEPTION_H_
-#define _DECAF_NET_UNKNOWNSERVICEEXCEPTION_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/io/IOException.h>
-
-namespace decaf{
-namespace net{
-
- class DECAF_API UnknownServiceException : public io::IOException {
- public:
-
- /**
- * Default Constructor
- */
- UnknownServiceException() throw() {}
-
- /**
- * Conversion Constructor from some other Exception
- * @param An exception that should become this type of Exception
- */
- UnknownServiceException( const Exception& ex ) throw()
- : io::IOException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- UnknownServiceException( const UnknownServiceException& ex ) throw()
- : io::IOException()
- {
- *(Exception*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- UnknownServiceException( const char* file, const int lineNumber,
- const char* msg, ... ) throw ()
- : io::IOException()
- {
- va_list vargs ;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual UnknownServiceException* clone() const {
- return new UnknownServiceException( *this );
- }
-
- /**
- * Destructor
- */
- virtual ~UnknownServiceException() throw() {}
-
- };
-
-}}
-
-#endif /*_DECAF_NET_UNKNOWNSERVICEEXCEPTION_H_*/
diff --git a/src/decaf/src/main/decaf/util/Collection.h b/src/decaf/src/main/decaf/util/Collection.h
deleted file mode 100644
index 7562a62..0000000
--- a/src/decaf/src/main/decaf/util/Collection.h
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_COLLECTION_H_
-#define _DECAF_UTIL_COLLECTION_H_
-
-#include <decaf/util/Config.h>
-#include <devaf/lang/exceptions/UnsupportedOperationException.h>
-#include <devaf/lang/exceptions/NullPointerException.h>
-#include <devaf/lang/exceptions/IllegalArgumentException.h>
-#include <decaf/util/Iterator.h>
-
-namespace decaf{
-namespace util{
-
- /**
- * The root interface in the collection hierarchy. A collection represents
- * a group of objects, known as its elements. Some collections allow
- * duplicate elements and others do not. Some are ordered and others
- * unordered. This interface is typically used to pass collections
- * around and manipulate them where maximum generality is desired.
- *
- * All general-purpose Collection implementation classes (which typically
- * implement Collection indirectly through one of its subinterfaces) should
- * provide two "standard" constructors: a void (no arguments) constructor,
- * which creates an empty collection, and a constructor with a single argument
- * of type Collection, which creates a new collection with the same elements
- * as its argument. In effect, the latter constructor allows the user to copy
- * any collection, producing an equivalent collection of the desired
- * implementation type. There is no way to enforce this convention
- * (as interfaces cannot contain constructors) but all of the general-purpose
- * Collection implementations in the Decaf platform libraries comply.
- *
- * The "destructive" methods contained in this interface, that is, the methods
- * that modify the collection on which they operate, are specified to throw
- * UnsupportedOperationException if this collection does not support the
- * operation. If this is the case, these methods may, but are not required
- * to, throw an UnsupportedOperationException if the invocation would have
- * no effect on the collection. For example, invoking the addAll(Collection)
- * method on an unmodifiable collection may, but is not required to, throw
- * the exception if the collection to be added is empty.
- *
- * Many methods in Collections Framework interfaces are defined in terms of
- * the equals method. For example, the specification for the
- * contains(Object o) method says: "returns true if and only if this
- * collection contains at least one element e such that
- * (o==null ? e==null : o.equals(e))."
- *
- * @since 1.0
- */
- template< typename T >
- class DECAF_API Collection
- {
- public:
-
- virtual ~Collection() {}
-
- /**
- * Returns the number of elements in this collection. If this collection
- * contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.
- * @returns the number of elements in this collection
- */
- virtual int size() = 0;
-
- /**
- * @returns true if this collection contains no elements.
- */
- virtual bool isEmpty() = 0;
-
- /**
- * Returns true if this collection contains the specified element. More
- * formally, returns true if and only if this collection contains at
- * least one element e such that (o==null ? e==null : o.equals(e)).
- * @param value - value to check for presence in the collection
- * @returns true if there is at least one of the elements in the collection
- * @thorws NullPointerException
- */
- virtual bool contains( const E& value )
- throw ( lang::exceptions::NullPointerException ) = 0;
-
- /**
- * Returns an iterator over the elements in this collection. There are
- * no guarantees concerning the order in which the elements are
- * returned (unless this collection is an instance of some class that
- * provides a guarantee).
- * @returns an Iterator over the elements in this collection
- */
- virtual Iterator<E>* iterator() = 0;
-
- /**
- * Returns an array containing all of the elements in this collection. If
- * the collection makes any guarantees as to what order its elements are
- * returned by its iterator, this method must return the elements in the
- * same order.
- *
- * This method acts as bridge between array-based and collection-based APIs.
- * @returns an array of the elements in this collection.
- */
- virtual std::vector<E> toArray() = 0;
-
- /**
- * Returns true if this collection changed as a result of the call.
- * (Returns false if this collection does not permit duplicates and
- * already contains the specified element.)
- *
- * Collections that support this operation may place limitations on
- * what elements may be added to this collection. In particular,
- * some collections will refuse to add null elements, and others
- * will impose restrictions on the type of elements that may be
- * added. Collection classes should clearly specify in their
- * documentation any restrictions on what elements may be added.
- *
- * If a collection refuses to add a particular element for any
- * reason other than that it already contains the element, it must
- * throw an exception (rather than returning false). This preserves
- * the invariant that a collection always contains the specified
- * element after this call returns.
- *
- * For non-pointer values, i.e. class instances or string's the object
- * will be copied into the collection, thus the object must support
- * being copied, must not hide the copy constructor and assignment
- * operator.
- *
- * @param value - reference to the element to add.
- * @returns true if the element was added
- * @throw UnsupportedOperationException
- * @throw NullPointerException
- * @throw IllegalArgumentException
- */
- virtual bool add( const E& value )
- throw ( lang::exceptions::UnsupportedOperationException,
- lang::exceptions::NullPointerException,
- lang::exceptions::IllegalArgumentException ) = 0;
-
- /**
- * Removes a single instance of the specified element from the
- * collection. More formally, removes an element e such that
- * (o==null ? e==null : o.equals(e)), if this collection contains one
- * or more such elements. Returns true if this collection contained
- * the specified element (or equivalently, if this collection changed
- * as a result of the call).
- * @param value - reference to the element to remove.
- * @returns true if the collection was changed
- * @throw UnsupportedOperationException
- * @throw NullPointerException
- */
- virtual bool remove( const E& value )
- throw ( lang::exceptions::UnsupportedOperationException,
- lang::exceptions::NullPointerException ) = 0;
-
- /**
- * Returns true if this collection contains all of the elements in
- * the specified collection.
- * @param source - Collection to compare to this one.
- * @thorw Exception
- */
- virtual bool containsAll( const Collection<E>& source )
- throw ( lang::Exception ) = 0;
-
- /**
- * Adds all of the elements in the specified collection to this
- * collection. The behavior of this operation is undefined if the
- * specified collection is modified while the operation is in progress.
- * (This implies that the behavior of this call is undefined if the
- * specified collection is this collection, and this collection is
- * nonempty.)
- * @param source - Collection whose elements are added to this one.
- * @return true if this collection changed as a result of the call
- * @throw UnsupportedOperationException
- * @throw NullPointerException
- * @throw IllegalArgumentException
- */
- virtual bool addAll( const Collection<E>& source )
- throw ( lang::exceptions::UnsupportedOperationException,
- lang::exceptions::NullPointerException,
- lang::exceptions::IllegalArgumentException ) = 0;
-
- /**
- * Removes all this collection's elements that are also contained in
- * the specified collection (optional operation). After this call returns,
- * this collection will contain no elements in common with the specified
- * collection.
- * @param value - The Collection whose elements are to be removed
- * @returns true if the collection changed as a result of this call
- * @throw UnsupportedOperationException
- * @throw NullPointerException
- * @throw IllegalArgumentException
- */
- virtual bool removeAll( const Collection<E>& value )
- throw ( lang::exceptions::UnsupportedOperationException,
- lang::exceptions::NullPointerException,
- lang::exceptions::IllegalArgumentException ) = 0;
-
- /**
- * Retains only the elements in this collection that are contained in the
- * specified collection (optional operation). In other words, removes from
- * this collection all of its elements that are not contained in the
- * specified collection.
- * @param value - The Collection whose elements are to be retained
- * @returns true if the collection changed as a result of this call
- * @throw UnsupportedOperationException
- * @throw NullPointerException
- * @throw IllegalArgumentException
- */
- virtual bool retainAll( const Collection<E> value )
- throw ( lang::exceptions::UnsupportedOperationException,
- lang::exceptions::NullPointerException,
- lang::exceptions::IllegalArgumentException ) = 0;
-
- /**
- * Removes all of the elements from this collection (optional operation).
- * This collection will be empty after this method returns unless it throws
- * an exception.
- * @throw UnsupportedOperationException
- */
- virtual void clear()
- throw ( lang::exceptions::UnsupportedOperationException ) = 0;
-
- /**
- * Compares the passed collection to this one, if they contain the
- * same elements, i.e. all their elements are equivalent, then it
- * returns true.
- * @returns true if the Collections contain the same elements.
- */
- virtual bool equals( const Collection<E>& value ) = 0;
-
- };
-
-}}
-
-#endif /*_DECAF_UTIL_COLLECTION_H_*/
diff --git a/src/decaf/src/main/decaf/util/Comparator.h b/src/decaf/src/main/decaf/util/Comparator.h
deleted file mode 100644
index 3701966..0000000
--- a/src/decaf/src/main/decaf/util/Comparator.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_COMPARATOR_H_
-#define _DECAF_UTIL_COMPARATOR_H_
-
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace util{
-
- /**
- * A comparison function, which imposes a total ordering on some collection
- * of objects. Comparators can be passed to a sort method (such as
- * Collections.sort) to allow precise control over the sort order. Comparators
- * can also be used to control the order of certain data structures.
- *
- * The ordering imposed by a Comparator c on a set of elements S is said to
- * be consistent with equals if and only if
- * ( compare( e1, e2) == 0 ) has the same boolean value as ( e1 == e2 ) for
- * every e1 and e2 in S.
- */
- template<typename T>
- class DECAF_API Comparator
- {
- public:
-
- virtual ~Comparator() {}
-
- /**
- * Compares its two arguments for order. Returns a negative integer, zero,
- * or a positive integer as the first argument is less than, equal to, or
- * greater than the second.
- *
- * The implementor must ensure that
- * sgn( compare(x, y)) == -sgn(compare(y, x) ) for all x and y.
- * (This implies that compare(x, y) must throw an exception if and only
- * if compare(y, x) throws an exception.)
- *
- * The implementor must also ensure that the relation is transitive:
- * ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0.
- *
- * Finally, the implementer must ensure that compare(x, y)==0 implies
- * that sgn(compare(x, z))==sgn(compare(y, z)) for all z.
- *
- * It is generally the case, but not strictly required that
- * (compare(x, y)==0) == ( x == y) ). Generally speaking, any comparator
- * that violates this condition should clearly indicate this fact. The
- * recommended language is "Note: this comparator imposes orderings that
- * are inconsistent with equals."
- * @param o1 - the first object to be compared
- * @param o2 - the second object to be compared
- * @returns a negative integer, zero, or a positive integer as the first
- * argument is less than, equal to, or greater than the second.
- */
- virtual int compare( const E& o1, const E& o2 ) = 0;
-
- };
-
-}}
-
-#endif /*_DECAF_UTIL_COMPARATOR_H_*/
diff --git a/src/decaf/src/main/decaf/util/Config.cpp b/src/decaf/src/main/decaf/util/Config.cpp
deleted file mode 100644
index 191aa53..0000000
--- a/src/decaf/src/main/decaf/util/Config.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <decaf/util/Config.h>
-
-_APR_LIBRARY _APR_LIBRARY::self;
diff --git a/src/decaf/src/main/decaf/util/Config.h b/src/decaf/src/main/decaf/util/Config.h
deleted file mode 100644
index 7ca005a..0000000
--- a/src/decaf/src/main/decaf/util/Config.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_CONFIG_H_
-#define _DECAF_UTIL_CONFIG_H_
-
-#ifdef DECAF_DLL
-#ifdef DECAF_EXPORTS
-#define DECAF_API __declspec(dllexport)
-#else
-#define DECAF_API __declspec(dllimport)
-#endif
-#else
-#define DECAF_API
-#endif
-
-//
-// The purpose of this header is to try to detect the supported headers
-// of the platform when the ./configure script is not being used to generate
-// the config.h file.
-//
-#if defined(HAVE_CONFIG_H)
-
- // config.h is generated by the ./configure script and it only
- // used by unix like systems (including cygwin)
- #include <config.h>
-
-#else /* !defined(HAVE_CONFIG_H) */
-
- // Not using ./configure script and make system.. chances are your using the native build tools
- // of Windows or OS X to do this build
-
- #if defined(_WIN32)
- #ifndef HAVE_OBJBASE_H
- #define HAVE_OBJBASE_H
- #endif
- #ifndef HAVE_RPCDCE_H
- #define HAVE_RPCDCE_H
- #endif
- #ifndef HAVE_WINSOCK2_H
- #define HAVE_WINSOCK2_H
- #endif
- #ifndef HAVE_STRUCT_ADDRINFO
- #define HAVE_STRUCT_ADDRINFO
- #endif
- #ifndef HAVE_SYS_TIMEB_H
- #define HAVE_SYS_TIMEB_H
- #endif
- #ifndef HAVE_FTIME
- #define HAVE_FTIME
- #endif
- #ifndef HAVE_WINDOWS_H
- #define HAVE_WINDOWS_H
- #endif
- #else
- #ifndef HAVE_UUID_UUID_H
- #define HAVE_UUID_UUID_H
- #endif
- #ifndef HAVE_UUID_T
- #define HAVE_UUID_T
- #endif
- #ifndef HAVE_PTHREAD_H
- #define HAVE_PTHREAD_H
- #endif
- #endif
-
-#endif /* !defined(HAVE_CONFIG_H) */
-
-// Macro to mark attributes as unused
-#ifdef __GNUC__
- #define DECAF_UNUSED __attribute__ ((__unused__))
-#else
- #define DECAF_UNUSED
-#endif
-
-
-// Define a class to hanlde APR initialization and termination, then declare a global
-// static instance that will cause the library to only be initialized once.
-#include <apr.h>
-#include <apr_general.h>
-#include <apr_pools.h>
-
-class _APR_LIBRARY {
-public:
-
- _APR_LIBRARY() {
- apr_initialize();
- }
-
- ~_APR_LIBRARY() {
- apr_terminate();
- }
-
-private:
-
- static _APR_LIBRARY self;
-
-};
-
-#endif /*_DECAF_UTIL_CONFIG_H_*/
diff --git a/src/decaf/src/main/decaf/util/Date.cpp b/src/decaf/src/main/decaf/util/Date.cpp
deleted file mode 100644
index 9eb6ea9..0000000
--- a/src/decaf/src/main/decaf/util/Date.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <decaf/util/Date.h>
-#include <decaf/util/Config.h>
-#include <decaf/lang/exceptions/UnsupportedOperationException.h>
-
-#include <apr_time.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::util;
-using namespace decaf::lang::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-long long Date::getCurrentTimeMilliseconds(){
- return apr_time_now() / 1000;
-}
diff --git a/src/decaf/src/main/decaf/util/Date.h b/src/decaf/src/main/decaf/util/Date.h
deleted file mode 100644
index 54c8f4e..0000000
--- a/src/decaf/src/main/decaf/util/Date.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_DATE_H_
-#define _DECAF_UTIL_DATE_H_
-
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace util{
-
- /**
- * Wrapper class around a time value in milliseconds. This
- * class is comparable to Java's java.util.Date class.
- */
- class DECAF_API Date
- {
- private:
-
- /**
- * The underlying time value in milliseconds�
- */
- long long time;
-
- public:
-
- /**
- * Default constructor - sets time to now.
- */
- Date(){
- time = getCurrentTimeMilliseconds();
- }
-
- /**
- * Constructs the date with a given time value.
- * @param milliseconds The time in milliseconds;
- */
- Date( long long milliseconds ){
- this->time = milliseconds;
- }
-
- /**
- * Copy constructor.
- */
- Date( const Date& source ){
- (*this) = source;
- }
-
- virtual ~Date(){}
-
- /**
- * Gets the underlying time.
- * @return The underlying time value in milliseconds.
- */
- long long getTime() const{
- return time;
- }
-
- /**
- * Sets the underlying time.
- * @param milliseconds The underlying time value in
- * milliseconds.
- */
- void setTime( long long milliseconds ){
- this->time = milliseconds;
- }
-
- /**
- * Determines wether or not this date falls after the
- * specified time.
- * @param when The date to compare
- * @return true if this date falls after when.
- */
- bool after( Date& when ) const{
- return time > when.time;
- }
-
- /**
- * Determines wether or not this date falls before the
- * specified time.
- * @param when The date to compare
- * @return true if this date falls before when.
- */
- bool before( Date& when ) const{
- return time < when.time;
- }
-
- /**
- * Determines wether or not this date is equal to the
- * specified time.
- * @param when The date to compare
- * @return true if this date is equal to when.
- */
- bool equals( Date& when ) const{
- return time == when.time;
- }
-
- /**
- * Assignment operator.
- */
- Date& operator =( const Date& source ){
- this->time = source.time;
- return *this;
- }
-
- /**
- * Returns the current time in milliseconds. Comparable
- * to Java's System.currentTimeMillis method.
- * @return The current time in milliseconds.
- */
- static long long getCurrentTimeMilliseconds();
- };
-
-}}
-
-#endif /*_DECAF_UTIL_DATE_H_*/
diff --git a/src/decaf/src/main/decaf/util/Iterator.h b/src/decaf/src/main/decaf/util/Iterator.h
deleted file mode 100644
index 3409697..0000000
--- a/src/decaf/src/main/decaf/util/Iterator.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_ITERATOR_H_
-#define _DECAF_UTIL_ITERATOR_H_
-
-#include <decaf/lang/exceptions/NoSuchElementException.h>
-#include <decaf/lang/exceptions/IllegalStateException.h>
-#include <decaf/lang/exceptions/UnsupportedOperationException.h>
-
-namespace decaf{
-namespace util{
-
- /**
- * Defines an object that can be used to iterate over the elements of a
- * collection. The iterator provides a way to access and remove elements
- * with well defined semantics.
- */
- template< typename T>
- class DECAF_API Iterator {
- public:
-
- virtual ~Iterator() {}
-
- /**
- * Returns the next element in the iteration. Calling this method
- * repeatedly until the hasNext() method returns false will return
- * each element in the underlying collection exactly once.
- * @returns next element in the iteration of elements
- * @throws NoSuchElementException - iteration has no more elements.
- */
- virtual T next() throw( lang::exceptions::NoSuchElementException ) = 0;
-
- /**
- * Returns true if the iteration has more elements. Returns false if
- * the next call to next would result in an NoSuchElementException to
- * be thrown.
- */
- virtual bool hasNext() const = 0;
-
- /**
- * Removes from the underlying collection the last element returned
- * by the iterator (optional operation). This method can be called
- * only once per call to next. The behavior of an iterator is
- * unspecified if the underlying collection is modified while the
- * iteration is in progress in any way other than by calling this
- * method.
- * @throws UnsupportedOperationException - if the remove operation
- * is not supported by this Iterator.
- * @throws IllegalStateException - if the next method has not yet been
- * called, or the remove method has already been called after
- * the last call to the next method.
- */
- virtual void remove() throw ( lang::exceptions::IllegalStateException,
- lang::exceptions::UnsupportedOperationException ) = 0;
-
- };
-
-}}
-
-#endif /*_DECAF_UTIL_ITERATOR_H_*/
diff --git a/src/decaf/src/main/decaf/util/Map.h b/src/decaf/src/main/decaf/util/Map.h
deleted file mode 100644
index 7575d4c..0000000
--- a/src/decaf/src/main/decaf/util/Map.h
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_MAP_H_
-#define _DECAF_UTIL_MAP_H_
-
-#include <map>
-#include <vector>
-#include <decaf/lang/exceptions/NoSuchElementException.h>
-#include <decaf/util/concurrent/Synchronizable.h>
-#include <decaf/util/concurrent/Mutex.h>
-
-namespace decaf{
-namespace util{
-
- /**
- * Map template that wraps around a std::map to provide
- * a more user-friendly interface and to provide common
- * functions that do not exist in std::map.
- */
- template <typename K, typename V> class DECAF_API Map : public concurrent::Synchronizable
- {
- private:
-
- std::map<K,V> valueMap;
- concurrent::Mutex mutex;
-
- public:
-
- /**
- * Default constructor - does nothing.
- */
- Map() {}
-
- /**
- * Copy constructor - copies the content of the given map into this
- * one.
- * @param source The source map.
- */
- Map( const Map& source ) : concurrent::Synchronizable() {
- copy( source );
- }
-
- virtual ~Map() {}
-
- /**
- * Comparison, equality is dependant on the method of determining
- * if the element are equal.
- * @param source - Map to compare to this one.
- * @returns true if the Map passed is equal in value to this one.
- */
- virtual bool equals( const Map& source ) const {
- return this->valueMap == source.valueMap;
- }
-
- /**
- * Copies the content of the source map into this map. Erases
- * all existing data in this map.
- * @param source The source object to copy from.
- */
- virtual void copy( const Map& source ) {
-
- // Erase the content of this object, and copy from the source
- // all the elements. We access source's private map since we
- // are also a Map, this saves us a lot of time.
- valueMap.clear();
- valueMap.insert( source.valueMap.begin(), source.valueMap.end() );
- }
-
- /**
- * Removes all keys and values from this map.
- */
- virtual void clear() {
- valueMap.clear();
- }
-
- /**
- * Indicates whether or this map contains a value for the
- * given key.
- * @param key The key to look up.
- * @return true if this map contains the value, otherwise false.
- */
- virtual bool containsKey( const K& key ) const {
- typename std::map<K,V>::const_iterator iter;
- iter = valueMap.find(key);
- return iter != valueMap.end();
- }
-
- /**
- * Indicates whether or this map contains a value for the
- * given value, i.e. they are equal, this is done by operator==
- * so the types must pass equivalence testing in this manner.
- * @param value The Value to look up.
- * @return true if this map contains the value, otherwise false.
- */
- virtual bool containsValue( const V& value ) const {
-
- if( valueMap.empty() ){
- return false;
- }
-
- typename std::map<K,V>::const_iterator iter = valueMap.begin();
- for( ; iter != valueMap.end(); ++iter ){
- if( (*iter).second == value ) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * @return if the Map contains any element or not, TRUE or FALSE
- */
- virtual bool isEmpty() const {
- return valueMap.empty();
- }
-
- /**
- * @return The number of elements (key/value pairs) in this map.
- */
- virtual std::size_t size() const {
- return valueMap.size();
- }
-
- /**
- * Gets the value for the specified key.
- * @param key The search key.
- * @return The value for the given key.
- * @throws activemq::exceptions::NoSuchElementException
- */
- virtual V getValue( const K& key ) const
- throw( lang::exceptions::NoSuchElementException ) {
-
- typename std::map<K,V>::const_iterator iter;
- iter = valueMap.find(key);
- if( iter == valueMap.end() ){
- throw lang::exceptions::NoSuchElementException( __FILE__,
- __LINE__,
- "Key does not exist in map" );
- }
-
- return iter->second;
- }
-
- /**
- * Sets the value for the specified key.
- * @param key The target key.
- * @param value The value to be set.
- */
- virtual void setValue( const K& key, V value ) {
- valueMap[key] = value;
- }
-
- /**
- * Removes the value (key/value pair) for the specified key from
- * the map.
- * @param key The search key.
- */
- virtual void remove( const K& key ) {
- valueMap.erase( key );
- }
-
- /**
- * @return the entire set of keys in this map as a std::vector.
- */
- virtual std::vector<K> getKeys() const{
- std::vector<K> keys( valueMap.size() );
-
- typename std::map<K,V>::const_iterator iter;
- iter=valueMap.begin();
- for( int ix=0; iter != valueMap.end(); ++iter, ++ix ){
- keys[ix] = iter->first;
- }
-
- return keys;
- }
-
- /**
- * @return the entire set of values in this map as a std::vector.
- */
- virtual std::vector<V> getValues() const {
- std::vector<V> values( valueMap.size() );
-
- typename std::map<K,V>::const_iterator iter;
- iter=valueMap.begin();
- for( int ix=0; iter != valueMap.end(); ++iter, ++ix ){
- values[ix] = iter->second;
- }
-
- return values;
- }
-
- public: // Methods from Synchronizable
-
- /**
- * Locks the object.
- * @throws ActiveMQException
- */
- virtual void lock() throw( lang::Exception ) {
- mutex.lock();
- }
-
- /**
- * Unlocks the object.
- * @throws ActiveMQException
- */
- virtual void unlock() throw( lang::Exception ) {
- mutex.unlock();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- * @throws ActiveMQException
- */
- virtual void wait() throw( lang::Exception ) {
- mutex.wait();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param millisecs the time in millisecsonds to wait, or
- * WAIT_INIFINITE
- * @throws ActiveMQException
- */
- virtual void wait( unsigned long millisecs )
- throw( lang::Exception ) {
- mutex.wait(millisecs);
- }
-
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws ActiveMQException
- */
- virtual void notify() throw( lang::Exception ) {
- mutex.notify();
- }
-
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws ActiveMQException
- */
- virtual void notifyAll() throw( lang::Exception ) {
- mutex.notifyAll();
- }
- };
-
-}}
-
-#endif /*_DECAF_UTIL_MAP_H_*/
diff --git a/src/decaf/src/main/decaf/util/Properties.h b/src/decaf/src/main/decaf/util/Properties.h
deleted file mode 100644
index 0993aef..0000000
--- a/src/decaf/src/main/decaf/util/Properties.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_PROPERTIES_H_
-#define _DECAF_UTIL_PROPERTIES_H_
-
-#include <map>
-#include <vector>
-#include <string>
-#include <sstream>
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace util{
-
- /**
- * Java-like properties class for mapping string names to string values.
- */
- class DECAF_API Properties{
- private:
-
- std::map< std::string, std::string > properties;
-
- public:
-
- virtual ~Properties(){}
-
- /**
- * Returns true if the properties object is empty
- * @return true if empty
- */
- virtual bool isEmpty() const {
- return properties.empty();
- }
-
- /**
- * Looks up the value for the given property.
- * @param name The name of the property to be looked up.
- * @return the value of the property with the given name, if it
- * exists. If it does not exist, returns NULL.
- */
- virtual const char* getProperty( const std::string& name ) const{
-
- std::map< std::string, std::string >::const_iterator iter =
- properties.find( name );
- if( iter == properties.end() ){
- return NULL;
- }
-
- return iter->second.c_str();
- }
-
- /**
- * Looks up the value for the given property.
- * @param name the name of the property to be looked up.
- * @param defaultValue The value to be returned if the given
- * property does not exist.
- * @return The value of the property specified by <code>name</code>, if it
- * exists, otherwise the <code>defaultValue</code>.
- */
- virtual std::string getProperty( const std::string& name,
- const std::string& defaultValue ) const {
-
- std::map< std::string, std::string >::const_iterator iter =
- properties.find( name );
- if( iter == properties.end() ){
- return defaultValue;
- }
-
- return iter->second;
- }
-
- /**
- * Sets the value for a given property. If the property already
- * exists, overwrites the value.
- * @param name The name of the value to be written.
- * @param value The value to be written.
- */
- virtual void setProperty( const std::string& name,
- const std::string& value ){
- properties[name] = value;
- //properties.insert( std::make_pair( name, value ) );
- }
-
- /**
- * Check to see if the Property exists in the set
- * @param name - property name to check for in this properties set.
- * @return true if property exists, false otherwise.
- */
- virtual bool hasProperty( const std::string& name ) const
- {
- if(properties.find(name) != properties.end())
- {
- return true;
- }
-
- return false;
- }
-
- /**
- * Removes the property with the given name.
- * @param name the name of the property to remove.
- */
- virtual void remove( const std::string& name ){
- properties.erase( name );
- }
-
- /**
- * Method that serializes the contents of the property map to
- * an arryay.
- * @return list of pairs where the first is the name and the second
- * is the value.
- */
- virtual std::vector< std::pair< std::string, std::string > > toArray() const{
-
- // Create a vector big enough to hold all the elements in the map.
- std::vector< std::pair<std::string, std::string> > vec(
- properties.begin(), properties.end() );
-
- return vec;
- }
-
- /**
- * Copies the contents of the given properties object to this one.
- * @param source The source properties object.
- */
- virtual void copy( const Properties* source ){
-
- clear();
- this->properties = source->properties;
- }
-
- /**
- * Clones this object.
- * @returns a replica of this object.
- */
- virtual Properties* clone() const{
-
- Properties* props = new Properties();
-
- props->properties = properties;
-
- return props;
- }
-
- /**
- * Clears all properties from the map.
- */
- virtual void clear(){
- properties.clear();
- }
-
- /**
- * Formats the contents of the Properties Object into a string
- * that can be logged, etc.
- * @returns string value of this object.
- */
- virtual std::string toString() const {
-
- std::ostringstream stream;
- std::map< std::string, std::string >::const_iterator iter;
-
- stream << "Begin Class activemq::util::Properties:" << std::endl;
-
- for( iter = properties.begin(); iter != properties.end(); ++iter ){
- stream << " properties[" << iter->first << "] = "
- << iter->second << std::endl;
- }
-
- stream << "End Class activemq::util::Properties:" << std::endl;
-
- return stream.str();
- }
-
- };
-
-}}
-
-#endif /*_DECAF_UTIL_PROPERTIES_H_*/
diff --git a/src/decaf/src/main/decaf/util/Queue.h b/src/decaf/src/main/decaf/util/Queue.h
deleted file mode 100644
index 294cf74..0000000
--- a/src/decaf/src/main/decaf/util/Queue.h
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_QUEUE_H_
-#define _DECAF_UTIL_QUEUE_H_
-
-#include <list>
-#include <vector>
-#include <decaf/util/concurrent/Mutex.h>
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace util{
-
- /**
- * The Queue class accepts messages with an psuh(m) command
- * where m is the message to be queued. It destructively
- * returns the message with pop(). pop() returns messages in
- * the order they were enqueued.
- *
- * Queue is implemented with an instance of the STL queue object.
- * The interface is essentially the same as that of the STL queue
- * except that the pop method actually reaturns a reference to the
- * element popped. This frees the app from having to call the
- * <code>front</code> method before calling pop.
- *
- * Queue<string> sq; // make a queue to hold string messages
- * sq.push(s); // enqueues a message m
- * string s = sq.pop(); // dequeues a message
- *
- * = DESIGN CONSIDERATIONS
- *
- * The Queue class inherits from the Synchronizable interface and
- * provides methods for locking and unlocking this queue as well as
- * waiting on this queue. In a multi-threaded app this can allow
- * for multiple threads to be reading from and writing to the same
- * Queue.
- *
- * Clients should consider that in a multiple threaded app it is
- * possible that items could be placed on the queue faster than
- * you are taking them off, so protection should be placed in your
- * polling loop to ensure that you don't get stuck there.
- */
-
- template <typename T> class DECAF_API Queue : public concurrent::Synchronizable {
- public:
-
- Queue() {}
- virtual ~Queue() {}
-
- /**
- * Empties this queue.
- */
- void clear() {
- queue.clear();
- }
-
- /**
- * Returns a Reference to the element at the head of the queue
- * @return reference to a queue type object or (safe)
- */
- T& front() {
- if( queue.empty() ) {
- return safe;
- }
-
- return queue.front();
- }
-
- /**
- * Returns a Reference to the element at the head of the queue
- * @return reference to a queue type object or (safe)
- */
- const T& front() const {
- if( queue.empty() ) {
- return safe;
- }
-
- return queue.front();
- }
-
- /**
- * Returns a Reference to the element at the tail of the queue
- * @return reference to a queue type object or (safe)
- */
- T& back() {
- if( queue.empty() ) {
- return safe;
- }
-
- return queue.back();
- }
-
- /**
- * Returns a Reference to the element at the tail of the queue
- * @return reference to a queue type object or (safe)
- */
- const T& back() const {
- if( queue.empty() ) {
- return safe;
- }
-
- return queue.back();
- }
-
- /**
- * Places a new Object at the Tail of the queue
- * @param t - Queue Object Type reference.
- */
- void push( const T &t ) {
- queue.push_back( t );
- }
-
- /**
- * Places a new Object at the front of the queue
- * @param t - Queue Object Type reference.
- */
- void enqueueFront( const T &t ) {
- queue.push_front( t );
- }
-
- /**
- * Removes and returns the element that is at the Head of the queue
- * @return reference to a queue type object or (safe)
- */
- T pop() {
- if( queue.empty() ) {
- return safe;
- }
-
- // Pop the element into a temp, since we need to remain locked.
- // this means getting front and then popping.
- T temp = queue.front();
- queue.pop_front();
-
- return temp;
- }
-
- /**
- * Gets the Number of elements currently in the Queue
- * @return Queue Size
- */
- size_t size() const{
- return queue.size();
- }
-
- /**
- * Checks if this Queue is currently empty
- * @return boolean indicating queue emptiness
- */
- bool empty() const {
- return queue.empty();
- }
-
- /**
- * @return the all values in this queue as a std::vector.
- */
- virtual std::vector<T> toArray() const {
- std::vector<T> valueArray( queue.begin(), queue.end() );
- return valueArray;
- }
-
- /**
- * Reverses the order of the contents of this queue and stores them
- * in the target queue.
- * @param target - The target queue that will receive the contents of
- * this queue in reverse order.
- */
- void reverse( Queue<T>& target ) const {
- target.queue.insert( target.queue.end(), queue.rbegin(), queue.rend() );
- }
-
- /**
- * Locks the object.
- */
- virtual void lock() throw( lang::Exception ){
- mutex.lock();
- }
-
- /**
- * Unlocks the object.
- */
- virtual void unlock() throw( lang::Exception ){
- mutex.unlock();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- */
- virtual void wait() throw( lang::Exception ){
- mutex.wait();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param millisecs time to wait, or WAIT_INIFINITE
- * @throws ActiveMQException
- */
- virtual void wait( unsigned long millisecs )
- throw( lang::Exception ) {
-
- mutex.wait(millisecs);
- }
-
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- */
- virtual void notify() throw( lang::Exception ){
- mutex.notify();
- }
-
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- */
- virtual void notifyAll() throw( lang::Exception ){
- mutex.notifyAll();
- }
-
- public: // Statics
-
- /**
- * Fetch a reference to the safe value this object will return
- * when there is nothing to fetch from the queue.
- * @return Reference to this Queues safe object
- */
- static const T& getSafeValue() { return safe; }
-
- private:
-
- // The real queue
- std::list<T> queue;
-
- // Object used for sync
- util::concurrent::Mutex mutex;
-
- // Safe value used when pop, front or back are
- // called and the queue is empty.
- static T safe;
-
- };
-
- //-----{ Static Init }----------------------------------------------------//
- template <typename T> T Queue<T>::safe;
-
-}}
-
-#endif /*_DECAF_UTIL_QUEUE_H_*/
diff --git a/src/decaf/src/main/decaf/util/Random.cpp b/src/decaf/src/main/decaf/util/Random.cpp
deleted file mode 100644
index 0df6574..0000000
--- a/src/decaf/src/main/decaf/util/Random.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Random.h"
-
-#include <decaf/util/Date.h>
-
-using namespace decaf;
-using namespace decaf::util;
-using namespace decaf::lang;
-
-unsigned long long Random::multiplier = 0x5deece66dLL;
-
-////////////////////////////////////////////////////////////////////////////////
-Random::Random() {
- setSeed(Date::getCurrentTimeMilliseconds());
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Random::Random( unsigned long long seed ) {
- setSeed(seed);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Random::nextBoolean() {
- return next(1) != 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Random::nextBytes( std::vector<unsigned char>& buf ) {
- int rand = 0;
- std::size_t count = 0, loop = 0;
- while (count < buf.size()) {
- if (loop == 0) {
- rand = nextInt();
- loop = 3;
- } else {
- loop--;
- }
- buf[count++] = (unsigned char) rand;
- rand >>= 8;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Random::nextDouble() {
- // was: return ((((long long) next(26) << 27) + next(27)) / (double) (1L << 53));
- long long divisor = 1LL;
- divisor <<= 31;
- divisor <<= 22;
- return ((((long long) next(26) << 27) + next(27)) / (double) divisor);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-float Random::nextFloat() {
- return (next(24) / 16777216.0f);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Random::nextGaussian() {
- if (haveNextNextGaussian) {
- // if X1 has been returned, return the second Gaussian
- haveNextNextGaussian = false;
- return nextNextGaussian;
- }
-
- double v1, v2, s;
- do {
- // Generates two independent random variables U1, U2
- v1 = 2 * nextDouble() - 1;
- v2 = 2 * nextDouble() - 1;
- s = v1 * v1 + v2 * v2;
- } while (s >= 1);
- double norm = std::sqrt(-2 * std::log(s) / s);
- // should that not be norm instead of multiplier ?
- nextNextGaussian = v2 * norm;
- haveNextNextGaussian = true;
- // should that not be norm instead of multiplier ?
- return v1 * norm;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Random::nextInt() {
- return next(32);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Random::nextInt( int n ) throw( exceptions::IllegalArgumentException ) {
- if (n > 0) {
- if ((n & -n) == n) {
- return (int) ((n * (long long) next(31)) >> 31);
- }
- int bits, val;
- do {
- bits = next(31);
- val = bits % n;
- } while (bits - val + (n - 1) < 0);
- return val;
- }
- throw exceptions::IllegalArgumentException();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long Random::nextLong() {
- return ((long long) next(32) << 32) + next(32);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Random::setSeed( unsigned long long seed ) {
- // was this->seed = (seed ^ multiplier) & ((1L << 48) - 1);
- unsigned long long mask = 1ULL;
- mask <<= 31;
- mask <<= 17;
- this->seed = (seed ^ multiplier) & (mask - 1);
- haveNextNextGaussian = false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Random::next( int bits ) {
- // was: seed = (seed * multiplier + 0xbL) & ((1L << 48) - 1);
- long long mask = 1L;
- mask <<= 31;
- mask <<= 17;
- seed = (seed * multiplier + 0xbL) & (mask - 1);
- // was: return (int) (seed >>> (48 - bits));
- return (int) (seed >> (48 - bits));
-}
diff --git a/src/decaf/src/main/decaf/util/Random.h b/src/decaf/src/main/decaf/util/Random.h
deleted file mode 100644
index 0ea456b..0000000
--- a/src/decaf/src/main/decaf/util/Random.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_RANDOM_H_
-#define _DECAF_UTIL_RANDOM_H_
-
-#include <decaf/lang/exceptions/IllegalArgumentException.h>
-#include <decaf/util/Config.h>
-#include <vector>
-#include <cmath>
-
-namespace decaf{
-namespace util{
-
- class DECAF_API Random
- {
- public:
-
- /**
- * Construct a random generator with the current time of day in
- * milliseconds as the initial state.
- *
- * @see #setSeed
- */
- Random();
-
- /**
- * Construct a random generator with the given <code>seed</code>
- * as the initial state.
- *
- * @param seed the seed that will determine the initial state of
- * this random number generator
- *
- * @see #setSeed
- */
- Random( unsigned long long seed );
-
- /**
- * Answers the next pseudo-random, uniformly distributed boolean
- * value generated by this generator.
- *
- * @return boolean a pseudo-random, uniformly distributed boolean
- * value
- */
- bool nextBoolean();
-
- /**
- * Modifies the byte array by a random sequence of bytes generated
- * by this random number generator.
- *
- * @param buf non-null array to contain the new random bytes
- *
- * @see #next
- */
- void nextBytes( std::vector<unsigned char>& buf );
-
- /**
- * Generates a normally distributed random double number between
- * 0.0 inclusively and 1.0 exclusively.
- *
- * @return double
- *
- * @see #nextFloat
- */
- double nextDouble();
-
- /**
- * Generates a normally distributed random float number between
- * 0.0 inclusively and 1.0 exclusively.
- *
- * @return float a random float number between 0.0 and 1.0
- *
- * @see #nextDouble
- */
- float nextFloat();
-
- /**
- * Pseudo-randomly generates (approximately) a normally
- * distributed <code>double</code> value with mean 0.0 and a
- * standard deviation value of <code>1.0</code> using the <i>polar
- * method<i> of G. E. P. Box, M. E. Muller, and G. Marsaglia, as
- * described by Donald E. Knuth in <i>The Art of Computer
- * Programming, Volume 2: Seminumerical Algorithms</i>, section
- * 3.4.1, subsection C, algorithm P
- *
- * @return double
- *
- * @see #nextDouble
- */
- double nextGaussian();
-
- /**
- * Generates a uniformly distributed 32-bit <code>int</code> value
- * from the this random number sequence.
- *
- * @return int uniformly distributed <code>int</code> value
- *
- * @see #next
- * @see #nextLong
- */
- int nextInt();
-
- /**
- * Returns to the caller a new pseudo-random integer value which
- * is uniformly distributed between 0 (inclusively) and the value
- * of <code>n</code> (exclusively).
- *
- * @return int
- * @param n int
- *
- * @throws IllegalArgumentException
- */
- int nextInt( int n ) throw( lang::exceptions::IllegalArgumentException );
-
- /**
- * Generates a uniformly distributed 64-bit <code>int</code> value
- * from the this random number sequence.
- *
- * @return 64-bit <code>int</code> random number
- *
- * @see #next
- * @see #nextInt()
- * @see #nextInt(int)
- */
- long long nextLong();
-
- /**
- * Modifies the seed using linear congruential formula presented
- * in <i>The Art of Computer Programming, Volume 2</i>, Section
- * 3.2.1.
- *
- * @param seed the seed that alters the state of the random number
- * generator
- *
- * @see #next
- * @see #Random()
- * @see #Random(long)
- */
- void setSeed( unsigned long long seed );
-
- protected:
-
- /**
- * Answers a pseudo-random uniformly distributed <code>int</code>
- * value of the number of bits specified by the argument
- * <code>bits</code> as described by Donald E. Knuth in <i>The Art
- * of Computer Programming, Volume 2: Seminumerical
- * Algorithms</i>, section 3.2.1.
- *
- * @return int a pseudo-random generated int number
- * @param bits number of bits of the returned value
- *
- * @see #nextBytes
- * @see #nextDouble
- * @see #nextFloat
- * @see #nextInt()
- * @see #nextInt(int)
- * @see #nextGaussian
- * @see #nextLong
- */
- int next( int bits );
-
- private:
-
- static unsigned long long multiplier;
-
- /**
- * The boolean value indicating if the second Gaussian number is available.
- */
- bool haveNextNextGaussian;
-
- /**
- * It is associated with the internal state of this generator.
- */
- unsigned long long seed;
-
- /**
- * The second Gaussian generated number.
- */
- double nextNextGaussian;
-
- };
-
-}}
-
-#endif /*_DECAF_UTIL_RANDOM_H_*/
diff --git a/src/decaf/src/main/decaf/util/Set.h b/src/decaf/src/main/decaf/util/Set.h
deleted file mode 100644
index a6ae16a..0000000
--- a/src/decaf/src/main/decaf/util/Set.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_SET_H_
-#define _DECAF_UTIL_SET_H_
-
-#include <set>
-#include <vector>
-#include <decaf/lang/exceptions/NoSuchElementException.h>
-#include <decaf/util/concurrent/Synchronizable.h>
-#include <decaf/util/concurrent/Mutex.h>
-#include <decaf/util/Iterator.h>
-
-namespace decaf{
-namespace util{
-
- /**
- * Map template that wraps around a std::map to provide
- * a more user-friendly interface and to provide common
- * functions that do not exist in std::map.
- */
- template <typename E> class DECAF_API Set : public util::concurrent::Synchronizable
- {
- private:
-
- std::set<E> values;
- util::concurrent::Mutex mutex;
-
- private:
-
- class SetIterator : public Iterator<E> {
- private:
-
- typename std::set<E>::iterator current;
- typename std::set<E>::iterator previous;
- typename std::set<E>* set;
-
- public:
-
- SetIterator( typename std::set<E>* set ) {
- this->current = set->begin();
- this->previous = set->end();
- this->set = set;
- }
- virtual ~SetIterator() {}
-
- virtual E next() throw( lang::exceptions::NoSuchElementException ){
- if( this->current == set->end() ) {
- throw lang::exceptions::NoSuchElementException(
- __FILE__, __LINE__,
- "Set::Iterator::next - No more elements to return" );
- }
-
- this->previous = this->current;
- return *( this->current++ );
- }
-
- virtual bool hasNext() const {
- return ( this->current != set->end() );
- }
-
- virtual void remove() throw ( lang::exceptions::IllegalStateException,
- lang::exceptions::UnsupportedOperationException ){
- if( this->previous == set->end() ) {
- throw lang::exceptions::IllegalStateException(
- __FILE__, __LINE__,
- "Set::Iterator::remove - Invalid State to call remove" );
- }
-
- this->set->erase( this->previous );
- this->previous = this->set->end();
- }
- };
-
- public:
-
- /**
- * Default constructor - does nothing.
- */
- Set(){}
-
- /**
- * Copy constructor - copies the content of the given set into this
- * one.
- * @param source The source set.
- */
- Set( const Set& source ){
- copy( source );
- }
-
- virtual ~Set(){}
-
- /**
- * Returns an iterator for this collection. The order of Iteration
- * is in no particular order other than the natural ording of the
- * elements in the Set class.
- * @returns Iterator<E> for this collection
- */
- Iterator<E>* iterator() {
- return new SetIterator( &values );
- }
-
- /**
- * Copies the content of the source set into this set. Erases
- * all existing data in this st.
- * @param source The source object to copy from.
- */
- virtual void copy( const Set& source ) {
- // Add all of the entries to this map.
- values = source.values;
- }
-
- /**
- * Removes all values from this set.
- */
- virtual void clear() {
- values.clear();
- }
-
- /**
- * Indicates whether or this set contains the given value.
- * @param value The value to look up.
- * @return true if this set contains the value, otherwise false.
- */
- virtual bool contains( const E& value ) const {
- typename std::set<E>::const_iterator iter;
- iter = values.find( value );
- return iter != values.end();
- }
-
- /**
- * @return if the set contains any element or not, TRUE or FALSE
- */
- virtual bool isEmpty() const {
- return values.empty();
- }
-
- /**
- * @return The number of elements in this set.
- */
- virtual std::size_t size() const {
- return values.size();
- }
-
- /**
- * Adds the given value to the set.
- * @param value The value to add.
- */
- virtual void add( const E& value ) {
- values.insert( value );
- }
-
- /**
- * Removes the value from the set.
- * @param value The value to be removed.
- */
- virtual void remove( const E& value ) {
- values.erase( value );
- }
-
- /**
- * @return the all values in this set as a std::vector.
- */
- virtual std::vector<E> toArray() const {
- std::vector<E> valueArray( values.size() );
-
- typename std::set<E>::const_iterator iter;
- iter=values.begin();
- for( int ix=0; iter != values.end(); ++iter, ++ix ){
- valueArray[ix] = *iter;
- }
-
- return valueArray;
- }
-
- public: // Methods from Synchronizable
-
- /**
- * Locks the object.
- * @throws Exception
- */
- virtual void lock() throw( lang::Exception ) {
- mutex.lock();
- }
-
- /**
- * Unlocks the object.
- * @throws Exception
- */
- virtual void unlock() throw( lang::Exception ) {
- mutex.unlock();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void wait() throw( lang::Exception ) {
- mutex.wait();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param millisecs the time in millisecsonds to wait, or
- * WAIT_INIFINITE
- * @throws Exception
- */
- virtual void wait( unsigned long millisecs )
- throw( lang::Exception ) {
- mutex.wait( millisecs );
- }
-
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notify() throw( lang::Exception ) {
- mutex.notify();
- }
-
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notifyAll() throw( lang::Exception ) {
- mutex.notifyAll();
- }
- };
-
-}}
-
-#endif /*_DECAF_UTIL_SET_H_*/
diff --git a/src/decaf/src/main/decaf/util/StringTokenizer.cpp b/src/decaf/src/main/decaf/util/StringTokenizer.cpp
deleted file mode 100644
index a65834a..0000000
--- a/src/decaf/src/main/decaf/util/StringTokenizer.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "StringTokenizer.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::util;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-StringTokenizer::StringTokenizer( const std::string& str,
- const std::string& delim,
- bool returnDelims ) {
- // store off the data
- this->str = str;
- this->delim = delim;
- this->returnDelims = returnDelims;
-
- // Start and the beginning
- pos = 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-StringTokenizer::~StringTokenizer(){
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int StringTokenizer::countTokens() const
-{
- int count = 0;
- string::size_type localPos = pos;
- string::size_type lastPos = pos;
-
- while( localPos != string::npos ) {
-
- if( returnDelims && str.find_first_of( delim, localPos ) == localPos ) {
- count += 1;
- localPos += 1;
- continue;
- }
-
- // Find first token by spanning the fist non-delimiter, to the
- // next delimiter, skipping any delimiters that are at the curret
- // location.
- lastPos = str.find_first_not_of( delim, localPos );
- localPos = str.find_first_of( delim, lastPos );
-
- if( lastPos != string::npos ) {
- count++;
- }
- }
-
- return count;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool StringTokenizer::hasMoreTokens() const
-{
- string::size_type nextpos =
- returnDelims ? str.find_first_of( delim, pos ) :
- str.find_first_not_of( delim, pos );
-
- return ( nextpos != string::npos );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string StringTokenizer::nextToken()
- throw ( lang::exceptions::NoSuchElementException )
-{
- if( pos == string::npos ) {
- throw NoSuchElementException(
- __FILE__, __LINE__,
- "StringTokenizer::nextToken - No more Tokens available");
- }
-
- if( returnDelims ) {
- // if char at current pos is a delim return it and advance pos
- if( str.find_first_of( delim, pos ) == pos ) {
- return str.substr( pos++, 1 );
- }
- }
-
- // Skip delimiters at beginning.
- string::size_type lastPos = str.find_first_not_of( delim, pos );
-
- // Find the next delimiter in the string, the charactors in between
- // will be the token to return. If this returns string::npos then
- // there are no more delimiters in the string.
- pos = str.find_first_of( delim, lastPos );
-
- if( string::npos != lastPos ) {
- // Found a token, count it, if the pos of the next delim is npos
- // then we set length to copy to npos so that all the remianing
- // portion of the string is copied, otherwise we set it to the
- return str.substr( lastPos,
- pos == string::npos ? pos : pos-lastPos );
- } else {
- throw NoSuchElementException(
- __FILE__, __LINE__,
- "StringTokenizer::nextToken - No more Tokens available" );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string StringTokenizer::nextToken( const std::string& delim )
- throw ( lang::exceptions::NoSuchElementException ) {
-
- this->delim = delim;
- return nextToken();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned int StringTokenizer::toArray( std::vector<std::string>& array )
-{
- int count = 0;
-
- while( hasMoreTokens() ) {
- array.push_back( nextToken() );
- count++;
- }
-
- return count;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void StringTokenizer::reset( const std::string& str,
- const std::string& delim,
- bool returnDelims )
-{
- if( str != "" ) {
- this->str = str;
- }
-
- if( delim != "" ) {
- this->delim = delim;
- }
-
- this->returnDelims = returnDelims;
-
- // Begin at the Beginning
- this->pos = 0;
-}
diff --git a/src/decaf/src/main/decaf/util/StringTokenizer.h b/src/decaf/src/main/decaf/util/StringTokenizer.h
deleted file mode 100644
index 7ae75b2..0000000
--- a/src/decaf/src/main/decaf/util/StringTokenizer.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_STRINGTOKENIZER_H_
-#define _DECAF_UTIL_STRINGTOKENIZER_H_
-
-#include <decaf/lang/exceptions/NoSuchElementException.h>
-#include <decaf/util/Config.h>
-#include <string>
-
-namespace decaf{
-namespace util{
-
- class DECAF_API StringTokenizer
- {
- private:
-
- // String to tokenize
- std::string str;
-
- // The delimiter string
- std::string delim;
-
- // The current pos in the string
- std::string::size_type pos;
-
- // Are we returning delimiters
- bool returnDelims;
-
- public:
-
- /**
- * Constructs a string tokenizer for the specified string. All
- * characters in the delim argument are the delimiters for separating
- * tokens.
- *
- * If the returnDelims flag is true, then the delimiter characters are
- * also returned as tokens. Each delimiter is returned as a string of
- * length one. If the flag is false, the delimiter characters are
- * skipped and only serve as separators between tokens.
- *
- * Note that if delim is "", this constructor does not throw an
- * exception. However, trying to invoke other methods on the resulting
- * StringTokenizer may result in an Exception.
- * @param string to tokenize
- * @param String containing the delimiters
- * @param boolean indicating if the delimiters are returned as tokens
- */
- StringTokenizer( const std::string& str,
- const std::string& delim = " \t\n\r\f",
- bool returnDelims = false);
-
- virtual ~StringTokenizer();
-
- /**
- * Calculates the number of times that this tokenizer's nextToken
- * method can be called before it generates an exception. The current
- * position is not advanced.
- * @return Count of remaining tokens
- */
- virtual int countTokens() const;
-
- /**
- * Tests if there are more tokens available from this tokenizer's
- * string.
- * @return true if there are more tokens remaining
- */
- virtual bool hasMoreTokens() const;
-
- /**
- * Returns the next token from this string tokenizer.
- * @return string value of next token
- * @thorws NoSuchElementException
- */
- virtual std::string nextToken()
- throw ( lang::exceptions::NoSuchElementException );
-
- /**
- * Returns the next token in this string tokenizer's string. First,
- * the set of characters considered to be delimiters by this
- * StringTokenizer object is changed to be the characters in the
- * string delim. Then the next token in the string after the current
- * position is returned. The current position is advanced beyond the
- * recognized token. The new delimiter set remains the default after
- * this call.
- * @param string containing the new set of delimiters
- * @return next string in the token list
- * @throw NoSuchElementException
- */
- virtual std::string nextToken( const std::string& delim )
- throw ( lang::exceptions::NoSuchElementException );
-
- /**
- * Grab all remaining tokens in the String and return them
- * in the vector that is passed in by reference.
- * @param vector to place token strings in
- * @return number of string placed into the vector
- */
- virtual unsigned int toArray( std::vector< std::string >& array );
-
- /**
- * Resets the Tokenizer's position in the String to the Beginning
- * calls to countToken and nextToken now start back at the beginning.
- * This allows this object to be reused, the caller need not create
- * a new instance every time a String needs tokenizing.
- * If set the string param will reset the string that this Tokenizer
- * is working on. If set to "" no change is made.
- * If set the delim param will reset the string that this Tokenizer
- * is using to tokenizer the string. If set to "", no change is made
- * If set the return Delims will set if this Tokenizer will return
- * delimiters as tokens. Defaults to false.
- * @param New String to tokenize or "", defaults to ""
- * @param New Delimiter String to use or "", defaults to ""
- * @param Should the Tokenizer return delimiters as Tokens, default false
- */
- virtual void reset( const std::string& str = "",
- const std::string& delim = "",
- bool returnDelims = false );
-
- };
-
-}}
-
-#endif /*_DECAF_UTIL_STRINGTOKENIZER_H_*/
diff --git a/src/decaf/src/main/decaf/util/UUID.cpp b/src/decaf/src/main/decaf/util/UUID.cpp
deleted file mode 100644
index e460910..0000000
--- a/src/decaf/src/main/decaf/util/UUID.cpp
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "UUID.h"
-#include <apr_strings.h>
-#include <apr_md5.h>
-#include <decaf/lang/exceptions/RuntimeException.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::util;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-UUID::UUID( long long mostSigBits, long long leastSigBits ) {
-
- memcpy( &apr_uuid.data[0], &mostSigBits, sizeof( long long ) );
- memcpy( &apr_uuid.data[sizeof(long long)], &leastSigBits, sizeof(long long ) );
-
- this->mostSigBits = mostSigBits;
- this->leastSigBits = leastSigBits;
-
- // Version indicator, set when a UUID is generated
- this->uuidVersion = (int)( mostSigBits & 0x000000000000F000LL ) >> 12;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-UUID::~UUID() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int UUID::compareTo( const UUID& value ) const {
- return apr_strnatcmp( (const char*)this->apr_uuid.data,
- (const char*)value.apr_uuid.data );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool UUID::equals( const UUID& value ) const {
- return apr_strnatcmp( (const char*)this->apr_uuid.data,
- (const char*)value.apr_uuid.data ) == 0 ? true : false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool UUID::operator==( const UUID& value ) const {
- return this->equals( value );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool UUID::operator<( const UUID& value ) const {
- return this->compareTo( value ) == -1 ? true : false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string UUID::toString() const {
- char buffer[APR_UUID_FORMATTED_LENGTH+1] = {0};
- apr_uuid_format( &buffer[0], &apr_uuid );
- return &buffer[0];
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long UUID::getLeastSignificantBits() const {
- return this->leastSigBits;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long UUID::getMostSignificantBits() const {
- long long result = 0;
- memcpy( &result, &this->apr_uuid.data[sizeof(long long)], sizeof(long long) );
- return this->mostSigBits;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long UUID::node() throw ( lang::exceptions::UnsupportedOperationException ) {
-
- if( this->version() != 1 ) {
- throw exceptions::UnsupportedOperationException(
- __FILE__, __LINE__,
- "UUID::node - Only a Version 1 UUID supports this operation." );
- }
-
- return ( this->leastSigBits & 0x0000FFFFFFFFFFFFULL );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long UUID::timestamp() throw ( lang::exceptions::UnsupportedOperationException ) {
-
- if( this->version() != 1 ) {
- throw exceptions::UnsupportedOperationException(
- __FILE__, __LINE__,
- "UUID::node - Only a Version 1 UUID supports this operation." );
- }
-
- // Mask out the version and shift values around to make time.
- long long timeLow = ( mostSigBits & 0xFFFFFFFF00000000ULL) >> 32;
- long long timeMid = ( mostSigBits & 0x00000000FFFF0000ULL) << 16;
- long long timeHigh = ( mostSigBits & 0x0000000000000FFFULL) << 48;
-
- return timeLow | timeMid | timeHigh;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int UUID::clockSequence() throw ( lang::exceptions::UnsupportedOperationException ) {
-
- if( this->version() != 1 ) {
- throw exceptions::UnsupportedOperationException(
- __FILE__, __LINE__,
- "UUID::node - Only a Version 1 UUID supports this operation." );
- }
-
- return (int)( ( this->leastSigBits & 0x3FFF000000000000ULL ) >> 48 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int UUID::variant() throw ( lang::exceptions::UnsupportedOperationException ) {
-
- // determine variant field
- if( ( this->leastSigBits & 0x8000000000000000ULL ) == 0 ) {
- // MSB0 not set, NCS backwards compatibility variant
- return 0;
- } else if( ( this->leastSigBits & 0x4000000000000000ULL ) != 0 ) {
- // MSB1 set, either MS reserved or future reserved
- return (int)( ( this->leastSigBits & 0xE000000000000000ULL ) >> 61 );
- }
-
- // MSB1 not set, RFC 4122 variant
- return 2;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int UUID::version() throw ( lang::exceptions::UnsupportedOperationException ) {
- return this->uuidVersion;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-UUID UUID::randomUUID() {
-
- apr_uuid_t temp;
- // Generate some random bytes.
- apr_uuid_get( &temp );
-
- long long msb = 0;
- long long lsb = 0;
-
- msb = (temp.data[0] & 0xFFLL) << 56;
- msb |= (temp.data[1] & 0xFFLL) << 48;
- msb |= (temp.data[2] & 0xFFLL) << 40;
- msb |= (temp.data[3] & 0xFFLL) << 32;
- msb |= (temp.data[4] & 0xFFLL) << 24;
- msb |= (temp.data[5] & 0xFFLL) << 16;
- msb |= (temp.data[6] & 0x0FLL) << 8;
- msb |= (0x4LL << 12); // set the version to 4
- msb |= (temp.data[7] & 0xFFLL);
-
- lsb = (temp.data[8] & 0x3FLL) << 56;
- lsb |= (0x2LL << 62); // set the variant to bits 01
- lsb |= (temp.data[9] & 0xFFLL) << 48;
- lsb |= (temp.data[10] & 0xFFLL) << 40;
- lsb |= (temp.data[11] & 0xFFLL) << 32;
- lsb |= (temp.data[12] & 0xFFLL) << 24;
- lsb |= (temp.data[13] & 0xFFLL) << 16;
- lsb |= (temp.data[14] & 0xFFLL) << 8;
- lsb |= (temp.data[15] & 0xFFLL);
-
- return UUID( msb, lsb );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-UUID UUID::nameUUIDFromBytes( const std::vector<char>& name ) {
- return UUID::nameUUIDFromBytes( &name[0], name.size() );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-UUID UUID::nameUUIDFromBytes( const char* name, std::size_t size ) {
-
- apr_uuid_t temp;
-
- if( apr_md5( &temp.data[0], name, size ) != APR_SUCCESS ) {
- throw exceptions::RuntimeException(
- __FILE__, __LINE__,
- "UUID::nameUUIDFromBytes - Failed to run MD5 encoder." );
- }
-
- long long msb = 0;
- long long lsb = 0;
-
- msb = (temp.data[0] & 0xFFLL) << 56;
- msb |= (temp.data[1] & 0xFFLL) << 48;
- msb |= (temp.data[2] & 0xFFLL) << 40;
- msb |= (temp.data[3] & 0xFFLL) << 32;
- msb |= (temp.data[4] & 0xFFLL) << 24;
- msb |= (temp.data[5] & 0xFFLL) << 16;
- msb |= (temp.data[6] & 0x0FLL) << 8;
- msb |= (0x3LL << 12); // set the version to 3
- msb |= (temp.data[7] & 0xFFLL);
-
- lsb = (temp.data[8] & 0x3FLL) << 56;
- lsb |= (0x2LL << 62); // set the variant to bits 01
- lsb |= (temp.data[9] & 0xFFLL) << 48;
- lsb |= (temp.data[10] & 0xFFLL) << 40;
- lsb |= (temp.data[11] & 0xFFLL) << 32;
- lsb |= (temp.data[12] & 0xFFLL) << 24;
- lsb |= (temp.data[13] & 0xFFLL) << 16;
- lsb |= (temp.data[14] & 0xFFLL) << 8;
- lsb |= (temp.data[15] & 0xFFLL);
-
- return UUID( msb, lsb );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-UUID UUID::fromString( const std::string& name )
- throw ( lang::exceptions::IllegalArgumentException ){
-
- apr_uuid_t temp;
-
- if( apr_uuid_parse( &temp, name.c_str() ) != APR_SUCCESS ) {
- throw lang::exceptions::IllegalArgumentException(
- __FILE__, __LINE__,
- "UUID::fromString - Invalid UUID String: ",
- name.c_str() );
- }
-
- long long mostSigBits = 0;
- long long leastSigBits = 0;
-
- // Extract to data from the uuid data
- memcpy( &mostSigBits, &temp.data[0], sizeof(long long) );
- memcpy( &leastSigBits, &temp.data[sizeof(long long)], sizeof(long long) );
-
- return UUID( mostSigBits, leastSigBits );
-}
diff --git a/src/decaf/src/main/decaf/util/UUID.h b/src/decaf/src/main/decaf/util/UUID.h
deleted file mode 100644
index 753c137..0000000
--- a/src/decaf/src/main/decaf/util/UUID.h
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_UUID_H_
-#define _DECAF_UTIL_UUID_H_
-
-#include <decaf/util/Config.h>
-#include <decaf/lang/Comparable.h>
-#include <decaf/lang/exceptions/UnsupportedOperationException.h>
-#include <decaf/lang/exceptions/IllegalArgumentException.h>
-#include <apr_uuid.h>
-#include <string>
-
-namespace decaf{
-namespace util{
-
- /**
- * A class that represents an immutable universally unique identifier (UUID).
- * A UUID represents a 128-bit value.
- *
- * There exist different variants of these global identifiers. The methods of
- * this class are for manipulating the Leach-Salz variant, although the
- * constructors allow the creation of any variant of UUID (described below).
- *
- * The layout of a variant 2 (Leach-Salz) UUID is as follows: The most
- * significant long consists of the following unsigned fields:
- *
- * 0xFFFFFFFF00000000 time_low
- * 0x00000000FFFF0000 time_mid
- * 0x000000000000F000 version
- * 0x0000000000000FFF time_hi
- *
- * The least significant long consists of the following unsigned fields:
- *
- * 0xC000000000000000 variant
- * 0x3FFF000000000000 clock_seq
- * 0x0000FFFFFFFFFFFF node
- *
- * The variant field contains a value which identifies the layout of the UUID.
- * The bit layout described above is valid only for a UUID with a variant value
- * of 2, which indicates the Leach-Salz variant.
- *
- * The version field holds a value that describes the type of this UUID. There
- * are four different basic types of UUIDs: time-based, DCE security, name-based,
- * and randomly generated UUIDs. These types have a version value of 1, 2, 3 and
- * 4, respectively.
- *
- * For more information including algorithms used to create UUIDs, see the
- * Internet-Draft UUIDs and GUIDs or the standards body definition at
- * ISO/IEC 11578:1996.
- */
- class UUID : public lang::Comparable<UUID> {
- private:
-
- // APR Uuid Type
- apr_uuid_t apr_uuid;
-
- // Copy of the High part of the data
- unsigned long long mostSigBits;
-
- // Copy of the Low part of the data
- unsigned long long leastSigBits;
-
- // Version indicator, set when a UUID is generated
- int uuidVersion;
-
- public:
-
- /**
- * Static factory to retrieve a type 4 (pseudo randomly generated) UUID.
- * The UUID is generated using a cryptographically strong pseudo random
- * number generator.
- * @return type 4 UUID
- */
- static UUID randomUUID();
-
- /**
- * Static factory to retrieve a type 3 (name based) UUID based on the
- * specified byte array.
- * @param name - a byte array to be used to construct a UUID.
- * @return type 3 UUID
- */
- static UUID nameUUIDFromBytes( const std::vector<char>& name );
-
- /**
- * Static factory to retrieve a type 3 (name based) UUID based on the
- * specified byte array.
- * @param name - a byte array to be used to construct a UUID.
- * @param size - the size of the byte array, or number of bytes to use.
- * @return type 3 UUID
- */
- static UUID nameUUIDFromBytes( const char* name, std::size_t size );
-
- /**
- * Creates a UUID from the string standard representation as described
- * in the toString() method.
- * @param name - a string to be used to construct a UUID.
- * @return type 3 UUID
- */
- static UUID fromString( const std::string& name )
- throw ( lang::exceptions::IllegalArgumentException );
-
- public:
-
- /**
- * Constructs a new UUID using the specified data. mostSigBits is used
- * for the most significant 64 bits of the UUID and leastSigBits becomes
- * the least significant 64 bits of the UUID.
- * @param mostSigBits
- * @param leastSigBits
- */
- UUID( long long mostSigBits, long long leastSigBits );
-
- virtual ~UUID();
-
- /**
- * Compare the given UUID to this one
- * @param value - the UUID to compare to
- */
- virtual int compareTo( const UUID& value ) const;
-
- /**
- * Compares this UUID to the one given, returns true if they are
- * equal
- * @param value - the UUID to compare to.
- * @return true if UUIDs are the same.
- */
- virtual bool equals( const UUID& value ) const;
-
- /**
- * Compares equality between this object and the one passed.
- * @param value - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator==( const UUID& value ) const;
-
- /**
- * Compares this object to another and returns true if this object
- * is considered to be less than the one passed. This
- * @param value - the value to be compared to this one.
- * @return true if this object is equal to the one passed.
- */
- virtual bool operator<( const UUID& value ) const;
-
- /**
- * Returns a String object representing this UUID. UUID's are formatted
- * as: 00112233-4455-6677-8899-AABBCCDDEEFF whose length is 36.
- * @returns formatted string for this UUID
- */
- virtual std::string toString() const;
-
- /**
- * @returns the most significant 64 bits of this UUID's 128 bit value.
- */
- virtual long long getLeastSignificantBits() const;
-
- /**
- * @returns the most significant 64 bits of this UUID's 128 bit value.
- */
- virtual long long getMostSignificantBits() const;
-
- /**
- * The node value associated with this UUID.
- *
- * The 48 bit node value is constructed from the node field of this UUID.
- * This field is intended to hold the IEEE 802 address of the machine that
- * generated this UUID to guarantee spatial uniqueness.
- *
- * The node value is only meaningful in a time-based UUID, which has
- * version type 1. If this UUID is not a time-based UUID then this method
- * throws UnsupportedOperationException.
- * @returns the node value of this UUID
- * @throws UnsupportedOperationException
- */
- virtual long long node()
- throw ( lang::exceptions::UnsupportedOperationException );
-
- /**
- * The timestamp value associated with this UUID.
- *
- * The 60 bit timestamp value is constructed from the time_low, time_mid,
- * and time_hi fields of this UUID. The resulting timestamp is measured in
- * 100-nanosecond units since midnight, October 15, 1582 UTC.
- *
- * The timestamp value is only meaningful in a time-based UUID, which has
- * version type 1. If this UUID is not a time-based UUID then this method
- * throws UnsupportedOperationException.
- * @returns the timestamp associated with a V1 UUID
- * @throws UnsupportedOperationException
- */
- virtual long long timestamp()
- throw ( lang::exceptions::UnsupportedOperationException );
-
- /**
- * The clock sequence value associated with this UUID.
- *
- * The 14 bit clock sequence value is constructed from the clock sequence
- * field of this UUID. The clock sequence field is used to guarantee temporal
- * uniqueness in a time-based UUID.
- *
- * The clockSequence value is only meaningful in a time-based UUID, which
- * has version type 1. If this UUID is not a time-based UUID then this
- * method throws UnsupportedOperationException.
- * @returns the clockSequeunce associated with a V1 UUID
- * @throws UnsupportedOperationException
- */
- virtual int clockSequence()
- throw ( lang::exceptions::UnsupportedOperationException );
-
- /**
- * The variant number associated with this UUID. The variant number describes
- * the layout of the UUID. The variant number has the following meaning:
- *
- * * 0 Reserved for NCS backward compatibility
- * * 2 The Leach-Salz variant (used by this class)
- * * 6 Reserved, Microsoft Corporation backward compatibility
- * * 7 Reserved for future definition
- *
- * @returns the variant associated with a V1 UUID
- * @throws UnsupportedOperationException
- */
- virtual int variant()
- throw ( lang::exceptions::UnsupportedOperationException );
-
- /**
- * The version number associated with this UUID. The version number describes
- * how this UUID was generated. The version number has the following meaning:
- *
- * * 1 Time-based UUID
- * * 2 DCE security UUID
- * * 3 Name-based UUID
- * * 4 Randomly generated UUID
- *
- * @returns the version associated with a V1 UUID
- * @throws UnsupportedOperationException
- */
- virtual int version()
- throw ( lang::exceptions::UnsupportedOperationException );
-
- };
-
-}}
-
-#endif /*_DECAF_UTIL_UUID_H_*/
diff --git a/src/decaf/src/main/decaf/util/concurrent/Concurrent.h b/src/decaf/src/main/decaf/util/concurrent/Concurrent.h
deleted file mode 100644
index 70b5be9..0000000
--- a/src/decaf/src/main/decaf/util/concurrent/Concurrent.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_CONCURRENT_CONCURRENT_H_
-#define _DECAF_UTIL_CONCURRENT_CONCURRENT_H_
-
-#include <decaf/util/concurrent/Lock.h>
-
-namespace decaf{
-namespace util{
-namespace concurrent{
-
-/**
- * The synchronized macro defines a mechanism for snycronizing
- * a scetion of code. The macro must be passed an object that
- * implements the Syncronizable interface.
- *
- * The macro works by creating a for loop that will loop exactly
- * once, creating a Lock object that is scoped to the loop. Once
- * the loop conpletes and exits the Lock object goes out of scope
- * releasing the lock on object W. For added safety the if else
- * is used because not all compiles restrict the lifetime of
- * loop variables to the loop, they will however restrict them
- * to the scope of the else.
- *
- * The macro would be used as follows.
- *
- * <Syncronizable> X;
- *
- * somefunction()
- * {
- * syncronized(X)
- * {
- * // Do something that needs syncronizing.
- * }
- * }
- */
-
-#define WAIT_INFINITE 0xFFFFFFFF
-
-#define synchronized(W) \
- if(false){} \
- else \
- for( decaf::util::concurrent::Lock lock_W(W); \
- lock_W.isLocked(); lock_W.unlock() )
-
-}}}
-
-#endif /*_DECAF_UTIL_CONCURRENT_CONCURRENT_H_*/
diff --git a/src/decaf/src/main/decaf/util/concurrent/CountDownLatch.cpp b/src/decaf/src/main/decaf/util/concurrent/CountDownLatch.cpp
deleted file mode 100644
index 6de53c9..0000000
--- a/src/decaf/src/main/decaf/util/concurrent/CountDownLatch.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "CountDownLatch.h"
-
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::util;
-using namespace decaf::util::concurrent;
-
-////////////////////////////////////////////////////////////////////////////////
-CountDownLatch::CountDownLatch( int count )
-{
- this->count = count;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-CountDownLatch::~CountDownLatch()
-{
- try {
-
- synchronized( &mutex ) {
- mutex.notifyAll();
- }
- }
- DECAF_CATCHALL_NOTHROW()
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void CountDownLatch::await() throw ( lang::Exception ) {
-
- try {
-
- synchronized( &mutex ) {
- if( count == 0 ){
- return;
- }
-
- mutex.wait();
- }
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool CountDownLatch::await( unsigned long timeOut ) throw ( lang::Exception ) {
- try {
-
- synchronized( &mutex ) {
- if( count == 0 ){
- return true;
- }
-
- mutex.wait( timeOut );
-
- return count == 0;
- }
-
- return true;
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void CountDownLatch::countDown() {
- try {
-
- if( count == 0 ) {
- return;
- }
-
- synchronized( &mutex ) {
- count--;
-
- // Signal when done.
- if( count == 0 ){
- mutex.notifyAll();
- }
- }
- }
- DECAF_CATCHALL_NOTHROW()
-}
diff --git a/src/decaf/src/main/decaf/util/concurrent/CountDownLatch.h b/src/decaf/src/main/decaf/util/concurrent/CountDownLatch.h
deleted file mode 100644
index 0936f68..0000000
--- a/src/decaf/src/main/decaf/util/concurrent/CountDownLatch.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_CONCURRENT_COUNTDOWNLATCH_H_
-#define _DECAF_CONCURRENT_COUNTDOWNLATCH_H_
-
-#include <decaf/util/concurrent/Mutex.h>
-#include <decaf/util/Config.h>
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace util{
-namespace concurrent{
-
- class DECAF_API CountDownLatch
- {
- private:
-
- /**
- * number to count down to
- */
- int count;
-
- /**
- * Mutex to protect the counts, and wait on.
- */
- Mutex mutex;
-
- public:
-
- /**
- * Constructor
- * @param count - number to count down from.
- */
- CountDownLatch( int count );
-
- virtual ~CountDownLatch();
-
- /**
- * Waits for the Count to be zero, and then returns
- * @throws CMSException
- */
- virtual void await() throw ( lang::Exception );
-
- /**
- * Waits for the Count to hit zero, or a timeout.
- * @param timeOut - time in milliseconds to wait.
- * @returns true if the wait made it to count zero, otherwise false
- */
- virtual bool await( unsigned long timeOut ) throw ( lang::Exception );
-
- /**
- * Counts down the latch, releasing all waiting threads when
- * the count hits zero.
- */
- virtual void countDown();
-
- /**
- * Gets the current count
- * @returns int count value
- */
- virtual int getCount() const {
- return this->count;
- }
-
- };
-
-}}}
-
-#endif /*_DECAF_CONCURRENT_COUNTDOWNLATCH_H_*/
diff --git a/src/decaf/src/main/decaf/util/concurrent/Lock.h b/src/decaf/src/main/decaf/util/concurrent/Lock.h
deleted file mode 100644
index 9973253..0000000
--- a/src/decaf/src/main/decaf/util/concurrent/Lock.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_CONCURRENT_LOCK_H_
-#define _DECAF_UTIL_CONCURRENT_LOCK_H_
-
-#include <decaf/lang/Exception.h>
-#include <decaf/util/concurrent/Synchronizable.h>
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace util{
-namespace concurrent{
-
- /**
- * A wrapper class around a given synchronization mechanism that
- * provides automatic release upon destruction.
- * @author Nathan Mittler
- */
- class Lock
- {
- private:
-
- /**
- * Flag to indicate whether or not this object has locked the
- * sync object.
- */
- bool locked;
-
- /**
- * The synchronizable object to lock/unlock.
- */
- Synchronizable* syncObject;
-
- public:
-
- /**
- * Constructor - initializes the object member and locks
- * the object if desired.
- * @param object The sync object to control
- * @param intiallyLocked If true, the object will automatically
- * be locked.
- */
- Lock( Synchronizable* object, const bool intiallyLocked = true )
- {
- try{
- syncObject = object;
- locked = false;
-
- if( intiallyLocked )
- {
- lock();
- }
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
- }
-
- /**
- * Destructor - Unlocks the object if it is locked.
- */
- virtual ~Lock()
- {
- try{
- if( locked )
- {
- syncObject->unlock();
- }
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
- }
-
- /**
- * Locks the object.
- */
- void lock()
- {
- try{
- syncObject->lock();
- locked = true;
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
- }
-
- /**
- * Unlocks the object.
- */
- void unlock()
- {
- try{
- if(locked)
- {
- syncObject->unlock();
- locked = false;
- }
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
- }
-
- /**
- * Indicates whether or not the object is locked.
- * @return true if the object is locked, otherwise false.
- */
- bool isLocked() const{ return locked; }
- };
-
-}}}
-
-#endif // _DECAF_UTIL_CONCURRENT_LOCK_H_
diff --git a/src/decaf/src/main/decaf/util/concurrent/Mutex.cpp b/src/decaf/src/main/decaf/util/concurrent/Mutex.cpp
deleted file mode 100644
index 9a0b65f..0000000
--- a/src/decaf/src/main/decaf/util/concurrent/Mutex.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <decaf/util/concurrent/Mutex.h>
-
-#include <apr_errno.h>
-#include <apr_time.h>
-
-using namespace decaf;
-using namespace decaf::util;
-using namespace decaf::util::concurrent;
-
-////////////////////////////////////////////////////////////////////////////////
-Mutex::Mutex() {
-
- apr_pool_create( &pool, NULL );
- apr_thread_mutex_create( &mutex, APR_THREAD_MUTEX_NESTED, pool );
- this->lock_owner = 0;
- this->lock_count = 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Mutex::~Mutex() {
-
- // Unlock the mutex.
- unlock();
-
- apr_thread_mutex_destroy( mutex );
- apr_pool_destroy( pool );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Mutex::lock() throw( lang::Exception ) {
-
- unsigned long threadId = lang::Thread::getId();
-
- if( threadId == lock_owner ) {
- lock_count++;
- } else {
- apr_thread_mutex_lock( mutex );
- lock_owner = threadId;
- lock_count = 1;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Mutex::unlock() throw( lang::Exception ) {
-
- if( lock_owner == 0 ) {
- return;
- }
-
- if( !isLockOwner() ) {
- throw lang::Exception(
- __FILE__, __LINE__,
- "Mutex::unlock - Failed, not Lock Owner!" );
- }
-
- lock_count--;
-
- if(lock_count == 0) {
- lock_owner = 0;
- apr_thread_mutex_unlock( mutex );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Mutex::wait() throw( lang::Exception )
-{
- // Delegate to the timed version
- wait( WAIT_INFINITE );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Mutex::wait( unsigned long millisecs )
- throw( lang::Exception )
-{
- if( !isLockOwner() ) {
- throw lang::Exception(
- __FILE__, __LINE__,
- "Mutex::wait - Failed, not Lock Owner!");
- }
-
- // Save the current owner as we are going to unlock and release for
- // someone else to lock on potentially. When we come back and
- // re-lock we want to restore to the state we were in before.
- unsigned long lock_owner = this->lock_owner;
- unsigned long lock_count = this->lock_count;
-
- this->lock_owner = 0;
- this->lock_count = 0;
-
- // Create this threads wait event
- apr_thread_cond_t* waitEvent = NULL;
- apr_thread_cond_create( &waitEvent, pool );
-
- // Store the event in the queue so that a notify can
- // call it and wake up the thread.
- eventQ.push_back( waitEvent );
-
- if( millisecs != WAIT_INFINITE ) {
- apr_interval_time_t wait = millisecs * 1000;
- apr_thread_cond_timedwait( waitEvent, mutex, wait );
- } else {
- apr_thread_cond_wait( waitEvent, mutex );
- }
-
- // Be Sure that the event is now removed
- eventQ.remove( waitEvent );
-
- // Destroy our wait event now, the notify method will have removed it
- // from the event queue.
- apr_thread_cond_destroy( waitEvent );
-
- // restore the owner
- this->lock_owner = lock_owner;
- this->lock_count = lock_count;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Mutex::notify() throw( lang::Exception )
-{
- if( !isLockOwner() ) {
- throw lang::Exception(
- __FILE__, __LINE__,
- "Mutex::Notify - Failed, not Lock Owner!" );
- }
-
- if( !eventQ.empty() ) {
- apr_thread_cond_t* event = eventQ.front();
- eventQ.remove( event );
- apr_thread_cond_signal( event );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Mutex::notifyAll() throw( lang::Exception )
-{
- if( !isLockOwner() ) {
- throw lang::Exception(
- __FILE__, __LINE__,
- "Mutex::NotifyAll - Failed, not Lock Owner!" );
- }
-
- while( !eventQ.empty() ) {
- apr_thread_cond_t* event = eventQ.front();
- eventQ.remove( event );
- apr_thread_cond_signal( event );
- }
-}
diff --git a/src/decaf/src/main/decaf/util/concurrent/Mutex.h b/src/decaf/src/main/decaf/util/concurrent/Mutex.h
deleted file mode 100644
index 1d1ab7b..0000000
--- a/src/decaf/src/main/decaf/util/concurrent/Mutex.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_CONCURRENT_MUTEX_H_
-#define _DECAF_CONCURRENT_MUTEX_H_
-
-#include <decaf/util/concurrent/Synchronizable.h>
-#include <decaf/util/concurrent/Concurrent.h>
-#include <decaf/lang/Thread.h>
-#include <decaf/util/Config.h>
-
-#include <apr_pools.h>
-#include <apr_thread_mutex.h>
-#include <apr_thread_cond.h>
-
-#include <list>
-#include <assert.h>
-
-namespace decaf{
-namespace util{
-namespace concurrent{
-
- /**
- * Creates a pthread_mutex_t object. The object is created
- * such that successive locks from the same thread is allowed
- * and will be successful.
- * @see pthread_mutex_t
- */
- class DECAF_API Mutex : public Synchronizable {
- private:
-
- // APR Pool Allocator
- apr_pool_t* pool;
-
- // The mutex object.
- apr_thread_mutex_t* mutex;
-
- // List of waiting threads
- std::list<apr_thread_cond_t*> eventQ;
-
- // Lock Status Members
- volatile unsigned long lock_owner;
- volatile unsigned long lock_count;
-
- public:
-
- /**
- * Constructor - creates and initializes the mutex.
- */
- Mutex();
-
- /**
- * Destructor - destroys the mutex object.
- */
- virtual ~Mutex();
-
- /**
- * Locks the object.
- * @throws ActiveMQException
- */
- virtual void lock() throw( lang::Exception );
-
- /**
- * Unlocks the object.
- * @throws ActiveMQException
- */
- virtual void unlock() throw( lang::Exception );
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify.
- * @throws ActiveMQException
- */
- virtual void wait() throw( lang::Exception );
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param millisecs the time in milliseconds to wait.
- * @throws ActiveMQException
- */
- virtual void wait( unsigned long millisecs )
- throw( lang::Exception );
-
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue.
- * @throws ActiveMQException
- */
- virtual void notify() throw( lang::Exception );
-
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue.
- * @throws ActiveMQException
- */
- virtual void notifyAll() throw( lang::Exception );
-
- private:
-
- /**
- * Check if the calling thread is the Lock Owner
- * @retun true if the caller is the lock owner
- */
- bool isLockOwner(){
- return lock_owner == lang::Thread::getId();
- }
-
- };
-
-}}}
-
-#endif /*_DECAF_CONCURRENT_MUTEX_H_*/
diff --git a/src/decaf/src/main/decaf/util/concurrent/PooledThread.cpp b/src/decaf/src/main/decaf/util/concurrent/PooledThread.cpp
deleted file mode 100644
index dc6daef..0000000
--- a/src/decaf/src/main/decaf/util/concurrent/PooledThread.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <decaf/util/concurrent/PooledThread.h>
-#include <decaf/util/concurrent/ThreadPool.h>
-#include <decaf/util/concurrent/TaskListener.h>
-#include <decaf/lang/exceptions/IllegalArgumentException.h>
-
-#include <iostream>
-
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-using namespace decaf::util;
-using namespace decaf::util::concurrent;
-
-////////////////////////////////////////////////////////////////////////////////
-LOGDECAF_INITIALIZE(logger, PooledThread, "com.activemq.concurrent.PooledThread")
-
-////////////////////////////////////////////////////////////////////////////////
-PooledThread::PooledThread(ThreadPool* pool)
-{
- if(pool == NULL)
- {
- throw IllegalArgumentException( __FILE__, __LINE__,
- "PooledThread::PooledThread");
- }
-
- busy = false;
- done = false;
-
- listener = NULL;
-
- // Store our Pool.
- this->pool = pool;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-PooledThread::~PooledThread()
-{
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void PooledThread::run(void)
-{
- ThreadPool::Task task;
-
- try
- {
- while(!done)
- {
- //LOGCMS_DEBUG(logger, "PooledThread::run - Entering deQ");
-
- // Blocks until there something to be done
- task = pool->deQueueTask();
-
- //LOGCMS_DEBUG(logger, "PooledThread::run - Exited deQ");
-
- // Check if the Done Flag is set, in case it happened while we
- // were waiting for a task
- if(done)
- {
- break;
- }
-
- // If we got here and the runnable was null then something
- // bad must have happened. Throw an Exception and bail.
- if(!task.first)
- {
- throw Exception( __FILE__, __LINE__,
- "PooledThread::run - Retrieive NULL task from Pool.");
- }
-
- // Got some work to do, so set flag to busy
- busy = true;
-
- // Inform a listener that we are going to start
- if(listener)
- {
- /*LOGCMS_DEBUG(logger,
- "PooledThread::run - Inform Listener we are starting");*/
- listener->onTaskStarted(this);
- }
-
- // Perform the work
- task.first->run();
-
- /*LOGCMS_DEBUG(logger,
- "PooledThread::run - Inform Task Listener we are done");*/
-
- // Notify the Task listener that we are done
- task.second->onTaskComplete(task.first);
-
- // Inform a listener that we are going to stop and wait
- // for a new task
- if(listener)
- {
- /*LOGCMS_DEBUG(logger,
- "PooledThread::run - Inform Listener we are done");*/
- listener->onTaskCompleted(this);
- }
-
- // Set flag to inactive, we will wait for work
- busy = false;
- }
- }
- catch( Exception& ex )
- {
- ex.setMark( __FILE__, __LINE__ );
-
- // Notify the Task owner
- if(task.first && task.second)
- {
- task.second->onTaskException(task.first, ex);
- }
-
- busy = false;
-
- // Notify the PooledThreadListener
- if(listener)
- {
- listener->onTaskException(this, ex);
- }
- }
- catch(...)
- {
- Exception ex(
- __FILE__, __LINE__,
- "PooledThread::run - Caught Unknown Exception");
-
- // Notify the Task owner
- if(task.first && task.second)
- {
- task.second->onTaskException(task.first, ex);
- }
-
- busy = false;
-
- // Notify the PooledThreadListener
- if(listener)
- {
- listener->onTaskException(this, ex);
- }
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void PooledThread::stop(void) throw ( Exception )
-{
- done = true;
-}
diff --git a/src/decaf/src/main/decaf/util/concurrent/PooledThread.h b/src/decaf/src/main/decaf/util/concurrent/PooledThread.h
deleted file mode 100644
index d1d4fff..0000000
--- a/src/decaf/src/main/decaf/util/concurrent/PooledThread.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_CONCURRENT_POOLEDTHREAD_H_
-#define _DECAF_UTIL_CONCURRENT_POOLEDTHREAD_H_
-
-#include <decaf/lang/Thread.h>
-#include <decaf/util/concurrent/PooledThreadListener.h>
-#include <decaf/util/logging/LoggerDefines.h>
-#include <decaf/util/Config.h>
-
-#include <decaf/lang/Exception.h>
-
-namespace decaf{
-namespace util{
-namespace concurrent{
-
- class ThreadPool;
-
- class DECAF_API PooledThread : public lang::Thread
- {
- private:
-
- // Is this thread currently processing something
- bool busy;
-
- // Boolean flag indicating thread should stop
- bool done;
-
- // Listener for Task related events
- PooledThreadListener* listener;
-
- // The thread pool this Pooled Thread is Servicing
- ThreadPool* pool;
-
- // Logger Init
- LOGDECAF_DECLARE(logger)
-
- public:
-
- /**
- * Constructor
- * @param pool the parant ThreadPool object
- */
- PooledThread( ThreadPool* pool );
-
- virtual ~PooledThread();
-
- /**
- * Run Method for this object waits for something to be
- * enqueued on the ThreadPool and then grabs it and calls
- * its run method.
- */
- virtual void run();
-
- /**
- * Stops the Thread, thread will complete its task if currently
- * running one, and then die. Does not block.
- * @throws Exception
- */
- virtual void stop() throw ( lang::Exception );
-
- /**
- * Checks to see if the thread is busy, if busy it means
- * that this thread has taken a task from the ThreadPool's
- * queue and is processing it.
- * @returns true if the Thread is busy
- */
- virtual bool isBusy() { return busy; }
-
- /**
- * Adds a listener to this <code>PooledThread</code> to be
- * notified when this thread starts and completes a task.
- * @param listener the listener to send notifications to.
- */
- virtual void setPooledThreadListener( PooledThreadListener* listener )
- {
- this->listener = listener;
- }
-
- /**
- * Removes a listener for this <code>PooledThread</code> to be
- * notified when this thread starts and completes a task.
- * @return a pointer to this thread's listener or NULL
- */
- virtual PooledThreadListener* getPooledThreadListener()
- {
- return this->listener;
- }
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_CONCURRENT_POOLEDTHREAD_H_*/
diff --git a/src/decaf/src/main/decaf/util/concurrent/PooledThreadListener.h b/src/decaf/src/main/decaf/util/concurrent/PooledThreadListener.h
deleted file mode 100644
index c818757..0000000
--- a/src/decaf/src/main/decaf/util/concurrent/PooledThreadListener.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_CONCURRENT_POOLEDTHREADLISTENER_H_
-#define _DECAF_UTIL_CONCURRENT_POOLEDTHREADLISTENER_H_
-
-#include <decaf/lang/Exception.h>
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace util{
-namespace concurrent{
-
- class PooledThread;
-
- class DECAF_API PooledThreadListener
- {
- public:
-
- /**
- * Destructor
- */
- virtual ~PooledThreadListener() {}
-
- /**
- * Called by a pooled thread when it is about to begin
- * executing a new task.
- * @param Pointer to the Pooled Thread that is making this call
- */
- virtual void onTaskStarted( PooledThread* thread ) = 0;
-
- /**
- * Called by a pooled thread when it has completed a task
- * and is going back to waiting for another task to run
- * @param Pointer the the Pooled Thread that is making this call.
- */
- virtual void onTaskCompleted( PooledThread* thread ) = 0;
-
- /**
- * Called by a pooled thread when it has encountered an exception
- * while running a user task, after receiving this notification
- * the callee should assume that the PooledThread is now no longer
- * running.
- * @param Pointer to the Pooled Thread that is making this call
- * @param The Exception that occured.
- */
- virtual void onTaskException( PooledThread* thread,
- lang::Exception& ex) = 0;
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_CONCURRENT_POOLEDTHREADLISTENER_H_*/
diff --git a/src/decaf/src/main/decaf/util/concurrent/Synchronizable.h b/src/decaf/src/main/decaf/util/concurrent/Synchronizable.h
deleted file mode 100644
index 0918bb7..0000000
--- a/src/decaf/src/main/decaf/util/concurrent/Synchronizable.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_CONCURRENT_SYNCHRONIZABLE_H_
-#define _DECAF_UTIL_CONCURRENT_SYNCHRONIZABLE_H_
-
-#include <decaf/lang/Exception.h>
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace util{
-namespace concurrent{
-
- /**
- * The interface for all synchronizable objects (that is, objects
- * that can be locked and unlocked).
- */
- class DECAF_API Synchronizable
- {
- public:
-
- virtual ~Synchronizable(){}
-
- /**
- * Locks the object.
- * @throws Exception
- */
- virtual void lock() throw( lang::Exception ) = 0;
-
- /**
- * Unlocks the object.
- * @throws Exception
- */
- virtual void unlock() throw( lang::Exception ) = 0;
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void wait() throw( lang::Exception ) = 0;
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param millisecs the time in millisecsonds to wait, or
- * WAIT_INIFINITE
- * @throws Exception
- */
- virtual void wait(unsigned long millisecs)
- throw( lang::Exception ) = 0;
-
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notify() throw( lang::Exception ) = 0;
-
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- * @throws Exception
- */
- virtual void notifyAll() throw( lang::Exception ) = 0;
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_CONCURRENT_SYNCHRONIZABLE_H_*/
diff --git a/src/decaf/src/main/decaf/util/concurrent/TaskListener.h b/src/decaf/src/main/decaf/util/concurrent/TaskListener.h
deleted file mode 100644
index af22c9e..0000000
--- a/src/decaf/src/main/decaf/util/concurrent/TaskListener.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_CONCURRENT_TASKLISTENER_H_
-#define _DECAF_UTIL_CONCURRENT_TASKLISTENER_H_
-
-#include <decaf/lang/Runnable.h>
-#include <decaf/lang/Exception.h>
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace util{
-namespace concurrent{
-
- class DECAF_API TaskListener
- {
- public:
-
- virtual ~TaskListener() {}
-
- /**
- * Called when a queued task has completed, the task that
- * finished is passed along for user consumption
- * @param task Runnable Pointer to the task that finished
- */
- virtual void onTaskComplete( lang::Runnable* task ) = 0;
-
- /**
- * Called when a queued task has thrown an exception while
- * being run. The Callee should assume that this was an
- * unrecoverable exeption and that this task is now defunct.
- * @param task Runnable Pointer to the task
- * @param ex The ActiveMQException that was thrown.
- */
- virtual void onTaskException( lang::Runnable* task,
- lang::Exception& ex ) = 0;
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_CONCURRENT_TASKLISTENER_H_*/
diff --git a/src/decaf/src/main/decaf/util/concurrent/ThreadPool.cpp b/src/decaf/src/main/decaf/util/concurrent/ThreadPool.cpp
deleted file mode 100644
index 66b6d3c..0000000
--- a/src/decaf/src/main/decaf/util/concurrent/ThreadPool.cpp
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <decaf/util/concurrent/ThreadPool.h>
-#include <decaf/util/concurrent/Concurrent.h>
-#include <decaf/lang/exceptions/IllegalArgumentException.h>
-#include <decaf/util/Config.h>
-
-#ifdef min
-#undef min
-#endif
-
-#include <algorithm>
-#include <iostream>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-using namespace decaf::util;
-using namespace decaf::util::concurrent;
-
-////////////////////////////////////////////////////////////////////////////////
-LOGDECAF_INITIALIZE(logger, ThreadPool, "com.activemq.concurrent.ThreadPool")
-LOGDECAF_INITIALIZE(marker, ThreadPool, "com.activemq.concurrent.ThreadPool.Marker")
-
-////////////////////////////////////////////////////////////////////////////////
-ThreadPool ThreadPool::instance;
-
-////////////////////////////////////////////////////////////////////////////////
-ThreadPool::ThreadPool()
-{
- maxThreads = DEFAULT_MAX_POOL_SIZE;
- blockSize = DEFAULT_MAX_BLOCK_SIZE;
- freeThreads = 0;
-
- shutdown = false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-ThreadPool::~ThreadPool()
-{
- try
- {
- std::vector<PooledThread*>::iterator itr = pool.begin();
-
- // Stop all the threads
- for(; itr != pool.end(); ++itr)
- {
- (*itr)->stop();
- }
-
- // Set the shutdown flag so that the DeQueue methods all quit
- // when we interrupt them.
- shutdown = true;
-
- synchronized(&queue)
- {
- // Signal the Queue so that all waiters are notified
- queue.notifyAll();
- }
-
- // Wait for everyone to die
- for(itr = pool.begin(); itr != pool.end(); ++itr)
- {
- (*itr)->join();
-
- // Destroy the threads
- delete *itr;
- }
-
- pool.clear();
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::queueTask( ThreadPool::Task task )
- throw ( lang::Exception )
-{
- try
- {
- if( !task.first || !task.second )
- {
- throw exceptions::IllegalArgumentException( __FILE__, __LINE__,
- "ThreadPool::QueueTask - Invalid args for Task");
- }
-
- //LOGCMS_DEBUG(logger, "ThreadPool::QueueTask - syncing on queue");
-
- synchronized(&queue)
- {
- //LOGCMS_DEBUG(logger, "ThreadPool::QueueTask - sync'd, synching pool");
-
- // If there's nobody open to do work, then create some more
- // threads to handle the work.
- if(freeThreads == 0)
- {
- AllocateThreads(blockSize);
- }
-
- //LOGCMS_DEBUG(logger, "ThreadPool::QueueTask - pushing task");
-
- // queue the new work.
- queue.push(task);
-
- //LOGCMS_DEBUG(logger, "ThreadPool::QueueTask - calling notify");
-
- // Inform waiters that we put some work on the queue.
- queue.notify();
- }
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-ThreadPool::Task ThreadPool::deQueueTask()
- throw ( lang::Exception )
-{
- try
- {
- //LOGCMS_DEBUG(logger, "ThreadPool::DeQueueTask - syncing on queue");
-
- synchronized(&queue)
- {
- /*LOGCMS_DEBUG(logger,
- "ThreadPool::DeQueueTask - sync'd checking queue empty");*/
-
- // Wait for work, wait in a while loop since another thread could
- // be waiting for a lock and get the work before we get woken up
- // from our wait.
- while(queue.empty() && !shutdown)
- {
- //LOGCMS_DEBUG(logger, "ThreadPool::DeQueueTask - Q empty, waiting");
-
- queue.wait();
-
- //LOGCMS_DEBUG(logger, "ThreadPool::DeQueueTask - done waiting");
- }
-
- // Don't give more work if we are closing down
- if(shutdown)
- {
- return Task();
- }
-
- // check size again.
- if(queue.empty())
- {
- throw lang::Exception( __FILE__, __LINE__,
- "ThreadPool::DeQueueUserWorkItem - Empty Taskn, not in shutdown.");
- }
-
- //LOGCMS_DEBUG(logger, "ThreadPool::DeQueueTask - popping task");
-
- // not empty so get the new work to do
- return queue.pop();
- }
-
- return Task();
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::reserve( std::size_t size )
-{
- try
- {
- synchronized(&poolLock)
- {
- if(size < pool.size() || pool.size() == maxThreads)
- {
- return;
- }
-
- // How many do we reserve
- std::size_t allocCount = size - pool.size();
-
- // Allocate the new Threads
- AllocateThreads(allocCount);
- }
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::setMaxThreads( std::size_t maxThreads )
-{
- try
- {
- synchronized(&poolLock)
- {
- if(maxThreads == 0)
- {
- // Caller tried to do something stupid, ignore them.
- return;
- }
-
- this->maxThreads = maxThreads;
- }
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::setBlockSize( std::size_t blockSize )
-{
- try
- {
- if(blockSize <= 0)
- {
- // User tried something dumb, protect them from themselves
- return;
- }
-
- synchronized(&poolLock)
- {
- this->blockSize = blockSize;
- }
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::AllocateThreads( std::size_t count )
-{
- try
- {
- if(pool.size() >= maxThreads)
- {
- return;
- }
-
- synchronized(&poolLock)
- {
- // Take the min of alloc size of maxThreads since we don't
- // want anybody sneaking eaxtra threads in, greedy bastards.
- count = std::min(count, maxThreads - pool.size());
-
- // Each time we create a thread we increment the free Threads
- // counter, but before we call start so that the Thread doesn't
- // get ahead of us.
- for(std::size_t i = 0; i < count; ++i)
- {
- pool.push_back(new PooledThread(this));
- pool.back()->setPooledThreadListener(this);
- freeThreads++;
- pool.back()->start();
- }
- }
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::onTaskStarted( PooledThread* thread DECAF_UNUSED )
-{
- try
- {
- synchronized(&poolLock)
- {
- freeThreads--;
-
- // Now that this callback has decremented the free threads coutner
- // let check if there is any outstanding work to be done and no
- // threads to handle it. This could happen if the QueueTask
- // method was called successively without any of the PooledThreads
- // having a chance to wake up and service the queue. This would
- // cause the number of Task to exceed the number of free threads
- // once the Threads got a chance to wake up and service the queue
- if( freeThreads == 0 && !queue.empty() )
- {
- // Allocate a new block of threads
- AllocateThreads( blockSize );
- }
- }
-
- //LOGCMS_DEBUG(logger, "ThreadPool::onTaskStarted:");
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::onTaskCompleted( PooledThread* thread DECAF_UNUSED)
-{
- try
- {
- synchronized(&poolLock)
- {
- freeThreads++;
- }
-
- //LOGCMS_DEBUG(logger, "ThreadPool::onTaskCompleted: ");
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::onTaskException(
- PooledThread* thread,
- lang::Exception& ex DECAF_UNUSED )
-{
- //LOGCMS_DEBUG(logger, "ThreadPool::onTaskException: ");
-
- try
- {
- synchronized(&poolLock)
- {
- // Delete the thread that had the exception and start a new
- // one to take its place.
- freeThreads--;
-
- std::vector<PooledThread*>::iterator itr =
- std::find(pool.begin(), pool.end(), thread);
-
- if(itr != pool.end())
- {
- pool.erase(itr);
- }
-
- // Bye-Bye Thread Object
- delete thread;
-
- // Now allocate a replacement
- AllocateThreads(1);
- }
- }
- DECAF_CATCH_RETHROW( lang::Exception )
- DECAF_CATCHALL_THROW( lang::Exception )
-}
-
diff --git a/src/decaf/src/main/decaf/util/concurrent/ThreadPool.h b/src/decaf/src/main/decaf/util/concurrent/ThreadPool.h
deleted file mode 100644
index ebf6329..0000000
--- a/src/decaf/src/main/decaf/util/concurrent/ThreadPool.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_CONCURRENT_THREADPOOL_H_
-#define _DECAF_UTIL_CONCURRENT_THREADPOOL_H_
-
-#include <decaf/lang/Runnable.h>
-#include <decaf/util/concurrent/PooledThread.h>
-#include <decaf/util/concurrent/PooledThreadListener.h>
-#include <decaf/util/concurrent/TaskListener.h>
-#include <decaf/util/concurrent/Mutex.h>
-#include <decaf/util/Queue.h>
-#include <decaf/util/logging/LoggerDefines.h>
-#include <decaf/util/Config.h>
-
-#include <vector>
-
-namespace decaf{
-namespace util{
-namespace concurrent{
-
- /**
- * Defines a Thread Pool object that implements the functionality
- * of pooling threads to perform user tasks. The Thread Poll has
- * max size that it will grow to. The thread pool allocates threads
- * in blocks. When there are no waiting worker threads and a task
- * is queued then a new batch is allocated. The user can specify
- * the size of the blocks, otherwise a default value is used.
- * <P>
- * When the user queues a task they must also queue a listner to
- * be notified when the task has completed, this provides the user
- * with a mechanism to know when a task object can be freed.
- * <P>
- * To have the Thread Pool perform a task, the user enqueue's an
- * object that implements the <code>Runnable</code> insterface and
- * one of the worker threads will executing it in its thread context.
- */
- class DECAF_API ThreadPool : public PooledThreadListener
- {
- public:
-
- // Constants
- static const size_t DEFAULT_MAX_POOL_SIZE = 10;
- static const size_t DEFAULT_MAX_BLOCK_SIZE = 3;
-
- // Types
- typedef std::pair<lang::Runnable*, TaskListener*> Task;
-
- private:
-
- // Vector of threads that this object has created for its pool.
- std::vector< PooledThread* > pool;
-
- // Queue of Task that are in need of completion
- util::Queue<Task> queue;
-
- // Max number of Threads this Pool can contian
- std::size_t maxThreads;
-
- // Max number of tasks that can be allocated at a time
- std::size_t blockSize;
-
- // boolean flag use to indocate that this object is shutting down.
- bool shutdown;
-
- // Count of threads that are currently free to perfom some work.
- std::size_t freeThreads;
-
- // Mutex for locking operations that affect the pool.
- Mutex poolLock;
-
- // Logger Init
- LOGDECAF_DECLARE(logger)
- LOGDECAF_DECLARE(marker)
-
- private: // Statics
-
- // The singleton instance of this class
- static ThreadPool instance;
-
- public:
-
- ThreadPool();
- virtual ~ThreadPool();
-
- /**
- * Queue a task to be completed by one of the Pooled Threads.
- * tasks are serviced as soon as a <code>PooledThread</code>
- * is available to run it.
- * @param task object that derives from Runnable
- * @throws ActiveMQException
- */
- virtual void queueTask( Task task )
- throw ( lang::Exception );
-
- /**
- * DeQueue a task to be completed by one of the Pooled Threads.
- * A caller of this method will block until there is something
- * in the tasks queue, therefore care must be taken when calling
- * this function. Normally clients of ThreadPool don't use
- * this, only the <code>PooledThread</code> objects owned by
- * this ThreadPool.
- * @return object that derives from Runnable
- * @throws ActiveMQException
- */
- virtual Task deQueueTask()
- throw ( lang::Exception );
-
- /**
- * Returns the current number of Threads in the Pool, this is
- * how many there are now, not how many are active or the max
- * number that might exist.
- * @return integer number of threads in existance.
- */
- virtual std::size_t getPoolSize() const { return pool.size(); }
-
- /**
- * Returns the current backlog of items in the tasks queue, this
- * is how much work is still waiting to get done.
- * @return number of outstanding tasks.
- */
- virtual std::size_t getBacklog() const { return queue.size(); }
-
- /**
- * Ensures that there is at least the specified number of Threads
- * allocated to the pool. If the size is greater than the MAX
- * number of threads in the pool, then only MAX threads are
- * reservved. If the size is smaller than the number of threads
- * currently in the pool, than nothing is done.
- * @param size the number of threads to reserve.
- */
- virtual void reserve( std::size_t size );
-
- /**
- * Get the Max Number of Threads this Pool can contain
- * @return max size
- */
- virtual std::size_t getMaxThreads() const { return maxThreads; }
-
- /**
- * Sets the Max number of threads this pool can contian.
- * if this value is smaller than the current size of the
- * pool nothing is done.
- * @param maxThreads total number of threads that can be pooled
- */
- virtual void setMaxThreads( std::size_t maxThreads );
-
- /**
- * Gets the Max number of threads that can be allocated at a time
- * when new threads are needed.
- * @return max Thread Block Size
- */
- virtual std::size_t getBlockSize() const { return blockSize; }
-
- /**
- * Sets the Max number of Threads that can be allocated at a time
- * when the Thread Pool determines that more Threads are needed.
- * @param blockSize Max Thread Block Size
- */
- virtual void setBlockSize( std::size_t blockSize );
-
- /**
- * Returns the current number of available threads in the pool, threads
- * that are performing a user task are considered unavailable. This value
- * could change immeadiately after calling as Threads could finish right
- * after and be available again. This is informational only.
- * @return totoal free threads
- */
- virtual std::size_t getFreeThreadCount() const {
- return freeThreads;
- }
-
- public: // PooledThreadListener Callbacks
-
- /**
- * Called by a pooled thread when it is about to begin
- * executing a new task. This will decrement the available
- * threads counter so that this object knows when there are
- * no more free threads and must create new ones.
- * @param thread Pointer to the Pooled Thread that is making this call
- */
- virtual void onTaskStarted( PooledThread* thread );
-
- /**
- * Called by a pooled thread when it has completed a task
- * and is going back to waiting for another task to run,
- * this will increment the free threads counter.
- * @param thread Pointer the the Pooled Thread that is making this call.
- */
- virtual void onTaskCompleted( PooledThread* thread );
-
- /**
- * Called by a pooled thread when it has encountered an exception
- * while running a user task, after receiving this notification
- * the callee should assume that the PooledThread is now no longer
- * running.
- * @param thread Pointer to the Pooled Thread that is making this call
- * @param ex The Exception that occured.
- */
- virtual void onTaskException( PooledThread* thread,
- lang::Exception& ex );
-
- public: // Statics
-
- /**
- * Return the one and only Thread Pool instance.
- * @return The Thread Pool Pointer
- */
- static ThreadPool* getInstance() {
- return &instance;
- }
-
- private:
-
- /**
- * Allocates the requested ammount of Threads, won't exceed
- * <code>maxThreads</code>.
- * @param count the number of threads to create
- */
- void AllocateThreads( std::size_t count );
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_CONCURRENT_THREADPOOL_H_*/
diff --git a/src/decaf/src/main/decaf/util/logging/ConsoleHandler.h b/src/decaf/src/main/decaf/util/logging/ConsoleHandler.h
deleted file mode 100644
index 09f97d1..0000000
--- a/src/decaf/src/main/decaf/util/logging/ConsoleHandler.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_LOGGING_CONSOLEHANDLER_H_
-#define _DECAF_UTIL_LOGGING_CONSOLEHANDLER_H_
-
-#include <decaf/util/logging/StreamHandler.h>
-#include <decaf/io/StandardErrorOutputStream.h>
-
-namespace decaf{
-namespace util{
-namespace logging{
-
- /**
- * This Handler publishes log records to System.err. By default the
- * SimpleFormatter is used to generate brief summaries.
- *
- * Configuration: By default each ConsoleHandler is initialized using
- * the following LogManager configuration properties. If properties are
- * not defined (or have invalid values) then the specified default
- * values are used.
- *
- * ConsoleHandler.level specifies the default level for the Handler
- * (defaults to Level.INFO).
- * ConsoleHandler.filter specifies the name of a Filter class to use
- * (defaults to no Filter).
- * ConsoleHandler.formatter specifies the name of a Formatter class to
- * use (defaults to SimpleFormatter).
- */
- class DECAF_API ConsoleHandler : public StreamHandler {
- private:
-
- // The Standard Error Stream to log to
- io::StandardErrorOutputStream stream;
-
- // The default Simple Formatter
- SimpleFormatter formatter;
-
- public:
-
- ConsoleHandler() : StreamHandler( &stream, &formatter ) {
-
- // Defaults level to Info
- setLevel( Level.INFO );
- }
-
- virtual ~ConsoleHandler() {}
-
- /**
- * Close the current output stream.
- * <p>
- * Override the StreamHandler close to flush the Std Err stream
- * but doesn't close.
- * @throw CMSException
- */
- virtual void close() throw ( cms::CMSException )
- {
- if( getOutputStream() ) {
- getOutputStream->flush();
- }
- }
-
- };
-
-}})
-
-#endif /*_DECAF_UTIL_LOGGING_CONSOLEHANDLER_H_*/
diff --git a/src/decaf/src/main/decaf/util/logging/Filter.h b/src/decaf/src/main/decaf/util/logging/Filter.h
deleted file mode 100644
index c1132b8..0000000
--- a/src/decaf/src/main/decaf/util/logging/Filter.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_LOGGING_FILTER_H_
-#define _DECAF_UTIL_LOGGING_FILTER_H_
-
-#include <decaf/util/logging/LogRecord.h>
-
-namespace decaf{
-namespace util{
-namespace logging{
-
- /**
- * A Filter can be used to provide fine grain control over what is
- * logged, beyond the control provided by log levels.
- *
- * Each Logger and each Handler can have a filter associated with it.
- * The Logger or Handler will call the isLoggable method to check if a
- * given LogRecord should be published. If isLoggable returns false,
- * the LogRecord will be discarded.
- */
- class DECAF_API Filter {
- public:
-
- virtual ~Filter() {}
-
- /**
- * Check if a given log record should be published.
- * @param record the <code>LogRecord</code> to check.
- * @returns true if the record is loggable.
- */
- virtual bool isLoggable( const LogRecord& record ) const = 0;
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_LOGGING_FILTER_H_*/
diff --git a/src/decaf/src/main/decaf/util/logging/Formatter.h b/src/decaf/src/main/decaf/util/logging/Formatter.h
deleted file mode 100644
index 18f5799..0000000
--- a/src/decaf/src/main/decaf/util/logging/Formatter.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_LOGGING_FORMATTER_H_
-#define _DECAF_UTIL_LOGGING_FORMATTER_H_
-
-namespace decaf{
-namespace util{
-namespace logging{
-
- /**
- * A Formatter provides support for formatting LogRecords.
- *
- * Typically each logging Handler will have a Formatter associated with
- * it. The Formatter takes a LogRecord and converts it to a string.
- *
- * Some formatters (such as the XMLFormatter) need to wrap head and
- * tail strings around a set of formatted records. The getHeader and
- * getTail methods can be used to obtain these strings.
- */
- class DECAF_API Formatter {
- public:
-
- virtual ~Formatter() {}
-
- /**
- * Format the given log record and return the formatted string.
- * @param record The Log Record to Format
- * @returns the formatted record.
- */
- virtual std::string format( const LogRecord& record ) const = 0;
-
- /**
- * Format the message string from a log record.
- * @param record The Log Record to Format
- * @returns the formatted message
- */
- virtual std::string formatMessage( const LogRecord& record ) const = 0;
-
- /**
- * Return the header string for a set of formatted records. In the
- * default implementation this method should return empty string
- * @param handler the target handler, can be null
- * @return the head string
- */
- virtual std::string getHead( const Handler* handler ) = 0;
-
- /**
- * Return the tail string for a set of formatted records. In the
- * default implementation this method should return empty string
- * @param handler the target handler, can be null
- * @return the tail string
- */
- virtual std::string getTail( const Handler* handler ) = 0;
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_LOGGING_FORMATTER_H_*/
diff --git a/src/decaf/src/main/decaf/util/logging/Handler.h b/src/decaf/src/main/decaf/util/logging/Handler.h
deleted file mode 100644
index bef829b..0000000
--- a/src/decaf/src/main/decaf/util/logging/Handler.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_LOGGING_HANDLER_H_
-#define _DECAF_UTIL_LOGGING_HANDLER_H_
-
-#include <decaf/io/Closeable.h>
-#include <decaf/util/logging/LogRecord.h>
-
-namespace decaf{
-namespace util{
-namespace logging{
-
- class Filter;
- class Formatter;
-
- /**
- * A Handler object takes log messages from a Logger and exports them.
- * It might for example, write them to a console or write them to a file,
- * or send them to a network logging service, or forward them to an OS
- * log, or whatever.
- *
- * A Handler can be disabled by doing a setLevel(Level.OFF) and can be
- * re-enabled by doing a setLevel with an appropriate level.
- *
- * Handler classes typically use LogManager properties to set default
- * values for the Handler's Filter, Formatter, and Level. See the
- * specific documentation for each concrete Handler class.
- */
- class DECAF_API Handler : public io::Closeable {
- public:
-
- virtual ~Handler() {}
-
- /**
- * Flush the Handler's output, clears any buffers.
- */
- virtual void flush() = 0;
-
- /**
- * Publish the Log Record to this Handler
- * @param record The Log Record to Publish
- */
- virtual void publish( const LogRecord& record ) = 0;
-
- /**
- * Check if this Handler would actually log a given LogRecord.
- * <p>
- * This method checks if the LogRecord has an appropriate Level and
- * whether it satisfies any Filter. It also may make other Handler
- * specific checks that might prevent a handler from logging the
- * LogRecord.
- * @param record <code>LogRecord</code> to check
- */
- virtual void isLoggable( const LogRecord& record ) = 0;
-
- /**
- * Sets the Filter that this Handler uses to filter Log Records
- * <p>
- * For each call of publish the Handler will call this Filter (if it
- * is non-null) to check if the LogRecord should be published or
- * discarded.
- * @param filter <code>Filter</code> derived instance
- */
- virtual void setFilter( const Filter* filter ) = 0;
-
- /**
- * Gets the Filter that this Handler uses to filter Log Records
- * @returns <code>Filter</code> derived instance
- */
- virtual const Filter* getFilter() = 0;
-
- /**
- * Set the log level specifying which message levels will be logged
- * by this Handler.
- * <p>
- * The intention is to allow developers to turn on voluminous logging,
- * but to limit the messages that are sent to certain Handlers.
- * @param value Level enumeration value
- */
- virtual void setLevel( Level value ) = 0;
-
- /**
- * Get the log level specifying which message levels will be logged
- * by this Handler.
- * @returns Level enumeration value
- */
- virtual Level getLevel() = 0;
-
- /**
- * Sets the <code>Formatter</code> used by this Handler
- * <p>
- * Some Handlers may not use Formatters, in which case the
- * Formatter will be remembered, but not used.
- * @param formatter <code>Filter</code> derived instance
- */
- virtual void setFormatter( const Formatter* formatter ) = 0;
-
- /**
- * Gets the <code>Formatter</code> used by this Handler
- * @returns <code>Filter</code> derived instance
- */
- virtual const Formatter* getFormatter() = 0;
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_LOGGING_HANDLER_H_*/
diff --git a/src/decaf/src/main/decaf/util/logging/LogManager.cpp b/src/decaf/src/main/decaf/util/logging/LogManager.cpp
deleted file mode 100644
index f4cc21d..0000000
--- a/src/decaf/src/main/decaf/util/logging/LogManager.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-#include "LogManager.h"
-
-#include <decaf/util/logging/PropertiesChangeListener.h>
-#include <decaf/util/concurrent/Concurrent.h>
-#include <decaf/util/Config.h>
-
-#include <algorithm>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::util;
-using namespace decaf::util::logging;
-
-////////////////////////////////////////////////////////////////////////////////
-concurrent::Mutex LogManager::mutex;
-LogManager* LogManager::instance = NULL;
-unsigned int LogManager::refCount = 0;
-
-////////////////////////////////////////////////////////////////////////////////
-LogManager::~LogManager()
-{
- // TODO - Delete all the loggers.
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void LogManager::setProperties( const Properties* properties )
-{
- // Copy the properties
- this->properties.copy(properties);
-
- // Update the configuration of the loggers.
- // TODO
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void LogManager::addPropertyChangeListener(
- PropertyChangeListener* listener )
-{
- if( find(listeners.begin(), listeners.end(), listener) == listeners.end() ) {
- listeners.push_back( listener );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void LogManager::removePropertyChangeListener(
- PropertyChangeListener* listener )
-{
- listeners.remove( listener );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Logger* LogManager::getLogger( const std::string& name DECAF_UNUSED ) {
- return NULL;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int LogManager::getLoggerNames( const std::vector<std::string>& names DECAF_UNUSED ) {
- return 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-LogManager* LogManager::getInstance() {
-
- synchronized( &mutex ) {
- if( instance == NULL ) {
- instance = new LogManager();
- }
-
- refCount++;
-
- return instance;
- }
-
- return NULL;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void LogManager::returnInstance() {
-
- synchronized( &mutex ) {
- if( refCount == 0 ) {
- return ;
- }
-
- refCount--;
-
- if( refCount == 0 ) {
- delete instance;
- instance = NULL;
- }
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void LogManager::destroy()
-{
- if( instance != NULL ) {
-
- synchronized( &mutex ) {
- delete instance;
- instance = NULL;
- refCount = 0;
- }
- }
-}
diff --git a/src/decaf/src/main/decaf/util/logging/LogManager.h b/src/decaf/src/main/decaf/util/logging/LogManager.h
deleted file mode 100644
index 194ba55..0000000
--- a/src/decaf/src/main/decaf/util/logging/LogManager.h
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-#ifndef _DECAF_UTIL_LOGGING_LOGMANAGER_H_
-#define _DECAF_UTIL_LOGGING_LOGMANAGER_H_
-
-#include <map>
-#include <list>
-#include <string>
-#include <vector>
-
-#include <decaf/util/Properties.h>
-#include <decaf/util/concurrent/Mutex.h>
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace util{
-namespace logging{
-
- class Logger;
- class PropertyChangeListener;
-
- /**
- * There is a single global LogManager object that is used to maintain
- * a set of shared state about Loggers and log services.
- *
- * This LogManager object:
- *
- * * Manages a hierarchical namespace of Logger objects. All named
- * Loggers are stored in this namespace.
- * * Manages a set of logging control properties. These are simple
- * key-value pairs that can be used by Handlers and other logging
- * objects to configure themselves.
- *
- * The global LogManager object can be retrieved using
- * LogManager.getLogManager(). The LogManager object is created during
- * class initialization and cannot subsequently be changed.
- *
- * ***TODO****
- * By default, the LogManager reads its initial configuration from a
- * properties file "lib/logging.properties" in the JRE directory. If
- * you edit that property file you can change the default logging
- * configuration for all uses of that JRE.
- *
- * In addition, the LogManager uses two optional system properties that
- * allow more control over reading the initial configuration:
- *
- * * "decaf.logger.config.class"
- * * "decaf.logger.config.file"
- *
- * These two properties may be set via the Preferences API, or as
- * command line property definitions to the "java" command, or as
- * system property definitions passed to JNI_CreateJavaVM.
- *
- * If the "java.util.logging.config.class" property is set, then the
- * property value is treated as a class name. The given class will be
- * loaded, an object will be instantiated, and that object's constructor
- * is responsible for reading in the initial configuration. (That object
- * may use other system properties to control its configuration.) The
- * alternate configuration class can use readConfiguration(InputStream)
- * to define properties in the LogManager.
- *
- * If "java.util.logging.config.class" property is not set, then the
- * "java.util.logging.config.file" system property can be used to specify
- * a properties file (in java.util.Properties format). The initial
- * logging configuration will be read from this file.
- *
- * If neither of these properties is defined then, as described above,
- * the LogManager will read its initial configuration from a properties
- * file "lib/logging.properties" in the JRE directory.
- *
- * The properties for loggers and Handlers will have names starting with
- * the dot-separated name for the handler or logger.
- * ***TODO****
- *
- * The global logging properties may include:
- *
- * * A property "handlers". This defines a whitespace separated
- * list of class names for handler classes to load and register as
- * handlers on the root Logger (the Logger named ""). Each class
- * name must be for a Handler class which has a default constructor.
- * Note that these Handlers may be created lazily, when they are
- * first used.
- * * A property "<logger>.handlers". This defines a whitespace or
- * comma separated list of class names for handlers classes to load
- * and register as handlers to the specified logger. Each class name
- * must be for a Handler class which has a default constructor. Note
- * that these Handlers may be created lazily, when they are first
- * used.
- * * A property "<logger>.useParentHandlers". This defines a boolean
- * value. By default every logger calls its parent in addition to
- * handling the logging message itself, this often result in
- * messages being handled by the root logger as well. When setting
- * this property to false a Handler needs to be configured for this
- * logger otherwise no logging messages are delivered.
- * * A property "config". This property is intended to allow arbitrary
- * configuration code to be run. The property defines a whitespace
- * separated list of class names. A new instance will be created for
- * each named class. The default constructor of each class may
- * execute arbitrary code to update the logging configuration, such
- * as setting logger levels, adding handlers, adding filters, etc.
- *
- * Loggers are organized into a naming hierarchy based on their dot
- * separated names. Thus "a.b.c" is a child of "a.b", but "a.b1" and
- * a.b2" are peers.
- *
- * All properties whose names end with ".level" are assumed to define
- * log levels for Loggers. Thus "foo.level" defines a log level for
- * the logger called "foo" and (recursively) for any of its children
- * in the naming hierarchy. Log Levels are applied in the order they
- * are defined in the properties file. Thus level settings for child
- * nodes in the tree should come after settings for their parents. The
- * property name ".level" can be used to set the level for the root of
- * the tree.
- *
- * All methods on the LogManager object are multi-thread safe.
- */
- class DECAF_API LogManager {
- private:
-
- // Change listener on this class's Properties
- std::list<PropertyChangeListener*> listeners;
-
- // Properties of the Log Manager
- util::Properties properties;
-
- public:
-
- virtual ~LogManager();
-
- /**
- * Sets the Properties this LogManager should use to configure
- * its loggers. Once set a properties change event is fired.
- * @param properties Pointer to read the configuration from
- */
- virtual void setProperties( const util::Properties* properties );
-
- /**
- * Gets a reference to the Logging Properties used by this
- * logger.
- * @returns The Logger Properties Pointer
- */
- virtual const util::Properties& getProperties() const {
- return properties;
- }
-
- /**
- * Gets the value of a named property of this LogManager
- * @param name of the Property to retrieve
- * @return the value of the property
- */
- virtual std::string getProperty( const std::string& name ) {
- return properties.getProperty( name );
- }
-
- /**
- * Adds a change listener for LogManager Properties, adding the same
- * instance of a change event listener does nothing.
- * @param listener a PropertyChangeListener
- */
- virtual void addPropertyChangeListener(
- PropertyChangeListener* listener );
-
- /**
- * Removes a properties change listener from the LogManager.
- * @param listener a PropertyChangeListener
- */
- virtual void removePropertyChangeListener(
- PropertyChangeListener* listener );
-
- /**
- * Retrieves or creates a new Logger using the name specified
- * a new logger inherits the configuration of the logger's
- * parent if there is no configuration data for the logger.
- * @param name The name of the Logger.
- */
- virtual Logger* getLogger( const std::string& name );
-
- /**
- * Gets a list of known Logger Names from this Manager
- * @param names STL Vector to hold string logger names
- * @return names count of how many loggers were inserted
- */
- virtual int getLoggerNames( const std::vector<std::string>& names );
-
- public: // Static Singleton Methods.
-
- /**
- * Get the singleton instance
- * @return Pointer to an instance of the Log Manager
- */
- static LogManager* getInstance();
-
- /**
- * Returns a Checked out instance of this Manager
- */
- static void returnInstance();
-
- /**
- * Forcefully Delete the Instance of this LogManager
- * even if there are outstanding references.
- */
- static void destroy();
-
- protected:
-
- /**
- * Constructor, hidden to protect against direct instantiation
- */
- LogManager() {}
-
- /**
- * Copy Constructo
- * @param manager the Manager to copy
- */
- LogManager( const LogManager& manager );
-
- /**
- * Assignment operator
- * @param manager the manager to assign from
- */
- void operator=( const LogManager& manager );
-
- private:
-
- // Static mutex to protect the singleton methods
- static concurrent::Mutex mutex;
-
- // Static pointer to the one and only instance.
- static LogManager* instance;
-
- // Static counter for number of outstanding references
- static unsigned int refCount;
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_LOGGING_LOGMANAGER_H_*/
diff --git a/src/decaf/src/main/decaf/util/logging/LogRecord.h b/src/decaf/src/main/decaf/util/logging/LogRecord.h
deleted file mode 100644
index 942f586..0000000
--- a/src/decaf/src/main/decaf/util/logging/LogRecord.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_LOGGING_LOGRECORD_H_
-#define _DECAF_UTIL_LOGGING_LOGRECORD_H_
-
-#include <decaf/util/logging/LoggerCommon.h>
-#include <decaf/util/Config.h>
-
-#include <string>
-
-namespace decaf{
-namespace util{
-namespace logging{
-
- class DECAF_API LogRecord
- {
- private:
-
- // Level of this Record
- Level level;
-
- // Name of the source Logger
- std::string loggerName;
-
- // Name of the File that originated the Log
- std::string sourceFile;
-
- // Line in the source file where log occured
- unsigned long sourceLine;
-
- // The message to Log.
- std::string message;
-
- // The function Name where the log occured
- std::string functionName;
-
- // Time in Mills since UTC that this Record was logged
- unsigned long timeStamp;
-
- // Thread Id of the Thread that logged this Record
- unsigned long threadId;
-
- public:
-
- LogRecord() {}
- virtual ~LogRecord() {}
-
- /**
- * Get Level of this log record
- * @return Level enumeration value.
- */
- Level getLevel() const {
- return level;
- };
-
- /**
- * Set the Level of this Log Record
- * @param value Level Enumeration Value
- */
- void setLevel( Level value ) {
- level = value;
- };
-
- /**
- * Gets the Source Logger's Name
- * @return the source loggers name
- */
- const std::string& getLoggerName() const {
- return loggerName;
- };
-
- /**
- * Sets the Source Logger's Name
- * @param loggerName the source loggers name
- */
- void setLoggerName( const std::string& loggerName ) {
- this->loggerName = loggerName;
- };
-
- /**
- * Gets the Source Log File name
- * @return the source loggers name
- */
- const std::string& getSourceFile() const {
- return sourceFile;
- };
-
- /**
- * Sets the Source Log File Name
- * @param loggerName the source loggers name
- */
- void setSourceFile( const std::string& sourceFile ) {
- this->sourceFile = sourceFile;
- };
-
- /**
- * Gets the Source Log line number
- * @return the source loggers line number
- */
- unsigned long getSourceLine() const {
- return sourceLine;
- };
-
- /**
- * Sets the Source Log line number
- * @param sourceLine the source logger's line number
- */
- void setSourceLine( long sourceLine ) {
- this->sourceLine = sourceLine;
- };
-
- /**
- * Gets the Message to be Logged
- * @return the source logger's message
- */
- const std::string& getMessage() const {
- return message;
- };
-
- /**
- * Sets the Message to be Logged
- * @param message the source loggers message
- */
- void setMessage( const std::string& message ) {
- this->message = message;
- };
-
- /**
- * Gets the name of the function where this log was logged
- * @return the source logger's message
- */
- const std::string& getSourceFunction() const {
- return functionName;
- };
-
- /**
- * Sets the name of the function where this log was logged
- * @param functionName the source of the log
- */
- void setSourceFunction( const std::string& functionName ) {
- this->functionName = functionName;
- };
-
- /**
- * Gets the time in mills that this message was logged.
- * @return UTC time in milliseconds
- */
- unsigned long getTimestamp() const { return timeStamp; };
-
- /**
- * Sets the time in mills that this message was logged.
- * @param timeStamp UTC Time in Milliseconds.
- */
- void setTimestamp( long timeStamp ) {
- this->timeStamp = timeStamp;
- };
-
- /**
- * Gets the Thread Id where this Log was created
- * @return the source loggers line number
- */
- unsigned long getTreadId() const {
- return threadId;
- };
-
- /**
- * Sets the Thread Id where this Log was created
- * @param threadId the source logger's line number
- */
- void setTreadId( long threadId ) {
- this->threadId = threadId;
- };
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_LOGGING_LOGRECORD_H_*/
diff --git a/src/decaf/src/main/decaf/util/logging/LogWriter.cpp b/src/decaf/src/main/decaf/util/logging/LogWriter.cpp
deleted file mode 100644
index 1bb649e..0000000
--- a/src/decaf/src/main/decaf/util/logging/LogWriter.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "LogWriter.h"
-
-#include <iostream>
-#include <decaf/lang/Thread.h>
-#include <decaf/util/concurrent/Concurrent.h>
-#include <decaf/util/concurrent/Mutex.h>
-#include <decaf/util/Config.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::util;
-using namespace decaf::util::concurrent;
-using namespace decaf::util::logging;
-
-////////////////////////////////////////////////////////////////////////////////
-concurrent::Mutex LogWriter::mutex;
-
-////////////////////////////////////////////////////////////////////////////////
-LogWriter::LogWriter(void)
-{
-}
-
-////////////////////////////////////////////////////////////////////////////////
-LogWriter::~LogWriter(void)
-{
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void LogWriter::log(const std::string& file DECAF_UNUSED,
- const int line DECAF_UNUSED,
- const std::string& prefix,
- const std::string& message)
-{
- synchronized(&mutex)
- {
- cout << prefix << " "
- << message << " - tid: " << Thread::getId() << endl;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void LogWriter::log(const std::string& message)
-{
- synchronized(&mutex)
- {
- cout << message << " - tid: " << Thread::getId() << endl;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-LogWriter& LogWriter::getInstance(void)
-{
- // This one instance
- static LogWriter instance;
-
- return instance;
-}
-
diff --git a/src/decaf/src/main/decaf/util/logging/LogWriter.h b/src/decaf/src/main/decaf/util/logging/LogWriter.h
deleted file mode 100644
index 676a339..0000000
--- a/src/decaf/src/main/decaf/util/logging/LogWriter.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_LOGGING_LOGWRITER_H_
-#define _DECAF_UTIL_LOGGING_LOGWRITER_H_
-
-#include <decaf/util/concurrent/Mutex.h>
-
-namespace decaf{
-namespace util{
-namespace logging{
-
- class DECAF_API LogWriter
- {
- public:
-
- LogWriter(void);
- virtual ~LogWriter(void);
-
- /**
- * Writes a message to the output destination
- * @param file
- * @param line
- * @param prefix
- * @param message
- */
- virtual void log(const std::string& file,
- const int line,
- const std::string& prefix,
- const std::string& message);
-
- /**
- * Writes a message to the output destination
- * @param message
- */
- virtual void log(const std::string& message);
-
- public: // Static methods
-
- /**
- * Get the singleton instance
- */
- static LogWriter& getInstance();
-
- /**
- * Returns a Checked out instance of this Writer
- */
- static void returnInstance();
-
- /**
- * Forcefully Delete the Instance of this LogWriter
- * even if there are outstanding references.
- */
- static void destroy();
-
- private:
-
- // Syncronization mutex
- static concurrent::Mutex mutex;
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_LOGGING_LOGWRITER_H_*/
diff --git a/src/decaf/src/main/decaf/util/logging/Logger.cpp b/src/decaf/src/main/decaf/util/logging/Logger.cpp
deleted file mode 100644
index 6c54cb2..0000000
--- a/src/decaf/src/main/decaf/util/logging/Logger.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "Logger.h"
-
-#include <decaf/util/logging/Handler.h>
-#include <decaf/util/Config.h>
-#include <algorithm>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-using namespace decaf::util::logging;
-
-////////////////////////////////////////////////////////////////////////////////
-Logger::Logger( const std::string& name DECAF_UNUSED,
- Logger* parent DECAF_UNUSED ) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Logger::~Logger() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Logger::addHandler( Handler* handler ) throw ( IllegalArgumentException ) {
-
- if( handler == NULL )
- {
- IllegalArgumentException(
- __FILE__, __LINE__,
- "Logger::addHandler - HAndler cannot be null");
- }
-
- if( find( handlers.begin(), handlers.end(), handler) != handlers.end() )
- {
- handlers.push_back( handler );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Logger::removeHandler( Handler* handler ) {
-
- list<Handler*>::iterator itr =
- find( handlers.begin(), handlers.end(), handler );
-
- if( itr != handlers.end() ) {
-
- delete *itr;
- handlers.erase(itr);
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Logger::setFilter( Filter* filter DECAF_UNUSED ){
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Logger::isLoggable( Level level DECAF_UNUSED ) const{
- return false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Logger::entry( const std::string& blockName DECAF_UNUSED,
- const std::string& file DECAF_UNUSED,
- const int line DECAF_UNUSED ) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Logger::exit(const std::string& blockName DECAF_UNUSED,
- const std::string& file DECAF_UNUSED,
- const int line DECAF_UNUSED) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Logger::debug( const std::string& file DECAF_UNUSED,
- const int line DECAF_UNUSED,
- const std::string fnctionName DECAF_UNUSED,
- const std::string& message DECAF_UNUSED ) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Logger::info( const std::string& file DECAF_UNUSED,
- const int line DECAF_UNUSED,
- const std::string fnctionName DECAF_UNUSED,
- const std::string& message DECAF_UNUSED ) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Logger::error( const std::string& file DECAF_UNUSED,
- const int line DECAF_UNUSED,
- const std::string fnctionName DECAF_UNUSED,
- const std::string& message DECAF_UNUSED ) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Logger::warn( const std::string& file DECAF_UNUSED,
- const int line DECAF_UNUSED,
- const std::string fnctionName DECAF_UNUSED,
- const std::string& message DECAF_UNUSED ) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Logger::fatal( const std::string& file DECAF_UNUSED,
- const int line DECAF_UNUSED,
- const std::string fnctionName DECAF_UNUSED,
- const std::string& message DECAF_UNUSED ) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Logger::log( Level level DECAF_UNUSED,
- const std::string& message DECAF_UNUSED ) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Logger::log( Level level DECAF_UNUSED,
- const std::string& file DECAF_UNUSED,
- const int line DECAF_UNUSED,
- const std::string& message DECAF_UNUSED,
- lang::Exception& ex DECAF_UNUSED ) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Logger::log( Level level DECAF_UNUSED,
- const std::string& file DECAF_UNUSED,
- const int line DECAF_UNUSED,
- const std::string& message DECAF_UNUSED, ... ) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void Logger::log( LogRecord& record DECAF_UNUSED ) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Logger* Logger::getLogger( const std::string& name DECAF_UNUSED ) {
- return NULL;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Logger* Logger::getAnonymousLogger() {
- return NULL;
-}
diff --git a/src/decaf/src/main/decaf/util/logging/Logger.h b/src/decaf/src/main/decaf/util/logging/Logger.h
deleted file mode 100644
index 9d46c7c..0000000
--- a/src/decaf/src/main/decaf/util/logging/Logger.h
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_LOGGING_LOGGER_H_
-#define _DECAF_UTIL_LOGGING_LOGGER_H_
-
-#include <decaf/util/logging/LoggerCommon.h>
-#include <decaf/util/logging/LogRecord.h>
-#include <decaf/lang/exceptions/IllegalArgumentException.h>
-#include <decaf/util/Config.h>
-
-#include <list>
-#include <string>
-#include <stdarg.h>
-
-namespace decaf{
-namespace util{
-namespace logging{
-
- class Handler;
- class Filter;
-
- class DECAF_API Logger
- {
- private:
-
- // The name of this Logger
- std::string name;
-
- // The Parent of this Logger
- Logger* parent;
-
- // list of Handlers owned by this logger
- std::list<Handler*> handlers;
-
- // Filter used by this Logger
- Filter* filter;
-
- // The Log Level of this Logger
- Level level;
-
- // Using Parent Handlers?
- bool useParentHandlers;
-
- public:
-
- /**
- * Creates a new instance of the Logger with the given name
- * and assign it the given parent logger.
- * <p>
- * The logger will be initially configured with a null Level
- * and with useParentHandlers true.
- * @param name - A name for the logger. This should be a
- * dot-separated name and should normally be based on the package
- * name or class name of the subsystem, such as java.net or
- * javax.swing. It may be null for anonymous Loggers.
- * @param parent logger that is this one's parent
- */
- Logger( const std::string& name, Logger* parent );
-
- virtual ~Logger();
-
- /**
- * Gets the name of this Logger
- * @return logger name
- */
- virtual const std::string& getName(void) const {
- return name;
- }
-
- /**
- * Add a log Handler to receive logging messages.
- * <p>
- * By default, Loggers also send their output to their parent logger.
- * Typically the root Logger is configured with a set of Handlers
- * that essentially act as default handlers for all loggers.
- *
- * @param handler A Logging Handler
- * #throws IllegalArgumentException
- */
- virtual void addHandler( Handler* handler )
- throw ( lang::exceptions::IllegalArgumentException );
-
- /**
- * Removes the specified Handler and destroys it
- * <p>
- * Returns silently if the given Handler is not found.
- * @param handler The Handler to remove
- */
- virtual void removeHandler( Handler* handler );
-
- /**
- * Gets a vector containing all the handlers that this class
- * has been assigned to use.
- * @returns a list of handlers that are used by this logger
- */
- // virtual const std::list<Handler*>& getHandlers(void) const;
-
- /**
- * Set a filter to control output on this Logger.
- * <p>
- * After passing the initial "level" check, the Logger will call
- * this Filter to check if a log record should really be published.
- * <p>
- * The caller releases ownership of this filter to this logger
- * @param filter to use, can be null
- */
- virtual void setFilter( Filter* filter );
-
- /**
- * Gets the Filter object that this class is using.
- * @return the Filter in use, can be null
- */
- virtual const Filter* getFilter() const {
- return filter;
- }
-
- /**
- * Get the log Level that has been specified for this Logger. The
- * result may be the Null level, which means that this logger's
- * effective level will be inherited from its parent.
- * @return the level that is currently set
- */
- virtual Level getLevel() const {
- return level;
- }
-
- /**
- * Set the log level specifying which message levels will be logged
- * by this logger. Message levels lower than this value will be
- * discarded. The level value Level.OFF can be used to turn off
- * logging.
- * <p>
- * If the new level is the Null Level, it means that this node
- * should inherit its level from its nearest ancestor with a
- * specific (non-null) level value.
- * @param level new Level value
- */
- virtual void setLevel( Level level ) {
- this->level = level;
- }
-
- /**
- * Discover whether or not this logger is sending its output to
- * its parent logger.
- * @return true if using Parent Handlers
- */
- virtual bool getUseParentHandlers() const {
- return useParentHandlers;
- }
-
- /**
- * pecify whether or not this logger should send its output to it's
- * parent Logger. This means that any LogRecords will also be
- * written to the parent's Handlers, and potentially to its parent,
- * recursively up the namespace.
- * @param value True is output is to be writen to the parent
- */
- virtual void setUseParentHandlers( bool value ) {
- this->useParentHandlers = value;
- }
-
- /**
- * Logs an Block Enter message
- * <p>
- * This is a convenience method that is used to tag a block enter, a
- * log record with the class name function name and the string
- * Entering is logged at the DEBUG log level.
- * @param blockName source block name
- * @param file source file name
- * @param line source line name
- */
- virtual void entry( const std::string& blockName,
- const std::string& file,
- const int line );
-
- /**
- * Logs an Block Exit message
- * <p>
- * This is a convenience method that is used to tag a block exit, a
- * log record with the class name function name and the string
- * Exiting is logged at the DEBUG log level.
- * @param blockName source block name
- * @param file source file name
- * @param line source line name
- */
- virtual void exit( const std::string& blockName,
- const std::string& file,
- const int line );
-
- /**
- * Log a Debug Level Log
- * <p>
- * If the logger is currently enabled for the DEBUG message level
- * then the given message is forwarded to all the registered output
- * Handler objects.
- * @param file the file name where the log was generated
- * @param line the line number where the log was generated
- * @param functionName name of the function that logged this
- * @param message the message to log
- */
- virtual void debug( const std::string& file,
- const int line,
- const std::string functionName,
- const std::string& message );
-
- /**
- * Log a info Level Log
- * <p>
- * If the logger is currently enabled for the info message level
- * then the given message is forwarded to all the registered output
- * Handler objects.
- *
- * @param file the file name where the log was generated
- * @param line the line number where the log was generated
- * @param functionName name of the function that logged this
- * @param message the message to log
- */
- virtual void info( const std::string& file,
- const int line,
- const std::string functionName,
- const std::string& message );
-
- /**
- * Log a warn Level Log
- * <p>
- * If the logger is currently enabled for the warn message level
- * then the given message is forwarded to all the registered output
- * Handler objects.
- * @param file the file name where the log was generated
- * @param line the line number where the log was generated
- * @param functionName name of the function that logged this
- * @param message the message to log
- */
- virtual void warn( const std::string& file,
- const int line,
- const std::string functionName,
- const std::string& message );
-
- /**
- * Log a error Level Log
- * <p>
- * If the logger is currently enabled for the error message level
- * then the given message is forwarded to all the registered output
- * Handler objects.
- * @param file the file name where the log was generated
- * @param line the line number where the log was generated
- * @param fnctionName name of the function that logged this
- * @param message the message to log
- */
- virtual void error( const std::string& file,
- const int line,
- const std::string fnctionName,
- const std::string& message );
-
- /**
- * Log a fatal Level Log
- * <p>
- * If the logger is currently enabled for the fatal message level
- * then the given message is forwarded to all the registered output
- * Handler objects.
- * @param file the file name where the log was generated
- * @param line the line number where the log was generated
- * @param fnctionName name of the function that logged this
- * @param message the message to log
- */
- virtual void fatal( const std::string& file,
- const int line,
- const std::string functionName,
- const std::string& message );
-
- /**
- * Log a Throw Message
- * <p>
- * If the logger is currently enabled for the Throwing message level
- * then the given message is forwarded to all the registered output
- * Handler objects.
- * @param file the file name where the log was generated
- * @param line the line number where the log was generated
- * @param fnctionName name of the function that logged this
- * @param message the message to log
- virtual void throwing( const std::string& file,
- const int line,
- const std::string fnctionName,
- const std::string& message );
- */
-
- /**
- * Check if a message of the given level would actually be logged
- * by this logger. This check is based on the Loggers effective
- * level, which may be inherited from its parent.
- * @param level - a message logging level
- * @returns true if the given message level is currently being logged.
- */
- virtual bool isLoggable( Level level ) const;
-
- /**
- * Log a LogRecord.
- * All the other logging methods in this class call through this
- * method to actually perform any logging. Subclasses can override
- * this single method to capture all log activity.
- * @param record - the LogRecord to be published
- */
- virtual void log( LogRecord& record );
-
- /**
- * Log a message, with no arguments.
- * <p>
- * If the logger is currently enabled for the given message level
- * then the given message is forwarded to all the registered output
- * Handler objects
- * @param level the Level to log at
- * @param message the message to log
- */
- virtual void log( Level level, const std::string& message );
-
- /**
- * Log a message, with the list of params that is formatted into
- * the message string.
- * <p>
- * If the logger is currently enabled for the given message level
- * then the given message is forwarded to all the registered output
- * Handler objects
- * @param level the Level to log at
- * @param file the message to log
- * @param line the line in the file
- * @param variable length arguement to format the message string.
- */
- virtual void log( Level level,
- const std::string& file,
- const int line,
- const std::string& message, ... );
-
- /**
- * Log a message, with associated Throwable information.
- * If the logger is currently enabled for the given message level
- * then the given arguments are stored in a LogRecord which is
- * forwarded to all registered output handlers.
- * Note that the thrown argument is stored in the LogRecord thrown
- * property, rather than the LogRecord parameters property. Thus is
- * it processed specially by output Formatters and is not treated
- * as a formatting parameter to the LogRecord message property.
- * @param level the Level to log at
- * @param file File that the message was logged in
- * @param line the line number where the message was logged at.
- * @param ex the Exception to log
- */
- virtual void log( Level level,
- const std::string& file,
- const int line,
- const std::string& message,
- lang::Exception& ex );
-
- public:
-
- /**
- * Creates an anonymous logger
- * <p>
- * The newly created Logger is not registered in the LogManager
- * namespace. There will be no access checks on updates to the
- * logger.
- * Even although the new logger is anonymous, it is configured to
- * have the root logger ("") as its parent. This means that by
- * default it inherits its effective level and handlers from the
- * root logger.
- * <p>
- * The caller is responsible for destroying the returned logger.
- * @return Newly created anonymous logger
- */
- static Logger* getAnonymousLogger();
-
- /**
- * Find or create a logger for a named subsystem. If a logger has
- * already been created with the given name it is returned.
- * Otherwise a new logger is created.
- * <p>
- * If a new logger is created its log level will be configured based
- * on the LogManager and it will configured to also send logging
- * output to its parent loggers Handlers. It will be registered in
- * the LogManager global namespace.
- * @param name - A name for the logger. This should be a
- * dot-separated name and should normally be based on the package
- * name or class name of the subsystem, such as cms or
- * activemq.core.ActiveMQConnection
- * @return a suitable logger.
- */
- static Logger* getLogger( const std::string& name );
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_LOGGING_LOGGER_H_*/
diff --git a/src/decaf/src/main/decaf/util/logging/LoggerCommon.h b/src/decaf/src/main/decaf/util/logging/LoggerCommon.h
deleted file mode 100644
index a660e8b..0000000
--- a/src/decaf/src/main/decaf/util/logging/LoggerCommon.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_LOGGING_LOGGERCOMMON_H_
-#define _DECAF_UTIL_LOGGING_LOGGERCOMMON_H_
-
-namespace decaf{
-namespace util{
-namespace logging{
-
- /**
- * Defines an enumeration for logging levels
- */
- enum Level
- {
- Off,
- Null,
- Markblock,
- Debug,
- Info,
- Warn,
- Error,
- Fatal,
- Throwing
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_LOGGING_LOGGERCOMMON_H_ */
diff --git a/src/decaf/src/main/decaf/util/logging/LoggerDefines.h b/src/decaf/src/main/decaf/util/logging/LoggerDefines.h
deleted file mode 100644
index 83d7047..0000000
--- a/src/decaf/src/main/decaf/util/logging/LoggerDefines.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_LOGGING_LOGGERDEFINES_H_
-#define _DECAF_UTIL_LOGGING_LOGGERDEFINES_H_
-
-#include <decaf/util/logging/SimpleLogger.h>
-#include <sstream>
-
-#define LOGDECAF_DECLARE(loggerName) \
- static decaf::util::logging::SimpleLogger loggerName;
-
-#define LOGDECAF_INITIALIZE(loggerName, className, loggerFamily) \
- decaf::util::logging::SimpleLogger className::loggerName(loggerFamily);
-
-#define LOGDECAF_DECLARE_LOCAL(loggerName) \
- decaf::util::logging::Logger loggerName;
-
-#define LOGDECAF_DEBUG(logger, message) \
- logger.debug(__FILE__, __LINE__, message);
-
-#define LOGDECAF_DEBUG_1(logger, message, value); \
- { \
- std::ostringstream ostream; \
- ostream << message << value; \
- logger.debug(__FILE__, __LINE__, ostream.str()); \
- }
-
-#define LOGDECAF_INFO(logger, message) \
- logger.info(__FILE__, __LINE__, message);
-
-#define LOGDECAF_ERROR(logger, message) \
- logger.error(__FILE__, __LINE__, message);
-
-#define LOGDECAF_WARN(logger, message) \
- logger.warn(__FILE__, __LINE__, message);
-
-#define LOGDECAF_FATAL(logger, message) \
- logger.fatal(__FILE__, __LINE__, message);
-
-
-#endif
diff --git a/src/decaf/src/main/decaf/util/logging/LoggerHierarchy.cpp b/src/decaf/src/main/decaf/util/logging/LoggerHierarchy.cpp
deleted file mode 100644
index e1c5a59..0000000
--- a/src/decaf/src/main/decaf/util/logging/LoggerHierarchy.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include "LoggerHierarchy.h"
-
-using namespace decaf::util::logging;
-
-////////////////////////////////////////////////////////////////////////////////
-LoggerHierarchy::LoggerHierarchy(){
-}
-
-////////////////////////////////////////////////////////////////////////////////
-LoggerHierarchy::~LoggerHierarchy(){
-}
-
diff --git a/src/decaf/src/main/decaf/util/logging/LoggerHierarchy.h b/src/decaf/src/main/decaf/util/logging/LoggerHierarchy.h
deleted file mode 100644
index b63353d..0000000
--- a/src/decaf/src/main/decaf/util/logging/LoggerHierarchy.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-#ifndef _DECAF_UTIL_LOGGING_LOGGERHIERARCHY_H_
-#define _DECAF_UTIL_LOGGING_LOGGERHIERARCHY_H_
-
-namespace decaf{
-namespace util{
-namespace logging{
-
- class LoggerHierarchy
- {
- public:
-
- LoggerHierarchy();
- virtual ~LoggerHierarchy();
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_LOGGING_LOGGERHIERARCHY_H_*/
diff --git a/src/decaf/src/main/decaf/util/logging/MarkBlockLogger.h b/src/decaf/src/main/decaf/util/logging/MarkBlockLogger.h
deleted file mode 100644
index ea304b2..0000000
--- a/src/decaf/src/main/decaf/util/logging/MarkBlockLogger.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_LOGGING_MARKBLOCKLOGGER_H_
-#define _DECAF_UTIL_LOGGING_MARKBLOCKLOGGER_H_
-
-#include <decaf/util/logging/Logger.h>
-
-namespace decaf{
-namespace util{
-namespace logging{
-
- /**
- * Defines a class that can be used to mark the entry and exit from
- * scoped blocks.
- * <p>
- * Create an instance of this class at the start of a scoped block,
- * passing it the logger to use and the name of the block. The block
- * entry and exit will be marked using the scope name, logger to the
- * logger at the MARKBLOCK log level.
- */
- class DECAF_API MarkBlockLogger
- {
- private:
-
- // Pointer to the Logger to use for Logging
- Logger* logger;
-
- // Block Name to Log
- std::string blockName;
-
- public:
-
- /**
- * Constructor - Marks Block entry
- * @param logger Logger to use
- * @param blockName Block name
- */
- MarkBlockLogger(Logger* logger, const std::string& blockName)
- {
- this->logger = logger;
- this->blockName = blockName;
-
- logger.mark(blockName + " - Entered");
- }
-
- virtual ~MarkBlockLogger(void)
- {
- logger->mark(blockName + " - Exited");
- }
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_LOGGING_MARKBLOCKLOGGER_H_*/
diff --git a/src/decaf/src/main/decaf/util/logging/PropertiesChangeListener.h b/src/decaf/src/main/decaf/util/logging/PropertiesChangeListener.h
deleted file mode 100644
index 2997431..0000000
--- a/src/decaf/src/main/decaf/util/logging/PropertiesChangeListener.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_LOGGING_PROPERTIESCHANGELISTENER_H_
-#define _DECAF_UTIL_LOGGING_PROPERTIESCHANGELISTENER_H_
-
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace util{
-namespace logging{
-
- /**
- * Defines the interface that classes can use to listen for change
- * events on Properties.
- */
- class DECAF_API PropertiesChangeListener
- {
- public:
-
- virtual ~PropertiesChangeListener() {}
-
- /**
- * Change Event, called when a property is changed
- * @param name - Name of the Property
- * @param oldValue - Old Value of the Property
- * @param newValue - New Value of the Property
- */
- virtual void onPropertyChanged( const std::string& name,
- const std::string& oldValue,
- const std::string& newValue ) = 0;
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_LOGGING_PROPERTIESCHANGELISTENER_H_*/
diff --git a/src/decaf/src/main/decaf/util/logging/SimpleFormatter.h b/src/decaf/src/main/decaf/util/logging/SimpleFormatter.h
deleted file mode 100644
index e7513a9..0000000
--- a/src/decaf/src/main/decaf/util/logging/SimpleFormatter.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_LOGGING_SIMPLEFORMATTER_H_
-#define _DECAF_UTIL_LOGGING_SIMPLEFORMATTER_H_
-
-#include <decaf/util/logging/formatter.h>
-
-namespace decaf{
-namespace util{
-namespace logging{
-
- /**
- * Print a brief summary of the LogRecord in a human readable format.
- * The summary will typically be 1 or 2 lines.
- */
- class DECAF_API SimpleFormatter : public Formatter {
- public:
-
- SimpleFormatter() {}
- virtual ~SimpleFormatter() {}
-
- /**
- * Format the given log record and return the formatted string.
- * @param record The Log Record to Format
- */
- virtual std::string format( const LogRecord& record ) const {
- return "";
- }
-
- /**
- * Format the message string from a log record.
- * @param record The Log Record to Format
- */
- virtual std::string formatMessage( const LogRecord& record ) const{
- return record.getMessage();
- }
-
- /**
- * Return the header string for a set of formatted records. In the
- * default implementation this method should return empty string
- * @param handler the target handler, can be null
- * @return empty string
- */
- virtual std::string getHead( const Handler* handler ) {
- return "";
- }
-
- /**
- * Return the tail string for a set of formatted records. In the
- * default implementation this method should return empty string
- * @param handler the target handler, can be null
- * @return empty string
- */
- virtual std::string getTail( const Handler* handler ) {
- return "";
- }
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_LOGGING_SIMPLEFORMATTER_H_*/
diff --git a/src/decaf/src/main/decaf/util/logging/SimpleLogger.cpp b/src/decaf/src/main/decaf/util/logging/SimpleLogger.cpp
deleted file mode 100644
index 1fc0840..0000000
--- a/src/decaf/src/main/decaf/util/logging/SimpleLogger.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "SimpleLogger.h"
-
-#include <iostream>
-#include <decaf/util/logging/LogWriter.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::util::concurrent;
-using namespace decaf::util::logging;
-
-////////////////////////////////////////////////////////////////////////////////
-SimpleLogger::SimpleLogger( const std::string& name )
-{
- this->name = name;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-SimpleLogger::~SimpleLogger()
-{}
-
-////////////////////////////////////////////////////////////////////////////////
-void SimpleLogger::mark( const std::string& message ) {
- LogWriter::getInstance().log( "", 0, "", message );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SimpleLogger::debug( const std::string& file,
- const int line,
- const std::string& message ) {
- LogWriter::getInstance().log( file, line, "DEBUG:", message );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SimpleLogger::info( const std::string& file,
- const int line,
- const std::string& message ) {
- LogWriter::getInstance().log( file, line, "INFO:", message );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SimpleLogger::warn( const std::string& file,
- const int line,
- const std::string& message ) {
- LogWriter::getInstance().log( file, line, "WARNING:", message );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SimpleLogger::error( const std::string& file,
- const int line,
- const std::string& message ) {
- LogWriter::getInstance().log( file, line, "ERROR:", message );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SimpleLogger::fatal( const std::string& file,
- const int line,
- const std::string& message ) {
- LogWriter::getInstance().log( file, line, "FATAL:", message );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SimpleLogger::log(const std::string& message ) {
- LogWriter::getInstance().log( message );
-}
diff --git a/src/decaf/src/main/decaf/util/logging/SimpleLogger.h b/src/decaf/src/main/decaf/util/logging/SimpleLogger.h
deleted file mode 100644
index 2ef0d89..0000000
--- a/src/decaf/src/main/decaf/util/logging/SimpleLogger.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_LOGGING_SIMPLELOGGER_H_
-#define _DECAF_UTIL_LOGGING_SIMPLELOGGER_H_
-
-#include <string>
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace util{
-namespace logging{
-
- class DECAF_API SimpleLogger
- {
- public:
-
- /**
- * Constructor
- */
- SimpleLogger( const std::string& name );
-
- /**
- * Destructor
- */
- virtual ~SimpleLogger();
-
- /**
- * Log a Mark Block Level Log
- */
- virtual void mark(const std::string& message);
-
- /**
- * Log a Debug Level Log
- */
- virtual void debug(const std::string& file,
- const int line,
- const std::string& message);
-
- /**
- * Log a Informational Level Log
- */
- virtual void info(const std::string& file,
- const int line,
- const std::string& message);
-
- /**
- * Log a Warning Level Log
- */
- virtual void warn(const std::string& file,
- const int line,
- const std::string& message);
-
- /**
- * Log a Error Level Log
- */
- virtual void error(const std::string& file,
- const int line,
- const std::string& message);
-
- /**
- * Log a Fatal Level Log
- */
- virtual void fatal(const std::string& file,
- const int line,
- const std::string& message);
-
- /**
- * No-frills log.
- */
- virtual void log(const std::string& message);
-
- private:
-
- // Name of this Logger
- std::string name;
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_LOGGING_SIMPLELOGGER_H_*/
diff --git a/src/decaf/src/main/decaf/util/logging/StreamHandler.h b/src/decaf/src/main/decaf/util/logging/StreamHandler.h
deleted file mode 100644
index b03087c..0000000
--- a/src/decaf/src/main/decaf/util/logging/StreamHandler.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_LOGGING_STREAMHANDLER_H_
-#define _DECAF_UTIL_LOGGING_STREAMHANDLER_H_
-
-#include <decaf/util/logging/LoggerCommon.h>
-#include <decaf/util/logging/Handler.h>
-#include <decaf/util/logging/Formatter.h>
-#include <decaf/util/logging/Filter.h>
-#include <decaf/io/OutputStream.h>
-#include <decaf/kang/exceptions/NullPointerException.h>
-#include <decaf/lang/exceptions/InvalidStateException.h>
-#include <decaf/util/concurrent/Concurrent.h>
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace util{
-namespace logging{
-
- class DECAF_API StreamHandler : public Handler {
- private:
-
- // OutputStream to write to
- io::OutputStream* stream;
-
- // Formats this Handlers output
- Formatter* formatter;
-
- // Filter object for Log Filtering
- Filter* filter;
-
- public:
-
- /**
- * Create a StreamHandler, with no current output stream.
- */
- StreamHandler() {
- this->stream = NULL;
- this->formatter = NULL;
- this->filter = NULL;
-
- this->level = Level::FATAL; // We take everything by default
- }
-
- /**
- * Create a StreamHandler, with no current output stream.
- */
- StreamHandler( io::OutputStream* stream, Formatter* formatter )
- {
- this->stream = stream;
- this->formatter = formatter;
- this->filter = NULL;
-
- this->level = Level::Fatal; // We take everything by default
- }
-
- /**
- * Destructor
- */
- virtual ~StreamHandler() {
- try {
- this->close();
- }
- AMQ_CATCH_NOTHROW( lang::Exception)
- AMQ_CATCALL_NOTHROW()
- }
-
- /**
- * Close the current output stream.
- * <p>
- * The close method will perform a flush and then close the Handler.
- * After close has been called this Handler should no longer be used.
- * Method calls may either be silently ignored or may throw runtime
- * exceptions.
- * @throw CMSException
- */
- virtual void close() throw ( cms::CMSException ) {
- if( stream ) {
- stream.flush();
- stream.close();
- }
- }
-
- /**
- * Flush the Handler's output, clears any buffers.
- */
- virtual void flush() {
- if(stream) {
- stream->flush();
- }
- }
-
- /**
- * Publish the Log Record to this Handler
- * @param The Log Record to Publish
- */
- virtual void publish( const LogRecord& record ) {
-
- try {
-
- if( !stream ) {
- throw lang::exceptions::NullPointerException(
- __FILE__, __LINE__,
- "StreamHandler::publish - Stream not set.");
- }
-
- // Check if we should log this record
- if(isLoggable( record) ) {
-
- std::string log = formatter->format(record);
-
- synchronized(stream) {
- // Write the data to the stream
- stream->write(log.c_str(), log.length());
- }
- }
- }
- AMQ_CATCH_RETHROW( lang::Exception )
- AMQ_CATCHALL_THROW( lang::Exception )
- }
-
- /**
- * Check if this Handler would actually log a given LogRecord.
- * <p>
- * @param <code>LogRecord</code> to check
- */
- virtual void isLoggable( const LogRecord& record ) {
-
- if( filter ) {
- // Allow for some filtering to occurr
- return filter->isLoggable( record );
- }
-
- // By default we want everything that is greater than or
- // equal to the set level of this Handler.
- return record.level >= level;
- }
-
- /**
- * Sets the Filter that this Handler uses to filter Log Records
- * @param <code>Filter</code> derived instance
- */
- virtual void setFilter( const Filter* filter ){
- this->filter = filter;
- }
-
- /**
- * Gets the Filter that this Handler uses to filter Log Records
- * @param <code>Filter</code> derived instance
- */
- virtual const Filter* getFilter(){
- return filter;
- }
-
- /**
- * Set the log level specifying which message levels will be logged
- * by this Handler.
- * <p>
- * The intention is to allow developers to turn on voluminous logging,
- * but to limit the messages that are sent to certain Handlers.
- * @param Level enumeration value
- */
- virtual void setLevel( Level level ){
- this->level = level;
- }
-
- /**
- * Get the log level specifying which message levels will be logged
- * by this Handler.
- * @param Level enumeration value
- */
- virtual Level getLevel(){
- return level;
- }
-
- /**
- * Sets the <code>Formatter</code> used by this Handler
- * @param <code>Filter</code> derived instance
- */
- virtual void setFormatter( const Formatter* formatter ){
- this->formatter = formatter;
- }
-
- /**
- * Gets the <code>Formatter</code> used by this Handler
- * @param <code>Filter</code> derived instance
- */
- virtual const Formatter* getFormatter(){
- return formatter;
- }
-
- /**
- * Gets the output Stream that this Handler is using
- * @return OuputStream pointer
- */
- virtual io::OutputStream* getOutputStream() const(
- return stream;
- }
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_LOGGING_STREAMHANDLER_H_*/
diff --git a/src/decaf/src/test-benchmarks/Makefile.am b/src/decaf/src/test-benchmarks/Makefile.am
deleted file mode 100644
index d5f203a..0000000
--- a/src/decaf/src/test-benchmarks/Makefile.am
+++ /dev/null
@@ -1,50 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-cc_sources = \
- decaf/lang/BooleanBenchmark.cpp \
- decaf/util/PropertiesBenchmark.cpp \
- decaf/util/QueueBenchmark.cpp \
- decaf/util/SetBenchmark.cpp \
- decaf/util/MapBenchmark.cpp \
- decaf/io/DataInputStreamBenchmark.cpp \
- decaf/io/DataOutputStreamBenchmark.cpp \
- benchmark/PerformanceTimer.cpp \
- testRegistry.cpp \
- main.cpp
-
-hh_sources = \
- decaf/lang/BooleanBenchmark.h \
- decaf/util/PropertiesBenchmark.h \
- decaf/util/QueueBenchmark.h \
- decaf/util/SetBenchmark.h \
- decaf/util/MapBenchmark.h \
- decaf/io/DataInputStreamBenchmark.h \
- decaf/io/DataOutputStreamBenchmark.h \
- benchmark/BenchmarkBase.h \
- benchmark/PerformanceTimer.h
-
-## Compile this as part of make check
-check_PROGRAMS = decaf-test-benchmarks
-
-##
-## Compiler/Linker Options
-##
-decaf_test_benchmarks_SOURCES = $(cc_sources)
-decaf_test_benchmarks_CXXFLAGS = $(DECAF_TEST_CXXFLAGS) -I$(srcdir)/../main @CPPUNIT_CFLAGS@
-decaf_test_benchmarks_LDADD= $(DECAF_TEST_LIBS) @CPPUNIT_LIBS@
-
diff --git a/src/decaf/src/test-benchmarks/benchmark/BenchmarkBase.h b/src/decaf/src/test-benchmarks/benchmark/BenchmarkBase.h
deleted file mode 100644
index 946b805..0000000
--- a/src/decaf/src/test-benchmarks/benchmark/BenchmarkBase.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _BENCHMARK_BENCHMARKBASE_H_
-#define _BENCHMARK_BENCHMARKBASE_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <decaf/lang/Runnable.h>
-#include <benchmark/PerformanceTimer.h>
-#include <string>
-
-namespace benchmark{
-
- template < class NAME, class TARGET, int ITERATIONS = 100 >
- class BenchmarkBase : public decaf::lang::Runnable,
- public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( NAME );
- CPPUNIT_TEST( runBenchmark );
- CPPUNIT_TEST_SUITE_END();
-
- private:
-
- PerformanceTimer timer;
-
- public:
-
- virtual ~BenchmarkBase() {}
-
- int getIterations() const {
- return ITERATIONS;
- }
-
- void runBenchmark(){
-
- for( int i = 0; i < ITERATIONS; ++i ){
- timer.start();
- this->run();
- timer.stop();
- }
-
- std::cout << typeid( TARGET ).name() << " Benchmark Time = "
- << timer.getAverageTime() << " Millisecs"
- << std::endl;
- }
-
- };
-
-}
-
-#endif /*_BENCHMARK_BENCHMARKBASE_H_*/
diff --git a/src/decaf/src/test-benchmarks/benchmark/PerformanceTimer.cpp b/src/decaf/src/test-benchmarks/benchmark/PerformanceTimer.cpp
deleted file mode 100644
index a21cbb5..0000000
--- a/src/decaf/src/test-benchmarks/benchmark/PerformanceTimer.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "PerformanceTimer.h"
-
-#include <decaf/util/Date.h>
-
-using namespace std;
-using namespace benchmark;
-using namespace decaf::util;
-
-////////////////////////////////////////////////////////////////////////////////
-PerformanceTimer::PerformanceTimer(){
- this->numberOfRuns = 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-PerformanceTimer::~PerformanceTimer(){
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void PerformanceTimer::start(){
- this->startTime = Date::getCurrentTimeMilliseconds();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void PerformanceTimer::stop(){
-
- this->endTime = Date::getCurrentTimeMilliseconds();
- times.push_back( endTime - startTime );
- numberOfRuns++;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void PerformanceTimer::reset(){
- this->startTime = 0;
- this->endTime = 0;
- this->times.clear();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-long long PerformanceTimer::getAverageTime() const{
-
- std::vector<long long>::const_iterator iter = times.begin();
- long long totalTime = 0;
-
- do{
- totalTime += *iter;
- } while( ++iter != times.end() );
-
- if( totalTime == 0 || numberOfRuns == 0 ) {
- return 0;
- }
-
- return totalTime / numberOfRuns;
-}
diff --git a/src/decaf/src/test-benchmarks/benchmark/PerformanceTimer.h b/src/decaf/src/test-benchmarks/benchmark/PerformanceTimer.h
deleted file mode 100644
index 0af0ff6..0000000
--- a/src/decaf/src/test-benchmarks/benchmark/PerformanceTimer.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _BENCHMARK_PERFORMANCETIMER_H_
-#define _BENCHMARK_PERFORMANCETIMER_H_
-
-#include <decaf/util/Config.h>
-#include <vector>
-
-namespace benchmark{
-
- /**
- * This class is used to aid in testing the performace of code. This class
- * maintains a running list of performance numbers for successive calls to
- * the method start and stop. Once the desired number of tests has been run,
- * the user can call getAverageTime to find out the average time it took for
- * all start / stop cycles.
- */
- class PerformanceTimer {
- private:
-
- long long numberOfRuns;
- std::vector<long long> times;
- long long startTime;
- long long endTime;
-
- public:
-
- PerformanceTimer();
- virtual ~PerformanceTimer();
-
- /**
- * Starts the timer, time is from the call to start until a call
- * to stop is made.
- */
- void start();
-
- /**
- * Stops the timer and records the latest time.
- */
- void stop();
-
- /**
- * Resets the Timer to an unused state all data is thrown out.
- */
- void reset();
-
- /**
- * Gets the number of runs made so far
- * @returns unsigned int that counts the number of runs
- */
- unsigned int getNumberOfRuns() const {
- return numberOfRuns;
- }
-
- /**
- * Gets the overall average time that the count has recoreded
- * for all start / stop cycles.
- * @returns the average time for all the runs times / numberOfRuns
- */
- long long getAverageTime() const;
-
- };
-
-}
-
-#endif /*_PERFORMANCETIMER_H_*/
diff --git a/src/decaf/src/test-benchmarks/decaf/io/DataInputStreamBenchmark.cpp b/src/decaf/src/test-benchmarks/decaf/io/DataInputStreamBenchmark.cpp
deleted file mode 100644
index d5ebf2f..0000000
--- a/src/decaf/src/test-benchmarks/decaf/io/DataInputStreamBenchmark.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "DataInputStreamBenchmark.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::io;
-
-////////////////////////////////////////////////////////////////////////////////
-DataInputStreamBenchmark::DataInputStreamBenchmark(){
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataInputStreamBenchmark::setUp(){
-
- buffer = new unsigned char[bufferSize];
-
- // init to full String Buffer
- for( int ix = 0; ix < bufferSize - 1; ++ix ) {
- buffer[ix] = 65;
- }
- buffer[bufferSize-1] = 0;
- bis.setByteArray( buffer, bufferSize );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataInputStreamBenchmark::tearDown(){
-
- delete buffer;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataInputStreamBenchmark::run(){
-
- DataInputStream dis( &bis );
-
- bool boolResult = 0;
- char charResult = 0;
- unsigned char byteResult = 0;
- unsigned short ushortResult = 0;
- short shortResult = 0;
- int intResult = 0;
- long long longResult = 0;
- double doubleResult = 0.0;
- float floatResult = 0.0f;
- std::string stringResult = "";
-
- for( size_t iy = 0; iy < bufferSize / sizeof( boolResult ); ++iy ){
- boolResult = dis.readBoolean();
- }
- bis.reset();
-
- for( size_t iy = 0; iy < bufferSize / sizeof( charResult ); ++iy ){
- charResult = dis.readChar();
- }
- bis.reset();
-
- for( size_t iy = 0; iy < bufferSize / sizeof( byteResult ); ++iy ){
- byteResult = dis.readByte();
- }
- bis.reset();
-
- for( size_t iy = 0; iy < bufferSize / sizeof( ushortResult ); ++iy ){
- ushortResult = dis.readUnsignedShort();
- }
- bis.reset();
-
- for( size_t iy = 0; iy < bufferSize / sizeof( shortResult ); ++iy ){
- shortResult = dis.readShort();
- }
- bis.reset();
-
- for( size_t iy = 0; iy < bufferSize / sizeof( intResult ); ++iy ){
- intResult = dis.readInt();
- }
- bis.reset();
-
- for( size_t iy = 0; iy < bufferSize / sizeof( longResult ); ++iy ){
- longResult = dis.readLong();
- }
- bis.reset();
-
- for( size_t iy = 0; iy < bufferSize / sizeof( floatResult ); ++iy ){
- floatResult = dis.readFloat();
- }
- bis.reset();
-
- for( size_t iy = 0; iy < bufferSize / sizeof( doubleResult ); ++iy ){
- doubleResult = dis.readDouble();
- }
- bis.reset();
-
- for( int i = 0; i < 5; ++i ) {
- stringResult = dis.readString();
- bis.reset();
- }
-}
diff --git a/src/decaf/src/test-benchmarks/decaf/io/DataInputStreamBenchmark.h b/src/decaf/src/test-benchmarks/decaf/io/DataInputStreamBenchmark.h
deleted file mode 100644
index b166895..0000000
--- a/src/decaf/src/test-benchmarks/decaf/io/DataInputStreamBenchmark.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_DATAINPUTSTREAMBENCHMARK_H_
-#define _DECAF_IO_DATAINPUTSTREAMBENCHMARK_H_
-
-#include <benchmark/BenchmarkBase.h>
-#include <decaf/io/DataInputStream.h>
-#include <decaf/io/ByteArrayInputStream.h>
-
-namespace decaf{
-namespace io{
-
- class DataInputStreamBenchmark :
- public benchmark::BenchmarkBase<
- decaf::io::DataInputStreamBenchmark, DataInputStream >
- {
- private:
-
- unsigned char* buffer;
- static const int bufferSize = 200000;
- ByteArrayInputStream bis;
-
- public:
-
- DataInputStreamBenchmark();
- virtual ~DataInputStreamBenchmark() {}
-
- virtual void setUp();
- virtual void tearDown();
- virtual void run();
- };
-
-}}
-
-#endif /*_DECAF_IO_DATAINPUTSTREAMBENCHMARK_H_*/
diff --git a/src/decaf/src/test-benchmarks/decaf/io/DataOutputStreamBenchmark.cpp b/src/decaf/src/test-benchmarks/decaf/io/DataOutputStreamBenchmark.cpp
deleted file mode 100644
index 1116b38..0000000
--- a/src/decaf/src/test-benchmarks/decaf/io/DataOutputStreamBenchmark.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "DataOutputStreamBenchmark.h"
-#include <decaf/io/ByteArrayOutputStream.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::io;
-
-////////////////////////////////////////////////////////////////////////////////
-DataOutputStreamBenchmark::DataOutputStreamBenchmark(){
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStreamBenchmark::setUp(){
-
- for( size_t i = 0; i < 8096; ++i ) {
- testString += 'a';
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStreamBenchmark::run(){
-
- std::vector<unsigned char> outputBuffer;
- int numRuns = 500;
-
- ByteArrayOutputStream bos( outputBuffer );
- DataOutputStream dos( &bos );
-
- for( int iy = 0; iy < numRuns * 40; ++iy ){
- dos.writeLong( 0xFF00FF00FF00FF00LL );
- }
- for( int iy = 0; iy < numRuns * 40; ++iy ){
- dos.writeInt( 312568 );
- }
- for( int iy = 0; iy < numRuns * 40; ++iy ){
- dos.writeShort( 12568 );
- }
- for( int iy = 0; iy < numRuns * 40; ++iy ){
- dos.writeUnsignedShort( 12568 );
- }
- for( int iy = 0; iy < numRuns * 40; ++iy ){
- dos.writeBoolean( true );
- }
- for( int iy = 0; iy < numRuns * 40; ++iy ){
- dos.writeDouble( 10.34235234 );
- }
- for( int iy = 0; iy < numRuns + 40; ++iy ){
- dos.writeFloat( 32.4f );
- }
-
- outputBuffer.clear();
-
- for( int iy = 0; iy < numRuns; ++iy ){
- dos.writeChars( testString );
- outputBuffer.clear();
- }
- for( int iy = 0; iy < numRuns; ++iy ){
- dos.writeBytes( testString );
- outputBuffer.clear();
- }
- for( int iy = 0; iy < numRuns; ++iy ){
- dos.writeUTF( testString );
- outputBuffer.clear();
- }
-
- outputBuffer.clear();
-}
diff --git a/src/decaf/src/test-benchmarks/decaf/io/DataOutputStreamBenchmark.h b/src/decaf/src/test-benchmarks/decaf/io/DataOutputStreamBenchmark.h
deleted file mode 100644
index cc9d07d..0000000
--- a/src/decaf/src/test-benchmarks/decaf/io/DataOutputStreamBenchmark.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_DATAOUTPUTSTREAMBENCHMARK_H_
-#define _DECAF_IO_DATAOUTPUTSTREAMBENCHMARK_H_
-
-#include <benchmark/BenchmarkBase.h>
-#include <decaf/io/DataOutputStream.h>
-
-namespace decaf{
-namespace io{
-
- class DataOutputStreamBenchmark :
- public benchmark::BenchmarkBase<
- decaf::io::DataOutputStreamBenchmark, DataOutputStream >
- {
- private:
-
- std::string testString;
-
- public:
-
- DataOutputStreamBenchmark();
- virtual ~DataOutputStreamBenchmark() {}
-
- virtual void setUp();
- virtual void run();
- };
-
-}}
-
-#endif /*_DECAF_IO_DATAOUTPUTSTREAMBENCHMARK_H_*/
diff --git a/src/decaf/src/test-benchmarks/decaf/lang/BooleanBenchmark.cpp b/src/decaf/src/test-benchmarks/decaf/lang/BooleanBenchmark.cpp
deleted file mode 100644
index c547bcd..0000000
--- a/src/decaf/src/test-benchmarks/decaf/lang/BooleanBenchmark.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BooleanBenchmark.h"
-
-using namespace decaf;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-BooleanBenchmark::BooleanBenchmark() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BooleanBenchmark::run(){
-
- int numRuns = 1000;
- Boolean boolean( false );
-
- std::string value = "";
-
- for( int i = 0; i < numRuns; ++i ) {
- value = boolean.toString();
- }
-
- for( int i = 0; i < numRuns; ++i ) {
- value = boolean.toString( false );
- value = boolean.toString( true );
- }
-
- for( int i = 0; i < numRuns; ++i ) {
- bool value1 = Boolean::parseBoolean( "false" );
- bool value2 = Boolean::parseBoolean( "true" );
-
- value = Boolean::valueOf( value1 ).toString();
- value = Boolean::valueOf( value2 ).toString();
- }
-
-}
diff --git a/src/decaf/src/test-benchmarks/decaf/lang/BooleanBenchmark.h b/src/decaf/src/test-benchmarks/decaf/lang/BooleanBenchmark.h
deleted file mode 100644
index ba3097c..0000000
--- a/src/decaf/src/test-benchmarks/decaf/lang/BooleanBenchmark.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_BOOLEANBENCHMARK_H_
-#define _DECAF_LANG_BOOLEANBENCHMARK_H_
-
-#include <benchmark/BenchmarkBase.h>
-#include <decaf/lang/Boolean.h>
-
-namespace decaf{
-namespace lang{
-
- class BooleanBenchmark :
- public benchmark::BenchmarkBase< decaf::lang::BooleanBenchmark, Boolean >
- {
- public:
-
- BooleanBenchmark();
- virtual ~BooleanBenchmark() {}
-
- virtual void run();
- };
-
-}}
-
-#endif /*_DECAF_LANG_BOOLEANBENCHMARK_H_*/
diff --git a/src/decaf/src/test-benchmarks/decaf/util/MapBenchmark.cpp b/src/decaf/src/test-benchmarks/decaf/util/MapBenchmark.cpp
deleted file mode 100644
index 9f3155c..0000000
--- a/src/decaf/src/test-benchmarks/decaf/util/MapBenchmark.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "MapBenchmark.h"
-#include <decaf/lang/Integer.h>
-
-using namespace decaf;
-using namespace decaf::util;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-MapBenchmark::MapBenchmark() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MapBenchmark::run() {
-
- int numRuns = 500;
- std::string test = "test";
- std::string resultStr = "";
- Map<std::string, std::string> stringCopy;
- Map<int, int> intCopy;
-
- for( int i = 0; i < numRuns; ++i ) {
- stringMap.setValue( test + Integer::toString(i), test + Integer::toString(i) );
- intMap.setValue( 100 + i, 100 + i );
- stringMap.containsKey( test + Integer::toString(i) );
- intMap.containsKey( 100 + i );
- stringMap.containsValue( test + Integer::toString(i) );
- intMap.containsValue( 100 + i );
- }
-
- for( int i = 0; i < numRuns; ++i ) {
- stringMap.remove( test + Integer::toString(i) );
- intMap.remove( 100 + i );
- stringMap.containsKey( test + Integer::toString(i) );
- intMap.containsKey( 100 + i );
- }
-
- for( int i = 0; i < numRuns; ++i ) {
- stringMap.setValue( test + Integer::toString(i), test + Integer::toString(i) );
- intMap.setValue( 100 + i, 100 + i );
- }
-
- std::vector<std::string> stringVec;
- std::vector<int> intVec;
-
- for( int i = 0; i < numRuns / 2; ++i ) {
- stringVec = stringMap.getKeys();
- stringVec = stringMap.getValues();
- intVec = intMap.getKeys();
- intVec = intMap.getValues();
- }
-
- for( int i = 0; i < numRuns / 2; ++i ) {
- stringCopy.copy( stringMap );
- stringCopy.clear();
- intCopy.copy( intMap );
- intCopy.clear();
- }
-
-}
diff --git a/src/decaf/src/test-benchmarks/decaf/util/MapBenchmark.h b/src/decaf/src/test-benchmarks/decaf/util/MapBenchmark.h
deleted file mode 100644
index 847034b..0000000
--- a/src/decaf/src/test-benchmarks/decaf/util/MapBenchmark.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_MAPBENCHMARK_H_
-#define _DECAF_UTIL_MAPBENCHMARK_H_
-
-#include <benchmark/BenchmarkBase.h>
-#include <decaf/util/Map.h>
-
-namespace decaf{
-namespace util{
-
- class MapBenchmark :
- public benchmark::BenchmarkBase<
- decaf::util::MapBenchmark, Map<int, int> >
- {
- private:
-
- Map< std::string, std::string> stringMap;
- Map<int, int> intMap;
-
- public:
-
- MapBenchmark();
- virtual ~MapBenchmark() {}
-
- virtual void run();
- };
-
-}}
-
-#endif /*_DECAF_UTIL_MAPBENCHMARK_H_*/
diff --git a/src/decaf/src/test-benchmarks/decaf/util/PropertiesBenchmark.cpp b/src/decaf/src/test-benchmarks/decaf/util/PropertiesBenchmark.cpp
deleted file mode 100644
index efb8a25..0000000
--- a/src/decaf/src/test-benchmarks/decaf/util/PropertiesBenchmark.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "PropertiesBenchmark.h"
-
-#include <decaf/lang/Integer.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::util;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-PropertiesBenchmark::PropertiesBenchmark() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void PropertiesBenchmark::run() {
-
- int numRuns = 250;
- std::string result = "";
- bool hasIt = false;
- Properties copy;
-
- for( int i = 0; i < numRuns; ++i ) {
- properties.setProperty( "test", "value" );
- hasIt = properties.hasProperty( "test" );
- result = properties.getProperty( "test" );
- properties.remove( "test" );
- }
-
- std::vector< std::pair< std::string, std::string > > array;
-
- std::string prefix = "test";
- for( int i = 0; i < numRuns; ++i ) {
- properties.setProperty(
- prefix + Integer::toString(i), prefix + Integer::toString(i) );
- }
-
- for( int i = 0; i < numRuns; ++i ) {
- array = properties.toArray();
- }
-
- for( int i = 0; i < numRuns; ++i ) {
- copy.copy( &properties );
- copy.clear();
- }
-
-}
diff --git a/src/decaf/src/test-benchmarks/decaf/util/PropertiesBenchmark.h b/src/decaf/src/test-benchmarks/decaf/util/PropertiesBenchmark.h
deleted file mode 100644
index 3e7ffbc..0000000
--- a/src/decaf/src/test-benchmarks/decaf/util/PropertiesBenchmark.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_PROPERTIESBENCHMARK_H_
-#define _DECAF_UTIL_PROPERTIESBENCHMARK_H_
-
-#include <benchmark/BenchmarkBase.h>
-
-#include <decaf/util/Properties.h>
-
-namespace decaf{
-namespace util{
-
- class PropertiesBenchmark :
- public benchmark::BenchmarkBase<
- decaf::util::PropertiesBenchmark, Properties >
- {
- private:
-
- Properties properties;
-
- public:
-
- PropertiesBenchmark();
- virtual ~PropertiesBenchmark() {}
-
- virtual void run();
- };
-
-}}
-
-#endif /*_DECAF_UTIL_PROPERTIESBENCHMARK_H_*/
diff --git a/src/decaf/src/test-benchmarks/decaf/util/QueueBenchmark.cpp b/src/decaf/src/test-benchmarks/decaf/util/QueueBenchmark.cpp
deleted file mode 100644
index a8d8967..0000000
--- a/src/decaf/src/test-benchmarks/decaf/util/QueueBenchmark.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "QueueBenchmark.h"
-
-#include <decaf/lang/Integer.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::util;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-QueueBenchmark::QueueBenchmark(){
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void QueueBenchmark::run(){
-
- int numRuns = 300;
- std::string test = "test";
- std::string resultStr = "";
- int resultInt = 0;
- Queue<std::string> stringQCopy;
- Queue<int> intQCopy;
-
- for( int i = 0; i < numRuns; ++i ) {
- stringQ.push( test );
- intQ.push( 65536 );
- }
-
- for( int i = 0; i < numRuns; ++i ) {
- stringQ.pop();
- intQ.pop();
- }
-
- for( int i = 0; i < numRuns; ++i ) {
- stringQ.enqueueFront( test );
- intQ.enqueueFront( 1024 );
- }
-
- for( int i = 0; i < numRuns; ++i ) {
- stringQ.reverse( stringQCopy );
- intQ.reverse( intQCopy );
- }
-
- std::vector<std::string> stringVec;
- std::vector<int> intVec;
-
- for( int i = 0; i < numRuns; ++i ) {
- stringVec = stringQ.toArray();
- intVec = intQ.toArray();
- }
-
- for( int i = 0; i < numRuns; ++i ) {
- resultStr = stringQ.front();
- resultStr = stringQ.back();
- resultInt = intQ.front();
- resultInt = intQ.back();
- stringQ.pop();
- intQ.pop();
- }
-
-}
diff --git a/src/decaf/src/test-benchmarks/decaf/util/QueueBenchmark.h b/src/decaf/src/test-benchmarks/decaf/util/QueueBenchmark.h
deleted file mode 100644
index be07b67..0000000
--- a/src/decaf/src/test-benchmarks/decaf/util/QueueBenchmark.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_QUEUE_QUEUEBENCHMARK_H_
-#define _DECAF_QUEUE_QUEUEBENCHMARK_H_
-
-#include <benchmark/BenchmarkBase.h>
-#include <decaf/util/Queue.h>
-
-namespace decaf{
-namespace util{
-
- class QueueBenchmark :
- public benchmark::BenchmarkBase<
- decaf::util::QueueBenchmark, Queue<int> >
- {
- private:
-
- Queue<std::string> stringQ;
- Queue<int> intQ;
-
- public:
-
- QueueBenchmark();
- virtual ~QueueBenchmark() {}
-
- virtual void run();
- };
-
-}}
-
-#endif /*_DECAF_QUEUE_QUEUEBENCHMARK_H_*/
diff --git a/src/decaf/src/test-benchmarks/decaf/util/SetBenchmark.cpp b/src/decaf/src/test-benchmarks/decaf/util/SetBenchmark.cpp
deleted file mode 100644
index 835cf3b..0000000
--- a/src/decaf/src/test-benchmarks/decaf/util/SetBenchmark.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "SetBenchmark.h"
-
-#include <decaf/lang/Integer.h>
-#include <decaf/util/Iterator.h>
-
-using namespace decaf;
-using namespace decaf::util;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-SetBenchmark::SetBenchmark(){
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SetBenchmark::run(){
-
- int numRuns = 500;
- std::string test = "test";
- std::string resultStr = "";
- Set<std::string> stringCopy;
- Set<int> intCopy;
-
- for( int i = 0; i < numRuns; ++i ) {
- stringSet.add( test + Integer::toString(i) );
- intSet.add( 100 + i );
- stringSet.contains( test + Integer::toString(i) );
- intSet.contains( 100 + i );
- }
-
- for( int i = 0; i < numRuns; ++i ) {
- stringSet.remove( test + Integer::toString(i) );
- intSet.remove( 100 + i );
- stringSet.contains( test + Integer::toString(i) );
- intSet.contains( 100 + i );
- }
-
- for( int i = 0; i < numRuns; ++i ) {
- stringSet.add( test + Integer::toString(i) );
- intSet.add( 100 + i );
- }
-
- std::vector<std::string> stringVec;
- std::vector<int> intVec;
-
- for( int i = 0; i < numRuns / 2; ++i ) {
- stringVec = stringSet.toArray();
- intVec = intSet.toArray();
- }
-
- std::string tempStr = "";
- int tempInt = 0;
-
- for( int i = 0; i < numRuns / 2; ++i ) {
-
- Iterator<std::string>* strIter = stringSet.iterator();
- Iterator<int>* intIter = intSet.iterator();
-
- while( strIter->hasNext() ){
- tempStr = strIter->next();
- }
-
- while( intIter->hasNext() ){
- tempInt = intIter->next();
- }
-
- delete strIter;
- delete intIter;
- }
-
- for( int i = 0; i < numRuns / 2; ++i ) {
- stringCopy.copy( stringSet );
- stringCopy.clear();
- intCopy.copy( intSet );
- intCopy.clear();
- }
-
-}
diff --git a/src/decaf/src/test-benchmarks/decaf/util/SetBenchmark.h b/src/decaf/src/test-benchmarks/decaf/util/SetBenchmark.h
deleted file mode 100644
index 7c57ef9..0000000
--- a/src/decaf/src/test-benchmarks/decaf/util/SetBenchmark.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_SETBENCHMARK_H_
-#define _DECAF_UTIL_SETBENCHMARK_H_
-
-#include <benchmark/BenchmarkBase.h>
-#include <decaf/util/Set.h>
-
-namespace decaf{
-namespace util{
-
- class SetBenchmark :
- public benchmark::BenchmarkBase<
- decaf::util::SetBenchmark, Set<int> >
- {
- private:
-
- Set<int> intSet;
- Set<std::string> stringSet;
-
- public:
-
- SetBenchmark();
- virtual ~SetBenchmark() {}
-
- virtual void run();
- };
-
-}}
-
-#endif /*_DECAF_UTIL_SETBENCHMARK_H_*/
diff --git a/src/decaf/src/test-benchmarks/main.cpp b/src/decaf/src/test-benchmarks/main.cpp
deleted file mode 100644
index ae67c6c..0000000
--- a/src/decaf/src/test-benchmarks/main.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-#include <cppunit/TestResult.h>
-#include <decaf/util/Config.h>
-#include <iostream>
-
-int main( int argc DECAF_UNUSED, char **argv DECAF_UNUSED ) {
- try {
- CppUnit::TextUi::TestRunner runner;
- CppUnit::TestFactoryRegistry ®istry =
- CppUnit::TestFactoryRegistry::getRegistry();
- runner.addTest( registry.makeTest() );
-
- std::cout << "=====================================================\n";
- std::cout << "Starting the Benchmarks:" << std::endl;
- std::cout << "-----------------------------------------------------\n";
-
- bool wasSuccessful = runner.run( "", false );
-
- std::cout << "-----------------------------------------------------\n";
- std::cout << "Finished with the Benchmarks." << std::endl;
- std::cout << "=====================================================\n";
-
- return !wasSuccessful;
- } catch(...) {
- std::cout << "----------------------------------------" << std::endl;
- std::cout << "- AN ERROR HAS OCCURED: -" << std::endl;
- std::cout << "----------------------------------------" << std::endl;
- }
-}
diff --git a/src/decaf/src/test-benchmarks/testRegistry.cpp b/src/decaf/src/test-benchmarks/testRegistry.cpp
deleted file mode 100644
index 31af405..0000000
--- a/src/decaf/src/test-benchmarks/testRegistry.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <decaf/lang/BooleanBenchmark.h>
-
-#include <decaf/util/PropertiesBenchmark.h>
-#include <decaf/util/QueueBenchmark.h>
-#include <decaf/util/SetBenchmark.h>
-#include <decaf/util/MapBenchmark.h>
-
-#include <decaf/io/DataInputStreamBenchmark.h>
-#include <decaf/io/DataOutputStreamBenchmark.h>
-
-CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::BooleanBenchmark );
-
-CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::PropertiesBenchmark );
-CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::QueueBenchmark );
-CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::SetBenchmark );
-CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::MapBenchmark );
-
-CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::DataInputStreamBenchmark );
-CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::DataOutputStreamBenchmark );
diff --git a/src/decaf/src/test/Makefile.am b/src/decaf/src/test/Makefile.am
deleted file mode 100644
index ce264fa..0000000
--- a/src/decaf/src/test/Makefile.am
+++ /dev/null
@@ -1,100 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-cc_sources = \
- decaf/lang/ByteTest.cpp \
- decaf/lang/CharacterTest.cpp \
- decaf/lang/BooleanTest.cpp \
- decaf/lang/ShortTest.cpp \
- decaf/lang/IntegerTest.cpp \
- decaf/lang/LongTest.cpp \
- decaf/lang/FloatTest.cpp \
- decaf/lang/DoubleTest.cpp \
- decaf/lang/ThreadTest.cpp \
- decaf/lang/ExceptionTest.cpp \
- decaf/lang/MathTest.cpp \
- decaf/lang/SystemTest.cpp \
- decaf/io/BufferedInputStreamTest.cpp \
- decaf/io/BufferedOutputStreamTest.cpp \
- decaf/io/ByteArrayInputStreamTest.cpp \
- decaf/io/ByteArrayOutputStreamTest.cpp \
- decaf/io/DataInputStreamTest.cpp \
- decaf/io/DataOutputStreamTest.cpp \
- decaf/net/SocketFactoryTest.cpp \
- decaf/net/SocketTest.cpp \
- decaf/net/URITest.cpp \
- decaf/net/URISyntaxExceptionTest.cpp \
- decaf/util/StringTokenizerTest.cpp \
- decaf/util/Endian.cpp \
- decaf/util/DateTest.cpp \
- decaf/util/UUIDTest.cpp \
- decaf/util/RandomTest.cpp \
- decaf/util/MapTest.cpp \
- decaf/util/QueueTest.cpp \
- decaf/util/SetTest.cpp \
- decaf/util/concurrent/CountDownLatchTest.cpp \
- decaf/util/concurrent/MutexTest.cpp \
- decaf/util/concurrent/ThreadPoolTest.cpp \
- testRegistry.cpp \
- main.cpp
-
-h_sources = \
- decaf/lang/ByteTest.h \
- decaf/lang/CharacterTest.h \
- decaf/lang/BooleanTest.h \
- decaf/lang/ShortTest.h \
- decaf/lang/IntegerTest.h \
- decaf/lang/LongTest.h \
- decaf/lang/FloatTest.h \
- decaf/lang/DoubleTest.h \
- decaf/lang/ThreadTest.h \
- decaf/lang/ExceptionTest.h \
- decaf/lang/MathTest.h \
- decaf/lang/SystemTest.h \
- decaf/io/BufferedInputStreamTest.h \
- decaf/io/BufferedOutputStreamTest.h \
- decaf/io/ByteArrayInputStreamTest.h \
- decaf/io/ByteArrayOutputStreamTest.h \
- decaf/io/DataInputStreamTest.h \
- decaf/io/DataOutputStreamTest.h \
- decaf/net/SocketFactoryTest.h \
- decaf/net/SocketTest.h \
- decaf/net/URITest.h \
- decaf/net/URISyntaxExceptionTest.h \
- decaf/util/StringTokenizerTest.h \
- decaf/util/Endian.h \
- decaf/util/DateTest.h \
- decaf/util/UUIDTest.h \
- decaf/util/RandomTest.h \
- decaf/util/MapTest.h \
- decaf/util/QueueTest.h \
- decaf/util/SetTest.h \
- decaf/util/concurrent/CountDownLatchTest.h \
- decaf/util/concurrent/MutexTest.h \
- decaf/util/concurrent/ThreadPoolTest.h
-
-## Compile this as part of make check
-check_PROGRAMS = decaf-test
-## Also run the tests as part of make check
-## TESTS = $(check_PROGRAMS)
-
-##
-## Compiler/Linker Options
-##
-decaf_test_SOURCES = $(cc_sources)
-decaf_test_CXXFLAGS = $(DECAF_TEST_CXXFLAGS) -I$(srcdir)/../main @CPPUNIT_CFLAGS@
-decaf_test_LDADD= $(DECAF_TEST_LIBS) @CPPUNIT_LIBS@
diff --git a/src/decaf/src/test/decaf/io/BufferedInputStreamTest.cpp b/src/decaf/src/test/decaf/io/BufferedInputStreamTest.cpp
deleted file mode 100644
index 13286db..0000000
--- a/src/decaf/src/test/decaf/io/BufferedInputStreamTest.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BufferedInputStreamTest.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::io;
-using namespace decaf::util;
-
-void BufferedInputStreamTest::testSmallerBuffer(){
-
- std::string testStr = "TEST12345678910";
- MyInputStream myStream( testStr );
- BufferedInputStream bufStream( &myStream, (std::size_t)1 );
-
- std::size_t available = bufStream.available();
- CPPUNIT_ASSERT( available == testStr.length() );
-
- unsigned char dummy = bufStream.read();
- CPPUNIT_ASSERT( dummy == 'T' );
-
- available = bufStream.available();
- CPPUNIT_ASSERT( available == (testStr.length() - 1) );
-
- dummy = bufStream.read();
- CPPUNIT_ASSERT( dummy == 'E' );
-
- available = bufStream.available();
- CPPUNIT_ASSERT( available == (testStr.length() - 2 ) );
-
- dummy = bufStream.read();
- CPPUNIT_ASSERT( dummy == 'S' );
-
- available = bufStream.available();
- CPPUNIT_ASSERT( available == (testStr.length() - 3 ) );
-
- dummy = bufStream.read();
- CPPUNIT_ASSERT( dummy == 'T' );
-
- unsigned char dummyBuf[20];
- memset( dummyBuf, 0, 20 );
- std::size_t numRead = bufStream.read( dummyBuf, 10 );
- CPPUNIT_ASSERT( numRead == 10 );
- CPPUNIT_ASSERT( strcmp( (char*)dummyBuf, "1234567891" ) == 0 );
-
- available = bufStream.available();
- CPPUNIT_ASSERT( available == 1 );
-}
-
-void BufferedInputStreamTest::testBiggerBuffer(){
-
- std::string testStr = "TEST12345678910";
- MyInputStream myStream( testStr );
- BufferedInputStream bufStream( &myStream, (std::size_t)10 );
-
- std::size_t available = bufStream.available();
- CPPUNIT_ASSERT( available == testStr.length() );
-
- unsigned char dummy = bufStream.read();
- CPPUNIT_ASSERT( dummy == 'T' );
-
- available = bufStream.available();
- CPPUNIT_ASSERT( available == (testStr.length() - 1 ) );
-
- dummy = bufStream.read();
- CPPUNIT_ASSERT( dummy == 'E' );
-
- available = bufStream.available();
- CPPUNIT_ASSERT( available == (testStr.length() - 2 ) );
-
- dummy = bufStream.read();
- CPPUNIT_ASSERT( dummy == 'S' );
-
- available = bufStream.available();
- CPPUNIT_ASSERT( available == (testStr.length() - 3 ) );
-
- dummy = bufStream.read();
- CPPUNIT_ASSERT( dummy == 'T' );
-
- unsigned char dummyBuf[20];
- memset( dummyBuf, 0, 20 );
- std::size_t numRead = bufStream.read( dummyBuf, 10 );
- CPPUNIT_ASSERT( numRead == 10 );
- CPPUNIT_ASSERT( strcmp( (char*)dummyBuf, "1234567891" ) == 0 );
-
- available = bufStream.available();
- CPPUNIT_ASSERT( available == 1 );
-}
diff --git a/src/decaf/src/test/decaf/io/BufferedInputStreamTest.h b/src/decaf/src/test/decaf/io/BufferedInputStreamTest.h
deleted file mode 100644
index 0664a4b..0000000
--- a/src/decaf/src/test/decaf/io/BufferedInputStreamTest.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_BUFFEREDINPUTSTREAMTEST_H_
-#define _DECAF_IO_BUFFEREDINPUTSTREAMTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/io/BufferedInputStream.h>
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace io{
-
- class BufferedInputStreamTest : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE( BufferedInputStreamTest );
- CPPUNIT_TEST( testSmallerBuffer );
- CPPUNIT_TEST( testBiggerBuffer );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- class MyInputStream : public InputStream{
- private:
- std::string data;
- std::size_t pos;
- public:
-
- MyInputStream( const std::string& data ){
- this->data = data;
- pos = 0;
- }
- virtual ~MyInputStream(){}
-
- virtual std::size_t available() const throw (IOException){
- std::size_t len = data.length();
- return len - pos;
- }
- virtual unsigned char read() throw (IOException){
- if( pos >= data.length() ){
- throw IOException();
- }
-
- return data.c_str()[pos++];
- }
- virtual int read( unsigned char* buffer, std::size_t bufferSize ) throw (IOException){
- std::size_t numToRead = std::min( bufferSize, available() );
-
- const char* str = data.c_str();
- for( std::size_t ix=0; ix<numToRead; ++ix ){
- buffer[ix] = str[pos+ix];
- }
-
- pos += numToRead;
-
- return numToRead;
- }
-
- virtual void close() throw(lang::Exception){
- // do nothing.
- }
- virtual std::size_t skip( std::size_t num DECAF_UNUSED) throw ( io::IOException, lang::exceptions::UnsupportedOperationException ) {
- return 0;
- }
-
- virtual void lock() throw(lang::Exception){
- }
- virtual void unlock() throw(lang::Exception){
- }
- virtual void wait() throw(lang::Exception){
- }
- virtual void wait(unsigned long millisecs DECAF_UNUSED) throw(lang::Exception){
- }
- virtual void notify() throw(lang::Exception){
- }
- virtual void notifyAll() throw(lang::Exception){
- }
- };
-
- public:
-
- virtual ~BufferedInputStreamTest(){}
- virtual void setUp(){}
- virtual void tearDown(){}
-
- void testSmallerBuffer();
- void testBiggerBuffer();
-
- };
-
-}}
-
-#endif /*_DECAF_IO_BUFFEREDINPUTSTREAMTEST_H_*/
diff --git a/src/decaf/src/test/decaf/io/BufferedOutputStreamTest.cpp b/src/decaf/src/test/decaf/io/BufferedOutputStreamTest.cpp
deleted file mode 100644
index 406ff30..0000000
--- a/src/decaf/src/test/decaf/io/BufferedOutputStreamTest.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BufferedOutputStreamTest.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::io;
-using namespace decaf::util;
-
-void BufferedOutputStreamTest::testSmallerBuffer(){
-
- MyOutputStream myStream;
- BufferedOutputStream bufStream( &myStream, (std::size_t)1 );
-
- const char* buffer = myStream.getBuffer();
-
- bufStream.write( (unsigned char)'T' );
- // Should not be written yet.
- CPPUNIT_ASSERT( strcmp( buffer, "" ) == 0 );
-
- bufStream.write( (unsigned char)'E' );
- // This time the T should have been written.
- CPPUNIT_ASSERT( strcmp( buffer, "T" ) == 0 );
-
- bufStream.write( (unsigned char*)"ST", 2 );
- // This time the ES should have been written.
- CPPUNIT_ASSERT( strcmp( buffer, "TES" ) == 0 );
-
- bufStream.flush();
- CPPUNIT_ASSERT( strcmp( buffer, "TEST" ) == 0 );
-}
-
-void BufferedOutputStreamTest::testBiggerBuffer(){
-
- MyOutputStream myStream;
- BufferedOutputStream bufStream( &myStream, (std::size_t)10 );
-
- const char* buffer = myStream.getBuffer();
-
- bufStream.write( (unsigned char*)"TEST", 4 );
-
- // Should not be written yet.
- CPPUNIT_ASSERT( strcmp( buffer, "" ) == 0 );
-
- bufStream.flush();
- CPPUNIT_ASSERT( strcmp( buffer, "TEST" ) == 0 );
-
- bufStream.write( (unsigned char*)"TEST", 4 );
- bufStream.write( (unsigned char*)"12345678910", 11);
-
- CPPUNIT_ASSERT( strcmp( buffer, "TESTTEST123456" ) == 0 );
-
- bufStream.flush();
- CPPUNIT_ASSERT( strcmp( buffer, "TESTTEST12345678910" ) == 0 );
-
-}
diff --git a/src/decaf/src/test/decaf/io/BufferedOutputStreamTest.h b/src/decaf/src/test/decaf/io/BufferedOutputStreamTest.h
deleted file mode 100644
index a4b5cfd..0000000
--- a/src/decaf/src/test/decaf/io/BufferedOutputStreamTest.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_BUFFEREDOUTPUTSTREAMTEST_H_
-#define _DECAF_IO_BUFFEREDOUTPUTSTREAMTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/io/BufferedOutputStream.h>
-#include <decaf/util/Config.h>
-#include <string.h>
-
-namespace decaf{
-namespace io{
-
- class BufferedOutputStreamTest : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE( BufferedOutputStreamTest );
- CPPUNIT_TEST( testSmallerBuffer );
- CPPUNIT_TEST( testBiggerBuffer );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- class MyOutputStream : public OutputStream{
- private:
- char buffer[100];
- std::size_t pos;
- public:
-
- MyOutputStream(){
- pos = 0;
- memset( buffer, 0, 100 );
- }
- virtual ~MyOutputStream(){}
-
- const char* getBuffer() const{ return buffer; }
-
- virtual void write( unsigned char c ) throw (IOException){
- if( pos >= 100 ){
- throw IOException();
- }
-
- buffer[pos++] = c;
- }
-
- virtual void write( const unsigned char* buffer, std::size_t len ) throw (IOException){
-
- if( (pos + len) > 100 ){
- throw IOException();
- }
-
- memcpy( this->buffer + pos, buffer, len );
-
- pos += len;
- }
-
- virtual void flush() throw (IOException){
- }
-
- virtual void close() throw(lang::Exception){
- // do nothing.
- }
-
- virtual void lock() throw(lang::Exception){
- }
- virtual void unlock() throw(lang::Exception){
- }
- virtual void wait() throw(lang::Exception){
- }
- virtual void wait(unsigned long millisecs DECAF_UNUSED) throw(lang::Exception){
- }
- virtual void notify() throw(lang::Exception){
- }
- virtual void notifyAll() throw(lang::Exception){
- }
- };
-
- public:
-
- virtual ~BufferedOutputStreamTest(){}
- virtual void setUp(){}
- virtual void tearDown(){}
-
- void testSmallerBuffer();
- void testBiggerBuffer();
-
- };
-
-}}
-
-#endif /*_DECAF_IO_BUFFEREDOUTPUTSTREAMTEST_H_*/
diff --git a/src/decaf/src/test/decaf/io/ByteArrayInputStreamTest.cpp b/src/decaf/src/test/decaf/io/ByteArrayInputStreamTest.cpp
deleted file mode 100644
index 51ef27e..0000000
--- a/src/decaf/src/test/decaf/io/ByteArrayInputStreamTest.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "ByteArrayInputStreamTest.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::io;
-using namespace decaf::util;
-
-void ByteArrayInputStreamTest::testStream()
-{
- std::vector<unsigned char> testBuffer;
-
- testBuffer.push_back('t');
- testBuffer.push_back('e');
- testBuffer.push_back('s');
- testBuffer.push_back('t');
-
- ByteArrayInputStream stream_a(&testBuffer[0], testBuffer.size());
-
- CPPUNIT_ASSERT( stream_a.available() == 4 );
-
- char a = stream_a.read();
- char b = stream_a.read();
- char c = stream_a.read();
- char d = stream_a.read();
-
- CPPUNIT_ASSERT( a == 't' && b == 'e' && c == 's' && d == 't' );
- CPPUNIT_ASSERT( stream_a.available() == 0 );
-
- testBuffer.push_back('e');
-
- stream_a.setByteArray(&testBuffer[0], testBuffer.size());
-
- CPPUNIT_ASSERT( stream_a.available() == 5 );
-
- unsigned char* buffer = new unsigned char[6];
-
- buffer[5] = '\0';
-
- CPPUNIT_ASSERT( stream_a.read(buffer, 5) == 5 );
- CPPUNIT_ASSERT( std::string((const char*)buffer) == std::string("teste") );
- CPPUNIT_ASSERT( stream_a.available() == 0 );
-
- stream_a.setByteArray(&testBuffer[0], testBuffer.size());
-
- memset(buffer, 0, 6);
-
- CPPUNIT_ASSERT( stream_a.read(buffer, 3) == 3 );
- CPPUNIT_ASSERT( stream_a.read(&buffer[3], 2) == 2 );
- CPPUNIT_ASSERT( std::string((const char*)buffer) == std::string("teste") );
-
- stream_a.close();
-
- delete [] buffer;
-}
diff --git a/src/decaf/src/test/decaf/io/ByteArrayInputStreamTest.h b/src/decaf/src/test/decaf/io/ByteArrayInputStreamTest.h
deleted file mode 100644
index 0a68cb0..0000000
--- a/src/decaf/src/test/decaf/io/ByteArrayInputStreamTest.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_BYTEARRAYINPUTSTREAMTEST_H_
-#define _DECAF_IO_BYTEARRAYINPUTSTREAMTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/io/ByteArrayInputStream.h>
-
-namespace decaf{
-namespace io{
-
- class ByteArrayInputStreamTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( ByteArrayInputStreamTest );
- CPPUNIT_TEST( testStream );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- ByteArrayInputStreamTest() {}
- virtual ~ByteArrayInputStreamTest() {}
-
- void testStream();
-
- };
-
-}}
-
-#endif /*_DECAF_IO_BYTEARRAYINPUTSTREAMTEST_H_*/
diff --git a/src/decaf/src/test/decaf/io/ByteArrayOutputStreamTest.cpp b/src/decaf/src/test/decaf/io/ByteArrayOutputStreamTest.cpp
deleted file mode 100644
index 6a843c1..0000000
--- a/src/decaf/src/test/decaf/io/ByteArrayOutputStreamTest.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "ByteArrayOutputStreamTest.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::io;
-using namespace decaf::util;
-
-void ByteArrayOutputStreamTest::testStream()
-{
- ByteArrayOutputStream stream_a;
-
- stream_a.write('a');
- stream_a.write(60);
- stream_a.write('c');
-
- CPPUNIT_ASSERT( stream_a.getByteArraySize() == 3 );
-
- stream_a.clear();
-
- CPPUNIT_ASSERT( stream_a.getByteArraySize() == 0 );
-
- stream_a.write((const unsigned char*)("abc"), 3);
-
- CPPUNIT_ASSERT( stream_a.getByteArraySize() == 3 );
-
- stream_a.clear();
-
- CPPUNIT_ASSERT( stream_a.getByteArraySize() == 0 );
-
- stream_a.write((const unsigned char*)("abc"), 3);
-
- unsigned char buffer[4];
-
- memset(buffer, 0, 4);
- memcpy(buffer, stream_a.getByteArray(), stream_a.getByteArraySize());
-
- CPPUNIT_ASSERT( std::string((const char*)buffer) == std::string("abc") );
-}
diff --git a/src/decaf/src/test/decaf/io/ByteArrayOutputStreamTest.h b/src/decaf/src/test/decaf/io/ByteArrayOutputStreamTest.h
deleted file mode 100644
index e467afa..0000000
--- a/src/decaf/src/test/decaf/io/ByteArrayOutputStreamTest.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_BYTEARRAYOUTPUTSTREAMTEST_H_
-#define _DECAF_IO_BYTEARRAYOUTPUTSTREAMTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/io/ByteArrayOutputStream.h>
-
-namespace decaf{
-namespace io{
-
- class ByteArrayOutputStreamTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( ByteArrayOutputStreamTest );
- CPPUNIT_TEST( testStream );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- ByteArrayOutputStreamTest() {}
- virtual ~ByteArrayOutputStreamTest() {}
-
- void testStream();
-
- };
-
-}}
-
-#endif /*_DECAF_IO_BYTEARRAYOUTPUTSTREAMTEST_H_*/
diff --git a/src/decaf/src/test/decaf/io/DataInputStreamTest.cpp b/src/decaf/src/test/decaf/io/DataInputStreamTest.cpp
deleted file mode 100644
index a5d61a3..0000000
--- a/src/decaf/src/test/decaf/io/DataInputStreamTest.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "DataInputStreamTest.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::io;
-using namespace decaf::util;
-
-void DataInputStreamTest::test(){
-
- unsigned char buffer[30];
- int ix = 0;
-
- unsigned char byteVal = (unsigned char)'T';
- unsigned short shortVal = 5;
- unsigned int intVal = 10000;
- unsigned long long longVal = 1000000000;
- float floatVal = 10.0f;
- double doubleVal = 100.0;
- unsigned char arrayVal[3] = {
- 'a', 'b', 'c'
- };
-
- int size = sizeof(char);
- memcpy( (char*)(buffer+ix), (char*)&byteVal, size );
- ix += size;
-
- size = sizeof(unsigned short);
- unsigned short tempShort = util::Endian::byteSwap(shortVal);
- memcpy( (char*)(buffer+ix), (char*)&tempShort, size );
- ix += size;
-
- size = sizeof(unsigned int);
- unsigned int tempInt = util::Endian::byteSwap(intVal);
- memcpy( (char*)(buffer+ix), (char*)&tempInt, size );
- ix += size;
-
- size = sizeof(unsigned long long);
- unsigned long long tempLong = util::Endian::byteSwap(longVal);
- memcpy( (char*)(buffer+ix), (char*)&tempLong, size );
- ix += size;
-
- size = sizeof(float);
- float tempFloat = util::Endian::byteSwap(floatVal);
- memcpy( (char*)(buffer+ix), (char*)&tempFloat, size );
- ix += size;
-
- size = sizeof(double);
- double tempDouble = util::Endian::byteSwap(doubleVal);
- memcpy( (char*)(buffer+ix), (char*)&tempDouble, size );
- ix += size;
-
- size = 3;
- memcpy( (char*)(buffer+ix), (char*)&arrayVal, size );
- ix += size;
-
- // Create the stream with the buffer we just wrote to.
- ByteArrayInputStream myStream( buffer, 30 );
- DataInputStream reader( &myStream );
-
- byteVal = reader.readByte();
- //std::cout << "Byte Value = " << byteVal << std::endl;
- CPPUNIT_ASSERT( byteVal == (unsigned char)'T' );
-
- shortVal = reader.readShort();
- //std::cout << "short Value = " << shortVal << std::endl;
- CPPUNIT_ASSERT( shortVal == 5 );
-
- intVal = reader.readInt();
- //std::cout << "int Value = " << intVal << std::endl;
- CPPUNIT_ASSERT( intVal == 10000 );
-
- longVal = reader.readLong();
- //std::cout << "long long Value = " << longVal << std::endl;
- CPPUNIT_ASSERT( longVal == 1000000000 );
-
- floatVal = reader.readFloat();
- //std::cout << "float Value = " << floatVal << std::endl;
- CPPUNIT_ASSERT( floatVal == 10.0f );
-
- doubleVal = reader.readDouble();
- //std::cout << "double Value = " << doubleVal << std::endl;
- CPPUNIT_ASSERT( doubleVal == 100.0 );
-
- reader.read( arrayVal, 0, 3 );
- //std::cout << "char[0] Value = " << (int)arrayVal[0] << std::endl;
- CPPUNIT_ASSERT( arrayVal[0] == 'a' );
- //std::cout << "char[1] Value = " << (int)arrayVal[1] << std::endl;
- CPPUNIT_ASSERT( arrayVal[1] == 'b' );
- //std::cout << "char[2] Value = " << (int)arrayVal[2] << std::endl;
- CPPUNIT_ASSERT( arrayVal[2] == 'c' );
-}
-
-void DataInputStreamTest::testString() {
-
- std::string data1 = "This is a Test";
- std::string data2 = "of the readString method";
- std::string data3 = "This one should fail";
-
- std::vector<unsigned char> buffer;
-
- buffer.insert( buffer.begin(), data1.begin(), data1.end() );
- buffer.push_back( '\0' );
- buffer.insert( buffer.end(), data2.begin(), data2.end() );
- buffer.push_back( '\0' );
- buffer.insert( buffer.end(), data3.begin(), data3.end() );
-
- // Create the stream with the buffer we just wrote to.
- ByteArrayInputStream myStream( buffer );
- DataInputStream reader( &myStream );
-
- std::string result1 = reader.readString();
- std::string result2 = reader.readString();
-
- CPPUNIT_ASSERT( result1 == data1 );
- CPPUNIT_ASSERT( result2 == data2 );
-
- try{
- std::string result3 = reader.readString();
- CPPUNIT_ASSERT( false );
- } catch(...){
- CPPUNIT_ASSERT( true );
- }
-
- try{
- std::vector<unsigned char> buffer2;
- reader.readFully( buffer2 );
- } catch(...){
- CPPUNIT_ASSERT( false );
- }
-}
-
-void DataInputStreamTest::testUTF() {
-
- std::string data1 = "This is a Test";
- std::string data2 = "of the readString method";
- std::string data3 = "This one should fail";
-
- char sizeData[sizeof(short)] = {0};
- short tempShort = 0;
-
- std::vector<unsigned char> buffer;
-
- tempShort = util::Endian::byteSwap( ((unsigned short)data1.size()) );
- memcpy( sizeData, (char*)&tempShort, sizeof( short ) );
- buffer.insert( buffer.end(), sizeData, sizeData + sizeof(short) );
- buffer.insert( buffer.end(), data1.begin(), data1.end() );
-
- tempShort = util::Endian::byteSwap( ((unsigned short)data2.size()) );
- memcpy( sizeData, (char*)&tempShort, sizeof( short ) );
- buffer.insert( buffer.end(), sizeData, sizeData + sizeof(short) );
- buffer.insert( buffer.end(), data2.begin(), data2.end() );
-
- tempShort = util::Endian::byteSwap( (unsigned short)(data3.size() + 10 ) );
- memcpy( sizeData, (char*)&tempShort, sizeof( short ) );
- buffer.insert( buffer.end(), sizeData, sizeData + sizeof(short) );
- buffer.insert( buffer.end(), data3.begin(), data3.end() );
-
- // Create the stream with the buffer we just wrote to.
- ByteArrayInputStream myStream( buffer );
- DataInputStream reader( &myStream );
-
- std::string result1 = reader.readUTF();
- std::string result2 = reader.readUTF();
-
- CPPUNIT_ASSERT( result1 == data1 );
- CPPUNIT_ASSERT( result2 == data2 );
-
- try{
- std::string result3 = reader.readUTF();
- CPPUNIT_ASSERT( false );
- } catch(...){
- CPPUNIT_ASSERT( true );
- }
-}
diff --git a/src/decaf/src/test/decaf/io/DataInputStreamTest.h b/src/decaf/src/test/decaf/io/DataInputStreamTest.h
deleted file mode 100644
index 07f3411..0000000
--- a/src/decaf/src/test/decaf/io/DataInputStreamTest.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_DATAINPUTSTREAMTEST_H_
-#define _DECAF_IO_DATAINPUTSTREAMTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/util/Endian.h>
-#include <decaf/lang/Exception.h>
-#include <decaf/io/BufferedInputStream.h>
-#include <decaf/io/ByteArrayInputStream.h>
-#include <decaf/io/DataInputStream.h>
-
-#ifdef min
-#undef min
-#endif
-
-#include <algorithm>
-
-namespace decaf{
-namespace io{
-
- class DataInputStreamTest : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE( DataInputStreamTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST( testString );
- CPPUNIT_TEST( testUTF );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- virtual ~DataInputStreamTest(){}
- virtual void setUp(){}
- virtual void tearDown(){}
-
- void test();
- void testString();
- void testUTF();
-
- };
-
-}}
-
-#endif /*_DECAF_IO_DATAINPUTSTREAMTEST_H_*/
diff --git a/src/decaf/src/test/decaf/io/DataOutputStreamTest.cpp b/src/decaf/src/test/decaf/io/DataOutputStreamTest.cpp
deleted file mode 100644
index da6b7e2..0000000
--- a/src/decaf/src/test/decaf/io/DataOutputStreamTest.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "DataOutputStreamTest.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::io;
-using namespace decaf::util;
-
-void DataOutputStreamTest::test(){
-
- unsigned char byteVal = (unsigned char)'T';
- unsigned short shortVal = 5;
- unsigned int intVal = 10000;
- unsigned long long longVal = 1000000000;
- float floatVal = 10.0f;
- double doubleVal = 100.0;
- unsigned char arrayVal[3] = {
- 'a', 'b', 'c'
- };
-
- // Create the stream with the buffer we just wrote to.
- ByteArrayOutputStream myStream;
- DataOutputStream writer( &myStream );
-
- writer.writeByte( byteVal );
- writer.writeShort( shortVal );
- writer.writeInt( intVal );
- writer.writeLong( longVal );
- writer.writeFloat( floatVal );
- writer.writeDouble( doubleVal );
- writer.write( arrayVal, 3 );
-
- const unsigned char* buffer = myStream.getByteArray();
- int ix = 0;
-
- unsigned char tempByte = buffer[ix];
- CPPUNIT_ASSERT( tempByte == byteVal );
- ix += sizeof( tempByte );
-
- unsigned short tempShort = 0;
- memcpy( &tempShort, buffer+ix, sizeof( unsigned short ) );
- tempShort = util::Endian::byteSwap( tempShort );
- CPPUNIT_ASSERT( tempShort == shortVal );
- ix += sizeof( tempShort );
-
- unsigned int tempInt = 0;
- memcpy( &tempInt, buffer+ix, sizeof( unsigned int ) );
- tempInt = util::Endian::byteSwap( tempInt );
- CPPUNIT_ASSERT( tempInt == intVal );
- ix += sizeof( tempInt );
-
- unsigned long long tempLong = 0;
- memcpy( &tempLong, buffer+ix, sizeof( unsigned long long ) );
- tempLong = util::Endian::byteSwap( tempLong );
- CPPUNIT_ASSERT( tempLong == longVal );
- ix += sizeof( tempLong );
-
- float tempFloat = 0;
- memcpy( &tempFloat, buffer+ix, sizeof( float ) );
- tempFloat = util::Endian::byteSwap( tempFloat );
- CPPUNIT_ASSERT( tempFloat == floatVal );
- ix += sizeof( tempFloat );
-
- double tempDouble = 0;
- memcpy( &tempDouble, buffer+ix, sizeof( double ) );
- tempDouble = util::Endian::byteSwap( tempDouble );
- CPPUNIT_ASSERT( tempDouble == doubleVal );
- ix += sizeof( tempDouble );
-}
diff --git a/src/decaf/src/test/decaf/io/DataOutputStreamTest.h b/src/decaf/src/test/decaf/io/DataOutputStreamTest.h
deleted file mode 100644
index a31f573..0000000
--- a/src/decaf/src/test/decaf/io/DataOutputStreamTest.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_IO_DATAOUTPUTSTREAMTEST_H_
-#define _DECAF_IO_DATAOUTPUTSTREAMTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/util/Endian.h>
-#include <decaf/io/DataOutputStream.h>
-#include <decaf/io/ByteArrayOutputStream.h>
-
-namespace decaf{
-namespace io{
-
- class DataOutputStreamTest : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE( DataOutputStreamTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- virtual ~DataOutputStreamTest(){}
- virtual void setUp(){}
- virtual void tearDown(){}
-
- void test();
-
- };
-
-}}
-
-#endif /*_DECAF_IO_DATAOUTPUTSTREAMTEST_H_*/
diff --git a/src/decaf/src/test/decaf/lang/BooleanTest.cpp b/src/decaf/src/test/decaf/lang/BooleanTest.cpp
deleted file mode 100644
index 679552f..0000000
--- a/src/decaf/src/test/decaf/lang/BooleanTest.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BooleanTest.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-
-void BooleanTest::test(void)
-{
- bool x = Boolean::parseBoolean("false");
- bool y = Boolean::parseBoolean("true");
- bool z = Boolean::parseBoolean("false");
-
- CPPUNIT_ASSERT( x == false );
- CPPUNIT_ASSERT( y == true );
- CPPUNIT_ASSERT( z == false );
-
- std::string x1 = Boolean::toString( x );
- std::string y1 = Boolean::toString( y );
- std::string z1 = Boolean::toString( z );
-
- CPPUNIT_ASSERT( x1 == "false" );
- CPPUNIT_ASSERT( y1 == "true" );
- CPPUNIT_ASSERT( z1 == "false" );
-
- Boolean b( true );
- CPPUNIT_ASSERT( b.booleanValue() == true );
-
-}
diff --git a/src/decaf/src/test/decaf/lang/BooleanTest.h b/src/decaf/src/test/decaf/lang/BooleanTest.h
deleted file mode 100644
index fd9050e..0000000
--- a/src/decaf/src/test/decaf/lang/BooleanTest.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_BOOLEANTEST_H_
-#define _DECAF_LANG_BOOLEANTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/lang/Boolean.h>
-
-namespace decaf{
-namespace lang{
-
- class BooleanTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( BooleanTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- BooleanTest() {}
- virtual ~BooleanTest() {}
-
- virtual void test(void);
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_BOOLEANTEST_H_*/
diff --git a/src/decaf/src/test/decaf/lang/ByteTest.cpp b/src/decaf/src/test/decaf/lang/ByteTest.cpp
deleted file mode 100644
index 8be8dc5..0000000
--- a/src/decaf/src/test/decaf/lang/ByteTest.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "ByteTest.h"
-
-using namespace decaf;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-ByteTest::ByteTest(){
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ByteTest::test() {
-
- Byte ubyte( 'b' );
-
- CPPUNIT_ASSERT( ubyte < 'a' == false );
- CPPUNIT_ASSERT( ubyte.compareTo( 'a' ) == 1 );
- CPPUNIT_ASSERT( ubyte.compareTo( 'b' ) == 0 );
- CPPUNIT_ASSERT( ubyte.compareTo( 'c' ) == -1 );
-
- CPPUNIT_ASSERT( ubyte.parseByte( "60" ) == 60 );
- CPPUNIT_ASSERT( ubyte.parseByte( "ff", 16 ) == 255 );
-
- CPPUNIT_ASSERT( ubyte.toString( 60 ) == "60" );
- CPPUNIT_ASSERT( ubyte.toString( 255 ) == "255" );
-
- CPPUNIT_ASSERT( ubyte.decode( "0xFF" ) == 255 );
- CPPUNIT_ASSERT( ubyte.decode( "255" ) == 255 );
-
-}
diff --git a/src/decaf/src/test/decaf/lang/ByteTest.h b/src/decaf/src/test/decaf/lang/ByteTest.h
deleted file mode 100644
index 5e62c59..0000000
--- a/src/decaf/src/test/decaf/lang/ByteTest.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_BYTETEST_H_
-#define _DECAF_LANG_BYTETEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/lang/Byte.h>
-
-namespace decaf{
-namespace lang{
-
- class ByteTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( ByteTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- ByteTest();
- virtual ~ByteTest() {}
-
- virtual void test();
- };
-
-}}
-
-#endif /*_DECAF_LANG_BYTETEST_H_*/
diff --git a/src/decaf/src/test/decaf/lang/CharacterTest.cpp b/src/decaf/src/test/decaf/lang/CharacterTest.cpp
deleted file mode 100644
index 63e50e4..0000000
--- a/src/decaf/src/test/decaf/lang/CharacterTest.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "CharacterTest.h"
-
-using namespace decaf;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-CharacterTest::CharacterTest() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void CharacterTest::test() {
-
- Character character( 'b' );
-
- CPPUNIT_ASSERT( character < 'a' == false );
- CPPUNIT_ASSERT( character.compareTo( 'a' ) == 1 );
- CPPUNIT_ASSERT( character.compareTo( 'b' ) == 0 );
- CPPUNIT_ASSERT( character.compareTo( 'c' ) == -1 );
-
- CPPUNIT_ASSERT( Character::isDigit('a') == false );
- CPPUNIT_ASSERT( Character::isDigit('7') == true );
- CPPUNIT_ASSERT( Character::isLowerCase('a') == true );
- CPPUNIT_ASSERT( Character::isLowerCase('A') == false );
- CPPUNIT_ASSERT( Character::isUpperCase('a') == false );
- CPPUNIT_ASSERT( Character::isUpperCase('A') == true );
- CPPUNIT_ASSERT( Character::isLetter('a') == true );
- CPPUNIT_ASSERT( Character::isLetter('8') == false );
- CPPUNIT_ASSERT( Character::isLetterOrDigit('a') == true );
- CPPUNIT_ASSERT( Character::isLetterOrDigit('&') == false );
- CPPUNIT_ASSERT( Character::digit( '9', 10 ) == 9 );
-
-}
-
diff --git a/src/decaf/src/test/decaf/lang/CharacterTest.h b/src/decaf/src/test/decaf/lang/CharacterTest.h
deleted file mode 100644
index 1624208..0000000
--- a/src/decaf/src/test/decaf/lang/CharacterTest.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_CHARACTERTEST_H_
-#define _DECAF_LANG_CHARACTERTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/lang/Character.h>
-
-namespace decaf{
-namespace lang{
-
- class CharacterTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( CharacterTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- CharacterTest();
- virtual ~CharacterTest() {}
-
- virtual void test();
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_CHARACTERTEST_H_*/
diff --git a/src/decaf/src/test/decaf/lang/DoubleTest.cpp b/src/decaf/src/test/decaf/lang/DoubleTest.cpp
deleted file mode 100644
index 823f756..0000000
--- a/src/decaf/src/test/decaf/lang/DoubleTest.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "DoubleTest.h"
-
-#include <decaf/lang/Double.h>
-#include <string>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-DoubleTest::DoubleTest() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DoubleTest::test() {
-}
diff --git a/src/decaf/src/test/decaf/lang/DoubleTest.h b/src/decaf/src/test/decaf/lang/DoubleTest.h
deleted file mode 100644
index c8af6df..0000000
--- a/src/decaf/src/test/decaf/lang/DoubleTest.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_DOUBLETEST_H_
-#define _DECAF_LANG_DOUBLETEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-namespace decaf{
-namespace lang{
-
- class DoubleTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( DoubleTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- DoubleTest();
- virtual ~DoubleTest() {}
-
- virtual void test();
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_DOUBLETEST_H_*/
diff --git a/src/decaf/src/test/decaf/lang/ExceptionTest.cpp b/src/decaf/src/test/decaf/lang/ExceptionTest.cpp
deleted file mode 100644
index 96e5113..0000000
--- a/src/decaf/src/test/decaf/lang/ExceptionTest.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "ExceptionTest.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-void ExceptionTest::testMessage0(){
- char* text = "This is a test";
- Exception ex( __FILE__, __LINE__, text );
- CPPUNIT_ASSERT( strcmp( ex.getMessage().c_str(), text ) == 0 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ExceptionTest::testMessage3(){
- Exception ex( __FILE__, __LINE__,
- "This is a test %d %d %d", 1, 100, 1000 );
- CPPUNIT_ASSERT( strcmp( ex.getMessage().c_str(),
- "This is a test 1 100 1000" ) == 0 );
-}
diff --git a/src/decaf/src/test/decaf/lang/ExceptionTest.h b/src/decaf/src/test/decaf/lang/ExceptionTest.h
deleted file mode 100644
index b21bc24..0000000
--- a/src/decaf/src/test/decaf/lang/ExceptionTest.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_EXCEPTIONTEST_H_
-#define _DECAF_LANG_EXCEPTIONTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/lang/Exception.h>
-#include <string.h>
-
-namespace decaf{
-namespace lang{
-
- class ExceptionTest : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE( ExceptionTest );
- CPPUNIT_TEST( testMessage0 );
- CPPUNIT_TEST( testMessage3 );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- virtual ~ExceptionTest(){}
-
- virtual void setUp(){}
- virtual void tearDown(){}
-
- void testMessage0();
- void testMessage3();
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_EXCEPTIONTEST_H_*/
diff --git a/src/decaf/src/test/decaf/lang/FloatTest.cpp b/src/decaf/src/test/decaf/lang/FloatTest.cpp
deleted file mode 100644
index f28133b..0000000
--- a/src/decaf/src/test/decaf/lang/FloatTest.cpp
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "FloatTest.h"
-
-#include <decaf/lang/Float.h>
-#include <decaf/lang/Integer.h>
-#include <decaf/lang/Long.h>
-#include <decaf/lang/Math.h>
-#include <string>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-const int FloatTest::rawBitsFor3_4eN38To38[] = {
- 0x1394470, 0x2e7958c, 0x490bd77, 0x634ecd5,
- 0x7e2280b, 0x98d5907, 0xb30af48, 0xcdcdb1a, 0xe8a08f0, 0x102c8b2d, 0x11d7adf8,
- 0x1386ccbb, 0x15287fe9, 0x16d29fe4, 0x1883a3ee, 0x1a248cea, 0x1bcdb025, 0x1d808e17,
- 0x1f20b19d, 0x20c8de04, 0x227b1585, 0x241ced73, 0x25c428d0, 0x27753303, 0x29193fe2,
- 0x2abf8fdb, 0x2c6f73d1, 0x2e15a863, 0x2fbb127c, 0x3169d71a, 0x33122671, 0x34b6b00d,
- 0x36645c10, 0x380eb98a, 0x39b267ec, 0x3b5f01e8, 0x3d0b6131, 0x3eae397d, 0x4059c7dc,
- 0x42081cea, 0x43aa2424, 0x4554ad2d, 0x4704ec3c, 0x48a6274b, 0x4a4fb11e, 0x4c01ceb3,
- 0x4da2425f, 0x4f4ad2f7, 0x50fd87b5, 0x529e74d1, 0x54461205, 0x55f79687, 0x579abe14,
- 0x59416d99, 0x5af1c900, 0x5c971da0, 0x5e3ce508, 0x5fec1e4a, 0x619392ee, 0x633877a9,
- 0x64e69594, 0x66901d7c, 0x683424dc, 0x69e12e12, 0x6b8cbccb, 0x6d2febfe, 0x6edbe6fe,
- 0x7089705f, 0x722bcc76, 0x73d6bf94, 0x758637bc, 0x7727c5ac, 0x78d1b717, 0x7a83126e,
- 0x7c23d70a, 0x7dcccccc, 0x7f7fffff };
-
-////////////////////////////////////////////////////////////////////////////////
-const std::string FloatTest::expectedStringFor3_4eN38To38[] = {
- "3.4028235E-38", "3.4028235E-37",
- "3.4028233E-36", "3.4028234E-35", "3.4028236E-34", "3.4028236E-33",
- "3.4028234E-32", "3.4028234E-31", "3.4028233E-30", "3.4028236E-29",
- "3.4028235E-28", "3.4028235E-27", "3.4028233E-26", "3.4028235E-25",
- "3.4028233E-24", "3.4028235E-23", "3.4028236E-22", "3.4028235E-21",
- "3.4028236E-20", "3.4028236E-19", "3.4028236E-18", "3.4028235E-17",
- "3.4028236E-16", "3.4028234E-15", "3.4028234E-14", "3.4028235E-13",
- "3.4028234E-12", "3.4028235E-11", "3.4028236E-10", "3.4028234E-9", "3.4028236E-8",
- "3.4028236E-7", "3.4028235E-6", "3.4028235E-5", "3.4028233E-4", "0.0034028236",
- "0.034028236", "0.34028235", "3.4028234", "34.028236", "340.28235", "3402.8235",
- "34028.234", "340282.34", "3402823.5", "3.4028236E7", "3.40282336E8",
- "3.40282342E9", "3.40282348E10", "3.40282343E11", "3.40282337E12", "3.40282353E13",
- "3.4028234E14", "3.4028234E15", "3.40282356E16", "3.40282356E17", "3.40282356E18",
- "3.4028236E19", "3.4028235E20", "3.4028233E21", "3.4028235E22", "3.4028233E23",
- "3.4028236E24", "3.4028234E25", "3.4028233E26", "3.4028234E27", "3.4028235E28",
- "3.4028236E29", "3.4028233E30", "3.4028235E31", "3.4028233E32", "3.4028236E33",
- "3.4028236E34", "3.4028234E35", "3.4028236E36", "3.4028235E37", "3.4028235E38" };
-
-////////////////////////////////////////////////////////////////////////////////
-const int FloatTest::rawBitsFor1_17eN38To38[] = {
- 0x80800000, 0x82200000, 0x83c80000,
- 0x857a0000, 0x871c4000, 0x88c35000, 0x8a742400, 0x8c189680, 0x8dbebc20, 0x8f6e6b28,
- 0x911502f9, 0x92ba43b7, 0x9468d4a5, 0x961184e7, 0x97b5e621, 0x99635fa9, 0x9b0e1bca,
- 0x9cb1a2bc, 0x9e5e0b6b, 0xa00ac723, 0xa1ad78ec, 0xa358d727, 0xa5078678, 0xa6a96816,
- 0xa853c21c, 0xaa045951, 0xaba56fa6, 0xad4ecb8f, 0xaf013f39, 0xb0a18f08, 0xb249f2ca,
- 0xb3fc6f7c, 0xb59dc5ae, 0xb7453719, 0xb8f684df, 0xba9a130c, 0xbc4097ce, 0xbdf0bdc2,
- 0xbf967699, 0xc13c1440, 0xc2eb1950, 0xc492efd2, 0xc637abc6, 0xc7e596b8, 0xc98f7e33,
- 0xcb335dc0, 0xcce0352f, 0xce8c213e, 0xd02f298d, 0xd1daf3f0, 0xd388d876, 0xd52b0e94,
- 0xd6d5d239, 0xd885a363, 0xda270c3c, 0xdbd0cf4b, 0xdd82818f, 0xdf2321f3, 0xe0cbea70,
- 0xe27ee50b, 0xe41f4f27, 0xe5c722f1, 0xe778ebad, 0xe91b934c, 0xeac2781f, 0xec731627,
- 0xee17edd8, 0xefbde94f, 0xf16d63a2, 0xf3145e45, 0xf4b975d7, 0xf667d34c, 0xf810e410,
- 0xf9b51d14, 0xfb626459, 0xfd0d7eb7, 0xfeb0de65 };
-
-////////////////////////////////////////////////////////////////////////////////
-const std::string FloatTest::expectedStringFor1_17eN38To38[] = {
- "-1.17549435E-38",
- "-1.1754944E-37", "-1.17549435E-36", "-1.17549435E-35", "-1.1754944E-34",
- "-1.17549435E-33", "-1.17549435E-32", "-1.1754944E-31", "-1.17549435E-30",
- "-1.17549435E-29", "-1.1754944E-28", "-1.1754943E-27", "-1.17549435E-26",
- "-1.1754943E-25", "-1.1754944E-24", "-1.1754943E-23", "-1.1754944E-22",
- "-1.1754943E-21", "-1.1754943E-20", "-1.1754943E-19", "-1.1754944E-18",
- "-1.1754944E-17", "-1.1754943E-16", "-1.1754943E-15", "-1.1754944E-14",
- "-1.1754943E-13", "-1.1754944E-12", "-1.1754943E-11", "-1.1754943E-10",
- "-1.1754944E-9", "-1.1754944E-8", "-1.1754943E-7", "-1.1754944E-6",
- "-1.1754943E-5", "-1.1754943E-4", "-0.0011754944", "-0.011754943", "-0.117549434",
- "-1.1754943", "-11.754944", "-117.54944", "-1175.4944", "-11754.943", "-117549.44",
- "-1175494.4", "-1.1754944E7", "-1.17549432E8", "-1.1754944E9", "-1.17549435E10",
- "-1.17549433E11", "-1.17549433E12", "-1.17549438E13", "-1.17549438E14",
- "-1.1754943E15", "-1.17549432E16", "-1.17549432E17", "-1.17549434E18",
- "-1.1754944E19", "-1.1754944E20", "-1.1754943E21", "-1.1754943E22",
- "-1.1754944E23", "-1.17549434E24", "-1.1754943E25", "-1.1754943E26",
- "-1.17549434E27", "-1.1754943E28", "-1.1754944E29", "-1.1754943E30",
- "-1.1754943E31", "-1.1754944E32", "-1.1754943E33", "-1.1754944E34",
- "-1.1754944E35", "-1.1754944E36", "-1.1754943E37", "-1.1754943E38" };
-
-////////////////////////////////////////////////////////////////////////////////
-FloatTest::FloatTest() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void FloatTest::doTestCompareRawBits( const std::string& originalFloatString,
- int expectedRawBits,
- const std::string& expectedString ) {
-
- int rawBits;
- float result = Float::parseFloat( originalFloatString );
- rawBits = Float::floatToIntBits( result );
- CPPUNIT_ASSERT_MESSAGE(
- std::string( "Original float(" ) + originalFloatString +
- ") Converted float(" + Float::toString( result ) +
- ") Expecting:" + Integer::toHexString( expectedRawBits ) +
- " Got: " + Integer::toHexString( rawBits ),
- expectedRawBits == rawBits );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void FloatTest::test_ConstructorF() {
- // Test for method decaf.lang.Float(float)
- Float f( 900.89f );
- CPPUNIT_ASSERT_MESSAGE( "Created incorrect float", f.floatValue() == 900.89f );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void FloatTest::test_ConstructorString() {
- // Test for method decaf.lang.Float(decaf.lang.String)
- Float f( "900.89" );
- CPPUNIT_ASSERT_MESSAGE("Created incorrect Float", f.floatValue() == 900.89f);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void FloatTest::test_byteValue() {
- // Test for method byte decaf.lang.Float::byteValue()
- Float f( 0.46874f );
- Float f2( 90.8f );
-
- CPPUNIT_ASSERT_MESSAGE( "Returned incorrect byte value",
- f.byteValue() == 0 && f2.byteValue() == 90 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void FloatTest::test_compare() {
-
- float values[] = { Float::NEGATIVE_INFINITY,
- -Float::MAX_VALUE,
- -2.0f,
- -Float::MIN_VALUE,
- -0.0f, 0.0f,
- Float::MIN_VALUE,
- 2.0f,
- Float::MAX_VALUE,
- Float::POSITIVE_INFINITY,
- Float::NaN };
-
- for( std::size_t i = 0; i < sizeof(values) / sizeof(float); i++ ) {
-
- float f1 = values[i];
- CPPUNIT_ASSERT_MESSAGE( "compare() should be equal:",
- Float::compare( f1, f1 ) == 0 );
- Float F1( f1 );
- CPPUNIT_ASSERT_MESSAGE( "compareTo() should be equal: ",
- F1.compareTo( F1 ) == 0);
-
- for( std::size_t j = i + 1; j < sizeof(values) / sizeof(float); j++ ) {
- float f2 = values[j];
- CPPUNIT_ASSERT_MESSAGE( "compare() should be less ",
- Float::compare(f1, f2) == -1 );
- CPPUNIT_ASSERT_MESSAGE( "compare() should be greater ",
- Float::compare(f2, f1) == 1 );
- Float F2(f2);
- CPPUNIT_ASSERT_MESSAGE( "compareTo() should be less ",
- F1.compareTo(F2) == -1 );
- CPPUNIT_ASSERT_MESSAGE( "compareTo() should be greater ",
- F2.compareTo(F1) == 1 );
- }
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void FloatTest::test_doubleValue() {
- // Test for method double decaf.lang.Float::doubleValue()
- CPPUNIT_ASSERT_MESSAGE(
- "Incorrect double value returned",
- Math::abs( Float( 999999.999f ).doubleValue() - 999999.999 ) < 1 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void FloatTest::test_floatToIntBitsF() {
- float f = 9876.2345f;
- int bits = Float::floatToIntBits( f );
- float r = Float::intBitsToFloat( bits );
- CPPUNIT_ASSERT_MESSAGE("Incorrect intBits returned", f == r);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void FloatTest::test_floatToRawIntBitsF() {
- int i = 0x7fc004d2;
- float f = Float::intBitsToFloat( i );
- CPPUNIT_ASSERT_MESSAGE( "Wrong raw bits", Float::floatToRawIntBits(f) == i );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void FloatTest::test_floatValue() {
- // Test for method float decaf.lang.Float::floatValue()
- Float f( 87.657f );
- Float f2( -0.876f );
- CPPUNIT_ASSERT_MESSAGE( "Returned incorrect floatValue",
- f.floatValue() == 87.657f &&
- ( f2.floatValue() == -0.876f ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void FloatTest::test_intBitsToFloatI() {
- float f = 9876.2345f;
- int bits = Float::floatToIntBits(f);
- float r = Float::intBitsToFloat(bits);
- CPPUNIT_ASSERT_MESSAGE("Incorrect intBits returned", f == r );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void FloatTest::test_intValue() {
- // Test for method int decaf.lang.Float::intValue()
- Float f( 0.46874f );
- Float f2( 90.8f );
- CPPUNIT_ASSERT_MESSAGE( "Returned incorrect int value",
- f.intValue() == 0 && f2.intValue() == 90 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void FloatTest::test_isInfinite() {
- // Test for method boolean decaf.lang.Float::isInfinite()
- CPPUNIT_ASSERT_MESSAGE("Infinity check failed",
- Float( Float::POSITIVE_INFINITY ).isInfinite() &&
- Float( Float::NEGATIVE_INFINITY ).isInfinite() &&
- !(Float( 0.13131414f ).isInfinite() ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void FloatTest::test_isInfiniteF() {
- // Test for method boolean decaf.lang.Float::isInfinite(float)
-
- CPPUNIT_ASSERT_MESSAGE( "Infinity check failed",
- Float::isInfinite( Float::POSITIVE_INFINITY ) &&
- (Float::isInfinite( Float::NEGATIVE_INFINITY) ) &&
- !( Float::isInfinite( 1.0f ) ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void FloatTest::test_isNaN() {
- // Test for method boolean decaf.lang.Float::isNaN()
- CPPUNIT_ASSERT_MESSAGE( "NAN check failed",
- Float( Float::NaN ).isNaN() && !( Float( 1.0f ).isNaN() ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void FloatTest::test_isNaNF() {
- // Test for method boolean decaf.lang.Float::isNaN(float)
- CPPUNIT_ASSERT_MESSAGE( "NaN check failed",
- Float::isNaN( Float::NaN ) && !( Float::isNaN( 12.09f ) ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void FloatTest::test_longValue() {
- // Test for method long decaf.lang.Float::longValue()
- Float f( 0.46874f );
- Float f2( 90.8f );
- CPPUNIT_ASSERT_MESSAGE( "Returned incorrect long value",
- f.longValue() == 0 && f2.longValue() == 90 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void FloatTest::test_parseFloatLDecaf_lang_String() {
-
- CPPUNIT_ASSERT_MESSAGE( "Incorrect float returned, expected zero.",
- 0.0 == Float::parseFloat("7.0064923216240853546186479164495e-46"));
- CPPUNIT_ASSERT_MESSAGE("Incorrect float returned, expected minimum float.",
- Float::MIN_VALUE ==
- Float::parseFloat("7.0064923216240853546186479164496e-46") );
-
-// doTestCompareRawBits(
-// "0.000000000000000000000000000000000000011754942807573642917278829910357665133228589927589904276829631184250030649651730385585324256680905818939208984375",
-// 0x800000, "1.17549435E-38");
-// doTestCompareRawBits(
-// "0.00000000000000000000000000000000000001175494280757364291727882991035766513322858992758990427682963118425003064965173038558532425668090581893920898437499999f",
-// 0x7fffff, "1.1754942E-38");
-//
-// /* Test a set of regular floats with exponents from -38 to +38 */
-// for (int i = 38; i > 3; i--) {
-// std::string testString;
-// testString = "3.4028234663852886e-" + i;
-// doTestCompareRawBits(testString, rawBitsFor3_4eN38To38[38 - i],
-// expectedStringFor3_4eN38To38[38 - i]);
-// }
-// doTestCompareRawBits("3.4028234663852886e-3", rawBitsFor3_4eN38To38[38 - 3],
-// expectedStringFor3_4eN38To38[38 - 3]);
-// doTestCompareRawBits("3.4028234663852886e-2", rawBitsFor3_4eN38To38[38 - 2],
-// expectedStringFor3_4eN38To38[38 - 2]);
-// doTestCompareRawBits("3.4028234663852886e-1", rawBitsFor3_4eN38To38[38 - 1],
-// expectedStringFor3_4eN38To38[38 - 1]);
-// doTestCompareRawBits("3.4028234663852886e-0", rawBitsFor3_4eN38To38[38 - 0],
-// expectedStringFor3_4eN38To38[38 - 0]);
-// doTestCompareRawBits("3.4028234663852886e+1", rawBitsFor3_4eN38To38[38 + 1],
-// expectedStringFor3_4eN38To38[38 + 1]);
-// doTestCompareRawBits("3.4028234663852886e+2", rawBitsFor3_4eN38To38[38 + 2],
-// expectedStringFor3_4eN38To38[38 + 2]);
-// doTestCompareRawBits("3.4028234663852886e+3", rawBitsFor3_4eN38To38[38 + 3],
-// expectedStringFor3_4eN38To38[38 + 3]);
-// doTestCompareRawBits("3.4028234663852886e+4", rawBitsFor3_4eN38To38[38 + 4],
-// expectedStringFor3_4eN38To38[38 + 4]);
-// doTestCompareRawBits("3.4028234663852886e+5", rawBitsFor3_4eN38To38[38 + 5],
-// expectedStringFor3_4eN38To38[38 + 5]);
-// doTestCompareRawBits("3.4028234663852886e+6", rawBitsFor3_4eN38To38[38 + 6],
-// expectedStringFor3_4eN38To38[38 + 6]);
-//
-// for (int i = 7; i < 39; i++) {
-// std::string testString;
-// testString = "3.4028234663852886e+" + i;
-// doTestCompareRawBits(testString, rawBitsFor3_4eN38To38[38 + i],
-// expectedStringFor3_4eN38To38[38 + i]);
-// }
-//
-// /* Test another set of regular floats with exponents from -38 to +38 */
-// for (int i = 38; i > 3; i--) {
-// std::string testString;
-// testString = "-1.1754943508222875e-" + i;
-// doTestCompareRawBits(testString, rawBitsFor1_17eN38To38[38 - i],
-// expectedStringFor1_17eN38To38[38 - i]);
-// }
-// doTestCompareRawBits("-1.1754943508222875e-3", rawBitsFor1_17eN38To38[38 - 3],
-// expectedStringFor1_17eN38To38[38 - 3]);
-// doTestCompareRawBits("-1.1754943508222875e-2", rawBitsFor1_17eN38To38[38 - 2],
-// expectedStringFor1_17eN38To38[38 - 2]);
-// doTestCompareRawBits("-1.1754943508222875e-1", rawBitsFor1_17eN38To38[38 - 1],
-// expectedStringFor1_17eN38To38[38 - 1]);
-// doTestCompareRawBits("-1.1754943508222875e-0", rawBitsFor1_17eN38To38[38 - 0],
-// expectedStringFor1_17eN38To38[38 - 0]);
-// doTestCompareRawBits("-1.1754943508222875e+1", rawBitsFor1_17eN38To38[38 + 1],
-// expectedStringFor1_17eN38To38[38 + 1]);
-// doTestCompareRawBits("-1.1754943508222875e+2", rawBitsFor1_17eN38To38[38 + 2],
-// expectedStringFor1_17eN38To38[38 + 2]);
-// doTestCompareRawBits("-1.1754943508222875e+3", rawBitsFor1_17eN38To38[38 + 3],
-// expectedStringFor1_17eN38To38[38 + 3]);
-// doTestCompareRawBits("-1.1754943508222875e+4", rawBitsFor1_17eN38To38[38 + 4],
-// expectedStringFor1_17eN38To38[38 + 4]);
-// doTestCompareRawBits("-1.1754943508222875e+5", rawBitsFor1_17eN38To38[38 + 5],
-// expectedStringFor1_17eN38To38[38 + 5]);
-// doTestCompareRawBits("-1.1754943508222875e+6", rawBitsFor1_17eN38To38[38 + 6],
-// expectedStringFor1_17eN38To38[38 + 6]);
-
-// for( int i = 7; i < 39; i++ ) {
-// std::string testString;
-// testString = "-1.1754943508222875e+" + Integer::toString( i );
-// doTestCompareRawBits( testString,
-// rawBitsFor1_17eN38To38[38 + i],
-// expectedStringFor1_17eN38To38[38 + i] );
-// }
-
- // Test denormalized floats (floats with exponents <= -38
- doTestCompareRawBits("1.1012984643248170E-45", 1, "1.4E-45");
- doTestCompareRawBits("-1.1012984643248170E-45", 0x80000001, "-1.4E-45");
- doTestCompareRawBits("1.0E-45", 1, "1.4E-45");
- doTestCompareRawBits("-1.0E-45", 0x80000001, "-1.4E-45");
- doTestCompareRawBits("0.9E-45", 1, "1.4E-45");
- doTestCompareRawBits("-0.9E-45", 0x80000001, "-1.4E-45");
- doTestCompareRawBits("4.203895392974451e-45", 3, "4.2E-45");
- doTestCompareRawBits("-4.203895392974451e-45", 0x80000003, "-4.2E-45");
- doTestCompareRawBits("0.004E-45", 0, "0.0");
- doTestCompareRawBits("-0.004E-45", 0x80000000, "-0.0");
-
- // Test for large floats close to and greater than 3.4028235E38 and
- // -3.4028235E38
- doTestCompareRawBits("1.2E+38", 0x7eb48e52, "1.2E38");
- doTestCompareRawBits("-1.2E+38", 0xfeb48e52, "-1.2E38");
- doTestCompareRawBits("3.2E+38", 0x7f70bdc2, "3.2E38");
- doTestCompareRawBits("-3.2E+38", 0xff70bdc2, "-3.2E38");
- doTestCompareRawBits("3.4E+38", 0x7f7fc99e, "3.4E38");
- doTestCompareRawBits("-3.4E+38", 0xff7fc99e, "-3.4E38");
- doTestCompareRawBits("3.4028234663852886E+38", 0x7f7fffff, "3.4028235E38");
- doTestCompareRawBits("-3.4028234663852886E+38", 0xff7fffff, "-3.4028235E38");
- doTestCompareRawBits("3.405E+38", 0x7f800000, "Infinity");
- doTestCompareRawBits("-3.405E+38", 0xff800000, "-Infinity");
- doTestCompareRawBits("3.41E+38", 0x7f800000, "Infinity");
- doTestCompareRawBits("-3.41E+38", 0xff800000, "-Infinity");
- doTestCompareRawBits("3.42E+38", 0x7f800000, "Infinity");
- doTestCompareRawBits("-3.42E+38", 0xff800000, "-Infinity");
- doTestCompareRawBits("1.0E+39", 0x7f800000, "Infinity");
- doTestCompareRawBits("-1.0E+39", 0xff800000, "-Infinity");
-}
diff --git a/src/decaf/src/test/decaf/lang/FloatTest.h b/src/decaf/src/test/decaf/lang/FloatTest.h
deleted file mode 100644
index 95bf288..0000000
--- a/src/decaf/src/test/decaf/lang/FloatTest.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_FLOATTEST_H_
-#define _DECAF_LANG_FLOATTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-namespace decaf{
-namespace lang{
-
- class FloatTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( FloatTest );
- CPPUNIT_TEST( test_ConstructorF );
- CPPUNIT_TEST( test_ConstructorString );
-// CPPUNIT_TEST( test_byteValue );
-// CPPUNIT_TEST( test_compare );
-// CPPUNIT_TEST( test_doubleValue );
-// CPPUNIT_TEST( test_floatToIntBitsF );
-// CPPUNIT_TEST( test_floatToRawIntBitsF );
-// CPPUNIT_TEST( test_floatValue );
-// CPPUNIT_TEST( test_intBitsToFloatI );
-// CPPUNIT_TEST( test_intValue );
-// CPPUNIT_TEST( test_isInfinite );
-// CPPUNIT_TEST( test_isInfiniteF );
-// CPPUNIT_TEST( test_isNaN );
-// CPPUNIT_TEST( test_isNaNF );
-// CPPUNIT_TEST( test_longValue );
-// CPPUNIT_TEST( test_parseFloatLDecaf_lang_String );
-
-// CPPUNIT_TEST( test_byteValue );
-// CPPUNIT_TEST( test_byteValue );
-// CPPUNIT_TEST( test_byteValue );
-// CPPUNIT_TEST( test_byteValue );
-// CPPUNIT_TEST( test_byteValue );
-// CPPUNIT_TEST( test_byteValue );
-// CPPUNIT_TEST( test_byteValue );
-// CPPUNIT_TEST( test_byteValue );
-// CPPUNIT_TEST( test_byteValue );
-// CPPUNIT_TEST( test_byteValue );
-// CPPUNIT_TEST( test_byteValue );
-// CPPUNIT_TEST( test_byteValue );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- static const int rawBitsFor3_4eN38To38[];
- static const std::string expectedStringFor3_4eN38To38[];
- static const int rawBitsFor1_17eN38To38[];
- static const std::string expectedStringFor1_17eN38To38[];
-
- FloatTest();
- virtual ~FloatTest() {}
-
- void test_ConstructorF();
- void test_ConstructorString();
- void test_byteValue();
- void test_compare();
- void test_doubleValue();
- void test_floatToIntBitsF();
- void test_floatToRawIntBitsF();
- void test_floatValue();
- void test_intBitsToFloatI();
- void test_intValue();
- void test_isInfinite();
- void test_isInfiniteF();
- void test_isNaN();
- void test_isNaNF();
- void test_longValue();
- void test_parseFloatLDecaf_lang_String();
-
-// void test_byteValue();
-// void test_byteValue();
-// void test_byteValue();
-// void test_byteValue();
-// void test_byteValue();
-// void test_byteValue();
-// void test_byteValue();
-// void test_byteValue();
-// void test_byteValue();
-// void test_byteValue();
-// void test_byteValue();
-// void test_byteValue();
-// void test_byteValue();
-// void test_byteValue();
-
- private:
-
- void doTestCompareRawBits( const std::string& originalFloatString,
- int expectedRawBits,
- const std::string& expectedString );
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_FLOATTEST_H_*/
diff --git a/src/decaf/src/test/decaf/lang/IntegerTest.cpp b/src/decaf/src/test/decaf/lang/IntegerTest.cpp
deleted file mode 100644
index b843cba..0000000
--- a/src/decaf/src/test/decaf/lang/IntegerTest.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "IntegerTest.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-void IntegerTest::test(void)
-{
- int x = Integer::parseInt("12");
- int y = Integer::parseInt("FF", 16);
- int z = Integer::parseInt("42");
-
- CPPUNIT_ASSERT( x == 12 );
- CPPUNIT_ASSERT( y == 255 );
- CPPUNIT_ASSERT( z == 42 );
-
- std::string x1 = Integer::toString( x );
- std::string y1 = Integer::toString( y );
- std::string z1 = Integer::toString( z );
-
- CPPUNIT_ASSERT( x1 == "12" );
- CPPUNIT_ASSERT( y1 == "255" );
- CPPUNIT_ASSERT( z1 == "42" );
-
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void IntegerTest::test2() {
- Integer integer( 255 );
-
- // Test cast functions
- CPPUNIT_ASSERT( integer.byteValue() == 255 );
- CPPUNIT_ASSERT( integer.shortValue() == 255 );
- CPPUNIT_ASSERT( integer.intValue() == 255 );
- CPPUNIT_ASSERT( integer.longValue() == 255 );
- CPPUNIT_ASSERT( integer.floatValue() == 255.0f );
- CPPUNIT_ASSERT( integer.doubleValue() == 255.0 );
-
- // Comparison functions
- CPPUNIT_ASSERT( integer.compareTo( 256 ) == -1 );
- CPPUNIT_ASSERT( integer.compareTo( 255 ) == 0 );
- CPPUNIT_ASSERT( integer.compareTo( 254 ) == 1 );
- CPPUNIT_ASSERT( integer.equals( Integer( 255 ) ) == true );
- CPPUNIT_ASSERT( integer.compareTo( Integer( 255 ) ) == 0 );
- CPPUNIT_ASSERT( integer == Integer( 255 ) );
-
- // decode
- CPPUNIT_ASSERT( integer == Integer::decode( "255" ) );
- CPPUNIT_ASSERT( integer == Integer::decode( "0xFF" ) );
- CPPUNIT_ASSERT( integer == Integer::decode( "255" ) );
- CPPUNIT_ASSERT( Integer::decode( "-255" ) == -255 );
-
- // reverseBytes
- CPPUNIT_ASSERT( (int)0xFF000000 == Integer::reverseBytes( 255 ) );
-
- // reverse
- CPPUNIT_ASSERT( Integer::reverse( Integer::reverse( 255 ) ) == 255 );
-
- // parseInt
- CPPUNIT_ASSERT( Integer::parseInt( "255") == 255 );
- CPPUNIT_ASSERT( Integer::parseInt( "255", 10 ) == 255 );
- CPPUNIT_ASSERT( Integer::parseInt( "255", 11 ) != 255 );
- CPPUNIT_ASSERT( Integer::parseInt( "FF", 16 ) == 255 );
-
- // valueOf
- CPPUNIT_ASSERT( Integer::valueOf( 255 ) == 255 );
- CPPUNIT_ASSERT( Integer::valueOf( "255" ) == 255 );
- CPPUNIT_ASSERT( Integer::valueOf( "255", 10 ) == 255 );
- CPPUNIT_ASSERT( (Integer::valueOf( "255", 11 )).intValue() != 255 );
- CPPUNIT_ASSERT( Integer::valueOf( "FF", 16 ) == 255 );
-
- // bitCount
- CPPUNIT_ASSERT( Integer::bitCount( 255 ) == 8 );
- CPPUNIT_ASSERT( Integer::bitCount( 0xFFFFFFFF ) == 32 );
-
- //toXXXString
- CPPUNIT_ASSERT( Integer::toString( 255 ) == "255" );
- CPPUNIT_ASSERT( Integer::toString( 255, 16 ) == "ff" );
- CPPUNIT_ASSERT( Integer::toHexString( 255 ) == "ff" );
- CPPUNIT_ASSERT( Integer::toOctalString( 255 ) == "377" );
- CPPUNIT_ASSERT( Integer::toBinaryString( 255 ) == "11111111" );
- CPPUNIT_ASSERT( Integer::toString( 255255 ) == "255255" );
-
- // highestOneBit
- CPPUNIT_ASSERT( Integer::highestOneBit( 255 ) == 128 );
- CPPUNIT_ASSERT( Integer::highestOneBit( 0xFF000000 ) == (int)0x80000000 );
-
- // lowestOneBit
- CPPUNIT_ASSERT( Integer::lowestOneBit( 255 ) == 1 );
- CPPUNIT_ASSERT( Integer::lowestOneBit( 0xFF000000 ) == (int)0x01000000 );
-}
diff --git a/src/decaf/src/test/decaf/lang/IntegerTest.h b/src/decaf/src/test/decaf/lang/IntegerTest.h
deleted file mode 100644
index 881b723..0000000
--- a/src/decaf/src/test/decaf/lang/IntegerTest.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_INTEGERTEST_H_
-#define _DECAF_LANG_INTEGERTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/lang/Integer.h>
-
-namespace decaf{
-namespace lang{
-
- class IntegerTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( IntegerTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST( test2 );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- IntegerTest(void) {}
- virtual ~IntegerTest(void) {}
-
- virtual void test();
- virtual void test2();
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_INTEGERTEST_H_*/
diff --git a/src/decaf/src/test/decaf/lang/LongTest.cpp b/src/decaf/src/test/decaf/lang/LongTest.cpp
deleted file mode 100644
index d745579..0000000
--- a/src/decaf/src/test/decaf/lang/LongTest.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "LongTest.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-void LongTest::test() {
-
- long long x = Long::parseLong("12");
- long long y = Long::parseLong("FF", 16);
- long long z = Long::parseLong("42");
-
- CPPUNIT_ASSERT( x == 12 );
- CPPUNIT_ASSERT( y == 255 );
- CPPUNIT_ASSERT( z == 42 );
-
- std::string x1 = Long::toString( x );
- std::string y1 = Long::toString( y );
- std::string z1 = Long::toString( z );
-
- CPPUNIT_ASSERT( x1 == "12" );
- CPPUNIT_ASSERT( y1 == "255" );
- CPPUNIT_ASSERT( z1 == "42" );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void LongTest::test2() {
-
- Long llong( 255 );
-
- // Test cast functions
- CPPUNIT_ASSERT( llong.byteValue() == 255 );
- CPPUNIT_ASSERT( llong.shortValue() == 255 );
- CPPUNIT_ASSERT( llong.intValue() == 255 );
- CPPUNIT_ASSERT( llong.longValue() == 255 );
- CPPUNIT_ASSERT( llong.floatValue() == 255.0f );
- CPPUNIT_ASSERT( llong.doubleValue() == 255.0 );
-
- // Comparison functions
- CPPUNIT_ASSERT( llong.compareTo( 256 ) == -1 );
- CPPUNIT_ASSERT( llong.compareTo( 255 ) == 0 );
- CPPUNIT_ASSERT( llong.compareTo( 254 ) == 1 );
- CPPUNIT_ASSERT( llong.equals( Long( 255 ) ) == true );
- CPPUNIT_ASSERT( llong.compareTo( Long( 255 ) ) == 0 );
- CPPUNIT_ASSERT( llong == Long( 255 ) );
-
- // decode
- CPPUNIT_ASSERT( llong == Long::decode( "255" ) );
- CPPUNIT_ASSERT( llong == Long::decode( "0xFF" ) );
- CPPUNIT_ASSERT( llong == Long::decode( "255" ) );
- CPPUNIT_ASSERT( Long::decode( "-255" ) == -255 );
-
- // reverseBytes
- CPPUNIT_ASSERT( (long long)0xFF00000000000000LL == Long::reverseBytes( 255 ) );
-
- // reverse
- CPPUNIT_ASSERT( Long::reverse( Long::reverse( 255 ) ) == 255 );
-
- // parseInt
- CPPUNIT_ASSERT( Long::parseLong( "255") == 255 );
- CPPUNIT_ASSERT( Long::parseLong( "255", 10 ) == 255 );
- CPPUNIT_ASSERT( Long::parseLong( "255", 11 ) != 255 );
- CPPUNIT_ASSERT( Long::parseLong( "FF", 16 ) == 255 );
-
- // valueOf
- CPPUNIT_ASSERT( Long::valueOf( 255 ) == 255 );
- CPPUNIT_ASSERT( Long::valueOf( "255" ) == 255 );
- CPPUNIT_ASSERT( Long::valueOf( "255", 10 ) == 255 );
- CPPUNIT_ASSERT( (Long::valueOf( "255", 11 )).intValue() != 255 );
- CPPUNIT_ASSERT( Long::valueOf( "FF", 16 ) == 255 );
-
- // bitCount
- CPPUNIT_ASSERT( Long::bitCount( 255 ) == 8 );
- CPPUNIT_ASSERT( Long::bitCount( 0xFFFFFFFF ) == 32 );
-
- //toXXXString
- CPPUNIT_ASSERT( Long::toString( 255 ) == "255" );
- CPPUNIT_ASSERT( Long::toString( 255, 16 ) == "ff" );
- CPPUNIT_ASSERT( Long::toHexString( 255 ) == "ff" );
- CPPUNIT_ASSERT( Long::toOctalString( 255 ) == "377" );
- CPPUNIT_ASSERT( Long::toBinaryString( 255 ) == "11111111" );
- CPPUNIT_ASSERT( Long::toString( 255255 ) == "255255" );
-
- // highestOneBit
- CPPUNIT_ASSERT( Long::highestOneBit( 255 ) == 128 );
- CPPUNIT_ASSERT( Long::highestOneBit( 0xFF000000 ) == (long long)0x80000000 );
-
- // lowestOneBit
- CPPUNIT_ASSERT( Long::lowestOneBit( 255 ) == 1 );
- CPPUNIT_ASSERT( Long::lowestOneBit( 0xFF000000 ) == (long long)0x01000000 );
-
-}
diff --git a/src/decaf/src/test/decaf/lang/LongTest.h b/src/decaf/src/test/decaf/lang/LongTest.h
deleted file mode 100644
index 29d62d1..0000000
--- a/src/decaf/src/test/decaf/lang/LongTest.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_LONGTEST_H_
-#define _DECAF_LANG_LONGTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/lang/Long.h>
-
-namespace decaf{
-namespace lang{
-
- class LongTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( LongTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST( test2 );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- LongTest() {}
- virtual ~LongTest() {}
-
- virtual void test();
- virtual void test2();
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_LONGTEST_H_*/
diff --git a/src/decaf/src/test/decaf/lang/MathTest.cpp b/src/decaf/src/test/decaf/lang/MathTest.cpp
deleted file mode 100644
index f4b16cb..0000000
--- a/src/decaf/src/test/decaf/lang/MathTest.cpp
+++ /dev/null
@@ -1,687 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "MathTest.h"
-
-#include <decaf/lang/Math.h>
-#include <decaf/lang/Double.h>
-#include <decaf/lang/Float.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-MathTest::MathTest() {
- this->HYP = Math::sqrt( 2.0 );
- this->OPP = 1.0;
- this->ADJ = 1.0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_absD() {
- // Test for method double decaf.lang.Math.abs(double)
-
- CPPUNIT_ASSERT_MESSAGE( "Incorrect double abs value",
- ( Math::abs(-1908.8976) == 1908.8976));
- CPPUNIT_ASSERT_MESSAGE( "Incorrect double abs value",
- ( Math::abs(1908.8976) == 1908.8976));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_absF() {
- // Test for method float decaf.lang.Math::abs(float)
- CPPUNIT_ASSERT_MESSAGE("Incorrect float abs value",
- (Math::abs(-1908.8976f) == 1908.8976f));
- CPPUNIT_ASSERT_MESSAGE("Incorrect float abs value",
- (Math::abs(1908.8976f) == 1908.8976f));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_absI() {
- // Test for method int decaf.lang.Math::abs(int)
- CPPUNIT_ASSERT_MESSAGE("Incorrect int abs value", (Math::abs(-1908897) == 1908897));
- CPPUNIT_ASSERT_MESSAGE("Incorrect int abs value", (Math::abs(1908897) == 1908897));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_absJ() {
- // Test for method long decaf.lang.Math::abs(long)
- CPPUNIT_ASSERT_MESSAGE("Incorrect long abs value",
- (Math::abs(-19088976000089LL) == 19088976000089LL));
- CPPUNIT_ASSERT_MESSAGE("Incorrect long abs value",
- (Math::abs(19088976000089LL) == 19088976000089LL));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_acosD() {
- // Test for method double decaf.lang.Math::acos(double)
- double r = Math::cos(Math::acos(ADJ / HYP));
- long long lr = Double::doubleToLongBits(r);
- long long t = Double::doubleToLongBits(ADJ / HYP);
- CPPUNIT_ASSERT_MESSAGE("Returned incorrect arc cosine", lr == t || (lr + 1) == t
- || (lr - 1) == t);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_asinD() {
- // Test for method double decaf.lang.Math::asin(double)
- double r = Math::sin(Math::asin(OPP / HYP));
- long long lr = Double::doubleToLongBits(r);
- long long t = Double::doubleToLongBits(OPP / HYP);
- CPPUNIT_ASSERT_MESSAGE("Returned incorrect arc sine", lr == t || (lr + 1) == t
- || (lr - 1) == t);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_atanD() {
- // Test for method double decaf.lang.Math::atan(double)
- double answer = Math::tan(Math::atan(1.0));
- CPPUNIT_ASSERT_MESSAGE("Returned incorrect arc tangent: ",
- answer <= 1.0 && answer >= 9.9999999999999983E-1);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_atan2DD() {
- // Test for method double decaf.lang.Math::atan2(double, double)
- double answer = Math::atan(Math::tan(1.0));
- CPPUNIT_ASSERT_MESSAGE("Returned incorrect arc tangent: ",
- answer <= 1.0 && answer >= 9.9999999999999983E-1);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_cbrt_D() {
- //Test for special situations
- CPPUNIT_ASSERT_MESSAGE("Should return Double::NaN",
- Double::isNaN(Math::cbrt(Double::NaN)));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return Double::POSITIVE_INFINITY",
- Math::cbrt(Double::POSITIVE_INFINITY), Double::POSITIVE_INFINITY );
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return Double::NEGATIVE_INFINITY",
- Math::cbrt(Double::NEGATIVE_INFINITY), Double::NEGATIVE_INFINITY);
- CPPUNIT_ASSERT_EQUAL(
- Double::doubleToLongBits(0.0),
- Double::doubleToLongBits(Math::cbrt(0.0)));
- CPPUNIT_ASSERT_EQUAL( Double::doubleToLongBits(+0.0),
- Double::doubleToLongBits(Math::cbrt(+0.0)));
- CPPUNIT_ASSERT_EQUAL( Double::doubleToLongBits(-0.0),
- Double::doubleToLongBits(Math::cbrt(-0.0)));
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 3.0", Math::cbrt(27.0), 3.0);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 5.643803094122362E102",
- 5.643803094122362E102, Math::cbrt(Double::MAX_VALUE));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 0.01", 0.01, Math::cbrt(0.000001));
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return -3.0", -3.0, Math::cbrt(-27.0));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.7031839360032603E-108",
- 1.7031839360032603E-108, Math::cbrt(Double::MIN_VALUE));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return -0.01", -0.01, Math::cbrt(-0.000001));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_ceilD() {
- // Test for method double decaf.lang.Math::ceil(double)
- CPPUNIT_ASSERT_EQUAL_MESSAGE( "Incorrect ceiling for double",
- 79.0, Math::ceil(78.89) );
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect ceiling for double",
- -78.0, Math::ceil(-78.89) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_cosD() {
- // Test for method double decaf.lang.Math::cos(double)
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect answer", 1.0, Math::cos(0));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect answer", 0.5403023058681398, Math::cos(1));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_cosh_D() {
- // Test for special situations
- CPPUNIT_ASSERT(Double::isNaN(Math::cosh(Double::NaN)));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY, Math::cosh(Double::POSITIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY, Math::cosh(Double::NEGATIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0", 1.0, Math::cosh(+0.0));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0", 1.0, Math::cosh(-0.0));
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY, Math::cosh(1234.56));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY, Math::cosh(-1234.56));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0000000000005",
- 1.0000000000005, Math::cosh(0.000001));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0000000000005",
- 1.0000000000005, Math::cosh(-0.000001));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 5.212214351945598",
- 5.212214351945598, Math::cosh(2.33482));
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY, Math::cosh(Double::MAX_VALUE));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0",
- 1.0, Math::cosh(Double::MIN_VALUE));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_expD() {
- // Test for method double decaf.lang.Math::exp(double)
- CPPUNIT_ASSERT_MESSAGE("Incorrect answer returned for simple power",
- Math::abs(Math::exp(4.0) -
- Math::E * Math::E * Math::E * Math::E) < 0.1 );
- CPPUNIT_ASSERT_MESSAGE("Incorrect answer returned for larger power",
- Math::log( Math::abs( Math::exp(5.5) ) - 5.5) < 10.0 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_expm1_D() {
- // Test for special cases
- CPPUNIT_ASSERT_MESSAGE("Should return NaN", Double::isNaN(Math::expm1(Double::NaN)));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY, Math::expm1(Double::POSITIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return -1.0", -1.0,
- Math::expm1(Double::NEGATIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL( Double::doubleToLongBits(0.0),
- Double::doubleToLongBits(Math::expm1(0.0)) );
- CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(+0.0),
- Double::doubleToLongBits(Math::expm1(+0.0)));
- CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(-0.0),
- Double::doubleToLongBits(Math::expm1(-0.0)));
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return -9.999950000166666E-6",
- -9.999950000166666E-6, Math::expm1(-0.00001));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0145103074469635E60",
- 1.0145103074469635E60, Math::expm1(138.16951162));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY,
- Math::expm1(123456789123456789123456789.4521584223));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY, Math::expm1(Double::MAX_VALUE));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return MIN_VALUE", Double::MIN_VALUE,
- Math::expm1(Double::MIN_VALUE));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_floorD() {
- // Test for method double decaf.lang.Math::floor(double)
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect floor for double",
- 78.0, Math::floor(78.89));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect floor for double",
- -79.0, Math::floor(-78.89));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_hypot_DD() {
- // Test for special cases
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY, Math::hypot(Double::POSITIVE_INFINITY,
- 1.0));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY, Math::hypot(Double::NEGATIVE_INFINITY,
- 123.324));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY,
- Math::hypot(-758.2587,Double::POSITIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY,
- Math::hypot(5687.21, Double::NEGATIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY, Math::hypot(Double::POSITIVE_INFINITY,
- Double::NEGATIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY, Math::hypot(Double::NEGATIVE_INFINITY,
- Double::POSITIVE_INFINITY));
- CPPUNIT_ASSERT_MESSAGE("Should be NaN", Double::isNaN(Math::hypot(Double::NaN,
- 2342301.89843)));
- CPPUNIT_ASSERT_MESSAGE("Should be NaN", Double::isNaN(Math::hypot(-345.2680,
- Double::NaN)));
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 2396424.905416697",
- 2396424.905416697, Math::hypot(12322.12, -2396393.2258));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 138.16958070558556", 138.16958070558556,
- Math::hypot(-138.16951162, 0.13817035864));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.7976931348623157E308",
- 1.7976931348623157E308, Math::hypot(Double::MAX_VALUE, 211370.35));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 5413.7185", 5413.7185, Math::hypot(
- -5413.7185, Double::MIN_VALUE));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_IEEEremainderDD() {
- // Test for method double decaf.lang.Math::IEEEremainder(double, double)
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect remainder returned",
- 0.0, Math::IEEEremainder(1.0, 1.0));
- CPPUNIT_ASSERT_MESSAGE("Incorrect remainder returned",
- Math::IEEEremainder(1.32,89.765) >= 1.4705063220631647E-2 ||
- Math::IEEEremainder(1.32, 89.765) >= 1.4705063220631649E-2);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_logD() {
- // Test for method double decaf.lang.Math::log(double)
- for( double d = 10; d >= -10; d -= 0.5 ) {
- double answer = Math::log( Math::exp(d) );
-
- std::cout << "d: " << d << std::endl;
- std::cout << "answer: " << answer << std::endl;
-
- CPPUNIT_ASSERT_MESSAGE(
- "Answer does not equal expected answer for d",
- Math::abs( answer - d ) <= Math::abs(d * 0.00000001) );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_log10_D() {
- // Test for special cases
- CPPUNIT_ASSERT(Double::isNaN(Math::log10(Double::NaN)));
- CPPUNIT_ASSERT(Double::isNaN(Math::log10(-2541.05745687234187532)));
- CPPUNIT_ASSERT(Double::isNaN(Math::log10(-0.1)));
- CPPUNIT_ASSERT_EQUAL(Double::POSITIVE_INFINITY, Math::log10(Double::POSITIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL(Double::NEGATIVE_INFINITY, Math::log10(0.0));
- CPPUNIT_ASSERT_EQUAL(Double::NEGATIVE_INFINITY, Math::log10(+0.0));
- CPPUNIT_ASSERT_EQUAL(Double::NEGATIVE_INFINITY, Math::log10(-0.0));
-
- CPPUNIT_ASSERT_EQUAL(3.0, Math::log10(1000.0));
- CPPUNIT_ASSERT_EQUAL(14.0, Math::log10(Math::pow(10, 14)));
- CPPUNIT_ASSERT_EQUAL(3.7389561269540406, Math::log10(5482.2158));
- CPPUNIT_ASSERT_EQUAL(14.661551142893833, Math::log10(458723662312872.125782332587));
- CPPUNIT_ASSERT_EQUAL(-0.9083828622192334, Math::log10(0.12348583358871));
- CPPUNIT_ASSERT_EQUAL(308.25471555991675, Math::log10(Double::MAX_VALUE));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_log1p_D() {
- // Test for special cases
- CPPUNIT_ASSERT_MESSAGE("Should return NaN", Double::isNaN(Math::log1p(Double::NaN)));
- CPPUNIT_ASSERT_MESSAGE("Should return NaN", Double::isNaN(Math::log1p(-32.0482175)));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY, Math::log1p(Double::POSITIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL( Double::doubleToLongBits(0.0),
- Double::doubleToLongBits(Math::log1p(0.0)));
- CPPUNIT_ASSERT_EQUAL( Double::doubleToLongBits(+0.0),
- Double::doubleToLongBits(Math::log1p(+0.0)));
- CPPUNIT_ASSERT_EQUAL( Double::doubleToLongBits(-0.0),
- Double::doubleToLongBits(Math::log1p(-0.0)));
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return -0.2941782295312541", -0.2941782295312541,
- Math::log1p(-0.254856327));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 7.368050685564151", 7.368050685564151,
- Math::log1p(1583.542));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 0.4633708685409921", 0.4633708685409921,
- Math::log1p(0.5894227));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 709.782712893384", 709.782712893384,
- Math::log1p(Double::MAX_VALUE));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return Double::MIN_VALUE", Double::MIN_VALUE,
- Math::log1p(Double::MIN_VALUE));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_maxDD() {
- // Test for method double decaf.lang.Math::max(double, double)
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect double max value", 1908897.6000089,
- Math::max(-1908897.6000089, 1908897.6000089));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect double max value",
- 1908897.6000089, Math::max(2.0, 1908897.6000089));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect double max value", -2.0,
- Math::max(-2.0, -1908897.6000089));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_maxFF() {
- // Test for method float decaf.lang.Math::max(float, float)
- CPPUNIT_ASSERT_MESSAGE("Incorrect float max value", Math::max(-1908897.600f,
- 1908897.600f) == 1908897.600f);
- CPPUNIT_ASSERT_MESSAGE("Incorrect float max value",
- Math::max(2.0f, 1908897.600f) == 1908897.600f);
- CPPUNIT_ASSERT_MESSAGE("Incorrect float max value",
- Math::max(-2.0f, -1908897.600f) == -2.0f);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_maxII() {
- // Test for method int decaf.lang.Math::max(int, int)
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect int max value",
- 19088976, Math::max(-19088976, 19088976));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect int max value",
- 19088976, Math::max(20, 19088976));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect int max value", -20, Math::max(-20, -19088976));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_maxJJ() {
- // Test for method long long decaf.lang.Math::max(long long, long long)
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect long max value",
- 19088976000089LL, Math::max(-19088976000089LL, 19088976000089LL));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect long max value",
- 19088976000089LL, Math::max(20LL, 19088976000089LL));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect long max value",
- -20LL, Math::max(-20LL, -19088976000089LL));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_minDD() {
- // Test for method double decaf.lang.Math::min(double, double)
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect double min value",
- -1908897.6000089, Math::min(-1908897.6000089, 1908897.6000089));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect double min value",
- 2.0, Math::min(2.0, 1908897.6000089));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect double min value",
- -1908897.6000089, Math::min(-2.0,-1908897.6000089));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_minFF() {
- // Test for method float decaf.lang.Math::min(float, float)
- CPPUNIT_ASSERT_MESSAGE("Incorrect float min value", Math::min(-1908897.600f,
- 1908897.600f) == -1908897.600f);
- CPPUNIT_ASSERT_MESSAGE("Incorrect float min value",
- Math::min(2.0f, 1908897.600f) == 2.0f);
- CPPUNIT_ASSERT_MESSAGE("Incorrect float min value",
- Math::min(-2.0f, -1908897.600f) == -1908897.600f);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_minII() {
- // Test for method int decaf.lang.Math::min(int, int)
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect int min value",
- -19088976, Math::min(-19088976, 19088976));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect int min value", 20, Math::min(20, 19088976));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect int min value",
- -19088976, Math::min(-20, -19088976));
-
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_minJJ() {
- // Test for method long long decaf.lang.Math::min(long long, long long)
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect long min value",
- -19088976000089LL, Math::min(-19088976000089LL, 19088976000089LL));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect long min value",
- 20LL, Math::min(20LL, 19088976000089LL));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect long min value",
- -19088976000089LL, Math::min(-20LL, -19088976000089LL));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_powDD() {
- // Test for method double decaf.lang.Math::pow(double, double)
- CPPUNIT_ASSERT_MESSAGE("pow returned incorrect value",
- (long) Math::pow(2, 8) == 256l);
- CPPUNIT_ASSERT_MESSAGE("pow returned incorrect value",
- Math::pow(2, -8) == 0.00390625);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect root returned1",
- 2.0, Math::sqrt(Math::pow(Math::sqrt(2), 4)));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_rintD() {
- // Test for method double decaf.lang.Math::rint(double)
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Failed to round properly - up to odd",
- 3.0, Math::rint(2.9));
- CPPUNIT_ASSERT_MESSAGE("Failed to round properly - NaN",
- Double::isNaN(Math::rint(Double::NaN)));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Failed to round properly down to even",
- 2.0, Math::rint(2.1));
- CPPUNIT_ASSERT_MESSAGE("Failed to round properly to even",
- Math::rint(2.5) == 2.0);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_roundD() {
- // Test for method long decaf.lang.Math::round(double)
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect rounding of a float",
- -91LL, Math::round(-90.89));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_roundF() {
- // Test for method int decaf.lang.Math::round(float)
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect rounding of a float",
- -91, Math::round(-90.89f));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_signum_D() {
- CPPUNIT_ASSERT(Double::isNaN(Math::signum(Double::NaN)));
- CPPUNIT_ASSERT(Double::isNaN(Math::signum(Double::NaN)));
- CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(0.0),
- Double::doubleToLongBits(Math::signum(0.0)));
- CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(+0.0),
- Double::doubleToLongBits(Math::signum(+0.0)));
- CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(-0.0),
- Double::doubleToLongBits(Math::signum(-0.0)));
-
- CPPUNIT_ASSERT_EQUAL(1.0, Math::signum(253681.2187962));
- CPPUNIT_ASSERT_EQUAL(-1.0, Math::signum(-125874693.56));
- CPPUNIT_ASSERT_EQUAL(1.0, Math::signum(1.2587E-308));
- CPPUNIT_ASSERT_EQUAL(-1.0, Math::signum(-1.2587E-308));
-
- CPPUNIT_ASSERT_EQUAL(1.0, Math::signum(Double::MAX_VALUE));
- CPPUNIT_ASSERT_EQUAL(1.0, Math::signum(Double::MIN_VALUE));
- CPPUNIT_ASSERT_EQUAL(-1.0, Math::signum(-Double::MAX_VALUE));
- CPPUNIT_ASSERT_EQUAL(-1.0, Math::signum(-Double::MIN_VALUE));
- CPPUNIT_ASSERT_EQUAL(1.0, Math::signum(Double::POSITIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL(-1.0, Math::signum(Double::NEGATIVE_INFINITY));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_signum_F() {
- CPPUNIT_ASSERT(Float::isNaN(Math::signum(Float::NaN)));
- CPPUNIT_ASSERT_EQUAL(Float::floatToIntBits(0.0f),
- Float::floatToIntBits(Math::signum(0.0f)));
- CPPUNIT_ASSERT_EQUAL(Float::floatToIntBits(+0.0f),
- Float::floatToIntBits(Math::signum(+0.0f)));
- CPPUNIT_ASSERT_EQUAL(Float::floatToIntBits(-0.0f),
- Float::floatToIntBits(Math::signum(-0.0f)));
-
- CPPUNIT_ASSERT_EQUAL(1.0f, Math::signum(253681.2187962f));
- CPPUNIT_ASSERT_EQUAL(-1.0f, Math::signum(-125874693.56f));
- CPPUNIT_ASSERT_EQUAL(1.0f, Math::signum(1.2587E-11f));
- CPPUNIT_ASSERT_EQUAL(-1.0f, Math::signum(-1.2587E-11f));
-
- CPPUNIT_ASSERT_EQUAL(1.0f, Math::signum(Float::MAX_VALUE));
- CPPUNIT_ASSERT_EQUAL(1.0f, Math::signum(Float::MIN_VALUE));
- CPPUNIT_ASSERT_EQUAL(-1.0f, Math::signum(-Float::MAX_VALUE));
- CPPUNIT_ASSERT_EQUAL(-1.0f, Math::signum(-Float::MIN_VALUE));
- CPPUNIT_ASSERT_EQUAL(1.0f, Math::signum(Float::POSITIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL(-1.0f, Math::signum(Float::NEGATIVE_INFINITY));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_sinD() {
- // Test for method double decaf.lang.Math::sin(double)
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect answer",
- 0.0, Math::sin(0));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect answer",
- 0.8414709848078965, Math::sin(1));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_sinh_D() {
- // Test for special situations
- CPPUNIT_ASSERT_MESSAGE("Should return NaN", Double::isNaN(Math::sinh(Double::NaN)));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY, Math::sinh(Double::POSITIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return NEGATIVE_INFINITY",
- Double::NEGATIVE_INFINITY, Math::sinh(Double::NEGATIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(0.0),
- Double::doubleToLongBits(Math::sinh(0.0)));
- CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(+0.0),
- Double::doubleToLongBits(Math::sinh(+0.0)));
- CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(-0.0),
- Double::doubleToLongBits(Math::sinh(-0.0)));
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY, Math::sinh(1234.56));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return NEGATIVE_INFINITY",
- Double::NEGATIVE_INFINITY, Math::sinh(-1234.56));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0000000000001666E-6",
- 1.0000000000001666E-6, Math::sinh(0.000001));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return -1.0000000000001666E-6",
- -1.0000000000001666E-6, Math::sinh(-0.000001));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 5.11538644196386",
- 5.11538644196386, Math::sinh( 2.33482 ) );
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
- Double::POSITIVE_INFINITY, Math::sinh(Double::MAX_VALUE));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 4.9E-324", 4.9E-324,
- Math::sinh(Double::MIN_VALUE));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_sqrtD() {
- // Test for method double decaf.lang.Math::sqrt(double)
- CPPUNIT_ASSERT_EQUAL_MESSAGE(
- "Incorrect root returned2", 7.0, Math::sqrt(49.0) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_tanD() {
- // Test for method double decaf.lang.Math::tan(double)
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect answer",
- 0.0, Math::tan(0));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect answer",
- 1.5574077246549023, Math::tan(1));
-
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_tanh_D() {
- // Test for special situations
- CPPUNIT_ASSERT_MESSAGE("Should return NaN", Double::isNaN(Math::tanh(Double::NaN)));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return +1.0", +1.0,
- Math::tanh(Double::POSITIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return -1.0", -1.0,
- Math::tanh(Double::NEGATIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(0.0),
- Double::doubleToLongBits(Math::tanh(0.0)));
- CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(+0.0),
- Double::doubleToLongBits(Math::tanh(+0.0)));
- CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(-0.0),
- Double::doubleToLongBits(Math::tanh(-0.0)));
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0", 1.0, Math::tanh(1234.56));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return -1.0", -1.0, Math::tanh(-1234.56));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 9.999999999996666E-7",
- 9.999999999996666E-7, Math::tanh(0.000001));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 0.981422884124941", 0.981422884124941,
- Math::tanh(2.33482));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0",
- 1.0, Math::tanh(Double::MAX_VALUE));
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 4.9E-324", 4.9E-324,
- Math::tanh(Double::MIN_VALUE));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_random() {
- // There isn't a place for these tests so just stick them here
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong value E",
- 4613303445314885481LL, Double::doubleToLongBits(Math::E));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong value PI",
- 4614256656552045848LL, Double::doubleToLongBits(Math::PI));
-
- for (int i = 500; i >= 0; i--) {
- double d = Math::random();
- CPPUNIT_ASSERT_MESSAGE("Generated number is out of range: ",
- d >= 0.0 && d < 1.0);
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_toRadiansD() {
- for (double d = 500; d >= 0; d -= 1.0) {
- double converted = Math::toDegrees(Math::toRadians(d));
- CPPUNIT_ASSERT_MESSAGE("Converted number not equal to original. d ",
- converted >= d * 0.99999999 && converted <= d * 1.00000001);
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_toDegreesD() {
- for (double d = 500; d >= 0; d -= 1.0) {
- double converted = Math::toRadians(Math::toDegrees(d));
- CPPUNIT_ASSERT_MESSAGE("Converted number not equal to original. d ",
- converted >= d * 0.99999999 && converted <= d * 1.00000001);
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_ulp_D() {
- // Test for special cases
- CPPUNIT_ASSERT_MESSAGE("Should return NaN", Double::isNaN(Math::ulp(Double::NaN)));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", Double::POSITIVE_INFINITY,
- Math::ulp(Double::POSITIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", Double::POSITIVE_INFINITY,
- Math::ulp(Double::NEGATIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
- Double::MIN_VALUE, Math::ulp(0.0) );
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", Double::MIN_VALUE,
- Math::ulp(+0.0));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", Double::MIN_VALUE,
- Math::ulp(-0.0));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", Math::pow(2, 971),
- Math::ulp(Double::MAX_VALUE));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", Math::pow(2, 971),
- Math::ulp(-Double::MAX_VALUE));
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
- Double::MIN_VALUE, Math::ulp(Double::MIN_VALUE) );
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
- Double::MIN_VALUE, Math::ulp(-Double::MIN_VALUE) );
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", 2.220446049250313E-16,
- Math::ulp(1.0));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", 2.220446049250313E-16,
- Math::ulp(-1.0));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", 2.2737367544323206E-13,
- Math::ulp(1153.0));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MathTest::test_ulp_f() {
-
- // Test for special cases
- CPPUNIT_ASSERT_MESSAGE("Should return NaN", Float::isNaN(Math::ulp(Float::NaN)));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
- Float::POSITIVE_INFINITY, Math::ulp(Float::POSITIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
- Float::POSITIVE_INFINITY, Math::ulp(Float::NEGATIVE_INFINITY));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
- Float::MIN_VALUE, Math::ulp(0.0f));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", Float::MIN_VALUE, Math
- ::ulp(+0.0f));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
- Math::ulp(-0.0f), Float::MIN_VALUE );
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
- 2.028241E31f, Math::ulp(Float::MAX_VALUE));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
- 2.028241E31f, Math::ulp(-Float::MAX_VALUE));
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
- 1.4E-45f, Math::ulp( Float::MIN_VALUE ) );
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
- 1.4E-45f, Math::ulp( -Float::MIN_VALUE ) );
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
- 1.1920929E-7f, Math::ulp(1.0f));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", 1.1920929E-7f,
- Math::ulp(-1.0f));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
- 1.2207031E-4f, Math::ulp(1153.0f));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
- 5.6E-45f, Math::ulp(9.403954E-38f) );
-}
-
diff --git a/src/decaf/src/test/decaf/lang/MathTest.h b/src/decaf/src/test/decaf/lang/MathTest.h
deleted file mode 100644
index 9edf228..0000000
--- a/src/decaf/src/test/decaf/lang/MathTest.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_MATHTEST_H_
-#define _DECAF_LANG_MATHTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-namespace decaf{
-namespace lang{
-
- class MathTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( MathTest );
- CPPUNIT_TEST( test_absD );
- CPPUNIT_TEST( test_absF );
- CPPUNIT_TEST( test_absI );
- CPPUNIT_TEST( test_absJ );
- CPPUNIT_TEST( test_acosD );
- CPPUNIT_TEST( test_asinD );
- CPPUNIT_TEST( test_atanD );
- CPPUNIT_TEST( test_atan2DD );
- CPPUNIT_TEST( test_cbrt_D );
- CPPUNIT_TEST( test_ceilD );
- CPPUNIT_TEST( test_cosD );
- CPPUNIT_TEST( test_cosh_D );
- CPPUNIT_TEST( test_expD );
- CPPUNIT_TEST( test_expm1_D );
- CPPUNIT_TEST( test_floorD );
- CPPUNIT_TEST( test_hypot_DD );
- CPPUNIT_TEST( test_IEEEremainderDD );
- CPPUNIT_TEST( test_logD );
- CPPUNIT_TEST( test_log10_D );
- CPPUNIT_TEST( test_log1p_D );
- CPPUNIT_TEST( test_maxDD );
- CPPUNIT_TEST( test_maxFF );
- CPPUNIT_TEST( test_maxII );
- CPPUNIT_TEST( test_maxJJ );
- CPPUNIT_TEST( test_minDD );
- CPPUNIT_TEST( test_minFF );
- CPPUNIT_TEST( test_minII );
- CPPUNIT_TEST( test_minJJ );
- CPPUNIT_TEST( test_powDD );
- CPPUNIT_TEST( test_rintD );
- CPPUNIT_TEST( test_roundD );
- CPPUNIT_TEST( test_roundF );
- CPPUNIT_TEST( test_signum_D );
- CPPUNIT_TEST( test_signum_F );
- CPPUNIT_TEST( test_sinD );
- CPPUNIT_TEST( test_sinh_D );
- CPPUNIT_TEST( test_sqrtD );
- CPPUNIT_TEST( test_tanD );
- CPPUNIT_TEST( test_tanh_D );
- CPPUNIT_TEST( test_random );
- CPPUNIT_TEST( test_toRadiansD );
- CPPUNIT_TEST( test_toDegreesD );
- CPPUNIT_TEST( test_ulp_D );
- CPPUNIT_TEST( test_ulp_f );
- CPPUNIT_TEST_SUITE_END();
-
- private:
-
- double HYP;
- double OPP;
- double ADJ;
-
- public:
-
- MathTest();
- virtual ~MathTest() {}
-
- virtual void test_absD();
- virtual void test_absF();
- virtual void test_absI();
- virtual void test_absJ();
- virtual void test_acosD();
- virtual void test_asinD();
- virtual void test_atanD();
- virtual void test_atan2DD();
- virtual void test_cbrt_D();
- virtual void test_ceilD();
- virtual void test_cosD();
- virtual void test_cosh_D();
- virtual void test_expD();
- virtual void test_expm1_D();
- virtual void test_floorD();
- virtual void test_hypot_DD();
- virtual void test_IEEEremainderDD();
- virtual void test_logD();
- virtual void test_log10_D();
- virtual void test_log1p_D();
- virtual void test_maxDD();
- virtual void test_maxFF();
- virtual void test_maxII();
- virtual void test_maxJJ();
- virtual void test_minDD();
- virtual void test_minFF();
- virtual void test_minII();
- virtual void test_minJJ();
- virtual void test_powDD();
- virtual void test_rintD();
- virtual void test_roundD();
- virtual void test_roundF();
- virtual void test_signum_D();
- virtual void test_signum_F();
- virtual void test_sinD();
- virtual void test_sinh_D();
- virtual void test_sqrtD();
- virtual void test_tanD();
- virtual void test_tanh_D();
- virtual void test_random();
- virtual void test_toRadiansD();
- virtual void test_toDegreesD();
- virtual void test_ulp_D();
- virtual void test_ulp_f();
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_MATHTEST_H_*/
diff --git a/src/decaf/src/test/decaf/lang/ShortTest.cpp b/src/decaf/src/test/decaf/lang/ShortTest.cpp
deleted file mode 100644
index f43669c..0000000
--- a/src/decaf/src/test/decaf/lang/ShortTest.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "ShortTest.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-ShortTest::ShortTest() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ShortTest::test() {
-
- Short short1( 65 );
-
- CPPUNIT_ASSERT( short1.byteValue() == 65 );
- CPPUNIT_ASSERT( short1.shortValue() == 65 );
- CPPUNIT_ASSERT( short1.intValue() == 65 );
- CPPUNIT_ASSERT( short1.longValue() == 65 );
- CPPUNIT_ASSERT( short1.floatValue() == 65.0f );
- CPPUNIT_ASSERT( short1.doubleValue() == 65.0 );
-
- CPPUNIT_ASSERT( short1.toString() == "65" );
- CPPUNIT_ASSERT( short1.toString( 99 ) == "99" );
-
- CPPUNIT_ASSERT( Short::reverseBytes( (short)0xFF00 ) == (short)0x00FF );
- CPPUNIT_ASSERT( Short::reverseBytes( (short)0x0F00 ) == (short)0x000F );
- CPPUNIT_ASSERT( Short::reverseBytes( (short)0xDE00 ) == (short)0x00DE );
- CPPUNIT_ASSERT( Short::reverseBytes( (short)0x00AB ) == (short)0xAB00 );
-
- Short short2( 255 );
-
- // Comparison functions
- CPPUNIT_ASSERT( short2.compareTo( 256 ) == -1 );
- CPPUNIT_ASSERT( short2.compareTo( 255 ) == 0 );
- CPPUNIT_ASSERT( short2.compareTo( 254 ) == 1 );
- CPPUNIT_ASSERT( short2.equals( Short( 255 ) ) == true );
- CPPUNIT_ASSERT( short2.compareTo( Short( 255 ) ) == 0 );
- CPPUNIT_ASSERT( short2 == Short( 255 ) );
-
- // decode
- CPPUNIT_ASSERT( short2 == Short::decode( "255" ) );
- CPPUNIT_ASSERT( short2 == Short::decode( "0xFF" ) );
- CPPUNIT_ASSERT( short2 == Short::decode( "255" ) );
- CPPUNIT_ASSERT( Short::decode( "-255" ) == -255 );
-
- // parseInt
- CPPUNIT_ASSERT( Short::parseShort( "255") == 255 );
- CPPUNIT_ASSERT( Short::parseShort( "255", 10 ) == 255 );
- CPPUNIT_ASSERT( Short::parseShort( "255", 11 ) != 255 );
- CPPUNIT_ASSERT( Short::parseShort( "FF", 16 ) == 255 );
-
- // valueOf
- CPPUNIT_ASSERT( Short::valueOf( 255 ) == 255 );
- CPPUNIT_ASSERT( Short::valueOf( "255" ) == 255 );
- CPPUNIT_ASSERT( Short::valueOf( "255", 10 ) == 255 );
- CPPUNIT_ASSERT( (Short::valueOf( "255", 11 )).shortValue() != 255 );
- CPPUNIT_ASSERT( Short::valueOf( "FF", 16 ) == 255 );
-
- CPPUNIT_ASSERT( Short::toString( 255 ) == "255" );
-
-}
-
diff --git a/src/decaf/src/test/decaf/lang/ShortTest.h b/src/decaf/src/test/decaf/lang/ShortTest.h
deleted file mode 100644
index c9dba63..0000000
--- a/src/decaf/src/test/decaf/lang/ShortTest.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_SHORTTEST_H_
-#define _DECAF_LANG_SHORTTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/lang/Short.h>
-
-namespace decaf{
-namespace lang{
-
- class ShortTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( ShortTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- ShortTest();
- virtual ~ShortTest() {}
-
- void test();
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_SHORTTEST_H_*/
diff --git a/src/decaf/src/test/decaf/lang/SystemTest.cpp b/src/decaf/src/test/decaf/lang/SystemTest.cpp
deleted file mode 100644
index 258dc52..0000000
--- a/src/decaf/src/test/decaf/lang/SystemTest.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "SystemTest.h"
-
-#include <decaf/lang/System.h>
-#include <decaf/util/Map.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::util;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-SystemTest::SystemTest() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SystemTest::test_getenv() {
-
- CPPUNIT_ASSERT( System::getenv( "PATH" ) != "" );
-
- try {
- System::getenv( "PATH_ASDFGHJKL" );
- CPPUNIT_ASSERT( false );
- } catch (...) {
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SystemTest::test_getenv2() {
-
- Map<std::string, std::string> values = System::getenv();
-
- CPPUNIT_ASSERT( values.size() != 0 );
- CPPUNIT_ASSERT( values.containsKey( "PATH" ) );
- CPPUNIT_ASSERT( !values.containsKey( "PATH_ASDFGHJKL" ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SystemTest::test_setenv() {
-
- Map<std::string, std::string> values1 = System::getenv();
- CPPUNIT_ASSERT( !values1.containsKey( "PATH_ASDFGHJKL" ) );
- System::setenv( "PATH_ASDFGHJKL", "test" );
- Map<std::string, std::string> values2 = System::getenv();
- CPPUNIT_ASSERT( values2.containsKey( "PATH_ASDFGHJKL" ) );
- System::unsetenv( "PATH_ASDFGHJKL" );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SystemTest::test_unsetenv() {
-
- Map<std::string, std::string> values1 = System::getenv();
- CPPUNIT_ASSERT( !values1.containsKey( "PATH_ASDFGHJKL" ) );
- System::setenv( "PATH_ASDFGHJKL", "test" );
- Map<std::string, std::string> values2 = System::getenv();
- CPPUNIT_ASSERT( values2.containsKey( "PATH_ASDFGHJKL" ) );
- System::unsetenv( "PATH_ASDFGHJKL" );
- Map<std::string, std::string> values3 = System::getenv();
- CPPUNIT_ASSERT( !values3.containsKey( "PATH_ASDFGHJKL" ) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SystemTest::test_currentTimeMillis() {
- CPPUNIT_ASSERT( System::currentTimeMillis() != 0 );
-}
diff --git a/src/decaf/src/test/decaf/lang/SystemTest.h b/src/decaf/src/test/decaf/lang/SystemTest.h
deleted file mode 100644
index b0c03b8..0000000
--- a/src/decaf/src/test/decaf/lang/SystemTest.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_SYSTEMTEST_H_
-#define _DECAF_LANG_SYSTEMTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-namespace decaf{
-namespace lang{
-
- class SystemTest : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE( SystemTest );
- CPPUNIT_TEST( test_getenv );
- CPPUNIT_TEST( test_getenv2 );
- CPPUNIT_TEST( test_setenv );
- CPPUNIT_TEST( test_unsetenv );
- CPPUNIT_TEST( test_currentTimeMillis );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- SystemTest();
- virtual ~SystemTest() {}
-
- void test_getenv();
- void test_getenv2();
- void test_setenv();
- void test_unsetenv();
- void test_currentTimeMillis();
-
- };
-
-}}
-
-#endif /*_DECAF_LANG_SYSTEMTEST_H_*/
diff --git a/src/decaf/src/test/decaf/lang/ThreadTest.cpp b/src/decaf/src/test/decaf/lang/ThreadTest.cpp
deleted file mode 100644
index 2a5e0d5..0000000
--- a/src/decaf/src/test/decaf/lang/ThreadTest.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "ThreadTest.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-
-void ThreadTest::testDelegate(){
-
- Delegate test;
- int initialValue = test.getStuff();
-
- Thread thread( &test );
- thread.start();
- thread.join();
-
- int finalValue = test.getStuff();
-
- // The values should be different - this proves
- // that the runnable was run.
- CPPUNIT_ASSERT( finalValue != initialValue );
-}
-
-void ThreadTest::testDerived(){
-
- Derived test;
- int initialValue = test.getStuff();
-
- test.start();
- test.join();
-
- int finalValue = test.getStuff();
-
- // The values should be different - this proves
- // that the runnable was run.
- CPPUNIT_ASSERT( finalValue != initialValue );
-}
-
-void ThreadTest::testJoin(){
-
- JoinTest test;
-
- time_t startTime = time( NULL );
- test.start();
- test.join();
- time_t endTime = time( NULL );
-
- time_t delta = endTime - startTime;
-
- // Should be about 5 seconds that elapsed.
- CPPUNIT_ASSERT( delta >= 1 && delta <= 3 );
-}
diff --git a/src/decaf/src/test/decaf/lang/ThreadTest.h b/src/decaf/src/test/decaf/lang/ThreadTest.h
deleted file mode 100644
index b91f688..0000000
--- a/src/decaf/src/test/decaf/lang/ThreadTest.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_LANG_THREADTEST_H_
-#define _DECAF_LANG_THREADTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/lang/Thread.h>
-#include <time.h>
-
-namespace decaf{
-namespace lang{
-
- class ThreadTest : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE( ThreadTest );
- CPPUNIT_TEST( testDelegate );
- CPPUNIT_TEST( testDerived );
- CPPUNIT_TEST( testJoin );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- class Delegate : public Runnable{
- private:
-
- int stuff;
-
- public:
-
- Delegate(){ stuff = 0; }
- virtual ~Delegate(){}
-
- int getStuff(){
- return stuff;
- }
-
- virtual void run(){
- stuff = 1;
- }
-
- };
-
- class Derived : public Thread{
- private:
-
- int stuff;
-
- public:
-
- Derived(){ stuff = 0; }
- virtual ~Derived(){}
-
- int getStuff(){
- return stuff;
- }
-
- virtual void run(){
- stuff = 1;
- }
-
- };
-
- class JoinTest : public Thread{
- public:
-
- JoinTest(){}
- virtual ~JoinTest(){}
-
- virtual void run(){
-
- // Sleep for 2 seconds.
- Thread::sleep( 2000 );
- }
-
- };
-
- public:
-
- virtual ~ThreadTest(){}
-
- virtual void setUp(){}
- virtual void tearDown(){}
-
- void testDelegate();
- void testDerived();
- void testJoin();
- };
-
-}}
-
-#endif /*_DECAF_LANG_THREADTEST_H_*/
diff --git a/src/decaf/src/test/decaf/net/SocketFactoryTest.cpp b/src/decaf/src/test/decaf/net/SocketFactoryTest.cpp
deleted file mode 100644
index 883fb78..0000000
--- a/src/decaf/src/test/decaf/net/SocketFactoryTest.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "SocketFactoryTest.h"
-
-#include <decaf/util/Properties.h>
-#include <decaf/net/SocketFactory.h>
-#include <decaf/net/TcpSocket.h>
-
-using namespace decaf;
-using namespace decaf::net;
-using namespace decaf::util;
-using namespace decaf::lang;
-using namespace decaf::util::concurrent;
-
-////////////////////////////////////////////////////////////////////////////////
-void SocketFactoryTest::test()
-{
- try
- {
- MyServerThread serverThread;
- serverThread.start();
-
- Thread::sleep( 500 );
-
- util::Properties properties;
-
- std::ostringstream ostream;
-
- ostream << "127.0.0.1:" << port;
-
- properties.setProperty("soLinger", "false");
-
- Socket* client = SocketFactory::createSocket(
- ostream.str(), properties );
-
- synchronized(&serverThread.mutex)
- {
- if(serverThread.getNumClients() != 1)
- {
- serverThread.mutex.wait(10000);
- }
- }
-
- CPPUNIT_ASSERT( client->isConnected() );
-
- CPPUNIT_ASSERT( serverThread.getNumClients() == 1 );
-
- client->close();
-
- synchronized(&serverThread.mutex)
- {
- if(serverThread.getNumClients() != 0)
- {
- serverThread.mutex.wait(10000);
- }
- }
-
- CPPUNIT_ASSERT( serverThread.getNumClients() == 0 );
-
- serverThread.stop();
- serverThread.join();
-
- delete client;
- }
- catch(lang::Exception ex)
- {
- std::cout << "SocketFactoryTest::test - Caught Exception." << std::endl;
- ex.printStackTrace();
- CPPUNIT_ASSERT( false );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SocketFactoryTest::testNoDelay()
-{
- try
- {
- MyServerThread serverThread;
- serverThread.start();
-
- Thread::sleep( 40 );
-
- util::Properties properties;
-
- std::ostringstream ostream;
-
- ostream << "127.0.0.1:" << port;
-
- properties.setProperty( "soLinger", "false" );
- properties.setProperty( "tcpNoDelay", "true" );
-
- Socket* client = SocketFactory::createSocket(
- ostream.str(), properties );
-
- TcpSocket* tcpSock = dynamic_cast<TcpSocket*>( client );
- CPPUNIT_ASSERT( tcpSock != NULL );
- CPPUNIT_ASSERT( tcpSock->getTcpNoDelay() == true );
-
- synchronized(&serverThread.mutex)
- {
- if(serverThread.getNumClients() != 1)
- {
- serverThread.mutex.wait(1000);
- }
- }
-
- CPPUNIT_ASSERT( client->isConnected() );
-
- CPPUNIT_ASSERT( serverThread.getNumClients() == 1 );
-
- client->close();
-
- synchronized(&serverThread.mutex)
- {
- if(serverThread.getNumClients() != 0)
- {
- serverThread.mutex.wait(1000);
- }
- }
-
- CPPUNIT_ASSERT( serverThread.getNumClients() == 0 );
-
- serverThread.stop();
- serverThread.join();
-
- delete client;
- }
- catch(lang::Exception ex)
- {
- CPPUNIT_ASSERT( false );
- }
-}
diff --git a/src/decaf/src/test/decaf/net/SocketFactoryTest.h b/src/decaf/src/test/decaf/net/SocketFactoryTest.h
deleted file mode 100644
index 8562bfb..0000000
--- a/src/decaf/src/test/decaf/net/SocketFactoryTest.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_SOCKETFACTORYTEST_H_
-#define _DECAF_NET_SOCKETFACTORYTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/net/Socket.h>
-#include <decaf/net/ServerSocket.h>
-#include <decaf/util/concurrent/Concurrent.h>
-#include <decaf/util/concurrent/Mutex.h>
-#include <decaf/lang/Thread.h>
-
-#include <sstream>
-
-namespace decaf{
-namespace net{
-
- class SocketFactoryTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( SocketFactoryTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST( testNoDelay );
- CPPUNIT_TEST_SUITE_END();
-
- static const int port = 23232;
-
- class MyServerThread : public lang::Thread{
- private:
-
- bool done;
- int numClients;
- std::string lastMessage;
-
- public:
-
- util::concurrent::Mutex mutex;
-
- public:
-
- MyServerThread(){
- done = false;
- numClients = 0;
- }
- virtual ~MyServerThread(){
- stop();
- }
-
- std::string getLastMessage(){
- return lastMessage;
- }
-
- int getNumClients(){
- return numClients;
- }
-
- virtual void stop(){
- done = true;
- }
-
- virtual void run(){
- try{
- unsigned char buf[1000];
-
- ServerSocket server;
- server.bind( "127.0.0.1", port );
-
- net::Socket* socket = server.accept();
- server.close();
-
- socket->setSoLinger( false );
-
- synchronized(&mutex)
- {
- numClients++;
- mutex.notifyAll();
- }
-
- while( !done && socket != NULL ){
-
- io::InputStream* stream = socket->getInputStream();
- memset( buf, 0, 1000 );
- try{
- if( stream->read( buf, 1000 ) == -1 ) {
- done = true;
- continue;
- }
-
- lastMessage = (char*)buf;
-
- if( strcmp( (char*)buf, "reply" ) == 0 ){
- io::OutputStream* output = socket->getOutputStream();
- output->write( (unsigned char*)"hello", strlen("hello" ) );
- }
-
- }catch( io::IOException& ex ){
- done = true;
- }
- }
-
- socket->close();
- delete socket;
-
- numClients--;
-
- synchronized(&mutex)
- {
- mutex.notifyAll();
- }
-
- }catch( io::IOException& ex ){
- printf("%s\n", ex.getMessage().c_str() );
- CPPUNIT_ASSERT( false );
- }catch( ... ){
- CPPUNIT_ASSERT( false );
- }
- }
- };
-
- public:
-
- SocketFactoryTest() {}
- virtual ~SocketFactoryTest() {}
-
- void test();
- void testNoDelay();
-
- };
-
-}}
-
-#endif /*_DECAF_NET_SOCKETFACTORYTEST_H_*/
diff --git a/src/decaf/src/test/decaf/net/SocketTest.cpp b/src/decaf/src/test/decaf/net/SocketTest.cpp
deleted file mode 100644
index 97122bf..0000000
--- a/src/decaf/src/test/decaf/net/SocketTest.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "SocketTest.h"
-
-#include <decaf/net/TcpSocket.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::net;
-using namespace decaf::util;
-using namespace decaf::lang;
-
-////////////////////////////////////////////////////////////////////////////////
-void SocketTest::testConnect() {
-
- try{
-
- MyServerThread serverThread;
- serverThread.start();
-
- Thread::sleep( 40 );
-
- TcpSocket client;
-
- client.connect("127.0.0.1", port);
- client.setSoLinger( false );
-
- synchronized(&serverThread.mutex)
- {
- if(serverThread.getNumClients() != 1)
- {
- serverThread.mutex.wait(1000);
- }
- }
-
- CPPUNIT_ASSERT( serverThread.getNumClients() == 1 );
-
- client.close();
-
- synchronized(&serverThread.mutex)
- {
- if(serverThread.getNumClients() != 0)
- {
- serverThread.mutex.wait(1000);
- }
- }
-
- CPPUNIT_ASSERT( serverThread.getNumClients() == 0 );
-
- serverThread.stop();
- serverThread.join();
-
- }catch( io::IOException& ex ){
- printf( "%s\n", ex.getMessage().c_str() );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SocketTest::testTx() {
-
- try{
-
- MyServerThread serverThread;
- serverThread.start();
-
- Thread::sleep( 10 );
-
- TcpSocket client;
-
- client.connect("127.0.0.1", port);
- client.setSoLinger( false );
-
- synchronized(&serverThread.mutex)
- {
- if(serverThread.getNumClients() != 1)
- {
- serverThread.mutex.wait(1000);
- }
- }
-
- CPPUNIT_ASSERT( serverThread.getNumClients() == 1 );
-
- io::OutputStream* stream = client.getOutputStream();
-
- std::string msg = "don't reply";
- stream->write( (unsigned char*)msg.c_str(), msg.length() );
-
- Thread::sleep( 10 );
-
- CPPUNIT_ASSERT( serverThread.getLastMessage() == msg );
-
- client.close();
-
- synchronized(&serverThread.mutex)
- {
- if(serverThread.getNumClients() != 0)
- {
- serverThread.mutex.wait(1000);
- }
- }
-
- CPPUNIT_ASSERT( serverThread.getNumClients() == 0 );
-
- serverThread.stop();
- serverThread.join();
-
- }catch( io::IOException& ex ){
- printf( "%s\n", ex.getMessage().c_str() );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SocketTest::testTrx() {
-
- try{
-
- MyServerThread serverThread;
- serverThread.start();
-
- Thread::sleep( 10 );
-
- TcpSocket client;
-
- client.connect("127.0.0.1", port);
- client.setSoLinger(false);
-
- synchronized(&serverThread.mutex)
- {
- if(serverThread.getNumClients() != 1)
- {
- serverThread.mutex.wait(1000);
- }
- }
-
- CPPUNIT_ASSERT( serverThread.getNumClients() == 1 );
-
- io::OutputStream* stream = client.getOutputStream();
-
- std::string msg = "reply";
- stream->write( (unsigned char*)msg.c_str(), msg.length() );
-
- synchronized(&serverThread.mutex)
- {
- serverThread.mutex.wait(300);
- }
-
- unsigned char buf[500];
- memset( buf, 0, 500 );
- io::InputStream* istream = client.getInputStream();
- std::size_t numRead = istream->read( buf, 500 );
- CPPUNIT_ASSERT( numRead == 5 );
- CPPUNIT_ASSERT( strcmp( (char*)buf, "hello" ) == 0 );
-
- client.close();
-
- serverThread.stop();
- serverThread.join();
-
- }catch( io::IOException& ex ){
- printf( "%s\n", ex.getMessage().c_str() );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SocketTest::testRxFail() {
-
- try{
-
- MyServerThread serverThread;
- serverThread.start();
-
- Thread::sleep( 10 );
-
- TcpSocket client;
-
- client.connect("127.0.0.1", port);
- client.setSoLinger( false );
-
- synchronized(&serverThread.mutex)
- {
- if(serverThread.getNumClients() != 1)
- {
- serverThread.mutex.wait(1000);
- }
- }
-
- CPPUNIT_ASSERT( serverThread.getNumClients() == 1 );
-
- // Give it a chance to get to its read call
- Thread::sleep( 100 );
-
- client.close();
-
- synchronized(&serverThread.mutex)
- {
- if(serverThread.getNumClients() != 0)
- {
- serverThread.mutex.wait(1000);
- }
- }
-
- CPPUNIT_ASSERT( serverThread.getNumClients() == 0 );
-
- serverThread.stop();
- serverThread.join();
-
- }catch( io::IOException& ex ){
- printf( "%s\n", ex.getMessage().c_str() );
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SocketTest::testTrxNoDelay() {
-
- try{
-
- MyServerThread serverThread;
- serverThread.start();
-
- Thread::sleep( 10 );
-
- TcpSocket client;
-
- client.connect("127.0.0.1", port);
- client.setSoLinger(false);
- client.setTcpNoDelay(true);
-
- CPPUNIT_ASSERT( client.getTcpNoDelay() == true );
-
- synchronized(&serverThread.mutex)
- {
- if(serverThread.getNumClients() != 1)
- {
- serverThread.mutex.wait(1000);
- }
- }
-
- CPPUNIT_ASSERT( serverThread.getNumClients() == 1 );
-
- io::OutputStream* stream = client.getOutputStream();
-
- std::string msg = "reply";
- stream->write( (unsigned char*)msg.c_str(), msg.length() );
-
- synchronized(&serverThread.mutex)
- {
- serverThread.mutex.wait(300);
- }
-
- unsigned char buf[500];
- memset( buf, 0, 500 );
- io::InputStream* istream = client.getInputStream();
- std::size_t numRead = istream->read( buf, 500 );
- CPPUNIT_ASSERT( numRead == 5 );
- CPPUNIT_ASSERT( strcmp( (char*)buf, "hello" ) == 0 );
-
- client.close();
-
- serverThread.stop();
- serverThread.join();
-
- }catch( io::IOException& ex ){
- printf( "%s\n", ex.getMessage().c_str() );
- }
-}
diff --git a/src/decaf/src/test/decaf/net/SocketTest.h b/src/decaf/src/test/decaf/net/SocketTest.h
deleted file mode 100644
index b9bba61..0000000
--- a/src/decaf/src/test/decaf/net/SocketTest.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_SOCKETTEST_H_
-#define _DECAF_NET_SOCKETTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/net/ServerSocket.h>
-#include <decaf/util/concurrent/Concurrent.h>
-#include <decaf/util/concurrent/Mutex.h>
-#include <decaf/lang/Thread.h>
-#include <list>
-#include <string.h>
-
-namespace decaf{
-namespace net{
-
- class SocketTest : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE( SocketTest );
- CPPUNIT_TEST( testConnect );
- CPPUNIT_TEST( testTx );
- CPPUNIT_TEST( testTrx );
- CPPUNIT_TEST( testTrxNoDelay );
- CPPUNIT_TEST( testRxFail );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- static const int port = 23232;
-
- class MyServerThread : public lang::Thread{
- private:
-
- bool done;
- int numClients;
- std::string lastMessage;
-
- public:
-
- util::concurrent::Mutex mutex;
-
- public:
-
- MyServerThread(){
- done = false;
- numClients = 0;
- }
-
- virtual ~MyServerThread(){
- stop();
- }
-
- std::string getLastMessage(){
- return lastMessage;
- }
-
- int getNumClients(){
- return numClients;
- }
-
- virtual void stop(){
- done = true;
- }
-
- virtual void run(){
- try{
- unsigned char buf[1000];
-
- ServerSocket server;
- server.bind( "127.0.0.1", port );
-
- Socket* socket = server.accept();
- server.close();
-
- //socket->setSoTimeout( 10 );
- socket->setSoLinger( false );
- numClients++;
-
- synchronized(&mutex)
- {
- mutex.notifyAll();
- }
-
- while( !done && socket != NULL ){
-
- io::InputStream* stream = socket->getInputStream();
-
- memset( buf, 0, 1000 );
- try{
-
- if( stream->read( buf, 1000 ) == -1 ) {
- done = true;
- continue;
- }
-
- lastMessage = (char*)buf;
-
- if( strcmp( (char*)buf, "reply" ) == 0 ){
- io::OutputStream* output = socket->getOutputStream();
- output->write( (unsigned char*)"hello", strlen("hello" ) );
-
- synchronized(&mutex)
- {
- mutex.notifyAll();
- }
- }
-
- }catch( io::IOException& ex ){
- done = true;
- }
- }
-
- socket->close();
- delete socket;
-
- numClients--;
-
- synchronized(&mutex)
- {
- mutex.notifyAll();
- }
-
- }catch( io::IOException& ex ){
- printf("%s\n", ex.getMessage().c_str() );
- CPPUNIT_ASSERT( false );
- }catch( ... ){
- CPPUNIT_ASSERT( false );
- }
- }
-
- };
-
- public:
-
- virtual ~SocketTest() {}
-
- void testConnect();
- void testTx();
- void testTrx();
- void testRxFail();
- void testTrxNoDelay();
-
- };
-
-}}
-
-#endif /*_DECAF_NET_SOCKETTEST_H_*/
diff --git a/src/decaf/src/test/decaf/net/URISyntaxExceptionTest.cpp b/src/decaf/src/test/decaf/net/URISyntaxExceptionTest.cpp
deleted file mode 100644
index 191f769..0000000
--- a/src/decaf/src/test/decaf/net/URISyntaxExceptionTest.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "URISyntaxExceptionTest.h"
-
-#include <decaf/net/URISyntaxException.h>
-
-using namespace decaf;
-using namespace decaf::net;
-
-////////////////////////////////////////////////////////////////////////////////
-URISyntaxExceptionTest::URISyntaxExceptionTest() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void URISyntaxExceptionTest::test() {
-
- URISyntaxException e1( __FILE__, __LINE__, "str", "problem", 2);
- CPPUNIT_ASSERT_MESSAGE("returned incorrect reason",
- e1.getReason() == "problem" );
- CPPUNIT_ASSERT_MESSAGE("returned incorrect input", e1.getInput() == "str" );
- CPPUNIT_ASSERT_MESSAGE("returned incorrect index", 2 == e1.getIndex());
-
- URISyntaxException e2( __FILE__, __LINE__, "str", "problem");
- CPPUNIT_ASSERT_MESSAGE("returned incorrect reason", e2.getReason() == "problem" );
- CPPUNIT_ASSERT_MESSAGE("returned incorrect input", e2.getInput() == "str" );
- CPPUNIT_ASSERT_MESSAGE("returned incorrect index", -1 == e2.getIndex());
-}
diff --git a/src/decaf/src/test/decaf/net/URISyntaxExceptionTest.h b/src/decaf/src/test/decaf/net/URISyntaxExceptionTest.h
deleted file mode 100644
index a2df0fe..0000000
--- a/src/decaf/src/test/decaf/net/URISyntaxExceptionTest.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_URISYNTAXEXCEPTIONTEST_H_
-#define _DECAF_NET_URISYNTAXEXCEPTIONTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-namespace decaf{
-namespace net{
-
- class URISyntaxExceptionTest : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE( URISyntaxExceptionTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- URISyntaxExceptionTest();
- virtual ~URISyntaxExceptionTest() {}
-
- void test();
- };
-
-}}
-
-#endif /*_DECAF_NET_URISYNTAXEXCEPTIONTEST_H_*/
diff --git a/src/decaf/src/test/decaf/net/URITest.cpp b/src/decaf/src/test/decaf/net/URITest.cpp
deleted file mode 100644
index 6c89315..0000000
--- a/src/decaf/src/test/decaf/net/URITest.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "URITest.h"
-
-#include <decaf/net/URI.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::net;
-using namespace decaf::lang;
-using namespace decaf::lang::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-URITest::URITest() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void URITest::test_Constructor_String() {
-
-// const std::string constructorTests[27] = {
-// "http://user@www.google.com:45/search?q=helpinfo#somefragment",
-// // http with authority, query and fragment
-// "ftp://ftp.is.co.za/rfc/rfc1808.txt", // ftp
-// "gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles",
-// // gopher
-// "mailto:mduerst@ifi.unizh.ch", // mailto
-// "news:comp.infosystems.www.servers.unix", // news
-// "telnet://melvyl.ucop.edu/", // telnet
-// "http://123.24.17.98/test", // IPv4 authority
-// "http://www.google.com:80/test",// domain name authority
-// "http://joe@[3ffe:2a00:100:7031::1]:80/test",
-// // IPv6 authority, with userinfo and port
-// "/relative", // relative starting with /
-// "//relative", // relative starting with //
-// "relative", // relative with no /
-// "#fragment",// relative just with fragment
-// "http://user@host:80", // UI, host,port
-// "http://user@host", // ui, host
-// "http://host", // host
-// "http://host:80", // host,port
-// "http://joe@:80", // ui, port (becomes registry-based)
-// "file:///foo/bar", // empty authority, non empty path
-// "ht?tp://hoe@host:80", // miscellaneous tests
-// "mai/lto:hey?joe#man", "http://host/a%20path#frag",
-// // path with an escaped octet for space char
-// "http://host/a%E2%82%ACpath#frag",
-// // path with escaped octet for unicode char, not USASCII
-// "http://host/a\u20ACpath#frag",
-// // path with unicode char, not USASCII equivalent to
-// // = "http://host/a\u0080path#frag",
-// "http://host%20name/", // escaped octets in host (becomes
-// // registry based)
-// "http://host\u00DFname/", // unicodechar in host (becomes
-// // registry based)
-// // equivalent to = "http://host\u00dfname/",
-// "ht123-+tp://www.google.com:80/test", // legal chars in scheme
-// };
-//
-// for( int i = 0; i < 27; i++ ) {
-// try {
-// new URI(constructorTests[i]);
-// } catch ( URISyntaxException e ) {
-// CPPUNIT_FAIL( string( "Failed to construct URI for: " ) +
-// constructorTests[i] + " : " +
-// e.getMessage() );
-// }
-// }
-
- std::vector<const char*> constructorTestsInvalid;
- // space char in path, not in escaped
- constructorTestsInvalid.push_back( "http:///a path#frag" );
- // octet form, with no host
- constructorTestsInvalid.push_back( "http://host/a[path#frag" );
- // an illegal char, not in escaped octet form, should throw an exception
- // invalid escape sequence in path
- constructorTestsInvalid.push_back( "http://host/a%path#frag" );
- // incomplete escape sequence in path
- constructorTestsInvalid.push_back( "http://host/a%#frag" );
- // space char in fragment, not in
- constructorTestsInvalid.push_back( "http://host#a frag" );
- // escaped octet form, no path
- // illegal char in fragment
- constructorTestsInvalid.push_back( "http://host/a#fr#ag" );
- // invalid escape sequence in fragment,
- constructorTestsInvalid.push_back( "http:///path#fr%ag" );
- // with no host
- // incomplete escape sequence in fragment
- constructorTestsInvalid.push_back( "http://host/path#frag%" );
- // space char in query, not in escaped octet form
- constructorTestsInvalid.push_back( "http://host/path?a query#frag" );
- // invalid escape sequence in query, no path
- constructorTestsInvalid.push_back( "http://host?query%ag" );
- // incomplete escape sequence in query, with no host
- constructorTestsInvalid.push_back( "http:///path?query%" );
- // invalid char in scheme specific part
- constructorTestsInvalid.push_back( "mailto:user^name@fklkf.com" );
-
-// for( size_t i = 0; i < constructorTestsInvalid.size(); i++ ) {
-// try {
-// new URI( constructorTestsInvalid[i] );
-// CPPUNIT_FAIL( string( "Failed to throw URISyntaxException for: " ) +
-// constructorTestsInvalid[i] );
-// } catch( URISyntaxException e ) {}
-// }
-
-// std::string invalid2[18] = {
-// // authority validation
-// "http://user@[3ffe:2x00:100:7031::1]:80/test", // malformed
-// // IPv6 authority
-// "http://[ipv6address]/apath#frag", // malformed ipv6 address
-// "http://[ipv6address/apath#frag", // malformed ipv6 address
-// "http://ipv6address]/apath#frag", // illegal char in host name
-// "http://ipv6[address/apath#frag",
-// "http://ipv6addr]ess/apath#frag",
-// "http://ipv6address[]/apath#frag",
-// // illegal char in username...
-// "http://us[]er@host/path?query#frag", "http://host name/path", // illegal
-// // char
-// // in
-// // authority
-// "http://host^name#fragment", // illegal char in authority
-// "telnet://us er@hostname/", // illegal char in authority
-// // missing components
-// "//", // Authority expected
-// "ascheme://", // Authority expected
-// "ascheme:", // Scheme-specific part expected
-// // scheme validation
-// "a scheme://reg/", // illegal char
-// "1scheme://reg/", // non alpha char as 1st char
-// "asche\u00dfme:ssp", // unicode char , not USASCII
-// "asc%20heme:ssp" // escape octets
-// };
-//
-// for( int i = 0; i < 18; i++ ) {
-// try {
-// new URI( invalid2[i] );
-// CPPUNIT_FAIL(
-// string( "Failed to throw URISyntaxException for: " ) + invalid2[i] );
-// } catch( URISyntaxException e ) {}
-// }
-}
diff --git a/src/decaf/src/test/decaf/net/URITest.h b/src/decaf/src/test/decaf/net/URITest.h
deleted file mode 100644
index 5cf0628..0000000
--- a/src/decaf/src/test/decaf/net/URITest.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_NET_URITEST_H_
-#define _DECAF_NET_URITEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-namespace decaf{
-namespace net{
-
- class URITest : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE( URITest );
- CPPUNIT_TEST( test_Constructor_String );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- URITest();
- virtual ~URITest() {}
-
- void test_Constructor_String();
-
- };
-
-}}
-
-#endif /*_DECAF_NET_URITEST_H_*/
diff --git a/src/decaf/src/test/decaf/util/DateTest.cpp b/src/decaf/src/test/decaf/util/DateTest.cpp
deleted file mode 100644
index 7d06df1..0000000
--- a/src/decaf/src/test/decaf/util/DateTest.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "DateTest.h"
-
-#include <decaf/util/Date.h>
-#include <decaf/lang/Thread.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::util;
-using namespace decaf::lang;
-
-void DateTest::test(){
-
- Date date1;
- CPPUNIT_ASSERT( date1.getTime() != 0 );
-
- decaf::lang::Thread::sleep(55);
-
- Date date2;
-
- CPPUNIT_ASSERT( date1.before(date2) == true );
- CPPUNIT_ASSERT( date1.after(date2) == false );
-
- Date date3 = date1;
- CPPUNIT_ASSERT( date1.equals( date3 ) == true );
-}
diff --git a/src/decaf/src/test/decaf/util/DateTest.h b/src/decaf/src/test/decaf/util/DateTest.h
deleted file mode 100644
index bd37140..0000000
--- a/src/decaf/src/test/decaf/util/DateTest.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_DATETEST_H_
-#define _DECAF_UTIL_DATETEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-namespace decaf{
-namespace util{
-
- class DateTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( DateTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
- DateTest(){};
- virtual ~DateTest(){};
-
- void test();
-
- };
-
-}}
-
-#endif /*_DECAF_UTIL_DATETEST_H_*/
diff --git a/src/decaf/src/test/decaf/util/Endian.cpp b/src/decaf/src/test/decaf/util/Endian.cpp
deleted file mode 100644
index af11202..0000000
--- a/src/decaf/src/test/decaf/util/Endian.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Endian.h"
-#include <decaf/util/Config.h>
-#include <string.h>
-
-using namespace decaf;
-using namespace decaf::util;
-
-////////////////////////////////////////////////////////////////////////////////
-void Endian::byteSwap(unsigned char* data, int dataLength) {
-
- #ifdef WORDS_BIGENDIAN
- return;
- #endif
-
- for (int i = 0; i<dataLength/2; i++) {
- unsigned char temp = data[i];
- data[i] = data[dataLength-1-i];
- data[dataLength-1-i] = temp;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned char Endian::byteSwap( unsigned char value ){
-
- #ifdef WORDS_BIGENDIAN
- return value;
- #endif
-
- return value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned short Endian::byteSwap( unsigned short value ){
-
- #ifdef WORDS_BIGENDIAN
- return value;
- #endif
-
- return (((unsigned short)value & 0xFF00 ) >> 8 ) |
- (((unsigned short)value & 0x00FF ) << 8 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned int Endian::byteSwap( unsigned int value ){
-
- #ifdef WORDS_BIGENDIAN
- return value;
- #endif
-
- return (((unsigned int)value & 0xFF000000 ) >> 24 ) |
- (((unsigned int)value & 0x00FF0000 ) >> 8 ) |
- (((unsigned int)value & 0x0000FF00 ) << 8 ) |
- (((unsigned int)value & 0x000000FF ) << 24 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned long long Endian::byteSwap( unsigned long long value ){
-
- #ifdef WORDS_BIGENDIAN
- return value;
- #endif
-
- return (((unsigned long long)value & 0xFF00000000000000ULL ) >> 56 ) |
- (((unsigned long long)value & 0x00FF000000000000ULL ) >> 40 ) |
- (((unsigned long long)value & 0x0000FF0000000000ULL ) >> 24 ) |
- (((unsigned long long)value & 0x000000FF00000000ULL ) >> 8 ) |
- (((unsigned long long)value & 0x00000000FF000000ULL ) << 8 ) |
- (((unsigned long long)value & 0x0000000000FF0000ULL ) << 24 ) |
- (((unsigned long long)value & 0x000000000000FF00ULL ) << 40 ) |
- (((unsigned long long)value & 0x00000000000000FFULL ) << 56 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-float Endian::byteSwap( float value ){
-
- #ifdef WORDS_BIGENDIAN
- return value;
- #endif
-
- unsigned int lvalue = 0;
- memcpy( &lvalue, &value, sizeof( float ) );
- lvalue = byteSwap( lvalue );
- memcpy( &value, &lvalue, sizeof( unsigned int ) );
- return value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-double Endian::byteSwap( double value ){
-
- #ifdef WORDS_BIGENDIAN
- return value;
- #endif
-
- unsigned long long lvalue = 0;
- memcpy( &lvalue, &value, sizeof( double ) );
- lvalue = byteSwap( lvalue );
- memcpy( &value, &lvalue, sizeof( unsigned long long ) );
- return value;
-}
-
diff --git a/src/decaf/src/test/decaf/util/Endian.h b/src/decaf/src/test/decaf/util/Endian.h
deleted file mode 100644
index 6c4eb58..0000000
--- a/src/decaf/src/test/decaf/util/Endian.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _DECAF_UTIL_ENDIAN_H
-#define _DECAF_UTIL_ENDIAN_H
-
-namespace decaf{
-namespace util{
-
- class Endian{
- public:
-
- static void byteSwap(unsigned char* data, int dataLength);
-
- static unsigned char byteSwap( unsigned char value );
-
- static unsigned short byteSwap( unsigned short value );
-
- static unsigned int byteSwap( unsigned int value );
-
- static unsigned long long byteSwap( unsigned long long value );
-
- static float byteSwap( float value );
-
- static double byteSwap( double value );
- };
-
-}}
-
-#endif /*_DECAF_UTIL_ENDIAN_H*/
diff --git a/src/decaf/src/test/decaf/util/MapTest.cpp b/src/decaf/src/test/decaf/util/MapTest.cpp
deleted file mode 100644
index f42b850..0000000
--- a/src/decaf/src/test/decaf/util/MapTest.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "MapTest.h"
-#include <string>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::util;
-
-////////////////////////////////////////////////////////////////////////////////
-MapTest::MapTest(){
-}
-
-////////////////////////////////////////////////////////////////////////////////
-MapTest::~MapTest(){
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MapTest::testContainsKey(){
-
- Map<string, bool> boolMap;
- CPPUNIT_ASSERT(boolMap.containsKey("bob") == false);
-
- boolMap.setValue( "bob", true );
-
- CPPUNIT_ASSERT(boolMap.containsKey("bob") == true );
- CPPUNIT_ASSERT(boolMap.containsKey("fred") == false );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MapTest::testClear(){
-
- Map<string, bool> boolMap;
- boolMap.setValue( "bob", true );
- boolMap.setValue( "fred", true );
-
- CPPUNIT_ASSERT(boolMap.size() == 2 );
- boolMap.clear();
- CPPUNIT_ASSERT(boolMap.size() == 0 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MapTest::testIsEmpty(){
-
- Map<string, bool> boolMap;
- boolMap.setValue( "bob", true );
- boolMap.setValue( "fred", true );
-
- CPPUNIT_ASSERT(boolMap.isEmpty() == false );
- boolMap.clear();
- CPPUNIT_ASSERT(boolMap.isEmpty() == true );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MapTest::testSize(){
-
- Map<string, bool> boolMap;
-
- CPPUNIT_ASSERT(boolMap.size() == 0 );
- boolMap.setValue( "bob", true );
- CPPUNIT_ASSERT(boolMap.size() == 1 );
- boolMap.setValue( "fred", true );
- CPPUNIT_ASSERT(boolMap.size() == 2 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MapTest::testValue(){
-
- Map<string, bool> boolMap;
-
- boolMap.setValue( "fred", true );
- CPPUNIT_ASSERT( boolMap.getValue("fred") == true );
-
- boolMap.setValue( "bob", false );
- CPPUNIT_ASSERT( boolMap.getValue("bob") == false );
- CPPUNIT_ASSERT( boolMap.getValue("fred") == true );
-
- try{
- boolMap.getValue( "mike" );
- CPPUNIT_ASSERT(false);
- } catch( decaf::lang::exceptions::NoSuchElementException& e ){
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MapTest::testRemove(){
- Map<string, bool> boolMap;
-
- boolMap.setValue( "fred", true );
- CPPUNIT_ASSERT( boolMap.containsKey("fred") == true );
- boolMap.remove( "fred" );
- CPPUNIT_ASSERT( boolMap.containsKey("fred") == false );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void MapTest::testContiansValue(){
- Map<string, bool> boolMap;
-
- boolMap.setValue( "fred", true );
- boolMap.setValue( "fred1", false );
- CPPUNIT_ASSERT( boolMap.containsValue(true) == true );
- boolMap.remove( "fred" );
- CPPUNIT_ASSERT( boolMap.containsValue(true) == false );
-}
diff --git a/src/decaf/src/test/decaf/util/MapTest.h b/src/decaf/src/test/decaf/util/MapTest.h
deleted file mode 100644
index ed57f73..0000000
--- a/src/decaf/src/test/decaf/util/MapTest.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_MAPTEST_H_
-#define _DECAF_UTIL_MAPTEST_H_
-
-#include <decaf/util/Map.h>
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-namespace decaf{
-namespace util{
-
- class MapTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( MapTest );
- CPPUNIT_TEST( testContainsKey );
- CPPUNIT_TEST( testClear );
- CPPUNIT_TEST( testSize );
- CPPUNIT_TEST( testValue );
- CPPUNIT_TEST( testRemove );
- CPPUNIT_TEST( testContiansValue );
- CPPUNIT_TEST( testIsEmpty );
- CPPUNIT_TEST_SUITE_END();
-
- public:
- MapTest();
- virtual ~MapTest();
-
- void testContainsKey();
- void testClear();
- void testSize();
- void testValue();
- void testRemove();
- void testContiansValue();
- void testIsEmpty();
-
- };
-
-}}
-
-#endif /*_DECAF_UTIL_MAPTEST_H_*/
diff --git a/src/decaf/src/test/decaf/util/QueueTest.cpp b/src/decaf/src/test/decaf/util/QueueTest.cpp
deleted file mode 100644
index f0a7fda..0000000
--- a/src/decaf/src/test/decaf/util/QueueTest.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "QueueTest.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::util;
-
-////////////////////////////////////////////////////////////////////////////////
-void QueueTest::test()
-{
- Queue<char> q;
-
- CPPUNIT_ASSERT( q.empty() == true );
- CPPUNIT_ASSERT( q.size() == 0 );
-
- q.push('a');
-
- CPPUNIT_ASSERT( q.front() == 'a' );
-
- q.pop();
-
- CPPUNIT_ASSERT( q.empty() == true );
-
- q.push('b');
- q.push('c');
-
- CPPUNIT_ASSERT( q.size() == 2 );
-
- CPPUNIT_ASSERT( q.front() == 'b' );
- CPPUNIT_ASSERT( q.back() == 'c' );
-}
diff --git a/src/decaf/src/test/decaf/util/QueueTest.h b/src/decaf/src/test/decaf/util/QueueTest.h
deleted file mode 100644
index a57ce40..0000000
--- a/src/decaf/src/test/decaf/util/QueueTest.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_QUEUETEST_H_
-#define _DECAF_UTIL_QUEUETEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/util/Queue.h>
-
-namespace decaf{
-namespace util{
-
- class QueueTest : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE( QueueTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- virtual ~QueueTest() {}
-
- void test();
- };
-
-}}
-
-#endif /*_DECAF_UTIL_QUEUETEST_H_*/
diff --git a/src/decaf/src/test/decaf/util/RandomTest.cpp b/src/decaf/src/test/decaf/util/RandomTest.cpp
deleted file mode 100644
index 79e5383..0000000
--- a/src/decaf/src/test/decaf/util/RandomTest.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "RandomTest.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::util;
-
-void RandomTest::test(){
-
- Random rand(122760);
- CPPUNIT_ASSERT_EQUAL(-1524104671, rand.nextInt());
- CPPUNIT_ASSERT_EQUAL(2785759620113032781LL, rand.nextLong());
- CPPUNIT_ASSERT_EQUAL(rand.nextDouble(), 0.8173322904425151);
- CPPUNIT_ASSERT_EQUAL(rand.nextFloat(), 0.8239248f);
-
- std::vector<unsigned char> b(0);
- rand.nextBytes(b);
- CPPUNIT_ASSERT_EQUAL(-899478426, rand.nextInt());
-
- rand = Random(122760);
- rand.nextInt();
- rand.nextLong();
- rand.nextDouble();
- rand.nextFloat();
- b = std::vector<unsigned char>(3);
- rand.nextBytes(b);
- CPPUNIT_ASSERT_EQUAL((unsigned char)102, b[0]);
- CPPUNIT_ASSERT_EQUAL((unsigned char)12, b[1]);
- CPPUNIT_ASSERT_EQUAL((unsigned char)99, b[2]);
- CPPUNIT_ASSERT_EQUAL(-1550323395, rand.nextInt());
-
- rand = Random(122760);
- rand.nextInt();
- rand.nextLong();
- rand.nextDouble();
- rand.nextFloat();
- b = std::vector<unsigned char>(4);
- rand.nextBytes(b);
- CPPUNIT_ASSERT_EQUAL((unsigned char)102, b[0]);
- CPPUNIT_ASSERT_EQUAL((unsigned char)12, b[1]);
- CPPUNIT_ASSERT_EQUAL((unsigned char)99, b[2]);
- CPPUNIT_ASSERT_EQUAL((unsigned char)-54, b[3]);
- CPPUNIT_ASSERT_EQUAL(-1550323395, rand.nextInt());
-
- rand = Random(122760);
- rand.nextInt();
- rand.nextLong();
- rand.nextDouble();
- rand.nextFloat();
- b = std::vector<unsigned char>(5);
- rand.nextBytes(b);
- CPPUNIT_ASSERT_EQUAL((unsigned char)102, b[0]);
- CPPUNIT_ASSERT_EQUAL((unsigned char)12, b[1]);
- CPPUNIT_ASSERT_EQUAL((unsigned char)99, b[2]);
- CPPUNIT_ASSERT_EQUAL((unsigned char)-54, b[3]);
- CPPUNIT_ASSERT_EQUAL((unsigned char)61, b[4]);
- CPPUNIT_ASSERT_EQUAL(-270809961, rand.nextInt());
-
- bool ok = true;
- rand = Random(0);
- for (int i=0; i < 1000000; ++i) {
- int x = rand.nextInt(1000);
- if (x < 0 || x >= 1000) {
- ok = false;
- }
- }
- CPPUNIT_ASSERT(ok);
-}
diff --git a/src/decaf/src/test/decaf/util/RandomTest.h b/src/decaf/src/test/decaf/util/RandomTest.h
deleted file mode 100644
index 10c6acd..0000000
--- a/src/decaf/src/test/decaf/util/RandomTest.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_RANDOMTEST_H_
-#define _DECAF_UTIL_RANDOMTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/util/Random.h>
-
-namespace decaf{
-namespace util{
-
- class RandomTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( RandomTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- RandomTest(){}
- virtual ~RandomTest(){}
-
- void test();
- };
-
-}}
-
-#endif /*_DECAF_UTIL_RANDOMTEST_H_*/
diff --git a/src/decaf/src/test/decaf/util/SetTest.cpp b/src/decaf/src/test/decaf/util/SetTest.cpp
deleted file mode 100644
index a841d0f..0000000
--- a/src/decaf/src/test/decaf/util/SetTest.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "SetTest.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::util;
-
-////////////////////////////////////////////////////////////////////////////////
-SetTest::SetTest(){
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SetTest::testContains(){
-
- Set<string> set;
- CPPUNIT_ASSERT( set.contains( "bob" ) == false);
-
- set.add( "bob" );
-
- CPPUNIT_ASSERT(set.contains( "bob" ) == true );
- CPPUNIT_ASSERT(set.contains( "fred" ) == false );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SetTest::testClear(){
-
- Set<string> set;
- set.add( "bob" );
- set.add( "fred" );
-
- CPPUNIT_ASSERT( set.size() == 2 );
- set.clear();
- CPPUNIT_ASSERT( set.size() == 0 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SetTest::testIsEmpty(){
-
- Set<string> set;
- set.add( "bob" );
- set.add( "fred" );
-
- CPPUNIT_ASSERT(set.isEmpty() == false );
- set.clear();
- CPPUNIT_ASSERT(set.isEmpty() == true );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SetTest::testSize(){
-
- Set<string> set;
-
- CPPUNIT_ASSERT( set.size() == 0 );
- set.add( "bob" );
- CPPUNIT_ASSERT( set.size() == 1 );
- set.add( "fred" );
- CPPUNIT_ASSERT( set.size() == 2 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SetTest::testAdd(){
- Set<string> set;
-
- set.add( "fred" );
- set.add( "fred" );
- set.add( "fred" );
- CPPUNIT_ASSERT( set.contains("fred") == true );
- CPPUNIT_ASSERT( set.size() == 1 );
- set.remove( "fred" );
- CPPUNIT_ASSERT( set.contains("fred") == false );
- CPPUNIT_ASSERT( set.isEmpty() );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SetTest::testRemove(){
- Set<string> set;
-
- set.add( "fred" );
- CPPUNIT_ASSERT( set.contains( "fred" ) == true );
- set.remove( "fred" );
- CPPUNIT_ASSERT( set.contains( "fred" ) == false );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SetTest::testToArray(){
-
- Set<string> set;
-
- set.add( "fred1" );
- set.add( "fred2" );
- set.add( "fred3" );
- CPPUNIT_ASSERT( set.size() == 3 );
-
- std::vector<std::string> array = set.toArray();
-
- CPPUNIT_ASSERT( array.size() == 3 );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void SetTest::testIterator(){
-
- Set<string> set;
-
- set.add( "fred1" );
- set.add( "fred2" );
- set.add( "fred3" );
-
- Iterator<string>* iterator1 = set.iterator();
- CPPUNIT_ASSERT( iterator1 != NULL );
- CPPUNIT_ASSERT( iterator1->hasNext() == true );
-
- size_t count = 0;
- while( iterator1->hasNext() ) {
- iterator1->next();
- ++count;
- }
-
- CPPUNIT_ASSERT( count == set.size() );
-
- Iterator<string>* iterator2 = set.iterator();
-
- while( iterator2->hasNext() ) {
- iterator2->next();
- iterator2->remove();
- }
-
- CPPUNIT_ASSERT( set.isEmpty() );
-
- delete iterator1;
- delete iterator2;
-}
diff --git a/src/decaf/src/test/decaf/util/SetTest.h b/src/decaf/src/test/decaf/util/SetTest.h
deleted file mode 100644
index dd2e0d8..0000000
--- a/src/decaf/src/test/decaf/util/SetTest.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_SETTEST_H_
-#define _DECAF_UTIL_SETTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/util/Set.h>
-#include <decaf/util/Iterator.h>
-
-namespace decaf{
-namespace util{
-
- class SetTest : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( SetTest );
- CPPUNIT_TEST( testContains );
- CPPUNIT_TEST( testClear );
- CPPUNIT_TEST( testSize );
- CPPUNIT_TEST( testAdd );
- CPPUNIT_TEST( testRemove );
- CPPUNIT_TEST( testIsEmpty );
- CPPUNIT_TEST( testToArray );
- CPPUNIT_TEST( testIterator );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- SetTest();
- virtual ~SetTest() {}
-
- void testContains();
- void testClear();
- void testSize();
- void testAdd();
- void testRemove();
- void testIsEmpty();
- void testToArray();
- void testIterator();
-
- };
-
-}}
-
-#endif /*_DECAF_UTIL_SETTEST_H_*/
diff --git a/src/decaf/src/test/decaf/util/StringTokenizerTest.cpp b/src/decaf/src/test/decaf/util/StringTokenizerTest.cpp
deleted file mode 100644
index 89930f4..0000000
--- a/src/decaf/src/test/decaf/util/StringTokenizerTest.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "StringTokenizerTest.h"
-#include <decaf/util/StringTokenizer.h>
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::util;
-
-////////////////////////////////////////////////////////////////////////////////
-void StringTokenizerTest::test()
-{
- StringTokenizer tokenizer("stomp://127.0.0.1:23232", "://");
- CPPUNIT_ASSERT( tokenizer.countTokens() == 3 );
- CPPUNIT_ASSERT( tokenizer.nextToken() == "stomp" );
- CPPUNIT_ASSERT( tokenizer.nextToken() == "127.0.0.1" );
- CPPUNIT_ASSERT( tokenizer.nextToken() == "23232" );
-
- StringTokenizer tokenizer1("::://stomp://127.0.0.1:23232:", ":/");
- CPPUNIT_ASSERT( tokenizer1.countTokens() == 3 );
- CPPUNIT_ASSERT( tokenizer1.nextToken() == "stomp" );
- CPPUNIT_ASSERT( tokenizer1.nextToken() == "127.0.0.1" );
- CPPUNIT_ASSERT( tokenizer1.nextToken() == "23232" );
-
- StringTokenizer tokenizer2("test");
- CPPUNIT_ASSERT( tokenizer2.countTokens() == 1 );
- CPPUNIT_ASSERT( tokenizer2.hasMoreTokens() == true );
- CPPUNIT_ASSERT( tokenizer2.nextToken() == "test" );
- CPPUNIT_ASSERT( tokenizer2.hasMoreTokens() == false );
-
- StringTokenizer tokenizer3(":", ":");
- CPPUNIT_ASSERT( tokenizer3.countTokens() == 0 );
- CPPUNIT_ASSERT( tokenizer3.hasMoreTokens() == false );
- CPPUNIT_ASSERT( tokenizer3.nextToken(" ") == ":" );
-
- try
- {
- tokenizer3.nextToken();
- CPPUNIT_ASSERT( false );
- }
- catch(lang::exceptions::NoSuchElementException ex)
- {
- CPPUNIT_ASSERT( true );
- }
-
- StringTokenizer tokenizer4("the quick brown fox");
- CPPUNIT_ASSERT( tokenizer4.countTokens() == 4 );
- CPPUNIT_ASSERT( tokenizer4.hasMoreTokens() == true );
- CPPUNIT_ASSERT( tokenizer4.nextToken() == "the" );
- CPPUNIT_ASSERT( tokenizer4.nextToken() == "quick" );
- CPPUNIT_ASSERT( tokenizer4.nextToken() == "brown" );
- CPPUNIT_ASSERT( tokenizer4.nextToken() == "fox" );
- CPPUNIT_ASSERT( tokenizer4.countTokens() == 0 );
- CPPUNIT_ASSERT( tokenizer4.hasMoreTokens() == false );
-
- StringTokenizer tokenizer5("the:quick:brown:fox", ":", true);
- CPPUNIT_ASSERT( tokenizer5.countTokens() == 7 );
- CPPUNIT_ASSERT( tokenizer5.hasMoreTokens() == true );
- CPPUNIT_ASSERT( tokenizer5.nextToken() == "the" );
- CPPUNIT_ASSERT( tokenizer5.nextToken() == ":" );
- CPPUNIT_ASSERT( tokenizer5.nextToken() == "quick" );
- CPPUNIT_ASSERT( tokenizer5.nextToken() == ":" );
- CPPUNIT_ASSERT( tokenizer5.nextToken() == "brown" );
- CPPUNIT_ASSERT( tokenizer5.nextToken() == ":" );
- CPPUNIT_ASSERT( tokenizer5.nextToken() == "fox" );
- CPPUNIT_ASSERT( tokenizer5.countTokens() == 0 );
- CPPUNIT_ASSERT( tokenizer5.hasMoreTokens() == false );
-
- std::vector<std::string> myArray;
- StringTokenizer tokenizer6("the:quick:brown:fox", ":");
- CPPUNIT_ASSERT( tokenizer6.countTokens() == 4 );
- CPPUNIT_ASSERT( tokenizer6.toArray(myArray) == 4 );
- CPPUNIT_ASSERT( tokenizer6.countTokens() == 0 );
- tokenizer6.reset();
- CPPUNIT_ASSERT( tokenizer6.countTokens() == 4 );
- tokenizer6.reset("the:quick:brown:fox", "$");
- CPPUNIT_ASSERT( tokenizer6.countTokens() == 1 );
- tokenizer6.reset("this$is$a$test");
- CPPUNIT_ASSERT( tokenizer6.countTokens() == 4 );
- tokenizer6.reset("this$is$a$test", "$", true);
- CPPUNIT_ASSERT( tokenizer6.countTokens() == 7 );
-}
diff --git a/src/decaf/src/test/decaf/util/StringTokenizerTest.h b/src/decaf/src/test/decaf/util/StringTokenizerTest.h
deleted file mode 100644
index 66d8776..0000000
--- a/src/decaf/src/test/decaf/util/StringTokenizerTest.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_STRINGTOKENIZERTEST_H_
-#define _DECAF_UTIL_STRINGTOKENIZERTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-namespace decaf{
-namespace util{
-
- class StringTokenizerTest : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE( StringTokenizerTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- virtual ~StringTokenizerTest() {}
-
- void test();
-
- };
-
-}}
-
-#endif /*_DECAF_UTIL_STRINGTOKENIZERTEST_H_*/
diff --git a/src/decaf/src/test/decaf/util/UUIDTest.cpp b/src/decaf/src/test/decaf/util/UUIDTest.cpp
deleted file mode 100644
index e2f5c5e..0000000
--- a/src/decaf/src/test/decaf/util/UUIDTest.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "UUIDTest.h"
-
-#include <decaf/util/UUID.h>
-
-using namespace decaf;
-using namespace decaf::util;
-
-////////////////////////////////////////////////////////////////////////////////
-UUIDTest::UUIDTest() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void UUIDTest::test() {
-
- std::string bytes = "ASDASFSADGSDGSDASFA";
-
- UUID randId = UUID::randomUUID();
- UUID bytesId = UUID::nameUUIDFromBytes( bytes.c_str(), bytes.size() );
-
- CPPUNIT_ASSERT( !( randId == bytesId ) );
- CPPUNIT_ASSERT( !( randId.equals( bytesId ) ) );
- CPPUNIT_ASSERT( randId.compareTo( bytesId ) != 0 );
-
- std::string uuidStr = randId.toString();
-
- UUID strId = UUID::fromString( uuidStr );
-
- CPPUNIT_ASSERT( randId == strId );
-
- CPPUNIT_ASSERT( randId.variant() == 2 );
-
- UUID fromBits( randId.getMostSignificantBits(),
- randId.getLeastSignificantBits() );
-
- CPPUNIT_ASSERT( randId.compareTo( fromBits) == 0 );
-}
diff --git a/src/decaf/src/test/decaf/util/UUIDTest.h b/src/decaf/src/test/decaf/util/UUIDTest.h
deleted file mode 100644
index ba7d188..0000000
--- a/src/decaf/src/test/decaf/util/UUIDTest.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_UUIDTEST_H_
-#define _DECAF_UTIL_UUIDTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-namespace decaf{
-namespace util{
-
- class UUIDTest : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE( UUIDTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- UUIDTest();
- virtual ~UUIDTest() {}
-
- virtual void test();
-
- };
-
-}}
-
-#endif /*_DECAF_UTIL_UUIDTEST_H_*/
diff --git a/src/decaf/src/test/decaf/util/concurrent/CountDownLatchTest.cpp b/src/decaf/src/test/decaf/util/concurrent/CountDownLatchTest.cpp
deleted file mode 100644
index 10d2f43..0000000
--- a/src/decaf/src/test/decaf/util/concurrent/CountDownLatchTest.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "CountDownLatchTest.h"
-
-using namespace decaf;
-using namespace decaf::util;
-using namespace decaf::util::concurrent;
-
-////////////////////////////////////////////////////////////////////////////////
-void CountDownLatchTest::test()
-{
- CountDownLatch latch( 50 );
-
- CPPUNIT_ASSERT( latch.getCount() == 50 );
-
- MyThread thread;
- thread.latch = &latch;
- thread.start();
-
- latch.await();
-
- CPPUNIT_ASSERT( latch.getCount() == 0 );
-
- thread.join();
-
- CPPUNIT_ASSERT( true );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void CountDownLatchTest::test2()
-{
- CountDownLatch latch( 75 );
-
- CPPUNIT_ASSERT( latch.getCount() == 75 );
-
- MyThread thread;
- thread.latch = &latch;
- thread.start();
-
- CPPUNIT_ASSERT( latch.await( 2 ) == false );
-
- latch.await();
-
- CPPUNIT_ASSERT( latch.getCount() == 0 );
-
- thread.join();
-
- CPPUNIT_ASSERT( true );
-}
diff --git a/src/decaf/src/test/decaf/util/concurrent/CountDownLatchTest.h b/src/decaf/src/test/decaf/util/concurrent/CountDownLatchTest.h
deleted file mode 100644
index 048a813..0000000
--- a/src/decaf/src/test/decaf/util/concurrent/CountDownLatchTest.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_CONCURRENT_COUNTDOWNLATCHTEST_H_
-#define _DECAF_UTIL_CONCURRENT_COUNTDOWNLATCHTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/lang/Thread.h>
-#include <decaf/util/concurrent/CountDownLatch.h>
-
-namespace decaf{
-namespace util{
-namespace concurrent{
-
- class CountDownLatchTest : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE( CountDownLatchTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST( test2 );
- CPPUNIT_TEST_SUITE_END();
-
- protected:
-
- class MyThread : public lang::Thread
- {
- public:
-
- CountDownLatch* latch;
-
- public:
-
- MyThread(){}
- virtual ~MyThread(){}
-
- virtual void run(){
-
- while( latch->getCount() > 0 ) {
- latch->countDown();
-
- lang::Thread::sleep( 20 );
- }
- }
-
- };
-
- public:
-
- CountDownLatchTest() {}
- virtual ~CountDownLatchTest() {}
-
- virtual void test();
- virtual void test2();
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_CONCURRENT_COUNTDOWNLATCHTEST_H_*/
diff --git a/src/decaf/src/test/decaf/util/concurrent/MutexTest.cpp b/src/decaf/src/test/decaf/util/concurrent/MutexTest.cpp
deleted file mode 100644
index 2eac067..0000000
--- a/src/decaf/src/test/decaf/util/concurrent/MutexTest.cpp
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "MutexTest.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::util;
-using namespace decaf::util::concurrent;
-
-///////////////////////////////////////////////////////////////////////////////
-void MutexTest::testTimedWait(){
-
- try
- {
- MyTimedWaitingThread test;
- time_t startTime = time( NULL );
- test.start();
- test.join();
- time_t endTime = time( NULL );
-
- time_t delta = endTime - startTime;
-
- CPPUNIT_ASSERT( delta >= 1 && delta <= 3 );
- }
- catch(lang::Exception& ex)
- {
- std::cout << ex.getMessage() << std::endl;
- }
-}
-
-void MutexTest::testWait(){
-
- try
- {
- MyWaitingThread test;
- test.start();
-
- Thread::sleep( 1000 );
-
- synchronized( &test )
- {
- for( int ix=0; ix<100; ix++ ){
- test.value += 1;
- }
-
- test.notify();
- }
-
- test.join();
-
- CPPUNIT_ASSERT( test.value == 2500 );
- } catch( lang::Exception& ex ) {
- ex.setMark( __FILE__, __LINE__ );
- }
-}
-
-void MutexTest::test()
-{
- MyThread test;
-
- synchronized(&test){
-
- test.start();
-
- for( int ix=0; ix<100; ix++ ){
- test.value += 1;
- }
- }
-
- test.join();
-
- CPPUNIT_ASSERT( test.value == 2500 );
-}
-
-void MutexTest::testNotify()
-{
- try{
- Mutex mutex;
- Mutex started;
- Mutex completed;
-
- const int numThreads = 30;
- MyNotifiedThread* threads[numThreads];
-
- // Create and start all the threads.
- for( int ix=0; ix<numThreads; ++ix ){
- threads[ix] = new MyNotifiedThread( &mutex, &started, &completed );
- threads[ix]->start();
- }
-
- synchronized( &started )
- {
- int count = 0;
-
- while( count < ( numThreads ) )
- {
- started.wait( 30 );
- count++;
- }
- }
-
- synchronized(&mutex)
- {
- mutex.notify();
- }
-
- Thread::sleep( 1000 );
-
- int counter = 0;
- for( int ix=0; ix<numThreads; ++ix ){
- if( threads[ix]->done ){
- counter++;
- }
- }
-
- // Make sure only 1 thread was notified.
- CPPUNIT_ASSERT( counter == 1 );
-
- synchronized(&mutex)
- {
- // Notify all threads.
- for( int ix=0; ix<numThreads-1; ++ix ){
- mutex.notify();
- }
- }
-
- synchronized( &started )
- {
- int count = 0;
-
- while( count < ( numThreads ) )
- {
- started.wait( 30 );
- count++;
- }
- }
-
- int numComplete = 0;
- for( int ix=0; ix<numThreads; ++ix ){
- if( threads[ix]->done ){
- numComplete++;
- }
- }
- CPPUNIT_ASSERT( numComplete == numThreads );
-
- synchronized( &mutex )
- {
- mutex.wait( 5 );
- }
-
- synchronized( &mutex )
- {
- mutex.notifyAll();
- }
-
- // Delete all the threads.
- for( int ix=0; ix<numThreads; ++ix ){
- delete threads[ix];
- }
-
- }catch( lang::Exception& ex ){
- ex.setMark( __FILE__, __LINE__ );
- }
-}
-
-void MutexTest::testNotifyAll()
-{
- try{
- Mutex mutex;
- Mutex started;
- Mutex completed;
-
- const int numThreads = 100;
- MyNotifiedThread* threads[numThreads];
-
- // Create and start all the threads.
- for( int ix=0; ix<numThreads; ++ix ){
- threads[ix] = new MyNotifiedThread( &mutex, &started, &completed );
- threads[ix]->start();
- }
-
- synchronized( &started )
- {
- int count = 0;
-
- while( count < ( numThreads ) )
- {
- started.wait( 30 );
- count++;
- }
- }
-
- for( int ix=0; ix<numThreads; ++ix )
- {
- if( threads[ix]->done == true ){
- printf("threads[%d] is done prematurely\n", ix );
- }
- CPPUNIT_ASSERT( threads[ix]->done == false );
- }
-
- // Notify all threads.
- synchronized( &mutex ){
- mutex.notifyAll();
- }
-
- synchronized( &completed )
- {
- int count = 0;
-
- while( count < ( numThreads ) )
- {
- completed.wait( 30 );
- count++;
- }
- }
-
- int numComplete = 0;
- for( int ix=0; ix<numThreads; ++ix ){
- if( threads[ix]->done ){
- numComplete++;
- }
- }
- //printf("numComplete: %d, numThreads: %d\n", numComplete, numThreads );
- CPPUNIT_ASSERT( numComplete == numThreads );
-
- // Delete all the threads.
- for( int ix=0; ix<numThreads; ++ix ){
- threads[ix]->join();
- delete threads[ix];
- }
-
- }catch( lang::Exception& ex ){
- ex.setMark( __FILE__, __LINE__ );
- }
-}
-
-void MutexTest::testRecursiveLock()
-{
- try{
- Mutex mutex;
-
- const int numThreads = 30;
- MyRecursiveLockThread* threads[numThreads];
-
- // Create and start all the threads.
- for( int ix=0; ix<numThreads; ++ix ){
- threads[ix] = new MyRecursiveLockThread( &mutex );
- threads[ix]->start();
- }
-
- // Sleep so all the threads can get to the wait.
- Thread::sleep( 1000 );
-
- for( int ix=0; ix<numThreads; ++ix ){
- if( threads[ix]->done == true ){
- std::cout << "threads[" << ix
- << "] is done prematurely\n";
- }
- CPPUNIT_ASSERT( threads[ix]->done == false );
- }
-
- // Notify all threads.
- synchronized( &mutex )
- {
- synchronized( &mutex )
- {
- mutex.notifyAll();
- }
- }
-
- // Sleep to give the threads time to wake up.
- Thread::sleep( 1000 );
-
- for( int ix=0; ix<numThreads; ++ix ){
- if( threads[ix]->done != true ){
- std::cout<< "threads[" << ix << "] is not done\n";
- }
- CPPUNIT_ASSERT( threads[ix]->done == true );
- }
-
- // Delete all the threads.
- for( int ix=0; ix<numThreads; ++ix ){
- delete threads[ix];
- }
-
- }catch( lang::Exception& ex ){
- ex.setMark( __FILE__, __LINE__ );
- }
-}
-
-void MutexTest::testDoubleLock()
-{
- try{
- Mutex mutex1;
- Mutex mutex2;
-
- MyDoubleLockThread thread(&mutex1, &mutex2);
-
- thread.start();
-
- // Let the thread get both locks
- Thread::sleep( 200 );
-
- // Lock mutex 2, thread is waiting on it
- synchronized(&mutex2)
- {
- mutex2.notify();
- }
-
- // Let the thread die
- thread.join();
-
- CPPUNIT_ASSERT( thread.done );
- }catch( lang::Exception& ex ){
- ex.setMark( __FILE__, __LINE__ );
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-void MutexTest::testStressMutex(){
- MyStoppableThread tester;
-
- tester.start();
-
- CPPUNIT_ASSERT( tester.isStarted() );
-
- for( int i = 0; i < 100; ++i ) {
- tester.stop();
- tester.start();
- }
-
- CPPUNIT_ASSERT( true );
-}
diff --git a/src/decaf/src/test/decaf/util/concurrent/MutexTest.h b/src/decaf/src/test/decaf/util/concurrent/MutexTest.h
deleted file mode 100644
index af62da4..0000000
--- a/src/decaf/src/test/decaf/util/concurrent/MutexTest.h
+++ /dev/null
@@ -1,493 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_CONCURRENT_MUTEXTEST_H_
-#define _DECAF_UTIL_CONCURRENT_MUTEXTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/lang/Thread.h>
-#include <decaf/lang/Runnable.h>
-#include <decaf/util/concurrent/Concurrent.h>
-#include <decaf/util/concurrent/Mutex.h>
-#include <decaf/util/Random.h>
-#include <time.h>
-
-namespace decaf{
-namespace util{
-namespace concurrent{
-
- class MutexTest : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE( MutexTest );
- CPPUNIT_TEST( test );
- CPPUNIT_TEST( testWait );
- CPPUNIT_TEST( testTimedWait );
- CPPUNIT_TEST( testNotify );
- CPPUNIT_TEST( testNotifyAll );
- CPPUNIT_TEST( testRecursiveLock );
- CPPUNIT_TEST( testDoubleLock );
- CPPUNIT_TEST( testStressMutex );
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- class MyThread
- :
- public lang::Thread,
- public Synchronizable{
-
- private:
-
- Mutex mutex;
-
- public:
-
- int value;
- MyThread(){ value = 0;}
- virtual ~MyThread(){}
-
- virtual void lock() throw(lang::Exception){
- mutex.lock();
- }
- virtual void unlock() throw(lang::Exception){
- mutex.unlock();
- }
- virtual void wait() throw(lang::Exception){
- mutex.wait();
- }
- virtual void wait(unsigned long millisecs) throw(lang::Exception){
- mutex.wait( millisecs );
- }
- virtual void notify() throw(lang::Exception){
- mutex.notify();
- }
- virtual void notifyAll() throw(lang::Exception){
- mutex.notifyAll();
- }
-
- virtual void run(){
-
- {
- Lock lock (this);
-
- value = value * 25;
- }
- }
-
- };
-
- class MyWaitingThread
- :
- public lang::Thread,
- public Synchronizable{
-
- private:
-
- Mutex mutex;
-
- public:
-
- int value;
- MyWaitingThread(){ value = 0;}
- virtual ~MyWaitingThread(){}
- virtual void lock() throw(lang::Exception){
- mutex.lock();
- }
- virtual void unlock() throw(lang::Exception){
- mutex.unlock();
- }
- virtual void wait() throw(lang::Exception){
- mutex.wait();
- }
- virtual void wait(unsigned long millisecs) throw(lang::Exception){
- mutex.wait( millisecs );
- }
- virtual void notify() throw(lang::Exception){
- mutex.notify();
- }
- virtual void notifyAll() throw(lang::Exception){
- mutex.notifyAll();
- }
-
- virtual void run(){
-
- try
- {
- synchronized(this)
- {
- this->wait();
-
- std::cout.flush();
-
- value = value * 25;
- }
- }
- catch(lang::Exception& ex)
- {
- ex.setMark( __FILE__, __LINE__ );
- }
- }
- };
-
- class MyTimedWaitingThread
- :
- public lang::Thread,
- public Synchronizable{
-
- private:
-
- Mutex mutex;
-
- public:
-
- int value;
- MyTimedWaitingThread(){ value = 0;}
- virtual ~MyTimedWaitingThread(){}
- virtual void lock() throw(lang::Exception){
- mutex.lock();
- }
- virtual void unlock() throw(lang::Exception){
- mutex.unlock();
- }
- virtual void wait() throw(lang::Exception){
- mutex.wait();
- }
- virtual void wait(unsigned long millisecs) throw(lang::Exception){
- mutex.wait( millisecs );
- }
- virtual void notify() throw(lang::Exception){
- mutex.notify();
- }
- virtual void notifyAll() throw(lang::Exception){
- mutex.notifyAll();
- }
-
- virtual void run(){
-
- try
- {
- synchronized(this)
- {
- this->wait(2000);
-
- value = 666;
- }
- }
- catch(lang::Exception& ex)
- {
- ex.setMark( __FILE__, __LINE__ );
- }
- }
- };
-
- class MyNotifiedThread
- :
- public lang::Thread,
- public Synchronizable{
-
- public:
-
- bool done;
- Mutex* mutex;
- Mutex* started;
- Mutex* completed;
-
- public:
-
- int value;
- MyNotifiedThread(Mutex* mutex, Mutex* started, Mutex* completed ){
- this->mutex = mutex;
- this->started = started;
- this->completed = completed;
- this->done = false;
- }
- virtual ~MyNotifiedThread(){}
- virtual void lock() throw(lang::Exception){
- mutex->lock();
- }
- virtual void unlock() throw(lang::Exception){
- mutex->unlock();
- }
- virtual void wait() throw(lang::Exception){
- mutex->wait();
- }
- virtual void wait(unsigned long millisecs) throw(lang::Exception){
- mutex->wait( millisecs );
- }
- virtual void notify() throw(lang::Exception){
- mutex->notify();
- }
- virtual void notifyAll() throw(lang::Exception){
- mutex->notifyAll();
- }
-
- virtual void run(){
-
- try
- {
- done = false;
- synchronized(this)
- {
- synchronized( started )
- {
- started->notify();
- }
-
- this->wait();
- done = true;
-
- synchronized( completed )
- {
- completed->notify();
- }
- }
- }
- catch(lang::Exception& ex)
- {
- ex.setMark( __FILE__, __LINE__ );
- }
- }
- };
-
- class MyRecursiveLockThread
- :
- public lang::Thread,
- public Synchronizable{
-
- public:
-
- bool done;
- Mutex* mutex;
-
- public:
-
- int value;
- MyRecursiveLockThread(Mutex* mutex){ this->mutex = mutex; done = false; }
- virtual ~MyRecursiveLockThread(){}
- virtual void lock() throw(lang::Exception){
- mutex->lock();
- }
- virtual void unlock() throw(lang::Exception){
- mutex->unlock();
- }
- virtual void wait() throw(lang::Exception){
- mutex->wait();
- }
- virtual void wait(unsigned long millisecs) throw(lang::Exception){
- mutex->wait( millisecs );
- }
- virtual void notify() throw(lang::Exception){
- mutex->notify();
- }
- virtual void notifyAll() throw(lang::Exception){
- mutex->notifyAll();
- }
-
- virtual void run(){
-
- try
- {
- done = false;
- synchronized(this)
- {
- synchronized(this)
- {
- this->wait();
- done = true;
- }
- }
- }
- catch(lang::Exception& ex)
- {
- ex.setMark( __FILE__, __LINE__ );
- }
- }
- };
-
- class MyDoubleLockThread
- :
- public lang::Thread
- {
-
- public:
-
- bool done;
- Mutex* mutex1;
- Mutex* mutex2;
-
- public:
-
- int value;
- MyDoubleLockThread(Mutex* mutex1, Mutex* mutex2)
- {
- this->mutex1 = mutex1;
- this->mutex2 = mutex2;
- done = false;
- }
-
- virtual ~MyDoubleLockThread(){}
-
- virtual void run(){
-
- try
- {
- done = false;
- synchronized(mutex1)
- {
- synchronized(mutex2)
- {
- mutex2->wait();
- done = true;
- }
- }
- }
- catch(lang::Exception& ex)
- {
- ex.setMark( __FILE__, __LINE__ );
- }
- }
- };
-
- class MyStoppableThread : public lang::Runnable
- {
- public:
-
- bool started;
- bool closed;
- Mutex mutex;
- lang::Thread* thread;
- util::Random rand;
-
- public:
-
- MyStoppableThread() {
- this->started = false;
- this->closed = false;
- this->thread = NULL;
- }
-
- virtual ~MyStoppableThread(){ close(); }
-
- virtual void start(){
- synchronized( &mutex ) {
-
- if( closed || started ) {
- return;
- }
-
- started = true;
-
- // Don't create the thread unless we need to.
- if( thread == NULL ) {
- thread = new lang::Thread( this );
- thread->start();
- }
-
- mutex.notifyAll();
- }
- }
-
- virtual void stop() {
- synchronized( &mutex ) {
-
- if( closed || !started ) {
- return;
- }
-
- // Set the state to stopped.
- started = false;
-
- // Wakeup the thread so that it can acknowledge the stop request.
- mutex.notifyAll();
-
- // Wait for the thread to notify us that it has acknowledged
- // the stop request.
- mutex.wait();
- }
- }
-
- virtual void close() {
- synchronized( &mutex ) {
-
- closed = true;
- mutex.notifyAll();
- }
-
- if( thread != NULL ) {
- thread->join();
- delete thread;
- thread = NULL;
- }
- }
-
- virtual bool isStarted() const {
- return started;
- }
-
- virtual void run(){
- try {
-
- while( true ) {
-
- lang::Thread::sleep( rand.nextInt( 100 ) );
-
- synchronized( &mutex ) {
-
- // If we're closing down, exit the thread.
- if( closed ) {
- return;
- }
-
- // When told to stop, the calling thread will wait for a
- // responding notification, indicating that we have acknowledged
- // the stop command.
- if( !isStarted() ) {
- mutex.notifyAll();
-
- // Wait for more data or to be woken up.
- mutex.wait();
- }
- }
- }
- } catch(...) {
- CPPUNIT_ASSERT( false );
- }
- }
- };
-
- public:
-
- virtual ~MutexTest(){}
- virtual void setUp(){}
- virtual void tearDown(){}
-
- void testTimedWait();
- void testWait();
- void test();
- void testNotify();
- void testNotifyAll();
- void testRecursiveLock();
- void testDoubleLock();
- void testStressMutex();
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_CONCURRENT_MUTEXTEST_H_*/
diff --git a/src/decaf/src/test/decaf/util/concurrent/ThreadPoolTest.cpp b/src/decaf/src/test/decaf/util/concurrent/ThreadPoolTest.cpp
deleted file mode 100644
index e0ae705..0000000
--- a/src/decaf/src/test/decaf/util/concurrent/ThreadPoolTest.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "ThreadPoolTest.h"
-
-using namespace std;
-using namespace decaf;
-using namespace decaf::lang;
-using namespace decaf::util;
-using namespace decaf::util::concurrent;
-
-///////////////////////////////////////////////////////////////////////////////
-void ThreadPoolTest::test1()
-{
- CountDownLatch myLatch( 3 );
- this->latch = &myLatch;
-
- MyTask task1( 1 );
- MyTask task2( 2 );
- MyTask task3( 3 );
-
- this->complete = 0;
- this->tasksToComplete = 3;
-
- ThreadPool* pool = ThreadPool::getInstance();
-
- pool->queueTask( ThreadPool::Task( &task1, this ) );
- pool->queueTask( ThreadPool::Task( &task2, this ) );
- pool->queueTask( ThreadPool::Task( &task3, this ) );
-
- // Wait for them to finish, if we can't do this in 30 seconds then
- // there's probably something really wrong.
- myLatch.await( 30000 );
-
- CPPUNIT_ASSERT( this->complete == this->tasksToComplete );
-
- CPPUNIT_ASSERT( task1.value == 101 );
- CPPUNIT_ASSERT( task2.value == 102 );
- CPPUNIT_ASSERT( task3.value == 103 );
-
- CPPUNIT_ASSERT( pool->getPoolSize() > 0 );
- CPPUNIT_ASSERT( pool->getBacklog() == 0 );
-
- CPPUNIT_ASSERT( pool->getMaxThreads() == ThreadPool::DEFAULT_MAX_POOL_SIZE );
- CPPUNIT_ASSERT( pool->getBlockSize() == ThreadPool::DEFAULT_MAX_BLOCK_SIZE );
-
- pool->setMaxThreads(50);
- pool->setBlockSize(50);
-
- CPPUNIT_ASSERT( pool->getMaxThreads() == 50 );
- CPPUNIT_ASSERT( pool->getBlockSize() == 50 );
-
- // Give it a little time to create all those threads.
- for( int i = 0; i < 1000; ++i ) {
- if( pool->getFreeThreadCount() == pool->getPoolSize() ) {
- break;
- }
-
- Thread::sleep( 100 );
- }
-
- CPPUNIT_ASSERT( pool->getFreeThreadCount() == pool->getPoolSize() );
- CPPUNIT_ASSERT( this->caughtEx == false );
-}
-
-///////////////////////////////////////////////////////////////////////////////
-void ThreadPoolTest::test2() {
-
- try
- {
- ThreadPool pool;
- Mutex myMutex;
-
- CPPUNIT_ASSERT( pool.getMaxThreads() == ThreadPool::DEFAULT_MAX_POOL_SIZE );
- CPPUNIT_ASSERT( pool.getBlockSize() == ThreadPool::DEFAULT_MAX_BLOCK_SIZE );
- pool.setMaxThreads(3);
- pool.setBlockSize(1);
- CPPUNIT_ASSERT( pool.getMaxThreads() == 3 );
- CPPUNIT_ASSERT( pool.getBlockSize() == 1 );
- CPPUNIT_ASSERT( pool.getPoolSize() == 0 );
- pool.reserve( 4 );
- CPPUNIT_ASSERT( pool.getPoolSize() == 3 );
- CPPUNIT_ASSERT( pool.getFreeThreadCount() == 3 );
-
- CountDownLatch startedLatch1(3); // First three should go right away
- CountDownLatch startedLatch2(1); // The fourth one goes after others finish
- CountDownLatch doneLatch(4); // All should be done when we are at the end.
-
- this->latch = &doneLatch;
-
- MyWaitingTask task1( &myMutex, &startedLatch1 );
- MyWaitingTask task2( &myMutex, &startedLatch1 );
- MyWaitingTask task3( &myMutex, &startedLatch1 );
- MyWaitingTask task4( &myMutex, &startedLatch2 );
-
- this->complete = 0;
- this->tasksToComplete = 4;
-
- pool.queueTask( ThreadPool::Task( &task1, this ) );
- pool.queueTask( ThreadPool::Task( &task2, this ) );
- pool.queueTask( ThreadPool::Task( &task3, this ) );
- pool.queueTask( ThreadPool::Task( &task4, this ) );
-
- // Wait 30 seconds, then we let it fail because something is
- // probably very wrong.
- startedLatch1.await( 30000 );
-
- CPPUNIT_ASSERT( pool.getFreeThreadCount() == 0 );
- CPPUNIT_ASSERT( pool.getBacklog() == 1 );
-
- // Wake up the tasks.
- synchronized(&myMutex) {
- myMutex.notifyAll();
- }
-
- // Wait 30 seconds, then we let it fail because something is
- // probably very wrong.
- startedLatch2.await( 30000 );
-
- // Wake up the last task.
- synchronized(&myMutex) {
- myMutex.notifyAll();
- }
-
- // Wait for them to finish, if it takes longer than 30 seconds
- // something is not right.
- doneLatch.await( 30000 );
-
- CPPUNIT_ASSERT( this->complete == this->tasksToComplete );
- CPPUNIT_ASSERT( this->caughtEx == false );
- }
- catch( lang::Exception& ex ) {
- ex.setMark( __FILE__, __LINE__ );
- }
-}
diff --git a/src/decaf/src/test/decaf/util/concurrent/ThreadPoolTest.h b/src/decaf/src/test/decaf/util/concurrent/ThreadPoolTest.h
deleted file mode 100644
index 298eaba..0000000
--- a/src/decaf/src/test/decaf/util/concurrent/ThreadPoolTest.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _DECAF_UTIL_CONCURRENT_THREADPOOLTEST_H_
-#define _DECAF_UTIL_CONCURRENT_THREADPOOLTEST_H_
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <decaf/util/concurrent/CountDownLatch.h>
-#include <decaf/util/concurrent/Concurrent.h>
-#include <decaf/lang/Thread.h>
-#include <decaf/util/concurrent/ThreadPool.h>
-#include <decaf/util/concurrent/TaskListener.h>
-#include <decaf/util/concurrent/Mutex.h>
-#include <decaf/util/Config.h>
-
-namespace decaf{
-namespace util{
-namespace concurrent{
-
- class ThreadPoolTest :
- public CppUnit::TestFixture,
- public TaskListener
- {
- CPPUNIT_TEST_SUITE( ThreadPoolTest );
- CPPUNIT_TEST( test1 );
- CPPUNIT_TEST( test2 );
- CPPUNIT_TEST_SUITE_END();
-
- int tasksToComplete;
- int complete;
- Mutex mutex;
- bool caughtEx;
- CountDownLatch* latch;
-
- public:
-
- ThreadPoolTest() {
- complete = 0;
- tasksToComplete = 0;
- caughtEx = false;
- latch = NULL;
- }
-
- virtual ~ThreadPoolTest() {}
-
- virtual void onTaskComplete( lang::Runnable* task DECAF_UNUSED)
- {
- try{
-
- complete++;
-
- if( latch != NULL ) {
- latch->countDown();
- }
- }catch( lang::Exception& ex ){
- ex.setMark( __FILE__, __LINE__ );
- }
- }
-
- virtual void onTaskException(
- lang::Runnable* task DECAF_UNUSED,
- lang::Exception& ex DECAF_UNUSED) {
- caughtEx = true;
- }
-
- public:
-
- class MyTask : public lang::Runnable
- {
- public:
-
- int value;
-
- MyTask( int x ) {
- value = x;
- }
-
- virtual ~MyTask() {};
-
- virtual void run(void) {
- value += 100;
- }
- };
-
- class MyWaitingTask : public lang::Runnable
- {
- public:
-
- Mutex* mutex;
- CountDownLatch* startedLatch;
-
- MyWaitingTask( Mutex* mutex, CountDownLatch* startedLatch ) {
- this->mutex = mutex;
- this->startedLatch = startedLatch;
- }
-
- virtual ~MyWaitingTask() {};
-
- virtual void run(void) {
- try
- {
- synchronized(mutex) {
- startedLatch->countDown();
- mutex->wait();
- }
- }
- catch( lang::Exception& ex ) {
- ex.setMark( __FILE__, __LINE__ );
- }
- }
- };
-
- public:
-
- virtual void test1();
- virtual void test2();
-
- };
-
-}}}
-
-#endif /*_DECAF_UTIL_CONCURRENT_THREADPOOLTEST_H_*/
diff --git a/src/decaf/src/test/main.cpp b/src/decaf/src/test/main.cpp
deleted file mode 100644
index d2ac513..0000000
--- a/src/decaf/src/test/main.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-#include <cppunit/BriefTestProgressListener.h>
-#include <cppunit/TestResult.h>
-#include <decaf/util/Config.h>
-
-int main( int argc DECAF_UNUSED, char **argv DECAF_UNUSED )
-{
- CppUnit::TextUi::TestRunner runner;
- CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry();
- runner.addTest( registry.makeTest() );
-
- // Shows a message as each test starts
- CppUnit::BriefTestProgressListener listener;
- runner.eventManager().addListener( &listener );
-
- bool wasSuccessful = runner.run( "", false );
- return !wasSuccessful;
-}
diff --git a/src/decaf/src/test/testRegistry.cpp b/src/decaf/src/test/testRegistry.cpp
deleted file mode 100644
index 216d185..0000000
--- a/src/decaf/src/test/testRegistry.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// All CPP Unit tests are registered in here so we can disable them and
-// enable them easily in one place.
-
-//#include <decaf/io/BufferedInputStreamTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::BufferedInputStreamTest );
-//#include <decaf/io/BufferedOutputStreamTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::BufferedOutputStreamTest );
-//#include <decaf/io/ByteArrayInputStreamTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::ByteArrayInputStreamTest );
-//#include <decaf/io/ByteArrayOutputStreamTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::ByteArrayOutputStreamTest );
-//#include <decaf/io/DataInputStreamTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::DataInputStreamTest );
-//#include <decaf/io/DataOutputStreamTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::io::DataOutputStreamTest );
-
-//#include <decaf/lang/MathTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::MathTest );
-//#include <decaf/lang/ByteTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::ByteTest );
-//#include <decaf/lang/CharacterTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::CharacterTest );
-//#include <decaf/lang/BooleanTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::BooleanTest );
-//#include <decaf/lang/ShortTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::ShortTest );
-//#include <decaf/lang/IntegerTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::IntegerTest );
-//#include <decaf/lang/LongTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::LongTest );
-//#include <decaf/lang/FloatTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::FloatTest );
-//#include <decaf/lang/DoubleTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::DoubleTest );
-//#include <decaf/lang/ExceptionTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::ExceptionTest );
-//#include <decaf/lang/ThreadTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::ThreadTest );
-//#include <decaf/lang/SystemTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::lang::SystemTest );
-//
-//#include <decaf/net/SocketFactoryTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::net::SocketFactoryTest );
-//#include <decaf/net/SocketTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::net::SocketTest );
-#include <decaf/net/URITest.h>
-CPPUNIT_TEST_SUITE_REGISTRATION( decaf::net::URITest );
-#include <decaf/net/URISyntaxExceptionTest.h>
-CPPUNIT_TEST_SUITE_REGISTRATION( decaf::net::URISyntaxExceptionTest );
-//
-//#include <decaf/util/concurrent/CountDownLatchTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::concurrent::CountDownLatchTest );
-//#include <decaf/util/concurrent/MutexTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::concurrent::MutexTest );
-//#include <decaf/util/concurrent/ThreadPoolTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::concurrent::ThreadPoolTest );
-//
-//#include <decaf/util/DateTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::DateTest );
-//#include <decaf/util/UUIDTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::UUIDTest );
-//#include <decaf/util/MapTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::MapTest );
-//#include <decaf/util/QueueTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::QueueTest );
-//#include <decaf/util/RandomTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::RandomTest );
-//#include <decaf/util/SetTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::SetTest );
-//#include <decaf/util/StringTokenizerTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( decaf::util::StringTokenizerTest );
diff --git a/src/decaf/vs2005-build/vs2005-decaf-example.vcproj b/src/decaf/vs2005-build/vs2005-decaf-example.vcproj
deleted file mode 100644
index 3215efd..0000000
--- a/src/decaf/vs2005-build/vs2005-decaf-example.vcproj
+++ /dev/null
@@ -1,379 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="vs2005-decaf-example"
- ProjectGUID="{3F0BD46A-0AD3-4FAE-9962-F3A252E53498}"
- RootNamespace="vs2005decafexample"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- BuildLogFile="$(IntDir)\$(ProjectName)\BuildLog.htm"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\src\test;..\src\main;"C:\Program Files\CPPUnit\include";"C:\Program Files\Microsoft Platform SDK\Include";"D:\Program Files\Microsoft Platform SDK\Include";"C:\Apps\cppunit-1.11.6\include";"E:\dev\cppunit-1.11.6\include""
- PreprocessorDefinitions="WIN32;WIN32_LEAN_AND_MEAN;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- ObjectFile="$(IntDir)\$(ProjectName)\"
- ProgramDataBaseFileName="$(IntDir)\$(ProjectName)\vc80.pdb"
- XMLDocumentationFileName="$(IntDir)\$(ProjectName)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- DisableSpecificWarnings="4290, 4101"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ws2_32.lib rpcrt4.lib cppunitd.lib"
- OutputFile="$(OutDir)\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories=""C:\Program Files\CPPUnit\lib";"C:\Apps\cppunit-1.11.6\lib";"E:\dev\cppunit-1.11.6\lib";"C:\Program Files\Microsoft Platform SDK\Lib";"D:\Program Files\Microsoft Platform SDK\Lib""
- ManifestFile="$(IntDir)\$(ProjectName)\$(TargetFileName).intermediate.manifest"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- OutputManifestFile="$(IntDir)\$(ProjectName)\$(TargetFileName).embed.manifest"
- ManifestResourceFile="$(IntDir)\$(ProjectName)\$(TargetFileName).embed.manifest.res"
- DependencyInformationFile="$(IntDir)\$(ProjectName)\mt.dep"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- BuildLogFile="$(IntDir)\$(ProjectName)\BuildLog.htm"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\src\test;..\src\main;"C:\Program Files\CPPUnit\include";"C:\Apps\cppunit-1.11.6\include";"E:\dev\cppunit-1.11.6\include";"C:\Program Files\Microsoft Platform SDK\Include";"D:\Program Files\Microsoft Platform SDK\Include""
- PreprocessorDefinitions="WIN32;WIN32_LEAN_AND_MEAN;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- ObjectFile="$(IntDir)\$(ProjectName)\"
- ProgramDataBaseFileName="$(IntDir)\$(ProjectName)\vc80.pdb"
- XMLDocumentationFileName="$(IntDir)\$(ProjectName)\"
- WarningLevel="2"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ws2_32.lib rpcrt4.lib cppunit.lib"
- OutputFile="$(OutDir)\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories=""C:\Program Files\CPPUnit\lib";"C:\Apps\cppunit-1.11.6\lib";"E:\dev\cppunit-1.11.6\lib";"C:\Program Files\Microsoft Platform SDK\Lib";"D:\Program Files\Microsoft Platform SDK\Lib""
- ManifestFile="$(IntDir)\$(ProjectName)\$(TargetFileName).intermediate.manifest"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- OutputManifestFile="$(IntDir)\$(ProjectName)\$(TargetFileName).embed.manifest"
- ManifestResourceFile="$(IntDir)\$(ProjectName)\$(TargetFileName).embed.manifest.res"
- DependencyInformationFile="$(IntDir)\$(ProjectName)\mt.dep"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ReleaseDLL|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- BuildLogFile="$(IntDir)\$(ProjectName)\BuildLog.htm"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\src\test;..\src\main;"C:\Program Files\CPPUnit\include";"C:\Apps\cppunit-1.11.6\include";"E:\dev\cppunit-1.11.6\include";"C:\Program Files\Microsoft Platform SDK\Include";"D:\Program Files\Microsoft Platform SDK\Include""
- PreprocessorDefinitions="WIN32;WIN32_LEAN_AND_MEAN;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;DECAF_DLL"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- ObjectFile="$(IntDir)\$(ProjectName)\"
- ProgramDataBaseFileName="$(IntDir)\$(ProjectName)\vc80.pdb"
- XMLDocumentationFileName="$(IntDir)\$(ProjectName)\"
- WarningLevel="2"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ws2_32.lib rpcrt4.lib cppunit.lib"
- OutputFile="$(OutDir)\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories=""C:\Program Files\CPPUnit\lib";"C:\Apps\cppunit-1.11.6\lib";"E:\dev\cppunit-1.11.6\lib";"C:\Program Files\Microsoft Platform SDK\Lib";"D:\Program Files\Microsoft Platform SDK\Lib""
- ManifestFile="$(IntDir)\$(ProjectName)\$(TargetFileName).intermediate.manifest"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- OutputManifestFile="$(IntDir)\$(ProjectName)\$(TargetFileName).embed.manifest"
- ManifestResourceFile="$(IntDir)\$(ProjectName)\$(TargetFileName).embed.manifest.res"
- DependencyInformationFile="$(IntDir)\$(ProjectName)\mt.dep"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="DebugDLL|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- BuildLogFile="$(IntDir)\$(ProjectName)\BuildLog.htm"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\src\test;..\src\main;"C:\Program Files\CPPUnit\include";"C:\Program Files\Microsoft Platform SDK\Include";"D:\Program Files\Microsoft Platform SDK\Include";"C:\Apps\cppunit-1.11.6\include";"E:\dev\cppunit-1.11.6\include""
- PreprocessorDefinitions="WIN32;WIN32_LEAN_AND_MEAN;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;DECAF_DLL"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- ObjectFile="$(IntDir)\$(ProjectName)\"
- ProgramDataBaseFileName="$(IntDir)\$(ProjectName)\vc80.pdb"
- XMLDocumentationFileName="$(IntDir)\$(ProjectName)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- DisableSpecificWarnings="4290, 4101"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ws2_32.lib rpcrt4.lib cppunitd.lib"
- OutputFile="$(OutDir)\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories=""C:\Program Files\CPPUnit\lib";"C:\Apps\cppunit-1.11.6\lib";"E:\dev\cppunit-1.11.6\lib";"C:\Program Files\Microsoft Platform SDK\Lib";"D:\Program Files\Microsoft Platform SDK\Lib""
- ManifestFile="$(IntDir)\$(ProjectName)\$(TargetFileName).intermediate.manifest"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- OutputManifestFile="$(IntDir)\$(ProjectName)\$(TargetFileName).embed.manifest"
- ManifestResourceFile="$(IntDir)\$(ProjectName)\$(TargetFileName).embed.manifest.res"
- DependencyInformationFile="$(IntDir)\$(ProjectName)\mt.dep"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath="..\src\examples\main.cpp"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/src/decaf/vs2005-build/vs2005-decaf-unittests.vcproj b/src/decaf/vs2005-build/vs2005-decaf-unittests.vcproj
deleted file mode 100644
index ebd02ee..0000000
--- a/src/decaf/vs2005-build/vs2005-decaf-unittests.vcproj
+++ /dev/null
@@ -1,535 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="vs2005-decaf-unittests"
- ProjectGUID="{71582D83-8CC9-4C85-83BF-2E272B6DAE8A}"
- RootNamespace="vs2005decafunittests"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- BuildLogFile="$(IntDir)\$(ProjectName)\BuildLog.htm"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\src\test;..\src\main;"C:\Program Files\CPPUnit\include";"C:\Program Files\Microsoft Platform SDK\Include";"D:\Program Files\Microsoft Platform SDK\Include";"C:\Apps\cppunit-1.11.6\include";"E:\dev\cppunit-1.11.6\include""
- PreprocessorDefinitions="WIN32;WIN32_LEAN_AND_MEAN;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- ObjectFile="$(IntDir)\$(ProjectName)\"
- ProgramDataBaseFileName="$(IntDir)\$(ProjectName)\vc80.pdb"
- XMLDocumentationFileName="$(IntDir)\$(ProjectName)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- DisableSpecificWarnings="4290, 4101"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ws2_32.lib rpcrt4.lib cppunitd.lib"
- OutputFile="$(OutDir)\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories=""C:\Program Files\CPPUnit\lib";"C:\Apps\cppunit-1.11.6\lib";"E:\dev\cppunit-1.11.6\lib";"C:\Program Files\Microsoft Platform SDK\Lib";"D:\Program Files\Microsoft Platform SDK\Lib""
- ManifestFile="$(IntDir)\$(ProjectName)\$(TargetFileName).intermediate.manifest"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- OutputManifestFile="$(IntDir)\$(ProjectName)\$(TargetFileName).embed.manifest"
- ManifestResourceFile="$(IntDir)\$(ProjectName)\$(TargetFileName).embed.manifest.res"
- DependencyInformationFile="$(IntDir)\$(ProjectName)\mt.dep"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- BuildLogFile="$(IntDir)\$(ProjectName)\BuildLog.htm"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\src\test;..\src\main;"C:\Program Files\CPPUnit\include";"C:\Apps\cppunit-1.11.6\include";"E:\dev\cppunit-1.11.6\include";"C:\Program Files\Microsoft Platform SDK\Include";"D:\Program Files\Microsoft Platform SDK\Include""
- PreprocessorDefinitions="WIN32;WIN32_LEAN_AND_MEAN;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- ObjectFile="$(IntDir)\$(ProjectName)\"
- ProgramDataBaseFileName="$(IntDir)\$(ProjectName)\vc80.pdb"
- XMLDocumentationFileName="$(IntDir)\$(ProjectName)\"
- WarningLevel="2"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ws2_32.lib rpcrt4.lib cppunit.lib"
- OutputFile="$(OutDir)\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories=""C:\Program Files\CPPUnit\lib";"C:\Apps\cppunit-1.11.6\lib";"E:\dev\cppunit-1.11.6\lib";"C:\Program Files\Microsoft Platform SDK\Lib";"D:\Program Files\Microsoft Platform SDK\Lib""
- ManifestFile="$(IntDir)\$(ProjectName)\$(TargetFileName).intermediate.manifest"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- OutputManifestFile="$(IntDir)\$(ProjectName)\$(TargetFileName).embed.manifest"
- ManifestResourceFile="$(IntDir)\$(ProjectName)\$(TargetFileName).embed.manifest.res"
- DependencyInformationFile="$(IntDir)\$(ProjectName)\mt.dep"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ReleaseDLL|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- BuildLogFile="$(IntDir)\$(ProjectName)\BuildLog.htm"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\src\test;..\src\main;"C:\Program Files\CPPUnit\include";"C:\Apps\cppunit-1.11.6\include";"E:\dev\cppunit-1.11.6\include";"C:\Program Files\Microsoft Platform SDK\Include";"D:\Program Files\Microsoft Platform SDK\Include""
- PreprocessorDefinitions="WIN32;WIN32_LEAN_AND_MEAN;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;DECAF_DLL"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- ObjectFile="$(IntDir)\$(ProjectName)\"
- ProgramDataBaseFileName="$(IntDir)\$(ProjectName)\vc80.pdb"
- XMLDocumentationFileName="$(IntDir)\$(ProjectName)\"
- WarningLevel="2"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ws2_32.lib rpcrt4.lib cppunit.lib"
- OutputFile="$(OutDir)\$(ProjectName).exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories=""C:\Program Files\CPPUnit\lib";"C:\Apps\cppunit-1.11.6\lib";"E:\dev\cppunit-1.11.6\lib";"C:\Program Files\Microsoft Platform SDK\Lib";"D:\Program Files\Microsoft Platform SDK\Lib""
- ManifestFile="$(IntDir)\$(ProjectName)\$(TargetFileName).intermediate.manifest"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- OutputManifestFile="$(IntDir)\$(ProjectName)\$(TargetFileName).embed.manifest"
- ManifestResourceFile="$(IntDir)\$(ProjectName)\$(TargetFileName).embed.manifest.res"
- DependencyInformationFile="$(IntDir)\$(ProjectName)\mt.dep"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="DebugDLL|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- BuildLogFile="$(IntDir)\$(ProjectName)\BuildLog.htm"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\src\test;..\src\main;"C:\Program Files\CPPUnit\include";"C:\Program Files\Microsoft Platform SDK\Include";"D:\Program Files\Microsoft Platform SDK\Include";"C:\Apps\cppunit-1.11.6\include";"E:\dev\cppunit-1.11.6\include""
- PreprocessorDefinitions="WIN32;WIN32_LEAN_AND_MEAN;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;DECAF_DLL"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- ObjectFile="$(IntDir)\$(ProjectName)\"
- ProgramDataBaseFileName="$(IntDir)\$(ProjectName)\vc80.pdb"
- XMLDocumentationFileName="$(IntDir)\$(ProjectName)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- DisableSpecificWarnings="4290, 4101"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ws2_32.lib rpcrt4.lib cppunitd.lib"
- OutputFile="$(OutDir)\$(ProjectName).exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories=""C:\Program Files\CPPUnit\lib";"C:\Apps\cppunit-1.11.6\lib";"E:\dev\cppunit-1.11.6\lib";"C:\Program Files\Microsoft Platform SDK\Lib";"D:\Program Files\Microsoft Platform SDK\Lib""
- ManifestFile="$(IntDir)\$(ProjectName)\$(TargetFileName).intermediate.manifest"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- OutputManifestFile="$(IntDir)\$(ProjectName)\$(TargetFileName).embed.manifest"
- ManifestResourceFile="$(IntDir)\$(ProjectName)\$(TargetFileName).embed.manifest.res"
- DependencyInformationFile="$(IntDir)\$(ProjectName)\mt.dep"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="decaf"
- >
- <Filter
- Name="io"
- >
- <File
- RelativePath="..\src\test\decaf\io\BufferedInputStreamTest.cpp"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\io\BufferedInputStreamTest.h"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\io\BufferedOutputStreamTest.cpp"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\io\BufferedOutputStreamTest.h"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\io\ByteArrayInputStreamTest.cpp"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\io\ByteArrayInputStreamTest.h"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\io\ByteArrayOutputStreamTest.cpp"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\io\ByteArrayOutputStreamTest.h"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\io\DataInputStreamTest.cpp"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\io\DataInputStreamTest.h"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\io\DataOutputStreamTest.cpp"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\io\DataOutputStreamTest.h"
- >
- </File>
- </Filter>
- <Filter
- Name="lang"
- >
- <File
- RelativePath="..\src\test\decaf\lang\BooleanTest.cpp"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\lang\BooleanTest.h"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\lang\IntegerTest.cpp"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\lang\IntegerTest.h"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\lang\LongTest.cpp"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\lang\LongTest.h"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\lang\ThreadTest.cpp"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\lang\ThreadTest.h"
- >
- </File>
- </Filter>
- <Filter
- Name="util"
- >
- <File
- RelativePath="..\src\test\decaf\util\DateTest.cpp"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\util\DateTest.h"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\util\Endian.cpp"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\util\Endian.h"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\util\GuidTest.cpp"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\util\GuidTest.h"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\util\StringTokenizerTest.cpp"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\util\StringTokenizerTest.h"
- >
- </File>
- <Filter
- Name="concurrent"
- >
- <File
- RelativePath="..\src\test\decaf\util\concurrent\CountDownLatchTest.cpp"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\util\concurrent\CountDownLatchTest.h"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\util\concurrent\MutexTest.cpp"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\util\concurrent\MutexTest.h"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\util\concurrent\ThreadPoolTest.cpp"
- >
- </File>
- <File
- RelativePath="..\src\test\decaf\util\concurrent\ThreadPoolTest.h"
- >
- </File>
- </Filter>
- </Filter>
- </Filter>
- <File
- RelativePath="..\src\test\main.cpp"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/src/decaf/vs2005-build/vs2005-decaf.sln b/src/decaf/vs2005-build/vs2005-decaf.sln
deleted file mode 100644
index e76b9f6..0000000
--- a/src/decaf/vs2005-build/vs2005-decaf.sln
+++ /dev/null
@@ -1,51 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual C++ Express 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vs2005-decaf", "vs2005-decaf.vcproj", "{D85BD1AB-82E9-4012-BEBE-67AD5CE2E399}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vs2005-decaf-unittests", "vs2005-decaf-unittests.vcproj", "{71582D83-8CC9-4C85-83BF-2E272B6DAE8A}"
- ProjectSection(ProjectDependencies) = postProject
- {D85BD1AB-82E9-4012-BEBE-67AD5CE2E399} = {D85BD1AB-82E9-4012-BEBE-67AD5CE2E399}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vs2005-decaf-example", "vs2005-decaf-example.vcproj", "{3F0BD46A-0AD3-4FAE-9962-F3A252E53498}"
- ProjectSection(ProjectDependencies) = postProject
- {D85BD1AB-82E9-4012-BEBE-67AD5CE2E399} = {D85BD1AB-82E9-4012-BEBE-67AD5CE2E399}
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- DebugDLL|Win32 = DebugDLL|Win32
- Release|Win32 = Release|Win32
- ReleaseDLL|Win32 = ReleaseDLL|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {D85BD1AB-82E9-4012-BEBE-67AD5CE2E399}.Debug|Win32.ActiveCfg = Debug|Win32
- {D85BD1AB-82E9-4012-BEBE-67AD5CE2E399}.Debug|Win32.Build.0 = Debug|Win32
- {D85BD1AB-82E9-4012-BEBE-67AD5CE2E399}.DebugDLL|Win32.ActiveCfg = DebugDLL|Win32
- {D85BD1AB-82E9-4012-BEBE-67AD5CE2E399}.DebugDLL|Win32.Build.0 = DebugDLL|Win32
- {D85BD1AB-82E9-4012-BEBE-67AD5CE2E399}.Release|Win32.ActiveCfg = Release|Win32
- {D85BD1AB-82E9-4012-BEBE-67AD5CE2E399}.Release|Win32.Build.0 = Release|Win32
- {D85BD1AB-82E9-4012-BEBE-67AD5CE2E399}.ReleaseDLL|Win32.ActiveCfg = ReleaseDLL|Win32
- {D85BD1AB-82E9-4012-BEBE-67AD5CE2E399}.ReleaseDLL|Win32.Build.0 = ReleaseDLL|Win32
- {71582D83-8CC9-4C85-83BF-2E272B6DAE8A}.Debug|Win32.ActiveCfg = Debug|Win32
- {71582D83-8CC9-4C85-83BF-2E272B6DAE8A}.Debug|Win32.Build.0 = Debug|Win32
- {71582D83-8CC9-4C85-83BF-2E272B6DAE8A}.DebugDLL|Win32.ActiveCfg = DebugDLL|Win32
- {71582D83-8CC9-4C85-83BF-2E272B6DAE8A}.DebugDLL|Win32.Build.0 = DebugDLL|Win32
- {71582D83-8CC9-4C85-83BF-2E272B6DAE8A}.Release|Win32.ActiveCfg = Release|Win32
- {71582D83-8CC9-4C85-83BF-2E272B6DAE8A}.Release|Win32.Build.0 = Release|Win32
- {71582D83-8CC9-4C85-83BF-2E272B6DAE8A}.ReleaseDLL|Win32.ActiveCfg = ReleaseDLL|Win32
- {71582D83-8CC9-4C85-83BF-2E272B6DAE8A}.ReleaseDLL|Win32.Build.0 = ReleaseDLL|Win32
- {3F0BD46A-0AD3-4FAE-9962-F3A252E53498}.Debug|Win32.ActiveCfg = Debug|Win32
- {3F0BD46A-0AD3-4FAE-9962-F3A252E53498}.Debug|Win32.Build.0 = Debug|Win32
- {3F0BD46A-0AD3-4FAE-9962-F3A252E53498}.DebugDLL|Win32.ActiveCfg = DebugDLL|Win32
- {3F0BD46A-0AD3-4FAE-9962-F3A252E53498}.DebugDLL|Win32.Build.0 = DebugDLL|Win32
- {3F0BD46A-0AD3-4FAE-9962-F3A252E53498}.Release|Win32.ActiveCfg = Release|Win32
- {3F0BD46A-0AD3-4FAE-9962-F3A252E53498}.Release|Win32.Build.0 = Release|Win32
- {3F0BD46A-0AD3-4FAE-9962-F3A252E53498}.ReleaseDLL|Win32.ActiveCfg = ReleaseDLL|Win32
- {3F0BD46A-0AD3-4FAE-9962-F3A252E53498}.ReleaseDLL|Win32.Build.0 = ReleaseDLL|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/src/decaf/vs2005-build/vs2005-decaf.vcproj b/src/decaf/vs2005-build/vs2005-decaf.vcproj
deleted file mode 100644
index c5653a6..0000000
--- a/src/decaf/vs2005-build/vs2005-decaf.vcproj
+++ /dev/null
@@ -1,794 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="vs2005-decaf"
- ProjectGUID="{D85BD1AB-82E9-4012-BEBE-67AD5CE2E399}"
- RootNamespace="vs2005decaf"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\$(ProjectName)"
- ConfigurationType="4"
- CharacterSet="1"
- BuildLogFile="$(IntDir)\$(ProjectName)\BuildLog.htm"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- UseUnicodeResponseFiles="false"
- Optimization="0"
- AdditionalIncludeDirectories="..\src\main;"C:\Program Files\Microsoft Platform SDK\Include";"D:\Program Files\Microsoft Platform SDK\Include""
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;WIN32_LEAN_AND_MEAN;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;$(NOINHERIT)"
- KeepComments="false"
- MinimalRebuild="false"
- ExceptionHandling="1"
- BasicRuntimeChecks="0"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- ObjectFile="$(IntDir)\$(ProjectName)\"
- ProgramDataBaseFileName="$(IntDir)\$(ProjectName)\vc80.pdb"
- XMLDocumentationFileName="$(IntDir)\$(ProjectName)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- DisableSpecificWarnings="4290;4101"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libdecafd.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\$(ProjectName)"
- ConfigurationType="4"
- CharacterSet="1"
- WholeProgramOptimization="1"
- BuildLogFile="$(IntDir)\$(ProjectName)\BuildLog.htm"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- UseUnicodeResponseFiles="false"
- AdditionalIncludeDirectories="..\src\main;"C:\Program Files\Microsoft Platform SDK\Include";"D:\Program Files\Microsoft Platform SDK\Include""
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;WIN32_LEAN_AND_MEAN;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;$(NOINHERIT)"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- ObjectFile="$(IntDir)\$(ProjectName)\"
- ProgramDataBaseFileName="$(IntDir)\$(ProjectName)\vc80.pdb"
- XMLDocumentationFileName="$(IntDir)\$(ProjectName)\"
- WarningLevel="2"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)\libdecaf.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ReleaseDLL|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="1"
- WholeProgramOptimization="1"
- BuildLogFile="$(IntDir)\$(ProjectName)\BuildLog.htm"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- UseUnicodeResponseFiles="false"
- AdditionalIncludeDirectories="..\src\main;"C:\Program Files\Microsoft Platform SDK\Include";"D:\Program Files\Microsoft Platform SDK\Include""
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;WIN32_LEAN_AND_MEAN;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_WINDOWS;_USRDLL;DECAF_DLL;DECAF_EXPORTS;$(NOINHERIT)"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- ObjectFile="$(IntDir)\$(ProjectName)\"
- ProgramDataBaseFileName="$(IntDir)\$(ProjectName)\vc80.pdb"
- XMLDocumentationFileName="$(IntDir)\$(ProjectName)\"
- WarningLevel="2"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- DisableSpecificWarnings="4251"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ws2_32.lib rpcrt4.lib"
- OutputFile="$(OutDir)\decaf.dll"
- GenerateDebugInformation="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="DebugDLL|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="1"
- BuildLogFile="$(IntDir)\$(ProjectName)\BuildLog.htm"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- UseUnicodeResponseFiles="false"
- Optimization="0"
- AdditionalIncludeDirectories="..\src\main;"C:\Program Files\Microsoft Platform SDK\Include";"D:\Program Files\Microsoft Platform SDK\Include""
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;WIN32_LEAN_AND_MEAN;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_WINDOWS;_USRDLL;DECAF_DLL;DECAF_EXPORTS;$(NOINHERIT)"
- KeepComments="false"
- MinimalRebuild="false"
- ExceptionHandling="1"
- BasicRuntimeChecks="0"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- ObjectFile="$(IntDir)\$(ProjectName)\"
- ProgramDataBaseFileName="$(IntDir)\$(ProjectName)\vc80.pdb"
- XMLDocumentationFileName="$(IntDir)\$(ProjectName)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- DisableSpecificWarnings="4290;4101;4251"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ws2_32.lib rpcrt4.lib"
- OutputFile="$(OutDir)\decafd.dll"
- GenerateDebugInformation="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="decaf"
- >
- <Filter
- Name="io"
- >
- <File
- RelativePath="..\src\main\decaf\io\BlockingByteArrayInputStream.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\BlockingByteArrayInputStream.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\BufferedInputStream.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\BufferedInputStream.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\BufferedOutputStream.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\BufferedOutputStream.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\ByteArrayInputStream.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\ByteArrayInputStream.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\ByteArrayOutputStream.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\ByteArrayOutputStream.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\Closeable.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\DataInputStream.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\DataInputStream.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\DataOutputStream.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\DataOutputStream.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\EOFException.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\FilterInputStream.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\FilterOutputStream.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\InputStream.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\IOException.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\OutputStream.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\Reader.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\StandardErrorOutputStream.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\io\Writer.h"
- >
- </File>
- </Filter>
- <Filter
- Name="lang"
- >
- <File
- RelativePath="..\src\main\decaf\lang\Boolean.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\Boolean.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\Character.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\Exception.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\Exception.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\Integer.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\Integer.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\Long.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\Long.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\Math.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\Number.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\Runnable.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\Thread.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\Thread.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\Throwable.h"
- >
- </File>
- <Filter
- Name="exceptions"
- >
- <File
- RelativePath="..\src\main\decaf\lang\exceptions\ExceptionDefines.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\exceptions\IllegalArgumentException.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\exceptions\IllegalMonitorStateException.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\exceptions\IllegalStateException.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\exceptions\IndexOutOfBoundsException.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\exceptions\InterruptedException.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\exceptions\InvalidStateException.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\exceptions\NoSuchElementException.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\exceptions\NullPointerException.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\exceptions\RuntimeException.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\lang\exceptions\UnsupportedOperationException.h"
- >
- </File>
- </Filter>
- </Filter>
- <Filter
- Name="net"
- >
- <File
- RelativePath="..\src\main\decaf\net\BufferedSocket.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\net\BufferedSocket.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\net\ServerSocket.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\net\ServerSocket.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\net\Socket.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\net\SocketError.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\net\SocketError.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\net\SocketException.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\net\SocketInputStream.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\net\SocketInputStream.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\net\SocketOutputStream.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\net\SocketOutputStream.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\net\TcpSocket.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\net\TcpSocket.h"
- >
- </File>
- </Filter>
- <Filter
- Name="util"
- >
- <File
- RelativePath="..\src\main\decaf\util\Config.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\Date.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\Date.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\Guid.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\Guid.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\Map.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\Properties.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\Queue.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\Set.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\StringTokenizer.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\StringTokenizer.h"
- >
- </File>
- <Filter
- Name="logging"
- >
- <File
- RelativePath="..\src\main\decaf\util\logging\ConsoleHandler.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\Filter.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\Formatter.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\Handler.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\Logger.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\Logger.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\LoggerCommon.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\LoggerDefines.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\LoggerHierarchy.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\LoggerHierarchy.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\LogManager.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\LogManager.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\LogRecord.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\LogWriter.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\LogWriter.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\MarkBlockLogger.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\PropertiesChangeListener.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\SimpleFormatter.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\SimpleLogger.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\SimpleLogger.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\logging\StreamHandler.h"
- >
- </File>
- </Filter>
- <Filter
- Name="concurrent"
- >
- <File
- RelativePath="..\src\main\decaf\util\concurrent\Concurrent.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\concurrent\CountDownLatch.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\concurrent\CountDownLatch.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\concurrent\Lock.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\concurrent\Mutex.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\concurrent\Mutex.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\concurrent\PooledThread.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\concurrent\PooledThread.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\concurrent\PooledThreadListener.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\concurrent\Synchronizable.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\concurrent\TaskListener.h"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\concurrent\ThreadPool.cpp"
- >
- </File>
- <File
- RelativePath="..\src\main\decaf\util\concurrent\ThreadPool.h"
- >
- </File>
- </Filter>
- </Filter>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>