diff --git a/.gitignore b/.gitignore
index d40a8aa61..64d0077d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -104,4 +104,7 @@ exported1.all.bin
/libsrc/ffdec_cli/dist/
/libsrc/ffdec_cli/coverage.ec
/out/
-/.idea/
\ No newline at end of file
+/.idea/
+/libsrc/decimal/nbproject/private/
+/libsrc/decimal/dist/
+/libsrc/decimal/build/
diff --git a/lib/decimal.jar b/lib/decimal.jar
new file mode 100644
index 000000000..9b54c7f5d
Binary files /dev/null and b/lib/decimal.jar differ
diff --git a/lib/decimal.license.txt b/lib/decimal.license.txt
new file mode 100644
index 000000000..d64569567
--- /dev/null
+++ b/lib/decimal.license.txt
@@ -0,0 +1,202 @@
+
+ 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/libsrc/decimal/build.xml b/libsrc/decimal/build.xml
new file mode 100644
index 000000000..d7aa0ee82
--- /dev/null
+++ b/libsrc/decimal/build.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+ Builds, tests, and runs the project decimal.
+
+
+
+
+
+
+
+
diff --git a/libsrc/decimal/manifest.mf b/libsrc/decimal/manifest.mf
new file mode 100644
index 000000000..328e8e5bc
--- /dev/null
+++ b/libsrc/decimal/manifest.mf
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
diff --git a/libsrc/decimal/nbproject/build-impl.xml b/libsrc/decimal/nbproject/build-impl.xml
new file mode 100644
index 000000000..e2b5fa701
--- /dev/null
+++ b/libsrc/decimal/nbproject/build-impl.xml
@@ -0,0 +1,1771 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set src.dir
+ Must set test.src.dir
+ Must set build.dir
+ Must set dist.dir
+ Must set build.classes.dir
+ Must set dist.javadoc.dir
+ Must set build.test.classes.dir
+ Must set build.test.results.dir
+ Must set build.classes.excludes
+ Must set dist.jar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No tests executed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+ java -jar "${dist.jar.resolved}"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must set fix.includes
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set profile.class
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+ Some tests failed; see details above.
+
+
+
+ Must select some files in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+ Must select one file in the IDE or set test.class
+
+
+
+ Must select one file in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libsrc/decimal/nbproject/genfiles.properties b/libsrc/decimal/nbproject/genfiles.properties
new file mode 100644
index 000000000..445d823c9
--- /dev/null
+++ b/libsrc/decimal/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=14659e15
+build.xml.script.CRC32=5af3e66c
+build.xml.stylesheet.CRC32=f85dc8f2@1.111.0.48
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=14659e15
+nbproject/build-impl.xml.script.CRC32=03a6cc80
+nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.111.0.48
diff --git a/libsrc/decimal/nbproject/project.properties b/libsrc/decimal/nbproject/project.properties
new file mode 100644
index 000000000..80cccd615
--- /dev/null
+++ b/libsrc/decimal/nbproject/project.properties
@@ -0,0 +1,117 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=false
+annotation.processing.processors.list=
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+application.title=decimal
+application.vendor=
+auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+ ${run.classpath}
+debug.modulepath=\
+ ${run.modulepath}
+debug.test.classpath=\
+ ${run.test.classpath}
+debug.test.modulepath=\
+ ${run.test.modulepath}
+# Files in build.classes.dir which should be excluded from distribution jar
+dist.archive.excludes=
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/decimal.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+dist.jlink.dir=${dist.dir}/jlink
+dist.jlink.output=${dist.jlink.dir}/decimal
+endorsed.classpath=
+excludes=
+includes=**
+jar.archive.disabled=${jnlp.enabled}
+jar.compress=false
+jar.index=${jnlp.enabled}
+javac.classpath=
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.external.vm=true
+javac.modulepath=
+javac.processormodulepath=
+javac.processorpath=\
+ ${javac.classpath}
+javac.source=1.8
+javac.target=1.8
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+javac.test.modulepath=\
+ ${javac.modulepath}
+javac.test.processorpath=\
+ ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.html5=false
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+# The jlink additional root modules to resolve
+jlink.additionalmodules=
+# The jlink additional command line parameters
+jlink.additionalparam=
+jlink.launcher=true
+jlink.launcher.name=decimal
+jnlp.codebase.type=no.codebase
+jnlp.descriptor=application
+jnlp.enabled=false
+jnlp.mixed.code=default
+jnlp.offline-allowed=false
+jnlp.signed=false
+jnlp.signing=
+jnlp.signing.alias=
+jnlp.signing.keystore=
+main.class=
+# Optional override of default Application-Library-Allowable-Codebase attribute identifying the locations where your signed RIA is expected to be found.
+manifest.custom.application.library.allowable.codebase=
+# Optional override of default Caller-Allowable-Codebase attribute identifying the domains from which JavaScript code can make calls to your RIA without security prompts.
+manifest.custom.caller.allowable.codebase=
+# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed
+manifest.custom.codebase=
+# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions)
+manifest.custom.permissions=
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+mkdist.disabled=false
+platform.active=default_platform
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project.
+# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
+# To set system properties for unit tests define test-sys-prop.name=value:
+run.jvmargs=
+run.modulepath=\
+ ${javac.modulepath}
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+run.test.modulepath=\
+ ${javac.test.modulepath}
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test
diff --git a/libsrc/decimal/nbproject/project.xml b/libsrc/decimal/nbproject/project.xml
new file mode 100644
index 000000000..d937e971a
--- /dev/null
+++ b/libsrc/decimal/nbproject/project.xml
@@ -0,0 +1,15 @@
+
+
+ org.netbeans.modules.java.j2seproject
+
+
+ decimal
+
+
+
+
+
+
+
+
+
diff --git a/libsrc/decimal/src/macromedia/asc/util/Decimal128.java b/libsrc/decimal/src/macromedia/asc/util/Decimal128.java
new file mode 100644
index 000000000..820afaaa2
--- /dev/null
+++ b/libsrc/decimal/src/macromedia/asc/util/Decimal128.java
@@ -0,0 +1,1163 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package macromedia.asc.util;
+
+import java.math.*;
+import java.lang.ArithmeticException;
+
+public class Decimal128 {
+
+ private static final byte DEC_NAN = 0x01;
+ private static final byte DEC_SNAN = 0x02;
+ private static final byte DEC_INF = 0x04;
+ private static final byte DEC_NEG = 0x08;
+
+ private static final byte DEC_SPECIAL = (DEC_NAN | DEC_SNAN | DEC_INF);
+
+ private byte flags;
+ private BigDecimal value;
+
+ public static final int MAX_PRECISION = 34;
+
+ public static final BigDecimal BigDecimalZERO = new BigDecimal("0");
+
+ public static final Decimal128 ZERO = new Decimal128(BigDecimalZERO, (byte)0);
+ public static final Decimal128 NEGZERO = new Decimal128(BigDecimalZERO, DEC_NEG);
+ public static final Decimal128 ONE = new Decimal128(new BigDecimal("1"), (byte)0);
+ public static final Decimal128 NEG1 = new Decimal128(new BigDecimal("-1"), DEC_NEG);
+ public static final Decimal128 NaN = new Decimal128(BigDecimalZERO, DEC_NAN);
+ public static final Decimal128 INFINITY = new Decimal128(BigDecimalZERO, DEC_INF);
+ public static final Decimal128 NEGINFINITY = new Decimal128(BigDecimalZERO, (byte)(DEC_INF | DEC_NEG));
+
+ /* private constructors used internally */
+ private Decimal128() {
+ flags = 0;
+ value = BigDecimalZERO; // or maybe leave null
+ }
+
+ private Decimal128(BigDecimal val, byte flagval) {
+ value = val;
+ flags = flagval;
+ }
+
+ /* public constructors */
+ public Decimal128(String str) {
+ // parse string that's either NaN, SNaN, (+/-)INF[INITY], or valid BigDecimal
+ flags = 0;
+ parseDecimalNumber(str.toCharArray(), Decimal128Context.DECIMAL128);
+ }
+
+ public Decimal128(String str, Decimal128Context ctx) {
+ // parse string that's either NaN, SNaN, (+/-)INF[INITY], or valid BigDecimal
+ flags = 0;
+ parseDecimalNumber(str.toCharArray(), ctx);
+ }
+
+ public Decimal128(char in[]) {
+ // same as string
+ flags = 0;
+ parseDecimalNumber(in, Decimal128Context.DECIMAL128);
+ }
+
+ public Decimal128(char in[], Decimal128Context ctx) {
+ // same as string
+ flags = 0;
+ parseDecimalNumber(in, ctx);
+ }
+
+
+ private void parseDecimalNumber(char in[], Decimal128Context ctx) {
+ boolean seenS = false;
+ value = BigDecimalZERO; // until proven otherwise
+ preparse: do {
+ for (int i = 0; i < in.length; i++) {
+ char c = in[i];
+ if (Character.isDigit(c) || c == '.') {
+ if (seenS)
+ break; // invalid input
+ else
+ break preparse; // parse as BigDecimal
+ }
+ if (c == '+') {
+ if (seenS)
+ break; // invalid input
+ continue; // NaN and infinity can have signs
+ }
+ if (c == '-') {
+ if (seenS)
+ break; // invalid input
+ flags = DEC_NEG;
+ continue;
+ }
+ if ((c == 'S') || (c == 's')) {
+ if (seenS)
+ break; // invalid input
+ seenS = true;
+ continue;
+ }
+ if (c == 'N') {
+ if (((i+2) < in.length) && (in[i+1] == 'a') && (in[i+2] == 'N')) {
+ flags |= (seenS)? DEC_SNAN : DEC_NAN;
+ if ((i+3) < in.length) {
+ // additional characters after NAN.
+ for (int j = i+3; j < in.length; j++) {
+ if (!Character.isDigit(in[j])) {
+ throw new IllegalArgumentException("invalid NaN payload");
+ }
+ }
+ value = new BigDecimal(in, i+3, (in.length - (i+3)), ctx.mathCtx());
+ // we know scale = 0 since we checked for only digits
+ if (value.precision() > 33)
+ value = BigDecimalZERO;
+ }
+ return;
+ }
+ else break;
+ }
+ if (c == 'I') {
+ if (seenS)
+ break;
+ if (((i+8) == in.length) && (in[i+1] == 'n') && (in[i+2] == 'f')
+ && (in[i+3] == 'i') && (in[i+4] == 'n')
+ && (in[i+5] == 'i') && (in[i+6] == 't') && (in[i+7] == 'y')) {
+ flags |= DEC_INF;
+ return; // nothing more to do here
+ }
+ // temporarily allow short infinity literals to run Mike's testcases
+ if (((i+3) == in.length) && (in[i+1] == 'n') && (in[i+2] == 'f')) {
+ flags |= DEC_INF;
+ return; // nothing more to do here
+ }
+ break; // invalid input
+ }
+ }
+ // only get here if input is invalid
+ throw new IllegalArgumentException("invalid decimal literal");
+ } while (false); // dummy loop labeled preparse
+
+ // we got here because we saw something that looks like the beginning of a number
+ value = new BigDecimal(in, ctx.mathCtx());
+ this.ClampOverflow(ctx);
+ }
+
+ public Decimal128(int val) {
+ flags = (val >= 0)?0 : DEC_NEG;
+ value = new BigDecimal(val, MathContext.DECIMAL128);
+ }
+
+ public Decimal128(int val, Decimal128Context ctx) {
+ flags = (val >= 0)?0 : DEC_NEG;
+ value = new BigDecimal(val, ctx.mathCtx());
+ }
+
+ public Decimal128(double val) {
+ flags = (val >= 0)?0 : DEC_NEG;
+ value = BigDecimalZERO; // until proven otherwise
+ if (Double.isNaN(val)) {
+ flags |= DEC_NAN;
+ }
+ else if (Double.isInfinite(val)) {
+ flags |= DEC_INF; // sign already set above.
+ }
+ else
+ value = new BigDecimal(val, MathContext.DECIMAL128);
+ }
+
+ public Decimal128(double val, Decimal128Context ctx) {
+ flags = (val >= 0)?0 : DEC_NEG;
+ value = BigDecimalZERO; // until proven otherwise
+ if (Double.isNaN(val)) {
+ flags |= DEC_NAN;
+ }
+ else if (Double.isInfinite(val)) {
+ flags |= DEC_INF; // sign already set above.
+ }
+ else
+ value = new BigDecimal(val, ctx.mathCtx());
+ }
+
+ public Decimal128(long val) {
+ flags = (val >= 0)?0 : DEC_NEG;
+ value = new BigDecimal(val, MathContext.DECIMAL128);
+ }
+
+ public Decimal128(long val, Decimal128Context ctx) {
+ flags = (val >= 0)?0 : DEC_NEG;
+ value = new BigDecimal(val, ctx.mathCtx());
+ }
+
+ /* operations to/from IEEE representation */
+
+ private static final int mask[] = {0x000, 0x001, 0x003, 0x007, 0x00F,
+ 0x01F, 0x03F, 0x07F, 0x0FF, 0x1FF, 0x3FF}; // can't declare static inside IEEERep
+
+ private class IEEERep {
+ // class to manipulate the representation of a IEEE 128 bit floating point
+ // currently generates format specified by http://www2.hursley.ibm.com/decimal/decbits.html
+
+ int data[] = {0, 0, 0, 0}; // data[0] is msb, containing sign, combo field, etc.
+ // data is initialized to 0, methods below OR in values taking advantage of this fact.
+
+ boolean negative=false, qNaN=false, sNaN=false, infinite=false, finalized=false;
+ int exponent;
+ short topDigit;
+
+ int currentDatum, currentShift, totalDigits;
+
+ /* *****************************************************************************
+ * Routines for taking apart IEEE representation
+ *******************************************************************************/
+ IEEERep() { // use this constructor to build a representation
+ topDigit = 0;
+ // initialize state for writing unit
+ currentDatum = 3;
+ currentShift = 0;
+ totalDigits = 0;
+ }
+
+ void setNeg() {
+ negative = true;
+ }
+ void setNaN(boolean signalling) {
+ if (signalling)
+ sNaN = true;
+ else qNaN = true;
+ }
+ void setInfinite() {
+ infinite = true;
+ }
+
+ void setExponent(int exp) { // exp is biased exponent
+ exponent = exp;
+ }
+
+ void addUnit (short unit) {
+ // add 3 more digits to the number. Digits are added in groups of 3, least significant
+ // first, the value passed to this routine is a number between 0 and 999. If 33 digits
+ // have already been added, it is an error if unit > 9.
+
+ if (totalDigits == 34)
+ throw new IllegalArgumentException("trying to add more than 34 digits to IEEE128");
+ if (totalDigits == 33) {
+ if (unit > 9)
+ throw new IllegalArgumentException("trying to add more than 34 digits to IEEE128");
+ topDigit = unit;
+ totalDigits++;
+ return;
+ }
+ totalDigits += 3;
+ int dpd = DenselyPackedDecimal.Bin2DPD(unit);
+ if (currentShift <= 22) {
+ // dpd fits into currentDatum completely
+ data[currentDatum] |= dpd << currentShift;
+ currentShift += 10;
+ }
+ else {
+ // bits overlap next data word
+ int onThis = 32 - currentShift; // will be between 0 and 9
+ if (onThis != 0)
+ data[currentDatum] |= dpd << currentShift;
+ data[currentDatum-1] |= (dpd >>> onThis);
+ currentDatum--;
+ currentShift = 10 - onThis;
+ }
+ }
+
+ byte[] getRep() {
+ if (!finalized) {
+ int combo = 0;
+ if (negative)
+ data[0] |= 0x80000000;
+ if (infinite)
+ combo = 0x1E;
+ else if (sNaN || qNaN) {
+ combo = 0x1F;
+ if (sNaN)
+ exponent = 0x800; // high order bit on in continuation field
+ else
+ exponent = 0;
+ }
+ else {
+ // finite number
+ if (topDigit < 8)
+ combo = topDigit | ((exponent >>> 9) & 0x18);
+ else
+ combo = 0x18 | (((exponent >>> 12) & 0x3) << 1) | (topDigit - 8);
+ }
+ data[0] |= (combo <<26) | ((exponent & 0xFFF) << 14);
+ finalized = true;
+ }
+ byte[] result = new byte[16];
+ int ndx = 0;
+ for (int i = 0; i < 16; i+= 4) {
+ int datum = data[ndx++];
+ result[i] = (byte)(datum >>> 24);
+ result[i+1] = (byte)((datum >>> 16) & 0xFF);
+ result[i+2] = (byte)((datum >>> 8) & 0xFF);
+ result[i+3] = (byte)(datum & 0xFF);
+ }
+ return result;
+ }
+
+ /* *****************************************************************************
+ * Routines for taking apart IEEE representation
+ *******************************************************************************/
+
+ int currentBit;
+
+ IEEERep(byte[] rep) { // use this constructor to take apart a representation
+ int ndx = 0;
+ for (int i = 0; i < 16; i+= 4) {
+ data[ndx++] = ((rep[i] & 0xFF)<<24) + ((rep[i+1] & 0xFF)<<16) +
+ ((rep[i+2] & 0xFF) <<8) + (rep[i+3] & 0xFF);
+ }
+ if ((data[0] & 0x80000000) != 0)
+ negative = true;
+ int combo = (data[0] >> 26) & 0x1F;
+ if (combo == 0x1E)
+ infinite = true;
+ else if (combo == 0x1F) {
+ if ((data[0] & 0x02000000) != 0)
+ sNaN = true;
+ else qNaN = true;
+ }
+ else {
+ // finite number
+ int expmsb;
+ if ((combo & 0x18) == 0x18) {
+ expmsb = (combo >> 1) & 0x3;
+ topDigit = (short)(8 + (combo & 0x01));
+ }
+ else {
+ expmsb = combo >>> 3;
+ topDigit = (short)(combo & 0x7);
+ }
+ exponent = ((data[0] >>> 14) & 0xFFF) | (expmsb << 12);
+ }
+ // initialize state for reading digits
+ currentDatum = -1;
+ }
+ short getUnit() {
+ // returns bases 1000 units from most significant to least
+ short result = 0;
+ if (currentDatum == -1) {
+ currentDatum = 0;
+ currentBit = 14;
+ return topDigit;
+ }
+ else if (currentDatum > 3) {
+ throw new IllegalArgumentException("trying to read more than 34 digits from IEEE128");
+ }
+ else {
+ if (currentBit >= 10) {
+ // all bits are in the current Datum
+ result = (short)((data[currentDatum] >>> (currentBit - 10)) & 0x3FF);
+ currentBit -= 10;
+ }
+ else {
+ // bits overlap into next Datum
+ int overlap = 10 - currentBit;
+ if (currentBit != 0) {
+ result = (short)((data[currentDatum] & mask[currentBit]) << overlap);
+ }
+ result |= (short)((data[++currentDatum] >>> (32-overlap)));
+ currentBit = 32- overlap;
+ }
+ }
+ return DenselyPackedDecimal.DPD2Bin(result);
+ }
+
+ boolean isInfinite() {
+ return infinite;
+ }
+
+ boolean isNaN() {
+ return (qNaN | sNaN);
+ }
+
+ boolean isSNaN() {
+ return (sNaN);
+ }
+
+ boolean isNegative() {
+ return negative;
+ }
+
+ int getExponent() {
+ return exponent;
+ }
+
+ } // IEEERep class
+
+ private static final int DECIMAL128_Pmax = 34;
+ private static final int DECIMAL128_Emax = 6144;
+ private static final int DECIMAL128_Emin = -6143;
+ private static final int DECIMAL128_Bias = 6176;
+ // highest biased exponent (Elimit-1)
+ private static final int DECIMAL128_Ehigh = (DECIMAL128_Emax+DECIMAL128_Bias-DECIMAL128_Pmax+1);
+
+ public byte[] toIEEE(Decimal128Context ctx) {
+ // returns 16 bytes of IEEE decimal128, big endian
+ int exp; // holds biased exponent
+ short dval;
+ IEEERep ieee = new IEEERep();
+ if ((flags & DEC_NEG) != 0)
+ ieee.setNeg();
+
+ do { // dummy loop to allow break
+ if ((flags & DEC_SPECIAL) == 0) {
+ char[] coefficient = value.abs().unscaledValue().toString().toCharArray();
+ int exponent = -value.scale(); // it appears backward from decNumber
+ int digits = coefficient.length;
+ int ae = exponent + digits - 1;
+ if ((digits > DECIMAL128_Pmax)
+ || (ae > DECIMAL128_Emax)
+ || (ae < DECIMAL128_Emin)) {
+ // possibly out of range. Do things to get it in range
+ Decimal128 n2 = this.add(Decimal128.ZERO, Decimal128Context.DECIMAL128);
+ if ((n2.flags & DEC_INF) != 0) {
+ ieee.setInfinite();
+ break;
+ }
+ coefficient = n2.value.abs().unscaledValue().toString().toCharArray();
+ exponent = -n2.value.scale();
+ digits = coefficient.length;
+ }
+ if (value.compareTo(BigDecimalZERO) == 0) {
+ if (exponent < -DECIMAL128_Bias) {
+ exp = 0;
+ ctx.status |= Decimal128Context.DEC_Clamped;
+ }
+ else {
+ exp = exponent + DECIMAL128_Bias; // bias exponent
+ if (exp > DECIMAL128_Ehigh) {
+ exp = DECIMAL128_Ehigh;
+ ctx.status |= Decimal128Context.DEC_Clamped;
+ }
+ }
+ ieee.setExponent(exp);
+ }
+ else { // nonzero
+ exp = exponent + DECIMAL128_Bias;
+ if (exp > DECIMAL128_Ehigh) {
+ // We want to limit exponent to Ehigh, even if we add trailing
+ // 0's to the coefficient
+ int shift = exp - DECIMAL128_Ehigh;
+ int k;
+ exp = DECIMAL128_Ehigh;
+ ctx.status |= Decimal128Context.DEC_Clamped;
+ char newCoef[] = new char[digits + shift];
+ for (k = 0; k < digits; k++) {
+ newCoef[k] = coefficient[k];
+ }
+ for (k = digits; k < (digits + shift); k++) {
+ newCoef[k] = '0';
+ }
+ coefficient = newCoef;
+ digits += shift;
+ }
+ ieee.setExponent(exp);
+ for (int i = digits-1; i >= 0; i -= 3) {
+ switch (i) {
+ case 0:
+ dval = (short)(coefficient[0] - '0');
+ break;
+ case 1:
+ dval = (short)(10 * (coefficient[0] - '0') + (coefficient[1] - '0'));
+ break;
+ default:
+ dval = (short)(100 * (coefficient[i-2] - '0')
+ + 10 * (coefficient[i-1] - '0') + (coefficient[i] - '0'));
+ }
+ ieee.addUnit(dval);
+ }
+ }
+ }
+ else {
+ if ((flags & DEC_INF) != 0) {
+ ieee.setInfinite();
+ }
+ else {
+ ieee.setNaN((flags & DEC_SNAN) != 0);
+ if (value != BigDecimalZERO) {
+ char[] payload = value.abs().unscaledValue().toString().toCharArray();
+ int digits = payload.length;
+ ieee.setExponent(0);
+ for (int i = digits-1; i >= 0; i -= 3) {
+ switch (i) {
+ case 0:
+ dval = (short)(payload[0] - '0');
+ break;
+ case 1:
+ dval = (short)(10 * (payload[0] - '0') + (payload[1] - '0'));
+ break;
+ default:
+ dval = (short)(100 * (payload[i-2] - '0')
+ + 10 * (payload[i-1] - '0') + (payload[i] - '0'));
+ }
+ ieee.addUnit(dval);
+ }
+ }
+ }
+ }
+ } while (false);
+
+ return ieee.getRep();
+ }
+
+ public byte[] toIEEE() {
+ return toIEEE(Decimal128Context.DECIMAL128);
+ }
+ /*
+ JPEXS
+ public ByteList toByteList(ByteList result) {
+ byte rep[] = toIEEE();
+ if (result == null)
+ result = new ByteList(16);
+ result.set(rep, 16);
+ return result;
+ }*/
+
+ /* constructor to go from IEEE representation */
+
+ /*
+ JPEXS
+ public Decimal128(ByteList rep) {
+ byte reparray[] = rep.toByteArray();
+ initFromIEEE(reparray);
+ }*/
+
+ public Decimal128(byte[] rep) {
+ initFromIEEE(rep);
+ }
+
+ private void initFromIEEE(byte[] rep) {
+ // must be 16 bytes holding an IEEE decimal128, big endian
+ if (rep.length != 16)
+ throw new IllegalArgumentException("Decimal128 needs 16 bytes for representation");
+ IEEERep ieee = new IEEERep(rep);
+ if (ieee.isNegative())
+ flags = DEC_NEG;
+ else
+ flags = 0;
+ if (ieee.isNaN()) {
+ value = BigDecimalZERO; // some day support fancier NaNs
+ if (ieee.isSNaN())
+ flags |= DEC_SNAN;
+ else
+ flags |= DEC_NAN;
+ // and fall through to parse payload
+ }
+ else if (ieee.isInfinite()) {
+ value = BigDecimalZERO; // so it's not uninitialized
+ flags |= DEC_INF;
+ return;
+ }
+ byte thousand[] = {0x03, (byte)0xE8};
+ // Why isn't there a public constructor for BigInteger that takes an int or long or something?
+ BigInteger THOUSAND = new BigInteger(thousand);
+ BigInteger coefficient = BigInteger.ZERO;
+ short unit;
+ boolean leadingZeroes = true;
+ for (int i = 0; i < 12; i++) {
+ unit = ieee.getUnit();
+ if (!leadingZeroes || (unit != 0 )) {
+ if (leadingZeroes) {
+ leadingZeroes = false;
+ }
+ else {
+ coefficient = THOUSAND.multiply(coefficient);
+ }
+ byte unitBytes[] = {(byte)(unit >>> 8), (byte)(unit & 0xFF)};
+ BigInteger bigUnit = new BigInteger(unitBytes);
+ coefficient = coefficient.add(bigUnit);
+ }
+ }
+ int scale = (ieee.isNaN())? 0 : (-(ieee.getExponent() - DECIMAL128_Bias));
+ value = new BigDecimal(coefficient, scale);
+ if ((flags & (DEC_NEG | DEC_NAN | DEC_SNAN)) == DEC_NEG) {
+ value = value.negate(MathContext.DECIMAL128); // don't negate payload
+ }
+ }
+
+ /* to other numeric types */
+ public int intValue() {
+ if ((this.flags & DEC_SPECIAL) != 0) {
+ throw new ArithmeticException("no valid integer value");
+ }
+ return this.value.intValue();
+ }
+
+ public long longValue() {
+ if ((this.flags & DEC_SPECIAL) != 0) {
+ throw new ArithmeticException("no valid long value");
+ }
+ return this.value.longValue();
+ }
+
+ public double doubleValue() {
+ if ((flags & (DEC_NAN | DEC_SNAN)) != 0)
+ return Double.NaN;
+ if ((flags & DEC_INF) != 0) {
+ if ((flags & DEC_NEG) != 0)
+ return Double.NEGATIVE_INFINITY;
+ else
+ return Double.POSITIVE_INFINITY;
+ }
+ return this.value.doubleValue();
+ }
+
+ public String toString() {
+ StringBuilder result = new StringBuilder();
+ if (((flags & DEC_SPECIAL) != 0) && ((flags & DEC_NEG) != 0))
+ result.append('-');
+ if ((flags & (DEC_NAN | DEC_SNAN)) != 0) {
+ if ((flags & DEC_SNAN) != 0) {
+ result.append("S");
+ }
+ result.append("NaN");
+ if (value.compareTo(BigDecimalZERO) != 0) {
+ result.append(value.toString());
+ }
+ }
+ else if ((flags & DEC_INF) != 0) {
+ result.append("Infinity");
+ }
+ else {
+ // a number, but BigDecimal doesn't have -0
+ if (((flags & DEC_NEG) != 0) && (value.compareTo(BigDecimalZERO) == 0)) {
+ result.append('-');
+ }
+ result.append(value.toString());
+ }
+ return result.toString();
+ }
+
+ public String toEngineeringString() {
+ if ((flags & (DEC_NAN | DEC_SNAN)) != 0) {
+ return "NaN"; // what about number after NaN
+ }
+ else if ((flags & DEC_INF) != 0) {
+ return "Infinity";
+ }
+ else {
+ return value.toEngineeringString();
+ }
+ }
+
+ public boolean isNaN() {
+ return ((flags & (DEC_NAN | DEC_SNAN)) != 0);
+ }
+
+ public boolean isQNaN() {
+ return ((flags & DEC_NAN) != 0);
+ }
+
+ public boolean isSNaN() {
+ return ((flags & DEC_SNAN) != 0);
+ }
+
+ public boolean isFinite() {
+ return ((flags & DEC_INF) == 0);
+ }
+
+ public boolean isNegative() {
+ return ((flags & DEC_NEG) != 0);
+ }
+
+ /* helper functions for arithmetic operations */
+ private Decimal128 opNaNs(Decimal128 operand, Decimal128Context ctx) {
+ // either this or operand is NaN or SNan
+ Decimal128 lhs = this;
+ if ((this.flags & DEC_SNAN) != 0) {
+ ctx.status |= Decimal128Context.DEC_Invalid_operation | Decimal128Context.DEC_sNaN;
+ }
+ else if (operand != null && ((operand.flags & DEC_SNAN) != 0)) {
+ lhs = operand;
+ ctx.status |= Decimal128Context.DEC_Invalid_operation | Decimal128Context.DEC_sNaN;
+ }
+ else if ((this.flags & DEC_NAN) == 0) {
+ lhs = operand;
+ }
+ Decimal128 result = new Decimal128(lhs.value, lhs.flags);
+ // we've signaled by setting status, now clear SNAN to NAN if necessary
+ result.flags &= ~DEC_SNAN;
+ result.flags |= DEC_NAN;
+ return result;
+ }
+
+ private void ClampOverflow(Decimal128Context ctx) {
+ // check that scale is within valid range, modify as required to get into
+ // range or set to proper infinity.
+ if ((flags & DEC_SPECIAL) != 0) {
+ return; // special ones are not out of range
+ }
+ // some definitions to keep code below readable
+ // scale of BigDecimals are negative of exponents in Decimal128s
+ BigDecimal resultVal;
+ final int MINSCALE = -(DECIMAL128_Emax - DECIMAL128_Pmax + 1);
+ final int MAXSCALE = DECIMAL128_Bias;
+ int scale = value.scale();
+ if (scale > MAXSCALE) {
+ // see if we can change scale withing ctx.precision
+ int numPrecision = value.precision();
+ // see if we can decrease the precision to lower the scale
+ // but can't make precision less than 1
+ int delta = scale - MAXSCALE;
+ if ((numPrecision - delta) >= 1) {
+ resultVal = value.setScale(MAXSCALE, ctx.getRoundingMode());
+ }
+ else {
+ // can't fit. Return 0 or smallest num, which ever is closer
+ /* 754r says return smallest value only if we would round to it
+ * if we had infinite precision, otherwise return 0.
+ *
+ * TODO: test for possible return of smallest possible non-zero value
+ */
+ value = new BigDecimal(BigInteger.ZERO, MAXSCALE);
+ return;
+ }
+ } // scale > MAXSCALE
+ else if (scale < MINSCALE) {
+ int numPrecision = value.precision();
+ // see if we can increase the precision to raise the scale
+ // but can't make precision greater than ctx.precision
+ int delta = MINSCALE - scale;
+ if ((numPrecision + delta) <= ctx.getPrecision() ||
+ // special case for 0 with a big scale
+ (value.compareTo(BigDecimalZERO) == 0)) {
+ resultVal = value.setScale(MINSCALE, ctx.getRoundingMode());
+ }
+ else {
+ // can't fit. Return Infinity or largest number, depending on rounding
+ RoundingMode mode = ctx.getRoundingMode();
+ if ((flags & DEC_NEG) != 0) {
+ // negative number
+ if (!((mode == RoundingMode.CEILING) || (mode == RoundingMode.DOWN))) {
+ flags = DEC_NEG | DEC_INF;
+ value = BigDecimalZERO;
+ return;
+ }
+ }
+ else {
+ // positive number
+ if (!((mode == RoundingMode.FLOOR) || (mode == RoundingMode.DOWN))) {
+ flags = DEC_INF;
+ value = BigDecimalZERO;
+ return;
+ }
+ }
+ // otherwise fall through to here and return largest possible number of this precision
+ byte nine[] = {(byte)9};
+ BigInteger NINE = new BigInteger(nine);
+ BigInteger total = NINE;
+ for (int i = 1; i < ctx.getPrecision(); i++) {
+ total = NINE.add(total.multiply(BigInteger.TEN));
+ }
+ resultVal = new BigDecimal(total, MINSCALE);
+ if ((flags & DEC_NEG) != 0) {
+ resultVal = resultVal.negate(ctx.mathCtx());
+ }
+ }
+ }
+ else
+ return; // it's in range
+
+ value = resultVal;
+ }
+
+ /* arithmetic operations */
+ public Decimal128 abs() {
+ return this.abs(Decimal128Context.DECIMAL128);
+ }
+
+ public Decimal128 abs(Decimal128Context ctx) {
+ Decimal128 result = new Decimal128();
+ result.flags = this.flags; // in case it's NaN or infinity
+ result.flags &= ~DEC_NEG;
+ result.value = this.value.abs(ctx.mathCtx());
+ return result;
+ }
+
+ public Decimal128 add(Decimal128 addend) {
+ return this.add(addend, Decimal128Context.DECIMAL128);
+ }
+
+ public Decimal128 add(Decimal128 addend, Decimal128Context ctx) {
+ Decimal128 result;
+ int specialbits = ((addend.flags | this.flags) & DEC_SPECIAL);
+ if (specialbits != 0) {
+ if ((specialbits & (DEC_NAN | DEC_SNAN)) != 0) {
+ result = opNaNs(addend, ctx); // one or more NaNs
+ return result;
+ }
+ else {//one or two infinities
+ result = new Decimal128();
+ if ((this.flags & DEC_INF) != 0) {
+ if ((addend.flags & DEC_INF) != 0) {
+ if (((this.flags ^ addend.flags) & DEC_NEG) != 0) { // different signs
+ ctx.status |= Decimal128Context.DEC_Invalid_operation;
+ result.flags = DEC_NAN; // should I do this?
+ return result;
+ }
+ }
+ result.flags = this.flags; // get sign and infinity flag from me
+ }
+ else { // augend is infinite, take its sign
+ result.flags = addend.flags;
+ }
+ return result;
+ }
+ }
+ result = new Decimal128();
+ result.value = this.value.add(addend.value, ctx.mathCtx());
+ if (result.value.compareTo(BigDecimalZERO) < 0)
+ result.flags |= DEC_NEG;
+ result.ClampOverflow(ctx);
+ return result;
+ }
+
+ public boolean equals(Decimal128 num) {
+ // return true if I'm > num
+ Decimal128 comp = this.compareTo(num, Decimal128Context.DECIMAL128);
+ if (comp == ZERO)
+ return true;
+ else
+ return false;
+ }
+
+ public boolean greaterThan(Decimal128 num) {
+ // return true if I'm > num
+ Decimal128 comp = this.compareTo(num, Decimal128Context.DECIMAL128);
+ if (comp == ONE)
+ return true;
+ else
+ return false;
+ }
+
+
+ public boolean greaterThanOrEqual(Decimal128 num) {
+ // return true if I'm >= num
+ Decimal128 comp = this.compareTo(num, Decimal128Context.DECIMAL128);
+ if (comp == ONE || comp == ZERO)
+ return true;
+ else
+ return false;
+ }
+
+ public boolean lessThan(Decimal128 num) {
+ // return true if I'm < num
+ Decimal128 comp = this.compareTo(num, Decimal128Context.DECIMAL128);
+ if (comp == NEG1)
+ return true;
+ else
+ return false;
+ }
+
+
+ public boolean lessThanOrEqual(Decimal128 num) {
+ // return true if I'm <= num
+ Decimal128 comp = this.compareTo(num, Decimal128Context.DECIMAL128);
+ if (comp == NEG1 || comp == ZERO)
+ return true;
+ else
+ return false;
+ }
+
+
+ // can't return just an int because could be NaN
+ private Decimal128 compareTo(Decimal128 val, Decimal128Context ctx) {
+ if (((this.flags | val.flags) & (DEC_NAN | DEC_SNAN)) != 0)
+ return opNaNs(val, ctx);
+ if ((this.flags & DEC_INF) != 0) {
+ // I'm infinite (+|-)
+ if ((this.flags & DEC_NEG) != 0) {
+ // I'm negative infinity, less than anything except another negative infinity
+ if ((val.flags & (DEC_INF | DEC_NEG)) == (DEC_INF | DEC_NEG)) {
+ ctx.status |= Decimal128Context.DEC_Invalid_operation;
+ return NaN;
+ }
+ return NEG1;
+ }
+ else { // I'm infinity, greater than anyone except another infinity
+ if ((val.flags & (DEC_INF | DEC_NEG)) == (DEC_INF)) {
+ ctx.status |= Decimal128Context.DEC_Invalid_operation;
+ return NaN;
+ }
+ return ONE;
+ }
+ }
+ else if ((val.flags & DEC_INF) != 0) {
+ // val is infinite and I'm not
+ if ((val.flags & DEC_NEG) != 0)
+ return ONE;
+ else
+ return NEG1;
+ }
+ else {
+ switch(this.value.compareTo(val.value)) {
+ case 1:
+ return ONE;
+ case -1:
+ return NEG1;
+ default:
+ return ZERO;
+ }
+ }
+ }
+
+ public Decimal128 divide(Decimal128 divisor) {
+ return this.divide(divisor, Decimal128Context.DECIMAL128);
+ }
+
+ public Decimal128 divide(Decimal128 divisor, Decimal128Context ctx) {
+ Decimal128 result;
+ boolean differentsigns = ((this.flags ^ divisor.flags) & DEC_NEG) != 0;
+ int specialbits = ((divisor.flags | this.flags) & DEC_SPECIAL);
+ if (specialbits != 0) {
+ if ((specialbits & (DEC_NAN | DEC_SNAN)) != 0) {
+ return opNaNs(divisor, ctx); // one or more NaNs
+ }
+ else {//one or two infinities
+ result = new Decimal128();
+ if ((this.flags & DEC_INF) != 0) {
+ // I'm infinite
+ if ((divisor.flags & DEC_INF) != 0) {
+ ctx.status |= Decimal128Context.DEC_Invalid_operation;
+ result.flags = DEC_NAN;
+ // if (differentsigns) result.flags |= DEC_NEG;
+ } else {
+ result.flags = DEC_INF;
+ if (differentsigns) result.flags |= DEC_NEG;
+ }
+ }
+ else { // divisor is infinite and I'm not, result is (+|-)0
+ result.value = BigDecimalZERO.setScale(DECIMAL128_Bias); // smallest 0
+ if (differentsigns) result.flags = DEC_NEG;
+ }
+ return result;
+ }
+ }
+ result = new Decimal128();
+ // now check for divide by 0
+ if (divisor.value.compareTo(BigDecimalZERO) == 0) { // don't use equals here
+ // divisor is 0, answer is (+|-)infinity unless I'm also 0
+ if (this.value.compareTo(BigDecimalZERO) == 0) {
+ // oops, 0/0 = NaN
+ ctx.status |= Decimal128Context.DEC_Invalid_operation;
+ result.flags = DEC_NAN;
+ }
+ else {
+ result.value = BigDecimalZERO;
+ result.flags |= DEC_INF;
+ }
+ }
+ else result.value = this.value.divide(divisor.value, ctx.mathCtx());
+ if (differentsigns)
+ result.flags |= DEC_NEG;
+ result.ClampOverflow(ctx);
+ return result;
+ }
+
+ public Decimal128 multiply(Decimal128 multiplicand) {
+ return this.multiply(multiplicand, Decimal128Context.DECIMAL128);
+ }
+
+ public Decimal128 multiply(Decimal128 multiplicand, Decimal128Context ctx) {
+ Decimal128 result;
+ boolean differentsigns = ((this.flags ^ multiplicand.flags) & DEC_NEG) != 0;
+ int specialbits = ((multiplicand.flags | this.flags) & DEC_SPECIAL);
+ if (specialbits != 0) {
+ if ((specialbits & (DEC_NAN | DEC_SNAN)) != 0) {
+ result = opNaNs(multiplicand, ctx); // one or more NaNs
+ return result;
+ }
+ else { //one or two infinities
+ result = new Decimal128();
+ if ((this.flags & DEC_INF) != 0) {
+ // I'm infinite, all is well unless he is 0
+ if (((multiplicand.flags & DEC_INF) == 0) && (multiplicand.value.compareTo(BigDecimalZERO) == 0)) {
+ ctx.status |= Decimal128Context.DEC_Invalid_operation; // should I do this?
+ result.flags = DEC_NAN;
+ return result;
+ }
+ }
+ else {
+ // He's infinite, I'd better not be 0
+ if (this.value.compareTo(BigDecimalZERO) == 0) {
+ ctx.status |= Decimal128Context.DEC_Invalid_operation; // should I do this?
+ result.flags = DEC_NAN;
+ return result;
+ }
+ }
+ result.flags = DEC_INF;
+ if (differentsigns) result.flags |= DEC_NEG;
+ return result;
+ }
+ }
+ result = new Decimal128();
+ result.value = this.value.multiply(multiplicand.value, ctx.mathCtx());
+ if (differentsigns) result.flags |= DEC_NEG;
+ result.ClampOverflow(ctx);
+ return result;
+ }
+
+ public Decimal128 remainder(Decimal128 divisor) {
+ return this.remainder(divisor, Decimal128Context.DECIMAL128);
+ }
+
+ public Decimal128 remainder(Decimal128 divisor, Decimal128Context ctx) {
+ Decimal128 result;
+ boolean differentsigns = ((this.flags ^ divisor.flags) & DEC_NEG) != 0;
+ int specialbits = ((divisor.flags | this.flags) & DEC_SPECIAL);
+ if (specialbits != 0) {
+ if ((specialbits & (DEC_NAN | DEC_SNAN)) != 0) {
+ return opNaNs(divisor, ctx); // one or more NaNs
+ }
+ else {//one or two infinities
+ result = new Decimal128();
+ if (((this.flags & DEC_INF) != 0) ||
+ ((divisor.flags & DEC_INF) == 0) && (divisor.value.compareTo(BigDecimalZERO) == 0)) {
+ // Dividend infinite or divisor 0
+ ctx.status |= Decimal128Context.DEC_Invalid_operation;
+ result.flags = DEC_NAN;
+ }
+ else { // d % infinity == d
+ result.value = this.value;
+ if (differentsigns) result.flags = DEC_NEG;
+ }
+ return result;
+ }
+ }
+ result = new Decimal128();
+ // finite % 0 = NaN
+ if (divisor.value.compareTo(BigDecimalZERO) == 0) {
+ // doesn't matter whether this.value is non-zero
+ result.flags = DEC_NAN;
+ }
+ else {
+ // 0 % finite = 0
+ if (this.value.compareTo(BigDecimalZERO) == 0) {
+ result.value = this.value;
+ }
+ else {
+ // for reasons Mike says are "by design", it can blow up
+ try {
+ if (ctx.mathCtx().getPrecision() == 34)
+ result.value = this.value.remainder(divisor.value, ctx.mathCtx());
+ else {
+ // compute remainder in full precision, round answer to smaller precision
+ result.value = this.value.remainder(divisor.value, Decimal128Context.DECIMAL128.mathCtx());
+ result.value = result.value.add(BigDecimalZERO, ctx.mathCtx());
+ }
+ } catch (ArithmeticException e) {
+ result.flags = DEC_NAN;
+ }
+ }
+ }
+ if (differentsigns)
+ result.flags |= DEC_NEG;
+ result.ClampOverflow(ctx);
+ return result;
+
+ }
+
+
+ public Decimal128 subtract(Decimal128 subtrahend) {
+ return this.subtract(subtrahend, Decimal128Context.DECIMAL128);
+ }
+
+ public Decimal128 subtract(Decimal128 subtrahend, Decimal128Context ctx) {
+ Decimal128 result;
+ int specialbits = ((subtrahend.flags | this.flags) & DEC_SPECIAL);
+ if (specialbits != 0) {
+ if ((specialbits & (DEC_NAN | DEC_SNAN)) != 0) {
+ result = opNaNs(subtrahend, ctx); // one or more NaNs
+ return result;
+ }
+ else {//one or two infinities
+ result = new Decimal128();
+ if ((this.flags & DEC_INF) != 0) {
+ // I'm infinite, only bad value is subtracting one of same sign
+ if ((subtrahend.flags & DEC_INF) != 0) {
+ if (((this.flags ^ subtrahend.flags) & DEC_NEG) == 0) { // same signs
+ ctx.status |= Decimal128Context.DEC_Invalid_operation;
+ result.flags = DEC_NAN; // should I do this?
+ return result;
+ }
+ }
+ result.flags = this.flags; // get sign and infinity flag from me
+ }
+ else { // augend is infinite and I'm not, take its sign
+ result.flags = subtrahend.flags;
+ result.flags ^= DEC_NEG; // toggle the sign bit
+ }
+ return result;
+ }
+ }
+ result = new Decimal128();
+ result.value = this.value.subtract(subtrahend.value, ctx.mathCtx());
+ if (result.value.compareTo(BigDecimalZERO) < 0)
+ result.flags |= DEC_NEG;
+ result.ClampOverflow(ctx);
+ return result;
+ }
+
+ /* override method from Object */
+ public int hashCode() {
+ return value.hashCode() ^ flags;
+ }
+
+
+ //JPEXS
+ @Override
+ public boolean equals(Object num) {
+ if (num instanceof Decimal128) {
+ return equals((Decimal128) num);
+ }
+ return false;
+ }
+
+ //JPEXS
+ public String toPlainString() {
+ if ((flags & (DEC_NAN | DEC_SNAN)) != 0) {
+ return "NaN"; // what about number after NaN
+ }
+ else if ((flags & DEC_INF) != 0) {
+ return "Infinity";
+ }
+ else {
+ return value.toPlainString();
+ }
+ }
+
+ //JPEXS
+ public String toActionScriptString() {
+ if ((flags & (DEC_NAN | DEC_SNAN)) != 0) {
+ return "NaN"; // what about number after NaN
+ }
+ else if ((flags & DEC_INF) != 0) {
+ return "Infinity";
+ }
+ else {
+ return value.toPlainString() + "m";
+ }
+ }
+}
diff --git a/libsrc/decimal/src/macromedia/asc/util/Decimal128Context.java b/libsrc/decimal/src/macromedia/asc/util/Decimal128Context.java
new file mode 100644
index 000000000..9e91f62b3
--- /dev/null
+++ b/libsrc/decimal/src/macromedia/asc/util/Decimal128Context.java
@@ -0,0 +1,127 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package macromedia.asc.util;
+
+import java.math.*;
+
+public class Decimal128Context {
+
+ private MathContext bdctx;
+ public int status;
+
+ public Decimal128Context() {
+ status = 0;
+ try {
+ bdctx = new MathContext(34, RoundingMode.HALF_EVEN);
+ } catch (NoClassDefFoundError e) {
+ bdctx = null; // we're not going to be using decimal stuff on 1.4
+ }
+ }
+
+ public Decimal128Context(int precision, RoundingMode rounding) {
+
+ status = 0;
+ try {
+ bdctx = new MathContext(precision, rounding);
+ } catch (NoClassDefFoundError e) {
+ bdctx = null; // we're not going to be using decimal stuff on 1.4
+ }
+ }
+
+
+ public int getPrecision() {
+ return bdctx.getPrecision();
+ }
+
+ public RoundingMode getRoundingMode() {
+ return bdctx.getRoundingMode();
+ }
+
+ protected MathContext mathCtx() { // should be visible only to Decimal128
+ return bdctx;
+ }
+ /* Should these be immutable like MathContext? It's hard to have the status field
+ * reflect error history if that is the case
+ */
+
+ public void setPrecision (int precision) {
+ if (precision < 1 || precision > 34) {
+ throw new IllegalArgumentException("Precision must be between 1 and 34");
+ }
+ if (bdctx.getPrecision() != precision) {
+ bdctx = new MathContext(precision, bdctx.getRoundingMode());
+ }
+ }
+
+ public void setRoundingMode(RoundingMode mode) {
+ if (bdctx.getRoundingMode() != mode) {
+ bdctx = new MathContext(bdctx.getPrecision(), mode);
+ }
+ }
+
+ private static RoundingMode defaultMode() {
+ RoundingMode result;
+ try {
+ result = RoundingMode.HALF_EVEN;
+ } catch (NoClassDefFoundError e) {
+ result = null; // we're not going to be using decimal stuff on 1.4
+ }
+ return result;
+ }
+
+ public static final Decimal128Context DECIMAL128 = new Decimal128Context(34, defaultMode());
+
+ /* Trap-enabler and Status flags (exceptional conditions), and their names */
+ // Top byte is reserved for internal use
+ static final int DEC_Conversion_syntax = 0x00000001;
+ static final int DEC_Division_by_zero = 0x00000002;
+ static final int DEC_Division_impossible = 0x00000004;
+ static final int DEC_Division_undefined = 0x00000008;
+ static final int DEC_Insufficient_storage = 0x00000010;
+ static final int DEC_Inexact = 0x00000020;
+ static final int DEC_Invalid_context = 0x00000040;
+ static final int DEC_Invalid_operation = 0x00000080;
+ static final int DEC_Overflow = 0x00000200;
+ static final int DEC_Clamped = 0x00000400;
+ static final int DEC_Rounded = 0x00000800;
+ static final int DEC_Subnormal = 0x00001000;
+ static final int DEC_Underflow = 0x00002000;
+ static final int DEC_sNaN = 0x40000000;
+
+ // name strings for the exceptional conditions
+
+ static final String DEC_Condition_CS = "Conversion syntax";
+ static final String DEC_Condition_DZ = "Division by zero";
+ static final String DEC_Condition_DI = "Division impossible";
+ static final String DEC_Condition_DU = "Division undefined";
+ static final String DEC_Condition_IE = "Inexact";
+ static final String DEC_Condition_IS = "Insufficient storage";
+ static final String DEC_Condition_IC = "Invalid context";
+ static final String DEC_Condition_IO = "Invalid operation";
+ static final String DEC_Condition_OV = "Overflow";
+ static final String DEC_Condition_PA = "Clamped";
+ static final String DEC_Condition_RO = "Rounded";
+ static final String DEC_Condition_SU = "Subnormal";
+ static final String DEC_Condition_UN = "Underflow";
+ static final String DEC_Condition_ZE = "No status";
+ static final String DEC_Condition_MU = "Multiple status";
+ static final int DEC_Condition_Length = 21; // length of the longest string,
+ // including terminator
+}
diff --git a/libsrc/decimal/src/macromedia/asc/util/DenselyPackedDecimal.java b/libsrc/decimal/src/macromedia/asc/util/DenselyPackedDecimal.java
new file mode 100644
index 000000000..48cad084b
--- /dev/null
+++ b/libsrc/decimal/src/macromedia/asc/util/DenselyPackedDecimal.java
@@ -0,0 +1,240 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package macromedia.asc.util;
+
+public class DenselyPackedDecimal {
+ private static final short BIN2DPD[]={
+ // 0 1 2 3 4 5 6 7 8 9
+ 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, 0x008, 0x009,
+ 0x010, 0x011, 0x012, 0x013, 0x014, 0x015, 0x016, 0x017, 0x018, 0x019,
+ 0x020, 0x021, 0x022, 0x023, 0x024, 0x025, 0x026, 0x027, 0x028, 0x029,
+ 0x030, 0x031, 0x032, 0x033, 0x034, 0x035, 0x036, 0x037, 0x038, 0x039,
+ 0x040, 0x041, 0x042, 0x043, 0x044, 0x045, 0x046, 0x047, 0x048, 0x049,
+ // 50 51 52 53 54 55 56 57 58 59
+ 0x050, 0x051, 0x052, 0x053, 0x054, 0x055, 0x056, 0x057, 0x058, 0x059,
+ 0x060, 0x061, 0x062, 0x063, 0x064, 0x065, 0x066, 0x067, 0x068, 0x069,
+ 0x070, 0x071, 0x072, 0x073, 0x074, 0x075, 0x076, 0x077, 0x078, 0x079,
+ 0x00a, 0x00b, 0x02a, 0x02b, 0x04a, 0x04b, 0x06a, 0x06b, 0x04e, 0x04f,
+ 0x01a, 0x01b, 0x03a, 0x03b, 0x05a, 0x05b, 0x07a, 0x07b, 0x05e, 0x05f,
+ //100 101 102 103 104 105 106 107 108 109
+ 0x080, 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x087, 0x088, 0x089,
+ 0x090, 0x091, 0x092, 0x093, 0x094, 0x095, 0x096, 0x097, 0x098, 0x099,
+ 0x0a0, 0x0a1, 0x0a2, 0x0a3, 0x0a4, 0x0a5, 0x0a6, 0x0a7, 0x0a8, 0x0a9,
+ 0x0b0, 0x0b1, 0x0b2, 0x0b3, 0x0b4, 0x0b5, 0x0b6, 0x0b7, 0x0b8, 0x0b9,
+ 0x0c0, 0x0c1, 0x0c2, 0x0c3, 0x0c4, 0x0c5, 0x0c6, 0x0c7, 0x0c8, 0x0c9,
+ //150 151 152 153 154 155 156 157 158 159
+ 0x0d0, 0x0d1, 0x0d2, 0x0d3, 0x0d4, 0x0d5, 0x0d6, 0x0d7, 0x0d8, 0x0d9,
+ 0x0e0, 0x0e1, 0x0e2, 0x0e3, 0x0e4, 0x0e5, 0x0e6, 0x0e7, 0x0e8, 0x0e9,
+ 0x0f0, 0x0f1, 0x0f2, 0x0f3, 0x0f4, 0x0f5, 0x0f6, 0x0f7, 0x0f8, 0x0f9,
+ 0x08a, 0x08b, 0x0aa, 0x0ab, 0x0ca, 0x0cb, 0x0ea, 0x0eb, 0x0ce, 0x0cf,
+ 0x09a, 0x09b, 0x0ba, 0x0bb, 0x0da, 0x0db, 0x0fa, 0x0fb, 0x0de, 0x0df,
+ //200 201 202 203 204 205 206 207 208 209
+ 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107, 0x108, 0x109,
+ 0x110, 0x111, 0x112, 0x113, 0x114, 0x115, 0x116, 0x117, 0x118, 0x119,
+ 0x120, 0x121, 0x122, 0x123, 0x124, 0x125, 0x126, 0x127, 0x128, 0x129,
+ 0x130, 0x131, 0x132, 0x133, 0x134, 0x135, 0x136, 0x137, 0x138, 0x139,
+ 0x140, 0x141, 0x142, 0x143, 0x144, 0x145, 0x146, 0x147, 0x148, 0x149,
+ //250 251 252 253 254 255 256 257 258 259
+ 0x150, 0x151, 0x152, 0x153, 0x154, 0x155, 0x156, 0x157, 0x158, 0x159,
+ 0x160, 0x161, 0x162, 0x163, 0x164, 0x165, 0x166, 0x167, 0x168, 0x169,
+ 0x170, 0x171, 0x172, 0x173, 0x174, 0x175, 0x176, 0x177, 0x178, 0x179,
+ 0x10a, 0x10b, 0x12a, 0x12b, 0x14a, 0x14b, 0x16a, 0x16b, 0x14e, 0x14f,
+ 0x11a, 0x11b, 0x13a, 0x13b, 0x15a, 0x15b, 0x17a, 0x17b, 0x15e, 0x15f,
+ //300 301 302 303 304 305 306 307 308 309
+ 0x180, 0x181, 0x182, 0x183, 0x184, 0x185, 0x186, 0x187, 0x188, 0x189,
+ 0x190, 0x191, 0x192, 0x193, 0x194, 0x195, 0x196, 0x197, 0x198, 0x199,
+ 0x1a0, 0x1a1, 0x1a2, 0x1a3, 0x1a4, 0x1a5, 0x1a6, 0x1a7, 0x1a8, 0x1a9,
+ 0x1b0, 0x1b1, 0x1b2, 0x1b3, 0x1b4, 0x1b5, 0x1b6, 0x1b7, 0x1b8, 0x1b9,
+ 0x1c0, 0x1c1, 0x1c2, 0x1c3, 0x1c4, 0x1c5, 0x1c6, 0x1c7, 0x1c8, 0x1c9,
+ //350 351 352 353 354 355 356 357 358 359
+ 0x1d0, 0x1d1, 0x1d2, 0x1d3, 0x1d4, 0x1d5, 0x1d6, 0x1d7, 0x1d8, 0x1d9,
+ 0x1e0, 0x1e1, 0x1e2, 0x1e3, 0x1e4, 0x1e5, 0x1e6, 0x1e7, 0x1e8, 0x1e9,
+ 0x1f0, 0x1f1, 0x1f2, 0x1f3, 0x1f4, 0x1f5, 0x1f6, 0x1f7, 0x1f8, 0x1f9,
+ 0x18a, 0x18b, 0x1aa, 0x1ab, 0x1ca, 0x1cb, 0x1ea, 0x1eb, 0x1ce, 0x1cf,
+ 0x19a, 0x19b, 0x1ba, 0x1bb, 0x1da, 0x1db, 0x1fa, 0x1fb, 0x1de, 0x1df,
+ //400 401 402 403 404 405 406 407 408 409
+ 0x200, 0x201, 0x202, 0x203, 0x204, 0x205, 0x206, 0x207, 0x208, 0x209,
+ 0x210, 0x211, 0x212, 0x213, 0x214, 0x215, 0x216, 0x217, 0x218, 0x219,
+ 0x220, 0x221, 0x222, 0x223, 0x224, 0x225, 0x226, 0x227, 0x228, 0x229,
+ 0x230, 0x231, 0x232, 0x233, 0x234, 0x235, 0x236, 0x237, 0x238, 0x239,
+ 0x240, 0x241, 0x242, 0x243, 0x244, 0x245, 0x246, 0x247, 0x248, 0x249,
+ //450 451 452 453 454 455 456 457 458 459
+ 0x250, 0x251, 0x252, 0x253, 0x254, 0x255, 0x256, 0x257, 0x258, 0x259,
+ 0x260, 0x261, 0x262, 0x263, 0x264, 0x265, 0x266, 0x267, 0x268, 0x269,
+ 0x270, 0x271, 0x272, 0x273, 0x274, 0x275, 0x276, 0x277, 0x278, 0x279,
+ 0x20a, 0x20b, 0x22a, 0x22b, 0x24a, 0x24b, 0x26a, 0x26b, 0x24e, 0x24f,
+ 0x21a, 0x21b, 0x23a, 0x23b, 0x25a, 0x25b, 0x27a, 0x27b, 0x25e, 0x25f,
+ //500 501 502 503 504 505 506 507 508 509
+ 0x280, 0x281, 0x282, 0x283, 0x284, 0x285, 0x286, 0x287, 0x288, 0x289,
+ 0x290, 0x291, 0x292, 0x293, 0x294, 0x295, 0x296, 0x297, 0x298, 0x299,
+ 0x2a0, 0x2a1, 0x2a2, 0x2a3, 0x2a4, 0x2a5, 0x2a6, 0x2a7, 0x2a8, 0x2a9,
+ 0x2b0, 0x2b1, 0x2b2, 0x2b3, 0x2b4, 0x2b5, 0x2b6, 0x2b7, 0x2b8, 0x2b9,
+ 0x2c0, 0x2c1, 0x2c2, 0x2c3, 0x2c4, 0x2c5, 0x2c6, 0x2c7, 0x2c8, 0x2c9,
+ //550 551 552 553 554 555 556 557 558 559
+ 0x2d0, 0x2d1, 0x2d2, 0x2d3, 0x2d4, 0x2d5, 0x2d6, 0x2d7, 0x2d8, 0x2d9,
+ 0x2e0, 0x2e1, 0x2e2, 0x2e3, 0x2e4, 0x2e5, 0x2e6, 0x2e7, 0x2e8, 0x2e9,
+ 0x2f0, 0x2f1, 0x2f2, 0x2f3, 0x2f4, 0x2f5, 0x2f6, 0x2f7, 0x2f8, 0x2f9,
+ 0x28a, 0x28b, 0x2aa, 0x2ab, 0x2ca, 0x2cb, 0x2ea, 0x2eb, 0x2ce, 0x2cf,
+ 0x29a, 0x29b, 0x2ba, 0x2bb, 0x2da, 0x2db, 0x2fa, 0x2fb, 0x2de, 0x2df,
+ //600 601 602 603 604 605 606 607 608 609
+ 0x300, 0x301, 0x302, 0x303, 0x304, 0x305, 0x306, 0x307, 0x308, 0x309,
+ 0x310, 0x311, 0x312, 0x313, 0x314, 0x315, 0x316, 0x317, 0x318, 0x319,
+ 0x320, 0x321, 0x322, 0x323, 0x324, 0x325, 0x326, 0x327, 0x328, 0x329,
+ 0x330, 0x331, 0x332, 0x333, 0x334, 0x335, 0x336, 0x337, 0x338, 0x339,
+ 0x340, 0x341, 0x342, 0x343, 0x344, 0x345, 0x346, 0x347, 0x348, 0x349,
+ //650 651 652 653 654 655 656 657 658 659
+ 0x350, 0x351, 0x352, 0x353, 0x354, 0x355, 0x356, 0x357, 0x358, 0x359,
+ 0x360, 0x361, 0x362, 0x363, 0x364, 0x365, 0x366, 0x367, 0x368, 0x369,
+ 0x370, 0x371, 0x372, 0x373, 0x374, 0x375, 0x376, 0x377, 0x378, 0x379,
+ 0x30a, 0x30b, 0x32a, 0x32b, 0x34a, 0x34b, 0x36a, 0x36b, 0x34e, 0x34f,
+ 0x31a, 0x31b, 0x33a, 0x33b, 0x35a, 0x35b, 0x37a, 0x37b, 0x35e, 0x35f,
+ //700 701 702 703 704 705 706 707 708 709
+ 0x380, 0x381, 0x382, 0x383, 0x384, 0x385, 0x386, 0x387, 0x388, 0x389,
+ 0x390, 0x391, 0x392, 0x393, 0x394, 0x395, 0x396, 0x397, 0x398, 0x399,
+ 0x3a0, 0x3a1, 0x3a2, 0x3a3, 0x3a4, 0x3a5, 0x3a6, 0x3a7, 0x3a8, 0x3a9,
+ 0x3b0, 0x3b1, 0x3b2, 0x3b3, 0x3b4, 0x3b5, 0x3b6, 0x3b7, 0x3b8, 0x3b9,
+ 0x3c0, 0x3c1, 0x3c2, 0x3c3, 0x3c4, 0x3c5, 0x3c6, 0x3c7, 0x3c8, 0x3c9,
+ //750 751 752 753 754 755 756 757 758 759
+ 0x3d0, 0x3d1, 0x3d2, 0x3d3, 0x3d4, 0x3d5, 0x3d6, 0x3d7, 0x3d8, 0x3d9,
+ 0x3e0, 0x3e1, 0x3e2, 0x3e3, 0x3e4, 0x3e5, 0x3e6, 0x3e7, 0x3e8, 0x3e9,
+ 0x3f0, 0x3f1, 0x3f2, 0x3f3, 0x3f4, 0x3f5, 0x3f6, 0x3f7, 0x3f8, 0x3f9,
+ 0x38a, 0x38b, 0x3aa, 0x3ab, 0x3ca, 0x3cb, 0x3ea, 0x3eb, 0x3ce, 0x3cf,
+ 0x39a, 0x39b, 0x3ba, 0x3bb, 0x3da, 0x3db, 0x3fa, 0x3fb, 0x3de, 0x3df,
+ //800 801 802 803 804 805 806 807 808 809
+ 0x00c, 0x00d, 0x10c, 0x10d, 0x20c, 0x20d, 0x30c, 0x30d, 0x02e, 0x02f,
+ 0x01c, 0x01d, 0x11c, 0x11d, 0x21c, 0x21d, 0x31c, 0x31d, 0x03e, 0x03f,
+ 0x02c, 0x02d, 0x12c, 0x12d, 0x22c, 0x22d, 0x32c, 0x32d, 0x12e, 0x12f,
+ 0x03c, 0x03d, 0x13c, 0x13d, 0x23c, 0x23d, 0x33c, 0x33d, 0x13e, 0x13f,
+ 0x04c, 0x04d, 0x14c, 0x14d, 0x24c, 0x24d, 0x34c, 0x34d, 0x22e, 0x22f,
+ //850 851 852 853 854 855 856 857 858 859
+ 0x05c, 0x05d, 0x15c, 0x15d, 0x25c, 0x25d, 0x35c, 0x35d, 0x23e, 0x23f,
+ 0x06c, 0x06d, 0x16c, 0x16d, 0x26c, 0x26d, 0x36c, 0x36d, 0x32e, 0x32f,
+ 0x07c, 0x07d, 0x17c, 0x17d, 0x27c, 0x27d, 0x37c, 0x37d, 0x33e, 0x33f,
+ 0x00e, 0x00f, 0x10e, 0x10f, 0x20e, 0x20f, 0x30e, 0x30f, 0x06e, 0x06f,
+ 0x01e, 0x01f, 0x11e, 0x11f, 0x21e, 0x21f, 0x31e, 0x31f, 0x07e, 0x07f,
+ //900 901 902 903 904 905 906 907 908 909
+ 0x08c, 0x08d, 0x18c, 0x18d, 0x28c, 0x28d, 0x38c, 0x38d, 0x0ae, 0x0af,
+ 0x09c, 0x09d, 0x19c, 0x19d, 0x29c, 0x29d, 0x39c, 0x39d, 0x0be, 0x0bf,
+ 0x0ac, 0x0ad, 0x1ac, 0x1ad, 0x2ac, 0x2ad, 0x3ac, 0x3ad, 0x1ae, 0x1af,
+ 0x0bc, 0x0bd, 0x1bc, 0x1bd, 0x2bc, 0x2bd, 0x3bc, 0x3bd, 0x1be, 0x1bf,
+ 0x0cc, 0x0cd, 0x1cc, 0x1cd, 0x2cc, 0x2cd, 0x3cc, 0x3cd, 0x2ae, 0x2af,
+ //950 951 952 953 954 955 956 957 958 959
+ 0x0dc, 0x0dd, 0x1dc, 0x1dd, 0x2dc, 0x2dd, 0x3dc, 0x3dd, 0x2be, 0x2bf,
+ 0x0ec, 0x0ed, 0x1ec, 0x1ed, 0x2ec, 0x2ed, 0x3ec, 0x3ed, 0x3ae, 0x3af,
+ 0x0fc, 0x0fd, 0x1fc, 0x1fd, 0x2fc, 0x2fd, 0x3fc, 0x3fd, 0x3be, 0x3bf,
+ 0x08e, 0x08f, 0x18e, 0x18f, 0x28e, 0x28f, 0x38e, 0x38f, 0x0ee, 0x0ef,
+ 0x09e, 0x09f, 0x19e, 0x19f, 0x29e, 0x29f, 0x39e, 0x39f, 0x0fe, 0x0ff
+ };
+
+ public static short Bin2DPD(short val) {
+ // could be recoded with shifts and or for space/time tradeoff
+ return BIN2DPD[val];
+ }
+
+ private static final short DPD2BIN[] = {
+ //000 001 002 003 004 005 006 007 008 009 00a 00b 00c 00d 00e 00f
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 80, 81, 800, 801, 880, 881,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 90, 91, 810, 811, 890, 891,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 82, 83, 820, 821, 808, 809,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 92, 93, 830, 831, 818, 819,
+ //040 041 042 043 044 045 046 047 048 049 04a 04b 04c 04d 04e 04f
+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 84, 85, 840, 841, 88, 89,
+ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 94, 95, 850, 851, 98, 99,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 86, 87, 860, 861, 888, 889,
+ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 96, 97, 870, 871, 898, 899,
+ //080 081 082 083 084 085 086 087 088 089 08a 08b 08c 08d 08e 08f
+ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 180, 181, 900, 901, 980, 981,
+ 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 190, 191, 910, 911, 990, 991,
+ 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 182, 183, 920, 921, 908, 909,
+ 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 192, 193, 930, 931, 918, 919,
+ //0c0 0c1 0c2 0c3 0c4 0c5 0c6 0c7 0c8 0c9 0ca 0cb 0cc 0cd 0ce 0cf
+ 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 184, 185, 940, 941, 188, 189,
+ 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 194, 195, 950, 951, 198, 199,
+ 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 186, 187, 960, 961, 988, 989,
+ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 196, 197, 970, 971, 998, 999,
+ //100 101 102 103 104 105 106 107 108 109 10a 10b 10c 10d 10e 10f
+ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 280, 281, 802, 803, 882, 883,
+ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 290, 291, 812, 813, 892, 893,
+ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 282, 283, 822, 823, 828, 829,
+ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 292, 293, 832, 833, 838, 839,
+ //140 141 142 143 144 145 146 147 148 149 14a 14b 14c 14d 14e 14f
+ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 284, 285, 842, 843, 288, 289,
+ 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 294, 295, 852, 853, 298, 299,
+ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 286, 287, 862, 863, 888, 889,
+ 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 296, 297, 872, 873, 898, 899,
+ //180 181 182 183 184 185 186 187 188 189 18a 18b 18c 18d 18e 18f
+ 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 380, 381, 902, 903, 982, 983,
+ 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 390, 391, 912, 913, 992, 993,
+ 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 382, 383, 922, 923, 928, 929,
+ 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 392, 393, 932, 933, 938, 939,
+ //1c0 1c1 1c2 1c3 1c4 1c5 1c6 1c7 1c8 1c9 1ca 1cb 1cc 1cd 1ce 1cf
+ 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 384, 385, 942, 943, 388, 389,
+ 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 394, 395, 952, 953, 398, 399,
+ 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 386, 387, 962, 963, 988, 989,
+ 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 396, 397, 972, 973, 998, 999,
+ //200 201 202 203 204 205 206 207 208 209 20a 20b 20c 20d 20e 20f
+ 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 480, 481, 804, 805, 884, 885,
+ 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 490, 491, 814, 815, 894, 895,
+ 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 482, 483, 824, 825, 848, 849,
+ 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 492, 493, 834, 835, 858, 859,
+ //240 241 242 243 244 245 246 247 248 249 24a 24b 24c 24d 24e 24f
+ 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 484, 485, 844, 845, 488, 489,
+ 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 494, 495, 854, 855, 498, 499,
+ 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 486, 487, 864, 865, 888, 889,
+ 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 496, 497, 874, 875, 898, 899,
+ //280 281 282 283 284 285 286 287 288 289 28a 28b 28c 28d 28e 28f
+ 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 580, 581, 904, 905, 984, 985,
+ 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 590, 591, 914, 915, 994, 995,
+ 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 582, 583, 924, 925, 948, 949,
+ 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 592, 593, 934, 935, 958, 959,
+ //2c0 2c1 2c2 2c3 2c4 2c5 2c6 2c7 2c8 2c9 2ca 2cb 2cc 2cd 2ce 2cf
+ 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 584, 585, 944, 945, 588, 589,
+ 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 594, 595, 954, 955, 598, 599,
+ 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 586, 587, 964, 965, 988, 989,
+ 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 596, 597, 974, 975, 998, 999,
+ //300 301 302 303 304 305 306 307 308 309 30a 30b 30c 30d 30e 30f
+ 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 680, 681, 806, 807, 886, 887,
+ 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 690, 691, 816, 817, 896, 897,
+ 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 682, 683, 826, 827, 868, 869,
+ 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 692, 693, 836, 837, 878, 879,
+ //340 341 342 343 344 345 346 347 348 349 34a 34b 34c 34d 34e 34f
+ 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 684, 685, 846, 847, 688, 689,
+ 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 694, 695, 856, 857, 698, 699,
+ 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 686, 687, 866, 867, 888, 889,
+ 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 696, 697, 876, 877, 898, 899,
+ //380 381 382 383 384 385 386 387 388 389 38a 38b 38c 38d 38e 38f
+ 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 780, 781, 906, 907, 986, 987,
+ 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 790, 791, 916, 917, 996, 997,
+ 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 782, 783, 926, 927, 968, 969,
+ 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 792, 793, 936, 937, 978, 979,
+ //3c0 3c1 3c2 3c3 3c4 3c5 3c6 3c7 3c8 3c9 3ca 3cb 3cc 3cd 3ce 3cf
+ 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 784, 785, 946, 947, 788, 789,
+ 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 794, 795, 956, 957, 798, 799,
+ 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 786, 787, 966, 967, 988, 989,
+ 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 796, 797, 976, 977, 998, 999
+ };
+
+ public static short DPD2Bin(short val) {
+ // could be recoded with shifts and or for space/time tradeoff
+ return DPD2BIN[val];
+ }
+
+
+}
diff --git a/libsrc/ffdec_lib/lib/decimal.jar b/libsrc/ffdec_lib/lib/decimal.jar
new file mode 100644
index 000000000..9b54c7f5d
Binary files /dev/null and b/libsrc/ffdec_lib/lib/decimal.jar differ
diff --git a/libsrc/ffdec_lib/lib/decimal.license.txt b/libsrc/ffdec_lib/lib/decimal.license.txt
new file mode 100644
index 000000000..d64569567
--- /dev/null
+++ b/libsrc/ffdec_lib/lib/decimal.license.txt
@@ -0,0 +1,202 @@
+
+ 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/libsrc/ffdec_lib/nbproject/project.xml b/libsrc/ffdec_lib/nbproject/project.xml
index 2499d14eb..af48bdc19 100644
--- a/libsrc/ffdec_lib/nbproject/project.xml
+++ b/libsrc/ffdec_lib/nbproject/project.xml
@@ -242,7 +242,7 @@ auxiliary.show.customizer.message=
src
- ../../src;lib/LZMA.jar;lib/avi.jar;lib/cmykjpeg.jar;lib/ddsreader.jar;lib/gif.jar;lib/gnujpdf.jar;lib/jlayer-1.0.2.jar;lib/jpacker.jar;lib/nellymoser.jar;lib/sfntly.jar;lib/tga.jar;lib/ttf.jar;lib/vlcj-4.7.3.jar;lib/vlcj-natives-4.7.0.jar;lib/flashdebugger.jar;lib/jna-3.5.1.jar;lib/jna-platform-3.5.1.jar;lib/gifreader.jar;lib/miterstroke.jar
+ ../../src;lib/LZMA.jar;lib/avi.jar;lib/cmykjpeg.jar;lib/ddsreader.jar;lib/gif.jar;lib/gnujpdf.jar;lib/jlayer-1.0.2.jar;lib/jpacker.jar;lib/nellymoser.jar;lib/sfntly.jar;lib/tga.jar;lib/ttf.jar;lib/vlcj-4.7.3.jar;lib/vlcj-natives-4.7.0.jar;lib/flashdebugger.jar;lib/jna-3.5.1.jar;lib/jna-platform-3.5.1.jar;lib/gifreader.jar;lib/miterstroke.jar;lib/decimal.jar
build
reports
dist
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java
index 133b7427e..c86a9a41d 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java
@@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.abc;
import com.jpexs.decompiler.flash.EndOfStreamException;
import com.jpexs.decompiler.flash.SWFInputStream;
-import com.jpexs.decompiler.flash.abc.types.Decimal;
import com.jpexs.decompiler.flash.abc.types.Float4;
import com.jpexs.decompiler.flash.abc.types.InstanceInfo;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
@@ -38,6 +37,7 @@ import com.jpexs.helpers.MemoryInputStream;
import com.jpexs.helpers.utf8.Utf8Helper;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import macromedia.asc.util.Decimal128;
/**
* ABC input stream.
@@ -684,11 +684,11 @@ public class ABCInputStream implements AutoCloseable {
* @return Decimal
* @throws IOException On I/O error
*/
- public Decimal readDecimal(String name) throws IOException {
+ public Decimal128 readDecimal(String name) throws IOException {
newDumpLevel(name, "Decimal");
byte[] data = readBytesInternal(16);
endDumpLevel();
- return new Decimal(data);
+ return new Decimal128(data);
}
/**
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABCOutputStream.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABCOutputStream.java
index aa5af8429..f172174bb 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABCOutputStream.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABCOutputStream.java
@@ -16,7 +16,6 @@
*/
package com.jpexs.decompiler.flash.abc;
-import com.jpexs.decompiler.flash.abc.types.Decimal;
import com.jpexs.decompiler.flash.abc.types.Float4;
import com.jpexs.decompiler.flash.abc.types.InstanceInfo;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
@@ -31,6 +30,7 @@ import com.jpexs.decompiler.flash.abc.types.traits.Traits;
import com.jpexs.helpers.utf8.Utf8Helper;
import java.io.IOException;
import java.io.OutputStream;
+import macromedia.asc.util.Decimal128;
/**
* ABC output stream.
@@ -456,8 +456,8 @@ public class ABCOutputStream extends OutputStream {
* @param value Decimal to write
* @throws IOException On I/O error
*/
- public void writeDecimal(Decimal value) throws IOException {
- write(value.data);
+ public void writeDecimal(Decimal128 value) throws IOException {
+ write(value.toIEEE());
}
/**
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java
index 0f789a56f..a87c689ae 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java
@@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.abc.avm2;
import com.jpexs.decompiler.flash.abc.ABCVersionRequirements;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions;
-import com.jpexs.decompiler.flash.abc.types.Decimal;
import com.jpexs.decompiler.flash.abc.types.Float4;
import com.jpexs.decompiler.flash.abc.types.Multiname;
import com.jpexs.decompiler.flash.abc.types.Namespace;
@@ -37,6 +36,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
+import macromedia.asc.util.Decimal128;
/**
* AVM2 constant pool.
@@ -73,7 +73,7 @@ public class AVM2ConstantPool implements Cloneable {
*/
@SWFField
@ABCVersionRequirements(exactMinor = 17)
- private HashArrayList constant_decimal = new HashArrayList<>();
+ private HashArrayList constant_decimal = new HashArrayList<>();
/**
* Constant pool of floats
@@ -389,7 +389,7 @@ public class AVM2ConstantPool implements Cloneable {
* @param value Value
* @return Index
*/
- public synchronized int addDecimal(Decimal value) {
+ public synchronized int addDecimal(Decimal128 value) {
ensureDefault(constant_decimal);
constant_decimal.add(value);
return constant_decimal.size() - 1;
@@ -510,7 +510,7 @@ public class AVM2ConstantPool implements Cloneable {
* @param value Value
* @return Value
*/
- public Decimal setDecimal(int index, Decimal value) {
+ public Decimal128 setDecimal(int index, Decimal128 value) {
constant_decimal.set(index, value);
return value;
}
@@ -650,7 +650,7 @@ public class AVM2ConstantPool implements Cloneable {
* @param index Index
* @return Value
*/
- public Decimal getDecimal(int index) {
+ public Decimal128 getDecimal(int index) {
return constant_decimal.get(index);
}
@@ -878,7 +878,7 @@ public class AVM2ConstantPool implements Cloneable {
* @param add Whether to add the decimal if it does not exist
* @return Decimal id
*/
- public int getDecimalId(Decimal val, boolean add) {
+ public int getDecimalId(Decimal128 val, boolean add) {
int id = getDecimalId(val);
if (add && id == -1) {
id = addDecimal(val);
@@ -892,7 +892,7 @@ public class AVM2ConstantPool implements Cloneable {
* @param value Value
* @return Decimal id
*/
- private int getDecimalId(Decimal value) {
+ private int getDecimalId(Decimal128 value) {
return constant_decimal.indexOf(value);
}
@@ -1375,7 +1375,7 @@ public class AVM2ConstantPool implements Cloneable {
}
decimalMap.put(0, 0);
for (int i = 1; i < secondPool.constant_decimal.size(); i++) {
- Decimal val = secondPool.constant_decimal.get(i);
+ Decimal128 val = secondPool.constant_decimal.get(i);
decimalMap.put(i, getDecimalId(val, true));
}
namespaceMap.put(0, 0);
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimpleOld.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimpleOld.java
index 7b6e5a9dc..02dc2fb08 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimpleOld.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimpleOld.java
@@ -81,7 +81,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushUndefinedIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.SwapIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.types.CoerceOrConvertTypeIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.types.TypeOfIns;
-import com.jpexs.decompiler.flash.abc.avm2.model.FloatValueAVM2Item;
+import com.jpexs.decompiler.flash.abc.avm2.model.DoubleValueAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.GetPropertyAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.NewArrayAVM2Item;
@@ -147,8 +147,8 @@ public class AVM2DeobfuscatorSimpleOld extends AVM2DeobfuscatorZeroJumpsNullPush
if (graphTargetItem instanceof IntegerValueAVM2Item) {
IntegerValueAVM2Item iv = (IntegerValueAVM2Item) graphTargetItem;
return cpool.makePush(iv.value);
- } else if (graphTargetItem instanceof FloatValueAVM2Item) {
- FloatValueAVM2Item fv = (FloatValueAVM2Item) graphTargetItem;
+ } else if (graphTargetItem instanceof DoubleValueAVM2Item) {
+ DoubleValueAVM2Item fv = (DoubleValueAVM2Item) graphTargetItem;
return cpool.makePush(fv.value);
} else if (graphTargetItem instanceof StringAVM2Item) {
StringAVM2Item fv = (StringAVM2Item) graphTargetItem;
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java
index a26a118f4..3f4c9b7bf 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java
@@ -292,6 +292,12 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem {
return constants.getUInt(operands[idx]);
case AVM2Code.DAT_DOUBLE_INDEX:
return constants.getDouble(operands[idx]);
+ case AVM2Code.DAT_DECIMAL_INDEX:
+ return constants.getDecimal(operands[idx]);
+ case AVM2Code.DAT_FLOAT_INDEX:
+ return constants.getFloat(operands[idx]);
+ case AVM2Code.DAT_FLOAT4_INDEX:
+ return constants.getFloat4(operands[idx]);
case AVM2Code.DAT_OFFSET:
return address + operands[idx] + getBytesLength();
case AVM2Code.DAT_CASE_BASEOFFSET:
@@ -447,7 +453,7 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem {
} else {
s.append(" ");
try {
- s.append(constants.getDecimal(operands[i]));
+ s.append(constants.getDecimal(operands[i]).toActionScriptString());
} catch (IndexOutOfBoundsException iob) {
s.append("Unknown(").append(operands[i]).append(")");
}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/decimalsupport/PushDNanIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/decimalsupport/PushDNanIns.java
index 28fbd13d4..355f2a831 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/decimalsupport/PushDNanIns.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/decimalsupport/PushDNanIns.java
@@ -17,6 +17,7 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other.decimalsupport;
import com.jpexs.decompiler.flash.abc.ABC;
+import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
@@ -24,6 +25,11 @@ import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2VerifyErrorException;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2InstructionFlag;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
+import com.jpexs.decompiler.flash.abc.avm2.model.DNanAVM2Item;
+import com.jpexs.decompiler.graph.GraphTargetItem;
+import com.jpexs.decompiler.graph.TranslateStack;
+import java.util.List;
+import macromedia.asc.util.Decimal128;
/**
* pushdnan instruction - push a decimal NaN.
@@ -38,6 +44,12 @@ public class PushDNanIns extends InstructionDefinition {
public PushDNanIns() {
super(0x34, "pushdnan", new int[]{}, true, AVM2InstructionFlag.NO_FLASH_PLAYER, AVM2InstructionFlag.ES4_NUMERICS_MINOR);
}
+
+ @Override
+ public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
+ lda.operandStack.push(Decimal128.NaN);
+ return true;
+ }
@Override
public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException {
@@ -57,4 +69,9 @@ public class PushDNanIns extends InstructionDefinition {
public int getStackPushCount(AVM2Instruction ins, ABC abc) {
return 1;
}
+
+ @Override
+ public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List output, String path) {
+ stack.push(new DNanAVM2Item(ins, localData.lineStartInstruction));
+ }
}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/decimalsupport/PushDecimalIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/decimalsupport/PushDecimalIns.java
index d8e9994c5..42fc6fd89 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/decimalsupport/PushDecimalIns.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/decimalsupport/PushDecimalIns.java
@@ -17,6 +17,7 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other.decimalsupport;
import com.jpexs.decompiler.flash.abc.ABC;
+import com.jpexs.decompiler.flash.abc.AVM2LocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Runtime;
@@ -25,6 +26,10 @@ import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2VerifyErrorException;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2InstructionFlag;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
+import com.jpexs.decompiler.flash.abc.avm2.model.DecimalValueAVM2Item;
+import com.jpexs.decompiler.graph.GraphTargetItem;
+import com.jpexs.decompiler.graph.TranslateStack;
+import java.util.List;
/**
* pushdecimal instruction - push a decimal.
@@ -40,6 +45,12 @@ public class PushDecimalIns extends InstructionDefinition {
super(0x33, "pushdecimal", new int[]{AVM2Code.DAT_DECIMAL_INDEX}, true, AVM2InstructionFlag.NO_FLASH_PLAYER, AVM2InstructionFlag.ES4_NUMERICS_MINOR);
}
+ @Override
+ public boolean execute(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) {
+ lda.operandStack.push(ins.getParam(constants, 0));
+ return true;
+ }
+
@Override
public void verify(LocalDataArea lda, AVM2ConstantPool constants, AVM2Instruction ins) throws AVM2VerifyErrorException {
if (lda.getRuntime() == AVM2Runtime.ADOBE_FLASH) {
@@ -58,4 +69,9 @@ public class PushDecimalIns extends InstructionDefinition {
public int getStackPushCount(AVM2Instruction ins, ABC abc) {
return 1;
}
+
+ @Override
+ public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List output, String path) {
+ stack.push(new DecimalValueAVM2Item(ins, localData.lineStartInstruction, localData.getConstants().getDecimal(ins.operands[0])));
+ }
}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushDoubleIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushDoubleIns.java
index 0ee2d1a8a..57ac95b40 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushDoubleIns.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushDoubleIns.java
@@ -23,7 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
-import com.jpexs.decompiler.flash.abc.avm2.model.FloatValueAVM2Item;
+import com.jpexs.decompiler.flash.abc.avm2.model.DoubleValueAVM2Item;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -50,7 +50,7 @@ public class PushDoubleIns extends InstructionDefinition {
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List output, String path) {
- stack.push(new FloatValueAVM2Item(ins, localData.lineStartInstruction, localData.getConstants().getDouble(ins.operands[0])));
+ stack.push(new DoubleValueAVM2Item(ins, localData.lineStartInstruction, localData.getConstants().getDouble(ins.operands[0])));
}
@Override
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushUIntIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushUIntIns.java
index bdbc123df..b8097bcf7 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushUIntIns.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushUIntIns.java
@@ -23,7 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
-import com.jpexs.decompiler.flash.abc.avm2.model.FloatValueAVM2Item;
+import com.jpexs.decompiler.flash.abc.avm2.model.DoubleValueAVM2Item;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.List;
@@ -50,7 +50,7 @@ public class PushUIntIns extends InstructionDefinition implements PushIntegerTyp
@Override
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List output, String path) {
- stack.push(new FloatValueAVM2Item(ins, localData.lineStartInstruction, (double) localData.getConstants().getUInt(ins.operands[0])));
+ stack.push(new DoubleValueAVM2Item(ins, localData.lineStartInstruction, (double) localData.getConstants().getUInt(ins.operands[0])));
}
@Override
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/DNanAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/DNanAVM2Item.java
new file mode 100644
index 000000000..e8422b57e
--- /dev/null
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/DNanAVM2Item.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2010-2024 JPEXS, All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3.0 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.
+ */
+package com.jpexs.decompiler.flash.abc.avm2.model;
+
+import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
+import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
+import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions;
+import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
+import com.jpexs.decompiler.graph.CompilationException;
+import com.jpexs.decompiler.graph.DottedChain;
+import com.jpexs.decompiler.graph.GraphSourceItem;
+import com.jpexs.decompiler.graph.GraphTargetItem;
+import com.jpexs.decompiler.graph.SimpleValue;
+import com.jpexs.decompiler.graph.SourceGenerator;
+import com.jpexs.decompiler.graph.TypeItem;
+import com.jpexs.decompiler.graph.model.LocalData;
+import java.util.List;
+
+/**
+ * Decimal NaN value.
+ *
+ * @author JPEXS
+ */
+public class DNanAVM2Item extends AVM2Item implements SimpleValue {
+
+ /**
+ * Constructor.
+ * @param instruction Instruction
+ * @param lineStartIns Line start instruction
+ */
+ public DNanAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns) {
+ super(instruction, lineStartIns, NOPRECEDENCE);
+ }
+
+ @Override
+ public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
+ return writer.append("NaN"); //How is this distinct from classic NaN? There should be separate constant
+ }
+
+ @Override
+ public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
+ return toSourceMerge(localData, generator,
+ new AVM2Instruction(0, AVM2Instructions.PushDNan, null)
+ );
+ }
+
+ @Override
+ public GraphTargetItem returnType() {
+ return new TypeItem(DottedChain.DECIMAL);
+ }
+
+ @Override
+ public boolean hasReturnValue() {
+ return true;
+ }
+
+ @Override
+ public boolean isSimpleValue() {
+ return true;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 3;
+ return hash;
+ }
+
+}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/DecimalValueAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/DecimalValueAVM2Item.java
new file mode 100644
index 000000000..43fb96b58
--- /dev/null
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/DecimalValueAVM2Item.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2010-2024 JPEXS, All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3.0 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.
+ */
+package com.jpexs.decompiler.flash.abc.avm2.model;
+
+import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
+import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
+import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions;
+import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator;
+import com.jpexs.decompiler.flash.ecma.EcmaScript;
+import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
+import com.jpexs.decompiler.graph.CompilationException;
+import com.jpexs.decompiler.graph.GraphSourceItem;
+import com.jpexs.decompiler.graph.GraphTargetItem;
+import com.jpexs.decompiler.graph.SourceGenerator;
+import com.jpexs.decompiler.graph.TypeItem;
+import com.jpexs.decompiler.graph.model.LocalData;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import macromedia.asc.util.Decimal128;
+
+/**
+ * Decimal value.
+ *
+ * @author JPEXS
+ */
+public class DecimalValueAVM2Item extends NumberValueAVM2Item {
+
+ /**
+ * Value
+ */
+ public Decimal128 value;
+
+ /**
+ * Constructor.
+ *
+ * @param instruction Instruction
+ * @param lineStartIns Line start instruction
+ * @param value Value
+ */
+ public DecimalValueAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, Decimal128 value) {
+ super(instruction, lineStartIns);
+ this.value = value;
+ }
+
+ @Override
+ public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
+ return writer.append(value.toActionScriptString());
+ }
+
+ @Override
+ public Object getResult() {
+ return value;
+ }
+
+ @Override
+ public boolean isCompileTime(Set dependencies) {
+ return true;
+ }
+
+ @Override
+ public List toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
+ return toSourceMerge(localData, generator,
+ new AVM2Instruction(0, AVM2Instructions.PushDecimal, new int[]{((AVM2SourceGenerator) generator).abcIndex.getSelectedAbc().constants.getDecimalId(value, true)})
+ );
+ }
+
+ @Override
+ public GraphTargetItem returnType() {
+ return TypeItem.NUMBER;
+ }
+
+ @Override
+ public boolean hasReturnValue() {
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 53 * hash + Objects.hashCode(this.value);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final DecimalValueAVM2Item other = (DecimalValueAVM2Item) obj;
+ if (!Objects.equals(this.value, other.value)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/FloatValueAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/DoubleValueAVM2Item.java
similarity index 93%
rename from libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/FloatValueAVM2Item.java
rename to libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/DoubleValueAVM2Item.java
index 5f4b133ea..44f6be669 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/FloatValueAVM2Item.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/DoubleValueAVM2Item.java
@@ -37,7 +37,7 @@ import java.util.Set;
*
* @author JPEXS
*/
-public class FloatValueAVM2Item extends NumberValueAVM2Item {
+public class DoubleValueAVM2Item extends NumberValueAVM2Item {
/**
* Value
@@ -51,7 +51,7 @@ public class FloatValueAVM2Item extends NumberValueAVM2Item {
* @param lineStartIns Line start instruction
* @param value Value
*/
- public FloatValueAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, Double value) {
+ public DoubleValueAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, Double value) {
super(instruction, lineStartIns);
this.value = value;
}
@@ -106,7 +106,7 @@ public class FloatValueAVM2Item extends NumberValueAVM2Item {
if (getClass() != obj.getClass()) {
return false;
}
- final FloatValueAVM2Item other = (FloatValueAVM2Item) obj;
+ final DoubleValueAVM2Item other = (DoubleValueAVM2Item) obj;
if (!Objects.equals(this.value, other.value)) {
return false;
}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/ASM3Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/ASM3Parser.java
index fcf0661fe..1f6cf83e5 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/ASM3Parser.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/ASM3Parser.java
@@ -53,6 +53,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Stack;
+import macromedia.asc.util.Decimal128;
/**
* Parses AVM2 P-code.
@@ -1093,6 +1094,7 @@ public class ASM3Parser {
case AVM2Code.DAT_INT_INDEX:
case AVM2Code.DAT_UINT_INDEX:
case AVM2Code.DAT_DOUBLE_INDEX:
+ case AVM2Code.DAT_DECIMAL_INDEX:
case AVM2Code.DAT_FLOAT_INDEX:
case AVM2Code.DAT_FLOAT4_INDEX:
if (parsedOperand.type == ParsedSymbol.TYPE_KEYWORD_UNKNOWN) {
@@ -1193,6 +1195,31 @@ public class ASM3Parser {
throw new AVM2ParseException("Double or null expected", lexer.yyline());
}
break;
+ case AVM2Code.DAT_DECIMAL_INDEX:
+ if (parsedOperand.type == ParsedSymbol.TYPE_KEYWORD_NULL) {
+ operandsList.add(0);
+ } else if ((parsedOperand.type == ParsedSymbol.TYPE_INTEGER) || (parsedOperand.type == ParsedSymbol.TYPE_FLOAT)) {
+
+ Decimal128 decimalVal = Decimal128.ZERO;
+ if (parsedOperand.type == ParsedSymbol.TYPE_INTEGER) {
+ decimalVal = new Decimal128((Integer) parsedOperand.value);
+ }
+ if (parsedOperand.type == ParsedSymbol.TYPE_FLOAT) {
+ decimalVal = new Decimal128((Double) parsedOperand.value);
+ }
+ int did = constants.getDecimalId(decimalVal, false);
+ if (did == -1) {
+ if ((missingHandler != null) && (missingHandler.missingDecimal(decimalVal))) {
+ did = constants.addDecimal(decimalVal);
+ } else {
+ throw new AVM2ParseException("Unknown decimal", lexer.yyline());
+ }
+ }
+ operandsList.add(did);
+ } else {
+ throw new AVM2ParseException("Float or null expected", lexer.yyline());
+ }
+ break;
case AVM2Code.DAT_FLOAT_INDEX:
if (parsedOperand.type == ParsedSymbol.TYPE_KEYWORD_NULL) {
operandsList.add(0);
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/MissingSymbolHandler.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/MissingSymbolHandler.java
index d3e5e164a..68f638064 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/MissingSymbolHandler.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/MissingSymbolHandler.java
@@ -16,8 +16,8 @@
*/
package com.jpexs.decompiler.flash.abc.avm2.parser.pcode;
-import com.jpexs.decompiler.flash.abc.types.Decimal;
import com.jpexs.decompiler.flash.abc.types.Float4;
+import macromedia.asc.util.Decimal128;
/**
* Missing symbol handler.
@@ -37,5 +37,5 @@ public interface MissingSymbolHandler {
public boolean missingFloat4(Float4 value);
- public boolean missingDecimal(Decimal value);
+ public boolean missingDecimal(Decimal128 value);
}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java
index fd2f59d30..24efcc657 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java
@@ -32,7 +32,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PopScopeIns;
import com.jpexs.decompiler.flash.abc.avm2.model.AVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.ApplyTypeAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.BooleanAVM2Item;
-import com.jpexs.decompiler.flash.abc.avm2.model.FloatValueAVM2Item;
+import com.jpexs.decompiler.flash.abc.avm2.model.DoubleValueAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.GetDescendantsAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item;
@@ -1546,8 +1546,8 @@ public class AVM2SourceGenerator implements SourceGenerator {
if (val instanceof IntegerValueAVM2Item) {
return new ValueKind(abcIndex.getSelectedAbc().constants.getIntId(((IntegerValueAVM2Item) val).value, true), ValueKind.CONSTANT_Int);
}
- if (val instanceof FloatValueAVM2Item) {
- return new ValueKind(abcIndex.getSelectedAbc().constants.getDoubleId(((FloatValueAVM2Item) val).value, true), ValueKind.CONSTANT_Double);
+ if (val instanceof DoubleValueAVM2Item) {
+ return new ValueKind(abcIndex.getSelectedAbc().constants.getDoubleId(((DoubleValueAVM2Item) val).value, true), ValueKind.CONSTANT_Double);
}
if (val instanceof NanAVM2Item) {
return new ValueKind(abcIndex.getSelectedAbc().constants.getDoubleId(Double.NaN, true), ValueKind.CONSTANT_Double);
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java
index 05fbca15f..52e4b3651 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java
@@ -26,7 +26,7 @@ import com.jpexs.decompiler.flash.abc.avm2.model.ConstructSuperAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.DefaultXMLNamespace;
import com.jpexs.decompiler.flash.abc.avm2.model.EscapeXAttrAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.EscapeXElemAVM2Item;
-import com.jpexs.decompiler.flash.abc.avm2.model.FloatValueAVM2Item;
+import com.jpexs.decompiler.flash.abc.avm2.model.DoubleValueAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.GetDescendantsAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.GetPropertyAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.HasNextAVM2Item;
@@ -2336,7 +2336,7 @@ public class ActionScript3Parser {
case MINUS:
s = lex();
if (s.isType(SymbolType.DOUBLE)) {
- ret = new FloatValueAVM2Item(null, null, -(Double) s.value);
+ ret = new DoubleValueAVM2Item(null, null, -(Double) s.value);
} else if (s.isType(SymbolType.INTEGER)) {
ret = new IntegerValueAVM2Item(null, null, -(Integer) s.value);
@@ -2348,12 +2348,12 @@ public class ActionScript3Parser {
((IntegerValueAVM2Item) num).value = -((IntegerValueAVM2Item) num).value;
((IntegerValueAVM2Item) num).detectFormat();
ret = num;
- } else if (num instanceof FloatValueAVM2Item) {
- Double d = ((FloatValueAVM2Item) num).value;
+ } else if (num instanceof DoubleValueAVM2Item) {
+ Double d = ((DoubleValueAVM2Item) num).value;
if (d.isInfinite()) {
- ((FloatValueAVM2Item) num).value = Double.NEGATIVE_INFINITY;
+ ((DoubleValueAVM2Item) num).value = Double.NEGATIVE_INFINITY;
} else {
- ((FloatValueAVM2Item) num).value = -d;
+ ((DoubleValueAVM2Item) num).value = -d;
}
ret = (num);
} else {
@@ -2435,7 +2435,7 @@ public class ActionScript3Parser {
break;
case INFINITY:
- ret = new FloatValueAVM2Item(null, null, Double.POSITIVE_INFINITY);
+ ret = new DoubleValueAVM2Item(null, null, Double.POSITIVE_INFINITY);
break;
case INTEGER:
@@ -2443,7 +2443,7 @@ public class ActionScript3Parser {
break;
case DOUBLE:
- ret = new FloatValueAVM2Item(null, null, (Double) s.value);
+ ret = new DoubleValueAVM2Item(null, null, (Double) s.value);
allowMemberOrCall = true; // 5.2.toString();
break;
case DELETE:
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Decimal.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Decimal.java
deleted file mode 100644
index 56c2f2a52..000000000
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Decimal.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2010-2024 JPEXS, All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3.0 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library.
- */
-package com.jpexs.decompiler.flash.abc.types;
-
-/**
- * Decimal value.
- *
- * @author JPEXS
- */
-public class Decimal {
-
- public byte[] data;
-
- public Decimal() {
- }
-
- public Decimal(byte[] data) {
- this.data = data;
- }
-
- @Override
- public String toString() {
- return new String(data);
- }
-}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/SwfXmlImporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/SwfXmlImporter.java
index a7d083603..562647d8a 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/SwfXmlImporter.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/SwfXmlImporter.java
@@ -22,7 +22,6 @@ import com.jpexs.decompiler.flash.abc.ABCVersion;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.types.ABCException;
import com.jpexs.decompiler.flash.abc.types.ClassInfo;
-import com.jpexs.decompiler.flash.abc.types.Decimal;
import com.jpexs.decompiler.flash.abc.types.InstanceInfo;
import com.jpexs.decompiler.flash.abc.types.MetadataInfo;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
@@ -132,6 +131,7 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
+import macromedia.asc.util.Decimal128;
/**
* SWF XML importer.
@@ -180,7 +180,7 @@ public class SwfXmlImporter {
CurvedEdgeRecord.class, EndShapeRecord.class, StraightEdgeRecord.class, StyleChangeRecord.class,
BEVELFILTER.class, BLURFILTER.class, COLORMATRIXFILTER.class, CONVOLUTIONFILTER.class,
DROPSHADOWFILTER.class, GLOWFILTER.class, GRADIENTBEVELFILTER.class, GRADIENTGLOWFILTER.class,
- AVM2ConstantPool.class, Decimal.class, Namespace.class, NamespaceSet.class, Multiname.class, MethodInfo.class, MetadataInfo.class,
+ AVM2ConstantPool.class, Decimal128.class, Namespace.class, NamespaceSet.class, Multiname.class, MethodInfo.class, MetadataInfo.class,
ValueKind.class, InstanceInfo.class, Traits.class, TraitClass.class, TraitFunction.class,
TraitMethodGetterSetter.class, TraitSlotConst.class, ClassInfo.class, ScriptInfo.class, MethodBody.class,
ABCException.class, ABCVersion.class, Amf3Value.class,
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/DottedChain.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/DottedChain.java
index b83a4a4f8..bfced7dc4 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/DottedChain.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/DottedChain.java
@@ -46,6 +46,8 @@ public class DottedChain implements Serializable, Comparable {
public static final DottedChain ARRAY = new DottedChain(new String[]{"Array"});
public static final DottedChain NUMBER = new DottedChain(new String[]{"Number"});
+
+ public static final DottedChain DECIMAL = new DottedChain(new String[]{"decimal"});
public static final DottedChain OBJECT = new DottedChain(new String[]{"Object"});
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java
index 1a682de7a..20318096b 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java
@@ -18,7 +18,7 @@ package com.jpexs.decompiler.graph;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
import com.jpexs.decompiler.flash.abc.avm2.model.ConvertAVM2Item;
-import com.jpexs.decompiler.flash.abc.avm2.model.FloatValueAVM2Item;
+import com.jpexs.decompiler.flash.abc.avm2.model.DoubleValueAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.IntegerValueAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.NameValuePair;
import com.jpexs.decompiler.flash.abc.avm2.model.NewArrayAVM2Item;
@@ -157,14 +157,14 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
return new StringAVM2Item(null, null, (String) r);
}
if (r instanceof Long) {
- return new FloatValueAVM2Item(null, null, (double) (Long) r);
+ return new DoubleValueAVM2Item(null, null, (double) (Long) r);
}
if (r instanceof Integer) {
return new IntegerValueAVM2Item(null, null, (Integer) r);
}
if (r instanceof Double) {
- return new FloatValueAVM2Item(null, null, (Double) r);
+ return new DoubleValueAVM2Item(null, null, (Double) r);
}
if (r instanceof Null) {
return new NullAVM2Item(null, null);
diff --git a/libsrc/ffdec_lib/testdata/decimal/bin/decimal.abc b/libsrc/ffdec_lib/testdata/decimal/bin/decimal.abc
new file mode 100644
index 000000000..bc4d44547
Binary files /dev/null and b/libsrc/ffdec_lib/testdata/decimal/bin/decimal.abc differ
diff --git a/libsrc/ffdec_lib/testdata/decimal/bin/decimal.cpp b/libsrc/ffdec_lib/testdata/decimal/bin/decimal.cpp
new file mode 100644
index 000000000..013c14083
--- /dev/null
+++ b/libsrc/ffdec_lib/testdata/decimal/bin/decimal.cpp
@@ -0,0 +1,55 @@
+const int decimal_abc_length = 794;
+const int decimal_abc_method_count = 0;
+const int decimal_abc_class_count = 6;
+const int decimal_abc_script_count = 1;
+const unsigned char decimal_abc_data[794] = {
+0x11, 0x00, 0x2e, 0x00, 0x02, 0xf0, 0xa2, 0x04, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x02, 0x26, 0x0c, 0x00, 0x00, 0x00,
+0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x16, 0x06, 0x4f, 0x62, 0x6a,
+0x65, 0x63, 0x74, 0x00, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x03, 0x69, 0x6e, 0x74, 0x07,
+0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x12, 0x5f, 0x5f, 0x41, 0x53, 0x33, 0x5f, 0x5f, 0x2e,
+0x76, 0x65, 0x63, 0x3a, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x0b, 0x5f, 0x5f, 0x41, 0x53, 0x33,
+0x5f, 0x5f, 0x2e, 0x76, 0x65, 0x63, 0x06, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x0d, 0x6d, 0x79,
+0x70, 0x6b, 0x67, 0x3a, 0x4d, 0x79, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x04, 0x76, 0x6f, 0x69, 0x64,
+0x08, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x64, 0x65, 0x63, 0x08, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x69,
+0x6e, 0x74, 0x04, 0x74, 0x65, 0x73, 0x74, 0x05, 0x74, 0x65, 0x73, 0x74, 0x64, 0x05, 0x6d, 0x79,
+0x70, 0x6b, 0x67, 0x07, 0x4d, 0x79, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x03, 0x4e, 0x61, 0x4e, 0x08,
+0x49, 0x6e, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x79, 0x09, 0x75, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e,
+0x65, 0x64, 0x03, 0x41, 0x53, 0x33, 0x21, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x61, 0x64,
+0x6f, 0x62, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x41, 0x53, 0x33, 0x2f, 0x32, 0x30, 0x30, 0x36,
+0x2f, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x11, 0x05, 0x01, 0x16, 0x02, 0x18, 0x01, 0x05,
+0x03, 0x18, 0x03, 0x05, 0x04, 0x18, 0x04, 0x05, 0x05, 0x18, 0x05, 0x05, 0x06, 0x16, 0x07, 0x18,
+0x06, 0x05, 0x09, 0x16, 0x0f, 0x18, 0x09, 0x08, 0x15, 0x00, 0x10, 0x07, 0x02, 0x01, 0x07, 0x02,
+0x03, 0x07, 0x02, 0x04, 0x07, 0x02, 0x05, 0x07, 0x0b, 0x08, 0x07, 0x02, 0x0a, 0x07, 0x0d, 0x0b,
+0x07, 0x0d, 0x0c, 0x07, 0x02, 0x0d, 0x07, 0x0d, 0x0e, 0x07, 0x0e, 0x10, 0x07, 0x02, 0x11, 0x07,
+0x02, 0x12, 0x07, 0x02, 0x13, 0x07, 0x02, 0x14, 0x0f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02,
+0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02,
+0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02,
+0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x06, 0x04, 0x02, 0x00, 0x01, 0x00, 0x04, 0x02, 0x00, 0x00,
+0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x06, 0x01, 0x00, 0x09, 0x03, 0x00, 0x01, 0x00,
+0x02, 0x01, 0x09, 0x05, 0x00, 0x03, 0x00, 0x03, 0x01, 0x09, 0x07, 0x00, 0x05, 0x00, 0x04, 0x01,
+0x09, 0x09, 0x00, 0x07, 0x00, 0x05, 0x01, 0x09, 0x0c, 0x00, 0x09, 0x00, 0x0b, 0x01, 0x09, 0x0f,
+0x00, 0x0d, 0x04, 0x07, 0x00, 0x01, 0x04, 0x00, 0x08, 0x00, 0x02, 0x03, 0x00, 0x09, 0x01, 0x02,
+0x0b, 0x0a, 0x01, 0x03, 0x0c, 0x00, 0x00, 0x02, 0x00, 0x04, 0x00, 0x06, 0x00, 0x08, 0x00, 0x0a,
+0x00, 0x01, 0x0e, 0x0a, 0x0f, 0x06, 0x01, 0x00, 0x10, 0x08, 0x01, 0x04, 0x02, 0x00, 0x02, 0x04,
+0x03, 0x01, 0x03, 0x04, 0x04, 0x02, 0x04, 0x04, 0x05, 0x03, 0x05, 0x04, 0x06, 0x04, 0x0c, 0x06,
+0x07, 0x02, 0x01, 0x06, 0x0d, 0x06, 0x08, 0x02, 0x02, 0x06, 0x0e, 0x06, 0x09, 0x00, 0x00, 0x0b,
+0x04, 0x0a, 0x05, 0x0f, 0x00, 0x01, 0x01, 0x02, 0x03, 0x03, 0xd0, 0x30, 0x47, 0x00, 0x00, 0x01,
+0x01, 0x01, 0x03, 0x04, 0x03, 0xd0, 0x30, 0x47, 0x00, 0x00, 0x02, 0x01, 0x01, 0x03, 0x04, 0x03,
+0xd0, 0x30, 0x47, 0x00, 0x00, 0x03, 0x01, 0x01, 0x04, 0x05, 0x06, 0xd0, 0x30, 0xd0, 0x49, 0x00,
+0x47, 0x00, 0x00, 0x04, 0x01, 0x01, 0x03, 0x04, 0x03, 0xd0, 0x30, 0x47, 0x00, 0x00, 0x05, 0x01,
+0x01, 0x04, 0x05, 0x06, 0xd0, 0x30, 0xd0, 0x49, 0x00, 0x47, 0x00, 0x00, 0x06, 0x01, 0x01, 0x03,
+0x04, 0x03, 0xd0, 0x30, 0x47, 0x00, 0x00, 0x07, 0x01, 0x01, 0x04, 0x05, 0x06, 0xd0, 0x30, 0xd0,
+0x49, 0x00, 0x47, 0x00, 0x00, 0x08, 0x01, 0x01, 0x03, 0x04, 0x03, 0xd0, 0x30, 0x47, 0x00, 0x00,
+0x09, 0x01, 0x01, 0x04, 0x05, 0x06, 0xd0, 0x30, 0xd0, 0x49, 0x00, 0x47, 0x00, 0x00, 0x0a, 0x01,
+0x01, 0x03, 0x04, 0x03, 0xd0, 0x30, 0x47, 0x00, 0x00, 0x0b, 0x01, 0x04, 0x04, 0x05, 0x0c, 0xd0,
+0x30, 0x2d, 0x01, 0x82, 0xd6, 0x33, 0x01, 0x80, 0x04, 0xd7, 0x47, 0x00, 0x00, 0x0c, 0x01, 0x02,
+0x04, 0x05, 0x03, 0xd0, 0x30, 0x47, 0x00, 0x00, 0x0d, 0x01, 0x01, 0x04, 0x05, 0x06, 0xd0, 0x30,
+0xd0, 0x49, 0x00, 0x47, 0x00, 0x00, 0x0e, 0x03, 0x01, 0x01, 0x03, 0x6c, 0xd0, 0x30, 0x65, 0x00,
+0x20, 0x58, 0x00, 0x68, 0x01, 0x65, 0x00, 0x5d, 0x01, 0x66, 0x01, 0x30, 0x64, 0x6c, 0x02, 0x58,
+0x01, 0x1d, 0x68, 0x02, 0x65, 0x00, 0x5d, 0x01, 0x66, 0x01, 0x30, 0x64, 0x6c, 0x02, 0x58, 0x02,
+0x1d, 0x68, 0x03, 0x65, 0x00, 0x5d, 0x01, 0x66, 0x01, 0x30, 0x64, 0x6c, 0x02, 0x58, 0x03, 0x1d,
+0x68, 0x04, 0x65, 0x00, 0x5d, 0x01, 0x66, 0x01, 0x30, 0x64, 0x6c, 0x02, 0x58, 0x04, 0x1d, 0x68,
+0x05, 0x65, 0x00, 0x5d, 0x01, 0x66, 0x01, 0x30, 0x64, 0x6c, 0x02, 0x58, 0x05, 0x1d, 0x68, 0x0b,
+0x65, 0x00, 0x24, 0x00, 0x24, 0x00, 0xa3, 0x68, 0x0c, 0x65, 0x00, 0x24, 0x01, 0x24, 0x00, 0xa3,
+0x68, 0x0d, 0x65, 0x00, 0x21, 0x68, 0x0e, 0x47, 0x00, 0x00 };
diff --git a/libsrc/ffdec_lib/testdata/decimal/bin/decimal.h b/libsrc/ffdec_lib/testdata/decimal/bin/decimal.h
new file mode 100644
index 000000000..43e39b3ef
--- /dev/null
+++ b/libsrc/ffdec_lib/testdata/decimal/bin/decimal.h
@@ -0,0 +1,12 @@
+const int abcclass_Object = 0;
+const int abcclass_Number = 1;
+const int abcclass_int = 2;
+const int abcclass_decimal = 3;
+const int abcclass___AS3___vec_Vector = 4;
+const int abcclass_mypkg_MyClass = 5;
+const int abcpackage_stubs_as = 0;
+extern const int decimal_abc_length;
+extern const int decimal_abc_method_count;
+extern const int decimal_abc_class_count;
+extern const int decimal_abc_script_count;
+extern const unsigned char decimal_abc_data[];
diff --git a/libsrc/ffdec_lib/testdata/decimal/build_flex.bat b/libsrc/ffdec_lib/testdata/decimal/build_flex.bat
new file mode 100644
index 000000000..ef6394279
--- /dev/null
+++ b/libsrc/ffdec_lib/testdata/decimal/build_flex.bat
@@ -0,0 +1,2 @@
+java -cp c:\flex\lib\asc.jar macromedia.asc.embedding.ScriptCompiler -strict -builtin -m -outdir bin/ -out decimal src/stubs.as>buildlog.flex.txt 2>&1
+rem /*-optimize*/
diff --git a/libsrc/ffdec_lib/testdata/decimal/src/Main.as b/libsrc/ffdec_lib/testdata/decimal/src/Main.as
new file mode 100644
index 000000000..25f855eb5
--- /dev/null
+++ b/libsrc/ffdec_lib/testdata/decimal/src/Main.as
@@ -0,0 +1,27 @@
+package
+{
+ import flash.display.Sprite;
+ import flash.events.Event;
+
+ /**
+ * ...
+ * @author Jindra
+ */
+ public class Main extends Sprite
+ {
+
+ public function Main()
+ {
+ if (stage) init();
+ else addEventListener(Event.ADDED_TO_STAGE, init);
+ }
+
+ private function init(e:Event = null):void
+ {
+ removeEventListener(Event.ADDED_TO_STAGE, init);
+ // entry point
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/libsrc/ffdec_lib/testdata/decimal/src/Number.as b/libsrc/ffdec_lib/testdata/decimal/src/Number.as
new file mode 100644
index 000000000..2982227d1
--- /dev/null
+++ b/libsrc/ffdec_lib/testdata/decimal/src/Number.as
@@ -0,0 +1,4 @@
+package {
+ public class Number {
+ }
+}
diff --git a/libsrc/ffdec_lib/testdata/decimal/src/Object.as b/libsrc/ffdec_lib/testdata/decimal/src/Object.as
new file mode 100644
index 000000000..66e32ec59
--- /dev/null
+++ b/libsrc/ffdec_lib/testdata/decimal/src/Object.as
@@ -0,0 +1,6 @@
+package
+{
+ public class Object
+ {
+ }
+}
diff --git a/libsrc/ffdec_lib/testdata/decimal/src/Toplevel.as b/libsrc/ffdec_lib/testdata/decimal/src/Toplevel.as
new file mode 100644
index 000000000..379bc0240
--- /dev/null
+++ b/libsrc/ffdec_lib/testdata/decimal/src/Toplevel.as
@@ -0,0 +1,9 @@
+package {
+ public namespace AS3 = "http://adobe.com/AS3/2006/builtin";
+
+ public const NaN: Number = 0 / 0;
+
+ public const Infinity: Number = 1 / 0;
+
+ public const undefined = void 0;
+}
diff --git a/libsrc/ffdec_lib/testdata/decimal/src/__AS3__/vec/Vector.as b/libsrc/ffdec_lib/testdata/decimal/src/__AS3__/vec/Vector.as
new file mode 100644
index 000000000..645459d7a
--- /dev/null
+++ b/libsrc/ffdec_lib/testdata/decimal/src/__AS3__/vec/Vector.as
@@ -0,0 +1,5 @@
+package __AS3__.vec {
+
+ public class Vector {
+ }
+}
diff --git a/libsrc/ffdec_lib/testdata/decimal/src/decimal.as b/libsrc/ffdec_lib/testdata/decimal/src/decimal.as
new file mode 100644
index 000000000..8335dbe99
--- /dev/null
+++ b/libsrc/ffdec_lib/testdata/decimal/src/decimal.as
@@ -0,0 +1,4 @@
+package {
+ public class decimal {
+ }
+}
diff --git a/libsrc/ffdec_lib/testdata/decimal/src/int.as b/libsrc/ffdec_lib/testdata/decimal/src/int.as
new file mode 100644
index 000000000..8fd30a041
--- /dev/null
+++ b/libsrc/ffdec_lib/testdata/decimal/src/int.as
@@ -0,0 +1,4 @@
+package {
+ public class int {
+ }
+}
diff --git a/libsrc/ffdec_lib/testdata/decimal/src/mypkg/MyClass.as b/libsrc/ffdec_lib/testdata/decimal/src/mypkg/MyClass.as
new file mode 100644
index 000000000..c7fa41f86
--- /dev/null
+++ b/libsrc/ffdec_lib/testdata/decimal/src/mypkg/MyClass.as
@@ -0,0 +1,30 @@
+package mypkg
+{
+ public class MyClass
+ {
+ private var attr_dec:decimal;
+ private var attr_int:int;
+
+ public function test(arg_d:decimal): void
+ {
+ //trace("Hello world");
+
+ //HALF_EVEN, DOWN, FLOOR, UP, CEILING, HALF_UP, HALF_DOWN
+
+ //use precision 10, rounding FLOOR;
+ //var arr = [];
+ //arg_d = arr[4];
+ /*var a:int = 1;
+ var b:int = 2;
+ var c:decimal = a < 3 ? a : b;*/
+ //this.testd(4);
+ var i:* = 70000;
+
+ var a:decimal = 10000000010000000002000000000300000000040000000005m;
+ }
+
+ private function testd(arg_d:decimal) {
+ }
+ }
+
+}
diff --git a/libsrc/ffdec_lib/testdata/decimal/src/stubs.as b/libsrc/ffdec_lib/testdata/decimal/src/stubs.as
new file mode 100644
index 000000000..1b4ea57df
--- /dev/null
+++ b/libsrc/ffdec_lib/testdata/decimal/src/stubs.as
@@ -0,0 +1,7 @@
+include "Object.as"
+include "Number.as"
+include "int.as"
+include "decimal.as"
+include "__AS3__/vec/Vector.as"
+include "TopLevel.as"
+include "mypkg/MyClass.as"
diff --git a/libsrc/ffdec_lib/testdata/decimal/src_air/mypkg/MySprite.as b/libsrc/ffdec_lib/testdata/decimal/src_air/mypkg/MySprite.as
new file mode 100644
index 000000000..1e0538574
--- /dev/null
+++ b/libsrc/ffdec_lib/testdata/decimal/src_air/mypkg/MySprite.as
@@ -0,0 +1,16 @@
+package mypkg
+{
+ import flash.display.Sprite;
+
+ public class MySprite extends Sprite
+ {
+
+ public function test(): void
+ {
+
+ var a:* = 70000m;
+ }
+
+ }
+
+}
diff --git a/nbproject/project.xml b/nbproject/project.xml
index 07619cb24..6abcd8e73 100644
--- a/nbproject/project.xml
+++ b/nbproject/project.xml
@@ -333,7 +333,7 @@
src
- lib/jpproxy.jar;lib/trident-6.2.jar;lib/substance-flamingo-6.2.jar;lib/flamingo-6.2.jar;lib/substance-6.2.jar;libsrc/ffdec_lib/src;lib/tablelayout.jar;lib/jsyntaxpane-0.9.5.jar;lib/JavactiveX.jar;lib/flashdebugger.jar;lib/treetable.jar;lib/minimal-json-0.9.5.jar;libsrc/ffdec_lib/lib/gnujpdf.jar;libsrc/ffdec_lib/lib/jna-3.5.1.jar;libsrc/ffdec_lib/lib/jna-platform-3.5.1.jar;libsrc/ffdec_lib/lib/flashdebugger.jar;lib/gifreader.jar;lib/jansi-2.4.0.jar
+ lib/jpproxy.jar;lib/trident-6.2.jar;lib/substance-flamingo-6.2.jar;lib/flamingo-6.2.jar;lib/substance-6.2.jar;libsrc/ffdec_lib/src;lib/tablelayout.jar;lib/jsyntaxpane-0.9.5.jar;lib/JavactiveX.jar;lib/flashdebugger.jar;lib/treetable.jar;lib/minimal-json-0.9.5.jar;libsrc/ffdec_lib/lib/gnujpdf.jar;libsrc/ffdec_lib/lib/jna-3.5.1.jar;libsrc/ffdec_lib/lib/jna-platform-3.5.1.jar;libsrc/ffdec_lib/lib/flashdebugger.jar;lib/gifreader.jar;lib/jansi-2.4.0.jar;lib/decimal.jar
build
javadoc
reports
diff --git a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java
index 06967baa2..c0ecb5733 100644
--- a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java
+++ b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java
@@ -38,7 +38,6 @@ import com.jpexs.decompiler.flash.abc.avm2.parser.AVM2ParseException;
import com.jpexs.decompiler.flash.abc.avm2.parser.pcode.ASM3Parser;
import com.jpexs.decompiler.flash.abc.avm2.parser.pcode.MissingSymbolHandler;
import com.jpexs.decompiler.flash.abc.avm2.parser.script.ActionScript3Parser;
-import com.jpexs.decompiler.flash.abc.types.Decimal;
import com.jpexs.decompiler.flash.abc.types.Float4;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
@@ -241,6 +240,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import macromedia.asc.util.Decimal128;
import org.fusesource.jansi.Ansi;
import org.fusesource.jansi.AnsiConsole;
@@ -4003,7 +4003,7 @@ public class CommandLineArgumentParser {
}
@Override
- public boolean missingDecimal(Decimal value) {
+ public boolean missingDecimal(Decimal128 value) {
return true;
}
diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java b/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java
index 0ef92bcc3..1dcfbf71f 100644
--- a/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java
+++ b/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java
@@ -26,7 +26,6 @@ import com.jpexs.decompiler.flash.abc.avm2.parser.pcode.ASM3Parser;
import com.jpexs.decompiler.flash.abc.avm2.parser.pcode.Flasm3Lexer;
import com.jpexs.decompiler.flash.abc.avm2.parser.pcode.MissingSymbolHandler;
import com.jpexs.decompiler.flash.abc.avm2.parser.pcode.ParsedSymbol;
-import com.jpexs.decompiler.flash.abc.types.Decimal;
import com.jpexs.decompiler.flash.abc.types.Float4;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
@@ -65,6 +64,7 @@ import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import javax.swing.text.BadLocationException;
import javax.swing.text.Utilities;
+import macromedia.asc.util.Decimal128;
/**
* @author JPEXS
@@ -319,7 +319,7 @@ public class ASMSourceEditorPane extends DebuggableEditorPane implements CaretLi
}
@Override
- public boolean missingDecimal(Decimal value) {
+ public boolean missingDecimal(Decimal128 value) {
return true;
}
diff --git a/src/com/jpexs/decompiler/flash/gui/abc/DialogMissingSymbolHandler.java b/src/com/jpexs/decompiler/flash/gui/abc/DialogMissingSymbolHandler.java
index 63ef17884..242b074c3 100644
--- a/src/com/jpexs/decompiler/flash/gui/abc/DialogMissingSymbolHandler.java
+++ b/src/com/jpexs/decompiler/flash/gui/abc/DialogMissingSymbolHandler.java
@@ -17,12 +17,12 @@
package com.jpexs.decompiler.flash.gui.abc;
import com.jpexs.decompiler.flash.abc.avm2.parser.pcode.MissingSymbolHandler;
-import com.jpexs.decompiler.flash.abc.types.Decimal;
import com.jpexs.decompiler.flash.abc.types.Float4;
import com.jpexs.decompiler.flash.gui.AppStrings;
import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.ViewMessages;
import javax.swing.JOptionPane;
+import macromedia.asc.util.Decimal128;
/**
* @author JPEXS
@@ -50,7 +50,7 @@ public class DialogMissingSymbolHandler implements MissingSymbolHandler {
}
@Override
- public boolean missingDecimal(Decimal value) {
+ public boolean missingDecimal(Decimal128 value) {
//I don't want to create new localizable string - it is not used at all
return true;
}